@pie-lib/config-ui 11.30.0-mui-update.0 → 11.30.1-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -9
- package/lib/__tests__/choice-utils.test.js +16 -0
- package/lib/__tests__/langs.test.js +55 -0
- package/lib/__tests__/number-text-field.test.js +128 -0
- package/lib/__tests__/settings-panel.test.js +201 -0
- package/lib/__tests__/two-choice.test.js +33 -0
- package/lib/alert-dialog.js +42 -23
- package/lib/alert-dialog.js.map +1 -1
- package/lib/checkbox.js +71 -56
- package/lib/checkbox.js.map +1 -1
- package/lib/choice-configuration/__tests__/feedback-menu.test.js +20 -0
- package/lib/choice-configuration/__tests__/index.test.js +119 -0
- package/lib/choice-configuration/feedback-menu.js +63 -24
- package/lib/choice-configuration/feedback-menu.js.map +1 -1
- package/lib/choice-configuration/index.js +257 -201
- package/lib/choice-configuration/index.js.map +1 -1
- package/lib/choice-utils.js +18 -6
- package/lib/choice-utils.js.map +1 -1
- package/lib/feedback-config/__tests__/feedback-config.test.js +78 -0
- package/lib/feedback-config/__tests__/feedback-selector.test.js +71 -0
- package/lib/feedback-config/feedback-selector.js +114 -77
- package/lib/feedback-config/feedback-selector.js.map +1 -1
- package/lib/feedback-config/group.js +40 -26
- package/lib/feedback-config/group.js.map +1 -1
- package/lib/feedback-config/index.js +90 -38
- package/lib/feedback-config/index.js.map +1 -1
- package/lib/form-section.js +33 -24
- package/lib/form-section.js.map +1 -1
- package/lib/help.js +80 -39
- package/lib/help.js.map +1 -1
- package/lib/index.js +31 -1
- package/lib/index.js.map +1 -1
- package/lib/input.js +54 -21
- package/lib/input.js.map +1 -1
- package/lib/inputs.js +95 -61
- package/lib/inputs.js.map +1 -1
- package/lib/langs.js +100 -56
- package/lib/langs.js.map +1 -1
- package/lib/layout/__tests__/config.layout.test.js +33 -0
- package/lib/layout/__tests__/layout-content.test.js +6 -0
- package/lib/layout/config-layout.js +99 -48
- package/lib/layout/config-layout.js.map +1 -1
- package/lib/layout/index.js +3 -0
- package/lib/layout/index.js.map +1 -1
- package/lib/layout/layout-contents.js +101 -72
- package/lib/layout/layout-contents.js.map +1 -1
- package/lib/layout/settings-box.js +56 -27
- package/lib/layout/settings-box.js.map +1 -1
- package/lib/mui-box/index.js +57 -41
- package/lib/mui-box/index.js.map +1 -1
- package/lib/number-text-field-custom.js +161 -79
- package/lib/number-text-field-custom.js.map +1 -1
- package/lib/number-text-field.js +115 -57
- package/lib/number-text-field.js.map +1 -1
- package/lib/radio-with-label.js +31 -23
- package/lib/radio-with-label.js.map +1 -1
- package/lib/settings/display-size.js +32 -16
- package/lib/settings/display-size.js.map +1 -1
- package/lib/settings/index.js +47 -14
- package/lib/settings/index.js.map +1 -1
- package/lib/settings/panel.js +228 -142
- package/lib/settings/panel.js.map +1 -1
- package/lib/settings/settings-radio-label.js +30 -21
- package/lib/settings/settings-radio-label.js.map +1 -1
- package/lib/settings/toggle.js +46 -34
- package/lib/settings/toggle.js.map +1 -1
- package/lib/tabs/index.js +57 -22
- package/lib/tabs/index.js.map +1 -1
- package/lib/tags-input/__tests__/index.test.js +88 -0
- package/lib/tags-input/index.js +99 -50
- package/lib/tags-input/index.js.map +1 -1
- package/lib/two-choice.js +90 -46
- package/lib/two-choice.js.map +1 -1
- package/lib/with-stateful-model.js +31 -8
- package/lib/with-stateful-model.js.map +1 -1
- package/package.json +10 -12
- package/src/__tests__/number-text-field.test.jsx +1 -1
- package/src/alert-dialog.jsx +18 -14
- package/src/checkbox.jsx +46 -42
- package/src/choice-configuration/feedback-menu.jsx +5 -5
- package/src/choice-configuration/index.jsx +193 -205
- package/src/feedback-config/feedback-selector.jsx +53 -51
- package/src/feedback-config/group.jsx +22 -21
- package/src/feedback-config/index.jsx +29 -27
- package/src/form-section.jsx +18 -18
- package/src/help.jsx +28 -20
- package/src/input.jsx +1 -1
- package/src/inputs.jsx +50 -34
- package/src/langs.jsx +46 -40
- package/src/layout/config-layout.jsx +36 -25
- package/src/layout/layout-contents.jsx +34 -34
- package/src/layout/settings-box.jsx +19 -16
- package/src/mui-box/index.jsx +43 -35
- package/src/number-text-field-custom.jsx +36 -30
- package/src/number-text-field.jsx +30 -22
- package/src/radio-with-label.jsx +13 -17
- package/src/settings/display-size.jsx +11 -12
- package/src/settings/panel.jsx +89 -83
- package/src/settings/settings-radio-label.jsx +13 -17
- package/src/settings/toggle.jsx +29 -29
- package/src/tabs/index.jsx +8 -8
- package/src/tags-input/index.jsx +38 -35
- package/src/two-choice.jsx +19 -15
- package/LICENSE.md +0 -5
- package/NEXT.CHANGELOG.json +0 -1
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;;;;AACA;;AACA;;AACA;;AAEA","sourcesContent":["import AlertDialog from './alert-dialog';\nimport FeedbackConfig, { FeedbackSelector, buildDefaults as feedbackConfigDefaults } from './feedback-config';\nimport { InputCheckbox, InputSwitch, InputRadio } from './inputs';\nimport Langs, { LanguageControls } from './langs';\nimport Tabs from './tabs';\nimport Checkbox from './checkbox';\nimport FormSection from './form-section';\nimport Help from './help';\nimport Input from './input';\nimport { InputContainer } from '@pie-lib/render-ui';\nimport NumberTextField from './number-text-field';\nimport NumberTextFieldCustom from './number-text-field-custom';\nimport TwoChoice, { NChoice } from './two-choice';\nimport TagsInput from './tags-input';\nimport MuiBox from './mui-box';\nimport ChoiceConfiguration from './choice-configuration';\nimport * as layout from './layout';\n\nimport * as choiceUtils from './choice-utils';\nimport withStatefulModel from './with-stateful-model';\nimport Toggle from './settings/toggle';\nimport DisplaySize from './settings/display-size';\n\nimport * as settings from './settings';\n\nexport {\n AlertDialog,\n FeedbackConfig,\n FeedbackSelector,\n feedbackConfigDefaults,\n InputCheckbox,\n InputSwitch,\n InputRadio,\n Langs,\n LanguageControls,\n Tabs,\n Checkbox,\n FormSection,\n Help,\n Input,\n InputContainer,\n NumberTextField,\n NumberTextFieldCustom,\n TwoChoice,\n NChoice,\n TagsInput,\n MuiBox,\n ChoiceConfiguration,\n layout,\n choiceUtils,\n withStatefulModel,\n Toggle,\n DisplaySize,\n settings,\n};\n"],"file":"index.js"}
|
package/lib/input.js
CHANGED
|
@@ -1,38 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports["default"] = void 0;
|
|
11
|
+
|
|
9
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
10
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
11
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
12
18
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
13
24
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
14
26
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
|
|
27
|
+
|
|
16
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
17
30
|
var React = _interopRequireWildcard(require("react"));
|
|
31
|
+
|
|
18
32
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
33
|
+
|
|
34
|
+
var _Input = _interopRequireDefault(require("@material-ui/core/Input"));
|
|
35
|
+
|
|
20
36
|
var _renderUi = require("@pie-lib/render-ui");
|
|
37
|
+
|
|
21
38
|
var _excluded = ["label", "type", "noModelUpdateOnError"];
|
|
22
|
-
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
var
|
|
39
|
+
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
|
+
|
|
42
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
+
|
|
44
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
45
|
+
|
|
46
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
+
|
|
48
|
+
var Input = /*#__PURE__*/function (_React$Component) {
|
|
49
|
+
(0, _inherits2["default"])(Input, _React$Component);
|
|
50
|
+
|
|
51
|
+
var _super = _createSuper(Input);
|
|
52
|
+
|
|
26
53
|
function Input(props) {
|
|
27
54
|
var _this;
|
|
55
|
+
|
|
28
56
|
(0, _classCallCheck2["default"])(this, Input);
|
|
29
|
-
_this =
|
|
30
|
-
(0, _defineProperty2["default"])(_this, "onChange", function (event) {
|
|
57
|
+
_this = _super.call(this, props);
|
|
58
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (event) {
|
|
31
59
|
var _this$props = _this.props,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
60
|
+
type = _this$props.type,
|
|
61
|
+
onChange = _this$props.onChange,
|
|
62
|
+
error = _this$props.error;
|
|
35
63
|
var value = event.target.value;
|
|
64
|
+
|
|
36
65
|
if (error(value, type)) {
|
|
37
66
|
_this.setState({
|
|
38
67
|
error: true,
|
|
@@ -43,6 +72,7 @@ var Input = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
|
43
72
|
error: false,
|
|
44
73
|
value: event.target.value
|
|
45
74
|
});
|
|
75
|
+
|
|
46
76
|
onChange(event);
|
|
47
77
|
}
|
|
48
78
|
});
|
|
@@ -51,8 +81,8 @@ var Input = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
|
51
81
|
};
|
|
52
82
|
return _this;
|
|
53
83
|
}
|
|
54
|
-
|
|
55
|
-
|
|
84
|
+
|
|
85
|
+
(0, _createClass2["default"])(Input, [{
|
|
56
86
|
key: "UNSAFE_componentWillReceiveProps",
|
|
57
87
|
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
58
88
|
this.setState({
|
|
@@ -63,22 +93,22 @@ var Input = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
|
63
93
|
key: "render",
|
|
64
94
|
value: function render() {
|
|
65
95
|
var _this$props2 = this.props,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
96
|
+
label = _this$props2.label,
|
|
97
|
+
type = _this$props2.type,
|
|
98
|
+
noModelUpdateOnError = _this$props2.noModelUpdateOnError,
|
|
99
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded);
|
|
70
100
|
var _this$state = this.state,
|
|
71
|
-
|
|
72
|
-
|
|
101
|
+
value = _this$state.value,
|
|
102
|
+
error = _this$state.error;
|
|
73
103
|
return label ? /*#__PURE__*/React.createElement(_renderUi.InputContainer, {
|
|
74
104
|
label: label
|
|
75
|
-
}, /*#__PURE__*/React.createElement(
|
|
105
|
+
}, /*#__PURE__*/React.createElement(_Input["default"], (0, _extends2["default"])({
|
|
76
106
|
type: type
|
|
77
107
|
}, rest, {
|
|
78
108
|
value: value,
|
|
79
109
|
onChange: this.onChange,
|
|
80
110
|
error: error
|
|
81
|
-
}))) : /*#__PURE__*/React.createElement(
|
|
111
|
+
}))) : /*#__PURE__*/React.createElement(_Input["default"], (0, _extends2["default"])({
|
|
82
112
|
type: type
|
|
83
113
|
}, rest, {
|
|
84
114
|
value: value,
|
|
@@ -87,7 +117,10 @@ var Input = exports["default"] = /*#__PURE__*/function (_React$Component) {
|
|
|
87
117
|
}));
|
|
88
118
|
}
|
|
89
119
|
}]);
|
|
120
|
+
return Input;
|
|
90
121
|
}(React.Component);
|
|
122
|
+
|
|
123
|
+
exports["default"] = Input;
|
|
91
124
|
(0, _defineProperty2["default"])(Input, "propTypes", {
|
|
92
125
|
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
93
126
|
onChange: _propTypes["default"].func.isRequired,
|
package/lib/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/input.jsx"],"names":["Input","props","event","type","onChange","error","value","target","setState","state","newProps","label","noModelUpdateOnError","rest","React","Component","PropTypes","oneOfType","string","number","func","isRequired","bool","isNaN"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;IAEqBA,K;;;;;AAgBnB,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,iGAcR,UAACC,KAAD,EAAW;AACpB,wBAAkC,MAAKD,KAAvC;AAAA,UAAQE,IAAR,eAAQA,IAAR;AAAA,UAAcC,QAAd,eAAcA,QAAd;AAAA,UAAwBC,KAAxB,eAAwBA,KAAxB;AACA,UAAMC,KAAK,GAAGJ,KAAK,CAACK,MAAN,CAAaD,KAA3B;;AAEA,UAAID,KAAK,CAACC,KAAD,EAAQH,IAAR,CAAT,EAAwB;AACtB,cAAKK,QAAL,CAAc;AACZH,UAAAA,KAAK,EAAE,IADK;AAEZC,UAAAA,KAAK,EAAEJ,KAAK,CAACK,MAAN,CAAaD;AAFR,SAAd;AAID,OALD,MAKO;AACL,cAAKE,QAAL,CAAc;AACZH,UAAAA,KAAK,EAAE,KADK;AAEZC,UAAAA,KAAK,EAAEJ,KAAK,CAACK,MAAN,CAAaD;AAFR,SAAd;;AAKAF,QAAAA,QAAQ,CAACF,KAAD,CAAR;AACD;AACF,KA/BkB;AAGjB,UAAKO,KAAL,GAAa;AACXH,MAAAA,KAA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oB,EAAEI,sBAAUM;AANf,C;iCADAtB,K,kBAUG;AACpBG,EAAAA,IAAI,EAAE,MADc;AAEpBE,EAAAA,KAAK,EAAE,eAACC,KAAD,EAAQH,IAAR;AAAA,WAAkBA,IAAI,KAAK,QAAT,GAAoB,CAACG,KAAD,IAAUiB,KAAK,CAACjB,KAAD,CAAnC,GAA6C,CAACA,KAAhE;AAAA,GAFa;AAGpBM,EAAAA,oBAAoB,EAAE;AAHF,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { default as MaterialInput } from '@material-ui/core/Input';\nimport { InputContainer } from '@pie-lib/render-ui';\n\nexport default class Input extends React.Component {\n static propTypes = {\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onChange: PropTypes.func.isRequired,\n label: PropTypes.string,\n type: PropTypes.string.isRequired,\n error: PropTypes.func,\n noModelUpdateOnError: PropTypes.bool,\n };\n\n static defaultProps = {\n type: 'text',\n error: (value, type) => (type === 'number' ? !value || isNaN(value) : !value),\n noModelUpdateOnError: false,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n value: props.value,\n };\n }\n\n UNSAFE_componentWillReceiveProps(newProps) {\n this.setState({\n value: newProps.value,\n });\n }\n\n onChange = (event) => {\n const { type, onChange, error } = this.props;\n const value = event.target.value;\n\n if (error(value, type)) {\n this.setState({\n error: true,\n value: event.target.value,\n });\n } else {\n this.setState({\n error: false,\n value: event.target.value,\n });\n\n onChange(event);\n }\n };\n\n render() {\n const {\n label,\n type,\n noModelUpdateOnError, // eslint-disable-line no-unused-vars\n ...rest\n } = this.props;\n const { value, error } = this.state;\n\n return label ? (\n <InputContainer label={label}>\n <MaterialInput type={type} {...rest} value={value} onChange={this.onChange} error={error} />\n </InputContainer>\n ) : (\n <MaterialInput type={type} {...rest} value={value} onChange={this.onChange} error={error} />\n );\n }\n}\n"],"file":"input.js"}
|
package/lib/inputs.js
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.InputSwitch = exports.InputRadio = exports.InputCheckbox = void 0;
|
|
9
|
+
|
|
8
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
+
|
|
12
|
+
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
13
|
+
|
|
14
|
+
var _Radio = _interopRequireDefault(require("@material-ui/core/Radio"));
|
|
15
|
+
|
|
11
16
|
var _renderUi = require("@pie-lib/render-ui");
|
|
17
|
+
|
|
12
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
13
20
|
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
|
|
22
|
+
var _Switch = _interopRequireDefault(require("@material-ui/core/Switch"));
|
|
23
|
+
|
|
24
|
+
var _styles = require("@material-ui/core/styles");
|
|
25
|
+
|
|
26
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
|
+
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
+
|
|
18
32
|
var InputTypes = {
|
|
33
|
+
classes: _propTypes["default"].object.isRequired,
|
|
19
34
|
className: _propTypes["default"].string,
|
|
20
35
|
label: _propTypes["default"].string,
|
|
21
36
|
checked: _propTypes["default"].bool,
|
|
@@ -23,83 +38,102 @@ var InputTypes = {
|
|
|
23
38
|
disabled: _propTypes["default"].bool,
|
|
24
39
|
error: _propTypes["default"].string
|
|
25
40
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var className = _ref.className,
|
|
34
|
-
label = _ref.label,
|
|
35
|
-
checked = _ref.checked,
|
|
36
|
-
onChange = _ref.onChange;
|
|
41
|
+
|
|
42
|
+
var RawInputSwitch = function RawInputSwitch(_ref) {
|
|
43
|
+
var classes = _ref.classes,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
label = _ref.label,
|
|
46
|
+
checked = _ref.checked,
|
|
47
|
+
onChange = _ref.onChange;
|
|
37
48
|
return /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
|
|
38
49
|
className: className,
|
|
39
50
|
label: label
|
|
40
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
51
|
+
}, /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
52
|
+
className: classes.switchRoot,
|
|
41
53
|
checked: checked,
|
|
42
54
|
onChange: onChange,
|
|
43
55
|
"aria-label": label
|
|
44
56
|
}));
|
|
45
57
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
transform: 'translate(-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
|
|
59
|
+
RawInputSwitch.propTypes = _objectSpread({}, InputTypes);
|
|
60
|
+
var InputSwitch = (0, _styles.withStyles)({
|
|
61
|
+
switchRoot: {
|
|
62
|
+
justifyContent: 'inherit',
|
|
63
|
+
transform: 'translate(-20%, 20%)'
|
|
64
|
+
}
|
|
65
|
+
})(RawInputSwitch);
|
|
66
|
+
exports.InputSwitch = InputSwitch;
|
|
67
|
+
|
|
68
|
+
var RawInputCheckbox = function RawInputCheckbox(props) {
|
|
69
|
+
var classes = props.classes,
|
|
70
|
+
className = props.className,
|
|
71
|
+
label = props.label,
|
|
72
|
+
checked = props.checked,
|
|
73
|
+
onChange = props.onChange,
|
|
74
|
+
disabled = props.disabled,
|
|
75
|
+
error = props.error;
|
|
64
76
|
return /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
|
|
65
77
|
className: className,
|
|
66
78
|
label: label
|
|
67
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
79
|
+
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
80
|
+
className: (0, _classnames["default"])(classes.checkboxRoot, classes.customColor, error && classes.error),
|
|
68
81
|
disabled: disabled,
|
|
69
82
|
checked: checked,
|
|
70
83
|
onChange: onChange,
|
|
71
|
-
"aria-label": label
|
|
72
|
-
error: error
|
|
84
|
+
"aria-label": label
|
|
73
85
|
}));
|
|
74
86
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var InputRadio = exports.InputRadio = function InputRadio(_ref5) {
|
|
87
|
-
var className = _ref5.className,
|
|
88
|
-
label = _ref5.label,
|
|
89
|
-
checked = _ref5.checked,
|
|
90
|
-
onChange = _ref5.onChange,
|
|
91
|
-
disabled = _ref5.disabled,
|
|
92
|
-
error = _ref5.error;
|
|
87
|
+
|
|
88
|
+
RawInputCheckbox.propTypes = _objectSpread({}, InputTypes);
|
|
89
|
+
|
|
90
|
+
var RawInputRadio = function RawInputRadio(props) {
|
|
91
|
+
var classes = props.classes,
|
|
92
|
+
className = props.className,
|
|
93
|
+
label = props.label,
|
|
94
|
+
checked = props.checked,
|
|
95
|
+
onChange = props.onChange,
|
|
96
|
+
disabled = props.disabled,
|
|
97
|
+
error = props.error;
|
|
93
98
|
return /*#__PURE__*/_react["default"].createElement(_renderUi.InputContainer, {
|
|
94
99
|
className: className,
|
|
95
100
|
label: label
|
|
96
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
102
|
+
className: (0, _classnames["default"])(classes.radioRoot, classes.customColor, error && classes.error),
|
|
97
103
|
disabled: disabled,
|
|
98
104
|
checked: checked,
|
|
99
105
|
onChange: onChange,
|
|
100
|
-
"aria-label": label
|
|
101
|
-
error: error
|
|
106
|
+
"aria-label": label
|
|
102
107
|
}));
|
|
103
108
|
};
|
|
104
|
-
|
|
109
|
+
|
|
110
|
+
RawInputRadio.propTypes = _objectSpread({}, InputTypes);
|
|
111
|
+
var InputCheckbox = (0, _styles.withStyles)(function (theme) {
|
|
112
|
+
return {
|
|
113
|
+
checkboxRoot: {
|
|
114
|
+
transform: 'translate(-25%, 20%)'
|
|
115
|
+
},
|
|
116
|
+
error: {
|
|
117
|
+
color: theme.palette.error.main
|
|
118
|
+
},
|
|
119
|
+
customColor: {
|
|
120
|
+
color: "".concat(_renderUi.color.tertiary(), " !important")
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
})(RawInputCheckbox);
|
|
124
|
+
exports.InputCheckbox = InputCheckbox;
|
|
125
|
+
var InputRadio = (0, _styles.withStyles)(function (theme) {
|
|
126
|
+
return {
|
|
127
|
+
radioRoot: {
|
|
128
|
+
transform: 'translate(-20%, 20%)'
|
|
129
|
+
},
|
|
130
|
+
error: {
|
|
131
|
+
color: theme.palette.error.main
|
|
132
|
+
},
|
|
133
|
+
customColor: {
|
|
134
|
+
color: "".concat(_renderUi.color.tertiary(), " !important")
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
})(RawInputRadio);
|
|
138
|
+
exports.InputRadio = InputRadio;
|
|
105
139
|
//# sourceMappingURL=inputs.js.map
|
package/lib/inputs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/inputs.jsx"],"names":["InputTypes","classes","PropTypes","object","isRequired","className","string","label","checked","bool","onChange","func","disabled","error","RawInputSwitch","switchRoot","propTypes","InputSwitch","justifyContent","transform","RawInputCheckbox","props","checkboxRoot","customColor","RawInputRadio","radioRoot","InputCheckbox","theme","color","palette","main","tertiary","InputRadio"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,IAAMA,UAAU,GAAG;AACjBC,EAAAA,OAAO,EAAEC,sBAAUC,MAAV,CAAiBC,UADT;AAEjBC,EAAAA,SAAS,EAAEH,sBAAUI,MAFJ;AAGjBC,EAAAA,KAAK,EAAEL,sBAAUI,MAHA;AAIjBE,EAAAA,OAAO,EAAEN,sBAAUO,IAJF;AAKjBC,EAAAA,QAAQ,EAAER,sBAAUS,IALH;AAMjBC,EAAAA,QAAQ,EAAEV,sBAAUO,IANH;AAOjBI,EAAAA,KAAK,EAAEX,sBAAUI;AAPA,CAAnB;;AAUA,IAAMQ,cAAc,GAAG,SAAjBA,cAAiB,OAAsD;AAAA,MAAnDb,OAAmD,QAAnDA,OAAmD;AAAA,MAA1CI,SAA0C,QAA1CA,SAA0C;AAAA,MAA/BE,KAA+B,QAA/BA,KAA+B;AAAA,MAAxBC,OAAwB,QAAxBA,OAAwB;AAAA,MAAfE,QAAe,QAAfA,QAAe;AAC3E,sBACE,gCAAC,wBAAD;AAAgB,IAAA,SAAS,EAAEL,SAA3B;AAAsC,IAAA,KAAK,EAAEE;AAA7C,k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,CAAtB;;AAYA,IAAMY,UAAU,GAAG,wBAAW,UAACL,KAAD;AAAA,SAAY;AACxCF,IAAAA,SAAS,EAAE;AACTN,MAAAA,SAAS,EAAE;AADF,KAD6B;AAIxCN,IAAAA,KAAK,EAAE;AACLe,MAAAA,KAAK,EAAED,KAAK,CAACE,OAAN,CAAchB,KAAd,CAAoBiB;AADtB,KAJiC;AAOxCP,IAAAA,WAAW,EAAE;AACXK,MAAAA,KAAK,YAAKA,gBAAMG,QAAN,EAAL;AADM;AAP2B,GAAZ;AAAA,CAAX,EAUfP,aAVe,CAAnB","sourcesContent":["import Checkbox from '@material-ui/core/Checkbox';\nimport Radio from '@material-ui/core/Radio';\nimport { InputContainer } from '@pie-lib/render-ui';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport Switch from '@material-ui/core/Switch';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nconst InputTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n label: PropTypes.string,\n checked: PropTypes.bool,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n error: PropTypes.string,\n};\n\nconst RawInputSwitch = ({ classes, className, label, checked, onChange }) => {\n return (\n <InputContainer className={className} label={label}>\n <Switch className={classes.switchRoot} checked={checked} onChange={onChange} aria-label={label} />\n </InputContainer>\n );\n};\n\nRawInputSwitch.propTypes = { ...InputTypes };\n\nconst InputSwitch = withStyles({\n switchRoot: {\n justifyContent: 'inherit',\n transform: 'translate(-20%, 20%)',\n },\n})(RawInputSwitch);\n\nconst RawInputCheckbox = (props) => {\n const { classes, className, label, checked, onChange, disabled, error } = props;\n\n return (\n <InputContainer className={className} label={label}>\n <Checkbox\n className={classNames(classes.checkboxRoot, classes.customColor, error && classes.error)}\n disabled={disabled}\n checked={checked}\n onChange={onChange}\n aria-label={label}\n />\n </InputContainer>\n );\n};\n\nRawInputCheckbox.propTypes = { ...InputTypes };\n\nconst RawInputRadio = (props) => {\n const { classes, className, label, checked, onChange, disabled, error } = props;\n\n return (\n <InputContainer className={className} label={label}>\n <Radio\n className={classNames(classes.radioRoot, classes.customColor, error && classes.error)}\n disabled={disabled}\n checked={checked}\n onChange={onChange}\n aria-label={label}\n />\n </InputContainer>\n );\n};\n\nRawInputRadio.propTypes = { ...InputTypes };\n\nconst InputCheckbox = withStyles((theme) => ({\n checkboxRoot: {\n transform: 'translate(-25%, 20%)',\n },\n error: {\n color: theme.palette.error.main,\n },\n customColor: {\n color: `${color.tertiary()} !important`,\n },\n}))(RawInputCheckbox);\n\nconst InputRadio = withStyles((theme) => ({\n radioRoot: {\n transform: 'translate(-20%, 20%)',\n },\n error: {\n color: theme.palette.error.main,\n },\n customColor: {\n color: `${color.tertiary()} !important`,\n },\n}))(RawInputRadio);\n\nexport { InputSwitch, InputCheckbox, InputRadio };\n"],"file":"inputs.js"}
|