From 55ea91d473ccea32e7ea5d7283049b26920bcd69 Mon Sep 17 00:00:00 2001 From: Cheton Wu Date: Thu, 25 Apr 2019 22:37:26 +0800 Subject: [PATCH] Fixed a bug that cannot render form controls in extra small size --- README.md | 18 +++++++++--------- .../{bundle.5b79b1ec.js => bundle.2e26e54c.js} | 4 ++-- docs/index.html | 2 +- src/FormControl.jsx | 3 --- 4 files changed, 12 insertions(+), 15 deletions(-) rename docs/build/{bundle.5b79b1ec.js => bundle.2e26e54c.js} (99%) diff --git a/README.md b/README.md index 1329517..e2a7c07 100644 --- a/README.md +++ b/README.md @@ -81,27 +81,27 @@ const FormGroup = styled.div` Name | Type | Default | Description :--- | :--- | :------ | :---------- tag | element | 'div' | -lg | boolean | false | -md | boolean | true | -sm | boolean | false | +lg | boolean | | +md | boolean | | Defaults to 'md' if nothing is specified. +sm | boolean | | #### Input Name | Type | Default | Description :--- | :--- | :------ | :---------- tag | element | 'input' | -lg | boolean | false | -md | boolean | true | -sm | boolean | false | +lg | boolean | | +md | boolean | | Defaults to 'md' if nothing is specified. +sm | boolean | | #### Select Name | Type | Default | Description :--- | :--- | :------ | :---------- tag | element | 'select' | -lg | boolean | false | -md | boolean | true | -sm | boolean | false | +lg | boolean | | +md | boolean | | Defaults to 'md' if nothing is specified. +sm | boolean | | #### Textarea diff --git a/docs/build/bundle.5b79b1ec.js b/docs/build/bundle.2e26e54c.js similarity index 99% rename from docs/build/bundle.5b79b1ec.js rename to docs/build/bundle.2e26e54c.js index 8b78a4d..61efde5 100644 --- a/docs/build/bundle.5b79b1ec.js +++ b/docs/build/bundle.2e26e54c.js @@ -8159,7 +8159,7 @@ eval("\nif (false) {}\n\nvar requireMap = { 'react': __webpack_require__(/*! rea /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -eval("\nif (false) {}\n\nmodule.exports = {\n 'description': '',\n 'displayName': 'FormControl',\n 'methods': [],\n 'props': [\n {\n 'type': { 'name': 'bool' },\n 'required': false,\n 'description': '',\n 'defaultValue': {\n 'value': 'false',\n 'computed': false\n },\n 'tags': {},\n 'name': 'lg'\n },\n {\n 'type': { 'name': 'bool' },\n 'required': false,\n 'description': '',\n 'defaultValue': {\n 'value': 'true',\n 'computed': false\n },\n 'tags': {},\n 'name': 'md'\n },\n {\n 'type': { 'name': 'bool' },\n 'required': false,\n 'description': '',\n 'defaultValue': {\n 'value': 'false',\n 'computed': false\n },\n 'tags': {},\n 'name': 'sm'\n },\n {\n 'type': {\n 'name': 'custom',\n 'raw': 'sharedPropTypes.tag'\n },\n 'required': false,\n 'description': '',\n 'defaultValue': {\n 'value': '\\'div\\'',\n 'computed': false\n },\n 'tags': {},\n 'name': 'tag'\n }\n ],\n 'doclets': {},\n 'examples': null\n}\n\t\n\n//# sourceURL=webpack:///./src/FormControl.jsx?./node_modules/react-styleguidist/lib/loaders/props-loader.js"); +eval("\nif (false) {}\n\nmodule.exports = {\n 'description': '',\n 'displayName': 'FormControl',\n 'methods': [],\n 'props': [\n {\n 'type': { 'name': 'bool' },\n 'required': false,\n 'description': '',\n 'tags': {},\n 'name': 'lg'\n },\n {\n 'type': { 'name': 'bool' },\n 'required': false,\n 'description': '',\n 'tags': {},\n 'name': 'md'\n },\n {\n 'type': { 'name': 'bool' },\n 'required': false,\n 'description': '',\n 'tags': {},\n 'name': 'sm'\n },\n {\n 'type': {\n 'name': 'custom',\n 'raw': 'sharedPropTypes.tag'\n },\n 'required': false,\n 'description': '',\n 'defaultValue': {\n 'value': '\\'div\\'',\n 'computed': false\n },\n 'tags': {},\n 'name': 'tag'\n }\n ],\n 'doclets': {},\n 'examples': null\n}\n\t\n\n//# sourceURL=webpack:///./src/FormControl.jsx?./node_modules/react-styleguidist/lib/loaders/props-loader.js"); /***/ }), @@ -14209,7 +14209,7 @@ eval("module.exports = {\"name\":\"@trendmicro/react-form-control\",\"version\": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _shared_prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shared/prop-types */ \"./src/shared/prop-types.js\");\n/* harmony import */ var _index_styl__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./index.styl */ \"./src/index.styl\");\n/* harmony import */ var _index_styl__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_index_styl__WEBPACK_IMPORTED_MODULE_4__);\nfunction _extends() { _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; }; return _extends.apply(this, arguments); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n\n\n\n\n\nvar propTypes = {\n tag: _shared_prop_types__WEBPACK_IMPORTED_MODULE_3__[\"tag\"],\n lg: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,\n md: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,\n sm: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool\n};\nvar defaultProps = {\n tag: 'div',\n lg: false,\n md: true,\n sm: false\n};\n\nvar FormControl = function FormControl(_ref) {\n var _cx;\n\n var className = _ref.className,\n Tag = _ref.tag,\n lg = _ref.lg,\n md = _ref.md,\n sm = _ref.sm,\n props = _objectWithoutProperties(_ref, [\"className\", \"tag\", \"lg\", \"md\", \"sm\"]);\n\n if (lg) {\n md = false;\n sm = false;\n }\n\n if (md) {\n sm = false;\n }\n\n if (!lg && !md && !sm) {\n md = true;\n }\n\n return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(Tag, _extends({}, props, {\n className: classnames__WEBPACK_IMPORTED_MODULE_0___default()(className, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControl, (_cx = {}, _defineProperty(_cx, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControlLg, lg), _defineProperty(_cx, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControlMd, md), _defineProperty(_cx, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControlSm, sm), _cx))\n }));\n};\n\nFormControl.propTypes = propTypes;\nFormControl.defaultProps = defaultProps;\n/* harmony default export */ __webpack_exports__[\"default\"] = (FormControl);\n\n//# sourceURL=webpack:///./src/FormControl.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ \"./node_modules/classnames/index.js\");\n/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ \"./node_modules/prop-types/index.js\");\n/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _shared_prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shared/prop-types */ \"./src/shared/prop-types.js\");\n/* harmony import */ var _index_styl__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./index.styl */ \"./src/index.styl\");\n/* harmony import */ var _index_styl__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_index_styl__WEBPACK_IMPORTED_MODULE_4__);\nfunction _extends() { _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; }; return _extends.apply(this, arguments); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n\n\n\n\n\nvar propTypes = {\n tag: _shared_prop_types__WEBPACK_IMPORTED_MODULE_3__[\"tag\"],\n lg: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,\n md: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool,\n sm: prop_types__WEBPACK_IMPORTED_MODULE_1___default.a.bool\n};\nvar defaultProps = {\n tag: 'div'\n};\n\nvar FormControl = function FormControl(_ref) {\n var _cx;\n\n var className = _ref.className,\n Tag = _ref.tag,\n lg = _ref.lg,\n md = _ref.md,\n sm = _ref.sm,\n props = _objectWithoutProperties(_ref, [\"className\", \"tag\", \"lg\", \"md\", \"sm\"]);\n\n if (lg) {\n md = false;\n sm = false;\n }\n\n if (md) {\n sm = false;\n }\n\n if (!lg && !md && !sm) {\n md = true;\n }\n\n return react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(Tag, _extends({}, props, {\n className: classnames__WEBPACK_IMPORTED_MODULE_0___default()(className, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControl, (_cx = {}, _defineProperty(_cx, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControlLg, lg), _defineProperty(_cx, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControlMd, md), _defineProperty(_cx, _index_styl__WEBPACK_IMPORTED_MODULE_4___default.a.formControlSm, sm), _cx))\n }));\n};\n\nFormControl.propTypes = propTypes;\nFormControl.defaultProps = defaultProps;\n/* harmony default export */ __webpack_exports__[\"default\"] = (FormControl);\n\n//# sourceURL=webpack:///./src/FormControl.jsx?"); /***/ }), diff --git a/docs/index.html b/docs/index.html index dbd16fd..1aed143 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -React Form Control v1.0.0
\ No newline at end of file +React Form Control v1.0.0
\ No newline at end of file diff --git a/src/FormControl.jsx b/src/FormControl.jsx index e07a2d5..56eb30d 100644 --- a/src/FormControl.jsx +++ b/src/FormControl.jsx @@ -13,9 +13,6 @@ const propTypes = { const defaultProps = { tag: 'div', - lg: false, - md: true, - sm: false, }; const FormControl = ({