@startlibs/form 1.0.0-alpha-10f → 1.0.0-alpha-10h

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.
Files changed (2) hide show
  1. package/lib/index.js +970 -305
  2. package/package.json +4 -1
package/lib/index.js CHANGED
@@ -13,10 +13,12 @@ var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread
13
13
  var _set = _interopDefault(require('lodash/fp/set'));
14
14
  var _update = _interopDefault(require('lodash/fp/update'));
15
15
  var _isFunction = _interopDefault(require('lodash/fp/isFunction'));
16
+ var _get = _interopDefault(require('lodash/fp/get'));
16
17
  var React = require('react');
17
18
  var React__default = _interopDefault(React);
18
19
  var core = require('@startlibs/core');
19
20
  var utils = require('@startlibs/utils');
21
+ var _difference = _interopDefault(require('lodash/fp/difference'));
20
22
  var _property = _interopDefault(require('lodash/fp/property'));
21
23
  var _uniqBy = _interopDefault(require('lodash/fp/uniqBy'));
22
24
  var _identity = _interopDefault(require('lodash/fp/identity'));
@@ -25,26 +27,26 @@ var styled__default = _interopDefault(styled);
25
27
  var components = require('@startlibs/components');
26
28
  var polished = require('polished');
27
29
  var reselect = require('reselect');
28
- var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
29
- var _without = _interopDefault(require('lodash/fp/without'));
30
- var form = require('@startlibs/form');
31
30
  var _taggedTemplateLiteral = _interopDefault(require('@babel/runtime/helpers/taggedTemplateLiteral'));
31
+ var form = require('@startlibs/form');
32
32
  var _isRegExp = _interopDefault(require('lodash/fp/isRegExp'));
33
- var _difference = _interopDefault(require('lodash/fp/difference'));
33
+ var _isString = _interopDefault(require('lodash/fp/isString'));
34
34
  var _union = _interopDefault(require('lodash/fp/union'));
35
35
  var _flow = _interopDefault(require('lodash/fp/flow'));
36
- var _isBoolean = _interopDefault(require('lodash/fp/isBoolean'));
37
- var _isString = _interopDefault(require('lodash/fp/isString'));
36
+ var _stubFalse = _interopDefault(require('lodash/fp/stubFalse'));
37
+ var _isFinite = _interopDefault(require('lodash/fp/isFinite'));
38
+ var _sortBy = _interopDefault(require('lodash/fp/sortBy'));
39
+ var _filter = _interopDefault(require('lodash/fp/filter'));
40
+ var reactWindow = require('react-window');
38
41
  var _classCallCheck = _interopDefault(require('@babel/runtime/helpers/classCallCheck'));
39
42
  var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass'));
40
43
  var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn'));
41
44
  var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf'));
42
45
  var _inherits = _interopDefault(require('@babel/runtime/helpers/inherits'));
43
- var _filter = _interopDefault(require('lodash/fp/filter'));
44
46
  var _map = _interopDefault(require('lodash/fp/map'));
45
- var _stubFalse = _interopDefault(require('lodash/fp/stubFalse'));
46
47
  var _isObject = _interopDefault(require('lodash/fp/isObject'));
47
- var _isFinite = _interopDefault(require('lodash/fp/isFinite'));
48
+ var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
49
+ var _isBoolean = _interopDefault(require('lodash/fp/isBoolean'));
48
50
  var _negate = _interopDefault(require('lodash/fp/negate'));
49
51
  var _zipObject = _interopDefault(require('lodash/fp/zipObject'));
50
52
  var _last = _interopDefault(require('lodash/fp/last'));
@@ -52,7 +54,6 @@ var _flatten = _interopDefault(require('lodash/fp/flatten'));
52
54
  var _fromPairs = _interopDefault(require('lodash/fp/fromPairs'));
53
55
  var _pick = _interopDefault(require('lodash/fp/pick'));
54
56
  var _toPairs = _interopDefault(require('lodash/fp/toPairs'));
55
- var _get = _interopDefault(require('lodash/fp/get'));
56
57
  var _entries = _interopDefault(require('lodash/fp/entries'));
57
58
 
58
59
  var errorsInsidePathSelector = function errorsInsidePathSelector() {
@@ -239,7 +240,7 @@ var useTransientErrorHelper = function useTransientErrorHelper() {
239
240
  showingErrors.current = newErrors;
240
241
  };
241
242
 
242
- React__default.useEffect(function () {
243
+ React.useEffect(function () {
243
244
  return function () {
244
245
  clearCurrentErrors();
245
246
  };
@@ -248,24 +249,45 @@ var useTransientErrorHelper = function useTransientErrorHelper() {
248
249
  };
249
250
  var Errors = function Errors(_ref17) {
250
251
  var path = _ref17.path,
251
- className = _ref17.className;
252
+ filter = _ref17.filter,
253
+ className = _ref17.className,
254
+ autoScroll = _ref17.autoScroll;
252
255
 
253
256
  var _useContext2 = React.useContext(ErrorsContext),
254
257
  getErrorsInsidePath = _useContext2.getErrorsInsidePath,
255
258
  willRemoveError = _useContext2.willRemoveError;
256
259
 
257
- var filter = React.useContext(ErrorFilterContext);
258
- var errors = filter(getErrorsInsidePath(path));
260
+ var contextFilter = React.useContext(ErrorFilterContext);
261
+ var ref = React.useRef();
262
+ var errors = filter ? getErrorsInsidePath(path).filter(filter) : contextFilter(getErrorsInsidePath(path));
263
+
264
+ var uniqErrors = _uniqBy(_property(0), errors).filter(function (_ref18) {
265
+ var _ref19 = _slicedToArray(_ref18, 1),
266
+ v = _ref19[0];
267
+
268
+ return v;
269
+ });
259
270
 
260
- var uniqErrors = _uniqBy(_property(0), errors);
271
+ var prevErrors = core.usePreviousForEffect(uniqErrors);
272
+ React.useEffect(function () {
273
+ var _ref$current;
261
274
 
275
+ var changed = _difference(uniqErrors, prevErrors);
276
+
277
+ if (autoScroll && changed.length && ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.scrollIntoView) && !utils.isElementInView(ref.current)) {
278
+ ref.current.scrollIntoView({
279
+ behavior: "smooth"
280
+ });
281
+ }
282
+ }, [uniqErrors]);
262
283
  return React__default.createElement(components.TransitionDiv, {
263
284
  block: true
264
- }, errors.length > 0 && React__default.createElement(Errors.Container, {
285
+ }, uniqErrors.length > 0 && React__default.createElement(Errors.Container, {
286
+ ref: ref,
265
287
  className: className
266
- }, uniqErrors.map(function (_ref18) {
267
- var _ref19 = _slicedToArray(_ref18, 1),
268
- value = _ref19[0];
288
+ }, uniqErrors.map(function (_ref20) {
289
+ var _ref21 = _slicedToArray(_ref20, 1),
290
+ value = _ref21[0];
269
291
 
270
292
  return value && React__default.createElement(Errors.Item, {
271
293
  key: value
@@ -282,7 +304,7 @@ Errors.Container = styled__default.ul.withConfig({
282
304
  Errors.Item = styled__default.li.withConfig({
283
305
  displayName: "Errors__Item",
284
306
  componentId: "sc-1vuw7bx-1"
285
- })(["background-color:", ";padding:1rem 3.5rem 1rem 1rem;border-radius:8px;border:1px solid ", ";color:", ";position:relative;text-align:left;& ~ &{margin-top:0.5rem;}", ""], function (props) {
307
+ })(["background-color:", ";padding:1rem 3.5rem 1rem 1rem;border-radius:8px;border:1px solid ", ";color:", ";position:relative;text-align:left;font-size:13px;line-height:130%;& ~ &{margin-top:0.5rem;}", ""], function (props) {
286
308
  return polished.lighten(0.42, props.theme.colors.alert);
287
309
  }, function (props) {
288
310
  return polished.lighten(0.35, props.theme.colors.alert);
@@ -292,7 +314,7 @@ Errors.CloseIcon = styled__default(components.Icon).attrs({
292
314
  }).withConfig({
293
315
  displayName: "Errors__CloseIcon",
294
316
  componentId: "sc-1vuw7bx-2"
295
- })(["color:", ";font-weight:600;display:inline-block;background-color:", ";width:21px;height:21px;line-height:21px;text-align:center;border-radius:50%;cursor:pointer;position:absolute;top:10px;right:10px;z-index:2;&:hover{background-color:", ";}"], utils.getColor('alert'), function (props) {
317
+ })(["color:", ";font-weight:600;display:inline-block;background-color:", ";width:21px;height:21px;line-height:21px;text-align:center;border-radius:50%;cursor:pointer;position:absolute;top:10px;right:10px;font-size:14px;z-index:2;&:hover{background-color:", ";}"], utils.getColor('alert'), function (props) {
296
318
  return polished.lighten(0.35, props.theme.colors.alert);
297
319
  }, function (props) {
298
320
  return polished.lighten(0.32, props.theme.colors.alert);
@@ -558,7 +580,7 @@ var useForm = function useForm(_ref, ref) {
558
580
  values = _args.length > 0 && _args[0] !== undefined ? _args[0] : getValues();
559
581
  validation = _args.length > 1 && _args[1] !== undefined ? _args[1] : preValidation;
560
582
  _context.next = 4;
561
- return utils.callIfFunction(validation, values);
583
+ return utils.callIfFunction(validation, values, utils$1);
562
584
 
563
585
  case 4:
564
586
  errors = _context.sent;
@@ -688,10 +710,14 @@ var useForm = function useForm(_ref, ref) {
688
710
  };
689
711
 
690
712
  case 18:
691
- request = transform(values);
713
+ _context2.next = 20;
714
+ return transform(values);
715
+
716
+ case 20:
717
+ request = _context2.sent;
692
718
 
693
719
  if (request) {
694
- _context2.next = 24;
720
+ _context2.next = 26;
695
721
  break;
696
722
  }
697
723
 
@@ -700,18 +726,19 @@ var useForm = function useForm(_ref, ref) {
700
726
  untransformed: true
701
727
  });
702
728
 
703
- case 24:
729
+ case 26:
704
730
  loading.open();
731
+ errorsUtils.clearErrors();
705
732
 
706
733
  if (!(!alwaysSave && !hasChangedRef.get() && (!values || values === getValues()))) {
707
- _context2.next = 30;
734
+ _context2.next = 33;
708
735
  break;
709
736
  }
710
737
 
711
- _context2.next = 28;
738
+ _context2.next = 31;
712
739
  return onSuccess(request);
713
740
 
714
- case 28:
741
+ case 31:
715
742
  if (!isUnmounted()) {
716
743
  loading.close();
717
744
  }
@@ -720,17 +747,17 @@ var useForm = function useForm(_ref, ref) {
720
747
  unrequested: request
721
748
  });
722
749
 
723
- case 30:
724
- _context2.prev = 30;
725
- _context2.next = 33;
750
+ case 33:
751
+ _context2.prev = 33;
752
+ _context2.next = 36;
726
753
  return action(request);
727
754
 
728
- case 33:
755
+ case 36:
729
756
  response = _context2.sent;
730
- _context2.next = 36;
757
+ _context2.next = 39;
731
758
  return onSuccess(request, response);
732
759
 
733
- case 36:
760
+ case 39:
734
761
  if (!isUnmounted()) {
735
762
  setHasChanged(false);
736
763
  loading.close();
@@ -741,18 +768,18 @@ var useForm = function useForm(_ref, ref) {
741
768
  response: response
742
769
  });
743
770
 
744
- case 40:
745
- _context2.prev = 40;
746
- _context2.t0 = _context2["catch"](30);
771
+ case 43:
772
+ _context2.prev = 43;
773
+ _context2.t0 = _context2["catch"](33);
747
774
 
748
- if (_context2.t0[0] && _context2.t0[0].errors) {
775
+ if (_get([0, 'errors'], _context2.t0)) {
749
776
  errorsUtils.setErrors(_context2.t0[0].errors);
750
777
  }
751
778
 
752
- _context2.next = 45;
779
+ _context2.next = 48;
753
780
  return onFailure(request, _context2.t0, utils$1);
754
781
 
755
- case 45:
782
+ case 48:
756
783
  if (!isUnmounted()) {
757
784
  loading.close();
758
785
  }
@@ -762,12 +789,12 @@ var useForm = function useForm(_ref, ref) {
762
789
  rejection: _context2.t0
763
790
  };
764
791
 
765
- case 47:
792
+ case 50:
766
793
  case "end":
767
794
  return _context2.stop();
768
795
  }
769
796
  }
770
- }, _callee2, this, [[30, 40]]);
797
+ }, _callee2, this, [[33, 43]]);
771
798
  }));
772
799
 
773
800
  return function submitForm(_x) {
@@ -923,13 +950,6 @@ var skipValidation = function skipValidation() {
923
950
  return true;
924
951
  };
925
952
 
926
- var itemToggle = function itemToggle(item) {
927
- return function () {
928
- var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
929
- return list.indexOf(item) >= 0 ? _without([item], list) : _toConsumableArray(list).concat([item]);
930
- };
931
- };
932
-
933
953
  var formInput = function formInput(_ref) {
934
954
  var undefinedPlaceholder = _ref.undefinedPlaceholder,
935
955
  _ref$isChecked = _ref.isChecked,
@@ -955,19 +975,18 @@ var formInput = function formInput(_ref) {
955
975
  setFormValue = _useFormValue2[1];
956
976
 
957
977
  var setValue = function setValue(value, element) {
958
- if (!validation(value, path)) {
959
- return;
960
- }
961
-
962
- setFormValue(transform(value, {
978
+ var opts = {
963
979
  path: path,
964
- prevValue: formValue
965
- }));
966
- utils.callIfFunction(onChange, utils.callIfFunction(value, formValue), {
967
980
  prevValue: formValue,
968
- path: path,
969
981
  element: element
970
- });
982
+ };
983
+
984
+ if (!validation(value, opts)) {
985
+ return;
986
+ }
987
+
988
+ setFormValue(transform(value, opts));
989
+ utils.callIfFunction(onChange, utils.callIfFunction(value, formValue), opts);
971
990
  };
972
991
 
973
992
  var setValueFromEventTarget = function setValueFromEventTarget(e) {
@@ -983,7 +1002,7 @@ var formInput = function formInput(_ref) {
983
1002
  };
984
1003
 
985
1004
  var toggleItem = function toggleItem() {
986
- return setValue(itemToggle(fieldValue));
1005
+ return setValue(utils._s.itemToggle(fieldValue));
987
1006
  };
988
1007
 
989
1008
  return [utils.ifUndefined(formValue, undefinedPlaceholder), setValue, {
@@ -997,7 +1016,10 @@ var formInput = function formInput(_ref) {
997
1016
  };
998
1017
 
999
1018
  var rawInput = function rawInput(_ref2) {
1019
+ var _errorUtils$paths;
1020
+
1000
1021
  var value = _ref2.value,
1022
+ path = _ref2.path,
1001
1023
  _ref2$isChecked = _ref2.isChecked,
1002
1024
  isChecked = _ref2$isChecked === void 0 ? _identity : _ref2$isChecked,
1003
1025
  name = _ref2.name,
@@ -1015,6 +1037,8 @@ var rawInput = function rawInput(_ref2) {
1015
1037
  rawValue = _useState2[0],
1016
1038
  setRawValue = _useState2[1];
1017
1039
 
1040
+ var errorUtils = React.useContext(ErrorsContext);
1041
+ var formattedPath = utils.formatPath(path);
1018
1042
  React.useEffect(function () {
1019
1043
  setRawValue(value);
1020
1044
  }, [value]);
@@ -1044,10 +1068,11 @@ var rawInput = function rawInput(_ref2) {
1044
1068
  };
1045
1069
 
1046
1070
  var toggleItem = function toggleItem() {
1047
- return setValue(itemToggle(fieldValue));
1071
+ return setValue(utils._s.itemToggle(fieldValue));
1048
1072
  };
1049
1073
 
1050
1074
  return [value, setValue, {
1075
+ hasErrors: errorUtils === null || errorUtils === void 0 ? void 0 : (_errorUtils$paths = errorUtils.paths) === null || _errorUtils$paths === void 0 ? void 0 : _errorUtils$paths.has(formattedPath),
1051
1076
  setFromField: setFromField,
1052
1077
  name: name,
1053
1078
  toggle: toggle,
@@ -1155,14 +1180,41 @@ Field.HelpText = HelpText;
1155
1180
  Field.Description = FieldDescription;
1156
1181
  Field.displayName = "Field";
1157
1182
 
1158
- var addExtraProp = function addExtraProp(element, extra) {
1159
- var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
1160
- return React__default.cloneElement(element, override ? _objectSpread({}, element.props, extra) : _objectSpread({}, extra, element.props), element.props.children);
1161
- };
1183
+ function _templateObject() {
1184
+ var data = _taggedTemplateLiteral(["\n min-height: 54px;\n font-size: 14px;\n "]);
1185
+
1186
+ _templateObject = function _templateObject() {
1187
+ return data;
1188
+ };
1189
+
1190
+ return data;
1191
+ }
1192
+ var FieldBoxIcon = styled__default(components.Icon).withConfig({
1193
+ displayName: "FieldBox__FieldBoxIcon",
1194
+ componentId: "sc-18ntu84-0"
1195
+ })(["font-size:25px;width:25px;text-align:center;margin-right:0.75rem;color:", ";"], function (props) {
1196
+ return props.color;
1197
+ });
1198
+ var FieldBoxAction = styled__default.div.withConfig({
1199
+ displayName: "FieldBox__FieldBoxAction",
1200
+ componentId: "sc-18ntu84-1"
1201
+ })(["margin-left:auto;color:", ";padding-left:0.5rem;font-size:12px;"], utils.getColor('main'));
1202
+ var FieldBox = styled__default.div.withConfig({
1203
+ displayName: "FieldBox",
1204
+ componentId: "sc-18ntu84-2"
1205
+ })(["display:flex;width:100%;background-color:", ";background-color:", ";border-radius:6px;min-height:42px;padding:1rem 1.25rem;cursor:pointer;align-items:center;font-size:13px;font-weight:500;color:", ";position:relative;transition:border-radius 0.5s ease;:hover,:active{background-color:", ";background-color:", ";}& ~ &{margin-top:0.75rem;}", "{margin-left:-0.25rem;}", ""], utils.getColor('bluishGray'), utils.getColor('gray240'), utils.getColor('gray60'), function (props) {
1206
+ return polished.darken(0.03, utils.getColor("bluishGray")(props));
1207
+ }, function (props) {
1208
+ return polished.darken(0.03, utils.getColor("gray240")(props));
1209
+ }, FieldBoxIcon, utils.media.mobile(_templateObject()));
1210
+ var FieldBoxHelpText = styled__default.span.withConfig({
1211
+ displayName: "FieldBox__FieldBoxHelpText",
1212
+ componentId: "sc-18ntu84-3"
1213
+ })(["font-weight:400;color:rgba(0,0,0,0.4);font-size:12px;"]);
1162
1214
 
1163
1215
  var useConfirmDialog = function useConfirmDialog(dialog, args, toggleCallback) {
1164
1216
  return components.useDialog(function (closeDialog) {
1165
- return addExtraProp(utils.callIfFunction(dialog, closeDialog), {
1217
+ return utils.addExtraProp(utils.callIfFunction(dialog, closeDialog), {
1166
1218
  closeDialog: closeDialog
1167
1219
  });
1168
1220
  }, args, toggleCallback);
@@ -1173,7 +1225,7 @@ var useConfirmDialogWithProps = function useConfirmDialogWithProps(dialog, args)
1173
1225
  overrideClose = _ref$overrideClose === void 0 ? true : _ref$overrideClose;
1174
1226
 
1175
1227
  return components.useDialogWithToggle(function (toggle) {
1176
- return addExtraProp(utils.callIfFunction(dialog, toggle.isOpen, toggle.close), {
1228
+ return utils.addExtraProp(utils.callIfFunction(dialog, toggle.isOpen, toggle.close), {
1177
1229
  closeDialog: toggle.close
1178
1230
  }, overrideClose);
1179
1231
  }, args);
@@ -1188,7 +1240,9 @@ var ConfirmDialog = function ConfirmDialog(_ref2) {
1188
1240
  _ref2$cancelLabel = _ref2.cancelLabel,
1189
1241
  cancelLabel = _ref2$cancelLabel === void 0 ? "Cancelar" : _ref2$cancelLabel,
1190
1242
  _ref2$cancelButton = _ref2.cancelButton,
1191
- cancelButton = _ref2$cancelButton === void 0 ? React__default.createElement(components.Button, null, cancelLabel) : _ref2$cancelButton,
1243
+ cancelButton = _ref2$cancelButton === void 0 ? React__default.createElement(components.Button, {
1244
+ tabIndex: 2
1245
+ }, cancelLabel) : _ref2$cancelButton,
1192
1246
  onFailure = _ref2.onFailure,
1193
1247
  title = _ref2.title,
1194
1248
  keepOnSuccess = _ref2.keepOnSuccess,
@@ -1202,9 +1256,12 @@ var ConfirmDialog = function ConfirmDialog(_ref2) {
1202
1256
  notify = _ref2.notify,
1203
1257
  confirmChanges = _ref2.confirmChanges,
1204
1258
  transform = _ref2.transform,
1205
- isLoading = _ref2.isLoading;
1259
+ isLoading = _ref2.isLoading,
1260
+ stickyFooter = _ref2.stickyFooter,
1261
+ _ref2$alwaysSave = _ref2.alwaysSave,
1262
+ alwaysSave = _ref2$alwaysSave === void 0 ? true : _ref2$alwaysSave;
1206
1263
  return React__default.createElement(form.WithForm, {
1207
- alwaysSave: true,
1264
+ alwaysSave: alwaysSave,
1208
1265
  ref: formRef,
1209
1266
  preValidation: preValidation,
1210
1267
  values: values,
@@ -1238,31 +1295,49 @@ var ConfirmDialog = function ConfirmDialog(_ref2) {
1238
1295
  isLoading: isLoading,
1239
1296
  closeDialog: closeDialog,
1240
1297
  form: form$1,
1241
- footer: React__default.createElement(React__default.Fragment, null, cancelButton && addExtraProp(utils.callIfFunction(cancelButton, closeDialog), {
1298
+ stickyFooter: stickyFooter,
1299
+ footer: React__default.createElement(React__default.Fragment, null, cancelButton && utils.addExtraProp(utils.callIfFunction(cancelButton, closeDialog), {
1242
1300
  onClick: closeDialog
1243
- }, false), utils.callIfFunction(alternativeButton, closeDialog), confirm && addExtraProp(confirm, {
1244
- isLoading: form$1.isLoading,
1245
- type: "submit"
1301
+ }, false), utils.callIfFunction(alternativeButton, closeDialog), confirm && utils.using(utils.callIfFunction(confirm, {
1302
+ form: form$1,
1303
+ isLoading: isLoading
1304
+ }))(function (c) {
1305
+ return c && utils.addExtraProp(c, {
1306
+ isLoading: form$1.isLoading,
1307
+ type: "submit"
1308
+ });
1246
1309
  }))
1247
- }, utils.callIfFunction(children, form$1), React__default.createElement(form.Errors, null));
1310
+ }, utils.callIfFunction(children, form$1), React__default.createElement(form.Errors, {
1311
+ autoScroll: true
1312
+ }));
1248
1313
  });
1249
1314
  };
1250
1315
  var FormDialog = ConfirmDialog;
1251
1316
 
1252
- function _templateObject2() {
1317
+ function _templateObject3() {
1253
1318
  var data = _taggedTemplateLiteral(["\n padding: 1rem;\n ", "\n "]);
1254
1319
 
1255
- _templateObject2 = function _templateObject2() {
1320
+ _templateObject3 = function _templateObject3() {
1256
1321
  return data;
1257
1322
  };
1258
1323
 
1259
1324
  return data;
1260
1325
  }
1261
1326
 
1262
- function _templateObject() {
1327
+ function _templateObject2() {
1263
1328
  var data = _taggedTemplateLiteral(["\n height: 42px;\n padding: 0 1rem;\n @supports (-webkit-touch-callout: none) {\n font-size: 16px;\n }\n "]);
1264
1329
 
1265
- _templateObject = function _templateObject() {
1330
+ _templateObject2 = function _templateObject2() {
1331
+ return data;
1332
+ };
1333
+
1334
+ return data;
1335
+ }
1336
+
1337
+ function _templateObject$1() {
1338
+ var data = _taggedTemplateLiteral(["\n bottom: 10px;\n "]);
1339
+
1340
+ _templateObject$1 = function _templateObject() {
1266
1341
  return data;
1267
1342
  };
1268
1343
 
@@ -1271,12 +1346,12 @@ function _templateObject() {
1271
1346
  var InputLoading = styled__default(components.Loading).withConfig({
1272
1347
  displayName: "TextInput__InputLoading",
1273
1348
  componentId: "yzpeng-0"
1274
- })(["bottom:8px;right:0.6rem;left:auto;top:auto;"]);
1349
+ })(["bottom:8px;right:0.6rem;left:auto;top:auto;", " "], utils.media.mobile(_templateObject$1()));
1275
1350
  var Input = styled__default.input.withConfig({
1276
1351
  displayName: "TextInput__Input",
1277
1352
  componentId: "yzpeng-1"
1278
- })(["width:100%;font-size:14px;border:1px solid ", ";border-radius:6px;outline:0;outline:none;color:", ";background:white;position:relative;height:3rem;padding:0 0.7rem;overflow:auto;", "::-webkit-input-placeholder{color:rgba(0,0,0,0.3);}::-moz-placeholder{color:rgba(0,0,0,0.3);}:-moz-placeholder{color:rgba(0,0,0,0.3);}:-ms-input-placeholder{color:rgba(0,0,0,0.3);}", "::-ms-clear{display:none;}", " ", " ", ""], utils.getColor('gray210'), utils.getColor('gray60'), utils.media.mobile(_templateObject()), function (props) {
1279
- return !props.hasTextBox && styled.css([":focus{border-color:", ";box-shadow:0px 0px 0px 2px rgba(0,0,0,0.1);}", ""], utils.getColor('gray180'), function (props) {
1353
+ })(["width:100%;font-size:14px;border:1px solid ", ";border-radius:6px;outline:0;outline:none;color:", ";background:white;position:relative;height:3rem;padding:0 0.7rem;overflow:auto;", "::-webkit-input-placeholder{color:rgba(0,0,0,0.3);}::-moz-placeholder{color:rgba(0,0,0,0.3);}:-moz-placeholder{color:rgba(0,0,0,0.3);}:-ms-input-placeholder{color:rgba(0,0,0,0.3);}", "::-ms-clear{display:none;}", " ", " ", ""], utils.getColor('gray210'), utils.getColor('gray60'), utils.media.mobile(_templateObject2()), function (props) {
1354
+ return !props.hasTextBox && !props.noFocus && styled.css([":focus{border-color:", ";box-shadow:0px 0px 0px 2px rgba(0,0,0,0.1);}", ""], utils.getColor('gray180'), function (props) {
1280
1355
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
1281
1356
  });
1282
1357
  }, function (props) {
@@ -1286,7 +1361,7 @@ var Input = styled__default.input.withConfig({
1286
1361
  return props.regularInputHeight ? 36 : props.minHeight || 60;
1287
1362
  }, function (props) {
1288
1363
  return props.autoResize ? 'overflow:hidden;' : 'overflow:auto;';
1289
- }, utils.media.mobile(_templateObject2(), function (props) {
1364
+ }, utils.media.mobile(_templateObject3(), function (props) {
1290
1365
  return props.regularInputHeight && 'min-height: 42px;';
1291
1366
  }));
1292
1367
  }, utils.customTheme('TextInput'));
@@ -1344,7 +1419,9 @@ var useTextInput = function useTextInput(_ref, ref) {
1344
1419
  rawHasErrors = _ref.rawHasErrors,
1345
1420
  transformOnBlur = _ref.transformOnBlur,
1346
1421
  raw = _ref.raw,
1347
- rest = _objectWithoutProperties(_ref, ["onFocus", "onBlur", "autoResize", "constraint", "pattern", "path", "rawValue", "rawSetValue", "rawHasErrors", "transformOnBlur", "raw"]);
1422
+ showValue = _ref.showValue,
1423
+ deleteTrailing = _ref.deleteTrailing,
1424
+ rest = _objectWithoutProperties(_ref, ["onFocus", "onBlur", "autoResize", "constraint", "pattern", "path", "rawValue", "rawSetValue", "rawHasErrors", "transformOnBlur", "raw", "showValue", "deleteTrailing"]);
1348
1425
 
1349
1426
  var _useInput = useInput(_objectSpread({
1350
1427
  path: path,
@@ -1362,7 +1439,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1362
1439
  setFocused = _useState2[1];
1363
1440
 
1364
1441
  var lastSelection = core.useRefState();
1365
- var lastValue = core.useRefState(formValue);
1442
+ var lastValue = core.useRefState(showValue(formValue));
1366
1443
 
1367
1444
  var handleOnFocus = function handleOnFocus(e) {
1368
1445
  setFocused(true);
@@ -1401,7 +1478,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1401
1478
  } catch (e) {}
1402
1479
 
1403
1480
  if (constraint || pattern) {
1404
- setFormValue(validateConstraint(target.value, constraint, formValue, pattern), ref.current);
1481
+ setFormValue(validateConstraint(target.value, constraint, showValue(formValue), pattern), ref.current);
1405
1482
  } else {
1406
1483
  setFormValue(target.value, ref.current);
1407
1484
  }
@@ -1410,9 +1487,19 @@ var useTextInput = function useTextInput(_ref, ref) {
1410
1487
  var validateConstraint = function validateConstraint(value, constraint, prevValue, pattern) {
1411
1488
  var newValue = '';
1412
1489
 
1413
- if (value === lastValue.get() || lastValue.get() && value.length < lastValue.get().length && !pattern) {
1414
- lastValue.set(value);
1415
- return value;
1490
+ if (value === lastValue.get() + "" || lastValue.get() && (lastValue.get() + "").indexOf(value) >= 0 && !pattern) {
1491
+ newValue = value;
1492
+
1493
+ if (deleteTrailing) {
1494
+ if (_isString(deleteTrailing) && value.slice(-deleteTrailing.length) === deleteTrailing) {
1495
+ newValue = value.slice(0, -deleteTrailing.length);
1496
+ } else if (_isRegExp(deleteTrailing) && deleteTrailing.test(value)) {
1497
+ newValue = value.replace(deleteTrailing, '');
1498
+ }
1499
+ }
1500
+
1501
+ lastValue.set(showValue(newValue));
1502
+ return newValue;
1416
1503
  }
1417
1504
 
1418
1505
  if (pattern) {
@@ -1461,7 +1548,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1461
1548
  newValue = utils.digitsToPattern(constraint, value);
1462
1549
  }
1463
1550
 
1464
- lastValue.set(newValue);
1551
+ lastValue.set(showValue(newValue));
1465
1552
  return newValue;
1466
1553
  };
1467
1554
 
@@ -1490,6 +1577,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1490
1577
  fieldClassName = _ref2$fieldClassName === void 0 ? '' : _ref2$fieldClassName,
1491
1578
  _ref2$FieldType = _ref2.FieldType,
1492
1579
  FieldType = _ref2$FieldType === void 0 ? Field : _ref2$FieldType,
1580
+ margin = _ref2.margin,
1493
1581
  rawValue = _ref2.value,
1494
1582
  rawSetValue = _ref2.setValue,
1495
1583
  rawHasErrors = _ref2.hasErrors,
@@ -1498,6 +1586,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1498
1586
  _ref2$onImage = _ref2.onImage,
1499
1587
  onImage = _ref2$onImage === void 0 ? false : _ref2$onImage,
1500
1588
  autoFocus = _ref2.autoFocus,
1589
+ noFocus = _ref2.noFocus,
1501
1590
  onFocus = _ref2.onFocus,
1502
1591
  onBlur = _ref2.onBlur,
1503
1592
  pattern = _ref2.pattern,
@@ -1507,7 +1596,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1507
1596
  raw = _ref2.raw,
1508
1597
  _ref2$tabIndex = _ref2.tabIndex,
1509
1598
  tabIndex = _ref2$tabIndex === void 0 ? 1 : _ref2$tabIndex,
1510
- rest = _objectWithoutProperties(_ref2, ["showValue", "label", "type", "helpText", "descText", "bellowDescText", "mandatory", "isLoading", "locked", "textBoxBefore", "textBoxAfter", "className", "fieldClassName", "FieldType", "value", "setValue", "hasErrors", "textarea", "onImage", "autoFocus", "onFocus", "onBlur", "pattern", "autoResize", "constraint", "path", "raw", "tabIndex"]);
1599
+ rest = _objectWithoutProperties(_ref2, ["showValue", "label", "type", "helpText", "descText", "bellowDescText", "mandatory", "isLoading", "locked", "textBoxBefore", "textBoxAfter", "className", "fieldClassName", "FieldType", "margin", "value", "setValue", "hasErrors", "textarea", "onImage", "autoFocus", "noFocus", "onFocus", "onBlur", "pattern", "autoResize", "constraint", "path", "raw", "tabIndex"]);
1511
1600
 
1512
1601
  var ref = core.useEnsureRef(forwardedRef);
1513
1602
 
@@ -1521,7 +1610,8 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1521
1610
  rawValue: rawValue,
1522
1611
  rawSetValue: rawSetValue,
1523
1612
  rawHasErrors: rawHasErrors,
1524
- raw: raw
1613
+ raw: raw,
1614
+ showValue: showValue
1525
1615
  }, rest), ref),
1526
1616
  _useTextInput2 = _slicedToArray(_useTextInput, 4),
1527
1617
  value = _useTextInput2[0],
@@ -1561,6 +1651,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1561
1651
  "data-hj-whitelist": type !== "password",
1562
1652
  locked: locked,
1563
1653
  autoFocus: !utils.isTouchDevice() && autoFocus,
1654
+ noFocus: noFocus,
1564
1655
  hasErrors: hasErrors,
1565
1656
  isOnImage: onImage,
1566
1657
  ref: ref,
@@ -1581,7 +1672,8 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1581
1672
  bellowDescText: bellowDescText,
1582
1673
  helpText: helpText,
1583
1674
  label: label,
1584
- labelClick: focusInput
1675
+ labelClick: focusInput,
1676
+ margin: margin
1585
1677
  }, isLoading && React__default.createElement(InputLoading, {
1586
1678
  absolute: true,
1587
1679
  size: 20
@@ -1616,15 +1708,17 @@ var WithImageInput = function WithImageInput(_ref) {
1616
1708
  multiple = _ref.multiple,
1617
1709
  _ref$path = _ref.path,
1618
1710
  path = _ref$path === void 0 ? ["image"] : _ref$path,
1619
- preValidation = _ref.preValidation,
1711
+ _ref$preValidation = _ref.preValidation,
1712
+ preValidation = _ref$preValidation === void 0 ? _stubFalse : _ref$preValidation,
1620
1713
  onChangeFile = _ref.onChangeFile,
1621
1714
  onClose = _ref.onClose,
1622
1715
  onClick = _ref.onClick,
1623
1716
  uploadFetcher = _ref.uploadFetcher,
1624
1717
  onSuccess = _ref.onSuccess,
1718
+ onFailure = _ref.onFailure,
1625
1719
  ajaxError = _ref.ajaxError,
1626
1720
  onTouchEnd = _ref.onTouchEnd,
1627
- rest = _objectWithoutProperties(_ref, ["children", "multiple", "path", "preValidation", "onChangeFile", "onClose", "onClick", "uploadFetcher", "onSuccess", "ajaxError", "onTouchEnd"]);
1721
+ rest = _objectWithoutProperties(_ref, ["children", "multiple", "path", "preValidation", "onChangeFile", "onClose", "onClick", "uploadFetcher", "onSuccess", "onFailure", "ajaxError", "onTouchEnd"]);
1628
1722
 
1629
1723
  var form = React.useContext(FormContext);
1630
1724
  var loading = core.useToggle();
@@ -1736,19 +1830,19 @@ var WithImageInput = function WithImageInput(_ref) {
1736
1830
  imageWidth: imageWidth,
1737
1831
  imageHeight: imageHeight
1738
1832
  });
1739
- }).catch(function () {
1833
+ }).catch(function (e) {
1740
1834
  loading.close();
1741
1835
 
1742
- if (form.getValue(getIndexedPath('image') !== file)) {
1836
+ if (form.getValue(getIndexedPath('image')) !== file) {
1743
1837
  form.setMeta(_update(['submittingImage'], function (v) {
1744
1838
  return v - 1;
1745
1839
  }));
1746
1840
  return;
1747
1841
  }
1748
1842
 
1749
- form.setError(getIndexedPath('image').join('.'), ajaxError);
1843
+ form.setError(getIndexedPath('image').join('.'), utils.callIfFunction(ajaxError, _get('[1].status', e)));
1750
1844
  form.setValues(_flow(_set(getIndexedPath('filename'), oldFilename), _set(getIndexedPath('image'), oldImage), _set(getIndexedPath('imageWidth'), oldImageWidth), _set(getIndexedPath('imageHeight'), oldImageHeight)), false);
1751
- form.setMeta(_flow(_update(['submittingImage'], function (v) {
1845
+ form.setMeta(_flow(_update('uploadingPaths', _difference(_difference.placeholder, [path.join(".")])), _update(['submittingImage'], function (v) {
1752
1846
  return v - 1;
1753
1847
  }), _update(['submittedImages'], function (v) {
1754
1848
  return (v || []).concat([{
@@ -1758,6 +1852,7 @@ var WithImageInput = function WithImageInput(_ref) {
1758
1852
  }]);
1759
1853
  }), _set(getIndexedPath('uploadStatus'), oldUploadStatus)));
1760
1854
  setTempImage(null);
1855
+ utils.callIfFunction(onFailure);
1761
1856
  });
1762
1857
  if (eventTarget && eventTarget.parentNode && typeof eventTarget.parentNode.click === 'function') eventTarget.parentNode.click();
1763
1858
  };
@@ -1811,13 +1906,14 @@ var Checkbox = function Checkbox(_ref) {
1811
1906
  _ref$isChecked = _ref.isChecked,
1812
1907
  isChecked = _ref$isChecked === void 0 ? _identity : _ref$isChecked,
1813
1908
  isList = _ref.isList,
1909
+ onClick = _ref.onClick,
1814
1910
  disabled = _ref.disabled,
1815
1911
  inverted = _ref.inverted,
1816
1912
  path = _ref.path,
1817
1913
  _ref$tabIndex = _ref.tabIndex,
1818
1914
  tabIndex = _ref$tabIndex === void 0 ? 1 : _ref$tabIndex,
1819
1915
  raw = _ref.raw,
1820
- rest = _objectWithoutProperties(_ref, ["className", "children", "isChecked", "isList", "disabled", "inverted", "path", "tabIndex", "raw"]);
1916
+ rest = _objectWithoutProperties(_ref, ["className", "children", "isChecked", "isList", "onClick", "disabled", "inverted", "path", "tabIndex", "raw"]);
1821
1917
 
1822
1918
  var focused = core.useToggle();
1823
1919
 
@@ -1839,7 +1935,9 @@ var Checkbox = function Checkbox(_ref) {
1839
1935
 
1840
1936
  var value = isChecked(testInvert(isList ? (v === null || v === void 0 ? void 0 : v.indexOf(rest.fieldValue)) >= 0 : v));
1841
1937
 
1842
- var onClick = function onClick(e) {
1938
+ var _onClick = function _onClick(e) {
1939
+ utils.callIfFunction(onClick, e);
1940
+
1843
1941
  if (!e.isDefaultPrevented()) {
1844
1942
  if (isList) {
1845
1943
  toggleItem();
@@ -1852,7 +1950,7 @@ var Checkbox = function Checkbox(_ref) {
1852
1950
  };
1853
1951
 
1854
1952
  return React__default.createElement("label", {
1855
- onClick: onClick,
1953
+ onClick: _onClick,
1856
1954
  "data-drag": "false",
1857
1955
  className: className
1858
1956
  }, !utils.isTouchDevice() && React__default.createElement(HiddenInput, {
@@ -1872,8 +1970,18 @@ var Checkbox = function Checkbox(_ref) {
1872
1970
  }));
1873
1971
  };
1874
1972
 
1973
+ function _templateObject3$1() {
1974
+ var data = _taggedTemplateLiteral(["\n bottom: 9px;\n "]);
1975
+
1976
+ _templateObject3$1 = function _templateObject3() {
1977
+ return data;
1978
+ };
1979
+
1980
+ return data;
1981
+ }
1982
+
1875
1983
  function _templateObject2$1() {
1876
- var data = _taggedTemplateLiteral(["\n height: 42px;\n line-height: 40px;\n padding-left: 1rem;\n "]);
1984
+ var data = _taggedTemplateLiteral(["\n min-height: 42px;\n padding-left: 1rem;\n ", "\n "]);
1877
1985
 
1878
1986
  _templateObject2$1 = function _templateObject2() {
1879
1987
  return data;
@@ -1882,10 +1990,10 @@ function _templateObject2$1() {
1882
1990
  return data;
1883
1991
  }
1884
1992
 
1885
- function _templateObject$1() {
1993
+ function _templateObject$2() {
1886
1994
  var data = _taggedTemplateLiteral(["\n ", " > * {\n font-size: 14px;\n }\n "]);
1887
1995
 
1888
- _templateObject$1 = function _templateObject() {
1996
+ _templateObject$2 = function _templateObject() {
1889
1997
  return data;
1890
1998
  };
1891
1999
 
@@ -1894,16 +2002,24 @@ function _templateObject$1() {
1894
2002
  var ComboboxMenu = styled__default(components.ContextListMenu).withConfig({
1895
2003
  displayName: "Combobox__ComboboxMenu",
1896
2004
  componentId: "u2hz6i-0"
1897
- })(["z-index:100;background-color:white;border-radius:4px 4px 6px 6px;margin-top:-1px;margin-bottom:0.5rem;box-shadow:0 2px 2px 0 rgba(0,0,0,0.14),0 3px 10px -2px rgba(0,0,0,0.15),0 1px 2px 0px rgba(0,0,0,0.2);border:1px solid #b4b4b4;max-height:25rem;width:auto;", " > *{font-size:13px;}", " ", ""], components.ListItem, utils.media.mobile(_templateObject$1(), components.ListItem), function (props) {
2005
+ })(["z-index:100;background-color:white;border-radius:4px 4px 6px 6px;margin-top:-1px;margin-bottom:0.5rem;box-shadow:0 2px 2px 0 rgba(0,0,0,0.14),0 3px 10px -2px rgba(0,0,0,0.15),0 1px 2px 0px rgba(0,0,0,0.2);border:1px solid #b4b4b4;max-height:25rem;width:auto;", " > *{font-size:13px;}", " ", " ", ""], components.ListItem, utils.media.mobile(_templateObject$2(), components.ListItem), function (props) {
1898
2006
  return props.withoutIcons && styled.css(["", " > *{padding-left:1.25rem;padding-right:1.25rem;}"], components.ListItem);
2007
+ }, function (props) {
2008
+ return props.withWindowing && "\n overflow: hidden;\n padding: 0;\n ";
1899
2009
  });
1900
2010
  var ComboboxInput = styled__default.div.withConfig({
1901
2011
  displayName: "Combobox__ComboboxInput",
1902
2012
  componentId: "u2hz6i-1"
1903
- })(["width:100%;font-size:14px;border:1px solid ", ";border-radius:6px;color:", ";background:white;position:relative;line-height:34px;display:block;height:3rem;padding:0 2.25rem 0 0.7rem;;overflow:auto;outline:0;outline:none;cursor:pointer;user-select:none;", " ", ":focus{border-color:", ";box-shadow:0px 0px 0px 2px rgba(0,0,0,0.1);}", ""], utils.getColor('gray210'), utils.getColor('gray60'), utils.media.mobile(_templateObject2$1()), function (props) {
1904
- return props.comboboxIsOpen && "\n // border-bottom-left-radius: 0;\n // border-bottom-right-radius: 0;\n ";
2013
+ })(["width:100%;font-size:14px;border:1px solid ", ";border-radius:6px;color:", ";background:white;position:relative;display:block;min-height:3rem;padding:0.5rem 2.5rem 0.5rem 0.7rem;overflow:auto;outline:0;outline:none;cursor:pointer;user-select:none;overflow:hidden;display:flex;align-items:center;word-break:break-word;", " ", " ", ":focus{border-color:", ";box-shadow:0px 0px 0px 2px rgba(0,0,0,0.1);}", " input{position:absolute;top:-1px;left:0;border:none;", "}"], utils.getColor('gray210'), utils.getColor('gray60'), function (props) {
2014
+ return props.suggestive && "\n padding-right: 0.7rem;\n ";
2015
+ }, utils.media.mobile(_templateObject2$1(), function (props) {
2016
+ return props.suggestive && "\n padding-right: 1rem;\n ";
2017
+ }), function (props) {
2018
+ return props.isFocused && styled.css(["border-color:", ";box-shadow:0px 0px 0px 2px rgba(0,0,0,0.1);"], utils.getColor('gray180'));
1905
2019
  }, utils.getColor('gray180'), function (props) {
1906
2020
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
2021
+ }, function (props) {
2022
+ return !props.suggestive && "\n padding-right: 2.5rem;\n ";
1907
2023
  });
1908
2024
  var ComboboxDropdownIcon = styled__default(components.Icon).withConfig({
1909
2025
  displayName: "Combobox__ComboboxDropdownIcon",
@@ -1912,16 +2028,25 @@ var ComboboxDropdownIcon = styled__default(components.Icon).withConfig({
1912
2028
  var FooterOptionsContainer = styled__default.div.withConfig({
1913
2029
  displayName: "Combobox__FooterOptionsContainer",
1914
2030
  componentId: "u2hz6i-3"
1915
- })(["position:sticky;bottom:-0.5rem;background:white;border-top:1px solid rgba(0,0,0,0.1);padding:0.5rem 0;margin:0.5rem 0 -0.5rem;"]);
2031
+ })(["background:white;border-top:1px solid rgba(0,0,0,0.1);padding:0;", ""], function (props) {
2032
+ return !props.hasWindoning && "\n padding: 0.5rem 0;\n margin: 0.5rem 0 -0.5rem;\n bottom: -0.5rem;\n position: sticky;\n ";
2033
+ });
1916
2034
  var ComboboxPlaceholder = styled__default.div.withConfig({
1917
2035
  displayName: "Combobox__ComboboxPlaceholder",
1918
2036
  componentId: "u2hz6i-4"
1919
2037
  })(["color:rgba(0,0,0,0.3);"]);
1920
- var SEPARATOR = {}; //shouldRecenter?
2038
+ var ComboboxLoading = styled__default(components.Loading).withConfig({
2039
+ displayName: "Combobox__ComboboxLoading",
2040
+ componentId: "u2hz6i-5"
2041
+ })(["bottom:6px;right:0.6rem;left:auto;top:auto;", ""], utils.media.mobile(_templateObject3$1()));
2042
+ var SEPARATOR = {};
2043
+ var NO_DIGITABLE_FOUND = "Nenhum resultado encontrado"; //shouldRecenter?
1921
2044
 
1922
- var Combobox = styled__default(function (_ref) {
2045
+ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
1923
2046
  var _ref$getLabel = _ref.getLabel,
1924
2047
  getLabel = _ref$getLabel === void 0 ? _identity : _ref$getLabel,
2048
+ getLabelAs = _ref.getLabelAs,
2049
+ getBoxLabelAs = _ref.getBoxLabelAs,
1925
2050
  getIcon = _ref.getIcon,
1926
2051
  _ref$scrollContainer = _ref.scrollContainer,
1927
2052
  scrollContainer = _ref$scrollContainer === void 0 ? function (el) {
@@ -1930,35 +2055,54 @@ var Combobox = styled__default(function (_ref) {
1930
2055
  className = _ref.className,
1931
2056
  options = _ref.options,
1932
2057
  autoFocus = _ref.autoFocus,
2058
+ autoOpenMenu = _ref.autoOpenMenu,
1933
2059
  mandatory = _ref.mandatory,
1934
2060
  placeholder = _ref.placeholder,
1935
2061
  disabled = _ref.disabled,
1936
2062
  fieldValue = _ref.fieldValue,
1937
2063
  label = _ref.label,
1938
2064
  path = _ref.path,
2065
+ withWindowing = _ref.withWindowing,
1939
2066
  _ref$tabIndex = _ref.tabIndex,
1940
2067
  tabIndex = _ref$tabIndex === void 0 ? 1 : _ref$tabIndex,
1941
2068
  fieldClassName = _ref.fieldClassName,
1942
2069
  descText = _ref.descText,
1943
2070
  helpText = _ref.helpText,
1944
2071
  raw = _ref.raw,
2072
+ digitable = _ref.digitable,
2073
+ digitableConstraint = _ref.digitableConstraint,
2074
+ digitableAsOption = _ref.digitableAsOption,
2075
+ suggestive = _ref.suggestive,
2076
+ onDigitableChange = _ref.onDigitableChange,
1945
2077
  footerOptions = _ref.footerOptions,
2078
+ isLoading = _ref.isLoading,
2079
+ menuRef = _ref.menuRef,
2080
+ overrideSetValue = _ref.overrideSetValue,
2081
+ _ref$transformOnSelec = _ref.transformOnSelect,
2082
+ transformOnSelect = _ref$transformOnSelec === void 0 ? _identity : _ref$transformOnSelec,
1946
2083
  _ref$check = _ref.check,
1947
2084
  check = _ref$check === void 0 ? function (a, b) {
1948
2085
  return a === b;
1949
2086
  } : _ref$check,
1950
- rest = _objectWithoutProperties(_ref, ["getLabel", "getIcon", "scrollContainer", "className", "options", "autoFocus", "mandatory", "placeholder", "disabled", "fieldValue", "label", "path", "tabIndex", "fieldClassName", "descText", "helpText", "raw", "footerOptions", "check"]);
2087
+ rest = _objectWithoutProperties(_ref, ["getLabel", "getLabelAs", "getBoxLabelAs", "getIcon", "scrollContainer", "className", "options", "autoFocus", "autoOpenMenu", "mandatory", "placeholder", "disabled", "fieldValue", "label", "path", "withWindowing", "tabIndex", "fieldClassName", "descText", "helpText", "raw", "digitable", "digitableConstraint", "digitableAsOption", "suggestive", "onDigitableChange", "footerOptions", "isLoading", "menuRef", "overrideSetValue", "transformOnSelect", "check"]);
1951
2088
 
1952
2089
  var selectedElement = React.useRef();
2090
+ var selectedElementIndex = React.useRef();
1953
2091
  var fieldRef = React.useRef();
2092
+ var windowingRef = React.useRef();
1954
2093
  var skipFocus = core.useRefState(autoFocus);
1955
2094
  var skipHover = core.useRefState();
1956
- var listElement = React.useRef();
1957
- var container = React.useRef();
2095
+ var skipDigitableSetValue = core.useRefState();
2096
+ var listElement = core.useEnsureRef(menuRef);
2097
+ var container = core.useEnsureRef(ref);
1958
2098
  var keyState = core.useRefState();
1959
- var contextMenu = core.useToggle();
2099
+ var contextMenu = core.useToggle(false);
1960
2100
  var hover = core.useToggle();
2101
+ var strongHover = core.useRefState();
1961
2102
  var scrollToVisibility = core.useToggle();
2103
+ var autoCompleteUID = core.useLazyConstant(function () {
2104
+ return utils.getUID();
2105
+ });
1962
2106
 
1963
2107
  var _useInput = useInput(_objectSpread({
1964
2108
  fieldValue: fieldValue,
@@ -1969,11 +2113,43 @@ var Combobox = styled__default(function (_ref) {
1969
2113
  confirmValue = _useInput2[1],
1970
2114
  hasErrors = _useInput2[2].hasErrors;
1971
2115
 
1972
- var _useState = React.useState(formValue),
1973
- _useState2 = _slicedToArray(_useState, 2),
1974
- value = _useState2[0],
1975
- _setValue = _useState2[1];
2116
+ var value = core.useToggle(formValue);
2117
+
2118
+ var _setValue = function setValue(v) {
2119
+ return value.openWith(v);
2120
+ };
2121
+
2122
+ var digitableValue = core.useToggle(getLabel(value.isOpen));
2123
+ var digitableRef = React.useRef();
2124
+ var ignoringFilter = core.useToggle();
1976
2125
 
2126
+ var setHover = function setHover(v) {
2127
+ hover.openWith(v);
2128
+
2129
+ if (digitable) {
2130
+ strongHover.set(hover.get());
2131
+ } else {
2132
+ _setValue(v);
2133
+ }
2134
+ };
2135
+
2136
+ React__default.useLayoutEffect(function () {
2137
+ if (digitable && !skipDigitableSetValue.get()) {
2138
+ if (contextMenu.isOpen) {
2139
+ digitableRef.current.select();
2140
+
2141
+ if (value.get() && !suggestive) {
2142
+ setHover(transformOnSelect(value.get()));
2143
+ }
2144
+ } else {
2145
+ digitableValue.openWith(getLabel(value.get()));
2146
+ strongHover.set(hover.get());
2147
+ hover.close();
2148
+ }
2149
+ }
2150
+
2151
+ skipDigitableSetValue.set(false);
2152
+ }, [contextMenu.isOpen]);
1977
2153
  React.useEffect(function () {
1978
2154
  contextMenu.isOpen && recenterScroll();
1979
2155
  }, [contextMenu.isOpen]);
@@ -1986,15 +2162,55 @@ var Combobox = styled__default(function (_ref) {
1986
2162
  autoFocus && ((_container$current = container.current) === null || _container$current === void 0 ? void 0 : _container$current.focus());
1987
2163
  }, []);
1988
2164
  React.useEffect(function () {
1989
- confirmValue(value);
2165
+ autoOpenMenu && toggleCombobox();
2166
+ }, []);
2167
+ core.useUpdateEffect(function () {
2168
+ if (value.isOpen !== formValue && !contextMenu.isOpen) {
2169
+ confirmValue(value.isOpen);
2170
+ }
1990
2171
  }, [!!contextMenu.isOpen]);
1991
2172
  React.useEffect(function () {
1992
- formValue !== value && _setValue(formValue);
2173
+ if (formValue !== value.isOpen) {
2174
+ _setValue(formValue);
2175
+ }
2176
+
2177
+ if (digitable) {
2178
+ digitableValue.openWith(function (prev) {
2179
+ return prev !== getLabel(formValue) ? getLabel(formValue) : prev;
2180
+ });
2181
+ }
1993
2182
  }, [formValue]);
1994
- var allOptions = options.concat(footerOptions || []).filter(function (v) {
2183
+ var filteredOptions = React.useMemo(function () {
2184
+ return _flow(_filter(function (v) {
2185
+ if (!digitable || !digitableValue.isOpen || ignoringFilter.isOpen) {
2186
+ return true;
2187
+ }
2188
+
2189
+ return utils.normalizeText(getLabel(v)).includes(utils.normalizeText(digitableValue.isOpen));
2190
+ }), _sortBy(function (v) {
2191
+ return utils.normalizeText(getLabel(v)).indexOf(utils.normalizeText(digitableValue.isOpen)) > 0;
2192
+ }))(options);
2193
+ }, [options, digitable, digitableValue.isOpen, ignoringFilter.isOpen]);
2194
+ var digitableOption = React.useMemo(function () {
2195
+ var option = filteredOptions.length < 8 && digitableAsOption && !!digitableValue.isOpen && utils.callIfFunction(digitableAsOption, digitableValue.isOpen);
2196
+ return option || !filteredOptions.length && digitable && !suggestive && NO_DIGITABLE_FOUND;
2197
+ }, [digitableValue.isOpen, filteredOptions.length]);
2198
+ var availableOptions = filteredOptions.concat(digitableOption || []);
2199
+ var allOptions = availableOptions.concat(footerOptions || []).filter(function (v) {
1995
2200
  return v !== SEPARATOR;
1996
2201
  });
1997
- var withPlaceholder = !value && value !== 0 && placeholder;
2202
+ var withPlaceholder = !value.isOpen && value.isOpen !== 0 && placeholder;
2203
+ core.useUpdateEffect(function () {
2204
+ if (suggestive) {
2205
+ return;
2206
+ }
2207
+
2208
+ if (hover.isOpen) {
2209
+ setHover(allOptions[0] === NO_DIGITABLE_FOUND ? allOptions[1] : allOptions[0]);
2210
+ } else if (digitableValue.isOpen) {
2211
+ setHover(utils.ifUndefined(value.isOpen, allOptions[0]));
2212
+ }
2213
+ }, [digitableValue.isOpen]);
1998
2214
 
1999
2215
  var toggleCombobox = function toggleCombobox() {
2000
2216
  if (contextMenu.isOpen) {
@@ -2013,25 +2229,43 @@ var Combobox = styled__default(function (_ref) {
2013
2229
  };
2014
2230
 
2015
2231
  var recenterScroll = function recenterScroll() {
2016
- if (listElement.current.getBoundingClientRect().bottom > window.innerHeight) {
2017
- var currentScrollContainer = scrollContainer(container.current);
2018
- currentScrollContainer.scrollTop = listElement.current.getBoundingClientRect().bottom + currentScrollContainer.scrollTop - window.innerHeight;
2019
- }
2232
+ if (withWindowing) {
2233
+ var index = hover.get() ? availableOptions.indexOf(hover.get()) : selectedElementIndex.current;
2234
+
2235
+ if (windowingRef.current) {
2236
+ windowingRef.current.scrollToItem(_isFinite(index) ? index : availableOptions.map(getLabel).indexOf(getLabel(value.get())) || 0, "center");
2237
+ }
2238
+ } else {
2239
+ if (!listElement.current) {
2240
+ return;
2241
+ }
2242
+
2243
+ if (listElement.current.getBoundingClientRect().bottom > window.innerHeight) {
2244
+ var currentScrollContainer = scrollContainer(container.current);
2245
+ currentScrollContainer.scrollTop = listElement.current.getBoundingClientRect().bottom + currentScrollContainer.scrollTop - window.innerHeight;
2246
+ }
2020
2247
 
2021
- if (selectedElement.current) {
2022
- listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight / 2 - getCurrentHeight() / 2;
2248
+ if (selectedElement.current) {
2249
+ listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight / 2 - getCurrentHeight() / 2;
2250
+ }
2023
2251
  }
2024
2252
  };
2025
2253
 
2026
2254
  var makeOptionVisible = function makeOptionVisible() {
2027
- if ((footerOptions === null || footerOptions === void 0 ? void 0 : footerOptions.indexOf(hover.isOpen)) >= 0) {
2028
- return;
2029
- } else if (selectedElement.current.offsetTop < listElement.current.scrollTop) {
2030
- skipHover.set(true);
2031
- listElement.current.scrollTop = selectedElement.current.offsetTop;
2032
- } else if (selectedElement.current.offsetTop + selectedElement.current.offsetHeight > listElement.current.scrollTop + getCurrentHeight()) {
2033
- skipHover.set(true);
2034
- listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight - getCurrentHeight();
2255
+ if (withWindowing) {
2256
+ if (windowingRef.current) {
2257
+ windowingRef.current.scrollToItem(selectedElementIndex.current || 0);
2258
+ }
2259
+ } else {
2260
+ if (footerOptions && (footerOptions === null || footerOptions === void 0 ? void 0 : footerOptions.indexOf(hover.isOpen)) >= 0 || !listElement.current) {
2261
+ return;
2262
+ } else if (selectedElement.current.offsetTop < listElement.current.scrollTop) {
2263
+ skipHover.set(true);
2264
+ listElement.current.scrollTop = selectedElement.current.offsetTop;
2265
+ } else if (selectedElement.current.offsetTop + selectedElement.current.offsetHeight > listElement.current.scrollTop + getCurrentHeight()) {
2266
+ skipHover.set(true);
2267
+ listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight - getCurrentHeight();
2268
+ }
2035
2269
  }
2036
2270
  };
2037
2271
 
@@ -2045,7 +2279,32 @@ var Combobox = styled__default(function (_ref) {
2045
2279
  hover.openWith(value);
2046
2280
  };
2047
2281
 
2282
+ var digitableKeyDown = function digitableKeyDown(e) {
2283
+ if (e.key.length == 1 || e.key == "Spacebar") {
2284
+ e.stopPropagation();
2285
+ } else if (e.key === 'Tab' || e.key === 'Enter') {
2286
+ if (suggestive && allOptions.indexOf(strongHover.get()) < 0) {
2287
+ if (allOptions.indexOf(value.isOpen) >= 0) {
2288
+ _setValue(transformOnSelect(value.isOpen));
2289
+ } else {
2290
+ _setValue(transformOnSelect(utils.callIfFunction(digitableAsOption, digitableValue.get()) || digitableValue.get()));
2291
+ }
2292
+ } else if (strongHover.get() === hover.get()) {
2293
+ _setValue(transformOnSelect(strongHover.get()));
2294
+ }
2295
+
2296
+ if (e.key === "Enter") {
2297
+ skipFocus.set(true);
2298
+ container.current.focus();
2299
+ }
2300
+ }
2301
+ };
2302
+
2048
2303
  var keyDown = function keyDown(e) {
2304
+ if (e.getModifierState('Shift') && e.key === 'Tab') {
2305
+ return;
2306
+ }
2307
+
2049
2308
  if ((e.key === 'Escape' || e.key === 'Tab') && contextMenu.isOpen) {
2050
2309
  e.stopPropagation();
2051
2310
  toggleCombobox();
@@ -2056,6 +2315,12 @@ var Combobox = styled__default(function (_ref) {
2056
2315
 
2057
2316
  if (!contextMenu.isOpen) {
2058
2317
  contextMenu.open();
2318
+
2319
+ if (digitable) {
2320
+ skipDigitableSetValue.set(true);
2321
+ digitableValue.openWith(e.key);
2322
+ return;
2323
+ }
2059
2324
  }
2060
2325
 
2061
2326
  var prevKeyState = keyState.get();
@@ -2077,12 +2342,10 @@ var Combobox = styled__default(function (_ref) {
2077
2342
 
2078
2343
  var goTo = function goTo(index) {
2079
2344
  scrollToVisibility.open();
2080
- hover.openWith(allOptions[index]);
2081
-
2082
- _setValue(allOptions[index]);
2345
+ setHover(allOptions[index]);
2083
2346
  };
2084
2347
 
2085
- var currentIndex = allOptions.indexOf(hover.isOpen !== false ? hover.isOpen : value);
2348
+ var currentIndex = allOptions.indexOf(hover.isOpen !== false ? hover.isOpen : value.isOpen);
2086
2349
  var direction = repeated ? e.shiftKey ? -1 : 1 : 0;
2087
2350
  var fnName = direction < 0 ? 'lastIndexOf' : 'indexOf';
2088
2351
  var item = repeated ? word.slice(0, 1) : word;
@@ -2109,16 +2372,14 @@ var Combobox = styled__default(function (_ref) {
2109
2372
 
2110
2373
  if (contextMenu.isOpen) {
2111
2374
  if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
2112
- var oldValue = hover.isOpen !== false ? hover.isOpen : value;
2375
+ var oldValue = hover.isOpen !== false ? hover.isOpen : value.isOpen;
2113
2376
  var previousIndex = allOptions.indexOf(oldValue);
2114
2377
  var newIndex = Math.min(Math.max((previousIndex + allOptions.length + (e.key === 'ArrowUp' ? previousIndex < 0 ? 0 : -1 : 1)) % allOptions.length, 0), allOptions.length - 1);
2115
2378
  scrollToVisibility.open();
2116
- hover.openWith(allOptions[newIndex]);
2117
-
2118
- _setValue(allOptions[newIndex]);
2379
+ setHover(allOptions[newIndex]);
2119
2380
  } else {
2120
2381
  if (hover.isOpen !== false) {
2121
- _setValue(hover.isOpen);
2382
+ _setValue(transformOnSelect(hover.isOpen));
2122
2383
  }
2123
2384
 
2124
2385
  toggleCombobox();
@@ -2128,30 +2389,91 @@ var Combobox = styled__default(function (_ref) {
2128
2389
  }
2129
2390
  };
2130
2391
 
2131
- var createOption = function createOption(option, i) {
2392
+ var createOption = function createOption(option, i, props, opts) {
2132
2393
  if (option === SEPARATOR) {
2133
2394
  return React__default.createElement(components.ListSeparator, {
2134
2395
  key: "separator" + i
2135
2396
  });
2136
2397
  }
2137
2398
 
2138
- var label = getLabel(option);
2139
- return React__default.createElement(Option, {
2399
+ if (option === NO_DIGITABLE_FOUND) {
2400
+ return React__default.createElement(Option, {
2401
+ key: NO_DIGITABLE_FOUND + i,
2402
+ disabled: true,
2403
+ label: NO_DIGITABLE_FOUND
2404
+ });
2405
+ }
2406
+
2407
+ var label = getLabel(option, {
2408
+ option: true
2409
+ });
2410
+ var checked = hover.isOpen !== false ? check(option, hover.isOpen) : check(option, value.isOpen);
2411
+
2412
+ if (checked) {
2413
+ selectedElementIndex.current = i;
2414
+ }
2415
+
2416
+ return React__default.createElement(Option, _extends({
2140
2417
  key: label + i,
2141
2418
  option: option,
2142
2419
  icon: utils.callIfFunction(getIcon, option),
2143
- checked: hover.isOpen !== false ? option === hover.isOpen : check(option, value),
2144
- label: label,
2420
+ checked: checked,
2421
+ label: getLabelAs ? getLabelAs(option) : label,
2145
2422
  setValue: function setValue(v) {
2146
- _setValue(v);
2423
+ if (!utils.callIfFunction(overrideSetValue, v, {
2424
+ setValue: _setValue,
2425
+ close: contextMenu.close
2426
+ })) {
2427
+ _setValue(transformOnSelect(v));
2147
2428
 
2148
- contextMenu.close();
2429
+ contextMenu.close();
2430
+ }
2149
2431
  skipFocus.set(true);
2150
2432
  container.current.focus();
2151
2433
  },
2152
2434
  setRef: selectedElement,
2153
2435
  onHover: handleHover
2154
- });
2436
+ }, props));
2437
+ };
2438
+
2439
+ var onClickInput = function onClickInput() {
2440
+ if (digitableRef.current && !contextMenu.get()) {
2441
+ digitableRef.current.select();
2442
+ }
2443
+
2444
+ if (!suggestive) {
2445
+ ignoringFilter.open();
2446
+ }
2447
+
2448
+ contextMenu.open();
2449
+ };
2450
+
2451
+ var onFocus = function onFocus(e) {
2452
+ if (skipFocus.get()) {
2453
+ skipFocus.set(false);
2454
+ } else {
2455
+ if (!suggestive) {
2456
+ ignoringFilter.open();
2457
+ }
2458
+
2459
+ contextMenu.open();
2460
+ }
2461
+ };
2462
+
2463
+ var onBlur = function onBlur(e) {
2464
+ var _listElement$current;
2465
+
2466
+ if (!((_listElement$current = listElement.current) === null || _listElement$current === void 0 ? void 0 : _listElement$current.contains(e.relatedTarget))) {
2467
+ if (!availableOptions.length && digitableAsOption && digitableValue.get()) {
2468
+ _setValue(transformOnSelect(utils.callIfFunction(digitableAsOption, digitableValue.get())));
2469
+ } else if (suggestive) {
2470
+ _setValue(transformOnSelect(utils.callIfFunction(digitableAsOption, digitableValue.get()) || digitableValue.get()));
2471
+ } else if (formValue !== value.isOpen) {
2472
+ confirmValue(value.isOpen);
2473
+ }
2474
+
2475
+ contextMenu.close();
2476
+ }
2155
2477
  };
2156
2478
 
2157
2479
  return React__default.createElement(Field, {
@@ -2163,60 +2485,106 @@ var Combobox = styled__default(function (_ref) {
2163
2485
  labelClick: toggleCombobox,
2164
2486
  ref: fieldRef
2165
2487
  }, React__default.createElement(ComboboxInput, {
2166
- onBlur: function onBlur(e) {
2167
- var _listElement$current;
2168
-
2169
- if (!((_listElement$current = listElement.current) === null || _listElement$current === void 0 ? void 0 : _listElement$current.contains(e.relatedTarget))) {
2170
- confirmValue(value);
2171
- contextMenu.close();
2172
- }
2173
- },
2174
- onFocus: function onFocus() {
2175
- return skipFocus.get() ? skipFocus.set(false) : contextMenu.open();
2176
- },
2177
- onClick: function onClick() {
2178
- return contextMenu.openWith(function (v) {
2179
- return _isBoolean(v) ? 2 : false;
2180
- });
2181
- },
2488
+ onBlur: onBlur,
2489
+ onFocus: onFocus,
2490
+ onClick: onClickInput,
2182
2491
  ref: container,
2183
- tabIndex: tabIndex,
2492
+ tabIndex: contextMenu.isOpen && digitable ? '-1' : tabIndex,
2184
2493
  onKeyDown: keyDown,
2185
2494
  disabled: disabled,
2186
2495
  withPlaceholder: withPlaceholder,
2187
2496
  hasErrors: hasErrors,
2188
- comboboxIsOpen: contextMenu.isOpen
2189
- }, withPlaceholder ? React__default.createElement(ComboboxPlaceholder, null, placeholder) : getLabel(value), React__default.createElement(ComboboxDropdownIcon, {
2497
+ comboboxIsOpen: contextMenu.isOpen,
2498
+ isFocused: digitable && !!contextMenu.isOpen,
2499
+ suggestive: suggestive
2500
+ }, digitable && !!contextMenu.isOpen ? React__default.createElement(TextInput, {
2501
+ raw: true,
2502
+ tabIndex: tabIndex,
2503
+ autoFocus: true,
2504
+ autoComplete: autoCompleteUID,
2505
+ ref: digitableRef,
2506
+ constraint: digitableConstraint,
2507
+ onKeyDown: digitableKeyDown,
2508
+ setValue: function setValue(v) {
2509
+ ignoringFilter.close();
2510
+ digitableValue.openWith(v);
2511
+ },
2512
+ value: digitableValue.isOpen || "",
2513
+ placeholder: placeholder,
2514
+ onChange: onDigitableChange
2515
+ }) : withPlaceholder ? React__default.createElement(ComboboxPlaceholder, null, placeholder) : React__default.createElement("div", null, getBoxLabelAs ? getBoxLabelAs(value.isOpen) : getLabel(value.isOpen)), isLoading ? React__default.createElement(ComboboxLoading, {
2516
+ absolute: true,
2517
+ size: 20
2518
+ }) : !suggestive && React__default.createElement(ComboboxDropdownIcon, {
2190
2519
  icon: "arrow-down"
2191
- }), !!contextMenu.isOpen && React__default.createElement(ComboboxMenuContainer, {
2520
+ }), !!contextMenu.isOpen && (!suggestive || !digitable || allOptions.length && digitableValue.isOpen) && React__default.createElement(ComboboxMenuContainer, {
2521
+ withWindowing: withWindowing,
2192
2522
  ref: listElement,
2193
- options: options,
2523
+ windowingRef: windowingRef,
2524
+ options: availableOptions,
2525
+ digitableValue: digitableValue.get(),
2526
+ digitableAsOption: digitableAsOption,
2194
2527
  footerOptions: footerOptions,
2195
2528
  getIcon: getIcon,
2196
2529
  createOption: createOption
2197
2530
  })));
2198
- }).withConfig({
2531
+ })).withConfig({
2199
2532
  displayName: "Combobox",
2200
- componentId: "u2hz6i-5"
2533
+ componentId: "u2hz6i-6"
2201
2534
  })(["user-select:none;"]);
2202
2535
 
2203
2536
  var _willUseIsSticky = components.willUseIsSticky(),
2204
2537
  _willUseIsSticky2 = _slicedToArray(_willUseIsSticky, 1),
2205
2538
  WithIsSticky = _willUseIsSticky2[0];
2206
2539
 
2207
- var ComboboxMenuContainer = React__default.forwardRef(function (_ref2, ref) {
2208
- var options = _ref2.options,
2209
- footerOptions = _ref2.footerOptions,
2210
- getIcon = _ref2.getIcon,
2211
- createOption = _ref2.createOption;
2540
+ var Option = function Option(_ref2) {
2541
+ var setValue = _ref2.setValue,
2542
+ icon = _ref2.icon,
2543
+ option = _ref2.option,
2544
+ onHover = _ref2.onHover,
2545
+ checked = _ref2.checked,
2546
+ label = _ref2.label,
2547
+ setRef = _ref2.setRef,
2548
+ props = _objectWithoutProperties(_ref2, ["setValue", "icon", "option", "onHover", "checked", "label", "setRef"]);
2549
+
2550
+ return React__default.createElement(components.ListItem, _extends({
2551
+ hover: checked,
2552
+ tabIndex: -1,
2553
+ onMouseOver: function onMouseOver(e) {
2554
+ return onHover(option, e);
2555
+ },
2556
+ ref: checked ? setRef : undefined,
2557
+ onClick: function onClick(e) {
2558
+ e.stopPropagation();
2559
+ setValue(option);
2560
+ }
2561
+ }, props), React__default.createElement("a", null, icon && React__default.createElement(components.Icon, {
2562
+ icon: icon
2563
+ }), label));
2564
+ };
2565
+ var ITEM_HEIGHT = 37;
2566
+ var ComboboxMenuContainer = React__default.forwardRef(function (_ref3, ref) {
2567
+ var options = _ref3.options,
2568
+ digitableAsOption = _ref3.digitableAsOption,
2569
+ footerOptions = _ref3.footerOptions,
2570
+ getIcon = _ref3.getIcon,
2571
+ createOption = _ref3.createOption,
2572
+ withWindowing = _ref3.withWindowing,
2573
+ digitableValue = _ref3.digitableValue,
2574
+ windowingRef = _ref3.windowingRef;
2212
2575
 
2213
2576
  var _usePositioning = components.usePositioning(ref, {
2214
- fill: true
2577
+ fill: true,
2578
+ on: options.length
2215
2579
  }),
2216
2580
  _usePositioning2 = _slicedToArray(_usePositioning, 2),
2217
2581
  positionInfo = _usePositioning2[0],
2218
2582
  positionPlaceholder = _usePositioning2[1];
2219
2583
 
2584
+ var getMenuHeight = function getMenuHeight(options) {
2585
+ return Math.min(options.length * ITEM_HEIGHT + 9, 300 - ((footerOptions === null || footerOptions === void 0 ? void 0 : footerOptions.length) || 0) * ITEM_HEIGHT - ((footerOptions === null || footerOptions === void 0 ? void 0 : footerOptions.length) ? 7 : 0));
2586
+ };
2587
+
2220
2588
  var slot = 'Popup';
2221
2589
  var slotName = React.useMemo(function () {
2222
2590
  return components.getDialogLayersSize() === 0 ? slot : slot + '-' + (components.getDialogLayersSize() - 1);
@@ -2225,39 +2593,30 @@ var ComboboxMenuContainer = React__default.forwardRef(function (_ref2, ref) {
2225
2593
  name: slotName
2226
2594
  }, React__default.createElement(ComboboxMenu, _extends({}, positionInfo, {
2227
2595
  ref: ref,
2596
+ withWindowing: withWindowing,
2228
2597
  withoutIcons: !getIcon
2229
- }), options.map(createOption), footerOptions && React__default.createElement(WithIsSticky, {
2598
+ }), withWindowing ? React__default.createElement(reactWindow.FixedSizeList, {
2599
+ ref: windowingRef,
2600
+ height: getMenuHeight(options),
2601
+ itemCount: options.length,
2602
+ itemSize: ITEM_HEIGHT,
2603
+ width: "100%"
2604
+ }, function (_ref4) {
2605
+ var index = _ref4.index,
2606
+ style = _ref4.style;
2607
+ return createOption(options[index], index, {
2608
+ style: style
2609
+ });
2610
+ }) : options.map(createOption).filter(Boolean), footerOptions && React__default.createElement(WithIsSticky, {
2230
2611
  intersection: true
2231
2612
  }, function (sentinel, isSticky) {
2232
2613
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(FooterOptionsContainer, {
2233
2614
  isSticky: isSticky,
2234
- className: "JS-list-footer"
2615
+ className: "JS-list-footer",
2616
+ hasWindoning: withWindowing
2235
2617
  }, footerOptions.map(createOption)), sentinel("margin-top:-3px;"));
2236
2618
  }))));
2237
2619
  });
2238
- var Option = function Option(_ref3) {
2239
- var setValue = _ref3.setValue,
2240
- icon = _ref3.icon,
2241
- option = _ref3.option,
2242
- onHover = _ref3.onHover,
2243
- checked = _ref3.checked,
2244
- label = _ref3.label,
2245
- setRef = _ref3.setRef;
2246
- return React__default.createElement(components.ListItem, {
2247
- hover: checked,
2248
- tabIndex: -1,
2249
- onMouseOver: function onMouseOver(e) {
2250
- return onHover(option, e);
2251
- },
2252
- ref: checked ? setRef : undefined,
2253
- onClick: function onClick(e) {
2254
- e.stopPropagation();
2255
- setValue(option);
2256
- }
2257
- }, React__default.createElement("a", null, icon && React__default.createElement(components.Icon, {
2258
- icon: icon
2259
- }), label));
2260
- };
2261
2620
 
2262
2621
  var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2263
2622
  var options = _ref.options,
@@ -2300,7 +2659,7 @@ var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2300
2659
  }
2301
2660
  };
2302
2661
 
2303
- var titleOptions = !value || options.indexOf(value) >= 0 ? options : options.concat(value);
2662
+ var titleOptions = !value || options.indexOf(value) >= 0 ? options : [value].concat(options);
2304
2663
  return customValue.isOpen !== false ? React__default.createElement(TextInput, _extends({
2305
2664
  label: label,
2306
2665
  tabIndex: tabIndex,
@@ -2322,10 +2681,40 @@ var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2322
2681
  }, extra));
2323
2682
  };
2324
2683
 
2325
- function _templateObject$2() {
2684
+ function _templateObject4() {
2326
2685
  var data = _taggedTemplateLiteral(["\n height: 42px;\n "]);
2327
2686
 
2328
- _templateObject$2 = function _templateObject() {
2687
+ _templateObject4 = function _templateObject4() {
2688
+ return data;
2689
+ };
2690
+
2691
+ return data;
2692
+ }
2693
+
2694
+ function _templateObject3$2() {
2695
+ var data = _taggedTemplateLiteral(["\n left: 1rem;\n right: 1rem;\n "]);
2696
+
2697
+ _templateObject3$2 = function _templateObject3() {
2698
+ return data;
2699
+ };
2700
+
2701
+ return data;
2702
+ }
2703
+
2704
+ function _templateObject2$2() {
2705
+ var data = _taggedTemplateLiteral(["\n padding-right: 4rem;\n "]);
2706
+
2707
+ _templateObject2$2 = function _templateObject2() {
2708
+ return data;
2709
+ };
2710
+
2711
+ return data;
2712
+ }
2713
+
2714
+ function _templateObject$3() {
2715
+ var data = _taggedTemplateLiteral(["\n padding: 0.25rem 1rem;\n min-height: 42px;\n "]);
2716
+
2717
+ _templateObject$3 = function _templateObject() {
2329
2718
  return data;
2330
2719
  };
2331
2720
 
@@ -2336,21 +2725,21 @@ var isSafari = ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0;
2336
2725
  var InputLoading$1 = styled__default(components.Loading).withConfig({
2337
2726
  displayName: "AutoComplete__InputLoading",
2338
2727
  componentId: "g0526o-0"
2339
- })(["bottom:8px;right:0.6rem;left:auto;top:10px;"]);
2728
+ })(["bottom:8px;right:0.6rem;left:auto;top:50%;transform:translate(-50%);"]);
2340
2729
  var AutoCompleteInput = styled__default.div.withConfig({
2341
2730
  displayName: "AutoComplete__AutoCompleteInput",
2342
2731
  componentId: "g0526o-1"
2343
- })(["width:100%;font-size:14px;border:1px solid ", ";border-radius:2px;color:", ";cursor:text;background:white;position:relative;outline:0;outline:none;min-height:3rem;line-height:34px;padding:0 0.7rem;", " ", " ", " ", ""], utils.getColor('gray210'), utils.getColor('gray60'), function (props) {
2732
+ })(["width:100%;font-size:14px;border:1px solid ", ";border-radius:6px;color:", ";cursor:text;background:white;position:relative;outline:0;outline:none;min-height:3rem;line-height:28px;padding:0.25rem 0.7rem;display:flex;align-items:center;flex-wrap:wrap;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.getColor('gray60'), function (props) {
2344
2733
  return props.focused && "\n border-color: ".concat(utils.getColor('gray180'), ";\n box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.075);\n ");
2345
2734
  }, function (props) {
2346
2735
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
2347
- }, function (props) {
2348
- return props.withDropdown && styled.css(["padding-right:3rem;"]);
2736
+ }, utils.media.mobile(_templateObject$3()), function (props) {
2737
+ return props.withDropdown && styled.css(["padding-right:3rem;", ""], utils.media.mobile(_templateObject2$2()));
2349
2738
  }, utils.customTheme('TextInput'));
2350
2739
  var AutoCompletePlaceholder = styled__default.span.withConfig({
2351
2740
  displayName: "AutoComplete__AutoCompletePlaceholder",
2352
2741
  componentId: "g0526o-2"
2353
- })(["position:absolute;top:0;pointer-events:none;color:rgba(0,0,0,0.4);"]);
2742
+ })(["position:absolute;top:50%;transform:translateY(-50%);pointer-events:none;color:rgba(0,0,0,0.3);left:0.7rem;right:0.7rem;", ""], utils.media.mobile(_templateObject3$2()));
2354
2743
  var AutoCompleteTextboxDiv = styled__default.div.withConfig({
2355
2744
  displayName: "AutoComplete__AutoCompleteTextboxDiv",
2356
2745
  componentId: "g0526o-3"
@@ -2358,7 +2747,7 @@ var AutoCompleteTextboxDiv = styled__default.div.withConfig({
2358
2747
  var AddedBox = styled__default.span.withConfig({
2359
2748
  displayName: "AutoComplete__AddedBox",
2360
2749
  componentId: "g0526o-4"
2361
- })(["background-color:rgb(230,230,230);padding:2px 2rem 4px 0.75rem;border-radius:12px;font-size:13px;position:relative;margin:0.4rem 0.7rem 0 -0.25rem;white-space:nowrap;display:inline-block;cursor:default;line-height:normal;max-width:90%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;", ""], isSafari ? "\n vertical-align: 2px;\n " : "\n vertical-align: -7px;\n ");
2750
+ })(["background-color:rgb(230,230,230);padding:5px 2rem 5px 0.75rem;border-radius:12px;font-size:13px;position:relative;margin-left:-3px;margin-right:9px;white-space:nowrap;cursor:default;line-height:normal;max-width:90%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;", ""], isSafari ? "\n vertical-align: 2px;\n " : "\n vertical-align: -7px;\n ");
2362
2751
  var RemoveIcon = styled__default(components.Icon).withConfig({
2363
2752
  displayName: "AutoComplete__RemoveIcon",
2364
2753
  componentId: "g0526o-5"
@@ -2376,7 +2765,7 @@ var AutoCompleteError = styled__default(Errors).withConfig({
2376
2765
  var DropdownIconContainer = styled__default(components.Icon).withConfig({
2377
2766
  displayName: "AutoComplete__DropdownIconContainer",
2378
2767
  componentId: "g0526o-8"
2379
- })(["position:absolute;right:0;bottom:0;width:3rem;height:3rem;bottom:-1px;", " ", "{position:absolute;width:2rem;height:2rem;line-height:2rem;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,0.1);border-radius:50%;text-align:center;cursor:pointer;color:", ";:hover,:active{background:rgba(0,0,0,0.15);}}"], utils.media.mobile(_templateObject$2()), components.Icon, utils.getColor('gray90'));
2768
+ })(["position:absolute;right:0;bottom:0;width:3rem;height:3rem;bottom:-1px;", " ", "{position:absolute;width:2rem;height:2rem;line-height:2rem;top:50%;left:50%;transform:translate(-50%,-50%);background:rgba(0,0,0,0.1);border-radius:50%;text-align:center;cursor:pointer;color:", ";:hover,:active{background:rgba(0,0,0,0.15);}}"], utils.media.mobile(_templateObject4()), components.Icon, utils.getColor('gray90'));
2380
2769
 
2381
2770
  var focusBeforeLast = function focusBeforeLast(e) {
2382
2771
  if (e.target && e.target !== e.currentTarget) return;
@@ -2453,6 +2842,7 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
2453
2842
  _ref$confirmIfValueKe = _ref.confirmIfValueKeys,
2454
2843
  confirmIfValueKeys = _ref$confirmIfValueKe === void 0 ? ['Tab'] : _ref$confirmIfValueKe,
2455
2844
  placeholder = _ref.placeholder,
2845
+ className = _ref.className,
2456
2846
  _ref$getListItem = _ref.getListItem,
2457
2847
  getListItem = _ref$getListItem === void 0 ? getLabel : _ref$getListItem,
2458
2848
  onAddValue = _ref.onAddValue,
@@ -2463,15 +2853,20 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
2463
2853
  mandatory = _ref.mandatory,
2464
2854
  descText = _ref.descText,
2465
2855
  helpText = _ref.helpText,
2466
- label = _ref.label;
2856
+ label = _ref.label,
2857
+ value = _ref.value,
2858
+ setValue = _ref.setValue,
2859
+ raw = _ref.raw;
2467
2860
  var autoCompleteBox = core.useToggle();
2468
2861
  var hoverIndex = core.useToggle();
2469
2862
  var isLoading = core.useToggle();
2470
2863
 
2471
2864
  var _useInput = useInput({
2472
2865
  path: path,
2473
- transform: transform
2474
- }),
2866
+ transform: transform,
2867
+ value: value,
2868
+ setValue: setValue
2869
+ }, raw),
2475
2870
  _useInput2 = _slicedToArray(_useInput, 3),
2476
2871
  formValue = _useInput2[0],
2477
2872
  setFormValue = _useInput2[1],
@@ -2773,6 +3168,7 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
2773
3168
  };
2774
3169
 
2775
3170
  var input = React__default.createElement(React__default.Fragment, null, React__default.createElement(AutoCompleteInput, {
3171
+ className: className,
2776
3172
  ref: ref,
2777
3173
  onFocus: autoCompleteList.length ? autoCompleteBox.open : undefined,
2778
3174
  hasErrors: errorUtils.errors.length > 0 || hasErrors,
@@ -2852,7 +3248,7 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
2852
3248
  labelClick: focusInput
2853
3249
  }, isLoading.isOpen && React__default.createElement(InputLoading$1, {
2854
3250
  absolute: true,
2855
- size: 20
3251
+ size: 24
2856
3252
  }), input);
2857
3253
  });
2858
3254
  AutoComplete.AddedBox = AddedBox;
@@ -3044,10 +3440,40 @@ var IfFormValue = function IfFormValue(_ref2) {
3044
3440
 
3045
3441
  return React__default.createElement(components.TransitionDiv, rest, doInvert(utils.callIfFunction(check, value)) ? utils.ifUndefined(utils.callIfFunction(children, value, setValue), _isObject(value) ? null : value, null) : null);
3046
3442
  };
3047
- var FormMeta = function FormMeta(_ref3) {
3443
+ var SwitchOnFormValue = function SwitchOnFormValue(_ref3) {
3048
3444
  var path = _ref3.path,
3049
3445
  children = _ref3.children,
3050
- inputs = _ref3.inputs;
3446
+ inputs = _ref3.inputs,
3447
+ on = _ref3.on,
3448
+ off = _ref3.off,
3449
+ check = _ref3.check,
3450
+ invert = _ref3.invert,
3451
+ _ref3$map = _ref3.map,
3452
+ map = _ref3$map === void 0 ? _identity : _ref3$map,
3453
+ rest = _objectWithoutProperties(_ref3, ["path", "children", "inputs", "on", "off", "check", "invert", "map"]);
3454
+
3455
+ var _useFormValue5 = useFormValue(path, inputs || []),
3456
+ _useFormValue6 = _slicedToArray(_useFormValue5, 2),
3457
+ value = _useFormValue6[0],
3458
+ setValue = _useFormValue6[1];
3459
+
3460
+ var doInvert = function doInvert(v) {
3461
+ return invert ? !v : v;
3462
+ };
3463
+
3464
+ var isOn = check || invert ? doInvert(utils.callIfFunction(check, value)) : value;
3465
+ var mappedValue = map(value);
3466
+ var onKey = React.useMemo(function () {
3467
+ return utils.getUID();
3468
+ }, [isOn, mappedValue]);
3469
+ return React__default.createElement(components.SwitchDiv, _extends({
3470
+ on: onKey
3471
+ }, rest), isOn ? on && on[mappedValue] ? utils.callIfFunction(on[mappedValue], value, setValue) : utils.ifUndefined(utils.callIfFunction(on, value, setValue), _isObject(value) ? null : value, null) : utils.ifUndefined(utils.callIfFunction(off, value, setValue), _isObject(value) ? null : value, null));
3472
+ };
3473
+ var FormMeta = function FormMeta(_ref4) {
3474
+ var path = _ref4.path,
3475
+ children = _ref4.children,
3476
+ inputs = _ref4.inputs;
3051
3477
 
3052
3478
  var _useFormMeta = useFormMeta(path, inputs || []),
3053
3479
  _useFormMeta2 = _slicedToArray(_useFormMeta, 2),
@@ -3056,6 +3482,28 @@ var FormMeta = function FormMeta(_ref3) {
3056
3482
 
3057
3483
  return utils.ifUndefined(utils.callIfFunction(children, value, setValue), value, null);
3058
3484
  };
3485
+ var LazyFormValues = function LazyFormValues(_ref5) {
3486
+ var value = _ref5.value,
3487
+ _ref5$format = _ref5.format,
3488
+ format = _ref5$format === void 0 ? _identity : _ref5$format,
3489
+ children = _ref5.children;
3490
+ var currentValue = value.read();
3491
+
3492
+ var _useState = React.useState(false),
3493
+ _useState2 = _slicedToArray(_useState, 2),
3494
+ loaded = _useState2[0],
3495
+ setLoaded = _useState2[1];
3496
+
3497
+ var formUtils = React.useContext(FormContext);
3498
+ React.useEffect(function () {
3499
+ formUtils.setValues(format(currentValue), false);
3500
+ setLoaded(utils.getUID);
3501
+ return function () {
3502
+ return value.refresh();
3503
+ };
3504
+ }, []);
3505
+ return utils.callIfFunction(children, loaded);
3506
+ };
3059
3507
 
3060
3508
  var addRootPath = function addRootPath(errorRootPath, errors, path) {
3061
3509
  var rootPath = [].concat(errorRootPath || [], path);
@@ -3104,6 +3552,10 @@ var ConfirmEditableBoxes = React.forwardRef(function (_ref, ref) {
3104
3552
  shared: shared,
3105
3553
  standalone: standalone
3106
3554
  } : shared : standalone;
3555
+ }).catch(function () {
3556
+ return withLoading && editableBoxes().forEach(function (_) {
3557
+ return _.loading().close();
3558
+ });
3107
3559
  }));
3108
3560
 
3109
3561
  case 2:
@@ -3614,6 +4066,8 @@ var SharedEditableTabBox = function SharedEditableTabBox(_ref15) {
3614
4066
  if (!errors) {
3615
4067
  form.setValues(utils._s.unsetOrRemoveAt(path));
3616
4068
  }
4069
+ }).catch(function () {
4070
+ return internalBox.current.loading.close();
3617
4071
  });
3618
4072
  return fetch;
3619
4073
  } else {
@@ -3796,10 +4250,20 @@ var Radiobox = function Radiobox(_ref) {
3796
4250
  }));
3797
4251
  };
3798
4252
 
3799
- function _templateObject$3() {
4253
+ function _templateObject2$3() {
4254
+ var data = _taggedTemplateLiteral(["width:100%;"]);
4255
+
4256
+ _templateObject2$3 = function _templateObject2() {
4257
+ return data;
4258
+ };
4259
+
4260
+ return data;
4261
+ }
4262
+
4263
+ function _templateObject$4() {
3800
4264
  var data = _taggedTemplateLiteral(["\n padding: 7px 12px 7px 32px;\n "]);
3801
4265
 
3802
- _templateObject$3 = function _templateObject() {
4266
+ _templateObject$4 = function _templateObject() {
3803
4267
  return data;
3804
4268
  };
3805
4269
 
@@ -3824,8 +4288,8 @@ var TextLabelContainer = styled__default.div.withConfig({
3824
4288
  var CheckboxContent = styled__default.div.withConfig({
3825
4289
  displayName: "SimpleCheckbox__CheckboxContent",
3826
4290
  componentId: "am8pps-4"
3827
- })(["cursor:pointer;position:relative;padding-left:2rem;", ""], function (props) {
3828
- return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$3()), function (props) {
4291
+ })(["cursor:pointer;position:relative;padding-left:2rem;transition:background 0.2s linear;", ""], function (props) {
4292
+ return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;width:100%;align-items:center;display:flex;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);transition:none;}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$4()), function (props) {
3829
4293
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
3830
4294
  }, function (props) {
3831
4295
  return props.checked && props.highlightSelected && styled.css(["border-color:", ";background:", ";:hover{background:", ";}", "{", "{color:", ";}}"], utils.getColor('main'), function (props) {
@@ -3869,22 +4333,34 @@ var SimpleCheckbox = styled__default(function (_ref) {
3869
4333
  ultraHighlightSelected: ultraHighlightSelected,
3870
4334
  hasErrors: hasErrors,
3871
4335
  disabled: disabled
3872
- }, React__default.createElement(TextLabelContainer, null, React__default.createElement(CheckboxPseudoInput, {
4336
+ }, React__default.createElement(_StyledDiv, null, React__default.createElement(TextLabelContainer, null, React__default.createElement(CheckboxPseudoInput, {
3873
4337
  focused: focused,
3874
4338
  tabIndex: tabIndex
3875
4339
  }, checked && React__default.createElement(components.Icon, {
3876
4340
  icon: "check"
3877
- })), React__default.createElement(TextLabel, null, label), helpText && React__default.createElement(HelpText, null, helpText)), descText && React__default.createElement(DescText, null, descText));
4341
+ })), React__default.createElement(TextLabel, null, label), helpText && React__default.createElement(HelpText, null, helpText)), descText && React__default.createElement(DescText, null, descText)));
3878
4342
  });
3879
4343
  }).withConfig({
3880
4344
  displayName: "SimpleCheckbox",
3881
4345
  componentId: "am8pps-5"
3882
- })(["cursor:pointer;position:relative;margin-bottom:1rem;display:block;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
4346
+ })(["cursor:pointer;position:relative;margin-bottom:1rem;display:flex;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
3883
4347
 
3884
- function _templateObject$4() {
4348
+ var _StyledDiv = styled__default("div")(_templateObject2$3());
4349
+
4350
+ function _templateObject2$4() {
4351
+ var data = _taggedTemplateLiteral(["width:100%;"]);
4352
+
4353
+ _templateObject2$4 = function _templateObject2() {
4354
+ return data;
4355
+ };
4356
+
4357
+ return data;
4358
+ }
4359
+
4360
+ function _templateObject$5() {
3885
4361
  var data = _taggedTemplateLiteral(["\n padding: 7px 12px 7px 32px;\n "]);
3886
4362
 
3887
- _templateObject$4 = function _templateObject() {
4363
+ _templateObject$5 = function _templateObject() {
3888
4364
  return data;
3889
4365
  };
3890
4366
 
@@ -3897,7 +4373,7 @@ var CssCircle = styled__default.div.withConfig({
3897
4373
  var TextLabel$1 = styled__default.span.withConfig({
3898
4374
  displayName: "SimpleRadiobox__TextLabel",
3899
4375
  componentId: "qv83xo-1"
3900
- })(["font-size:13px;line-height:16px;margin:2px 0;display:block;"]);
4376
+ })(["font-size:13px;line-height:16px;margin:2px 0.25rem 2px 0;display:block;"]);
3901
4377
  var DescText$1 = styled__default.div.withConfig({
3902
4378
  displayName: "SimpleRadiobox__DescText",
3903
4379
  componentId: "qv83xo-2"
@@ -3905,12 +4381,12 @@ var DescText$1 = styled__default.div.withConfig({
3905
4381
  var TextLabelContainer$1 = styled__default.div.withConfig({
3906
4382
  displayName: "SimpleRadiobox__TextLabelContainer",
3907
4383
  componentId: "qv83xo-3"
3908
- })(["display:flex;align-items:center;position:relative;", "{margin-left:0.25rem;}"], HelpText);
4384
+ })(["display:flex;align-items:center;position:relative;flex-wrap:wrap;"]);
3909
4385
  var RadioboxContent = styled__default.div.withConfig({
3910
4386
  displayName: "SimpleRadiobox__RadioboxContent",
3911
4387
  componentId: "qv83xo-4"
3912
- })(["cursor:pointer;position:relative;padding-left:2rem;", ""], function (props) {
3913
- return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$4()), function (props) {
4388
+ })(["cursor:pointer;position:relative;padding-left:2rem;transition:background 0.2s linear;", ""], function (props) {
4389
+ return props.framed && styled.css(["border:1px solid ", ";border-radius:6px;min-height:3rem;min-width:8rem;background:white;width:100%;align-items:center;display:flex;:hover{background:rgb(245,245,245);}:active{background:rgb(235,235,235);transition:none;}padding:10px 12px 10px 32px;", " ", " ", " ", " ", ""], utils.getColor('gray210'), utils.media.desktop(_templateObject$5()), function (props) {
3914
4390
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
3915
4391
  }, function (props) {
3916
4392
  return props.checked && props.highlightSelected && styled.css(["border-color:", ";background:", ";:hover{background:", ";}", "{:before{background-color:", ";}}"], utils.getColor('main'), function (props) {
@@ -3941,16 +4417,18 @@ var SimpleRadiobox = styled__default(function (props) {
3941
4417
  ultraHighlightSelected: props.ultraHighlightSelected,
3942
4418
  hasErrors: hasErrors,
3943
4419
  disabled: disabled
3944
- }, React__default.createElement(TextLabelContainer$1, null, React__default.createElement(CssCircle, {
4420
+ }, React__default.createElement(_StyledDiv$1, null, React__default.createElement(TextLabelContainer$1, null, React__default.createElement(CssCircle, {
3945
4421
  checked: checked,
3946
4422
  focused: focused,
3947
4423
  tabIndex: tabIndex
3948
- }), React__default.createElement(TextLabel$1, null, props.label), props.helpText && React__default.createElement(HelpText, null, props.helpText)), props.descText && React__default.createElement(DescText$1, null, props.descText));
4424
+ }), React__default.createElement(TextLabel$1, null, props.label), props.helpText && React__default.createElement(HelpText, null, " ", props.helpText)), props.descText && React__default.createElement(DescText$1, null, props.descText)));
3949
4425
  });
3950
4426
  }).withConfig({
3951
4427
  displayName: "SimpleRadiobox",
3952
4428
  componentId: "qv83xo-5"
3953
- })(["cursor:pointer;position:relative;margin-bottom:1rem;display:block;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
4429
+ })(["cursor:pointer;position:relative;margin-bottom:1rem;display:flex;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
4430
+
4431
+ var _StyledDiv$1 = styled__default("div")(_templateObject2$4());
3954
4432
 
3955
4433
  var InputboxGroup = styled__default(function (_ref) {
3956
4434
  var path = _ref.path,
@@ -3993,7 +4471,7 @@ var InputboxGroup = styled__default(function (_ref) {
3993
4471
  }, function (props) {
3994
4472
  return props.unevenlyWide && "\n width: 100%;\n display: flex;\n label {\n flex-grow: 1;\n }\n ";
3995
4473
  }, function (props) {
3996
- return props.horizontal ? "\n @supports (flex-wrap: wrap) {\n display: flex;\n flex-wrap: wrap;\n }\n min-height: 3rem;\n align-items: center;\n ".concat(SimpleRadiobox, ", ").concat(SimpleCheckbox, " {\n margin-right: 1.5rem;\n margin-bottom: 0.5rem;\n display: inline-block;\n }\n ") : "\n ".concat(SimpleRadiobox, ", ").concat(SimpleCheckbox, " {\n margin-bottom: 0.5rem;\n :last-child {\n margin-bottom: 1rem;\n }\n }\n ");
4474
+ return props.horizontal ? "\n @supports (flex-wrap: wrap) {\n display: flex;\n flex-wrap: wrap;\n }\n min-height: 3rem;\n ".concat(SimpleRadiobox, ", ").concat(SimpleCheckbox, " {\n margin-right: 1.5rem;\n margin-bottom: 0.5rem;\n }\n ") : "\n ".concat(SimpleRadiobox, ", ").concat(SimpleCheckbox, " {\n margin-bottom: 0.5rem;\n :last-child {\n margin-bottom: 1.5rem;\n }\n }\n ");
3997
4475
  }, function (props) {
3998
4476
  return props.framedBoxes && styled.css(["", ""], function (props) {
3999
4477
  return props.horizontal && "\n margin: -4px;\n width: calc(100% + 8px);\n ".concat(SimpleRadiobox, ", ").concat(SimpleCheckbox, " {\n margin: 4px;\n }\n ");
@@ -4002,20 +4480,20 @@ var InputboxGroup = styled__default(function (_ref) {
4002
4480
  var RadioboxGroup = InputboxGroup;
4003
4481
  var CheckboxGroup = InputboxGroup;
4004
4482
 
4005
- function _templateObject2$2() {
4483
+ function _templateObject2$5() {
4006
4484
  var data = _taggedTemplateLiteral(["\n line-height: 42px;\n width: 2.25rem;\n "]);
4007
4485
 
4008
- _templateObject2$2 = function _templateObject2() {
4486
+ _templateObject2$5 = function _templateObject2() {
4009
4487
  return data;
4010
4488
  };
4011
4489
 
4012
4490
  return data;
4013
4491
  }
4014
4492
 
4015
- function _templateObject$5() {
4493
+ function _templateObject$6() {
4016
4494
  var data = _taggedTemplateLiteral(["\n width: 2.5rem;\n "]);
4017
4495
 
4018
- _templateObject$5 = function _templateObject() {
4496
+ _templateObject$6 = function _templateObject() {
4019
4497
  return data;
4020
4498
  };
4021
4499
 
@@ -4028,7 +4506,7 @@ var LEVELS = [DAY, MONTH, YEAR];
4028
4506
  var DatePickerContainer = styled__default.div.withConfig({
4029
4507
  displayName: "DatePicker__DatePickerContainer",
4030
4508
  componentId: "sc-1wo8j4d-0"
4031
- })(["width:20rem;position:absolute;z-index:10;background-color:white;border-radius:5px;border:1px solid ", ";user-select:none;box-shadow:0 0 4px 0 rgba(0,0,0,0.2);font-size:13px;text-align:center;animation:0.2s datePickerFadeInDown ease-out;display:none;@supports (flex-wrap:wrap){display:block;}input{padding-right:2.25rem;", "}@keyframes datePickerFadeInDown{from{opacity:0;transform:translateY(-10px);pointer-events:none;}to{opacity:1;transform:none;pointer-events:none;}}"], utils.getColor('gray210'), utils.media.mobile(_templateObject$5()));
4509
+ })(["width:20rem;position:absolute;z-index:10;background-color:white;border-radius:5px;border:1px solid ", ";user-select:none;box-shadow:0 0 4px 0 rgba(0,0,0,0.2);font-size:13px;text-align:center;animation:0.2s datePickerFadeInDown ease-out;display:none;@supports (flex-wrap:wrap){display:block;}input{padding-right:2.25rem;", "}@keyframes datePickerFadeInDown{from{opacity:0;transform:translateY(-10px);pointer-events:none;}to{opacity:1;transform:none;pointer-events:none;}}"], utils.getColor('gray210'), utils.media.mobile(_templateObject$6()));
4032
4510
  var CalendarHeader = styled__default.div.withConfig({
4033
4511
  displayName: "DatePicker__CalendarHeader",
4034
4512
  componentId: "sc-1wo8j4d-1"
@@ -4082,7 +4560,7 @@ var DatePickerInputIcon = styled__default(components.Icon).withConfig({
4082
4560
  componentId: "sc-1wo8j4d-11"
4083
4561
  })(["position:absolute;outline:none;bottom:0;font-size:21px;line-height:3rem;right:0;width:2rem;cursor:pointer;color:", ";:hover{color:", ";}display:none;@supports (flex-wrap:wrap){display:block;}", " ", ""], utils.getColor('gray150'), utils.getColor('main'), function (props) {
4084
4562
  return props.disabled && 'pointer-events: none;';
4085
- }, utils.media.mobile(_templateObject2$2()));
4563
+ }, utils.media.mobile(_templateObject2$5()));
4086
4564
  var ClearButton = styled__default(components.Icon).withConfig({
4087
4565
  displayName: "DatePicker__ClearButton",
4088
4566
  componentId: "sc-1wo8j4d-12"
@@ -4701,33 +5179,31 @@ function getClosestNextLeapYear(year) {
4701
5179
  return y;
4702
5180
  }
4703
5181
 
4704
- function _templateObject$6() {
5182
+ function _templateObject$7() {
4705
5183
  var data = _taggedTemplateLiteral(["\n padding 1rem;\n "]);
4706
5184
 
4707
- _templateObject$6 = function _templateObject() {
5185
+ _templateObject$7 = function _templateObject() {
4708
5186
  return data;
4709
5187
  };
4710
5188
 
4711
5189
  return data;
4712
5190
  }
4713
5191
 
4714
- var shouldPreventExpand = function shouldPreventExpand(fn) {
4715
- return function (e) {
4716
- return e.target.closest('body,[data-expand="false"],label,input,textarea,button').matches('body,[data-expand="true"]') && fn(e);
4717
- };
5192
+ var shouldPreventExpand = function shouldPreventExpand(e, fn) {
5193
+ return !e.target.closest('body,[data-expand="false"],label,input,textarea,button').matches('body,[data-expand="true"]');
4718
5194
  };
4719
5195
 
4720
5196
  var ExpandableBoxStyled = styled__default.div.withConfig({
4721
5197
  displayName: "ExpandableBox__ExpandableBoxStyled",
4722
5198
  componentId: "sc-1nsk1wq-0"
4723
- })(["padding:1rem;border-radius:6px;background:", ";font-size:14px;outline:none;transition:background 0.25s linear;position:relative;", " ", " & ~ &{margin-top:0.75rem;}", " &{margin-top:0.75rem;}"], utils.getColor('gray240'), function (props) {
5199
+ })(["padding:1rem;border-radius:6px;background:", ";font-size:14px;outline:none;transition:background 0.2s linear;position:relative;", " ", " & ~ &{margin-top:0.75rem;}", " &{margin-top:0.75rem;}"], utils.getColor('lightBluishGray'), function (props) {
4724
5200
  return props.small && "\n padding: 0.875rem 1rem;\n min-height: 3rem;\n ";
4725
5201
  }, function (props) {
4726
- return props.collapsed ? styled.css(["cursor:pointer;padding-right:3.25rem;:hover{background:", ";}:active{background:", ";}"], function (props) {
4727
- return polished.darken(0.05, utils.getColor("gray240")(props));
5202
+ return props.collapsed ? styled.css(["cursor:pointer;padding-right:3.25rem;:hover{background:", ";}:active{background:", ";transition:none;}"], function (props) {
5203
+ return polished.darken(0.035, utils.getColor('lightBluishGray')(props));
4728
5204
  }, function (props) {
4729
- return polished.darken(0.08, utils.getColor("gray240")(props));
4730
- }) : styled.css(["padding 1.5rem;", " ", ""], utils.media.max(340)(_templateObject$6()), function (props) {
5205
+ return polished.darken(0.05, utils.getColor('lightBluishGray')(props));
5206
+ }) : styled.css(["padding 1.5rem;", " ", ""], utils.media.max(340)(_templateObject$7()), function (props) {
4731
5207
  return props.fixMarginBottom && "\n padding-bottom: 0.5rem !important;\n ";
4732
5208
  });
4733
5209
  }, components.SwitchDiv);
@@ -4762,11 +5238,21 @@ var checkErrors = function checkErrors() {
4762
5238
  };
4763
5239
  var timing = utils.animationTiming('0.25s ease-out');
4764
5240
  var switchAnimation = utils.oneWayAnimation('opacity: 1;transform:translateY(0);', 'opacity: 0;', 'opacity: 0; transform:translateY(30px);');
4765
- var ExpandableBox = function ExpandableBox(_ref) {
4766
- var children = _ref.children,
5241
+ var hasAnyExpanded = 0;
5242
+ var ExpandableBox = styled__default(function (_ref) {
5243
+ var className = _ref.className,
5244
+ children = _ref.children,
5245
+ overflowEffect = _ref.overflowEffect,
5246
+ recycleTab = _ref.recycleTab,
5247
+ escCancels = _ref.escCancels,
5248
+ enterConfirms = _ref.enterConfirms,
5249
+ _ref$withIcon = _ref.withIcon,
5250
+ withIcon = _ref$withIcon === void 0 ? true : _ref$withIcon,
4767
5251
  info = _ref.info,
4768
5252
  isOpen = _ref.isOpen,
4769
5253
  openWhen = _ref.openWhen,
5254
+ _ref$canExpand = _ref.canExpand,
5255
+ canExpand = _ref$canExpand === void 0 ? _identity : _ref$canExpand,
4770
5256
  path = _ref.path,
4771
5257
  _ref$retargetFilter = _ref.retargetFilter,
4772
5258
  retargetFilter = _ref$retargetFilter === void 0 ? function (el) {
@@ -4796,6 +5282,10 @@ var ExpandableBox = function ExpandableBox(_ref) {
4796
5282
  _setErrors = _useTransientErrorHel2[0],
4797
5283
  clearErrors = _useTransientErrorHel2[1];
4798
5284
 
5285
+ var previousValue = core.useRefState();
5286
+ var isAutoOpened = core.useToggle(isOpen);
5287
+ var containerRef = React.useRef();
5288
+
4799
5289
  var setErrors = function setErrors() {
4800
5290
  for (var _len2 = arguments.length, errors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
4801
5291
  errors[_key2] = arguments[_key2];
@@ -4823,6 +5313,12 @@ var ExpandableBox = function ExpandableBox(_ref) {
4823
5313
  return result;
4824
5314
  }
4825
5315
  });
5316
+
5317
+ var _useRecycleFocus = core.useRecycleFocus(containerRef, recycleTab && expand.isOpen, recycleTab),
5318
+ _useRecycleFocus2 = _slicedToArray(_useRecycleFocus, 2),
5319
+ firstFocus = _useRecycleFocus2[0],
5320
+ lastFocus = _useRecycleFocus2[1];
5321
+
4826
5322
  var openWhenResult = utils.callIfFunction(openWhen);
4827
5323
  React.useEffect(function () {
4828
5324
  if (openWhenResult) {
@@ -4836,51 +5332,78 @@ var ExpandableBox = function ExpandableBox(_ref) {
4836
5332
  }
4837
5333
  };
4838
5334
  }, [expand.isOpen]);
5335
+ React.useEffect(function () {
5336
+ if (expand.get() && !isAutoOpened.get()) {
5337
+ previousValue.set(getValue());
5338
+ hasAnyExpanded += 1;
5339
+ return function () {
5340
+ hasAnyExpanded -= 1;
5341
+ };
5342
+ }
5343
+ }, [expand.isOpen, isAutoOpened.isOpen]);
5344
+
5345
+ var cancel = function cancel() {
5346
+ setValue(previousValue.get());
5347
+ expand.close();
5348
+ };
5349
+
4839
5350
  var utils$1 = core.useLazyConstant(function () {
4840
5351
  return {
4841
5352
  close: utils.constrainEvent(expand.close),
4842
- setValue: setValue
5353
+ setValue: setValue,
5354
+ cancel: cancel
4843
5355
  };
4844
5356
  });
4845
5357
 
4846
5358
  var onBlur = function onBlur(e) {
4847
5359
  if (e.currentTarget !== e.relatedTarget && (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget))) {
4848
- if (utils.callIfFunction(retargetFilter, e.relatedTarget)) {
5360
+ var retarget = utils.callIfFunction(retargetFilter, e.relatedTarget);
5361
+
5362
+ if (retarget === true) {
4849
5363
  e.target.focus();
4850
- } else {
5364
+ } else if (retarget === false) {
4851
5365
  expand.close();
4852
5366
  }
4853
5367
  }
4854
5368
  };
4855
5369
 
5370
+ var checkEscEnter = function checkEscEnter(e) {
5371
+ if (e.key === 'Enter' && enterConfirms) {
5372
+ e.stopPropagation();
5373
+ e.preventDefault();
5374
+ expand.close();
5375
+ } else if (e.key === 'Escape' && escCancels) {
5376
+ e.stopPropagation();
5377
+ e.preventDefault();
5378
+ cancel();
5379
+ }
5380
+ };
5381
+
5382
+ var onClick = function onClick(e) {
5383
+ return !shouldPreventExpand(e) && utils.callIfFunction(canExpand, e) && !hasAnyExpanded && expand.open();
5384
+ };
5385
+
4856
5386
  return React__default.createElement(ExpandableBoxStyled, {
5387
+ className: className + (expand.isOpen && (enterConfirms || escCancels) ? " JS-dialog-skip-evts" : ""),
5388
+ ref: containerRef,
4857
5389
  tabIndex: -1,
4858
5390
  onBlur: onBlur,
5391
+ onFocus: isAutoOpened.close,
4859
5392
  collapsed: !expand.isOpen,
4860
5393
  fixMarginBottom: fixMarginBottom,
4861
- onClick: shouldPreventExpand(expand.open)
4862
- }, React__default.createElement(FlipDiv$1, {
5394
+ onClick: onClick,
5395
+ onKeyDown: checkEscEnter
5396
+ }, expand.isOpen && firstFocus, React__default.createElement(FlipDiv$1, {
4863
5397
  key: expand.isOpen,
5398
+ overflowEffect: overflowEffect,
4864
5399
  useAnimation: flipAnimation,
4865
5400
  animation: animation,
4866
5401
  animationTiming: animationTiming
4867
- }, expand.isOpen ? utils.callIfFunction(children, value, utils$1) : React__default.createElement(React__default.Fragment, null, utils.callIfFunction(info, value, utils$1), React__default.createElement(EditIcon, null))));
4868
- };
4869
-
4870
- var overflowEffect = function overflowEffect(element) {
4871
- var _element$offsetParent;
4872
-
4873
- if (!(element === null || element === void 0 ? void 0 : (_element$offsetParent = element.offsetParent) === null || _element$offsetParent === void 0 ? void 0 : _element$offsetParent.parentElement)) {
4874
- return;
4875
- }
4876
-
4877
- var parentDom = element.offsetParent.parentElement;
4878
- var previousOverflow = parentDom.style.overflow;
4879
- parentDom.style.overflow = 'hidden';
4880
- return function () {
4881
- return parentDom.style.overflow = previousOverflow;
4882
- };
4883
- };
5402
+ }, expand.isOpen ? utils.callIfFunction(children, value, utils$1) : React__default.createElement(React__default.Fragment, null, utils.callIfFunction(info, value, utils$1), withIcon && React__default.createElement(EditIcon, null))), expand.isOpen && lastFocus);
5403
+ }).withConfig({
5404
+ displayName: "ExpandableBox",
5405
+ componentId: "sc-1nsk1wq-2"
5406
+ })([""]);
4884
5407
 
4885
5408
  var PseudoExpandableBox = function PseudoExpandableBox(_ref2) {
4886
5409
  var children = _ref2.children,
@@ -4894,14 +5417,15 @@ var PseudoExpandableBox = function PseudoExpandableBox(_ref2) {
4894
5417
  };
4895
5418
  var FlipDivStyle = styled__default.div.withConfig({
4896
5419
  displayName: "ExpandableBox__FlipDivStyle",
4897
- componentId: "sc-1nsk1wq-2"
5420
+ componentId: "sc-1nsk1wq-3"
4898
5421
  })(["position:relative;"]);
4899
5422
 
4900
5423
  var FlipDiv$1 = function FlipDiv(_ref3) {
4901
5424
  var useAnimation = _ref3.useAnimation,
4902
5425
  animation = _ref3.animation,
4903
5426
  animationTiming = _ref3.animationTiming,
4904
- props = _objectWithoutProperties(_ref3, ["useAnimation", "animation", "animationTiming"]);
5427
+ overflowEffect = _ref3.overflowEffect,
5428
+ props = _objectWithoutProperties(_ref3, ["useAnimation", "animation", "animationTiming", "overflowEffect"]);
4905
5429
 
4906
5430
  var ref = React.useRef();
4907
5431
  useAnimation(ref, null, null, {
@@ -4914,10 +5438,10 @@ var FlipDiv$1 = function FlipDiv(_ref3) {
4914
5438
  }));
4915
5439
  };
4916
5440
 
4917
- function _templateObject$7() {
5441
+ function _templateObject$8() {
4918
5442
  var data = _taggedTemplateLiteral(["\n padding-right: 2.25rem;\n background: rgba(0,0,0,0.075);\n "]);
4919
5443
 
4920
- _templateObject$7 = function _templateObject() {
5444
+ _templateObject$8 = function _templateObject() {
4921
5445
  return data;
4922
5446
  };
4923
5447
 
@@ -5009,7 +5533,7 @@ var RichTextContainer = styled__default.div.withConfig({
5009
5533
  }, function (props) {
5010
5534
  return props.focus && "\n border-color: ".concat(utils.getColor('gray180'), ";\n box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.1);\n ");
5011
5535
  }, function (props) {
5012
- return props.locked && css(_templateObject$7());
5536
+ return props.locked && css(_templateObject$8());
5013
5537
  });
5014
5538
  var RichTextInput = styled__default.div.withConfig({
5015
5539
  displayName: "RichText__RichTextInput",
@@ -5875,10 +6399,10 @@ var ToggleContainer = styled__default.div.withConfig({
5875
6399
  var Toggle = styled__default.div.withConfig({
5876
6400
  displayName: "ToggleCheckbox__Toggle",
5877
6401
  componentId: "sc-11ob8ah-1"
5878
- })(["cursor:pointer;flex-shrink:0;margin-left:1rem;float:right;width:2.25rem;height:1rem;border-radius:1rem;background:", ";display:inline-block;position:relative;transition:0.25s ease;:after{content:'';transition:0.25s ease;width:1.25rem;height:1.25rem;border-radius:50%;display:block;position:absolute;top:50%;transform:translateY(-50%);", "}", ""], function (props) {
5879
- return props.checked ? 'rgba(0, 132, 214, 0.3)' : 'rgba(0,0,0,0.15)';
6402
+ })(["cursor:pointer;flex-shrink:0;margin-left:1rem;float:right;transition:0.25s ease;width:2.75rem;height:18px;border-radius:18px;background:", ";display:inline-block;position:relative;font-weight:600;:after{content:'';transition:0.25s ease;border-radius:50%;display:block;position:absolute;top:50%;transform:translateY(-50%);width:14px;height:14px;background:white;", "}", ""], function (props) {
6403
+ return props.checked ? utils.getColor('main') : 'rgba(0,0,0,0.14)';
5880
6404
  }, function (props) {
5881
- return props.checked ? styled.css(["left:100%;transform:translate(-100%,-50%);background:", ";"], utils.getColor('main')) : styled.css(["left:0;background:", ";"], utils.getColor('gray150'));
6405
+ return props.checked ? styled.css(["margin-left:-2px;left:100%;transform:translate(-100%,-50%);"]) : styled.css(["margin-left:2px;left:0;"]);
5882
6406
  }, utils.customTheme('ToggleCheckbox'));
5883
6407
  var ToggleLabel = styled__default.div.withConfig({
5884
6408
  displayName: "ToggleCheckbox__ToggleLabel",
@@ -5888,6 +6412,20 @@ var DescText$2 = styled__default.div.withConfig({
5888
6412
  displayName: "ToggleCheckbox__DescText",
5889
6413
  componentId: "sc-11ob8ah-3"
5890
6414
  })(["font-weight:400;color:rgba(0,0,0,0.4);font-size:12px;margin-top:0.25rem;"]);
6415
+ var ToggleCheckboxStyled = styled__default(Checkbox).withConfig({
6416
+ displayName: "ToggleCheckbox__ToggleCheckboxStyled",
6417
+ componentId: "sc-11ob8ah-4"
6418
+ })(["position:relative;border-radius:6px;padding:1rem;min-height:42px;font-weight:500;margin-bottom:1.5rem;cursor:pointer;display:flex;align-items:center;justify-content:space-between;transition:background 0.2s linear;& ~ &{margin-top:-1rem;}", " ", " ", " ", ""], function (props) {
6419
+ return props.gray ? "\n background-color: rgba(0,0,0,0.06);\n :hover {\n background-color: rgba(0,0,0,0.08);\n }\n :active {\n background-color: rgba(0,0,0,0.1);\n transition: none;\n }\n " : styled.css(["background-color:", ";:hover{background:", ";}:active{background:", ";transition:none;}"], utils.getColor('lightBluishGray'), function (props) {
6420
+ return polished.darken(0.035, utils.getColor('lightBluishGray')(props));
6421
+ }, function (props) {
6422
+ return polished.darken(0.05, utils.getColor('lightBluishGray')(props));
6423
+ });
6424
+ }, function (props) {
6425
+ return !props.noFocus && styled.css([":focus-within{background-color:rgba(0,0,0,0.09);:after{content:'';pointer-events:none;position:absolute;top:-3px;right:-3px;left:-3px;bottom:-3px;border-radius:9px;border:2px solid rgba(0,0,0,0.15);}}"]);
6426
+ }, function (props) {
6427
+ return props.disabled && "\n opacity: 0.8;\n pointer-events:none;\n ";
6428
+ }, utils.customTheme('ToggleCheckboxBox'));
5891
6429
  var ToggleCheckbox = styled__default(function (_ref) {
5892
6430
  var path = _ref.path,
5893
6431
  disabled = _ref.disabled,
@@ -5895,14 +6433,16 @@ var ToggleCheckbox = styled__default(function (_ref) {
5895
6433
  descText = _ref.descText,
5896
6434
  helpText = _ref.helpText,
5897
6435
  tabIndex = _ref.tabIndex,
6436
+ noFocus = _ref.noFocus,
5898
6437
  className = _ref.className,
5899
- rest = _objectWithoutProperties(_ref, ["path", "disabled", "label", "descText", "helpText", "tabIndex", "className"]);
6438
+ rest = _objectWithoutProperties(_ref, ["path", "disabled", "label", "descText", "helpText", "tabIndex", "noFocus", "className"]);
5900
6439
 
5901
- return React__default.createElement(Checkbox, _extends({
5902
- className: className,
6440
+ return React__default.createElement(ToggleCheckboxStyled, _extends({
5903
6441
  path: path,
5904
6442
  tabIndex: tabIndex,
5905
- disabled: disabled
6443
+ disabled: disabled,
6444
+ noFocus: noFocus,
6445
+ className: className
5906
6446
  }, rest), function (_ref2) {
5907
6447
  var disabled = _ref2.disabled,
5908
6448
  checked = _ref2.checked,
@@ -5914,17 +6454,13 @@ var ToggleCheckbox = styled__default(function (_ref) {
5914
6454
  });
5915
6455
  }).withConfig({
5916
6456
  displayName: "ToggleCheckbox",
5917
- componentId: "sc-11ob8ah-4"
5918
- })(["position:relative;background-color:rgba(0,0,0,0.06);border-radius:6px;padding:0.75rem 1rem;min-height:36px;font-weight:600;font-weight:500;margin-bottom:1rem;cursor:pointer;display:flex;align-items:center;justify-content:space-between;:hover{background-color:rgba(0,0,0,0.08);}:active{background-color:rgba(0,0,0,0.1);}& ~ &{margin-top:-0.5rem;}", " ", " ", ""], function (props) {
5919
- return !props.noFocus && styled.css([":focus-within{background-color:rgba(0,0,0,0.09);:after{content:'';pointer-events:none;position:absolute;top:-3px;right:-3px;left:-3px;bottom:-3px;border-radius:9px;border:2px solid rgba(0,0,0,0.15);}}"]);
5920
- }, function (props) {
5921
- return props.disabled && "\n opacity: 0.8;\n pointer-events:none;\n ";
5922
- }, utils.customTheme('ToggleCheckboxBox'));
6457
+ componentId: "sc-11ob8ah-5"
6458
+ })([""]);
5923
6459
 
5924
- function _templateObject$8() {
6460
+ function _templateObject$9() {
5925
6461
  var data = _taggedTemplateLiteral(["\n min-width: 0;\n ", "\n "]);
5926
6462
 
5927
- _templateObject$8 = function _templateObject() {
6463
+ _templateObject$9 = function _templateObject() {
5928
6464
  return data;
5929
6465
  };
5930
6466
 
@@ -5943,7 +6479,7 @@ var TabButton = styled__default(components.Button).withConfig({
5943
6479
  return props.isFirst !== undefined && !props.isFirst && "\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n :focus:after{\n border-bottom-left-radius: 2px;\n border-top-left-radius: 2px;\n }\n ";
5944
6480
  }, function (props) {
5945
6481
  return props.isLast !== undefined && !props.isLast && "\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n :focus:after{\n border-bottom-right-radius: 2px;\n border-top-right-radius: 2px;\n z-index: 2;\n }\n ";
5946
- }, utils.media.mobile(_templateObject$8(), function (props) {
6482
+ }, utils.media.mobile(_templateObject$9(), function (props) {
5947
6483
  return props.icon ? "\n padding-left: 1.25rem;\n padding-right: 1rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ";
5948
6484
  }), utils.customTheme('TabButton'));
5949
6485
  var InnerButton = styled__default.a.withConfig({
@@ -5980,6 +6516,40 @@ var TabRadiobox = styled__default(function (_ref) {
5980
6516
  componentId: "sc-1vu3bcn-2"
5981
6517
  })(["display:inline-block;"]);
5982
6518
 
6519
+ var Tab = styled__default.div.withConfig({
6520
+ displayName: "CleanTabRadiobox__Tab",
6521
+ componentId: "uh7jfp-0"
6522
+ })(["width:100%;font-size:16px;color:", ";font-weight:500;margin-left:0;padding:12px 2.5rem;flex-grow:1;height:100%;border-bottom:1px solid ", ";position:relative;", " ", ""], utils.getColor("gray120"), utils.getColor("gray210"), function (props) {
6523
+ return props.checked ? styled.css(["color:", ";:after{content:'';position:absolute;bottom:-2px;left:0;right:0;height:3px;background:", ";border-radius:10px;}"], utils.getColor("main"), utils.getColor("main")) : styled.css(["cursor:pointer;:hover{color:", ";}"], utils.getColor("gray90"));
6524
+ }, utils.customTheme('CleanTabButton'));
6525
+ var InnerButton$1 = styled__default.a.withConfig({
6526
+ displayName: "CleanTabRadiobox__InnerButton",
6527
+ componentId: "uh7jfp-1"
6528
+ })([""]);
6529
+ var CleanTabRadiobox = styled__default(function (_ref) {
6530
+ var label = _ref.label,
6531
+ white = _ref.white,
6532
+ icon = _ref.icon,
6533
+ props = _objectWithoutProperties(_ref, ["label", "white", "icon"]);
6534
+
6535
+ return React__default.createElement(Radiobox, props, function (_ref2) {
6536
+ var disabled = _ref2.disabled,
6537
+ checked = _ref2.checked,
6538
+ hasErrors = _ref2.hasErrors,
6539
+ focused = _ref2.focused;
6540
+ return React__default.createElement(Tab, {
6541
+ innerAs: InnerButton$1,
6542
+ tabIndex: -1,
6543
+ focused: focused,
6544
+ checked: checked,
6545
+ disabled: disabled
6546
+ }, label);
6547
+ });
6548
+ }).withConfig({
6549
+ displayName: "CleanTabRadiobox",
6550
+ componentId: "uh7jfp-2"
6551
+ })(["display:inline-block;"]);
6552
+
5983
6553
  var error = 'Error';
5984
6554
  var messages = {
5985
6555
  required: error,
@@ -6018,6 +6588,14 @@ var confirmEmails = function confirmEmails(emailKey) {
6018
6588
  return (props[emailKey] || confirm) && props[emailKey] !== confirm && messages.confirmEmails;
6019
6589
  };
6020
6590
  };
6591
+ var confirm = function confirm(sourceKey, messageKey) {
6592
+ var isEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (a, b) {
6593
+ return a === b;
6594
+ };
6595
+ return function (confirm, k, props) {
6596
+ return (props[sourceKey] || confirm) && !isEqual(props[sourceKey], confirm) && (messages[messageKey] || messageKey);
6597
+ };
6598
+ };
6021
6599
  var emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
6022
6600
  var emailValidation = function emailValidation(s, k) {
6023
6601
  return !emailRegex.test(s) && messages.emailValidation;
@@ -6053,9 +6631,85 @@ var buildValidation = function buildValidation(validations) {
6053
6631
  }), _fromPairs)(validations), utils.callIfFunction(custom, props)));
6054
6632
  };
6055
6633
  };
6634
+ var buildAsyncValidation = function buildAsyncValidation(validations) {
6635
+ var custom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
6636
+ /*#__PURE__*/
6637
+ _asyncToGenerator(
6638
+ /*#__PURE__*/
6639
+ _regeneratorRuntime.mark(function _callee() {
6640
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
6641
+ while (1) {
6642
+ switch (_context.prev = _context.next) {
6643
+ case 0:
6644
+ case "end":
6645
+ return _context.stop();
6646
+ }
6647
+ }
6648
+ }, _callee, this);
6649
+ }));
6650
+ return (
6651
+ /*#__PURE__*/
6652
+ function () {
6653
+ var _ref6 = _asyncToGenerator(
6654
+ /*#__PURE__*/
6655
+ _regeneratorRuntime.mark(function _callee2(props) {
6656
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
6657
+ while (1) {
6658
+ switch (_context2.prev = _context2.next) {
6659
+ case 0:
6660
+ _context2.t0 = onEmpty;
6661
+ _context2.t1 = _objectSpread;
6662
+ _context2.t2 = {};
6663
+ _context2.next = 5;
6664
+ return _flow(_entries, _map(function (_ref7) {
6665
+ var _ref8 = _slicedToArray(_ref7, 2),
6666
+ k = _ref8[0],
6667
+ v = _ref8[1];
6668
+
6669
+ return Promise.all([].concat(v).map(function (fn) {
6670
+ return fn(_get(k, props), k, props);
6671
+ })).then(function (v) {
6672
+ return [k, v.filter(Boolean)];
6673
+ });
6674
+ }), function (promiseArray) {
6675
+ return Promise.all(promiseArray).then(function (v) {
6676
+ return _flow(_filter(function (_ref9) {
6677
+ var _ref10 = _slicedToArray(_ref9, 2),
6678
+ k = _ref10[0],
6679
+ v = _ref10[1];
6680
+
6681
+ return v.length;
6682
+ }), _fromPairs)(v);
6683
+ });
6684
+ })(validations);
6685
+
6686
+ case 5:
6687
+ _context2.t3 = _context2.sent;
6688
+ _context2.next = 8;
6689
+ return utils.callIfFunction(custom, props);
6690
+
6691
+ case 8:
6692
+ _context2.t4 = _context2.sent;
6693
+ _context2.t5 = (0, _context2.t1)(_context2.t2, _context2.t3, _context2.t4);
6694
+ return _context2.abrupt("return", (0, _context2.t0)(false, _context2.t5));
6695
+
6696
+ case 11:
6697
+ case "end":
6698
+ return _context2.stop();
6699
+ }
6700
+ }
6701
+ }, _callee2, this);
6702
+ }));
6703
+
6704
+ return function (_x) {
6705
+ return _ref6.apply(this, arguments);
6706
+ };
6707
+ }()
6708
+ );
6709
+ };
6056
6710
  var responseFailure = function responseFailure(fn) {
6057
- return function (v, response, _ref5) {
6058
- var setErrors = _ref5.setErrors;
6711
+ return function (v, response, _ref11) {
6712
+ var setErrors = _ref11.setErrors;
6059
6713
  var errorSetter = setErrors;
6060
6714
  var r = [].concat(response, v);
6061
6715
  console.log(r);
@@ -6077,9 +6731,11 @@ var validation = {
6077
6731
  minLength: minLength,
6078
6732
  confirmPasswords: confirmPasswords,
6079
6733
  confirmEmails: confirmEmails,
6734
+ confirm: confirm,
6080
6735
  emailValidation: emailValidation,
6081
6736
  optional: optional,
6082
6737
  buildValidation: buildValidation,
6738
+ buildAsyncValidation: buildAsyncValidation,
6083
6739
  responseFailure: responseFailure
6084
6740
  };
6085
6741
 
@@ -6088,6 +6744,7 @@ exports.AutoCompleteTextbox = AutoCompleteTextbox;
6088
6744
  exports.BellowFieldDescription = BellowFieldDescription;
6089
6745
  exports.Checkbox = Checkbox;
6090
6746
  exports.CheckboxGroup = CheckboxGroup;
6747
+ exports.CleanTabRadiobox = CleanTabRadiobox;
6091
6748
  exports.Combobox = Combobox;
6092
6749
  exports.ComboboxInput = ComboboxInput;
6093
6750
  exports.ComboboxMenu = ComboboxMenu;
@@ -6103,6 +6760,10 @@ exports.Errors = Errors;
6103
6760
  exports.ErrorsContext = ErrorsContext;
6104
6761
  exports.ExpandableBox = ExpandableBox;
6105
6762
  exports.Field = Field;
6763
+ exports.FieldBox = FieldBox;
6764
+ exports.FieldBoxAction = FieldBoxAction;
6765
+ exports.FieldBoxHelpText = FieldBoxHelpText;
6766
+ exports.FieldBoxIcon = FieldBoxIcon;
6106
6767
  exports.FieldDescription = FieldDescription;
6107
6768
  exports.FileInput = FileInput;
6108
6769
  exports.FloatLabelTextInput = FloatLabelTextInput;
@@ -6117,6 +6778,8 @@ exports.IconRadioBoxIconContainer = IconRadioBoxIconContainer;
6117
6778
  exports.IconRadioBoxText = IconRadioBoxText;
6118
6779
  exports.IfFormValue = IfFormValue;
6119
6780
  exports.InputboxGroup = InputboxGroup;
6781
+ exports.LazyFormValues = LazyFormValues;
6782
+ exports.NO_DIGITABLE_FOUND = NO_DIGITABLE_FOUND;
6120
6783
  exports.Option = Option;
6121
6784
  exports.PathContext = PathContext;
6122
6785
  exports.PseudoExpandableBox = PseudoExpandableBox;
@@ -6128,6 +6791,8 @@ exports.RichTextInput = RichTextInput;
6128
6791
  exports.SEPARATOR = SEPARATOR;
6129
6792
  exports.SimpleCheckbox = SimpleCheckbox;
6130
6793
  exports.SimpleRadiobox = SimpleRadiobox;
6794
+ exports.SwitchOnFormValue = SwitchOnFormValue;
6795
+ exports.Tab = Tab;
6131
6796
  exports.TabButton = TabButton;
6132
6797
  exports.TabRadiobox = TabRadiobox;
6133
6798
  exports.TextInput = TextInput;