Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Commit

Permalink
Add lib under git so we can npm install from github
Browse files Browse the repository at this point in the history
  • Loading branch information
terebentina committed Aug 26, 2016
1 parent 31c2809 commit 023afdc
Show file tree
Hide file tree
Showing 16 changed files with 631 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/coverage
/demo/dist
/es
/lib
/node_modules
/umd
npm-debug.log*
Expand Down
26 changes: 26 additions & 0 deletions lib/components/Box.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use strict";

exports.__esModule = true;

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Box(_ref) {
var children = _ref.children;

return _react2.default.createElement(
"div",
{ className: "box" },
children
);
}

process.env.NODE_ENV !== "production" ? Box.propTypes = {
children: _react.PropTypes.any
} : void 0;

exports.default = Box;
module.exports = exports["default"];
45 changes: 45 additions & 0 deletions lib/components/Control.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Control(_ref) {
var children = _ref.children;
var className = _ref.className;
var type = _ref.type;
var addonPosition = _ref.addonPosition;

var cName = 'control';
if (type == 'group') {
cName += ' is-grouped';
} else if (type == 'addons') {
cName += ' has-addons';
}
if (className) {
cName += ' ' + className;
}
if (addonPosition && addonPosition != 'left') {
cName += ' has-addons-' + addonPosition;
}

return _react2.default.createElement(
'div',
{ className: cName },
children
);
}

process.env.NODE_ENV !== "production" ? Control.propTypes = {
children: _react.PropTypes.any,
className: _react.PropTypes.string,
type: _react.PropTypes.oneOf(['group', 'addons']),
addonPosition: _react.PropTypes.oneOf(['left', 'centered', 'right'])
} : void 0;

exports.default = Control;
module.exports = exports['default'];
33 changes: 33 additions & 0 deletions lib/components/Icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Icon(_ref) {
var name = _ref.name;
var size = _ref.size;

var cName = 'icon';
if (size) {
cName += ' is-' + size;
}

return _react2.default.createElement(
'span',
{ className: cName },
_react2.default.createElement('i', { className: 'fa fa-' + name })
);
}

process.env.NODE_ENV !== "production" ? Icon.propTypes = {
name: _react.PropTypes.string.isRequired,
size: _react.PropTypes.oneOf(['small', 'medium', 'large'])
} : void 0;

exports.default = Icon;
module.exports = exports['default'];
122 changes: 122 additions & 0 deletions lib/components/Input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _Control = require('./Control');

var _Control2 = _interopRequireDefault(_Control);

var _Icon = require('./Icon');

var _Icon2 = _interopRequireDefault(_Icon);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Input(_ref) {
var value = _ref.value;
var name = _ref.name;
var id = _ref.id;
var label = _ref.label;
var placeholder = _ref.placeholder;
var expanded = _ref.expanded;
var type = _ref.type;
var size = _ref.size;
var state = _ref.state;
var message = _ref.message;
var icon = _ref.icon;
var iconPosition = _ref.iconPosition;
var onChange = _ref.onChange;

var inputClassName = 'input';
var controlClassName = '';
var messageClassName = 'help';

if (type) {
inputClassName += ' is-' + type;
messageClassName += ' is-' + type;
}
if (size) {
inputClassName += ' is-' + size;
}
if (icon) {
controlClassName += ' has-icon';
if (iconPosition == 'right') {
controlClassName += ' has-icon-right';
}
}
if (state == 'loading') {
controlClassName += ' is-loading';
}
if (expanded) {
inputClassName += ' is-expanded';
}

var input = _react2.default.createElement('input', {
value: value,
className: inputClassName,
type: 'text',
name: name,
id: id,
placeholder: placeholder,
disabled: state == 'disabled',
onChange: onChange
});

if (label) {
return _react2.default.createElement(
'div',
null,
_react2.default.createElement(
'label',
{ className: 'label', htmlFor: id },
label
),
_react2.default.createElement(
_Control2.default,
{ className: controlClassName },
input,
icon && _react2.default.createElement(_Icon2.default, { name: icon }),
message && _react2.default.createElement(
'span',
{ className: messageClassName },
message
)
)
);
}

return _react2.default.createElement(
_Control2.default,
{ className: controlClassName },
input,
icon && _react2.default.createElement(_Icon2.default, { name: icon }),
message && _react2.default.createElement(
'span',
{ className: messageClassName },
message
)
);
}

process.env.NODE_ENV !== "production" ? Input.propTypes = {
value: _react.PropTypes.string,
name: _react.PropTypes.string,
id: _react.PropTypes.string,
label: _react.PropTypes.string,
placeholder: _react.PropTypes.string,
expanded: _react.PropTypes.bool,
type: _react.PropTypes.oneOf(['primary', 'info', 'success', 'warning', 'danger']),
size: _react.PropTypes.oneOf(['small', 'medium', 'large']),
state: _react.PropTypes.oneOf(['loading', 'disabled']),
message: _react.PropTypes.string,
icon: _react.PropTypes.any,
iconPosition: _react.PropTypes.oneOf(['left', 'right']),
onChange: _react.PropTypes.func.isRequired
} : void 0;

exports.default = Input;
module.exports = exports['default'];
58 changes: 58 additions & 0 deletions lib/components/Link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _Icon = require('./Icon');

var _Icon2 = _interopRequireDefault(_Icon);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Link(_ref) {
var children = _ref.children;
var type = _ref.type;
var size = _ref.size;
var style = _ref.style;
var state = _ref.state;
var icon = _ref.icon;
var iconPosition = _ref.iconPosition;

var className = 'button';
if (type) {
className += ' is-' + type;
}
if (size) {
className += ' is-' + size;
}
if (style) {
className += ' is-' + style;
}
if (state) {
className += ' is-' + state;
}

return _react2.default.createElement(
'a',
{ className: className },
iconPosition == 'left' && icon && _react2.default.createElement(_Icon2.default, { name: icon }),
children,
iconPosition == 'right' && icon && _react2.default.createElement(_Icon2.default, { name: icon })
);
}

process.env.NODE_ENV !== "production" ? Link.propTypes = {
children: _react.PropTypes.any,
type: _react.PropTypes.oneOf(['primary', 'info', 'success', 'warning', 'danger', 'link']),
size: _react.PropTypes.oneOf(['small', 'medium', 'large']),
style: _react.PropTypes.oneOf(['outlined', 'inverted']),
state: _react.PropTypes.oneOf(['loading', 'active', 'disabled']),
icon: _react.PropTypes.string,
iconPosition: _react.PropTypes.oneOf(['left', 'right'])
} : void 0;

exports.default = Link;
module.exports = exports['default'];
36 changes: 36 additions & 0 deletions lib/components/Notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Notification(_ref) {
var children = _ref.children;
var type = _ref.type;
var hasClose = _ref.hasClose;

var cName = 'notification';
if (type) {
cName += ' is-' + type;
}

return _react2.default.createElement(
'div',
{ className: cName },
hasClose && _react2.default.createElement('button', { className: 'delete' }),
children
);
}

process.env.NODE_ENV !== "production" ? Notification.propTypes = {
children: _react.PropTypes.any,
type: _react.PropTypes.oneOf(['primary', 'info', 'success', 'warning', 'danger']),
hasClose: _react.PropTypes.bool
} : void 0;

exports.default = Notification;
module.exports = exports['default'];
41 changes: 41 additions & 0 deletions lib/components/Tag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

exports.__esModule = true;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function Tag(_ref) {
var children = _ref.children;
var type = _ref.type;
var size = _ref.size;
var hasClose = _ref.hasClose;

var className = 'tag';
if (type) {
className += ' is-' + type;
}
if (size) {
className += ' is-' + size;
}

return _react2.default.createElement(
'span',
{ className: className },
children,
hasClose && _react2.default.createElement('button', { className: 'delete' })
);
}

process.env.NODE_ENV !== "production" ? Tag.propTypes = {
children: _react.PropTypes.any,
type: _react.PropTypes.oneOf(['dark', 'primary', 'info', 'success', 'warning', 'danger']),
size: _react.PropTypes.oneOf(['small', 'medium', 'large']),
hasClose: _react.PropTypes.bool
} : void 0;

exports.default = Tag;
module.exports = exports['default'];
Loading

0 comments on commit 023afdc

Please sign in to comment.