fk-react-ui-components
Version:
Step 1 : Create a file in [ Seeds / Plants / Trees ] <br> Step 2 : It should export an Object with component name and story Component [Refer other components] <br> Step 3 : Story Component should return a react component <br> Step 3 : Created file should
89 lines (66 loc) • 4.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _templateObject = _taggedTemplateLiteral(['\n fontweight: 500;\n display: block;\n padding: ', ';\n border-radius: 4px;\n border: ', ';\n height: 30px;\n width: ', ';\n height: ', ';\n max-width: ', ';\n margin: ', ';\n font-size: ', ';\n -webkit-appearance: ', ';\n -moz-appearance: ', ';\n outline: ', ';\n color: ', ';\n float: ', ';\n text-transform: capitalize;\n\n &:disabled {\n background-color: #eeeeee75;\n }\n'], ['\n fontweight: 500;\n display: block;\n padding: ', ';\n border-radius: 4px;\n border: ', ';\n height: 30px;\n width: ', ';\n height: ', ';\n max-width: ', ';\n margin: ', ';\n font-size: ', ';\n -webkit-appearance: ', ';\n -moz-appearance: ', ';\n outline: ', ';\n color: ', ';\n float: ', ';\n text-transform: capitalize;\n\n &:disabled {\n background-color: #eeeeee75;\n }\n']);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _styledComponents = require('styled-components');
var _styledComponents2 = _interopRequireDefault(_styledComponents);
var _colorCodes = require('../../colorCodes');
var _FormElement2 = require('../FormElement');
var _FormElement3 = _interopRequireDefault(_FormElement2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var StyledSelect = _styledComponents2.default.select(_templateObject, function (props) {
return props.padding || '7px';
}, function (props) {
return props.border || '1px solid ' + _colorCodes.colors.inputBorder;
}, function (props) {
return props.width || '100%';
}, function (props) {
return props.height || '100%';
}, function (props) {
return props.maxWidth || 'none';
}, function (props) {
return props.margin || 'none';
}, function (props) {
return props.fontSize || '13px';
}, function (props) {
return props.appearance || 'normal';
}, function (props) {
return props.appearance || 'normal';
}, function (props) {
return props.outline;
}, function (props) {
return props.color;
}, function (props) {
return props.float;
});
var Select = function (_FormElement) {
_inherits(Select, _FormElement);
function Select() {
_classCallCheck(this, Select);
return _possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).apply(this, arguments));
}
_createClass(Select, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
StyledSelect,
_extends({
value: this.state.value,
onChange: this.handleChange
}, this.props),
this.props.children
);
}
}]);
return Select;
}(_FormElement3.default);
exports.default = Select;