@startlibs/form 1.0.0-alpha-10h → 1.0.0-alpha-9w.2

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 +613 -1391
  2. package/package.json +4 -6
package/lib/index.js CHANGED
@@ -13,12 +13,10 @@ 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'));
17
16
  var React = require('react');
18
17
  var React__default = _interopDefault(React);
19
18
  var core = require('@startlibs/core');
20
19
  var utils = require('@startlibs/utils');
21
- var _difference = _interopDefault(require('lodash/fp/difference'));
22
20
  var _property = _interopDefault(require('lodash/fp/property'));
23
21
  var _uniqBy = _interopDefault(require('lodash/fp/uniqBy'));
24
22
  var _identity = _interopDefault(require('lodash/fp/identity'));
@@ -27,33 +25,33 @@ var styled__default = _interopDefault(styled);
27
25
  var components = require('@startlibs/components');
28
26
  var polished = require('polished');
29
27
  var reselect = require('reselect');
30
- var _taggedTemplateLiteral = _interopDefault(require('@babel/runtime/helpers/taggedTemplateLiteral'));
28
+ var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
29
+ var _without = _interopDefault(require('lodash/fp/without'));
31
30
  var form = require('@startlibs/form');
31
+ var _taggedTemplateLiteral = _interopDefault(require('@babel/runtime/helpers/taggedTemplateLiteral'));
32
32
  var _isRegExp = _interopDefault(require('lodash/fp/isRegExp'));
33
- var _isString = _interopDefault(require('lodash/fp/isString'));
33
+ var _difference = _interopDefault(require('lodash/fp/difference'));
34
34
  var _union = _interopDefault(require('lodash/fp/union'));
35
35
  var _flow = _interopDefault(require('lodash/fp/flow'));
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');
36
+ var _isBoolean = _interopDefault(require('lodash/fp/isBoolean'));
37
+ var _isString = _interopDefault(require('lodash/fp/isString'));
41
38
  var _classCallCheck = _interopDefault(require('@babel/runtime/helpers/classCallCheck'));
42
39
  var _createClass = _interopDefault(require('@babel/runtime/helpers/createClass'));
43
40
  var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn'));
44
41
  var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf'));
45
42
  var _inherits = _interopDefault(require('@babel/runtime/helpers/inherits'));
43
+ var _filter = _interopDefault(require('lodash/fp/filter'));
46
44
  var _map = _interopDefault(require('lodash/fp/map'));
45
+ var _stubFalse = _interopDefault(require('lodash/fp/stubFalse'));
47
46
  var _isObject = _interopDefault(require('lodash/fp/isObject'));
48
- var _toConsumableArray = _interopDefault(require('@babel/runtime/helpers/toConsumableArray'));
49
- var _isBoolean = _interopDefault(require('lodash/fp/isBoolean'));
50
- var _negate = _interopDefault(require('lodash/fp/negate'));
47
+ var _isFinite = _interopDefault(require('lodash/fp/isFinite'));
51
48
  var _zipObject = _interopDefault(require('lodash/fp/zipObject'));
52
- var _last = _interopDefault(require('lodash/fp/last'));
53
49
  var _flatten = _interopDefault(require('lodash/fp/flatten'));
54
50
  var _fromPairs = _interopDefault(require('lodash/fp/fromPairs'));
55
51
  var _pick = _interopDefault(require('lodash/fp/pick'));
56
52
  var _toPairs = _interopDefault(require('lodash/fp/toPairs'));
53
+ var _negate = _interopDefault(require('lodash/fp/negate'));
54
+ var _get = _interopDefault(require('lodash/fp/get'));
57
55
  var _entries = _interopDefault(require('lodash/fp/entries'));
58
56
 
59
57
  var errorsInsidePathSelector = function errorsInsidePathSelector() {
@@ -139,9 +137,7 @@ var useProvideErrors = function useProvideErrors() {
139
137
  };
140
138
 
141
139
  var setErrors = function setErrors(newErrors) {
142
- console.log(parseMultipleErrors(newErrors));
143
- errors.openWith(parseMultipleErrors(newErrors));
144
- errors.get();
140
+ return errors.openWith(parseMultipleErrors(newErrors));
145
141
  };
146
142
 
147
143
  var setError = function setError(errorPath, errorValue) {
@@ -240,7 +236,7 @@ var useTransientErrorHelper = function useTransientErrorHelper() {
240
236
  showingErrors.current = newErrors;
241
237
  };
242
238
 
243
- React.useEffect(function () {
239
+ React__default.useEffect(function () {
244
240
  return function () {
245
241
  clearCurrentErrors();
246
242
  };
@@ -249,45 +245,24 @@ var useTransientErrorHelper = function useTransientErrorHelper() {
249
245
  };
250
246
  var Errors = function Errors(_ref17) {
251
247
  var path = _ref17.path,
252
- filter = _ref17.filter,
253
- className = _ref17.className,
254
- autoScroll = _ref17.autoScroll;
248
+ className = _ref17.className;
255
249
 
256
250
  var _useContext2 = React.useContext(ErrorsContext),
257
251
  getErrorsInsidePath = _useContext2.getErrorsInsidePath,
258
252
  willRemoveError = _useContext2.willRemoveError;
259
253
 
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
- });
270
-
271
- var prevErrors = core.usePreviousForEffect(uniqErrors);
272
- React.useEffect(function () {
273
- var _ref$current;
254
+ var filter = React.useContext(ErrorFilterContext);
255
+ var errors = filter(getErrorsInsidePath(path));
274
256
 
275
- var changed = _difference(uniqErrors, prevErrors);
257
+ var uniqErrors = _uniqBy(_property(0), errors);
276
258
 
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]);
283
259
  return React__default.createElement(components.TransitionDiv, {
284
260
  block: true
285
- }, uniqErrors.length > 0 && React__default.createElement(Errors.Container, {
286
- ref: ref,
261
+ }, errors.length > 0 && React__default.createElement(Errors.Container, {
287
262
  className: className
288
- }, uniqErrors.map(function (_ref20) {
289
- var _ref21 = _slicedToArray(_ref20, 1),
290
- value = _ref21[0];
263
+ }, uniqErrors.map(function (_ref18) {
264
+ var _ref19 = _slicedToArray(_ref18, 1),
265
+ value = _ref19[0];
291
266
 
292
267
  return value && React__default.createElement(Errors.Item, {
293
268
  key: value
@@ -304,7 +279,7 @@ Errors.Container = styled__default.ul.withConfig({
304
279
  Errors.Item = styled__default.li.withConfig({
305
280
  displayName: "Errors__Item",
306
281
  componentId: "sc-1vuw7bx-1"
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) {
282
+ })(["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) {
308
283
  return polished.lighten(0.42, props.theme.colors.alert);
309
284
  }, function (props) {
310
285
  return polished.lighten(0.35, props.theme.colors.alert);
@@ -314,7 +289,7 @@ Errors.CloseIcon = styled__default(components.Icon).attrs({
314
289
  }).withConfig({
315
290
  displayName: "Errors__CloseIcon",
316
291
  componentId: "sc-1vuw7bx-2"
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) {
292
+ })(["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) {
318
293
  return polished.lighten(0.35, props.theme.colors.alert);
319
294
  }, function (props) {
320
295
  return polished.lighten(0.32, props.theme.colors.alert);
@@ -580,7 +555,7 @@ var useForm = function useForm(_ref, ref) {
580
555
  values = _args.length > 0 && _args[0] !== undefined ? _args[0] : getValues();
581
556
  validation = _args.length > 1 && _args[1] !== undefined ? _args[1] : preValidation;
582
557
  _context.next = 4;
583
- return utils.callIfFunction(validation, values, utils$1);
558
+ return utils.callIfFunction(validation, values);
584
559
 
585
560
  case 4:
586
561
  errors = _context.sent;
@@ -710,14 +685,10 @@ var useForm = function useForm(_ref, ref) {
710
685
  };
711
686
 
712
687
  case 18:
713
- _context2.next = 20;
714
- return transform(values);
715
-
716
- case 20:
717
- request = _context2.sent;
688
+ request = transform(values);
718
689
 
719
690
  if (request) {
720
- _context2.next = 26;
691
+ _context2.next = 24;
721
692
  break;
722
693
  }
723
694
 
@@ -726,19 +697,18 @@ var useForm = function useForm(_ref, ref) {
726
697
  untransformed: true
727
698
  });
728
699
 
729
- case 26:
700
+ case 24:
730
701
  loading.open();
731
- errorsUtils.clearErrors();
732
702
 
733
703
  if (!(!alwaysSave && !hasChangedRef.get() && (!values || values === getValues()))) {
734
- _context2.next = 33;
704
+ _context2.next = 30;
735
705
  break;
736
706
  }
737
707
 
738
- _context2.next = 31;
708
+ _context2.next = 28;
739
709
  return onSuccess(request);
740
710
 
741
- case 31:
711
+ case 28:
742
712
  if (!isUnmounted()) {
743
713
  loading.close();
744
714
  }
@@ -747,17 +717,17 @@ var useForm = function useForm(_ref, ref) {
747
717
  unrequested: request
748
718
  });
749
719
 
750
- case 33:
751
- _context2.prev = 33;
752
- _context2.next = 36;
720
+ case 30:
721
+ _context2.prev = 30;
722
+ _context2.next = 33;
753
723
  return action(request);
754
724
 
755
- case 36:
725
+ case 33:
756
726
  response = _context2.sent;
757
- _context2.next = 39;
727
+ _context2.next = 36;
758
728
  return onSuccess(request, response);
759
729
 
760
- case 39:
730
+ case 36:
761
731
  if (!isUnmounted()) {
762
732
  setHasChanged(false);
763
733
  loading.close();
@@ -768,18 +738,18 @@ var useForm = function useForm(_ref, ref) {
768
738
  response: response
769
739
  });
770
740
 
771
- case 43:
772
- _context2.prev = 43;
773
- _context2.t0 = _context2["catch"](33);
741
+ case 40:
742
+ _context2.prev = 40;
743
+ _context2.t0 = _context2["catch"](30);
774
744
 
775
- if (_get([0, 'errors'], _context2.t0)) {
745
+ if (_context2.t0[0] && _context2.t0[0].errors) {
776
746
  errorsUtils.setErrors(_context2.t0[0].errors);
777
747
  }
778
748
 
779
- _context2.next = 48;
749
+ _context2.next = 45;
780
750
  return onFailure(request, _context2.t0, utils$1);
781
751
 
782
- case 48:
752
+ case 45:
783
753
  if (!isUnmounted()) {
784
754
  loading.close();
785
755
  }
@@ -789,12 +759,12 @@ var useForm = function useForm(_ref, ref) {
789
759
  rejection: _context2.t0
790
760
  };
791
761
 
792
- case 50:
762
+ case 47:
793
763
  case "end":
794
764
  return _context2.stop();
795
765
  }
796
766
  }
797
- }, _callee2, this, [[33, 43]]);
767
+ }, _callee2, this, [[30, 40]]);
798
768
  }));
799
769
 
800
770
  return function submitForm(_x) {
@@ -950,6 +920,13 @@ var skipValidation = function skipValidation() {
950
920
  return true;
951
921
  };
952
922
 
923
+ var itemToggle = function itemToggle(item) {
924
+ return function () {
925
+ var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
926
+ return list.indexOf(item) >= 0 ? _without([item], list) : _toConsumableArray(list).concat([item]);
927
+ };
928
+ };
929
+
953
930
  var formInput = function formInput(_ref) {
954
931
  var undefinedPlaceholder = _ref.undefinedPlaceholder,
955
932
  _ref$isChecked = _ref.isChecked,
@@ -975,18 +952,19 @@ var formInput = function formInput(_ref) {
975
952
  setFormValue = _useFormValue2[1];
976
953
 
977
954
  var setValue = function setValue(value, element) {
978
- var opts = {
979
- path: path,
980
- prevValue: formValue,
981
- element: element
982
- };
983
-
984
- if (!validation(value, opts)) {
955
+ if (!validation(value, path)) {
985
956
  return;
986
957
  }
987
958
 
988
- setFormValue(transform(value, opts));
989
- utils.callIfFunction(onChange, utils.callIfFunction(value, formValue), opts);
959
+ setFormValue(transform(value, {
960
+ path: path,
961
+ prevValue: formValue
962
+ }));
963
+ utils.callIfFunction(onChange, utils.callIfFunction(value, formValue), {
964
+ prevValue: formValue,
965
+ path: path,
966
+ element: element
967
+ });
990
968
  };
991
969
 
992
970
  var setValueFromEventTarget = function setValueFromEventTarget(e) {
@@ -1002,7 +980,7 @@ var formInput = function formInput(_ref) {
1002
980
  };
1003
981
 
1004
982
  var toggleItem = function toggleItem() {
1005
- return setValue(utils._s.itemToggle(fieldValue));
983
+ return setValue(itemToggle(fieldValue));
1006
984
  };
1007
985
 
1008
986
  return [utils.ifUndefined(formValue, undefinedPlaceholder), setValue, {
@@ -1016,10 +994,7 @@ var formInput = function formInput(_ref) {
1016
994
  };
1017
995
 
1018
996
  var rawInput = function rawInput(_ref2) {
1019
- var _errorUtils$paths;
1020
-
1021
997
  var value = _ref2.value,
1022
- path = _ref2.path,
1023
998
  _ref2$isChecked = _ref2.isChecked,
1024
999
  isChecked = _ref2$isChecked === void 0 ? _identity : _ref2$isChecked,
1025
1000
  name = _ref2.name,
@@ -1037,8 +1012,6 @@ var rawInput = function rawInput(_ref2) {
1037
1012
  rawValue = _useState2[0],
1038
1013
  setRawValue = _useState2[1];
1039
1014
 
1040
- var errorUtils = React.useContext(ErrorsContext);
1041
- var formattedPath = utils.formatPath(path);
1042
1015
  React.useEffect(function () {
1043
1016
  setRawValue(value);
1044
1017
  }, [value]);
@@ -1068,11 +1041,10 @@ var rawInput = function rawInput(_ref2) {
1068
1041
  };
1069
1042
 
1070
1043
  var toggleItem = function toggleItem() {
1071
- return setValue(utils._s.itemToggle(fieldValue));
1044
+ return setValue(itemToggle(fieldValue));
1072
1045
  };
1073
1046
 
1074
1047
  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),
1076
1048
  setFromField: setFromField,
1077
1049
  name: name,
1078
1050
  toggle: toggle,
@@ -1132,9 +1104,7 @@ var Container = styled__default.div.withConfig({
1132
1104
  var Label = styled__default.label.withConfig({
1133
1105
  displayName: "Field__Label",
1134
1106
  componentId: "p9woft-2"
1135
- })(["font-weight:500;display:inline-block;font-size:", "px;margin-bottom:.5rem;", " ", ""], function (props) {
1136
- return props.labelFontSize ? props.labelFontSize : '14';
1137
- }, function (props) {
1107
+ })(["font-weight:500;display:inline-block;font-size:14px;margin-bottom:.5rem;", " ", ""], function (props) {
1138
1108
  return props.isOnImage && 'color: #fff;';
1139
1109
  }, utils.customTheme("FieldLabel"));
1140
1110
  var HelpText = styled__default.span.withConfig({
@@ -1160,16 +1130,14 @@ var Field = React__default.forwardRef(function (_ref, ref) {
1160
1130
  mandatory = _ref.mandatory,
1161
1131
  onImage = _ref.onImage,
1162
1132
  children = _ref.children,
1163
- labelFontSize = _ref.labelFontSize,
1164
- rest = _objectWithoutProperties(_ref, ["label", "helpText", "descText", "bellowDescText", "className", "labelClick", "focused", "mandatory", "onImage", "children", "labelFontSize"]);
1133
+ rest = _objectWithoutProperties(_ref, ["label", "helpText", "descText", "bellowDescText", "className", "labelClick", "focused", "mandatory", "onImage", "children"]);
1165
1134
 
1166
1135
  return React__default.createElement(Container, _extends({
1167
1136
  ref: ref
1168
1137
  }, rest, {
1169
1138
  className: className
1170
1139
  }), label && React__default.createElement(Label, _extends({}, rest, {
1171
- onClick: labelClick,
1172
- labelFontSize: labelFontSize
1140
+ onClick: labelClick
1173
1141
  }), label, mandatory && React__default.createElement(Mandatory, {
1174
1142
  mandatory: mandatory
1175
1143
  }, "*"), helpText && React__default.createElement(HelpText, null, " ", helpText), descText && React__default.createElement(FieldDescription, null, descText)), children, bellowDescText && React__default.createElement(BellowFieldDescription, null, bellowDescText));
@@ -1180,41 +1148,14 @@ Field.HelpText = HelpText;
1180
1148
  Field.Description = FieldDescription;
1181
1149
  Field.displayName = "Field";
1182
1150
 
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;"]);
1151
+ var addExtraProp = function addExtraProp(element, extra) {
1152
+ var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
1153
+ return React__default.cloneElement(element, override ? _objectSpread({}, element.props, extra) : _objectSpread({}, extra, element.props), element.props.children);
1154
+ };
1214
1155
 
1215
1156
  var useConfirmDialog = function useConfirmDialog(dialog, args, toggleCallback) {
1216
1157
  return components.useDialog(function (closeDialog) {
1217
- return utils.addExtraProp(utils.callIfFunction(dialog, closeDialog), {
1158
+ return addExtraProp(utils.callIfFunction(dialog, closeDialog), {
1218
1159
  closeDialog: closeDialog
1219
1160
  });
1220
1161
  }, args, toggleCallback);
@@ -1225,7 +1166,7 @@ var useConfirmDialogWithProps = function useConfirmDialogWithProps(dialog, args)
1225
1166
  overrideClose = _ref$overrideClose === void 0 ? true : _ref$overrideClose;
1226
1167
 
1227
1168
  return components.useDialogWithToggle(function (toggle) {
1228
- return utils.addExtraProp(utils.callIfFunction(dialog, toggle.isOpen, toggle.close), {
1169
+ return addExtraProp(utils.callIfFunction(dialog, toggle.isOpen, toggle.close), {
1229
1170
  closeDialog: toggle.close
1230
1171
  }, overrideClose);
1231
1172
  }, args);
@@ -1240,9 +1181,7 @@ var ConfirmDialog = function ConfirmDialog(_ref2) {
1240
1181
  _ref2$cancelLabel = _ref2.cancelLabel,
1241
1182
  cancelLabel = _ref2$cancelLabel === void 0 ? "Cancelar" : _ref2$cancelLabel,
1242
1183
  _ref2$cancelButton = _ref2.cancelButton,
1243
- cancelButton = _ref2$cancelButton === void 0 ? React__default.createElement(components.Button, {
1244
- tabIndex: 2
1245
- }, cancelLabel) : _ref2$cancelButton,
1184
+ cancelButton = _ref2$cancelButton === void 0 ? React__default.createElement(components.Button, null, cancelLabel) : _ref2$cancelButton,
1246
1185
  onFailure = _ref2.onFailure,
1247
1186
  title = _ref2.title,
1248
1187
  keepOnSuccess = _ref2.keepOnSuccess,
@@ -1256,12 +1195,9 @@ var ConfirmDialog = function ConfirmDialog(_ref2) {
1256
1195
  notify = _ref2.notify,
1257
1196
  confirmChanges = _ref2.confirmChanges,
1258
1197
  transform = _ref2.transform,
1259
- isLoading = _ref2.isLoading,
1260
- stickyFooter = _ref2.stickyFooter,
1261
- _ref2$alwaysSave = _ref2.alwaysSave,
1262
- alwaysSave = _ref2$alwaysSave === void 0 ? true : _ref2$alwaysSave;
1198
+ isLoading = _ref2.isLoading;
1263
1199
  return React__default.createElement(form.WithForm, {
1264
- alwaysSave: alwaysSave,
1200
+ alwaysSave: true,
1265
1201
  ref: formRef,
1266
1202
  preValidation: preValidation,
1267
1203
  values: values,
@@ -1295,37 +1231,19 @@ var ConfirmDialog = function ConfirmDialog(_ref2) {
1295
1231
  isLoading: isLoading,
1296
1232
  closeDialog: closeDialog,
1297
1233
  form: form$1,
1298
- stickyFooter: stickyFooter,
1299
- footer: React__default.createElement(React__default.Fragment, null, cancelButton && utils.addExtraProp(utils.callIfFunction(cancelButton, closeDialog), {
1234
+ footer: React__default.createElement(React__default.Fragment, null, cancelButton && addExtraProp(utils.callIfFunction(cancelButton, closeDialog), {
1300
1235
  onClick: closeDialog
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
- });
1236
+ }, false), utils.callIfFunction(alternativeButton, closeDialog), confirm && addExtraProp(confirm, {
1237
+ isLoading: form$1.isLoading,
1238
+ type: "submit"
1309
1239
  }))
1310
- }, utils.callIfFunction(children, form$1), React__default.createElement(form.Errors, {
1311
- autoScroll: true
1312
- }));
1240
+ }, utils.callIfFunction(children, form$1), React__default.createElement(form.Errors, null));
1313
1241
  });
1314
1242
  };
1315
1243
  var FormDialog = ConfirmDialog;
1316
1244
 
1317
- function _templateObject3() {
1318
- var data = _taggedTemplateLiteral(["\n padding: 1rem;\n ", "\n "]);
1319
-
1320
- _templateObject3 = function _templateObject3() {
1321
- return data;
1322
- };
1323
-
1324
- return data;
1325
- }
1326
-
1327
1245
  function _templateObject2() {
1328
- var data = _taggedTemplateLiteral(["\n height: 42px;\n padding: 0 1rem;\n @supports (-webkit-touch-callout: none) {\n font-size: 16px;\n }\n "]);
1246
+ var data = _taggedTemplateLiteral(["\n padding: 1rem;\n ", "\n "]);
1329
1247
 
1330
1248
  _templateObject2 = function _templateObject2() {
1331
1249
  return data;
@@ -1334,10 +1252,10 @@ function _templateObject2() {
1334
1252
  return data;
1335
1253
  }
1336
1254
 
1337
- function _templateObject$1() {
1338
- var data = _taggedTemplateLiteral(["\n bottom: 10px;\n "]);
1255
+ function _templateObject() {
1256
+ var data = _taggedTemplateLiteral(["\n height: 42px;\n padding: 0 1rem;\n @supports (-webkit-touch-callout: none) {\n font-size: 16px;\n }\n "]);
1339
1257
 
1340
- _templateObject$1 = function _templateObject() {
1258
+ _templateObject = function _templateObject() {
1341
1259
  return data;
1342
1260
  };
1343
1261
 
@@ -1346,12 +1264,12 @@ function _templateObject$1() {
1346
1264
  var InputLoading = styled__default(components.Loading).withConfig({
1347
1265
  displayName: "TextInput__InputLoading",
1348
1266
  componentId: "yzpeng-0"
1349
- })(["bottom:8px;right:0.6rem;left:auto;top:auto;", " "], utils.media.mobile(_templateObject$1()));
1267
+ })(["bottom:8px;right:0.6rem;left:auto;top:auto;"]);
1350
1268
  var Input = styled__default.input.withConfig({
1351
1269
  displayName: "TextInput__Input",
1352
1270
  componentId: "yzpeng-1"
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) {
1271
+ })(["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) {
1272
+ 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) {
1355
1273
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
1356
1274
  });
1357
1275
  }, function (props) {
@@ -1361,7 +1279,7 @@ var Input = styled__default.input.withConfig({
1361
1279
  return props.regularInputHeight ? 36 : props.minHeight || 60;
1362
1280
  }, function (props) {
1363
1281
  return props.autoResize ? 'overflow:hidden;' : 'overflow:auto;';
1364
- }, utils.media.mobile(_templateObject3(), function (props) {
1282
+ }, utils.media.mobile(_templateObject2(), function (props) {
1365
1283
  return props.regularInputHeight && 'min-height: 42px;';
1366
1284
  }));
1367
1285
  }, utils.customTheme('TextInput'));
@@ -1419,9 +1337,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1419
1337
  rawHasErrors = _ref.rawHasErrors,
1420
1338
  transformOnBlur = _ref.transformOnBlur,
1421
1339
  raw = _ref.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"]);
1340
+ rest = _objectWithoutProperties(_ref, ["onFocus", "onBlur", "autoResize", "constraint", "pattern", "path", "rawValue", "rawSetValue", "rawHasErrors", "transformOnBlur", "raw"]);
1425
1341
 
1426
1342
  var _useInput = useInput(_objectSpread({
1427
1343
  path: path,
@@ -1439,7 +1355,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1439
1355
  setFocused = _useState2[1];
1440
1356
 
1441
1357
  var lastSelection = core.useRefState();
1442
- var lastValue = core.useRefState(showValue(formValue));
1358
+ var lastValue = core.useRefState(formValue);
1443
1359
 
1444
1360
  var handleOnFocus = function handleOnFocus(e) {
1445
1361
  setFocused(true);
@@ -1478,7 +1394,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1478
1394
  } catch (e) {}
1479
1395
 
1480
1396
  if (constraint || pattern) {
1481
- setFormValue(validateConstraint(target.value, constraint, showValue(formValue), pattern), ref.current);
1397
+ setFormValue(validateConstraint(target.value, constraint, formValue, pattern), ref.current);
1482
1398
  } else {
1483
1399
  setFormValue(target.value, ref.current);
1484
1400
  }
@@ -1487,19 +1403,9 @@ var useTextInput = function useTextInput(_ref, ref) {
1487
1403
  var validateConstraint = function validateConstraint(value, constraint, prevValue, pattern) {
1488
1404
  var newValue = '';
1489
1405
 
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;
1406
+ if (value === lastValue.get() || lastValue.get() && value.length < lastValue.get().length && !pattern) {
1407
+ lastValue.set(value);
1408
+ return value;
1503
1409
  }
1504
1410
 
1505
1411
  if (pattern) {
@@ -1548,7 +1454,7 @@ var useTextInput = function useTextInput(_ref, ref) {
1548
1454
  newValue = utils.digitsToPattern(constraint, value);
1549
1455
  }
1550
1456
 
1551
- lastValue.set(showValue(newValue));
1457
+ lastValue.set(newValue);
1552
1458
  return newValue;
1553
1459
  };
1554
1460
 
@@ -1577,7 +1483,6 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1577
1483
  fieldClassName = _ref2$fieldClassName === void 0 ? '' : _ref2$fieldClassName,
1578
1484
  _ref2$FieldType = _ref2.FieldType,
1579
1485
  FieldType = _ref2$FieldType === void 0 ? Field : _ref2$FieldType,
1580
- margin = _ref2.margin,
1581
1486
  rawValue = _ref2.value,
1582
1487
  rawSetValue = _ref2.setValue,
1583
1488
  rawHasErrors = _ref2.hasErrors,
@@ -1586,7 +1491,6 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1586
1491
  _ref2$onImage = _ref2.onImage,
1587
1492
  onImage = _ref2$onImage === void 0 ? false : _ref2$onImage,
1588
1493
  autoFocus = _ref2.autoFocus,
1589
- noFocus = _ref2.noFocus,
1590
1494
  onFocus = _ref2.onFocus,
1591
1495
  onBlur = _ref2.onBlur,
1592
1496
  pattern = _ref2.pattern,
@@ -1596,7 +1500,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1596
1500
  raw = _ref2.raw,
1597
1501
  _ref2$tabIndex = _ref2.tabIndex,
1598
1502
  tabIndex = _ref2$tabIndex === void 0 ? 1 : _ref2$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"]);
1503
+ 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"]);
1600
1504
 
1601
1505
  var ref = core.useEnsureRef(forwardedRef);
1602
1506
 
@@ -1610,8 +1514,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1610
1514
  rawValue: rawValue,
1611
1515
  rawSetValue: rawSetValue,
1612
1516
  rawHasErrors: rawHasErrors,
1613
- raw: raw,
1614
- showValue: showValue
1517
+ raw: raw
1615
1518
  }, rest), ref),
1616
1519
  _useTextInput2 = _slicedToArray(_useTextInput, 4),
1617
1520
  value = _useTextInput2[0],
@@ -1651,7 +1554,6 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1651
1554
  "data-hj-whitelist": type !== "password",
1652
1555
  locked: locked,
1653
1556
  autoFocus: !utils.isTouchDevice() && autoFocus,
1654
- noFocus: noFocus,
1655
1557
  hasErrors: hasErrors,
1656
1558
  isOnImage: onImage,
1657
1559
  ref: ref,
@@ -1672,8 +1574,7 @@ var TextInput = styled__default(React.forwardRef(function (_ref2, forwardedRef)
1672
1574
  bellowDescText: bellowDescText,
1673
1575
  helpText: helpText,
1674
1576
  label: label,
1675
- labelClick: focusInput,
1676
- margin: margin
1577
+ labelClick: focusInput
1677
1578
  }, isLoading && React__default.createElement(InputLoading, {
1678
1579
  absolute: true,
1679
1580
  size: 20
@@ -1708,17 +1609,15 @@ var WithImageInput = function WithImageInput(_ref) {
1708
1609
  multiple = _ref.multiple,
1709
1610
  _ref$path = _ref.path,
1710
1611
  path = _ref$path === void 0 ? ["image"] : _ref$path,
1711
- _ref$preValidation = _ref.preValidation,
1712
- preValidation = _ref$preValidation === void 0 ? _stubFalse : _ref$preValidation,
1612
+ preValidation = _ref.preValidation,
1713
1613
  onChangeFile = _ref.onChangeFile,
1714
1614
  onClose = _ref.onClose,
1715
1615
  onClick = _ref.onClick,
1716
1616
  uploadFetcher = _ref.uploadFetcher,
1717
1617
  onSuccess = _ref.onSuccess,
1718
- onFailure = _ref.onFailure,
1719
1618
  ajaxError = _ref.ajaxError,
1720
1619
  onTouchEnd = _ref.onTouchEnd,
1721
- rest = _objectWithoutProperties(_ref, ["children", "multiple", "path", "preValidation", "onChangeFile", "onClose", "onClick", "uploadFetcher", "onSuccess", "onFailure", "ajaxError", "onTouchEnd"]);
1620
+ rest = _objectWithoutProperties(_ref, ["children", "multiple", "path", "preValidation", "onChangeFile", "onClose", "onClick", "uploadFetcher", "onSuccess", "ajaxError", "onTouchEnd"]);
1722
1621
 
1723
1622
  var form = React.useContext(FormContext);
1724
1623
  var loading = core.useToggle();
@@ -1830,19 +1729,19 @@ var WithImageInput = function WithImageInput(_ref) {
1830
1729
  imageWidth: imageWidth,
1831
1730
  imageHeight: imageHeight
1832
1731
  });
1833
- }).catch(function (e) {
1732
+ }).catch(function () {
1834
1733
  loading.close();
1835
1734
 
1836
- if (form.getValue(getIndexedPath('image')) !== file) {
1735
+ if (form.getValue(getIndexedPath('image') !== file)) {
1837
1736
  form.setMeta(_update(['submittingImage'], function (v) {
1838
1737
  return v - 1;
1839
1738
  }));
1840
1739
  return;
1841
1740
  }
1842
1741
 
1843
- form.setError(getIndexedPath('image').join('.'), utils.callIfFunction(ajaxError, _get('[1].status', e)));
1742
+ form.setError(getIndexedPath('image').join('.'), ajaxError);
1844
1743
  form.setValues(_flow(_set(getIndexedPath('filename'), oldFilename), _set(getIndexedPath('image'), oldImage), _set(getIndexedPath('imageWidth'), oldImageWidth), _set(getIndexedPath('imageHeight'), oldImageHeight)), false);
1845
- form.setMeta(_flow(_update('uploadingPaths', _difference(_difference.placeholder, [path.join(".")])), _update(['submittingImage'], function (v) {
1744
+ form.setMeta(_flow(_update(['submittingImage'], function (v) {
1846
1745
  return v - 1;
1847
1746
  }), _update(['submittedImages'], function (v) {
1848
1747
  return (v || []).concat([{
@@ -1852,7 +1751,6 @@ var WithImageInput = function WithImageInput(_ref) {
1852
1751
  }]);
1853
1752
  }), _set(getIndexedPath('uploadStatus'), oldUploadStatus)));
1854
1753
  setTempImage(null);
1855
- utils.callIfFunction(onFailure);
1856
1754
  });
1857
1755
  if (eventTarget && eventTarget.parentNode && typeof eventTarget.parentNode.click === 'function') eventTarget.parentNode.click();
1858
1756
  };
@@ -1906,14 +1804,13 @@ var Checkbox = function Checkbox(_ref) {
1906
1804
  _ref$isChecked = _ref.isChecked,
1907
1805
  isChecked = _ref$isChecked === void 0 ? _identity : _ref$isChecked,
1908
1806
  isList = _ref.isList,
1909
- onClick = _ref.onClick,
1910
1807
  disabled = _ref.disabled,
1911
1808
  inverted = _ref.inverted,
1912
1809
  path = _ref.path,
1913
1810
  _ref$tabIndex = _ref.tabIndex,
1914
1811
  tabIndex = _ref$tabIndex === void 0 ? 1 : _ref$tabIndex,
1915
1812
  raw = _ref.raw,
1916
- rest = _objectWithoutProperties(_ref, ["className", "children", "isChecked", "isList", "onClick", "disabled", "inverted", "path", "tabIndex", "raw"]);
1813
+ rest = _objectWithoutProperties(_ref, ["className", "children", "isChecked", "isList", "disabled", "inverted", "path", "tabIndex", "raw"]);
1917
1814
 
1918
1815
  var focused = core.useToggle();
1919
1816
 
@@ -1935,9 +1832,7 @@ var Checkbox = function Checkbox(_ref) {
1935
1832
 
1936
1833
  var value = isChecked(testInvert(isList ? (v === null || v === void 0 ? void 0 : v.indexOf(rest.fieldValue)) >= 0 : v));
1937
1834
 
1938
- var _onClick = function _onClick(e) {
1939
- utils.callIfFunction(onClick, e);
1940
-
1835
+ var onClick = function onClick(e) {
1941
1836
  if (!e.isDefaultPrevented()) {
1942
1837
  if (isList) {
1943
1838
  toggleItem();
@@ -1950,7 +1845,7 @@ var Checkbox = function Checkbox(_ref) {
1950
1845
  };
1951
1846
 
1952
1847
  return React__default.createElement("label", {
1953
- onClick: _onClick,
1848
+ onClick: onClick,
1954
1849
  "data-drag": "false",
1955
1850
  className: className
1956
1851
  }, !utils.isTouchDevice() && React__default.createElement(HiddenInput, {
@@ -1970,18 +1865,8 @@ var Checkbox = function Checkbox(_ref) {
1970
1865
  }));
1971
1866
  };
1972
1867
 
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
-
1983
1868
  function _templateObject2$1() {
1984
- var data = _taggedTemplateLiteral(["\n min-height: 42px;\n padding-left: 1rem;\n ", "\n "]);
1869
+ var data = _taggedTemplateLiteral(["\n height: 42px;\n line-height: 40px;\n padding-left: 1rem;\n "]);
1985
1870
 
1986
1871
  _templateObject2$1 = function _templateObject2() {
1987
1872
  return data;
@@ -1990,10 +1875,10 @@ function _templateObject2$1() {
1990
1875
  return data;
1991
1876
  }
1992
1877
 
1993
- function _templateObject$2() {
1878
+ function _templateObject$1() {
1994
1879
  var data = _taggedTemplateLiteral(["\n ", " > * {\n font-size: 14px;\n }\n "]);
1995
1880
 
1996
- _templateObject$2 = function _templateObject() {
1881
+ _templateObject$1 = function _templateObject() {
1997
1882
  return data;
1998
1883
  };
1999
1884
 
@@ -2002,24 +1887,16 @@ function _templateObject$2() {
2002
1887
  var ComboboxMenu = styled__default(components.ContextListMenu).withConfig({
2003
1888
  displayName: "Combobox__ComboboxMenu",
2004
1889
  componentId: "u2hz6i-0"
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) {
1890
+ })(["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) {
2006
1891
  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 ";
2009
1892
  });
2010
1893
  var ComboboxInput = styled__default.div.withConfig({
2011
1894
  displayName: "Combobox__ComboboxInput",
2012
1895
  componentId: "u2hz6i-1"
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'));
1896
+ })(["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) {
1897
+ return props.comboboxIsOpen && "\n // border-bottom-left-radius: 0;\n // border-bottom-right-radius: 0;\n ";
2019
1898
  }, utils.getColor('gray180'), function (props) {
2020
1899
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
2021
- }, function (props) {
2022
- return !props.suggestive && "\n padding-right: 2.5rem;\n ";
2023
1900
  });
2024
1901
  var ComboboxDropdownIcon = styled__default(components.Icon).withConfig({
2025
1902
  displayName: "Combobox__ComboboxDropdownIcon",
@@ -2028,25 +1905,16 @@ var ComboboxDropdownIcon = styled__default(components.Icon).withConfig({
2028
1905
  var FooterOptionsContainer = styled__default.div.withConfig({
2029
1906
  displayName: "Combobox__FooterOptionsContainer",
2030
1907
  componentId: "u2hz6i-3"
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
- });
1908
+ })(["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;"]);
2034
1909
  var ComboboxPlaceholder = styled__default.div.withConfig({
2035
1910
  displayName: "Combobox__ComboboxPlaceholder",
2036
1911
  componentId: "u2hz6i-4"
2037
1912
  })(["color:rgba(0,0,0,0.3);"]);
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?
1913
+ var SEPARATOR = {}; //shouldRecenter?
2044
1914
 
2045
- var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
1915
+ var Combobox = styled__default(function (_ref) {
2046
1916
  var _ref$getLabel = _ref.getLabel,
2047
1917
  getLabel = _ref$getLabel === void 0 ? _identity : _ref$getLabel,
2048
- getLabelAs = _ref.getLabelAs,
2049
- getBoxLabelAs = _ref.getBoxLabelAs,
2050
1918
  getIcon = _ref.getIcon,
2051
1919
  _ref$scrollContainer = _ref.scrollContainer,
2052
1920
  scrollContainer = _ref$scrollContainer === void 0 ? function (el) {
@@ -2055,54 +1923,35 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2055
1923
  className = _ref.className,
2056
1924
  options = _ref.options,
2057
1925
  autoFocus = _ref.autoFocus,
2058
- autoOpenMenu = _ref.autoOpenMenu,
2059
1926
  mandatory = _ref.mandatory,
2060
1927
  placeholder = _ref.placeholder,
2061
1928
  disabled = _ref.disabled,
2062
1929
  fieldValue = _ref.fieldValue,
2063
1930
  label = _ref.label,
2064
1931
  path = _ref.path,
2065
- withWindowing = _ref.withWindowing,
2066
1932
  _ref$tabIndex = _ref.tabIndex,
2067
1933
  tabIndex = _ref$tabIndex === void 0 ? 1 : _ref$tabIndex,
2068
1934
  fieldClassName = _ref.fieldClassName,
2069
1935
  descText = _ref.descText,
2070
1936
  helpText = _ref.helpText,
2071
1937
  raw = _ref.raw,
2072
- digitable = _ref.digitable,
2073
- digitableConstraint = _ref.digitableConstraint,
2074
- digitableAsOption = _ref.digitableAsOption,
2075
- suggestive = _ref.suggestive,
2076
- onDigitableChange = _ref.onDigitableChange,
2077
1938
  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,
2083
1939
  _ref$check = _ref.check,
2084
1940
  check = _ref$check === void 0 ? function (a, b) {
2085
1941
  return a === b;
2086
1942
  } : _ref$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"]);
1943
+ rest = _objectWithoutProperties(_ref, ["getLabel", "getIcon", "scrollContainer", "className", "options", "autoFocus", "mandatory", "placeholder", "disabled", "fieldValue", "label", "path", "tabIndex", "fieldClassName", "descText", "helpText", "raw", "footerOptions", "check"]);
2088
1944
 
2089
1945
  var selectedElement = React.useRef();
2090
- var selectedElementIndex = React.useRef();
2091
1946
  var fieldRef = React.useRef();
2092
- var windowingRef = React.useRef();
2093
1947
  var skipFocus = core.useRefState(autoFocus);
2094
1948
  var skipHover = core.useRefState();
2095
- var skipDigitableSetValue = core.useRefState();
2096
- var listElement = core.useEnsureRef(menuRef);
2097
- var container = core.useEnsureRef(ref);
1949
+ var listElement = React.useRef();
1950
+ var container = React.useRef();
2098
1951
  var keyState = core.useRefState();
2099
- var contextMenu = core.useToggle(false);
1952
+ var contextMenu = core.useToggle();
2100
1953
  var hover = core.useToggle();
2101
- var strongHover = core.useRefState();
2102
1954
  var scrollToVisibility = core.useToggle();
2103
- var autoCompleteUID = core.useLazyConstant(function () {
2104
- return utils.getUID();
2105
- });
2106
1955
 
2107
1956
  var _useInput = useInput(_objectSpread({
2108
1957
  fieldValue: fieldValue,
@@ -2113,43 +1962,11 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2113
1962
  confirmValue = _useInput2[1],
2114
1963
  hasErrors = _useInput2[2].hasErrors;
2115
1964
 
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();
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
- }
1965
+ var _useState = React.useState(formValue),
1966
+ _useState2 = _slicedToArray(_useState, 2),
1967
+ value = _useState2[0],
1968
+ _setValue = _useState2[1];
2150
1969
 
2151
- skipDigitableSetValue.set(false);
2152
- }, [contextMenu.isOpen]);
2153
1970
  React.useEffect(function () {
2154
1971
  contextMenu.isOpen && recenterScroll();
2155
1972
  }, [contextMenu.isOpen]);
@@ -2162,55 +1979,15 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2162
1979
  autoFocus && ((_container$current = container.current) === null || _container$current === void 0 ? void 0 : _container$current.focus());
2163
1980
  }, []);
2164
1981
  React.useEffect(function () {
2165
- autoOpenMenu && toggleCombobox();
2166
- }, []);
2167
- core.useUpdateEffect(function () {
2168
- if (value.isOpen !== formValue && !contextMenu.isOpen) {
2169
- confirmValue(value.isOpen);
2170
- }
1982
+ confirmValue(value);
2171
1983
  }, [!!contextMenu.isOpen]);
2172
1984
  React.useEffect(function () {
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
- }
1985
+ formValue !== value && _setValue(formValue);
2182
1986
  }, [formValue]);
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) {
1987
+ var allOptions = options.concat(footerOptions || []).filter(function (v) {
2200
1988
  return v !== SEPARATOR;
2201
1989
  });
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]);
1990
+ var withPlaceholder = !value && value !== 0 && placeholder;
2214
1991
 
2215
1992
  var toggleCombobox = function toggleCombobox() {
2216
1993
  if (contextMenu.isOpen) {
@@ -2229,43 +2006,25 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2229
2006
  };
2230
2007
 
2231
2008
  var recenterScroll = function recenterScroll() {
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
- }
2009
+ if (listElement.current.getBoundingClientRect().bottom > window.innerHeight) {
2010
+ var currentScrollContainer = scrollContainer(container.current);
2011
+ currentScrollContainer.scrollTop = listElement.current.getBoundingClientRect().bottom + currentScrollContainer.scrollTop - window.innerHeight;
2012
+ }
2247
2013
 
2248
- if (selectedElement.current) {
2249
- listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight / 2 - getCurrentHeight() / 2;
2250
- }
2014
+ if (selectedElement.current) {
2015
+ listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight / 2 - getCurrentHeight() / 2;
2251
2016
  }
2252
2017
  };
2253
2018
 
2254
2019
  var makeOptionVisible = function makeOptionVisible() {
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
- }
2020
+ if ((footerOptions === null || footerOptions === void 0 ? void 0 : footerOptions.indexOf(hover.isOpen)) >= 0) {
2021
+ return;
2022
+ } else if (selectedElement.current.offsetTop < listElement.current.scrollTop) {
2023
+ skipHover.set(true);
2024
+ listElement.current.scrollTop = selectedElement.current.offsetTop;
2025
+ } else if (selectedElement.current.offsetTop + selectedElement.current.offsetHeight > listElement.current.scrollTop + getCurrentHeight()) {
2026
+ skipHover.set(true);
2027
+ listElement.current.scrollTop = selectedElement.current.offsetTop + selectedElement.current.offsetHeight - getCurrentHeight();
2269
2028
  }
2270
2029
  };
2271
2030
 
@@ -2279,32 +2038,7 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2279
2038
  hover.openWith(value);
2280
2039
  };
2281
2040
 
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
-
2303
2041
  var keyDown = function keyDown(e) {
2304
- if (e.getModifierState('Shift') && e.key === 'Tab') {
2305
- return;
2306
- }
2307
-
2308
2042
  if ((e.key === 'Escape' || e.key === 'Tab') && contextMenu.isOpen) {
2309
2043
  e.stopPropagation();
2310
2044
  toggleCombobox();
@@ -2315,12 +2049,6 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2315
2049
 
2316
2050
  if (!contextMenu.isOpen) {
2317
2051
  contextMenu.open();
2318
-
2319
- if (digitable) {
2320
- skipDigitableSetValue.set(true);
2321
- digitableValue.openWith(e.key);
2322
- return;
2323
- }
2324
2052
  }
2325
2053
 
2326
2054
  var prevKeyState = keyState.get();
@@ -2342,10 +2070,12 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2342
2070
 
2343
2071
  var goTo = function goTo(index) {
2344
2072
  scrollToVisibility.open();
2345
- setHover(allOptions[index]);
2073
+ hover.openWith(allOptions[index]);
2074
+
2075
+ _setValue(allOptions[index]);
2346
2076
  };
2347
2077
 
2348
- var currentIndex = allOptions.indexOf(hover.isOpen !== false ? hover.isOpen : value.isOpen);
2078
+ var currentIndex = allOptions.indexOf(hover.isOpen !== false ? hover.isOpen : value);
2349
2079
  var direction = repeated ? e.shiftKey ? -1 : 1 : 0;
2350
2080
  var fnName = direction < 0 ? 'lastIndexOf' : 'indexOf';
2351
2081
  var item = repeated ? word.slice(0, 1) : word;
@@ -2372,14 +2102,16 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2372
2102
 
2373
2103
  if (contextMenu.isOpen) {
2374
2104
  if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
2375
- var oldValue = hover.isOpen !== false ? hover.isOpen : value.isOpen;
2105
+ var oldValue = hover.isOpen !== false ? hover.isOpen : value;
2376
2106
  var previousIndex = allOptions.indexOf(oldValue);
2377
2107
  var newIndex = Math.min(Math.max((previousIndex + allOptions.length + (e.key === 'ArrowUp' ? previousIndex < 0 ? 0 : -1 : 1)) % allOptions.length, 0), allOptions.length - 1);
2378
2108
  scrollToVisibility.open();
2379
- setHover(allOptions[newIndex]);
2109
+ hover.openWith(allOptions[newIndex]);
2110
+
2111
+ _setValue(allOptions[newIndex]);
2380
2112
  } else {
2381
2113
  if (hover.isOpen !== false) {
2382
- _setValue(transformOnSelect(hover.isOpen));
2114
+ _setValue(hover.isOpen);
2383
2115
  }
2384
2116
 
2385
2117
  toggleCombobox();
@@ -2389,91 +2121,30 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2389
2121
  }
2390
2122
  };
2391
2123
 
2392
- var createOption = function createOption(option, i, props, opts) {
2124
+ var createOption = function createOption(option, i) {
2393
2125
  if (option === SEPARATOR) {
2394
2126
  return React__default.createElement(components.ListSeparator, {
2395
2127
  key: "separator" + i
2396
2128
  });
2397
2129
  }
2398
2130
 
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({
2131
+ var label = getLabel(option);
2132
+ return React__default.createElement(Option, {
2417
2133
  key: label + i,
2418
2134
  option: option,
2419
2135
  icon: utils.callIfFunction(getIcon, option),
2420
- checked: checked,
2421
- label: getLabelAs ? getLabelAs(option) : label,
2136
+ checked: hover.isOpen !== false ? option === hover.isOpen : check(option, value),
2137
+ label: label,
2422
2138
  setValue: function setValue(v) {
2423
- if (!utils.callIfFunction(overrideSetValue, v, {
2424
- setValue: _setValue,
2425
- close: contextMenu.close
2426
- })) {
2427
- _setValue(transformOnSelect(v));
2139
+ _setValue(v);
2428
2140
 
2429
- contextMenu.close();
2430
- }
2141
+ contextMenu.close();
2431
2142
  skipFocus.set(true);
2432
2143
  container.current.focus();
2433
2144
  },
2434
2145
  setRef: selectedElement,
2435
2146
  onHover: handleHover
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
- }
2147
+ });
2477
2148
  };
2478
2149
 
2479
2150
  return React__default.createElement(Field, {
@@ -2485,106 +2156,60 @@ var Combobox = styled__default(React__default.forwardRef(function (_ref, ref) {
2485
2156
  labelClick: toggleCombobox,
2486
2157
  ref: fieldRef
2487
2158
  }, React__default.createElement(ComboboxInput, {
2488
- onBlur: onBlur,
2489
- onFocus: onFocus,
2490
- onClick: onClickInput,
2159
+ onBlur: function onBlur(e) {
2160
+ var _listElement$current;
2161
+
2162
+ if (!((_listElement$current = listElement.current) === null || _listElement$current === void 0 ? void 0 : _listElement$current.contains(e.relatedTarget))) {
2163
+ confirmValue(value);
2164
+ contextMenu.close();
2165
+ }
2166
+ },
2167
+ onFocus: function onFocus() {
2168
+ return skipFocus.get() ? skipFocus.set(false) : contextMenu.open();
2169
+ },
2170
+ onClick: function onClick() {
2171
+ return contextMenu.openWith(function (v) {
2172
+ return _isBoolean(v) ? 2 : false;
2173
+ });
2174
+ },
2491
2175
  ref: container,
2492
- tabIndex: contextMenu.isOpen && digitable ? '-1' : tabIndex,
2176
+ tabIndex: tabIndex,
2493
2177
  onKeyDown: keyDown,
2494
2178
  disabled: disabled,
2495
2179
  withPlaceholder: withPlaceholder,
2496
2180
  hasErrors: hasErrors,
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, {
2181
+ comboboxIsOpen: contextMenu.isOpen
2182
+ }, withPlaceholder ? React__default.createElement(ComboboxPlaceholder, null, placeholder) : getLabel(value), React__default.createElement(ComboboxDropdownIcon, {
2519
2183
  icon: "arrow-down"
2520
- }), !!contextMenu.isOpen && (!suggestive || !digitable || allOptions.length && digitableValue.isOpen) && React__default.createElement(ComboboxMenuContainer, {
2521
- withWindowing: withWindowing,
2184
+ }), !!contextMenu.isOpen && React__default.createElement(ComboboxMenuContainer, {
2522
2185
  ref: listElement,
2523
- windowingRef: windowingRef,
2524
- options: availableOptions,
2525
- digitableValue: digitableValue.get(),
2526
- digitableAsOption: digitableAsOption,
2186
+ options: options,
2527
2187
  footerOptions: footerOptions,
2528
2188
  getIcon: getIcon,
2529
2189
  createOption: createOption
2530
2190
  })));
2531
- })).withConfig({
2191
+ }).withConfig({
2532
2192
  displayName: "Combobox",
2533
- componentId: "u2hz6i-6"
2193
+ componentId: "u2hz6i-5"
2534
2194
  })(["user-select:none;"]);
2535
2195
 
2536
2196
  var _willUseIsSticky = components.willUseIsSticky(),
2537
2197
  _willUseIsSticky2 = _slicedToArray(_willUseIsSticky, 1),
2538
2198
  WithIsSticky = _willUseIsSticky2[0];
2539
2199
 
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;
2200
+ var ComboboxMenuContainer = React__default.forwardRef(function (_ref2, ref) {
2201
+ var options = _ref2.options,
2202
+ footerOptions = _ref2.footerOptions,
2203
+ getIcon = _ref2.getIcon,
2204
+ createOption = _ref2.createOption;
2575
2205
 
2576
2206
  var _usePositioning = components.usePositioning(ref, {
2577
- fill: true,
2578
- on: options.length
2207
+ fill: true
2579
2208
  }),
2580
2209
  _usePositioning2 = _slicedToArray(_usePositioning, 2),
2581
2210
  positionInfo = _usePositioning2[0],
2582
2211
  positionPlaceholder = _usePositioning2[1];
2583
2212
 
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
-
2588
2213
  var slot = 'Popup';
2589
2214
  var slotName = React.useMemo(function () {
2590
2215
  return components.getDialogLayersSize() === 0 ? slot : slot + '-' + (components.getDialogLayersSize() - 1);
@@ -2593,39 +2218,48 @@ var ComboboxMenuContainer = React__default.forwardRef(function (_ref3, ref) {
2593
2218
  name: slotName
2594
2219
  }, React__default.createElement(ComboboxMenu, _extends({}, positionInfo, {
2595
2220
  ref: ref,
2596
- withWindowing: withWindowing,
2597
2221
  withoutIcons: !getIcon
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, {
2222
+ }), options.map(createOption), footerOptions && React__default.createElement(WithIsSticky, {
2611
2223
  intersection: true
2612
2224
  }, function (sentinel, isSticky) {
2613
2225
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(FooterOptionsContainer, {
2614
2226
  isSticky: isSticky,
2615
- className: "JS-list-footer",
2616
- hasWindoning: withWindowing
2227
+ className: "JS-list-footer"
2617
2228
  }, footerOptions.map(createOption)), sentinel("margin-top:-3px;"));
2618
2229
  }))));
2619
2230
  });
2620
-
2621
- var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2622
- var options = _ref.options,
2623
- label = _ref.label,
2624
- constraint = _ref.constraint,
2625
- path = _ref.path,
2626
- _ref$customIndex = _ref.customIndex,
2627
- customIndex = _ref$customIndex === void 0 ? options.length - 1 : _ref$customIndex,
2628
- _ref$tabIndex = _ref.tabIndex,
2231
+ var Option = function Option(_ref3) {
2232
+ var setValue = _ref3.setValue,
2233
+ icon = _ref3.icon,
2234
+ option = _ref3.option,
2235
+ onHover = _ref3.onHover,
2236
+ checked = _ref3.checked,
2237
+ label = _ref3.label,
2238
+ setRef = _ref3.setRef;
2239
+ return React__default.createElement(components.ListItem, {
2240
+ hover: checked,
2241
+ tabIndex: -1,
2242
+ onMouseOver: function onMouseOver(e) {
2243
+ return onHover(option, e);
2244
+ },
2245
+ ref: checked ? setRef : undefined,
2246
+ onClick: function onClick(e) {
2247
+ e.stopPropagation();
2248
+ setValue(option);
2249
+ }
2250
+ }, React__default.createElement("a", null, icon && React__default.createElement(components.Icon, {
2251
+ icon: icon
2252
+ }), label));
2253
+ };
2254
+
2255
+ var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2256
+ var options = _ref.options,
2257
+ label = _ref.label,
2258
+ constraint = _ref.constraint,
2259
+ path = _ref.path,
2260
+ _ref$customIndex = _ref.customIndex,
2261
+ customIndex = _ref$customIndex === void 0 ? options.length - 1 : _ref$customIndex,
2262
+ _ref$tabIndex = _ref.tabIndex,
2629
2263
  tabIndex = _ref$tabIndex === void 0 ? 1 : _ref$tabIndex,
2630
2264
  extra = _objectWithoutProperties(_ref, ["options", "label", "constraint", "path", "customIndex", "tabIndex"]);
2631
2265
 
@@ -2659,7 +2293,7 @@ var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2659
2293
  }
2660
2294
  };
2661
2295
 
2662
- var titleOptions = !value || options.indexOf(value) >= 0 ? options : [value].concat(options);
2296
+ var titleOptions = !value || options.indexOf(value) >= 0 ? options : options.concat(value);
2663
2297
  return customValue.isOpen !== false ? React__default.createElement(TextInput, _extends({
2664
2298
  label: label,
2665
2299
  tabIndex: tabIndex,
@@ -2681,40 +2315,10 @@ var ComboboxWithCustom = function ComboboxWithCustom(_ref) {
2681
2315
  }, extra));
2682
2316
  };
2683
2317
 
2684
- function _templateObject4() {
2318
+ function _templateObject$2() {
2685
2319
  var data = _taggedTemplateLiteral(["\n height: 42px;\n "]);
2686
2320
 
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() {
2321
+ _templateObject$2 = function _templateObject() {
2718
2322
  return data;
2719
2323
  };
2720
2324
 
@@ -2725,21 +2329,21 @@ var isSafari = ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0;
2725
2329
  var InputLoading$1 = styled__default(components.Loading).withConfig({
2726
2330
  displayName: "AutoComplete__InputLoading",
2727
2331
  componentId: "g0526o-0"
2728
- })(["bottom:8px;right:0.6rem;left:auto;top:50%;transform:translate(-50%);"]);
2332
+ })(["bottom:8px;right:0.6rem;left:auto;top:10px;"]);
2729
2333
  var AutoCompleteInput = styled__default.div.withConfig({
2730
2334
  displayName: "AutoComplete__AutoCompleteInput",
2731
2335
  componentId: "g0526o-1"
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) {
2336
+ })(["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) {
2733
2337
  return props.focused && "\n border-color: ".concat(utils.getColor('gray180'), ";\n box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.075);\n ");
2734
2338
  }, function (props) {
2735
2339
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
2736
- }, utils.media.mobile(_templateObject$3()), function (props) {
2737
- return props.withDropdown && styled.css(["padding-right:3rem;", ""], utils.media.mobile(_templateObject2$2()));
2340
+ }, function (props) {
2341
+ return props.withDropdown && styled.css(["padding-right:3rem;"]);
2738
2342
  }, utils.customTheme('TextInput'));
2739
2343
  var AutoCompletePlaceholder = styled__default.span.withConfig({
2740
2344
  displayName: "AutoComplete__AutoCompletePlaceholder",
2741
2345
  componentId: "g0526o-2"
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()));
2346
+ })(["position:absolute;top:0;pointer-events:none;color:rgba(0,0,0,0.4);"]);
2743
2347
  var AutoCompleteTextboxDiv = styled__default.div.withConfig({
2744
2348
  displayName: "AutoComplete__AutoCompleteTextboxDiv",
2745
2349
  componentId: "g0526o-3"
@@ -2747,7 +2351,7 @@ var AutoCompleteTextboxDiv = styled__default.div.withConfig({
2747
2351
  var AddedBox = styled__default.span.withConfig({
2748
2352
  displayName: "AutoComplete__AddedBox",
2749
2353
  componentId: "g0526o-4"
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 ");
2354
+ })(["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 ");
2751
2355
  var RemoveIcon = styled__default(components.Icon).withConfig({
2752
2356
  displayName: "AutoComplete__RemoveIcon",
2753
2357
  componentId: "g0526o-5"
@@ -2765,7 +2369,7 @@ var AutoCompleteError = styled__default(Errors).withConfig({
2765
2369
  var DropdownIconContainer = styled__default(components.Icon).withConfig({
2766
2370
  displayName: "AutoComplete__DropdownIconContainer",
2767
2371
  componentId: "g0526o-8"
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'));
2372
+ })(["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'));
2769
2373
 
2770
2374
  var focusBeforeLast = function focusBeforeLast(e) {
2771
2375
  if (e.target && e.target !== e.currentTarget) return;
@@ -2842,7 +2446,6 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
2842
2446
  _ref$confirmIfValueKe = _ref.confirmIfValueKeys,
2843
2447
  confirmIfValueKeys = _ref$confirmIfValueKe === void 0 ? ['Tab'] : _ref$confirmIfValueKe,
2844
2448
  placeholder = _ref.placeholder,
2845
- className = _ref.className,
2846
2449
  _ref$getListItem = _ref.getListItem,
2847
2450
  getListItem = _ref$getListItem === void 0 ? getLabel : _ref$getListItem,
2848
2451
  onAddValue = _ref.onAddValue,
@@ -2853,20 +2456,15 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
2853
2456
  mandatory = _ref.mandatory,
2854
2457
  descText = _ref.descText,
2855
2458
  helpText = _ref.helpText,
2856
- label = _ref.label,
2857
- value = _ref.value,
2858
- setValue = _ref.setValue,
2859
- raw = _ref.raw;
2459
+ label = _ref.label;
2860
2460
  var autoCompleteBox = core.useToggle();
2861
2461
  var hoverIndex = core.useToggle();
2862
2462
  var isLoading = core.useToggle();
2863
2463
 
2864
2464
  var _useInput = useInput({
2865
2465
  path: path,
2866
- transform: transform,
2867
- value: value,
2868
- setValue: setValue
2869
- }, raw),
2466
+ transform: transform
2467
+ }),
2870
2468
  _useInput2 = _slicedToArray(_useInput, 3),
2871
2469
  formValue = _useInput2[0],
2872
2470
  setFormValue = _useInput2[1],
@@ -3168,7 +2766,6 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
3168
2766
  };
3169
2767
 
3170
2768
  var input = React__default.createElement(React__default.Fragment, null, React__default.createElement(AutoCompleteInput, {
3171
- className: className,
3172
2769
  ref: ref,
3173
2770
  onFocus: autoCompleteList.length ? autoCompleteBox.open : undefined,
3174
2771
  hasErrors: errorUtils.errors.length > 0 || hasErrors,
@@ -3248,7 +2845,7 @@ var AutoComplete = React__default.forwardRef(function (_ref, outerRef) {
3248
2845
  labelClick: focusInput
3249
2846
  }, isLoading.isOpen && React__default.createElement(InputLoading$1, {
3250
2847
  absolute: true,
3251
- size: 24
2848
+ size: 20
3252
2849
  }), input);
3253
2850
  });
3254
2851
  AutoComplete.AddedBox = AddedBox;
@@ -3440,40 +3037,10 @@ var IfFormValue = function IfFormValue(_ref2) {
3440
3037
 
3441
3038
  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);
3442
3039
  };
3443
- var SwitchOnFormValue = function SwitchOnFormValue(_ref3) {
3040
+ var FormMeta = function FormMeta(_ref3) {
3444
3041
  var path = _ref3.path,
3445
3042
  children = _ref3.children,
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;
3043
+ inputs = _ref3.inputs;
3477
3044
 
3478
3045
  var _useFormMeta = useFormMeta(path, inputs || []),
3479
3046
  _useFormMeta2 = _slicedToArray(_useFormMeta, 2),
@@ -3482,28 +3049,6 @@ var FormMeta = function FormMeta(_ref4) {
3482
3049
 
3483
3050
  return utils.ifUndefined(utils.callIfFunction(children, value, setValue), value, null);
3484
3051
  };
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
- };
3507
3052
 
3508
3053
  var addRootPath = function addRootPath(errorRootPath, errors, path) {
3509
3054
  var rootPath = [].concat(errorRootPath || [], path);
@@ -3552,10 +3097,6 @@ var ConfirmEditableBoxes = React.forwardRef(function (_ref, ref) {
3552
3097
  shared: shared,
3553
3098
  standalone: standalone
3554
3099
  } : shared : standalone;
3555
- }).catch(function () {
3556
- return withLoading && editableBoxes().forEach(function (_) {
3557
- return _.loading().close();
3558
- });
3559
3100
  }));
3560
3101
 
3561
3102
  case 2:
@@ -3619,7 +3160,7 @@ var ConfirmEditableBoxes = React.forwardRef(function (_ref, ref) {
3619
3160
 
3620
3161
  var modifiedEditablesPath = function modifiedEditablesPath(boxes) {
3621
3162
  return modifiedEditableBoxes(boxes).map(function (_) {
3622
- return utils.callIfFunction(_.path);
3163
+ return _.path;
3623
3164
  });
3624
3165
  };
3625
3166
 
@@ -3647,7 +3188,7 @@ var ConfirmEditableBoxes = React.forwardRef(function (_ref, ref) {
3647
3188
  var validated = modifiedEditableBoxes(sharedBoxes()).reduce(function (_ref5, box) {
3648
3189
  var success = _ref5.success,
3649
3190
  errors = _ref5.errors;
3650
- var index = utils.callIfFunction(box.path);
3191
+ var index = box.path;
3651
3192
 
3652
3193
  var _box$modifiedValue = box.modifiedValue(),
3653
3194
  _box$modifiedValue2 = _slicedToArray(_box$modifiedValue, 2),
@@ -3946,39 +3487,18 @@ var EditableBoxPresentation = styled__default(React.forwardRef(function (_ref13,
3946
3487
 
3947
3488
  var SharedEditableTabBox = function SharedEditableTabBox(_ref15) {
3948
3489
  var path = _ref15.path,
3949
- isSingle = _ref15.isSingle,
3950
- _ref15$checkIsNew = _ref15.checkIsNew,
3951
- checkIsNew = _ref15$checkIsNew === void 0 ? function (a, b) {
3952
- return a !== b;
3953
- } : _ref15$checkIsNew,
3954
- props = _objectWithoutProperties(_ref15, ["path", "isSingle", "checkIsNew"]);
3490
+ props = _objectWithoutProperties(_ref15, ["path"]);
3955
3491
 
3956
3492
  var editableGroup = React.useContext(EditableContext);
3957
3493
  var form = React.useContext(FormContext);
3958
- var isNew = core.useRefState(function () {
3959
- return isSingle ? false : checkIsNew(utils._s.get(path, form.getOriginalValues()), form.getValue(path));
3960
- });
3494
+ var isNew = core.useRefState(utils._s.get(path, form.getOriginalValues()) !== form.getValue(path));
3961
3495
  var internalBox = React__default.useRef();
3962
- var pathRef = core.useRefMemo(path);
3963
3496
 
3964
3497
  var loading = function loading() {
3965
3498
  return internalBox.current.loading;
3966
3499
  };
3967
3500
 
3968
- var modifiedValue = function modifiedValue() {
3969
- var oldItem = internalBox.current.getValue(undefined, form.getOriginalValues());
3970
- var newItem = internalBox.current.getValue();
3971
- return newItem !== oldItem ? [newItem, true] : [oldItem, false];
3972
- };
3973
-
3974
- var selfRef = React.useRef({
3975
- loading: loading,
3976
- path: function path() {
3977
- return pathRef.current;
3978
- },
3979
- form: form,
3980
- modifiedValue: modifiedValue
3981
- });
3501
+ var selfRef = React.useRef();
3982
3502
 
3983
3503
  var resetField = function resetField() {
3984
3504
  return form.resetField([].concat(path));
@@ -3998,6 +3518,12 @@ var SharedEditableTabBox = function SharedEditableTabBox(_ref15) {
3998
3518
  editableGroup.sharedBoxes.register(selfRef.current);
3999
3519
  };
4000
3520
 
3521
+ var modifiedValue = function modifiedValue() {
3522
+ var oldItem = internalBox.current.getValue(undefined, form.getOriginalValues());
3523
+ var newItem = internalBox.current.getValue();
3524
+ return newItem !== oldItem ? [newItem, true] : [oldItem, false];
3525
+ };
3526
+
4001
3527
  var validate = function validate(props, path) {
4002
3528
  var errors = editableGroup.itemValidation(props, path);
4003
3529
 
@@ -4066,8 +3592,6 @@ var SharedEditableTabBox = function SharedEditableTabBox(_ref15) {
4066
3592
  if (!errors) {
4067
3593
  form.setValues(utils._s.unsetOrRemoveAt(path));
4068
3594
  }
4069
- }).catch(function () {
4070
- return internalBox.current.loading.close();
4071
3595
  });
4072
3596
  return fetch;
4073
3597
  } else {
@@ -4090,6 +3614,12 @@ var SharedEditableTabBox = function SharedEditableTabBox(_ref15) {
4090
3614
  }
4091
3615
  };
4092
3616
 
3617
+ selfRef.current = {
3618
+ loading: loading,
3619
+ path: path,
3620
+ form: form,
3621
+ modifiedValue: modifiedValue
3622
+ };
4093
3623
  return React__default.createElement(EditableBoxPresentation, _extends({
4094
3624
  ref: internalBox,
4095
3625
  resetField: resetField,
@@ -4113,6 +3643,7 @@ var EditableBox = function EditableBox(_ref17) {
4113
3643
 
4114
3644
  var editableGroup = React.useContext(EditableContext);
4115
3645
  var form = React.useContext(FormContext);
3646
+ var selfRef = React.useRef();
4116
3647
  var internalBox = React__default.useRef();
4117
3648
 
4118
3649
  var resetField = function resetField() {
@@ -4165,17 +3696,14 @@ var EditableBox = function EditableBox(_ref17) {
4165
3696
  return internalBox.current.loading;
4166
3697
  };
4167
3698
 
4168
- var pathRef = core.useRefMemo(path);
4169
- var selfRef = React.useRef({
3699
+ selfRef.current = {
4170
3700
  loading: loading,
4171
- path: function path() {
4172
- return pathRef.current;
4173
- },
3701
+ path: path,
4174
3702
  form: form,
4175
3703
  modifiedValue: modifiedValue,
4176
3704
  handleSubmit: handleSubmit,
4177
3705
  close: close
4178
- });
3706
+ };
4179
3707
  return React__default.createElement(EditableBoxPresentation, _extends({
4180
3708
  ref: internalBox,
4181
3709
  resetField: resetField,
@@ -4250,20 +3778,10 @@ var Radiobox = function Radiobox(_ref) {
4250
3778
  }));
4251
3779
  };
4252
3780
 
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() {
3781
+ function _templateObject$3() {
4264
3782
  var data = _taggedTemplateLiteral(["\n padding: 7px 12px 7px 32px;\n "]);
4265
3783
 
4266
- _templateObject$4 = function _templateObject() {
3784
+ _templateObject$3 = function _templateObject() {
4267
3785
  return data;
4268
3786
  };
4269
3787
 
@@ -4288,8 +3806,8 @@ var TextLabelContainer = styled__default.div.withConfig({
4288
3806
  var CheckboxContent = styled__default.div.withConfig({
4289
3807
  displayName: "SimpleCheckbox__CheckboxContent",
4290
3808
  componentId: "am8pps-4"
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) {
3809
+ })(["cursor:pointer;position:relative;padding-left:2rem;", ""], function (props) {
3810
+ 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) {
4293
3811
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
4294
3812
  }, function (props) {
4295
3813
  return props.checked && props.highlightSelected && styled.css(["border-color:", ";background:", ";:hover{background:", ";}", "{", "{color:", ";}}"], utils.getColor('main'), function (props) {
@@ -4333,34 +3851,22 @@ var SimpleCheckbox = styled__default(function (_ref) {
4333
3851
  ultraHighlightSelected: ultraHighlightSelected,
4334
3852
  hasErrors: hasErrors,
4335
3853
  disabled: disabled
4336
- }, React__default.createElement(_StyledDiv, null, React__default.createElement(TextLabelContainer, null, React__default.createElement(CheckboxPseudoInput, {
3854
+ }, React__default.createElement(TextLabelContainer, null, React__default.createElement(CheckboxPseudoInput, {
4337
3855
  focused: focused,
4338
3856
  tabIndex: tabIndex
4339
3857
  }, checked && React__default.createElement(components.Icon, {
4340
3858
  icon: "check"
4341
- })), React__default.createElement(TextLabel, null, label), helpText && React__default.createElement(HelpText, null, helpText)), descText && React__default.createElement(DescText, null, descText)));
3859
+ })), React__default.createElement(TextLabel, null, label), helpText && React__default.createElement(HelpText, null, helpText)), descText && React__default.createElement(DescText, null, descText));
4342
3860
  });
4343
3861
  }).withConfig({
4344
3862
  displayName: "SimpleCheckbox",
4345
3863
  componentId: "am8pps-5"
4346
- })(["cursor:pointer;position:relative;margin-bottom:1rem;display:flex;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
3864
+ })(["cursor:pointer;position:relative;margin-bottom:1rem;display:block;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
4347
3865
 
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() {
3866
+ function _templateObject$4() {
4361
3867
  var data = _taggedTemplateLiteral(["\n padding: 7px 12px 7px 32px;\n "]);
4362
3868
 
4363
- _templateObject$5 = function _templateObject() {
3869
+ _templateObject$4 = function _templateObject() {
4364
3870
  return data;
4365
3871
  };
4366
3872
 
@@ -4373,7 +3879,7 @@ var CssCircle = styled__default.div.withConfig({
4373
3879
  var TextLabel$1 = styled__default.span.withConfig({
4374
3880
  displayName: "SimpleRadiobox__TextLabel",
4375
3881
  componentId: "qv83xo-1"
4376
- })(["font-size:13px;line-height:16px;margin:2px 0.25rem 2px 0;display:block;"]);
3882
+ })(["font-size:13px;line-height:16px;margin:2px 0;display:block;"]);
4377
3883
  var DescText$1 = styled__default.div.withConfig({
4378
3884
  displayName: "SimpleRadiobox__DescText",
4379
3885
  componentId: "qv83xo-2"
@@ -4381,12 +3887,12 @@ var DescText$1 = styled__default.div.withConfig({
4381
3887
  var TextLabelContainer$1 = styled__default.div.withConfig({
4382
3888
  displayName: "SimpleRadiobox__TextLabelContainer",
4383
3889
  componentId: "qv83xo-3"
4384
- })(["display:flex;align-items:center;position:relative;flex-wrap:wrap;"]);
3890
+ })(["display:flex;align-items:center;position:relative;", "{margin-left:0.25rem;}"], HelpText);
4385
3891
  var RadioboxContent = styled__default.div.withConfig({
4386
3892
  displayName: "SimpleRadiobox__RadioboxContent",
4387
3893
  componentId: "qv83xo-4"
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) {
3894
+ })(["cursor:pointer;position:relative;padding-left:2rem;", ""], function (props) {
3895
+ 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) {
4390
3896
  return props.hasErrors && styled.css(["border-color:", " !important;"], utils.getColor('alert'));
4391
3897
  }, function (props) {
4392
3898
  return props.checked && props.highlightSelected && styled.css(["border-color:", ";background:", ";:hover{background:", ";}", "{:before{background-color:", ";}}"], utils.getColor('main'), function (props) {
@@ -4417,18 +3923,16 @@ var SimpleRadiobox = styled__default(function (props) {
4417
3923
  ultraHighlightSelected: props.ultraHighlightSelected,
4418
3924
  hasErrors: hasErrors,
4419
3925
  disabled: disabled
4420
- }, React__default.createElement(_StyledDiv$1, null, React__default.createElement(TextLabelContainer$1, null, React__default.createElement(CssCircle, {
3926
+ }, React__default.createElement(TextLabelContainer$1, null, React__default.createElement(CssCircle, {
4421
3927
  checked: checked,
4422
3928
  focused: focused,
4423
3929
  tabIndex: tabIndex
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)));
3930
+ }), 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));
4425
3931
  });
4426
3932
  }).withConfig({
4427
3933
  displayName: "SimpleRadiobox",
4428
3934
  componentId: "qv83xo-5"
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());
3935
+ })(["cursor:pointer;position:relative;margin-bottom:1rem;display:block;", ""], utils.ifProp('disabled', styled.css(["pointer-events:none;"])));
4432
3936
 
4433
3937
  var InputboxGroup = styled__default(function (_ref) {
4434
3938
  var path = _ref.path,
@@ -4471,7 +3975,7 @@ var InputboxGroup = styled__default(function (_ref) {
4471
3975
  }, function (props) {
4472
3976
  return props.unevenlyWide && "\n width: 100%;\n display: flex;\n label {\n flex-grow: 1;\n }\n ";
4473
3977
  }, function (props) {
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 ");
3978
+ 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 ");
4475
3979
  }, function (props) {
4476
3980
  return props.framedBoxes && styled.css(["", ""], function (props) {
4477
3981
  return props.horizontal && "\n margin: -4px;\n width: calc(100% + 8px);\n ".concat(SimpleRadiobox, ", ").concat(SimpleCheckbox, " {\n margin: 4px;\n }\n ");
@@ -4480,20 +3984,20 @@ var InputboxGroup = styled__default(function (_ref) {
4480
3984
  var RadioboxGroup = InputboxGroup;
4481
3985
  var CheckboxGroup = InputboxGroup;
4482
3986
 
4483
- function _templateObject2$5() {
3987
+ function _templateObject2$2() {
4484
3988
  var data = _taggedTemplateLiteral(["\n line-height: 42px;\n width: 2.25rem;\n "]);
4485
3989
 
4486
- _templateObject2$5 = function _templateObject2() {
3990
+ _templateObject2$2 = function _templateObject2() {
4487
3991
  return data;
4488
3992
  };
4489
3993
 
4490
3994
  return data;
4491
3995
  }
4492
3996
 
4493
- function _templateObject$6() {
3997
+ function _templateObject$5() {
4494
3998
  var data = _taggedTemplateLiteral(["\n width: 2.5rem;\n "]);
4495
3999
 
4496
- _templateObject$6 = function _templateObject() {
4000
+ _templateObject$5 = function _templateObject() {
4497
4001
  return data;
4498
4002
  };
4499
4003
 
@@ -4506,7 +4010,7 @@ var LEVELS = [DAY, MONTH, YEAR];
4506
4010
  var DatePickerContainer = styled__default.div.withConfig({
4507
4011
  displayName: "DatePicker__DatePickerContainer",
4508
4012
  componentId: "sc-1wo8j4d-0"
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()));
4013
+ })(["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()));
4510
4014
  var CalendarHeader = styled__default.div.withConfig({
4511
4015
  displayName: "DatePicker__CalendarHeader",
4512
4016
  componentId: "sc-1wo8j4d-1"
@@ -4560,7 +4064,7 @@ var DatePickerInputIcon = styled__default(components.Icon).withConfig({
4560
4064
  componentId: "sc-1wo8j4d-11"
4561
4065
  })(["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) {
4562
4066
  return props.disabled && 'pointer-events: none;';
4563
- }, utils.media.mobile(_templateObject2$5()));
4067
+ }, utils.media.mobile(_templateObject2$2()));
4564
4068
  var ClearButton = styled__default(components.Icon).withConfig({
4565
4069
  displayName: "DatePicker__ClearButton",
4566
4070
  componentId: "sc-1wo8j4d-12"
@@ -4765,9 +4269,10 @@ var DatePicker = React.forwardRef(function (_ref, maybeInputRef) {
4765
4269
 
4766
4270
  var stopFocusPropagation = function stopFocusPropagation(e) {
4767
4271
  return e.stopPropagation();
4768
- };
4272
+ }; // const calendarValue = new Date(!isNaN(time) && formValue !== -1 ? offsetedTime : now())
4769
4273
 
4770
- var calendarValue = new Date(!isNaN(time) && formValue !== -1 ? offsetedTime : now());
4274
+
4275
+ var calendarValue = new Date(!isNaN(time) && formValue !== -1 ? offsetedTime : nowTimeZoneAdjusted(timezoneOffset));
4771
4276
  calendarValue.setUTCHours(0, 0, 0);
4772
4277
  return React__default.createElement(Field, {
4773
4278
  helpText: helpText,
@@ -4963,6 +4468,15 @@ function now() {
4963
4468
  return dt;
4964
4469
  }
4965
4470
 
4471
+ function nowTimeZoneAdjusted(timezoneOffset) {
4472
+ var timezoneOffsetMilliseconds = timezoneOffset * 3600000; // 3600000 milliseconds in an hour
4473
+
4474
+ var dt = new Date();
4475
+ dt.setTime(dt.getTime() + timezoneOffsetMilliseconds);
4476
+ dt.setUTCHours(0, 0, 0, 0);
4477
+ return dt;
4478
+ }
4479
+
4966
4480
  function inRange(context, date) {
4967
4481
  return context.min <= date && context.max >= date;
4968
4482
  }
@@ -5179,365 +4693,91 @@ function getClosestNextLeapYear(year) {
5179
4693
  return y;
5180
4694
  }
5181
4695
 
5182
- function _templateObject$7() {
5183
- var data = _taggedTemplateLiteral(["\n padding 1rem;\n "]);
4696
+ var FORMAT_TOOLS = {
4697
+ 'bold': ['b', 'strong'],
4698
+ 'italic': 'i',
4699
+ 'underline': 'u',
4700
+ 'strikethrough': 'strike',
4701
+ 'link': 'a',
4702
+ 'insertUnorderedList': ['ul', 'li'],
4703
+ 'insertOrderedList': ['ol', 'li'],
4704
+ 'outdent': '',
4705
+ 'indent': 'blockquote',
4706
+ 'fontSizeUp': 'font',
4707
+ 'fontSizeDown': 'font'
4708
+ };
4709
+ var TAG_TO_STYLE_PROPERTY = {
4710
+ 'b': 'fontWeight',
4711
+ 'strong': 'fontWeight',
4712
+ 'u': 'textDecoration',
4713
+ 'strike': 'textDecoration',
4714
+ 'font': 'fontSize',
4715
+ 'i': 'fontStyle'
4716
+ };
5184
4717
 
5185
- _templateObject$7 = function _templateObject() {
5186
- return data;
4718
+ var _GET_LIMITS_FONT_SIZE_PX = function GET_LIMITS_FONT_SIZE_PX() {
4719
+ var s = document.createElement('span');
4720
+ s.style.fontSize = 'medium';
4721
+ document.body.appendChild(s);
4722
+ var fontSize = parseInt(getComputedStyle(s).fontSize);
4723
+ document.body.removeChild(s);
4724
+ var limits = [fontSize * 3 / 5, fontSize * 3];
4725
+
4726
+ _GET_LIMITS_FONT_SIZE_PX = function GET_LIMITS_FONT_SIZE_PX() {
4727
+ return limits;
5187
4728
  };
5188
4729
 
5189
- return data;
5190
- }
4730
+ return limits;
4731
+ };
5191
4732
 
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"]');
4733
+ var wrapWith = function wrapWith(el, wrapper) {
4734
+ el.parentNode.insertBefore(wrapper, el);
4735
+ wrapper.appendChild(el);
5194
4736
  };
5195
4737
 
5196
- var ExpandableBoxStyled = styled__default.div.withConfig({
5197
- displayName: "ExpandableBox__ExpandableBoxStyled",
5198
- componentId: "sc-1nsk1wq-0"
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) {
5200
- return props.small && "\n padding: 0.875rem 1rem;\n min-height: 3rem;\n ";
5201
- }, function (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));
5204
- }, 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) {
5207
- return props.fixMarginBottom && "\n padding-bottom: 0.5rem !important;\n ";
5208
- });
5209
- }, components.SwitchDiv);
5210
- var EditIcon = styled__default(components.Icon).attrs({
5211
- icon: 'edit'
5212
- }).withConfig({
5213
- displayName: "ExpandableBox__EditIcon",
5214
- componentId: "sc-1nsk1wq-1"
5215
- })(["position:absolute;top:50%;transform:translateY(-50%);right:-24px;color:rgba(0,0,0,0.25);font-size:20px;"]);
5216
- var checkErrors = function checkErrors() {
5217
- for (var _len = arguments.length, checks = new Array(_len), _key = 0; _key < _len; _key++) {
5218
- checks[_key] = arguments[_key];
5219
- }
4738
+ var FIX_STYLE = {
4739
+ 'fontWeight': function fontWeight(v, el) {
4740
+ var intFontWeight = parseInt(window.getComputedStyle(el).fontWeight);
4741
+ return intFontWeight <= 400 ? 400 : 600;
4742
+ },
4743
+ 'fontSize': function fontSize(v, el) {
4744
+ var _GET_LIMITS_FONT_SIZE = _GET_LIMITS_FONT_SIZE_PX(),
4745
+ _GET_LIMITS_FONT_SIZE2 = _slicedToArray(_GET_LIMITS_FONT_SIZE, 2),
4746
+ min = _GET_LIMITS_FONT_SIZE2[0],
4747
+ max = _GET_LIMITS_FONT_SIZE2[1];
5220
4748
 
5221
- return function (v, setErrors) {
5222
- var results = checks.map(function (c) {
5223
- return c(v);
5224
- }).filter(Boolean);
4749
+ var intFontSize = parseInt(window.getComputedStyle(el).fontSize);
4750
+ return Math.min(max, Math.max(min, intFontSize)) + 'px';
4751
+ },
4752
+ 'textDecoration': function textDecoration(v, el) {
4753
+ var values = v.split(' ').filter(function (v) {
4754
+ return v === 'underline' || v === 'line-through';
4755
+ });
5225
4756
 
5226
- if (!results.length) {
5227
- return true;
4757
+ if (values.indexOf('underline') >= 0) {
4758
+ wrapWith(el, document.createElement('u'));
5228
4759
  }
5229
4760
 
5230
- var messages = results.filter(_negate(_isBoolean));
5231
-
5232
- if (messages.length) {
5233
- setErrors.apply(void 0, _toConsumableArray(messages));
4761
+ if (values.indexOf('line-through') >= 0) {
4762
+ wrapWith(el, document.createElement('strike'));
5234
4763
  }
5235
4764
 
5236
- return false;
5237
- };
5238
- };
5239
- var timing = utils.animationTiming('0.25s ease-out');
5240
- var switchAnimation = utils.oneWayAnimation('opacity: 1;transform:translateY(0);', 'opacity: 0;', 'opacity: 0; transform:translateY(30px);');
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,
5251
- info = _ref.info,
5252
- isOpen = _ref.isOpen,
5253
- openWhen = _ref.openWhen,
5254
- _ref$canExpand = _ref.canExpand,
5255
- canExpand = _ref$canExpand === void 0 ? _identity : _ref$canExpand,
5256
- path = _ref.path,
5257
- _ref$retargetFilter = _ref.retargetFilter,
5258
- retargetFilter = _ref$retargetFilter === void 0 ? function (el) {
5259
- var _el$tagName;
5260
-
5261
- return (el === null || el === void 0 ? void 0 : (_el$tagName = el.tagName) === null || _el$tagName === void 0 ? void 0 : _el$tagName.toLowerCase()) === "button";
5262
- } : _ref$retargetFilter,
5263
- _ref$isValid = _ref.isValid,
5264
- isValid = _ref$isValid === void 0 ? function () {
5265
- return true;
5266
- } : _ref$isValid,
5267
- fixMarginBottom = _ref.fixMarginBottom,
5268
- _ref$animation = _ref.animation,
5269
- animation = _ref$animation === void 0 ? switchAnimation : _ref$animation,
5270
- _ref$animationTiming = _ref.animationTiming,
5271
- animationTiming = _ref$animationTiming === void 0 ? timing : _ref$animationTiming;
5272
- var flipAnimation = core.useLazyConstant(components.willUseFlipSwitch);
5273
-
5274
- var _useFormValue = form.useFormValue(path),
5275
- _useFormValue2 = _slicedToArray(_useFormValue, 3),
5276
- value = _useFormValue2[0],
5277
- setValue = _useFormValue2[1],
5278
- getValue = _useFormValue2[2];
5279
-
5280
- var _useTransientErrorHel = useTransientErrorHelper(),
5281
- _useTransientErrorHel2 = _slicedToArray(_useTransientErrorHel, 2),
5282
- _setErrors = _useTransientErrorHel2[0],
5283
- clearErrors = _useTransientErrorHel2[1];
5284
-
5285
- var previousValue = core.useRefState();
5286
- var isAutoOpened = core.useToggle(isOpen);
5287
- var containerRef = React.useRef();
5288
-
5289
- var setErrors = function setErrors() {
5290
- for (var _len2 = arguments.length, errors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5291
- errors[_key2] = arguments[_key2];
5292
- }
5293
-
5294
- _setErrors(errors.length ? errors.map(function (k) {
5295
- return _isString(k) ? [k, ''] : k;
5296
- }) : [[path, '']]);
5297
-
5298
- return true;
5299
- };
5300
-
5301
- var expand = core.useToggle(isOpen, function (newV, prevV) {
5302
- if (newV === 0 || prevV === 0) {
5303
- return;
5304
- }
5305
-
5306
- if (newV === false) {
5307
- var result = isValid(getValue(), setErrors);
5308
-
5309
- if (result === true) {
5310
- clearErrors();
5311
- }
5312
-
5313
- return result;
5314
- }
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
-
5322
- var openWhenResult = utils.callIfFunction(openWhen);
5323
- React.useEffect(function () {
5324
- if (openWhenResult) {
5325
- expand.open();
5326
- }
5327
- }, [openWhenResult]);
5328
- React.useEffect(function () {
5329
- return function () {
5330
- if (expand.get() === 0) {
5331
- expand.close();
5332
- }
5333
- };
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
-
5350
- var utils$1 = core.useLazyConstant(function () {
5351
- return {
5352
- close: utils.constrainEvent(expand.close),
5353
- setValue: setValue,
5354
- cancel: cancel
5355
- };
5356
- });
5357
-
5358
- var onBlur = function onBlur(e) {
5359
- if (e.currentTarget !== e.relatedTarget && (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget))) {
5360
- var retarget = utils.callIfFunction(retargetFilter, e.relatedTarget);
5361
-
5362
- if (retarget === true) {
5363
- e.target.focus();
5364
- } else if (retarget === false) {
5365
- expand.close();
5366
- }
5367
- }
5368
- };
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
-
5386
- return React__default.createElement(ExpandableBoxStyled, {
5387
- className: className + (expand.isOpen && (enterConfirms || escCancels) ? " JS-dialog-skip-evts" : ""),
5388
- ref: containerRef,
5389
- tabIndex: -1,
5390
- onBlur: onBlur,
5391
- onFocus: isAutoOpened.close,
5392
- collapsed: !expand.isOpen,
5393
- fixMarginBottom: fixMarginBottom,
5394
- onClick: onClick,
5395
- onKeyDown: checkEscEnter
5396
- }, expand.isOpen && firstFocus, React__default.createElement(FlipDiv$1, {
5397
- key: expand.isOpen,
5398
- overflowEffect: overflowEffect,
5399
- useAnimation: flipAnimation,
5400
- animation: animation,
5401
- animationTiming: animationTiming
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
- })([""]);
5407
-
5408
- var PseudoExpandableBox = function PseudoExpandableBox(_ref2) {
5409
- var children = _ref2.children,
5410
- small = _ref2.small,
5411
- onClick = _ref2.onClick;
5412
- return React__default.createElement(ExpandableBoxStyled, {
5413
- collapsed: true,
5414
- small: small,
5415
- onClick: onClick
5416
- }, React__default.createElement(FlipDivStyle, null, children, React__default.createElement(EditIcon, null)));
5417
- };
5418
- var FlipDivStyle = styled__default.div.withConfig({
5419
- displayName: "ExpandableBox__FlipDivStyle",
5420
- componentId: "sc-1nsk1wq-3"
5421
- })(["position:relative;"]);
5422
-
5423
- var FlipDiv$1 = function FlipDiv(_ref3) {
5424
- var useAnimation = _ref3.useAnimation,
5425
- animation = _ref3.animation,
5426
- animationTiming = _ref3.animationTiming,
5427
- overflowEffect = _ref3.overflowEffect,
5428
- props = _objectWithoutProperties(_ref3, ["useAnimation", "animation", "animationTiming", "overflowEffect"]);
5429
-
5430
- var ref = React.useRef();
5431
- useAnimation(ref, null, null, {
5432
- switchAnimation: animation,
5433
- timing: animationTiming,
5434
- effect: overflowEffect
5435
- });
5436
- return React__default.createElement(FlipDivStyle, _extends({}, props, {
5437
- ref: ref
5438
- }));
5439
- };
5440
-
5441
- function _templateObject$8() {
5442
- var data = _taggedTemplateLiteral(["\n padding-right: 2.25rem;\n background: rgba(0,0,0,0.075);\n "]);
5443
-
5444
- _templateObject$8 = function _templateObject() {
5445
- return data;
5446
- };
5447
-
5448
- return data;
5449
- }
5450
- var InputIcon$1 = styled__default(components.Icon).withConfig({
5451
- displayName: "RichText__InputIcon",
5452
- componentId: "x8c1ig-0"
5453
- })(["position:absolute;outline:none;bottom:0;font-size:21px;line-height:3rem;right:0;width:2rem;pointer-events:none;color:", ";"], utils.getColor('gray150'));
5454
- var FORMAT_TOOLS = {
5455
- 'bold': ['b', 'strong'],
5456
- 'italic': 'i',
5457
- 'underline': 'u',
5458
- 'strikethrough': 'strike',
5459
- 'link': 'a',
5460
- 'insertUnorderedList': ['ul', 'li'],
5461
- 'insertOrderedList': ['ol', 'li'],
5462
- 'outdent': '',
5463
- 'indent': 'blockquote',
5464
- 'fontSizeUp': 'font',
5465
- 'fontSizeDown': 'font'
5466
- };
5467
- var TAG_TO_STYLE_PROPERTY = {
5468
- 'b': 'fontWeight',
5469
- 'strong': 'fontWeight',
5470
- 'u': 'textDecoration',
5471
- 'strike': 'textDecoration',
5472
- 'font': 'fontSize',
5473
- 'i': 'fontStyle'
5474
- };
5475
-
5476
- var _GET_LIMITS_FONT_SIZE_PX = function GET_LIMITS_FONT_SIZE_PX() {
5477
- var s = document.createElement('span');
5478
- s.style.fontSize = 'medium';
5479
- document.body.appendChild(s);
5480
- var fontSize = parseInt(getComputedStyle(s).fontSize);
5481
- document.body.removeChild(s);
5482
- var limits = [fontSize * 3 / 5, fontSize * 3];
5483
-
5484
- _GET_LIMITS_FONT_SIZE_PX = function GET_LIMITS_FONT_SIZE_PX() {
5485
- return limits;
5486
- };
5487
-
5488
- return limits;
5489
- };
5490
-
5491
- var wrapWith = function wrapWith(el, wrapper) {
5492
- el.parentNode.insertBefore(wrapper, el);
5493
- wrapper.appendChild(el);
5494
- };
5495
-
5496
- var FIX_STYLE = {
5497
- 'fontWeight': function fontWeight(v, el) {
5498
- var intFontWeight = parseInt(window.getComputedStyle(el).fontWeight);
5499
- return intFontWeight <= 400 ? 400 : 600;
5500
- },
5501
- 'fontSize': function fontSize(v, el) {
5502
- var _GET_LIMITS_FONT_SIZE = _GET_LIMITS_FONT_SIZE_PX(),
5503
- _GET_LIMITS_FONT_SIZE2 = _slicedToArray(_GET_LIMITS_FONT_SIZE, 2),
5504
- min = _GET_LIMITS_FONT_SIZE2[0],
5505
- max = _GET_LIMITS_FONT_SIZE2[1];
5506
-
5507
- var intFontSize = parseInt(window.getComputedStyle(el).fontSize);
5508
- return Math.min(max, Math.max(min, intFontSize)) + 'px';
5509
- },
5510
- 'textDecoration': function textDecoration(v, el) {
5511
- var values = v.split(' ').filter(function (v) {
5512
- return v === 'underline' || v === 'line-through';
5513
- });
5514
-
5515
- if (values.indexOf('underline') >= 0) {
5516
- wrapWith(el, document.createElement('u'));
5517
- }
5518
-
5519
- if (values.indexOf('line-through') >= 0) {
5520
- wrapWith(el, document.createElement('strike'));
5521
- }
5522
-
5523
- return '';
5524
- }
4765
+ return '';
4766
+ }
5525
4767
  };
5526
4768
  var RichTextContainer = styled__default.div.withConfig({
5527
4769
  displayName: "RichText__RichTextContainer",
5528
- componentId: "x8c1ig-1"
5529
- })(["position:relative;width:100%;border:1px solid ", ";border-radius:6px;background:white;", ";", ";", " ", " ul{list-style-type:disc;}ul,ol{padding-inline-start:25px;margin-block-start:0.5em;margin-block-end:0.5em;}"], utils.getColor('gray210'), function (props) {
4770
+ componentId: "x8c1ig-0"
4771
+ })(["position:relative;width:100%;border:1px solid ", ";border-radius:6px;background:white;", ";", ";", ""], utils.getColor('gray210'), function (props) {
5530
4772
  return props.hasErrors && "border-color: ".concat(utils.getColor(props)('alert'));
5531
4773
  }, function (props) {
5532
4774
  return props.showToolbar && "\n ".concat(ToolsContainer, " {\n transition: 0.5s;\n max-height: 7.5rem;\n transition: 0.6s;\n pointer-events: auto;\n }\n ");
5533
4775
  }, function (props) {
5534
4776
  return props.focus && "\n border-color: ".concat(utils.getColor('gray180'), ";\n box-shadow: 0px 0px 0px 2px rgba(0,0,0,0.1);\n ");
5535
- }, function (props) {
5536
- return props.locked && css(_templateObject$8());
5537
4777
  });
5538
4778
  var RichTextInput = styled__default.div.withConfig({
5539
4779
  displayName: "RichText__RichTextInput",
5540
- componentId: "x8c1ig-2"
4780
+ componentId: "x8c1ig-1"
5541
4781
  })(["width:100%;font-size:14px;outline:0;outline:none;color:", ";background:white;min-height:", "px;outline:0;padding:0.7rem;overflow:auto;border-radius:5px;b,strong{font-weight:600;}&[contenteditable=true]:empty:before{content:attr(placeholder);color:rgba(0,0,0,0.3);}", ""], utils.getColor('gray60'), function (props) {
5542
4782
  return props.minHeight || 78;
5543
4783
  }, function (props) {
@@ -5545,15 +4785,15 @@ var RichTextInput = styled__default.div.withConfig({
5545
4785
  });
5546
4786
  var ToolsContainer = styled__default.div.withConfig({
5547
4787
  displayName: "RichText__ToolsContainer",
5548
- componentId: "x8c1ig-3"
4788
+ componentId: "x8c1ig-2"
5549
4789
  })(["background:", ";padding:0 0.125rem;border-top-left-radius:5px;border-top-right-radius:5px;transition:0.225s;max-height:0;pointer-events:none;overflow:hidden;"], utils.getColor('gray240'));
5550
4790
  var ToolButton = styled__default(components.Button).withConfig({
5551
4791
  displayName: "RichText__ToolButton",
5552
- componentId: "x8c1ig-4"
4792
+ componentId: "x8c1ig-3"
5553
4793
  })(["min-height:2rem;min-width:2rem;background:transparent;box-shadow:none;margin:0.25rem 0.125rem;& ~ &{margin-left:0.125rem;}.icon{font-size:23px;color:", ";position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);}&:hover,&.activated:hover{background:rgba(0,0,0,0.13);}&.activated{background:rgba(0,0,0,0.1);}&:focus:after{content:none;}"], utils.getColor('gray90'));
5554
4794
  var ToolSeparator = styled__default.span.withConfig({
5555
4795
  displayName: "RichText__ToolSeparator",
5556
- componentId: "x8c1ig-5"
4796
+ componentId: "x8c1ig-4"
5557
4797
  })(["border-left:1px solid ", ";margin-left:0.75rem;margin-right:0.5rem;line-height:2rem;vertical-align:-6px;"], utils.getColor('gray180'));
5558
4798
  var JS_CLASS = "EDITOR--JS";
5559
4799
 
@@ -5652,10 +4892,6 @@ var cleanEditor = function cleanEditor(editor, acceptedTags) {
5652
4892
  clean(el.childNodes);
5653
4893
  el.removeAttribute('class');
5654
4894
 
5655
- if (tagName === 'a') {
5656
- el.setAttribute('target', '_blank');
5657
- }
5658
-
5659
4895
  if (el.getAttribute('style')) {
5660
4896
  var usedStyles = _toPairs(_pick(acceptedStyles, el.style)).filter(function (_ref) {
5661
4897
  var _ref2 = _slicedToArray(_ref, 2),
@@ -5751,7 +4987,7 @@ var RichText = function RichText(_ref5) {
5751
4987
  placeholder = _ref5.placeholder,
5752
4988
  className = _ref5.className,
5753
4989
  _ref5$formatTools = _ref5.formatTools,
5754
- formatTools = _ref5$formatTools === void 0 ? ['link', 'bold', 'italic', 'underline', 'strikethrough'] : _ref5$formatTools,
4990
+ formatTools = _ref5$formatTools === void 0 ? ['bold', 'italic', 'underline', 'strikethrough'] : _ref5$formatTools,
5755
4991
  _ref5$reformatText = _ref5.reformatText,
5756
4992
  reformatText = _ref5$reformatText === void 0 ? _identity : _ref5$reformatText,
5757
4993
  mandatory = _ref5.mandatory,
@@ -5759,11 +4995,7 @@ var RichText = function RichText(_ref5) {
5759
4995
  helpText = _ref5.helpText,
5760
4996
  linkColor = _ref5.linkColor,
5761
4997
  _ref5$tabIndex = _ref5.tabIndex,
5762
- tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex,
5763
- value = _ref5.value,
5764
- setValue = _ref5.setValue,
5765
- raw = _ref5.raw,
5766
- locked = _ref5.locked;
4998
+ tabIndex = _ref5$tabIndex === void 0 ? 1 : _ref5$tabIndex;
5767
4999
  var linkPopup = core.usePopupToggle();
5768
5000
  var input = core.useEnsureRef(inputRef);
5769
5001
  var activeLinkNode = React.useRef();
@@ -5775,34 +5007,21 @@ var RichText = function RichText(_ref5) {
5775
5007
  var commands = core.useRefState([]);
5776
5008
  var containerFocused = core.useToggle();
5777
5009
  var needsNormalize = core.useRefState();
5778
- var alreadyCancelled = core.useRefState(); // const [formValue, setFormValue] = useInput({path})
5010
+ var alreadyCancelled = core.useRefState();
5779
5011
 
5780
5012
  var _useInput = useInput({
5781
- path: path,
5782
- value: value,
5783
- setValue: setValue
5784
- }, raw),
5785
- _useInput2 = _slicedToArray(_useInput, 3),
5013
+ path: path
5014
+ }),
5015
+ _useInput2 = _slicedToArray(_useInput, 2),
5786
5016
  formValue = _useInput2[0],
5787
- setFormValue = _useInput2[1],
5788
- hasErrors = _useInput2[2].hasErrors; // const tempValue = useConstant(formValue)
5017
+ setFormValue = _useInput2[1];
5789
5018
 
5019
+ var tempValue = core.useConstant(formValue);
5790
5020
 
5791
- var _useState = React.useState(formValue),
5021
+ var _useState = React.useState({}),
5792
5022
  _useState2 = _slicedToArray(_useState, 2),
5793
- tempValue = _useState2[0],
5794
- setTempValue = _useState2[1];
5795
-
5796
- React.useEffect(function () {
5797
- if (value === formValue && formValue !== tempValue) {
5798
- setTempValue(formValue);
5799
- }
5800
- }, [path]);
5801
-
5802
- var _useState3 = React.useState({}),
5803
- _useState4 = _slicedToArray(_useState3, 2),
5804
- activatedTools = _useState4[0],
5805
- setActivatedTools = _useState4[1];
5023
+ activatedTools = _useState2[0],
5024
+ setActivatedTools = _useState2[1];
5806
5025
 
5807
5026
  var validElements = core.useLazyConstant(function () {
5808
5027
  return ['br', 'div', 'p', 'span'].concat(_flatten(formatTools.map(function (tool) {
@@ -5838,6 +5057,8 @@ var RichText = function RichText(_ref5) {
5838
5057
  };
5839
5058
 
5840
5059
  var containerBlur = function containerBlur(e) {
5060
+ console.log(e.target, e.currentTarget);
5061
+
5841
5062
  if (containerFocused.isOpen !== 1) {
5842
5063
  containerFocused.close();
5843
5064
  triggerScrollForPanel(Date.now());
@@ -5852,26 +5073,6 @@ var RichText = function RichText(_ref5) {
5852
5073
  }
5853
5074
  };
5854
5075
 
5855
- var keydownHandler = function keydownHandler(e) {
5856
- if (containerFocused.isOpen === 2) {
5857
- if (formatTools.indexOf('link') < 0) {
5858
- return;
5859
- }
5860
-
5861
- if (e.key === "k" && e.ctrlKey || e.key === "k" && e.metaKey) {
5862
- e.preventDefault();
5863
- execCommand(null, 'link');
5864
- }
5865
- }
5866
- };
5867
-
5868
- React.useEffect(function () {
5869
- document.addEventListener('keydown', keydownHandler);
5870
- return function () {
5871
- return document.removeEventListener('keydown', keydownHandler);
5872
- };
5873
- }, [containerFocused.isOpen]);
5874
-
5875
5076
  var execCommand = function execCommand(e, command) {
5876
5077
  if (command === 'link') {
5877
5078
  var nodeEl;
@@ -5906,23 +5107,17 @@ var RichText = function RichText(_ref5) {
5906
5107
  _anchor.innerHTML = '&#8203;';
5907
5108
 
5908
5109
  if (range.collapsed) {
5909
- range.insertNode(_anchor);
5110
+ window.getSelection().getRangeAt(0).insertNode(_anchor);
5910
5111
  } else {
5911
- if (range.commonAncestorContainer === input.current) {
5912
- range.setStart(range.endContainer, 0);
5913
- }
5914
-
5915
5112
  document.execCommand('createLink', false, '_');
5916
5113
  _anchor = window.getSelection().anchorNode;
5917
5114
  }
5918
5115
 
5919
- var _parent = range.commonAncestorContainer.nodeType === 3 ? range.commonAncestorContainer.parentNode : range.commonAncestorContainer;
5116
+ var _parent = _anchor.nodeName === 'A' ? _anchor : _anchor.parentElement.matches('a') ? _anchor.parentElement : _anchor.nextSibling;
5920
5117
 
5921
- var links = _parent.querySelectorAll("a[href='_']");
5118
+ _parent.setAttribute('href', ' ');
5922
5119
 
5923
- Array.from(links).slice(0, -1).forEach(removeLinkFromNode);
5924
- nodeEl = _last(links);
5925
- nodeEl.setAttribute('href', ' ');
5120
+ nodeEl = _parent;
5926
5121
  }
5927
5122
  }
5928
5123
 
@@ -5960,25 +5155,11 @@ var RichText = function RichText(_ref5) {
5960
5155
  containerFocused.openWith(1);
5961
5156
  focus();
5962
5157
  }
5963
-
5964
- if (command === 'insertUnorderedList' || command === 'insertOrderedList') {
5965
- var _range2 = document.createRange();
5966
-
5967
- _range2.setStart(startSelectionToken.get().nextSibling, 0);
5968
-
5969
- var _end = endSelectionToken.get().nextSibling;
5970
- startSelectionToken.get().remove();
5971
- endSelectionToken.get().remove();
5972
- startSelectionToken.set(null);
5973
- endSelectionToken.set(null);
5974
-
5975
- _range2.setEnd(_end, 0);
5976
- }
5977
5158
  };
5978
5159
 
5979
5160
  var execCommandMouseUp = function execCommandMouseUp() {
5980
5161
  if (startSelectionToken.get()) {
5981
- // window.getSelection().removeAllRanges()
5162
+ window.getSelection().removeAllRanges();
5982
5163
  var range = document.createRange();
5983
5164
  range.setStart(startSelectionToken.get().nextSibling, 0);
5984
5165
  var end = endSelectionToken.get().nextSibling;
@@ -5994,9 +5175,8 @@ var RichText = function RichText(_ref5) {
5994
5175
 
5995
5176
  commands.get().forEach(function (c) {
5996
5177
  return parseAndExecCommand(c);
5997
- }); // commands.set(_.without(['insertUnorderedList','insertOrderedList','outdent','indent']))
5998
-
5999
- commands.set([]);
5178
+ });
5179
+ commands.set(_without(['insertUnorderedList', 'insertOrderedList', 'outdent', 'indent']));
6000
5180
  setFormValue(input.current.innerHTML);
6001
5181
  containerFocused.openWith(2);
6002
5182
  toggleButtonsState();
@@ -6146,14 +5326,10 @@ var RichText = function RichText(_ref5) {
6146
5326
  });
6147
5327
  };
6148
5328
 
6149
- var removeLinkFromNode = function removeLinkFromNode(node) {
6150
- node.outerHTML = node.innerHTML === "\u200B" ? '' : node.innerHTML;
6151
- };
6152
-
6153
5329
  var removeLink = function removeLink(e) {
6154
5330
  if (e) e.preventDefault();
6155
5331
  alreadyCancelled.set(true);
6156
- removeLinkFromNode(activeLinkNode.current);
5332
+ activeLinkNode.current.outerHTML = activeLinkNode.current.innerHTML === "\u200B" ? '' : activeLinkNode.current.innerHTML;
6157
5333
  linkPopup.close();
6158
5334
 
6159
5335
  if (input.current) {
@@ -6222,8 +5398,6 @@ var RichText = function RichText(_ref5) {
6222
5398
  className: JS_CLASS,
6223
5399
  minHeight: minHeight,
6224
5400
  placeholder: placeholder
6225
- }), locked && React__default.createElement(InputIcon$1, {
6226
- icon: "lock"
6227
5401
  }), linkPopup.isOpen && React__default.createElement(EditLinkPopup, {
6228
5402
  input: input,
6229
5403
  activeLinkNode: activeLinkNode,
@@ -6250,22 +5424,19 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
6250
5424
  values = _ref7.values;
6251
5425
  var linkPopup = React.useRef();
6252
5426
  var formRef = React.useRef();
6253
- var linkTextRef = React.useRef();
6254
- var linkUrlRef = React.useRef();
6255
- var LABELS = React.useContext(core.StartlibsContext).labels.RichText;
6256
5427
 
6257
5428
  var preValidation = function preValidation(formValues) {
6258
5429
  var errors;
6259
5430
 
6260
5431
  if (!formValues.linkText) {
6261
5432
  errors = {
6262
- 'linkText': [LABELS.linkTextError]
5433
+ 'linkText': ['Campos com asterisco (*) são obrigatórios.']
6263
5434
  };
6264
5435
  }
6265
5436
 
6266
5437
  if (!formValues.linkUrl || formValues.linkUrl === ' ' || !utils.linkRegex.test(formValues.linkUrl.trim())) {
6267
5438
  errors = _objectSpread({}, errors, {
6268
- 'linkUrl': [LABELS.linkUrlError]
5439
+ 'linkUrl': ['Adicione um endereço válido.']
6269
5440
  });
6270
5441
  }
6271
5442
 
@@ -6274,8 +5445,7 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
6274
5445
 
6275
5446
  var checkEscOrEnter = function checkEscOrEnter(e) {
6276
5447
  if (e.keyCode === 27) {
6277
- e.stopPropagation();
6278
- cancel(e);
5448
+ e.stopPropagation().cancel(e);
6279
5449
  } else if (e.keyCode === 13) {
6280
5450
  e.preventDefault();
6281
5451
  e.stopPropagation();
@@ -6294,13 +5464,6 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
6294
5464
  'left': left + 'px',
6295
5465
  'top': top + 'px'
6296
5466
  });
6297
-
6298
- if (values.linkText) {
6299
- linkUrlRef.current.focus();
6300
- } else {
6301
- linkTextRef.current.focus();
6302
- }
6303
-
6304
5467
  return cancel;
6305
5468
  }, []);
6306
5469
  return React__default.createElement(WithForm, {
@@ -6317,29 +5480,230 @@ var EditLinkPopup = function EditLinkPopup(_ref7) {
6317
5480
  className: "popup rich-text-link-editor ignore-link",
6318
5481
  contentEditable: false
6319
5482
  }, React__default.createElement(TextInput, {
6320
- ref: linkTextRef,
5483
+ autoFocus: !values.linkText,
6321
5484
  mandatory: true,
6322
5485
  path: "linkText",
6323
- label: LABELS.popupLinkText
5486
+ label: "Texto de exibi\xE7\xE3o"
6324
5487
  }), React__default.createElement(TextInput, {
6325
- ref: linkUrlRef,
5488
+ autoFocus: values.linkText,
6326
5489
  mandatory: true,
6327
5490
  path: "linkUrl",
6328
- label: LABELS.popupLinkUrl
5491
+ label: "Endere\xE7o completo"
6329
5492
  }), React__default.createElement("div", {
6330
5493
  className: "popup-footer"
6331
5494
  }, React__default.createElement(components.Button, {
6332
5495
  className: "remove-link",
6333
5496
  icon: "remove",
6334
5497
  onClick: removeLink
6335
- }, LABELS.popupRemove), React__default.createElement(components.Button, {
5498
+ }, "Remover Link"), React__default.createElement(components.Button, {
6336
5499
  onClick: cancel,
6337
5500
  tabIndex: 0
6338
- }, LABELS.popupCancel), React__default.createElement(components.Button, {
5501
+ }, "Cancelar"), React__default.createElement(components.Button, {
6339
5502
  highlight: true,
6340
5503
  onClick: form.willSubmitForm
6341
- }, LABELS.popupConfirm)), React__default.createElement(Errors, null));
5504
+ }, "Aplicar")), React__default.createElement(Errors, null));
5505
+ });
5506
+ };
5507
+
5508
+ function _templateObject$6() {
5509
+ var data = _taggedTemplateLiteral(["\n padding 1rem;\n "]);
5510
+
5511
+ _templateObject$6 = function _templateObject() {
5512
+ return data;
5513
+ };
5514
+
5515
+ return data;
5516
+ }
5517
+
5518
+ var shouldPreventExpand = function shouldPreventExpand(fn) {
5519
+ return function (e) {
5520
+ return e.target.closest('body,[data-expand="false"],label,input,textarea,button').matches('body,[data-expand="true"]') && fn(e);
5521
+ };
5522
+ };
5523
+
5524
+ var ExpandableBoxStyled = styled__default.div.withConfig({
5525
+ displayName: "ExpandableBox__ExpandableBoxStyled",
5526
+ componentId: "sc-1nsk1wq-0"
5527
+ })(["padding:1rem;border-radius:8px;background:", ";font-size:14px;outline:none;transition:background 0.25s linear;", " & ~ &{margin-top:0.75rem;}", " &{margin-top:0.75rem;}"], utils.getColor('gray240'), function (props) {
5528
+ return props.collapsed ? styled.css(["cursor:pointer;padding-right:3.25rem;:hover{background:", ";}:active{background:", ";}"], function (props) {
5529
+ return polished.darken(0.05, utils.getColor("gray240")(props));
5530
+ }, function (props) {
5531
+ return polished.darken(0.08, utils.getColor("gray240")(props));
5532
+ }) : styled.css(["padding 1.5rem;", " ", ""], utils.media.max(340)(_templateObject$6()), function (props) {
5533
+ return props.fixMarginBottom && "\n padding-bottom: 0.5rem !important;\n ";
5534
+ });
5535
+ }, components.SwitchDiv);
5536
+ var EditIcon = styled__default(components.Icon).attrs({
5537
+ icon: 'edit'
5538
+ }).withConfig({
5539
+ displayName: "ExpandableBox__EditIcon",
5540
+ componentId: "sc-1nsk1wq-1"
5541
+ })(["position:absolute;top:50%;transform:translateY(-50%);right:-24px;color:rgba(0,0,0,0.25);font-size:20px;"]);
5542
+ var checkErrors = function checkErrors() {
5543
+ for (var _len = arguments.length, checks = new Array(_len), _key = 0; _key < _len; _key++) {
5544
+ checks[_key] = arguments[_key];
5545
+ }
5546
+
5547
+ return function (v, setErrors) {
5548
+ var results = checks.map(function (c) {
5549
+ return c(v);
5550
+ }).filter(Boolean);
5551
+
5552
+ if (!results.length) {
5553
+ return true;
5554
+ }
5555
+
5556
+ var messages = results.filter(_negate(_isBoolean));
5557
+
5558
+ if (messages.length) {
5559
+ setErrors.apply(void 0, _toConsumableArray(messages));
5560
+ }
5561
+
5562
+ return false;
5563
+ };
5564
+ };
5565
+ var timing = utils.animationTiming('0.25s ease-out');
5566
+ var switchAnimation = utils.oneWayAnimation('opacity: 1;transform:translateY(0);', 'opacity: 0;', 'opacity: 0; transform:translateY(30px);');
5567
+ var ExpandableBox = function ExpandableBox(_ref) {
5568
+ var children = _ref.children,
5569
+ info = _ref.info,
5570
+ isOpen = _ref.isOpen,
5571
+ openWhen = _ref.openWhen,
5572
+ path = _ref.path,
5573
+ _ref$retargetFilter = _ref.retargetFilter,
5574
+ retargetFilter = _ref$retargetFilter === void 0 ? function (el) {
5575
+ var _el$tagName;
5576
+
5577
+ return (el === null || el === void 0 ? void 0 : (_el$tagName = el.tagName) === null || _el$tagName === void 0 ? void 0 : _el$tagName.toLowerCase()) === "button";
5578
+ } : _ref$retargetFilter,
5579
+ _ref$isValid = _ref.isValid,
5580
+ isValid = _ref$isValid === void 0 ? function () {
5581
+ return true;
5582
+ } : _ref$isValid,
5583
+ fixMarginBottom = _ref.fixMarginBottom,
5584
+ _ref$animation = _ref.animation,
5585
+ animation = _ref$animation === void 0 ? switchAnimation : _ref$animation,
5586
+ _ref$animationTiming = _ref.animationTiming,
5587
+ animationTiming = _ref$animationTiming === void 0 ? timing : _ref$animationTiming;
5588
+ var flipAnimation = core.useLazyConstant(components.willUseFlipSwitch);
5589
+
5590
+ var _useFormValue = form.useFormValue(path),
5591
+ _useFormValue2 = _slicedToArray(_useFormValue, 3),
5592
+ value = _useFormValue2[0],
5593
+ setValue = _useFormValue2[1],
5594
+ getValue = _useFormValue2[2];
5595
+
5596
+ var _useTransientErrorHel = useTransientErrorHelper(),
5597
+ _useTransientErrorHel2 = _slicedToArray(_useTransientErrorHel, 2),
5598
+ _setErrors = _useTransientErrorHel2[0],
5599
+ clearErrors = _useTransientErrorHel2[1];
5600
+
5601
+ var setErrors = function setErrors() {
5602
+ for (var _len2 = arguments.length, errors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5603
+ errors[_key2] = arguments[_key2];
5604
+ }
5605
+
5606
+ _setErrors(errors.length ? errors.map(function (k) {
5607
+ return _isString(k) ? [k, ''] : k;
5608
+ }) : [[path, '']]);
5609
+
5610
+ return true;
5611
+ };
5612
+
5613
+ var expand = core.useToggle(isOpen, function (newV, prevV) {
5614
+ if (newV === 0 || prevV === 0) {
5615
+ return;
5616
+ }
5617
+
5618
+ if (newV === false) {
5619
+ var result = isValid(getValue(), setErrors);
5620
+
5621
+ if (result === true) {
5622
+ clearErrors();
5623
+ }
5624
+
5625
+ return result;
5626
+ }
6342
5627
  });
5628
+ var openWhenResult = utils.callIfFunction(openWhen);
5629
+ React.useEffect(function () {
5630
+ if (openWhenResult) {
5631
+ expand.open();
5632
+ }
5633
+ }, [openWhenResult]);
5634
+ React.useEffect(function () {
5635
+ return function () {
5636
+ if (expand.get() === 0) {
5637
+ expand.close();
5638
+ }
5639
+ };
5640
+ }, [expand.isOpen]);
5641
+ var utils$1 = core.useLazyConstant(function () {
5642
+ return {
5643
+ close: utils.constrainEvent(expand.close),
5644
+ setValue: setValue
5645
+ };
5646
+ });
5647
+
5648
+ var onBlur = function onBlur(e) {
5649
+ if (e.currentTarget !== e.relatedTarget && (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget))) {
5650
+ if (utils.callIfFunction(retargetFilter, e.relatedTarget)) {
5651
+ e.target.focus();
5652
+ } else {
5653
+ expand.close();
5654
+ }
5655
+ }
5656
+ };
5657
+
5658
+ return React__default.createElement(ExpandableBoxStyled, {
5659
+ tabIndex: -1,
5660
+ onBlur: onBlur,
5661
+ collapsed: !expand.isOpen,
5662
+ fixMarginBottom: fixMarginBottom,
5663
+ onClick: shouldPreventExpand(expand.open)
5664
+ }, React__default.createElement(FlipDiv$1, {
5665
+ key: expand.isOpen,
5666
+ useAnimation: flipAnimation,
5667
+ animation: animation,
5668
+ animationTiming: animationTiming
5669
+ }, 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))));
5670
+ };
5671
+
5672
+ var overflowEffect = function overflowEffect(element) {
5673
+ var _element$offsetParent;
5674
+
5675
+ if (!(element === null || element === void 0 ? void 0 : (_element$offsetParent = element.offsetParent) === null || _element$offsetParent === void 0 ? void 0 : _element$offsetParent.parentElement)) {
5676
+ return;
5677
+ }
5678
+
5679
+ var parentDom = element.offsetParent.parentElement;
5680
+ var previousOverflow = parentDom.style.overflow;
5681
+ parentDom.style.overflow = 'hidden';
5682
+ return function () {
5683
+ return parentDom.style.overflow = previousOverflow;
5684
+ };
5685
+ };
5686
+
5687
+ var FlipDivStyle = styled__default.div.withConfig({
5688
+ displayName: "ExpandableBox__FlipDivStyle",
5689
+ componentId: "sc-1nsk1wq-2"
5690
+ })(["position:relative;"]);
5691
+
5692
+ var FlipDiv$1 = function FlipDiv(_ref2) {
5693
+ var useAnimation = _ref2.useAnimation,
5694
+ animation = _ref2.animation,
5695
+ animationTiming = _ref2.animationTiming,
5696
+ props = _objectWithoutProperties(_ref2, ["useAnimation", "animation", "animationTiming"]);
5697
+
5698
+ var ref = React.useRef();
5699
+ useAnimation(ref, null, null, {
5700
+ switchAnimation: animation,
5701
+ timing: animationTiming,
5702
+ effect: overflowEffect
5703
+ });
5704
+ return React__default.createElement(FlipDivStyle, _extends({}, props, {
5705
+ ref: ref
5706
+ }));
6343
5707
  };
6344
5708
 
6345
5709
  var IconRadioBoxText = styled__default.div.withConfig({
@@ -6399,33 +5763,19 @@ var ToggleContainer = styled__default.div.withConfig({
6399
5763
  var Toggle = styled__default.div.withConfig({
6400
5764
  displayName: "ToggleCheckbox__Toggle",
6401
5765
  componentId: "sc-11ob8ah-1"
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)';
5766
+ })(["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) {
5767
+ return props.checked ? 'rgba(0, 132, 214, 0.3)' : 'rgba(0,0,0,0.15)';
6404
5768
  }, function (props) {
6405
- return props.checked ? styled.css(["margin-left:-2px;left:100%;transform:translate(-100%,-50%);"]) : styled.css(["margin-left:2px;left:0;"]);
5769
+ return props.checked ? styled.css(["left:100%;transform:translate(-100%,-50%);background:", ";"], utils.getColor('main')) : styled.css(["left:0;background:", ";"], utils.getColor('gray150'));
6406
5770
  }, utils.customTheme('ToggleCheckbox'));
6407
5771
  var ToggleLabel = styled__default.div.withConfig({
6408
5772
  displayName: "ToggleCheckbox__ToggleLabel",
6409
5773
  componentId: "sc-11ob8ah-2"
6410
- })(["flex-basis:0;flex-grow:1;display:inline-block;font-size:14px;"]);
5774
+ })(["flex-basis:0;flex-grow:1;display:inline-block;font-size:13px;"]);
6411
5775
  var DescText$2 = styled__default.div.withConfig({
6412
5776
  displayName: "ToggleCheckbox__DescText",
6413
5777
  componentId: "sc-11ob8ah-3"
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'));
5778
+ })(["font-weight:400;color:", ";font-size:12px;margin-top:0.25rem;"], utils.getColor('gray120'));
6429
5779
  var ToggleCheckbox = styled__default(function (_ref) {
6430
5780
  var path = _ref.path,
6431
5781
  disabled = _ref.disabled,
@@ -6433,16 +5783,14 @@ var ToggleCheckbox = styled__default(function (_ref) {
6433
5783
  descText = _ref.descText,
6434
5784
  helpText = _ref.helpText,
6435
5785
  tabIndex = _ref.tabIndex,
6436
- noFocus = _ref.noFocus,
6437
5786
  className = _ref.className,
6438
- rest = _objectWithoutProperties(_ref, ["path", "disabled", "label", "descText", "helpText", "tabIndex", "noFocus", "className"]);
5787
+ rest = _objectWithoutProperties(_ref, ["path", "disabled", "label", "descText", "helpText", "tabIndex", "className"]);
6439
5788
 
6440
- return React__default.createElement(ToggleCheckboxStyled, _extends({
5789
+ return React__default.createElement(Checkbox, _extends({
5790
+ className: className,
6441
5791
  path: path,
6442
5792
  tabIndex: tabIndex,
6443
- disabled: disabled,
6444
- noFocus: noFocus,
6445
- className: className
5793
+ disabled: disabled
6446
5794
  }, rest), function (_ref2) {
6447
5795
  var disabled = _ref2.disabled,
6448
5796
  checked = _ref2.checked,
@@ -6454,13 +5802,17 @@ var ToggleCheckbox = styled__default(function (_ref) {
6454
5802
  });
6455
5803
  }).withConfig({
6456
5804
  displayName: "ToggleCheckbox",
6457
- componentId: "sc-11ob8ah-5"
6458
- })([""]);
5805
+ componentId: "sc-11ob8ah-4"
5806
+ })(["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) {
5807
+ 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);}}"]);
5808
+ }, function (props) {
5809
+ return props.disabled && "\n opacity: 0.8;\n pointer-events:none;\n ";
5810
+ });
6459
5811
 
6460
- function _templateObject$9() {
5812
+ function _templateObject$7() {
6461
5813
  var data = _taggedTemplateLiteral(["\n min-width: 0;\n ", "\n "]);
6462
5814
 
6463
- _templateObject$9 = function _templateObject() {
5815
+ _templateObject$7 = function _templateObject() {
6464
5816
  return data;
6465
5817
  };
6466
5818
 
@@ -6479,7 +5831,7 @@ var TabButton = styled__default(components.Button).withConfig({
6479
5831
  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 ";
6480
5832
  }, function (props) {
6481
5833
  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 ";
6482
- }, utils.media.mobile(_templateObject$9(), function (props) {
5834
+ }, utils.media.mobile(_templateObject$7(), function (props) {
6483
5835
  return props.icon ? "\n padding-left: 1.25rem;\n padding-right: 1rem;\n " : "\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n ";
6484
5836
  }), utils.customTheme('TabButton'));
6485
5837
  var InnerButton = styled__default.a.withConfig({
@@ -6516,40 +5868,6 @@ var TabRadiobox = styled__default(function (_ref) {
6516
5868
  componentId: "sc-1vu3bcn-2"
6517
5869
  })(["display:inline-block;"]);
6518
5870
 
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
-
6553
5871
  var error = 'Error';
6554
5872
  var messages = {
6555
5873
  required: error,
@@ -6588,14 +5906,6 @@ var confirmEmails = function confirmEmails(emailKey) {
6588
5906
  return (props[emailKey] || confirm) && props[emailKey] !== confirm && messages.confirmEmails;
6589
5907
  };
6590
5908
  };
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
- };
6599
5909
  var emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
6600
5910
  var emailValidation = function emailValidation(s, k) {
6601
5911
  return !emailRegex.test(s) && messages.emailValidation;
@@ -6631,93 +5941,17 @@ var buildValidation = function buildValidation(validations) {
6631
5941
  }), _fromPairs)(validations), utils.callIfFunction(custom, props)));
6632
5942
  };
6633
5943
  };
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
- };
6710
5944
  var responseFailure = function responseFailure(fn) {
6711
- return function (v, response, _ref11) {
6712
- var setErrors = _ref11.setErrors;
5945
+ return function (_, response, _ref5) {
5946
+ var setErrors = _ref5.setErrors;
6713
5947
  var errorSetter = setErrors;
6714
- var r = [].concat(response, v);
5948
+ var r = [].concat(response, _);
6715
5949
  console.log(r);
6716
5950
  var error = fn.apply(void 0, _toConsumableArray(r));
6717
5951
 
6718
5952
  if (error === true) ; else if (error) {
6719
5953
  errorSetter(error);
6720
- } else if (!_get('response[0].errors')) {
5954
+ } else {
6721
5955
  errorSetter({
6722
5956
  "": [messages.SERVER_ERROR]
6723
5957
  });
@@ -6731,11 +5965,9 @@ var validation = {
6731
5965
  minLength: minLength,
6732
5966
  confirmPasswords: confirmPasswords,
6733
5967
  confirmEmails: confirmEmails,
6734
- confirm: confirm,
6735
5968
  emailValidation: emailValidation,
6736
5969
  optional: optional,
6737
5970
  buildValidation: buildValidation,
6738
- buildAsyncValidation: buildAsyncValidation,
6739
5971
  responseFailure: responseFailure
6740
5972
  };
6741
5973
 
@@ -6744,7 +5976,6 @@ exports.AutoCompleteTextbox = AutoCompleteTextbox;
6744
5976
  exports.BellowFieldDescription = BellowFieldDescription;
6745
5977
  exports.Checkbox = Checkbox;
6746
5978
  exports.CheckboxGroup = CheckboxGroup;
6747
- exports.CleanTabRadiobox = CleanTabRadiobox;
6748
5979
  exports.Combobox = Combobox;
6749
5980
  exports.ComboboxInput = ComboboxInput;
6750
5981
  exports.ComboboxMenu = ComboboxMenu;
@@ -6760,10 +5991,6 @@ exports.Errors = Errors;
6760
5991
  exports.ErrorsContext = ErrorsContext;
6761
5992
  exports.ExpandableBox = ExpandableBox;
6762
5993
  exports.Field = Field;
6763
- exports.FieldBox = FieldBox;
6764
- exports.FieldBoxAction = FieldBoxAction;
6765
- exports.FieldBoxHelpText = FieldBoxHelpText;
6766
- exports.FieldBoxIcon = FieldBoxIcon;
6767
5994
  exports.FieldDescription = FieldDescription;
6768
5995
  exports.FileInput = FileInput;
6769
5996
  exports.FloatLabelTextInput = FloatLabelTextInput;
@@ -6778,11 +6005,8 @@ exports.IconRadioBoxIconContainer = IconRadioBoxIconContainer;
6778
6005
  exports.IconRadioBoxText = IconRadioBoxText;
6779
6006
  exports.IfFormValue = IfFormValue;
6780
6007
  exports.InputboxGroup = InputboxGroup;
6781
- exports.LazyFormValues = LazyFormValues;
6782
- exports.NO_DIGITABLE_FOUND = NO_DIGITABLE_FOUND;
6783
6008
  exports.Option = Option;
6784
6009
  exports.PathContext = PathContext;
6785
- exports.PseudoExpandableBox = PseudoExpandableBox;
6786
6010
  exports.Radiobox = Radiobox;
6787
6011
  exports.RadioboxGroup = RadioboxGroup;
6788
6012
  exports.RichText = RichText;
@@ -6791,8 +6015,6 @@ exports.RichTextInput = RichTextInput;
6791
6015
  exports.SEPARATOR = SEPARATOR;
6792
6016
  exports.SimpleCheckbox = SimpleCheckbox;
6793
6017
  exports.SimpleRadiobox = SimpleRadiobox;
6794
- exports.SwitchOnFormValue = SwitchOnFormValue;
6795
- exports.Tab = Tab;
6796
6018
  exports.TabButton = TabButton;
6797
6019
  exports.TabRadiobox = TabRadiobox;
6798
6020
  exports.TextInput = TextInput;