@maif/react-forms 1.0.5 → 1.0.6

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.
@@ -54,6 +54,14 @@ and limitations under the License.
54
54
 
55
55
  /*! showdown v 1.9.1 - 02-11-2019 */
56
56
 
57
+ /**
58
+ * A better abstraction over CSS.
59
+ *
60
+ * @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
61
+ * @website https://github.com/cssinjs/jss
62
+ * @license MIT
63
+ */
64
+
57
65
  /** @license React v0.20.2
58
66
  * scheduler.production.min.js
59
67
  *
package/lib/form.d.ts CHANGED
@@ -5,7 +5,7 @@ export function Form({ schema, flow, value, inputWrapper, onSubmit, footer, styl
5
5
  inputWrapper: any;
6
6
  onSubmit: any;
7
7
  footer: any;
8
- style: any;
8
+ style?: {} | undefined;
9
9
  className: any;
10
10
  options?: {} | undefined;
11
11
  }): JSX.Element;
package/lib/form.js CHANGED
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Form = void 0;
7
7
 
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
8
10
  var _yup = require("@hookform/resolvers/yup");
9
11
 
10
12
  var _classnames = _interopRequireDefault(require("classnames"));
11
13
 
12
- var _react = _interopRequireWildcard(require("react"));
13
-
14
14
  var _reactFeather = require("react-feather");
15
15
 
16
16
  var _reactHookForm = require("react-hook-form");
@@ -23,6 +23,8 @@ var _uuid = require("uuid");
23
23
 
24
24
  var yup = _interopRequireWildcard(require("yup"));
25
25
 
26
+ var _styleContext = require("./styleContext");
27
+
26
28
  var _type = require("./type");
27
29
 
28
30
  var _format = require("./format");
@@ -33,12 +35,12 @@ var _index2 = require("./resolvers/index");
33
35
 
34
36
  var _Option = require("./Option");
35
37
 
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
+
36
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); }
37
41
 
38
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; }
39
43
 
40
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
41
-
42
44
  function _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); }
43
45
 
44
46
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -171,10 +173,12 @@ var Form = function Form(_ref2) {
171
173
  inputWrapper = _ref2.inputWrapper,
172
174
  onSubmit = _ref2.onSubmit,
173
175
  footer = _ref2.footer,
174
- style = _ref2.style,
176
+ _ref2$style = _ref2.style,
177
+ style = _ref2$style === void 0 ? {} : _ref2$style,
175
178
  className = _ref2.className,
176
179
  _ref2$options = _ref2.options,
177
180
  options = _ref2$options === void 0 ? {} : _ref2$options;
181
+ var classes = (0, _styleContext.useCustomStyle)(style);
178
182
  var formFlow = flow || Object.keys(schema);
179
183
 
180
184
  var maybeCustomHttpClient = function maybeCustomHttpClient(url, method) {
@@ -203,39 +207,63 @@ var Form = function Form(_ref2) {
203
207
  return resolver;
204
208
  };
205
209
 
206
- var cleanInputArray = function cleanInputArray(obj) {
210
+ var cleanInputArray = function cleanInputArray(obj, subSchema) {
207
211
  return Object.entries(obj).reduce(function (acc, curr) {
208
212
  var _curr = _slicedToArray(curr, 2),
209
213
  key = _curr[0],
210
214
  v = _curr[1];
211
215
 
212
216
  if (Array.isArray(v)) {
213
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v.map(function (value) {
214
- return {
215
- value: value
216
- };
217
- })));
217
+ var isArray = (0, _Option.option)(subSchema).orElse(schema).map(function (s) {
218
+ return s[key];
219
+ }).map(function (entry) {
220
+ return !!entry.array;
221
+ }).getOrElse(false);
222
+
223
+ if (isArray) {
224
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v.map(function (value) {
225
+ return {
226
+ value: value
227
+ };
228
+ })));
229
+ }
230
+
231
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v));
218
232
  } else if (!!v && _typeof(v) === 'object') {
219
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, cleanInputArray(v)));
233
+ var _schema$key;
234
+
235
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, cleanInputArray(v, ((_schema$key = schema[key]) === null || _schema$key === void 0 ? void 0 : _schema$key.schema) || {})));
220
236
  } else {
221
237
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v));
222
238
  }
223
239
  }, {});
224
240
  };
225
241
 
226
- var cleanOutputArray = function cleanOutputArray(obj) {
242
+ var cleanOutputArray = function cleanOutputArray(obj, subSchema) {
227
243
  return Object.entries(obj).reduce(function (acc, curr) {
228
244
  var _curr2 = _slicedToArray(curr, 2),
229
245
  key = _curr2[0],
230
246
  v = _curr2[1];
231
247
 
232
248
  if (Array.isArray(v)) {
233
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v.map(function (_ref3) {
234
- var value = _ref3.value;
235
- return value;
236
- })));
249
+ var isArray = (0, _Option.option)(subSchema).orElse(schema).map(function (s) {
250
+ return s[key];
251
+ }).map(function (entry) {
252
+ return !!entry.array;
253
+ }).getOrElse(false);
254
+
255
+ if (isArray) {
256
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v.map(function (_ref3) {
257
+ var value = _ref3.value;
258
+ return value;
259
+ })));
260
+ }
261
+
262
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v));
237
263
  } else if (!!v && _typeof(v) === 'object') {
238
- return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, cleanOutputArray(v)));
264
+ var _schema$key2;
265
+
266
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, cleanOutputArray(v, ((_schema$key2 = schema[key]) === null || _schema$key2 === void 0 ? void 0 : _schema$key2.schema) || {})));
239
267
  } else {
240
268
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, v));
241
269
  }
@@ -269,7 +297,7 @@ var Form = function Form(_ref2) {
269
297
  (0, _react.useEffect)(function () {
270
298
  //todo: with debounce
271
299
  if (!!options.autosubmit) {
272
- handleSubmit(function (data) {
300
+ handleSubmit(function () {
273
301
  return onSubmit(cleanOutputArray(data));
274
302
  });
275
303
  }
@@ -280,8 +308,7 @@ var Form = function Form(_ref2) {
280
308
  }
281
309
 
282
310
  return /*#__PURE__*/_react["default"].createElement(_reactHookForm.FormProvider, methods, /*#__PURE__*/_react["default"].createElement("form", {
283
- className: className || "col-12 section pt-2 pr-2",
284
- style: style,
311
+ className: className || classes.pr_15,
285
312
  onSubmit: handleSubmit(function (data) {
286
313
  var clean = cleanOutputArray(data);
287
314
  return onSubmit(clean);
@@ -364,6 +391,8 @@ exports.Form = Form;
364
391
  var Footer = function Footer(props) {
365
392
  var _props$actions, _props$actions$submit, _props$actions2, _props$actions2$submi, _props$actions3, _props$actions3$reset, _props$actions4, _props$actions4$reset, _props$actions5, _props$actions5$submi;
366
393
 
394
+ var classes = (0, _styleContext.useCustomStyle)();
395
+
367
396
  if (props.render) {
368
397
  return props.render({
369
398
  reset: props.reset,
@@ -373,13 +402,13 @@ var Footer = function Footer(props) {
373
402
 
374
403
  var isSubmitDisplayed = ((_props$actions = props.actions) === null || _props$actions === void 0 ? void 0 : (_props$actions$submit = _props$actions.submit) === null || _props$actions$submit === void 0 ? void 0 : _props$actions$submit.display) === undefined ? true : !!((_props$actions2 = props.actions) !== null && _props$actions2 !== void 0 && (_props$actions2$submi = _props$actions2.submit) !== null && _props$actions2$submi !== void 0 && _props$actions2$submi.display);
375
404
  return /*#__PURE__*/_react["default"].createElement("div", {
376
- className: "d-flex flex-row justify-content-end mt-2"
405
+ className: "".concat(classes.flex, " ").concat(classes.jc_end, " ").concat(classes.mt_5)
377
406
  }, ((_props$actions3 = props.actions) === null || _props$actions3 === void 0 ? void 0 : (_props$actions3$reset = _props$actions3.reset) === null || _props$actions3$reset === void 0 ? void 0 : _props$actions3$reset.display) && /*#__PURE__*/_react["default"].createElement("button", {
378
- className: "btn btn-danger",
407
+ className: "".concat(classes.btn, " ").concat(classes.btn_red),
379
408
  type: "button",
380
409
  onClick: props.reset
381
410
  }, ((_props$actions4 = props.actions) === null || _props$actions4 === void 0 ? void 0 : (_props$actions4$reset = _props$actions4.reset) === null || _props$actions4$reset === void 0 ? void 0 : _props$actions4$reset.label) || 'Reset'), isSubmitDisplayed && /*#__PURE__*/_react["default"].createElement("button", {
382
- className: "btn btn-success ml-1",
411
+ className: "".concat(classes.btn, " ").concat(classes.btn_green, " ").concat(classes.ml_10),
383
412
  type: "submit"
384
413
  }, ((_props$actions5 = props.actions) === null || _props$actions5 === void 0 ? void 0 : (_props$actions5$submi = _props$actions5.submit) === null || _props$actions5$submi === void 0 ? void 0 : _props$actions5$submi.label) || 'Save'));
385
414
  };
@@ -399,6 +428,7 @@ var Step = function Step(_ref4) {
399
428
  httpClient = _ref4.httpClient,
400
429
  defaultValue = _ref4.defaultValue,
401
430
  index = _ref4.index;
431
+ var classes = (0, _styleContext.useCustomStyle)();
402
432
 
403
433
  if (step.array) {
404
434
  return /*#__PURE__*/_react["default"].createElement(ArrayStep, {
@@ -477,7 +507,7 @@ var Step = function Step(_ref4) {
477
507
  }, /*#__PURE__*/_react["default"].createElement("textarea", _extends({
478
508
  type: "text",
479
509
  id: entry,
480
- className: (0, _classnames["default"])("form-control", {
510
+ className: (0, _classnames["default"])(classes.input, {
481
511
  'is-invalid': error
482
512
  }),
483
513
  readOnly: step.disabled ? 'readOnly' : null
@@ -590,7 +620,7 @@ var Step = function Step(_ref4) {
590
620
  // {...step.props}
591
621
  type: step.format || 'text',
592
622
  id: entry,
593
- className: (0, _classnames["default"])("form-control", {
623
+ className: (0, _classnames["default"])(classes.input, {
594
624
  'is-invalid': error
595
625
  }),
596
626
  readOnly: step.disabled ? 'readOnly' : null // defaultValue={defaultValue}
@@ -617,7 +647,7 @@ var Step = function Step(_ref4) {
617
647
  }, field),
618
648
  error: error
619
649
  }, /*#__PURE__*/_react["default"].createElement(_index.SelectInput, _extends({}, step.props, {
620
- className: (0, _classnames["default"])({
650
+ className: (0, _classnames["default"])(classes.content, {
621
651
  'is-invalid': error
622
652
  }),
623
653
  readOnly: step.disabled ? 'readOnly' : null,
@@ -647,7 +677,7 @@ var Step = function Step(_ref4) {
647
677
  }, /*#__PURE__*/_react["default"].createElement("input", _extends({}, step.props, {
648
678
  type: step.format || 'number',
649
679
  id: entry,
650
- className: (0, _classnames["default"])("form-control", {
680
+ className: (0, _classnames["default"])(classes.input, {
651
681
  'is-invalid': error
652
682
  }),
653
683
  readOnly: step.disabled ? 'readOnly' : null,
@@ -846,14 +876,16 @@ var Step = function Step(_ref4) {
846
876
  },
847
877
  type: "file",
848
878
  multiple: true,
849
- className: "form-control d-none",
879
+ className: classes.d_none,
850
880
  onChange: setFiles
851
881
  }), /*#__PURE__*/_react["default"].createElement("button", {
852
882
  type: "button",
853
- className: "btn btn-outline-success pl",
883
+ className: "".concat(classes.btn, " ").concat(classes.flex, " ").concat(classes.ai_center),
854
884
  disabled: uploading,
855
885
  onClick: trigger
856
- }, uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Loader, null), !uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Upload, null), "Select file"));
886
+ }, uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Loader, null), !uploading && /*#__PURE__*/_react["default"].createElement(_reactFeather.Upload, null), /*#__PURE__*/_react["default"].createElement("span", {
887
+ className: "".concat(classes.ml_5)
888
+ }, "Select file")));
857
889
  };
858
890
 
859
891
  return /*#__PURE__*/_react["default"].createElement(CustomizableInput, {
@@ -891,7 +923,7 @@ var Step = function Step(_ref4) {
891
923
  }, /*#__PURE__*/_react["default"].createElement("input", _extends({}, step.props, {
892
924
  type: "file",
893
925
  id: entry,
894
- className: (0, _classnames["default"])("form-control", {
926
+ className: (0, _classnames["default"])(classes.input, {
895
927
  'is-invalid': error
896
928
  }),
897
929
  readOnly: step.disabled ? 'readOnly' : null,
@@ -9,30 +9,27 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _reactFeather = require("react-feather");
11
11
 
12
+ var _styleContext = require("../styleContext");
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
15
 
14
16
  var BooleanInput = function BooleanInput(_ref) {
15
17
  var onChange = _ref.onChange,
16
18
  value = _ref.value;
17
- return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
18
- className: "form-group row"
19
- }, /*#__PURE__*/_react["default"].createElement("div", {
20
- className: "col-sm-10"
21
- }, /*#__PURE__*/_react["default"].createElement("div", {
22
- className: "row"
23
- }, /*#__PURE__*/_react["default"].createElement("div", {
24
- className: "col-sm-6 cursor-pointer"
19
+ var classes = (0, _styleContext.useCustomStyle)();
20
+ return /*#__PURE__*/_react["default"].createElement("div", {
21
+ className: classes.cursor_pointer
25
22
  }, !!value && /*#__PURE__*/_react["default"].createElement(_reactFeather.ToggleRight, {
26
- className: "input__boolean__on",
23
+ className: classes.input__boolean__on,
27
24
  onClick: function onClick() {
28
25
  return onChange(false);
29
26
  }
30
27
  }), !value && /*#__PURE__*/_react["default"].createElement(_reactFeather.ToggleLeft, {
31
- className: "input__boolean__off",
28
+ className: classes.input__boolean__off,
32
29
  onClick: function onClick() {
33
30
  return onChange(true);
34
31
  }
35
- }))))));
32
+ }));
36
33
  };
37
34
 
38
35
  exports.BooleanInput = BooleanInput;
@@ -1,6 +1,8 @@
1
- export function CodeInput({ onChange, value, className, readOnly }: {
1
+ export function CodeInput({ onChange, value, className, readOnly, theme, mode }: {
2
2
  onChange: any;
3
3
  value: any;
4
4
  className?: string | undefined;
5
5
  readOnly: any;
6
+ theme?: string | undefined;
7
+ mode?: string | undefined;
6
8
  }): JSX.Element;
@@ -15,10 +15,14 @@ require("ace-builds/src-noconflict/mode-json");
15
15
 
16
16
  require("ace-builds/src-noconflict/mode-javascript");
17
17
 
18
+ require("ace-builds/src-noconflict/mode-css");
19
+
18
20
  require("ace-builds/src-noconflict/mode-markdown");
19
21
 
20
22
  require("ace-builds/src-noconflict/theme-monokai");
21
23
 
24
+ require("ace-builds/src-noconflict/theme-tomorrow");
25
+
22
26
  require("ace-builds/src-noconflict/ext-searchbox");
23
27
 
24
28
  require("ace-builds/src-noconflict/ext-language_tools");
@@ -30,7 +34,11 @@ var CodeInput = function CodeInput(_ref) {
30
34
  value = _ref.value,
31
35
  _ref$className = _ref.className,
32
36
  className = _ref$className === void 0 ? '' : _ref$className,
33
- readOnly = _ref.readOnly;
37
+ readOnly = _ref.readOnly,
38
+ _ref$theme = _ref.theme,
39
+ theme = _ref$theme === void 0 ? 'monokai' : _ref$theme,
40
+ _ref$mode = _ref.mode,
41
+ mode = _ref$mode === void 0 ? 'javascript' : _ref$mode;
34
42
  return /*#__PURE__*/_react["default"].createElement(_reactAce["default"], {
35
43
  className: className,
36
44
  readOnly: readOnly,
@@ -38,8 +46,8 @@ var CodeInput = function CodeInput(_ref) {
38
46
  zIndex: 0,
39
47
  isolation: 'isolate'
40
48
  },
41
- mode: "javascript",
42
- theme: "monokai",
49
+ mode: mode,
50
+ theme: theme,
43
51
  onChange: onChange,
44
52
  value: value,
45
53
  name: "scriptParam",
@@ -49,7 +49,7 @@ var Collapse = function Collapse(props) {
49
49
  }, /*#__PURE__*/_react["default"].createElement("hr", null), /*#__PURE__*/_react["default"].createElement("div", {
50
50
  className: "form-group row"
51
51
  }, /*#__PURE__*/_react["default"].createElement("div", {
52
- className: "col-sm-10",
52
+ className: "col-sm-12",
53
53
  onClick: toggle,
54
54
  style: {
55
55
  cursor: 'pointer'
@@ -44,7 +44,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
44
44
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
45
45
 
46
46
  var valueToSelectOption = function valueToSelectOption(value) {
47
- var isMulti = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
47
+ var possibleValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
48
+ var isMulti = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
48
49
 
49
50
  if (value === null) {
50
51
  return null;
@@ -52,39 +53,51 @@ var valueToSelectOption = function valueToSelectOption(value) {
52
53
 
53
54
  if (isMulti) {
54
55
  return value.map(function (x) {
55
- return valueToSelectOption(x);
56
+ return valueToSelectOption(x, possibleValues, false);
56
57
  });
57
58
  }
58
59
 
60
+ var maybeValue = (0, _Option.option)(possibleValues.find(function (v) {
61
+ return v.value === value;
62
+ }));
59
63
  return {
60
- label: (value === null || value === void 0 ? void 0 : value.label) || value,
61
- value: (value === null || value === void 0 ? void 0 : value.value) || value
64
+ label: maybeValue.map(function (v) {
65
+ return v.label;
66
+ }).getOrElse(value),
67
+ value: maybeValue.map(function (v) {
68
+ return v.value;
69
+ }).getOrElse(value)
62
70
  };
63
71
  };
64
72
 
65
73
  var SelectInput = function SelectInput(props) {
74
+ var possibleValues = (props.possibleValues || []).map(function (v) {
75
+ return props.transformer ? props.transformer(v) : v;
76
+ }).map(function (v) {
77
+ return {
78
+ label: (v === null || v === void 0 ? void 0 : v.label) || v,
79
+ value: (v === null || v === void 0 ? void 0 : v.value) || v
80
+ };
81
+ });
82
+
66
83
  var _useState = (0, _react.useState)(false),
67
84
  _useState2 = _slicedToArray(_useState, 2),
68
85
  loading = _useState2[0],
69
86
  setLoading = _useState2[1];
70
87
 
71
- var _useState3 = (0, _react.useState)(valueToSelectOption(props.value || props.defaultValue, props.isMulti)),
88
+ var _useState3 = (0, _react.useState)(possibleValues),
72
89
  _useState4 = _slicedToArray(_useState3, 2),
73
- value = _useState4[0],
74
- setValue = _useState4[1];
90
+ values = _useState4[0],
91
+ setValues = _useState4[1];
75
92
 
76
- var _useState5 = (0, _react.useState)((props.possibleValues || []).map(function (v) {
77
- return props.transformer ? props.transformer(v) : v;
78
- }).map(function (v) {
79
- return valueToSelectOption(v);
80
- })),
93
+ var _useState5 = (0, _react.useState)(valueToSelectOption(props.value || props.defaultValue, possibleValues, props.isMulti)),
81
94
  _useState6 = _slicedToArray(_useState5, 2),
82
- values = _useState6[0],
83
- setValues = _useState6[1];
95
+ value = _useState6[0],
96
+ setValue = _useState6[1];
84
97
 
85
98
  (0, _react.useEffect)(function () {
86
- setValue(valueToSelectOption(props.value || props.defaultValue, props.isMulti));
87
- }, []);
99
+ setValue(valueToSelectOption(props.value, values, props.isMulti));
100
+ }, [props.value, values]);
88
101
  (0, _react.useEffect)(function () {
89
102
  if (props.optionsFrom) {
90
103
  var cond = (0, _Option.option)(props.fetchCondition).map(function (cond) {
@@ -125,8 +138,8 @@ var SelectInput = function SelectInput(props) {
125
138
  var createOption = function createOption(option) {
126
139
  var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
127
140
  fn(option);
128
- setValues([].concat(_toConsumableArray(values), [valueToSelectOption(option)]));
129
- onChange(valueToSelectOption(option));
141
+ setValues([].concat(_toConsumableArray(values), [valueToSelectOption(option, values)]));
142
+ onChange([].concat(_toConsumableArray(value), [valueToSelectOption(option, [].concat(_toConsumableArray(values), [valueToSelectOption(option, values)]))]));
130
143
  };
131
144
 
132
145
  if (props.createOption) {
package/lib/style.d.ts ADDED
@@ -0,0 +1,156 @@
1
+ export namespace style {
2
+ const input: {
3
+ display: string;
4
+ width: string;
5
+ padding: string;
6
+ fontSize: string;
7
+ color: string;
8
+ border: string;
9
+ borderRadius: number;
10
+ "&[readonly]": {
11
+ backgroundColor: string;
12
+ opacity: number;
13
+ };
14
+ };
15
+ namespace btn {
16
+ const borderRadius: number;
17
+ const padding: number;
18
+ const fontSize: string;
19
+ const cursor: string;
20
+ const border: number;
21
+ }
22
+ namespace btn_sm {
23
+ const fontSize_1: string;
24
+ export { fontSize_1 as fontSize };
25
+ const padding_1: string;
26
+ export { padding_1 as padding };
27
+ }
28
+ const btn_group: {
29
+ "& > button:not(:last-child)": {
30
+ borderTopRightRadius: number;
31
+ borderBottomRightRadius: number;
32
+ };
33
+ "& > button:not(:first-child)": {
34
+ borderTopLeftRadius: number;
35
+ borderBottomLeftRadius: number;
36
+ };
37
+ };
38
+ const btn_red: {
39
+ color: string;
40
+ backgroundColor: string;
41
+ borderColor: string;
42
+ "&:hover": {
43
+ backgroundColor: string;
44
+ borderColor: string;
45
+ };
46
+ };
47
+ const btn_green: {
48
+ color: string;
49
+ backgroundColor: string;
50
+ borderColor: string;
51
+ "&:hover": {
52
+ backgroundColor: string;
53
+ borderColor: string;
54
+ };
55
+ };
56
+ const btn_blue: {
57
+ color: string;
58
+ backgroundColor: string;
59
+ borderColor: string;
60
+ "&:hover": {
61
+ backgroundColor: string;
62
+ borderColor: string;
63
+ };
64
+ };
65
+ const btn_grey: {
66
+ color: string;
67
+ backgroundColor: string;
68
+ borderColor: string;
69
+ "&:hover": {
70
+ backgroundColor: string;
71
+ borderColor: string;
72
+ };
73
+ };
74
+ namespace txt_red {
75
+ const color: string;
76
+ }
77
+ namespace ml_5 {
78
+ const marginLeft: number;
79
+ }
80
+ namespace ml_10 {
81
+ const marginLeft_1: number;
82
+ export { marginLeft_1 as marginLeft };
83
+ }
84
+ namespace mt_5 {
85
+ const marginTop: number;
86
+ }
87
+ namespace mt_10 {
88
+ const marginTop_1: number;
89
+ export { marginTop_1 as marginTop };
90
+ }
91
+ namespace mt_20 {
92
+ const marginTop_2: number;
93
+ export { marginTop_2 as marginTop };
94
+ }
95
+ namespace mb_5 {
96
+ const marginBottom: number;
97
+ }
98
+ namespace p_15 {
99
+ const padding_2: number;
100
+ export { padding_2 as padding };
101
+ }
102
+ namespace pr_15 {
103
+ const paddingRight: number;
104
+ }
105
+ namespace d_none {
106
+ const display: string;
107
+ }
108
+ namespace flex {
109
+ const display_1: string;
110
+ export { display_1 as display };
111
+ }
112
+ namespace flexDirection {
113
+ const flexDirection_1: string;
114
+ export { flexDirection_1 as flexDirection };
115
+ }
116
+ namespace jc_end {
117
+ const justifyContent: string;
118
+ }
119
+ namespace ac_center {
120
+ const alignContent: string;
121
+ }
122
+ namespace ai_center {
123
+ const alignItems: string;
124
+ }
125
+ namespace cursor_pointer {
126
+ const cursor_1: string;
127
+ export { cursor_1 as cursor };
128
+ }
129
+ namespace collapse {
130
+ const display_2: string;
131
+ export { display_2 as display };
132
+ const justifyContent_1: string;
133
+ export { justifyContent_1 as justifyContent };
134
+ const cursor_2: string;
135
+ export { cursor_2 as cursor };
136
+ }
137
+ namespace collapse_label {
138
+ export const fontWeight: string;
139
+ const marginTop_3: number;
140
+ export { marginTop_3 as marginTop };
141
+ }
142
+ const datepicker: {
143
+ "& input": {
144
+ borderRadius: string;
145
+ };
146
+ };
147
+ const code: {};
148
+ namespace input__boolean__on {
149
+ const color_1: string;
150
+ export { color_1 as color };
151
+ }
152
+ namespace input__boolean__off {
153
+ const color_2: string;
154
+ export { color_2 as color };
155
+ }
156
+ }