@thecb/components 9.2.0-beta.9 → 9.2.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +835 -1831
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +60 -6
- package/dist/index.esm.js +834 -1831
- package/dist/index.esm.js.map +1 -1
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/checkbox/Checkbox.js +3 -1
- package/src/components/atoms/checkbox/Checkbox.stories.js +3 -2
- package/src/components/atoms/country-dropdown/CountryDropdown.js +3 -1
- package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +1 -0
- package/src/components/atoms/dropdown/Dropdown.js +77 -39
- package/src/components/atoms/dropdown/Dropdown.theme.js +8 -2
- package/src/components/atoms/form-layouts/FormInput.js +3 -0
- package/src/components/atoms/form-select/FormSelect.js +22 -9
- package/src/components/atoms/form-select/FormSelect.stories.js +2 -2
- package/src/components/atoms/icons/.DS_Store +0 -0
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +9 -6
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +4 -1
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.stories.js +1 -0
- package/src/components/molecules/address-form/AddressForm.js +6 -0
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +6 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +6 -0
- package/src/components/molecules/popover/Popover.js +1 -1
- package/src/components/molecules/radio-group/RadioGroup.js +1 -1
- package/src/components/molecules/radio-section/RadioSection.js +1 -0
- package/src/components/molecules/radio-section/RadioSection.stories.js +3 -2
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +11 -6
- package/src/components/molecules/radio-section/radio-button/RadioButton.theme.js +2 -2
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +1 -1
- package/src/components/molecules/toast-notification/ToastNotification.js +5 -6
- package/src/components/molecules/toast-notification/ToastNotification.stories.js +4 -4
- package/src/constants/colors.js +2 -0
- package/src/hooks/index.js +3 -0
- package/src/{util/hooks → hooks}/use-toast-notification/index.d.ts +6 -6
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/types/common/ToastVariants.ts +1 -1
- package/src/util/index.js +2 -2
- package/src/util/hooks/index.js +0 -1
- /package/src/{util/useOutsideClick.js → hooks/use-outside-click/index.js} +0 -0
- /package/src/{util/useScrollTo.js → hooks/use-scroll-to/index.js} +0 -0
- /package/src/{util/hooks → hooks}/use-toast-notification/index.js +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -5019,6 +5019,7 @@ var INFO_BLUE = "#E4F4FD";
|
|
|
5019
5019
|
var CORNFLOWER_BLUE = "#EBEFFB";
|
|
5020
5020
|
var HOVER_LIGHT_BLUE = "#EFFAFF";
|
|
5021
5021
|
var MATISSE_BLUE = "#15749D";
|
|
5022
|
+
var MATISSE_BLUE_DARK = "#105C7D";
|
|
5022
5023
|
var ROYAL_BLUE = "#3181E3";
|
|
5023
5024
|
var ROYAL_BLUE_VIVID = "#3B5BDB";
|
|
5024
5025
|
var ASTRAL_BLUE = "#3176AA";
|
|
@@ -5154,6 +5155,7 @@ var colors = /*#__PURE__*/Object.freeze({
|
|
|
5154
5155
|
BOSTON_BLUE: BOSTON_BLUE,
|
|
5155
5156
|
HOVER_LIGHT_BLUE: HOVER_LIGHT_BLUE,
|
|
5156
5157
|
MATISSE_BLUE: MATISSE_BLUE,
|
|
5158
|
+
MATISSE_BLUE_DARK: MATISSE_BLUE_DARK,
|
|
5157
5159
|
ROYAL_BLUE: ROYAL_BLUE,
|
|
5158
5160
|
ROYAL_BLUE_VIVID: ROYAL_BLUE_VIVID,
|
|
5159
5161
|
ASTRAL_BLUE: ASTRAL_BLUE,
|
|
@@ -22132,7 +22134,9 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22132
22134
|
extraStyles = _ref4.extraStyles,
|
|
22133
22135
|
textExtraStyles = _ref4.textExtraStyles,
|
|
22134
22136
|
_ref4$dataQa = _ref4.dataQa,
|
|
22135
|
-
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa
|
|
22137
|
+
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa,
|
|
22138
|
+
_ref4$isRequired = _ref4.isRequired,
|
|
22139
|
+
isRequired = _ref4$isRequired === void 0 ? false : _ref4$isRequired;
|
|
22136
22140
|
|
|
22137
22141
|
var _useState = React.useState(false),
|
|
22138
22142
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -22186,7 +22190,8 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22186
22190
|
errorStyles: themeValues.errorStyles,
|
|
22187
22191
|
disabledStyles: themeValues.disabledStyles,
|
|
22188
22192
|
disabledCheckedStyles: themeValues.disabledCheckedStyles,
|
|
22189
|
-
focusedStyles: themeValues.focusedStyles
|
|
22193
|
+
focusedStyles: themeValues.focusedStyles,
|
|
22194
|
+
"aria-required": isRequired
|
|
22190
22195
|
}, /*#__PURE__*/React__default.createElement(CheckboxIcon, {
|
|
22191
22196
|
viewBox: "0 0 24 24",
|
|
22192
22197
|
disabled: disabled,
|
|
@@ -23700,9 +23705,11 @@ exportTypedArrayMethod$1('at', function at(index) {
|
|
|
23700
23705
|
|
|
23701
23706
|
var selectedColor = "".concat(MATISSE_BLUE);
|
|
23702
23707
|
var hoverColor$3 = "".concat(HOVER_LIGHT_BLUE);
|
|
23708
|
+
var focusColor = "".concat(MATISSE_BLUE_DARK);
|
|
23703
23709
|
var fallbackValues$f = {
|
|
23704
23710
|
selectedColor: selectedColor,
|
|
23705
|
-
hoverColor: hoverColor$3
|
|
23711
|
+
hoverColor: hoverColor$3,
|
|
23712
|
+
focusColor: focusColor
|
|
23706
23713
|
};
|
|
23707
23714
|
|
|
23708
23715
|
var IconWrapper = styled__default.div.withConfig({
|
|
@@ -23725,7 +23732,7 @@ var DropdownContentWrapper = styled__default.div.withConfig({
|
|
|
23725
23732
|
var DropdownItemWrapper = styled__default.li.withConfig({
|
|
23726
23733
|
displayName: "Dropdown__DropdownItemWrapper",
|
|
23727
23734
|
componentId: "sc-pn6m0h-2"
|
|
23728
|
-
})(["
|
|
23735
|
+
})(["text-align:start;border-width:2px;border-style:solid;border-color:", ";box-shadow:none;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{border-color:", ";> *{background:", ";border-color:", ";}}&:focus{outline:none;border-color:", ";> *{background:", ";border-color:white;outline:none;}}"], function (_ref4) {
|
|
23729
23736
|
var selected = _ref4.selected,
|
|
23730
23737
|
themeValues = _ref4.themeValues;
|
|
23731
23738
|
return selected ? themeValues.selectedColor : WHITE;
|
|
@@ -23733,44 +23740,73 @@ var DropdownItemWrapper = styled__default.li.withConfig({
|
|
|
23733
23740
|
var disabled = _ref5.disabled;
|
|
23734
23741
|
return disabled ? "default" : "pointer";
|
|
23735
23742
|
}, function (_ref6) {
|
|
23736
|
-
var
|
|
23737
|
-
|
|
23743
|
+
var disabled = _ref6.disabled,
|
|
23744
|
+
selected = _ref6.selected,
|
|
23738
23745
|
themeValues = _ref6.themeValues;
|
|
23739
|
-
return selected ? themeValues.
|
|
23746
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23740
23747
|
}, function (_ref7) {
|
|
23741
23748
|
var selected = _ref7.selected,
|
|
23742
23749
|
disabled = _ref7.disabled,
|
|
23743
23750
|
themeValues = _ref7.themeValues;
|
|
23744
|
-
return selected ? themeValues.
|
|
23751
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23752
|
+
}, function (_ref8) {
|
|
23753
|
+
var selected = _ref8.selected,
|
|
23754
|
+
disabled = _ref8.disabled,
|
|
23755
|
+
themeValues = _ref8.themeValues;
|
|
23756
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23757
|
+
}, function (_ref9) {
|
|
23758
|
+
var themeValues = _ref9.themeValues;
|
|
23759
|
+
return themeValues.selectedColor;
|
|
23760
|
+
}, function (_ref10) {
|
|
23761
|
+
var selected = _ref10.selected,
|
|
23762
|
+
disabled = _ref10.disabled,
|
|
23763
|
+
themeValues = _ref10.themeValues;
|
|
23764
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23765
|
+
});
|
|
23766
|
+
var DropdownItemBorder = styled__default.div.withConfig({
|
|
23767
|
+
displayName: "Dropdown__DropdownItemBorder",
|
|
23768
|
+
componentId: "sc-pn6m0h-3"
|
|
23769
|
+
})(["background:", ";border-color:", ";border-width:2px;border-style:solid;padding:12px;"], function (_ref11) {
|
|
23770
|
+
var selected = _ref11.selected,
|
|
23771
|
+
themeValues = _ref11.themeValues;
|
|
23772
|
+
return selected ? themeValues.selectedColor : WHITE;
|
|
23773
|
+
}, function (_ref12) {
|
|
23774
|
+
var selected = _ref12.selected,
|
|
23775
|
+
themeValues = _ref12.themeValues;
|
|
23776
|
+
return selected ? themeValues.selectedColor : WHITE;
|
|
23745
23777
|
});
|
|
23746
23778
|
|
|
23747
|
-
var Dropdown = function Dropdown(
|
|
23748
|
-
var placeholder =
|
|
23749
|
-
options =
|
|
23750
|
-
value =
|
|
23751
|
-
isOpen =
|
|
23752
|
-
isError =
|
|
23753
|
-
onSelect =
|
|
23754
|
-
|
|
23755
|
-
disabledValues =
|
|
23756
|
-
|
|
23757
|
-
_onClick =
|
|
23758
|
-
themeValues =
|
|
23759
|
-
maxHeight =
|
|
23760
|
-
|
|
23761
|
-
widthFitOptions =
|
|
23762
|
-
disabled =
|
|
23763
|
-
|
|
23764
|
-
hasTitles =
|
|
23765
|
-
|
|
23766
|
-
autoEraseTypeAhead =
|
|
23767
|
-
ariaLabelledby =
|
|
23768
|
-
ariaDescribedby =
|
|
23769
|
-
autocompleteValue =
|
|
23770
|
-
|
|
23771
|
-
smoothScroll =
|
|
23772
|
-
|
|
23773
|
-
ariaInvalid =
|
|
23779
|
+
var Dropdown = function Dropdown(_ref13) {
|
|
23780
|
+
var placeholder = _ref13.placeholder,
|
|
23781
|
+
options = _ref13.options,
|
|
23782
|
+
value = _ref13.value,
|
|
23783
|
+
isOpen = _ref13.isOpen,
|
|
23784
|
+
isError = _ref13.isError,
|
|
23785
|
+
onSelect = _ref13.onSelect,
|
|
23786
|
+
_ref13$disabledValues = _ref13.disabledValues,
|
|
23787
|
+
disabledValues = _ref13$disabledValues === void 0 ? [] : _ref13$disabledValues,
|
|
23788
|
+
_ref13$onClick = _ref13.onClick,
|
|
23789
|
+
_onClick = _ref13$onClick === void 0 ? noop : _ref13$onClick,
|
|
23790
|
+
themeValues = _ref13.themeValues,
|
|
23791
|
+
maxHeight = _ref13.maxHeight,
|
|
23792
|
+
_ref13$widthFitOption = _ref13.widthFitOptions,
|
|
23793
|
+
widthFitOptions = _ref13$widthFitOption === void 0 ? false : _ref13$widthFitOption,
|
|
23794
|
+
disabled = _ref13.disabled,
|
|
23795
|
+
_ref13$hasTitles = _ref13.hasTitles,
|
|
23796
|
+
hasTitles = _ref13$hasTitles === void 0 ? false : _ref13$hasTitles,
|
|
23797
|
+
_ref13$autoEraseTypeA = _ref13.autoEraseTypeAhead,
|
|
23798
|
+
autoEraseTypeAhead = _ref13$autoEraseTypeA === void 0 ? true : _ref13$autoEraseTypeA,
|
|
23799
|
+
ariaLabelledby = _ref13.ariaLabelledby,
|
|
23800
|
+
ariaDescribedby = _ref13.ariaDescribedby,
|
|
23801
|
+
autocompleteValue = _ref13.autocompleteValue,
|
|
23802
|
+
_ref13$smoothScroll = _ref13.smoothScroll,
|
|
23803
|
+
smoothScroll = _ref13$smoothScroll === void 0 ? true : _ref13$smoothScroll,
|
|
23804
|
+
_ref13$ariaInvalid = _ref13.ariaInvalid,
|
|
23805
|
+
ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid,
|
|
23806
|
+
_ref13$isRequired = _ref13.isRequired,
|
|
23807
|
+
isRequired = _ref13$isRequired === void 0 ? false : _ref13$isRequired;
|
|
23808
|
+
|
|
23809
|
+
var required = options.required || isRequired;
|
|
23774
23810
|
|
|
23775
23811
|
var _useState = React.useState(""),
|
|
23776
23812
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -24019,7 +24055,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24019
24055
|
"aria-labelledby": ariaLabelledby,
|
|
24020
24056
|
"aria-describedby": ariaDescribedby,
|
|
24021
24057
|
"aria-expanded": isOpen,
|
|
24022
|
-
"aria-required":
|
|
24058
|
+
"aria-required": required,
|
|
24023
24059
|
"aria-invalid": ariaInvalid,
|
|
24024
24060
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24025
24061
|
borderRadius: "2px",
|
|
@@ -24041,7 +24077,6 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24041
24077
|
},
|
|
24042
24078
|
padding: "12px",
|
|
24043
24079
|
placeholder: getSelection(),
|
|
24044
|
-
required: options.required,
|
|
24045
24080
|
role: "combobox",
|
|
24046
24081
|
themeValues: themeValues,
|
|
24047
24082
|
title: hasTitles ? getSelection() : null,
|
|
@@ -24049,6 +24084,9 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24049
24084
|
tabIndex: 0,
|
|
24050
24085
|
value: inputValue,
|
|
24051
24086
|
width: "100%"
|
|
24087
|
+
/* Non-semantic elements need the aria-* version of the attribute */
|
|
24088
|
+
,
|
|
24089
|
+
"aria-disabled": disabledValues.includes(inputValue)
|
|
24052
24090
|
}), /*#__PURE__*/React__default.createElement(IconWrapper, {
|
|
24053
24091
|
open: isOpen,
|
|
24054
24092
|
onClick: _onClick
|
|
@@ -24059,7 +24097,8 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24059
24097
|
widthFitOptions: widthFitOptions,
|
|
24060
24098
|
tabIndex: 0,
|
|
24061
24099
|
role: "listbox",
|
|
24062
|
-
id: "".concat(ariaLabelledby, "_listbox")
|
|
24100
|
+
id: "".concat(ariaLabelledby, "_listbox"),
|
|
24101
|
+
required: required
|
|
24063
24102
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
24064
24103
|
childGap: "0",
|
|
24065
24104
|
as: "ul"
|
|
@@ -24092,11 +24131,15 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24092
24131
|
onFocus: function onFocus() {
|
|
24093
24132
|
return setFocusedRef(optionRefs.current[i]);
|
|
24094
24133
|
}
|
|
24134
|
+
}, /*#__PURE__*/React__default.createElement(DropdownItemBorder, {
|
|
24135
|
+
disabled: disabledValues.includes(choice.value),
|
|
24136
|
+
selected: choice.value === value,
|
|
24137
|
+
themeValues: themeValues
|
|
24095
24138
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
24096
24139
|
variant: "p",
|
|
24097
24140
|
color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
|
|
24098
|
-
extraStyles: "padding-left: 16px;\n
|
|
24099
|
-
}, choice.text));
|
|
24141
|
+
extraStyles: "padding-left: 16px;\n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;")
|
|
24142
|
+
}, choice.text)));
|
|
24100
24143
|
}))) : /*#__PURE__*/React__default.createElement(React.Fragment, null)));
|
|
24101
24144
|
};
|
|
24102
24145
|
|
|
@@ -24205,7 +24248,9 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24205
24248
|
_ref$dataQa = _ref.dataQa,
|
|
24206
24249
|
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
|
|
24207
24250
|
_ref$widthFitOptions = _ref.widthFitOptions,
|
|
24208
|
-
widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions
|
|
24251
|
+
widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions,
|
|
24252
|
+
_ref$isRequired = _ref.isRequired,
|
|
24253
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
24209
24254
|
|
|
24210
24255
|
var _useState = React.useState(false),
|
|
24211
24256
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -24213,6 +24258,17 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24213
24258
|
setOpen = _useState2[1];
|
|
24214
24259
|
|
|
24215
24260
|
var dropdownRef = React.useRef(null);
|
|
24261
|
+
var required = (options === null || options === void 0 ? void 0 : options.required) || isRequired;
|
|
24262
|
+
var labelId = React.useMemo(function () {
|
|
24263
|
+
return function (labelTextWhenNoError) {
|
|
24264
|
+
return createIdFromString(labelTextWhenNoError);
|
|
24265
|
+
};
|
|
24266
|
+
}, [labelTextWhenNoError]);
|
|
24267
|
+
var descriptionId = React.useMemo(function () {
|
|
24268
|
+
return function (field, labelTextWhenNoError) {
|
|
24269
|
+
return field.hasErrors && field.dirty ? labelId(labelTextWhenNoError) + "error-message" : "";
|
|
24270
|
+
};
|
|
24271
|
+
}, [field, labelTextWhenNoError]);
|
|
24216
24272
|
|
|
24217
24273
|
var handleClickAway = function handleClickAway(event) {
|
|
24218
24274
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
@@ -24228,8 +24284,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24228
24284
|
});
|
|
24229
24285
|
return /*#__PURE__*/React__default.createElement(SelectContainer, {
|
|
24230
24286
|
ref: dropdownRef,
|
|
24287
|
+
"aria-role": "group",
|
|
24231
24288
|
disabled: disabled,
|
|
24232
|
-
"aria-disabled": disabled,
|
|
24233
24289
|
"data-qa": dataQa
|
|
24234
24290
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
24235
24291
|
padding: "0",
|
|
@@ -24243,10 +24299,10 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24243
24299
|
color: themeValues.labelColor,
|
|
24244
24300
|
weight: themeValues.fontWeight,
|
|
24245
24301
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
24246
|
-
id:
|
|
24302
|
+
id: labelId(labelTextWhenNoError)
|
|
24247
24303
|
}, labelTextWhenNoError))), /*#__PURE__*/React__default.createElement(Dropdown$1, {
|
|
24248
|
-
ariaLabelledby:
|
|
24249
|
-
ariaDescribedby:
|
|
24304
|
+
ariaLabelledby: labelId(labelTextWhenNoError),
|
|
24305
|
+
ariaDescribedby: descriptionId(field, labelTextWhenNoError),
|
|
24250
24306
|
maxHeight: dropdownMaxHeight,
|
|
24251
24307
|
widthFitOptions: widthFitOptions,
|
|
24252
24308
|
hasTitles: hasTitles,
|
|
@@ -24267,7 +24323,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24267
24323
|
},
|
|
24268
24324
|
disabled: disabled,
|
|
24269
24325
|
autocompleteValue: autocompleteValue,
|
|
24270
|
-
smoothScroll: smoothScroll
|
|
24326
|
+
smoothScroll: smoothScroll,
|
|
24327
|
+
isRequired: required
|
|
24271
24328
|
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
24272
24329
|
direction: "row",
|
|
24273
24330
|
justify: "space-between"
|
|
@@ -25037,7 +25094,9 @@ var CountryDropdown = function CountryDropdown(_ref) {
|
|
|
25037
25094
|
showErrors = _ref.showErrors,
|
|
25038
25095
|
onChange = _ref.onChange,
|
|
25039
25096
|
_ref$dataQa = _ref.dataQa,
|
|
25040
|
-
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa
|
|
25097
|
+
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
|
|
25098
|
+
_ref$isRequired = _ref.isRequired,
|
|
25099
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
25041
25100
|
return /*#__PURE__*/React__default.createElement(FormSelect$1, {
|
|
25042
25101
|
options: options,
|
|
25043
25102
|
field: field,
|
|
@@ -25047,7 +25106,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
|
|
|
25047
25106
|
errorMessages: errorMessages,
|
|
25048
25107
|
showErrors: showErrors,
|
|
25049
25108
|
onChange: onChange,
|
|
25050
|
-
autocompleteValue: "country-name"
|
|
25109
|
+
autocompleteValue: "country-name",
|
|
25110
|
+
isRequired: isRequired
|
|
25051
25111
|
});
|
|
25052
25112
|
};
|
|
25053
25113
|
|
|
@@ -25211,6 +25271,346 @@ var DisplayBox = function DisplayBox(_ref) {
|
|
|
25211
25271
|
|
|
25212
25272
|
var DisplayBox$1 = themeComponent(DisplayBox, "DisplayBox", fallbackValues$i);
|
|
25213
25273
|
|
|
25274
|
+
/*
|
|
25275
|
+
Hook that assigns a click event listener to the main document element
|
|
25276
|
+
Returns a ref to attach to another element (like an icon/button that triggers a popover)
|
|
25277
|
+
If a click event gets captured by the document and the assigned element isn't the target
|
|
25278
|
+
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
25279
|
+
|
|
25280
|
+
See popover component for implementation
|
|
25281
|
+
|
|
25282
|
+
*/
|
|
25283
|
+
|
|
25284
|
+
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
25285
|
+
var ref = React.useRef();
|
|
25286
|
+
React.useEffect(function () {
|
|
25287
|
+
}, [ref]);
|
|
25288
|
+
return ref;
|
|
25289
|
+
};
|
|
25290
|
+
|
|
25291
|
+
/*
|
|
25292
|
+
Hook that takes an ID selector for an element on the screen
|
|
25293
|
+
And optionally values for top position, left position, smooth behavior
|
|
25294
|
+
Finds element on screen and scrolls it to the provided coordinates
|
|
25295
|
+
|
|
25296
|
+
(string, number, number, string, number) => undefined;
|
|
25297
|
+
*/
|
|
25298
|
+
var useScrollTo = function useScrollTo(id) {
|
|
25299
|
+
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
25300
|
+
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
25301
|
+
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
25302
|
+
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
25303
|
+
var scrollItem;
|
|
25304
|
+
|
|
25305
|
+
if (delay) {
|
|
25306
|
+
setTimeout(function () {
|
|
25307
|
+
var _scrollItem;
|
|
25308
|
+
|
|
25309
|
+
scrollItem = document.getElementById(id);
|
|
25310
|
+
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
25311
|
+
top: top,
|
|
25312
|
+
left: left,
|
|
25313
|
+
behavior: behavior
|
|
25314
|
+
});
|
|
25315
|
+
}, delay);
|
|
25316
|
+
} else {
|
|
25317
|
+
var _scrollItem2;
|
|
25318
|
+
|
|
25319
|
+
scrollItem = document.getElementById(id);
|
|
25320
|
+
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
25321
|
+
top: top,
|
|
25322
|
+
left: left,
|
|
25323
|
+
behavior: behavior
|
|
25324
|
+
});
|
|
25325
|
+
}
|
|
25326
|
+
};
|
|
25327
|
+
|
|
25328
|
+
var initialToastState = {
|
|
25329
|
+
isOpen: false,
|
|
25330
|
+
variant: "",
|
|
25331
|
+
message: ""
|
|
25332
|
+
};
|
|
25333
|
+
|
|
25334
|
+
var useToastNotification = function useToastNotification() {
|
|
25335
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
25336
|
+
_ref$timeout = _ref.timeout,
|
|
25337
|
+
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
25338
|
+
|
|
25339
|
+
var _useState = React.useState(initialToastState),
|
|
25340
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25341
|
+
toastState = _useState2[0],
|
|
25342
|
+
setToastState = _useState2[1];
|
|
25343
|
+
|
|
25344
|
+
React.useEffect(function () {
|
|
25345
|
+
if (toastState.isOpen) {
|
|
25346
|
+
setTimeout(function () {
|
|
25347
|
+
setToastState(initialToastState);
|
|
25348
|
+
}, timeout);
|
|
25349
|
+
}
|
|
25350
|
+
}, [timeout, toastState.isOpen]);
|
|
25351
|
+
|
|
25352
|
+
var showToast = function showToast(_ref2) {
|
|
25353
|
+
var message = _ref2.message,
|
|
25354
|
+
variant = _ref2.variant;
|
|
25355
|
+
return setToastState({
|
|
25356
|
+
isOpen: true,
|
|
25357
|
+
variant: variant,
|
|
25358
|
+
message: message
|
|
25359
|
+
});
|
|
25360
|
+
};
|
|
25361
|
+
|
|
25362
|
+
var hideToast = function hideToast() {
|
|
25363
|
+
return setToastState(initialToastState);
|
|
25364
|
+
};
|
|
25365
|
+
|
|
25366
|
+
return {
|
|
25367
|
+
isToastOpen: toastState.isOpen,
|
|
25368
|
+
toastVariant: toastState.variant,
|
|
25369
|
+
toastMessage: toastState.message,
|
|
25370
|
+
showToast: showToast,
|
|
25371
|
+
hideToast: hideToast
|
|
25372
|
+
};
|
|
25373
|
+
};
|
|
25374
|
+
|
|
25375
|
+
|
|
25376
|
+
|
|
25377
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
25378
|
+
__proto__: null,
|
|
25379
|
+
useOutsideClick: useOutsideClickHook,
|
|
25380
|
+
useScrollTo: useScrollTo,
|
|
25381
|
+
useToastNotification: useToastNotification
|
|
25382
|
+
});
|
|
25383
|
+
|
|
25384
|
+
var hoverColor$4 = "#116285";
|
|
25385
|
+
var activeColor$4 = "#0E506D";
|
|
25386
|
+
var popoverTriggerColor = "#15749D";
|
|
25387
|
+
var fallbackValues$j = {
|
|
25388
|
+
hoverColor: hoverColor$4,
|
|
25389
|
+
activeColor: activeColor$4,
|
|
25390
|
+
popoverTriggerColor: popoverTriggerColor
|
|
25391
|
+
};
|
|
25392
|
+
|
|
25393
|
+
var arrowBorder = function arrowBorder(borderColor, direction) {
|
|
25394
|
+
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
|
|
25395
|
+
var angle = "".concat(width, " solid transparent");
|
|
25396
|
+
var straight = "".concat(width, " solid ").concat(borderColor);
|
|
25397
|
+
|
|
25398
|
+
if (direction == "down") {
|
|
25399
|
+
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
|
|
25400
|
+
} else if (direction == "up") {
|
|
25401
|
+
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
|
|
25402
|
+
} else if (direction == "left") {
|
|
25403
|
+
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
|
|
25404
|
+
} else if (direction == "right") {
|
|
25405
|
+
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
|
|
25406
|
+
}
|
|
25407
|
+
};
|
|
25408
|
+
|
|
25409
|
+
var Popover = function Popover(_ref) {
|
|
25410
|
+
var themeValues = _ref.themeValues,
|
|
25411
|
+
_ref$triggerText = _ref.triggerText,
|
|
25412
|
+
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
25413
|
+
_ref$content = _ref.content,
|
|
25414
|
+
content = _ref$content === void 0 ? "" : _ref$content,
|
|
25415
|
+
_ref$hasIcon = _ref.hasIcon,
|
|
25416
|
+
hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
|
|
25417
|
+
Icon = _ref.icon,
|
|
25418
|
+
_ref$iconHelpText = _ref.iconHelpText,
|
|
25419
|
+
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
25420
|
+
_ref$popoverID = _ref.popoverID,
|
|
25421
|
+
popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
|
|
25422
|
+
_ref$popoverFocus = _ref.popoverFocus,
|
|
25423
|
+
popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
|
|
25424
|
+
extraStyles = _ref.extraStyles,
|
|
25425
|
+
textExtraStyles = _ref.textExtraStyles,
|
|
25426
|
+
_ref$minWidth = _ref.minWidth,
|
|
25427
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
25428
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
25429
|
+
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
25430
|
+
_ref$height = _ref.height,
|
|
25431
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
25432
|
+
position = _ref.position,
|
|
25433
|
+
arrowPosition = _ref.arrowPosition,
|
|
25434
|
+
_ref$arrowDirection = _ref.arrowDirection,
|
|
25435
|
+
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
25436
|
+
_ref$transform = _ref.transform,
|
|
25437
|
+
transform = _ref$transform === void 0 ? "none" : _ref$transform,
|
|
25438
|
+
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
25439
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
25440
|
+
backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
|
|
25441
|
+
_ref$borderColor = _ref.borderColor,
|
|
25442
|
+
borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
|
|
25443
|
+
popoverExtraStyles = _ref.popoverExtraStyles;
|
|
25444
|
+
var hoverColor = themeValues.hoverColor,
|
|
25445
|
+
activeColor = themeValues.activeColor,
|
|
25446
|
+
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
25447
|
+
|
|
25448
|
+
var _ref2 = position !== null && position !== void 0 ? position : {},
|
|
25449
|
+
_ref2$top = _ref2.top,
|
|
25450
|
+
top = _ref2$top === void 0 ? "-110px" : _ref2$top,
|
|
25451
|
+
_ref2$right = _ref2.right,
|
|
25452
|
+
right = _ref2$right === void 0 ? "auto" : _ref2$right,
|
|
25453
|
+
_ref2$bottom = _ref2.bottom,
|
|
25454
|
+
bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
|
|
25455
|
+
_ref2$left = _ref2.left,
|
|
25456
|
+
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
25457
|
+
|
|
25458
|
+
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
25459
|
+
_ref3$arrowTop = _ref3.arrowTop,
|
|
25460
|
+
arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
|
|
25461
|
+
_ref3$arrowRight = _ref3.arrowRight,
|
|
25462
|
+
arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
|
|
25463
|
+
_ref3$arrowBottom = _ref3.arrowBottom,
|
|
25464
|
+
arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
|
|
25465
|
+
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
25466
|
+
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
25467
|
+
|
|
25468
|
+
var _useState = React.useState(false),
|
|
25469
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25470
|
+
popoverOpen = _useState2[0],
|
|
25471
|
+
togglePopover = _useState2[1];
|
|
25472
|
+
|
|
25473
|
+
var handleTogglePopover = function handleTogglePopover(popoverState) {
|
|
25474
|
+
if (popoverOpen !== popoverState) {
|
|
25475
|
+
togglePopover(popoverState);
|
|
25476
|
+
}
|
|
25477
|
+
};
|
|
25478
|
+
|
|
25479
|
+
var triggerRef = useOutsideClickHook();
|
|
25480
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
25481
|
+
padding: "0",
|
|
25482
|
+
extraStyles: "position: relative; ".concat(extraStyles)
|
|
25483
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25484
|
+
action: function action() {
|
|
25485
|
+
return noop;
|
|
25486
|
+
},
|
|
25487
|
+
onFocus: function onFocus() {
|
|
25488
|
+
handleTogglePopover(true);
|
|
25489
|
+
},
|
|
25490
|
+
onBlur: function onBlur() {
|
|
25491
|
+
handleTogglePopover(false);
|
|
25492
|
+
},
|
|
25493
|
+
onKeyDown: function onKeyDown(e) {
|
|
25494
|
+
if (e.keyCode === 27) {
|
|
25495
|
+
handleTogglePopover(false);
|
|
25496
|
+
}
|
|
25497
|
+
},
|
|
25498
|
+
onTouchStart: function onTouchStart() {
|
|
25499
|
+
return handleTogglePopover(true);
|
|
25500
|
+
},
|
|
25501
|
+
onTouchEnd: function onTouchEnd() {
|
|
25502
|
+
return handleTogglePopover(false);
|
|
25503
|
+
},
|
|
25504
|
+
onMouseEnter: function onMouseEnter() {
|
|
25505
|
+
return handleTogglePopover(true);
|
|
25506
|
+
},
|
|
25507
|
+
onMouseLeave: function onMouseLeave() {
|
|
25508
|
+
return handleTogglePopover(false);
|
|
25509
|
+
},
|
|
25510
|
+
contentOverride: true,
|
|
25511
|
+
variant: "smallGhost",
|
|
25512
|
+
tabIndex: "0",
|
|
25513
|
+
id: "btnPopover".concat(popoverID),
|
|
25514
|
+
"aria-expanded": popoverOpen,
|
|
25515
|
+
"aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
|
|
25516
|
+
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25517
|
+
"aria-controls": "Disclosed".concat(popoverID),
|
|
25518
|
+
ref: triggerRef,
|
|
25519
|
+
extraStyles: buttonExtraStyles
|
|
25520
|
+
}, hasIcon && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement(Box, {
|
|
25521
|
+
padding: "0",
|
|
25522
|
+
srOnly: true
|
|
25523
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25524
|
+
id: "btnPopover".concat(popoverID, "_info")
|
|
25525
|
+
}, iconHelpText))), !hasIcon && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25526
|
+
color: popoverTriggerColor,
|
|
25527
|
+
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
25528
|
+
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
25529
|
+
background: backgroundColor,
|
|
25530
|
+
borderRadius: "4px",
|
|
25531
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25532
|
+
id: "Disclosed".concat(popoverID),
|
|
25533
|
+
role: "region",
|
|
25534
|
+
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25535
|
+
tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
|
|
25536
|
+
minWidth: minWidth,
|
|
25537
|
+
maxWidth: maxWidth,
|
|
25538
|
+
extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, ";\n transform: ").concat(transform, ";\n ").concat(popoverExtraStyles, ";\n ")
|
|
25539
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, content), /*#__PURE__*/React__default.createElement(Box, {
|
|
25540
|
+
padding: "0",
|
|
25541
|
+
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
|
|
25542
|
+
})));
|
|
25543
|
+
};
|
|
25544
|
+
|
|
25545
|
+
var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
|
|
25546
|
+
|
|
25547
|
+
var DisplayCard = function DisplayCard(_ref) {
|
|
25548
|
+
var title = _ref.title,
|
|
25549
|
+
item = _ref.item,
|
|
25550
|
+
buttonText = _ref.buttonText,
|
|
25551
|
+
buttonAction = _ref.buttonAction,
|
|
25552
|
+
url = _ref.url,
|
|
25553
|
+
_ref$link = _ref.link,
|
|
25554
|
+
link = _ref$link === void 0 ? false : _ref$link,
|
|
25555
|
+
helpText = _ref.helpText,
|
|
25556
|
+
_ref$hasPopover = _ref.hasPopover,
|
|
25557
|
+
hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
|
|
25558
|
+
_ref$popoverTriggerTe = _ref.popoverTriggerText,
|
|
25559
|
+
popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
|
|
25560
|
+
_ref$popoverContent = _ref.popoverContent,
|
|
25561
|
+
popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
|
|
25562
|
+
popoverExtraStyles = _ref.popoverExtraStyles,
|
|
25563
|
+
popoverTextExtraStyles = _ref.popoverTextExtraStyles;
|
|
25564
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
25565
|
+
padding: "0 0 16px"
|
|
25566
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
25567
|
+
childGap: "0rem"
|
|
25568
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25569
|
+
padding: "0 0 8px 0"
|
|
25570
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25571
|
+
justify: "space-between",
|
|
25572
|
+
align: "center",
|
|
25573
|
+
overflow: true
|
|
25574
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
25575
|
+
variant: "pL",
|
|
25576
|
+
color: CHARADE_GREY,
|
|
25577
|
+
extraStyles: "letter-spacing: 0.29px"
|
|
25578
|
+
}, title), hasPopover && /*#__PURE__*/React__default.createElement(Popover$1, {
|
|
25579
|
+
triggerText: popoverTriggerText,
|
|
25580
|
+
content: popoverContent,
|
|
25581
|
+
popoverExtraStyles: popoverExtraStyles,
|
|
25582
|
+
popoverTextExtraStyles: popoverTextExtraStyles
|
|
25583
|
+
}))), /*#__PURE__*/React__default.createElement(Box, {
|
|
25584
|
+
padding: "0"
|
|
25585
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25586
|
+
padding: "24px",
|
|
25587
|
+
borderSize: "1px",
|
|
25588
|
+
borderRadius: "4px",
|
|
25589
|
+
background: WHITE,
|
|
25590
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
25591
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25592
|
+
justify: "space-between",
|
|
25593
|
+
align: "center"
|
|
25594
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25595
|
+
color: CHARADE_GREY
|
|
25596
|
+
}, item), link ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
25597
|
+
text: buttonText,
|
|
25598
|
+
url: url,
|
|
25599
|
+
variant: "smallGhost",
|
|
25600
|
+
dataQa: buttonText,
|
|
25601
|
+
extraStyles: "min-width: 0;"
|
|
25602
|
+
}) : buttonAction ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25603
|
+
text: buttonText,
|
|
25604
|
+
action: buttonAction,
|
|
25605
|
+
variant: "smallGhost",
|
|
25606
|
+
dataQa: buttonText,
|
|
25607
|
+
extraStyles: "min-width: 0;"
|
|
25608
|
+
}) : helpText ? /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25609
|
+
color: STORM_GREY,
|
|
25610
|
+
extraStyles: "font-style: italic;"
|
|
25611
|
+
}, helpText) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
|
|
25612
|
+
};
|
|
25613
|
+
|
|
25214
25614
|
function _extends$2() {
|
|
25215
25615
|
_extends$2 = Object.assign || function (target) {
|
|
25216
25616
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -25489,392 +25889,6 @@ var FormattedInput = function FormattedInput(_ref) {
|
|
|
25489
25889
|
}));
|
|
25490
25890
|
};
|
|
25491
25891
|
|
|
25492
|
-
var formatDelimiter = "_";
|
|
25493
|
-
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
25494
|
-
var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
|
|
25495
|
-
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
25496
|
-
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
25497
|
-
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
25498
|
-
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
25499
|
-
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
25500
|
-
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
25501
|
-
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
25502
|
-
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
25503
|
-
var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
25504
|
-
var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
|
|
25505
|
-
var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
|
|
25506
|
-
var ACTIVE = "ACTIVE";
|
|
25507
|
-
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
25508
|
-
var EXPIRED = "EXPIRED";
|
|
25509
|
-
var textMargin = textAlign === "right" ? "auto" : "0";
|
|
25510
|
-
|
|
25511
|
-
switch (expirationStatus) {
|
|
25512
|
-
case ACTIVE:
|
|
25513
|
-
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25514
|
-
as: as,
|
|
25515
|
-
variant: "pXS",
|
|
25516
|
-
color: ASH_GREY,
|
|
25517
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25518
|
-
}, "Exp Date ", expireDate);
|
|
25519
|
-
|
|
25520
|
-
case EXPIRING_SOON:
|
|
25521
|
-
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25522
|
-
as: as,
|
|
25523
|
-
variant: "pXS",
|
|
25524
|
-
color: FIRE_YELLOW,
|
|
25525
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25526
|
-
}, "Expiring Soon ", expireDate);
|
|
25527
|
-
|
|
25528
|
-
case EXPIRED:
|
|
25529
|
-
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25530
|
-
as: as,
|
|
25531
|
-
variant: "pXS",
|
|
25532
|
-
color: ASH_GREY,
|
|
25533
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25534
|
-
}, "Expired");
|
|
25535
|
-
}
|
|
25536
|
-
};
|
|
25537
|
-
|
|
25538
|
-
var formats = /*#__PURE__*/Object.freeze({
|
|
25539
|
-
__proto__: null,
|
|
25540
|
-
formatDelimiter: formatDelimiter,
|
|
25541
|
-
phoneFormats: phoneFormats,
|
|
25542
|
-
moneyFormats: moneyFormats,
|
|
25543
|
-
expirationDateFormats: expirationDateFormats,
|
|
25544
|
-
zipFormat: zipFormat,
|
|
25545
|
-
creditCardFormat: creditCardFormat,
|
|
25546
|
-
expirationDateFormat: expirationDateFormat,
|
|
25547
|
-
phoneFormat: phoneFormat,
|
|
25548
|
-
moneyFormat: moneyFormat,
|
|
25549
|
-
renderCardStatus: renderCardStatus
|
|
25550
|
-
});
|
|
25551
|
-
|
|
25552
|
-
var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
|
|
25553
|
-
var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
25554
|
-
// Only move focus when "hasErrors" is true
|
|
25555
|
-
// "hasErrors" is managed by container page of form
|
|
25556
|
-
// typically set to "true" on attempted form submission, if errors exist
|
|
25557
|
-
// Reset errors, if provided, resets the error state tracking in order to properly re-run
|
|
25558
|
-
React.useEffect(function () {
|
|
25559
|
-
if (hasErrors) {
|
|
25560
|
-
var _inputsWithErrors$;
|
|
25561
|
-
|
|
25562
|
-
var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
|
|
25563
|
-
inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
|
|
25564
|
-
}
|
|
25565
|
-
|
|
25566
|
-
return function () {
|
|
25567
|
-
return resetHasErrors(false);
|
|
25568
|
-
};
|
|
25569
|
-
});
|
|
25570
|
-
};
|
|
25571
|
-
|
|
25572
|
-
/*
|
|
25573
|
-
Hook that assigns a click event listener to the main document element
|
|
25574
|
-
Returns a ref to attach to another element (like an icon/button that triggers a popover)
|
|
25575
|
-
If a click event gets captured by the document and the assigned element isn't the target
|
|
25576
|
-
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
25577
|
-
|
|
25578
|
-
See popover component for implementation
|
|
25579
|
-
|
|
25580
|
-
*/
|
|
25581
|
-
|
|
25582
|
-
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
25583
|
-
var ref = React.useRef();
|
|
25584
|
-
React.useEffect(function () {
|
|
25585
|
-
}, [ref]);
|
|
25586
|
-
return ref;
|
|
25587
|
-
};
|
|
25588
|
-
|
|
25589
|
-
var initialToastState = {
|
|
25590
|
-
isOpen: false,
|
|
25591
|
-
variant: "",
|
|
25592
|
-
message: ""
|
|
25593
|
-
};
|
|
25594
|
-
|
|
25595
|
-
var useToastNotification = function useToastNotification() {
|
|
25596
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
25597
|
-
_ref$timeout = _ref.timeout,
|
|
25598
|
-
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
25599
|
-
|
|
25600
|
-
var _useState = React.useState(initialToastState),
|
|
25601
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25602
|
-
toastState = _useState2[0],
|
|
25603
|
-
setToastState = _useState2[1];
|
|
25604
|
-
|
|
25605
|
-
React.useEffect(function () {
|
|
25606
|
-
if (toastState.isOpen) {
|
|
25607
|
-
setTimeout(function () {
|
|
25608
|
-
setToastState(initialToastState);
|
|
25609
|
-
}, timeout);
|
|
25610
|
-
}
|
|
25611
|
-
}, [timeout, toastState.isOpen]);
|
|
25612
|
-
|
|
25613
|
-
var showToast = function showToast(_ref2) {
|
|
25614
|
-
var message = _ref2.message,
|
|
25615
|
-
variant = _ref2.variant;
|
|
25616
|
-
return setToastState({
|
|
25617
|
-
isOpen: true,
|
|
25618
|
-
variant: variant,
|
|
25619
|
-
message: message
|
|
25620
|
-
});
|
|
25621
|
-
};
|
|
25622
|
-
|
|
25623
|
-
var hideToast = function hideToast() {
|
|
25624
|
-
return setToastState(initialToastState);
|
|
25625
|
-
};
|
|
25626
|
-
|
|
25627
|
-
return {
|
|
25628
|
-
isToastOpen: toastState.isOpen,
|
|
25629
|
-
toastVariant: toastState.variant,
|
|
25630
|
-
toastMessage: toastState.message,
|
|
25631
|
-
showToast: showToast,
|
|
25632
|
-
hideToast: hideToast
|
|
25633
|
-
};
|
|
25634
|
-
};
|
|
25635
|
-
|
|
25636
|
-
|
|
25637
|
-
|
|
25638
|
-
var index$4 = /*#__PURE__*/Object.freeze({
|
|
25639
|
-
__proto__: null,
|
|
25640
|
-
formats: formats,
|
|
25641
|
-
general: general,
|
|
25642
|
-
theme: themeUtils,
|
|
25643
|
-
useFocusInvalidInput: useFocusInvalidInput,
|
|
25644
|
-
useOutsideClick: useOutsideClickHook,
|
|
25645
|
-
useToastNotification: useToastNotification
|
|
25646
|
-
});
|
|
25647
|
-
|
|
25648
|
-
var hoverColor$4 = "#116285";
|
|
25649
|
-
var activeColor$4 = "#0E506D";
|
|
25650
|
-
var popoverTriggerColor = "#15749D";
|
|
25651
|
-
var fallbackValues$j = {
|
|
25652
|
-
hoverColor: hoverColor$4,
|
|
25653
|
-
activeColor: activeColor$4,
|
|
25654
|
-
popoverTriggerColor: popoverTriggerColor
|
|
25655
|
-
};
|
|
25656
|
-
|
|
25657
|
-
var arrowBorder = function arrowBorder(borderColor, direction) {
|
|
25658
|
-
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
|
|
25659
|
-
var angle = "".concat(width, " solid transparent");
|
|
25660
|
-
var straight = "".concat(width, " solid ").concat(borderColor);
|
|
25661
|
-
|
|
25662
|
-
if (direction == "down") {
|
|
25663
|
-
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
|
|
25664
|
-
} else if (direction == "up") {
|
|
25665
|
-
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
|
|
25666
|
-
} else if (direction == "left") {
|
|
25667
|
-
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
|
|
25668
|
-
} else if (direction == "right") {
|
|
25669
|
-
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
|
|
25670
|
-
}
|
|
25671
|
-
};
|
|
25672
|
-
|
|
25673
|
-
var Popover = function Popover(_ref) {
|
|
25674
|
-
var themeValues = _ref.themeValues,
|
|
25675
|
-
_ref$triggerText = _ref.triggerText,
|
|
25676
|
-
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
25677
|
-
_ref$content = _ref.content,
|
|
25678
|
-
content = _ref$content === void 0 ? "" : _ref$content,
|
|
25679
|
-
_ref$hasIcon = _ref.hasIcon,
|
|
25680
|
-
hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
|
|
25681
|
-
Icon = _ref.icon,
|
|
25682
|
-
_ref$iconHelpText = _ref.iconHelpText,
|
|
25683
|
-
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
25684
|
-
_ref$popoverID = _ref.popoverID,
|
|
25685
|
-
popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
|
|
25686
|
-
_ref$popoverFocus = _ref.popoverFocus,
|
|
25687
|
-
popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
|
|
25688
|
-
extraStyles = _ref.extraStyles,
|
|
25689
|
-
textExtraStyles = _ref.textExtraStyles,
|
|
25690
|
-
_ref$minWidth = _ref.minWidth,
|
|
25691
|
-
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
25692
|
-
_ref$maxWidth = _ref.maxWidth,
|
|
25693
|
-
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
25694
|
-
_ref$height = _ref.height,
|
|
25695
|
-
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
25696
|
-
position = _ref.position,
|
|
25697
|
-
arrowPosition = _ref.arrowPosition,
|
|
25698
|
-
_ref$arrowDirection = _ref.arrowDirection,
|
|
25699
|
-
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
25700
|
-
_ref$transform = _ref.transform,
|
|
25701
|
-
transform = _ref$transform === void 0 ? "none" : _ref$transform,
|
|
25702
|
-
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
25703
|
-
_ref$backgroundColor = _ref.backgroundColor,
|
|
25704
|
-
backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
|
|
25705
|
-
_ref$borderColor = _ref.borderColor,
|
|
25706
|
-
borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
|
|
25707
|
-
popoverExtraStyles = _ref.popoverExtraStyles;
|
|
25708
|
-
var hoverColor = themeValues.hoverColor,
|
|
25709
|
-
activeColor = themeValues.activeColor,
|
|
25710
|
-
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
25711
|
-
|
|
25712
|
-
var _ref2 = position !== null && position !== void 0 ? position : {},
|
|
25713
|
-
_ref2$top = _ref2.top,
|
|
25714
|
-
top = _ref2$top === void 0 ? "-110px" : _ref2$top,
|
|
25715
|
-
_ref2$right = _ref2.right,
|
|
25716
|
-
right = _ref2$right === void 0 ? "auto" : _ref2$right,
|
|
25717
|
-
_ref2$bottom = _ref2.bottom,
|
|
25718
|
-
bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
|
|
25719
|
-
_ref2$left = _ref2.left,
|
|
25720
|
-
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
25721
|
-
|
|
25722
|
-
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
25723
|
-
_ref3$arrowTop = _ref3.arrowTop,
|
|
25724
|
-
arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
|
|
25725
|
-
_ref3$arrowRight = _ref3.arrowRight,
|
|
25726
|
-
arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
|
|
25727
|
-
_ref3$arrowBottom = _ref3.arrowBottom,
|
|
25728
|
-
arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
|
|
25729
|
-
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
25730
|
-
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
25731
|
-
|
|
25732
|
-
var _useState = React.useState(false),
|
|
25733
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25734
|
-
popoverOpen = _useState2[0],
|
|
25735
|
-
togglePopover = _useState2[1];
|
|
25736
|
-
|
|
25737
|
-
var handleTogglePopover = function handleTogglePopover(popoverState) {
|
|
25738
|
-
if (popoverOpen !== popoverState) {
|
|
25739
|
-
togglePopover(popoverState);
|
|
25740
|
-
}
|
|
25741
|
-
};
|
|
25742
|
-
|
|
25743
|
-
var triggerRef = useOutsideClickHook();
|
|
25744
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
25745
|
-
padding: "0",
|
|
25746
|
-
extraStyles: "position: relative; ".concat(extraStyles)
|
|
25747
|
-
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25748
|
-
action: function action() {
|
|
25749
|
-
return noop;
|
|
25750
|
-
},
|
|
25751
|
-
onFocus: function onFocus() {
|
|
25752
|
-
handleTogglePopover(true);
|
|
25753
|
-
},
|
|
25754
|
-
onBlur: function onBlur() {
|
|
25755
|
-
handleTogglePopover(false);
|
|
25756
|
-
},
|
|
25757
|
-
onKeyDown: function onKeyDown(e) {
|
|
25758
|
-
if (e.keyCode === 27) {
|
|
25759
|
-
handleTogglePopover(false);
|
|
25760
|
-
}
|
|
25761
|
-
},
|
|
25762
|
-
onTouchStart: function onTouchStart() {
|
|
25763
|
-
return handleTogglePopover(true);
|
|
25764
|
-
},
|
|
25765
|
-
onTouchEnd: function onTouchEnd() {
|
|
25766
|
-
return handleTogglePopover(false);
|
|
25767
|
-
},
|
|
25768
|
-
onMouseEnter: function onMouseEnter() {
|
|
25769
|
-
return handleTogglePopover(true);
|
|
25770
|
-
},
|
|
25771
|
-
onMouseLeave: function onMouseLeave() {
|
|
25772
|
-
return handleTogglePopover(false);
|
|
25773
|
-
},
|
|
25774
|
-
contentOverride: true,
|
|
25775
|
-
variant: "smallGhost",
|
|
25776
|
-
tabIndex: "0",
|
|
25777
|
-
id: "btnPopover".concat(popoverID),
|
|
25778
|
-
"aria-expanded": popoverOpen,
|
|
25779
|
-
"aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
|
|
25780
|
-
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25781
|
-
"aria-controls": "Disclosed".concat(popoverID),
|
|
25782
|
-
ref: triggerRef,
|
|
25783
|
-
extraStyles: buttonExtraStyles
|
|
25784
|
-
}, hasIcon && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement(Box, {
|
|
25785
|
-
padding: "0",
|
|
25786
|
-
srOnly: true
|
|
25787
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25788
|
-
id: "btnPopover".concat(popoverID, "_info")
|
|
25789
|
-
}, iconHelpText))), !hasIcon && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25790
|
-
color: popoverTriggerColor,
|
|
25791
|
-
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
25792
|
-
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
25793
|
-
background: backgroundColor,
|
|
25794
|
-
borderRadius: "4px",
|
|
25795
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25796
|
-
id: "Disclosed".concat(popoverID),
|
|
25797
|
-
role: "region",
|
|
25798
|
-
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25799
|
-
tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
|
|
25800
|
-
minWidth: minWidth,
|
|
25801
|
-
maxWidth: maxWidth,
|
|
25802
|
-
extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, ";\n transform: ").concat(transform, ";\n ").concat(popoverExtraStyles, ";\n ")
|
|
25803
|
-
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, content), /*#__PURE__*/React__default.createElement(Box, {
|
|
25804
|
-
padding: "0",
|
|
25805
|
-
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
|
|
25806
|
-
})));
|
|
25807
|
-
};
|
|
25808
|
-
|
|
25809
|
-
var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
|
|
25810
|
-
|
|
25811
|
-
var DisplayCard = function DisplayCard(_ref) {
|
|
25812
|
-
var title = _ref.title,
|
|
25813
|
-
item = _ref.item,
|
|
25814
|
-
buttonText = _ref.buttonText,
|
|
25815
|
-
buttonAction = _ref.buttonAction,
|
|
25816
|
-
url = _ref.url,
|
|
25817
|
-
_ref$link = _ref.link,
|
|
25818
|
-
link = _ref$link === void 0 ? false : _ref$link,
|
|
25819
|
-
helpText = _ref.helpText,
|
|
25820
|
-
_ref$hasPopover = _ref.hasPopover,
|
|
25821
|
-
hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
|
|
25822
|
-
_ref$popoverTriggerTe = _ref.popoverTriggerText,
|
|
25823
|
-
popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
|
|
25824
|
-
_ref$popoverContent = _ref.popoverContent,
|
|
25825
|
-
popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
|
|
25826
|
-
popoverExtraStyles = _ref.popoverExtraStyles,
|
|
25827
|
-
popoverTextExtraStyles = _ref.popoverTextExtraStyles;
|
|
25828
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
25829
|
-
padding: "0 0 16px"
|
|
25830
|
-
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
25831
|
-
childGap: "0rem"
|
|
25832
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25833
|
-
padding: "0 0 8px 0"
|
|
25834
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25835
|
-
justify: "space-between",
|
|
25836
|
-
align: "center",
|
|
25837
|
-
overflow: true
|
|
25838
|
-
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
25839
|
-
variant: "pL",
|
|
25840
|
-
color: CHARADE_GREY,
|
|
25841
|
-
extraStyles: "letter-spacing: 0.29px"
|
|
25842
|
-
}, title), hasPopover && /*#__PURE__*/React__default.createElement(Popover$1, {
|
|
25843
|
-
triggerText: popoverTriggerText,
|
|
25844
|
-
content: popoverContent,
|
|
25845
|
-
popoverExtraStyles: popoverExtraStyles,
|
|
25846
|
-
popoverTextExtraStyles: popoverTextExtraStyles
|
|
25847
|
-
}))), /*#__PURE__*/React__default.createElement(Box, {
|
|
25848
|
-
padding: "0"
|
|
25849
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25850
|
-
padding: "24px",
|
|
25851
|
-
borderSize: "1px",
|
|
25852
|
-
borderRadius: "4px",
|
|
25853
|
-
background: WHITE,
|
|
25854
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
25855
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25856
|
-
justify: "space-between",
|
|
25857
|
-
align: "center"
|
|
25858
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25859
|
-
color: CHARADE_GREY
|
|
25860
|
-
}, item), link ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
25861
|
-
text: buttonText,
|
|
25862
|
-
url: url,
|
|
25863
|
-
variant: "smallGhost",
|
|
25864
|
-
dataQa: buttonText,
|
|
25865
|
-
extraStyles: "min-width: 0;"
|
|
25866
|
-
}) : buttonAction ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25867
|
-
text: buttonText,
|
|
25868
|
-
action: buttonAction,
|
|
25869
|
-
variant: "smallGhost",
|
|
25870
|
-
dataQa: buttonText,
|
|
25871
|
-
extraStyles: "min-width: 0;"
|
|
25872
|
-
}) : helpText ? /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25873
|
-
color: STORM_GREY,
|
|
25874
|
-
extraStyles: "font-style: italic;"
|
|
25875
|
-
}, helpText) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
|
|
25876
|
-
};
|
|
25877
|
-
|
|
25878
25892
|
var linkColor$2 = {
|
|
25879
25893
|
"default": "".concat(MATISSE_BLUE),
|
|
25880
25894
|
disabled: "".concat(MATISSE_BLUE)
|
|
@@ -25940,7 +25954,7 @@ var fallbackValues$k = {
|
|
|
25940
25954
|
};
|
|
25941
25955
|
|
|
25942
25956
|
var _excluded$p = ["showErrors", "themeValues"],
|
|
25943
|
-
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa"];
|
|
25957
|
+
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"];
|
|
25944
25958
|
var InputField = styled__default.input.withConfig({
|
|
25945
25959
|
displayName: "FormInput__InputField",
|
|
25946
25960
|
componentId: "sc-l094r1-0"
|
|
@@ -26027,6 +26041,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
26027
26041
|
removeFromValue = _ref15.removeFromValue,
|
|
26028
26042
|
_ref15$dataQa = _ref15.dataQa,
|
|
26029
26043
|
dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
|
|
26044
|
+
_ref15$isRequired = _ref15.isRequired,
|
|
26045
|
+
isRequired = _ref15$isRequired === void 0 ? false : _ref15$isRequired,
|
|
26030
26046
|
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
26031
26047
|
|
|
26032
26048
|
var _useState = React.useState(false),
|
|
@@ -26113,7 +26129,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
26113
26129
|
$customHeight: customHeight,
|
|
26114
26130
|
$extraStyles: extraStyles,
|
|
26115
26131
|
"data-qa": dataQa || labelTextWhenNoError,
|
|
26116
|
-
autoComplete: autocompleteValue
|
|
26132
|
+
autoComplete: autocompleteValue,
|
|
26133
|
+
required: isRequired
|
|
26117
26134
|
}, props)) : /*#__PURE__*/React__default.createElement(InputField, _extends({
|
|
26118
26135
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
26119
26136
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
@@ -26132,7 +26149,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
26132
26149
|
$customHeight: customHeight,
|
|
26133
26150
|
$extraStyles: extraStyles,
|
|
26134
26151
|
"data-qa": dataQa || labelTextWhenNoError,
|
|
26135
|
-
autoComplete: autocompleteValue
|
|
26152
|
+
autoComplete: autocompleteValue,
|
|
26153
|
+
required: isRequired
|
|
26136
26154
|
}, props))), /*#__PURE__*/React__default.createElement(Stack, {
|
|
26137
26155
|
direction: "row",
|
|
26138
26156
|
justify: "space-between",
|
|
@@ -26341,6 +26359,66 @@ var fallbackValues$n = {
|
|
|
26341
26359
|
autopayTextColor: autopayTextColor$1
|
|
26342
26360
|
};
|
|
26343
26361
|
|
|
26362
|
+
var formatDelimiter = "_";
|
|
26363
|
+
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
26364
|
+
var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
|
|
26365
|
+
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
26366
|
+
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
26367
|
+
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
26368
|
+
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
26369
|
+
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
26370
|
+
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
26371
|
+
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
26372
|
+
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
26373
|
+
var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
26374
|
+
var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
|
|
26375
|
+
var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
|
|
26376
|
+
var ACTIVE = "ACTIVE";
|
|
26377
|
+
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
26378
|
+
var EXPIRED = "EXPIRED";
|
|
26379
|
+
var textMargin = textAlign === "right" ? "auto" : "0";
|
|
26380
|
+
|
|
26381
|
+
switch (expirationStatus) {
|
|
26382
|
+
case ACTIVE:
|
|
26383
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26384
|
+
as: as,
|
|
26385
|
+
variant: "pXS",
|
|
26386
|
+
color: ASH_GREY,
|
|
26387
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26388
|
+
}, "Exp Date ", expireDate);
|
|
26389
|
+
|
|
26390
|
+
case EXPIRING_SOON:
|
|
26391
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26392
|
+
as: as,
|
|
26393
|
+
variant: "pXS",
|
|
26394
|
+
color: FIRE_YELLOW,
|
|
26395
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26396
|
+
}, "Expiring Soon ", expireDate);
|
|
26397
|
+
|
|
26398
|
+
case EXPIRED:
|
|
26399
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26400
|
+
as: as,
|
|
26401
|
+
variant: "pXS",
|
|
26402
|
+
color: ASH_GREY,
|
|
26403
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26404
|
+
}, "Expired");
|
|
26405
|
+
}
|
|
26406
|
+
};
|
|
26407
|
+
|
|
26408
|
+
var formats = /*#__PURE__*/Object.freeze({
|
|
26409
|
+
__proto__: null,
|
|
26410
|
+
formatDelimiter: formatDelimiter,
|
|
26411
|
+
phoneFormats: phoneFormats,
|
|
26412
|
+
moneyFormats: moneyFormats,
|
|
26413
|
+
expirationDateFormats: expirationDateFormats,
|
|
26414
|
+
zipFormat: zipFormat,
|
|
26415
|
+
creditCardFormat: creditCardFormat,
|
|
26416
|
+
expirationDateFormat: expirationDateFormat,
|
|
26417
|
+
phoneFormat: phoneFormat,
|
|
26418
|
+
moneyFormat: moneyFormat,
|
|
26419
|
+
renderCardStatus: renderCardStatus
|
|
26420
|
+
});
|
|
26421
|
+
|
|
26344
26422
|
var CreditCardWrapper = styled__default.div.withConfig({
|
|
26345
26423
|
displayName: "FormattedCreditCard__CreditCardWrapper",
|
|
26346
26424
|
componentId: "sc-s0ta5l-0"
|
|
@@ -27205,7 +27283,7 @@ var HiddenRadioInput = styled__default.input.withConfig({
|
|
|
27205
27283
|
var Circle = styled__default.div.withConfig({
|
|
27206
27284
|
displayName: "RadioButtonWithLabel__Circle",
|
|
27207
27285
|
componentId: "sc-1m9whwg-1"
|
|
27208
|
-
})(["flex-shrink:0;margin-right:8px;width:1.5rem;height
|
|
27286
|
+
})(["flex-shrink:0;margin-right:8px;width:1.5rem;height:1.5rem;border:", ";border-radius:50%;box-sizing:border-box;padding:2px;:after{content:\"\";width:100%;height:100%;display:block;background:", ";border-radius:50%;transform:scale(0);}"], function (_ref) {
|
|
27209
27287
|
var inactiveBorderColor = _ref.inactiveBorderColor;
|
|
27210
27288
|
return "1px solid ".concat(inactiveBorderColor);
|
|
27211
27289
|
}, function (_ref2) {
|
|
@@ -27215,12 +27293,12 @@ var Circle = styled__default.div.withConfig({
|
|
|
27215
27293
|
var InputAndLabelContainer = styled__default(Cluster).withConfig({
|
|
27216
27294
|
displayName: "RadioButtonWithLabel__InputAndLabelContainer",
|
|
27217
27295
|
componentId: "sc-1m9whwg-2"
|
|
27218
|
-
})(["overflow:visible;", ":checked + label ", ":after{transform:scale(0.85);transition:transform 0.15s;}", ":checked + label ", "{border:", "}", ":focus + label ", "{
|
|
27296
|
+
})(["overflow:visible;", ":checked + label ", ":after{transform:scale(0.85);transition:transform 0.15s;}", ":checked + label ", "{border:", ";}", ":focus + label ", "{box-shadow:", ";}"], HiddenRadioInput, Circle, HiddenRadioInput, Circle, function (_ref3) {
|
|
27219
27297
|
var activeColor = _ref3.activeColor;
|
|
27220
|
-
return "1px solid "
|
|
27298
|
+
return "1px solid " + activeColor;
|
|
27221
27299
|
}, HiddenRadioInput, Circle, function (_ref4) {
|
|
27222
27300
|
var activeColor = _ref4.activeColor;
|
|
27223
|
-
return "0px 0px 2px 1px "
|
|
27301
|
+
return "0px 0px 2px 1px " + activeColor;
|
|
27224
27302
|
});
|
|
27225
27303
|
|
|
27226
27304
|
var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
@@ -27285,7 +27363,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
|
27285
27363
|
var RadioButtonWithLabel$1 = themeComponent(RadioButtonWithLabel, "RadioButtonWithLabel", fallbackValues$u);
|
|
27286
27364
|
|
|
27287
27365
|
var activeColor$6 = "".concat(MATISSE_BLUE);
|
|
27288
|
-
var inactiveColor = "".concat(
|
|
27366
|
+
var inactiveColor = "".concat(STORM_GREY);
|
|
27289
27367
|
var fallbackValues$v = {
|
|
27290
27368
|
activeColor: activeColor$6,
|
|
27291
27369
|
inactiveColor: inactiveColor
|
|
@@ -27314,23 +27392,27 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27314
27392
|
_ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
|
|
27315
27393
|
ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
|
|
27316
27394
|
_ref2$ariaLabel = _ref2.ariaLabel,
|
|
27317
|
-
ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel
|
|
27395
|
+
ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel,
|
|
27396
|
+
_ref2$required = _ref2.required,
|
|
27397
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
27318
27398
|
var buttonBorder = {
|
|
27319
27399
|
onFocused: {
|
|
27320
27400
|
borderColor: themeValues.activeColor,
|
|
27321
|
-
|
|
27401
|
+
outline: "3px solid ".concat(themeValues.activeColor),
|
|
27402
|
+
outlineOffset: "2px"
|
|
27322
27403
|
},
|
|
27323
27404
|
offFocused: {
|
|
27324
27405
|
borderColor: themeValues.activeColor,
|
|
27325
|
-
|
|
27406
|
+
outline: "3px solid ".concat(themeValues.activeColor),
|
|
27407
|
+
outlineOffset: "2px"
|
|
27326
27408
|
},
|
|
27327
27409
|
on: {
|
|
27328
27410
|
borderColor: themeValues.activeColor,
|
|
27329
|
-
|
|
27411
|
+
outline: "0"
|
|
27330
27412
|
},
|
|
27331
27413
|
off: {
|
|
27332
27414
|
borderColor: themeValues.inactiveColor,
|
|
27333
|
-
|
|
27415
|
+
outline: "0"
|
|
27334
27416
|
}
|
|
27335
27417
|
};
|
|
27336
27418
|
var buttonCenter = {
|
|
@@ -27372,6 +27454,8 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27372
27454
|
type: "radio",
|
|
27373
27455
|
id: "radio-".concat(name),
|
|
27374
27456
|
disabled: disabled,
|
|
27457
|
+
required: required,
|
|
27458
|
+
"aria-required": required,
|
|
27375
27459
|
onClick: toggleRadio,
|
|
27376
27460
|
"aria-describedby": ariaDescribedBy,
|
|
27377
27461
|
tabIndex: "-1"
|
|
@@ -27379,7 +27463,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27379
27463
|
borderWidth: "1px",
|
|
27380
27464
|
borderStyle: "solid",
|
|
27381
27465
|
borderRadius: "12px",
|
|
27382
|
-
margin: "
|
|
27466
|
+
margin: "6px 14px 6px 6px",
|
|
27383
27467
|
height: "24px",
|
|
27384
27468
|
width: "24px",
|
|
27385
27469
|
variants: buttonBorder,
|
|
@@ -38064,7 +38148,9 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
38064
38148
|
field = _ref.field,
|
|
38065
38149
|
fieldActions = _ref.fieldActions,
|
|
38066
38150
|
showErrors = _ref.showErrors,
|
|
38067
|
-
countryCode = _ref.countryCode
|
|
38151
|
+
countryCode = _ref.countryCode,
|
|
38152
|
+
_ref$isRequired = _ref.isRequired,
|
|
38153
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
38068
38154
|
var placeholder = countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
|
|
38069
38155
|
var options = [placeholder].concat(_toConsumableArray(getOptions(countryCode)));
|
|
38070
38156
|
return /*#__PURE__*/React__default.createElement(FormSelect$1, {
|
|
@@ -38074,7 +38160,8 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
38074
38160
|
labelTextWhenNoError: labelTextWhenNoError,
|
|
38075
38161
|
errorMessages: errorMessages,
|
|
38076
38162
|
showErrors: showErrors,
|
|
38077
|
-
autocompleteValue: "address-level1"
|
|
38163
|
+
autocompleteValue: "address-level1",
|
|
38164
|
+
isRequired: isRequired
|
|
38078
38165
|
});
|
|
38079
38166
|
};
|
|
38080
38167
|
|
|
@@ -38698,44 +38785,52 @@ var TableHeading_styled = styled__default.th.withConfig({
|
|
|
38698
38785
|
return extraStyles;
|
|
38699
38786
|
});
|
|
38700
38787
|
|
|
38701
|
-
const validatorToPredicate =
|
|
38702
|
-
|
|
38703
|
-
...rest
|
|
38704
|
-
|
|
38788
|
+
const validatorToPredicate =
|
|
38789
|
+
(validatorFn, emptyCase) =>
|
|
38790
|
+
(value, ...rest) =>
|
|
38791
|
+
value === '' ? emptyCase : validatorFn(value, ...rest);
|
|
38705
38792
|
|
|
38706
38793
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
38707
38794
|
|
|
38795
|
+
function getDefaultExportFromCjs (x) {
|
|
38796
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
38797
|
+
}
|
|
38798
|
+
|
|
38708
38799
|
var dayjs_min = {exports: {}};
|
|
38709
38800
|
|
|
38710
38801
|
(function (module, exports) {
|
|
38711
|
-
!function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date"
|
|
38712
|
-
}(dayjs_min));
|
|
38802
|
+
!function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
38803
|
+
} (dayjs_min));
|
|
38713
38804
|
|
|
38714
|
-
var
|
|
38805
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
38806
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
38715
38807
|
|
|
38716
38808
|
var customParseFormat$1 = {exports: {}};
|
|
38717
38809
|
|
|
38718
38810
|
(function (module, exports) {
|
|
38719
|
-
!function(t
|
|
38720
|
-
}(customParseFormat$1));
|
|
38811
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
|
|
38812
|
+
} (customParseFormat$1));
|
|
38721
38813
|
|
|
38722
|
-
var
|
|
38814
|
+
var customParseFormatExports = customParseFormat$1.exports;
|
|
38815
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
38723
38816
|
|
|
38724
38817
|
var isSameOrBefore$1 = {exports: {}};
|
|
38725
38818
|
|
|
38726
38819
|
(function (module, exports) {
|
|
38727
|
-
!function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
38728
|
-
}(isSameOrBefore$1));
|
|
38820
|
+
!function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
38821
|
+
} (isSameOrBefore$1));
|
|
38729
38822
|
|
|
38730
|
-
var
|
|
38823
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
38824
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
38731
38825
|
|
|
38732
38826
|
var isSameOrAfter$1 = {exports: {}};
|
|
38733
38827
|
|
|
38734
38828
|
(function (module, exports) {
|
|
38735
|
-
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
38736
|
-
}(isSameOrAfter$1));
|
|
38829
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
38830
|
+
} (isSameOrAfter$1));
|
|
38737
38831
|
|
|
38738
|
-
var
|
|
38832
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
38833
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
38739
38834
|
|
|
38740
38835
|
/* eslint-disable no-unused-vars */
|
|
38741
38836
|
|
|
@@ -38751,24 +38846,24 @@ dayjs.extend(isSameOrAfter);
|
|
|
38751
38846
|
|
|
38752
38847
|
let validatorFns = {};
|
|
38753
38848
|
|
|
38754
|
-
const INCLUDED_IN =
|
|
38755
|
-
const INCLUDED_IN_ERROR =
|
|
38849
|
+
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
38850
|
+
const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
|
|
38756
38851
|
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
38757
38852
|
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
38758
38853
|
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
38759
38854
|
|
|
38760
|
-
const REQUIRED =
|
|
38761
|
-
const REQUIRED_ERROR =
|
|
38855
|
+
const REQUIRED = 'validator/REQUIRED';
|
|
38856
|
+
const REQUIRED_ERROR = 'error/REQUIRED';
|
|
38762
38857
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
38763
|
-
validatorFns[REQUIRED] = (value, args, form) => value !==
|
|
38858
|
+
validatorFns[REQUIRED] = (value, args, form) => value !== '';
|
|
38764
38859
|
|
|
38765
|
-
const ONLY_INTEGERS =
|
|
38766
|
-
const ONLY_INTEGERS_ERROR =
|
|
38860
|
+
const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
|
|
38861
|
+
const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
|
|
38767
38862
|
const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
38768
38863
|
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
38769
38864
|
|
|
38770
|
-
const ONLY_NATURALS =
|
|
38771
|
-
const ONLY_NATURALS_ERROR =
|
|
38865
|
+
const ONLY_NATURALS = 'validator/ONLY_NATURALS';
|
|
38866
|
+
const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
|
|
38772
38867
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
38773
38868
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
38774
38869
|
|
|
@@ -38781,8 +38876,8 @@ not tested as validation function
|
|
|
38781
38876
|
to validate exp date instead use combo of:
|
|
38782
38877
|
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
38783
38878
|
*/
|
|
38784
|
-
const ONLY_EXPIRATION_DATE =
|
|
38785
|
-
const ONLY_EXPIRATION_DATE_ERROR =
|
|
38879
|
+
const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
|
|
38880
|
+
const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
|
|
38786
38881
|
const onlyExpirationDate = createValidator(
|
|
38787
38882
|
ONLY_EXPIRATION_DATE,
|
|
38788
38883
|
ONLY_EXPIRATION_DATE_ERROR
|
|
@@ -38790,64 +38885,63 @@ const onlyExpirationDate = createValidator(
|
|
|
38790
38885
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
38791
38886
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
38792
38887
|
|
|
38793
|
-
const NUMBER_LESS_THAN =
|
|
38794
|
-
const NUMBER_LESS_THAN_ERROR =
|
|
38888
|
+
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
38889
|
+
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
38795
38890
|
const numberLessThan = createValidator(
|
|
38796
38891
|
NUMBER_LESS_THAN,
|
|
38797
38892
|
NUMBER_LESS_THAN_ERROR
|
|
38798
38893
|
);
|
|
38799
38894
|
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
38800
|
-
if (value ===
|
|
38895
|
+
if (value === '') {
|
|
38801
38896
|
return true;
|
|
38802
38897
|
}
|
|
38803
38898
|
return Number(value) < args[0];
|
|
38804
38899
|
};
|
|
38805
38900
|
|
|
38806
|
-
const NUMBER_LESS_THAN_OR_EQUAL_TO =
|
|
38807
|
-
"validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
38901
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38808
38902
|
const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
|
|
38809
|
-
|
|
38903
|
+
'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38810
38904
|
const numberLessThanOrEqualTo = createValidator(
|
|
38811
38905
|
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
38812
38906
|
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
38813
38907
|
);
|
|
38814
38908
|
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38815
|
-
if (value ===
|
|
38909
|
+
if (value === '') {
|
|
38816
38910
|
return true;
|
|
38817
38911
|
}
|
|
38818
38912
|
return Number(value) <= args[0];
|
|
38819
38913
|
};
|
|
38820
38914
|
|
|
38821
|
-
const NUMBER_GREATER_THAN =
|
|
38822
|
-
const NUMBER_GREATER_THAN_ERROR =
|
|
38915
|
+
const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
|
|
38916
|
+
const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
|
|
38823
38917
|
const numberGreaterThan = createValidator(
|
|
38824
38918
|
NUMBER_GREATER_THAN,
|
|
38825
38919
|
NUMBER_GREATER_THAN_ERROR
|
|
38826
38920
|
);
|
|
38827
38921
|
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
38828
|
-
if (value ===
|
|
38922
|
+
if (value === '') {
|
|
38829
38923
|
return true;
|
|
38830
38924
|
}
|
|
38831
38925
|
return Number(value) > args[0];
|
|
38832
38926
|
};
|
|
38833
38927
|
|
|
38834
38928
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO =
|
|
38835
|
-
|
|
38929
|
+
'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38836
38930
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
|
|
38837
|
-
|
|
38931
|
+
'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38838
38932
|
const numberGreaterThanOrEqualTo = createValidator(
|
|
38839
38933
|
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
38840
38934
|
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
38841
38935
|
);
|
|
38842
38936
|
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38843
|
-
if (value ===
|
|
38937
|
+
if (value === '') {
|
|
38844
38938
|
return true;
|
|
38845
38939
|
}
|
|
38846
38940
|
return Number(value) >= args[0];
|
|
38847
38941
|
};
|
|
38848
38942
|
|
|
38849
|
-
const MATCHES_FIELD =
|
|
38850
|
-
const MATCHES_FIELD_ERROR$1 =
|
|
38943
|
+
const MATCHES_FIELD = 'validator/MATCHES_FIELD';
|
|
38944
|
+
const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
|
|
38851
38945
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
38852
38946
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
38853
38947
|
const dependentField = form[args[0]];
|
|
@@ -38860,7 +38954,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
|
38860
38954
|
return value === dependentFieldValue;
|
|
38861
38955
|
};
|
|
38862
38956
|
|
|
38863
|
-
const validateWhenErrorMessage = type =>
|
|
38957
|
+
const validateWhenErrorMessage = (type) =>
|
|
38864
38958
|
`${type} was passed to validateWhen, but that validator type does not exist.
|
|
38865
38959
|
Please check that you are only calling validator creator functions exported from
|
|
38866
38960
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -38868,25 +38962,21 @@ const validateWhenErrorMessage = type =>
|
|
|
38868
38962
|
createFormState). Also make sure you aren't passing validateWhen() to validateWhen
|
|
38869
38963
|
as the primary validator.`;
|
|
38870
38964
|
|
|
38871
|
-
const VALIDATE_WHEN =
|
|
38872
|
-
const VALIDATE_WHEN_ERROR =
|
|
38873
|
-
const validateWhen = (
|
|
38874
|
-
dependentValidator,
|
|
38875
|
-
primaryValidator,
|
|
38876
|
-
optionalFieldName
|
|
38877
|
-
) => ({
|
|
38965
|
+
const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
|
|
38966
|
+
const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
|
|
38967
|
+
const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
|
|
38878
38968
|
type: VALIDATE_WHEN,
|
|
38879
38969
|
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
38880
|
-
error: dependentValidator.error
|
|
38970
|
+
error: dependentValidator.error,
|
|
38881
38971
|
});
|
|
38882
38972
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
38883
38973
|
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
38884
38974
|
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
38885
|
-
const dependsOnOtherField = typeof optionalFieldName ===
|
|
38975
|
+
const dependsOnOtherField = typeof optionalFieldName === 'string';
|
|
38886
38976
|
|
|
38887
38977
|
if (
|
|
38888
38978
|
primaryValidator.type === undefined ||
|
|
38889
|
-
typeof validatorFns[primaryValidator.type] !==
|
|
38979
|
+
typeof validatorFns[primaryValidator.type] !== 'function'
|
|
38890
38980
|
) {
|
|
38891
38981
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
38892
38982
|
}
|
|
@@ -38910,26 +39000,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
|
38910
39000
|
);
|
|
38911
39001
|
|
|
38912
39002
|
return primaryPredicatePassed
|
|
38913
|
-
? validatorFns[dependentValidator.type](
|
|
38914
|
-
value,
|
|
38915
|
-
dependentValidator.args,
|
|
38916
|
-
form
|
|
38917
|
-
)
|
|
39003
|
+
? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
|
|
38918
39004
|
: true;
|
|
38919
39005
|
};
|
|
38920
39006
|
|
|
38921
|
-
const validateSumErrorMessage = type =>
|
|
39007
|
+
const validateSumErrorMessage = (type) =>
|
|
38922
39008
|
`${type} was passed to validateSum, but that validator type does not exist.
|
|
38923
39009
|
Please check that you are only calling validator creator functions exported from
|
|
38924
39010
|
redux-freeform in your form config and that you didn't forget to
|
|
38925
39011
|
invoke the validator creator (you cannot pass the functions themselves to
|
|
38926
39012
|
createFormState).`;
|
|
38927
|
-
const VALIDATE_SUM =
|
|
38928
|
-
const VALIDATE_SUM_ERROR =
|
|
39013
|
+
const VALIDATE_SUM = 'validator/VALIDATE_SUM';
|
|
39014
|
+
const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
|
|
38929
39015
|
const validateSum = (validator, fieldNamesArray) => ({
|
|
38930
39016
|
type: VALIDATE_SUM,
|
|
38931
39017
|
args: [validator, fieldNamesArray],
|
|
38932
|
-
error: validator.error
|
|
39018
|
+
error: validator.error,
|
|
38933
39019
|
});
|
|
38934
39020
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
38935
39021
|
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
@@ -38937,7 +39023,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38937
39023
|
|
|
38938
39024
|
if (
|
|
38939
39025
|
validator.type === undefined ||
|
|
38940
|
-
typeof validatorFns[validator.type] !==
|
|
39026
|
+
typeof validatorFns[validator.type] !== 'function'
|
|
38941
39027
|
) {
|
|
38942
39028
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
38943
39029
|
}
|
|
@@ -38958,37 +39044,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38958
39044
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
38959
39045
|
};
|
|
38960
39046
|
|
|
38961
|
-
const HAS_LENGTH =
|
|
38962
|
-
const HAS_LENGTH_ERROR =
|
|
39047
|
+
const HAS_LENGTH = 'validator/HAS_LENGTH';
|
|
39048
|
+
const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
|
|
38963
39049
|
const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
38964
39050
|
validatorFns[HAS_LENGTH] = (value, args, form) => {
|
|
38965
|
-
if (value ===
|
|
39051
|
+
if (value === '') {
|
|
38966
39052
|
return true;
|
|
38967
39053
|
}
|
|
38968
39054
|
const min = args[0];
|
|
38969
39055
|
const max = args[1];
|
|
38970
39056
|
if (max == undefined || min == undefined) {
|
|
38971
39057
|
throw new Error(
|
|
38972
|
-
|
|
39058
|
+
'Max and min need to be defined for hasLength, both or one of them is undefined'
|
|
38973
39059
|
);
|
|
38974
39060
|
}
|
|
38975
39061
|
if (max < min) {
|
|
38976
|
-
throw new Error(
|
|
38977
|
-
"hasLength validator was passed a min greater than the max"
|
|
38978
|
-
);
|
|
39062
|
+
throw new Error('hasLength validator was passed a min greater than the max');
|
|
38979
39063
|
}
|
|
38980
39064
|
const valueLength = value.length;
|
|
38981
39065
|
return max >= valueLength && valueLength >= min;
|
|
38982
39066
|
};
|
|
38983
39067
|
|
|
38984
|
-
const DATE_BEFORE_TODAY =
|
|
38985
|
-
const DATE_BEFORE_TODAY_ERROR =
|
|
39068
|
+
const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
|
|
39069
|
+
const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
|
|
38986
39070
|
const dateBeforeToday = createValidator(
|
|
38987
39071
|
DATE_BEFORE_TODAY,
|
|
38988
39072
|
DATE_BEFORE_TODAY_ERROR
|
|
38989
39073
|
);
|
|
38990
39074
|
validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
38991
|
-
if (value ===
|
|
39075
|
+
if (value === '') {
|
|
38992
39076
|
return true;
|
|
38993
39077
|
}
|
|
38994
39078
|
const dateFormat = args[0];
|
|
@@ -38997,7 +39081,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38997
39081
|
|
|
38998
39082
|
if (dateFormat == undefined || unit == undefined) {
|
|
38999
39083
|
throw new Error(
|
|
39000
|
-
|
|
39084
|
+
'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
|
|
39001
39085
|
);
|
|
39002
39086
|
}
|
|
39003
39087
|
const now = dayjs();
|
|
@@ -39009,14 +39093,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
39009
39093
|
return dateValue.isBefore(now, unit);
|
|
39010
39094
|
};
|
|
39011
39095
|
|
|
39012
|
-
const DATE_AFTER_TODAY =
|
|
39013
|
-
const DATE_AFTER_TODAY_ERROR =
|
|
39096
|
+
const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
|
|
39097
|
+
const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
|
|
39014
39098
|
const dateAfterToday = createValidator(
|
|
39015
39099
|
DATE_AFTER_TODAY,
|
|
39016
39100
|
DATE_AFTER_TODAY_ERROR
|
|
39017
39101
|
);
|
|
39018
39102
|
validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
39019
|
-
if (value ===
|
|
39103
|
+
if (value === '') {
|
|
39020
39104
|
return true;
|
|
39021
39105
|
}
|
|
39022
39106
|
const dateFormat = args[0];
|
|
@@ -39025,7 +39109,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
39025
39109
|
|
|
39026
39110
|
if (dateFormat == undefined || unit == undefined) {
|
|
39027
39111
|
throw new Error(
|
|
39028
|
-
|
|
39112
|
+
'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
|
|
39029
39113
|
);
|
|
39030
39114
|
}
|
|
39031
39115
|
const now = dayjs();
|
|
@@ -39037,14 +39121,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
39037
39121
|
return dateValue.isAfter(now, unit);
|
|
39038
39122
|
};
|
|
39039
39123
|
|
|
39040
|
-
const IS_VALID_MONTH =
|
|
39041
|
-
const IS_VALID_MONTH_ERROR =
|
|
39042
|
-
const isValidMonth = createValidator(
|
|
39043
|
-
IS_VALID_MONTH,
|
|
39044
|
-
IS_VALID_MONTH_ERROR
|
|
39045
|
-
);
|
|
39124
|
+
const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
|
|
39125
|
+
const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
|
|
39126
|
+
const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
|
|
39046
39127
|
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
39047
|
-
if (value ===
|
|
39128
|
+
if (value === '') {
|
|
39048
39129
|
return true;
|
|
39049
39130
|
}
|
|
39050
39131
|
// Function takes one argument representing the character position
|
|
@@ -39054,43 +39135,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
|
39054
39135
|
// Only works with two digit months (01, 02, 03, etc)
|
|
39055
39136
|
const monthStartPosition = parseInt(args[0]);
|
|
39056
39137
|
const monthEndPosition = monthStartPosition + 2;
|
|
39057
|
-
if (monthStartPosition
|
|
39058
|
-
throw new Error(
|
|
39138
|
+
if (isNaN(monthStartPosition)) {
|
|
39139
|
+
throw new Error('Month start position has to be a valid integer string');
|
|
39059
39140
|
}
|
|
39060
39141
|
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
39061
|
-
if (month
|
|
39142
|
+
if (isNaN(month)) {
|
|
39062
39143
|
return false;
|
|
39063
39144
|
}
|
|
39064
39145
|
return month >= 1 && month <= 12;
|
|
39065
39146
|
};
|
|
39066
39147
|
|
|
39067
|
-
const MATCHES_REGEX =
|
|
39068
|
-
const MATCHES_REGEX_ERROR =
|
|
39148
|
+
const MATCHES_REGEX = 'validator/MATCHES_REGEX';
|
|
39149
|
+
const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
|
|
39069
39150
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
39070
39151
|
validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
39071
|
-
if (value ===
|
|
39152
|
+
if (value === '') {
|
|
39072
39153
|
return true;
|
|
39073
39154
|
}
|
|
39074
39155
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
39075
39156
|
};
|
|
39076
39157
|
|
|
39077
39158
|
// based on http://www.brainjar.com/js/validation/
|
|
39078
|
-
const IS_ROUTING_NUMBER =
|
|
39079
|
-
const IS_ROUTING_NUMBER_ERROR =
|
|
39159
|
+
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
39160
|
+
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
39080
39161
|
const isRoutingNumber = createValidator(
|
|
39081
39162
|
IS_ROUTING_NUMBER,
|
|
39082
39163
|
IS_ROUTING_NUMBER_ERROR
|
|
39083
39164
|
);
|
|
39084
39165
|
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
39085
|
-
if (value ===
|
|
39166
|
+
if (value === '') {
|
|
39086
39167
|
return true;
|
|
39087
39168
|
}
|
|
39088
39169
|
if (value.length != 9) {
|
|
39089
39170
|
return false;
|
|
39090
39171
|
}
|
|
39091
39172
|
const sum = value
|
|
39092
|
-
.split(
|
|
39093
|
-
.map(ch => parseInt(ch))
|
|
39173
|
+
.split('')
|
|
39174
|
+
.map((ch) => parseInt(ch))
|
|
39094
39175
|
.reduce((acc, cur, idx) => {
|
|
39095
39176
|
switch (idx % 3) {
|
|
39096
39177
|
case 0:
|
|
@@ -39104,69 +39185,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
|
39104
39185
|
return sum != 0 && sum % 10 == 0;
|
|
39105
39186
|
};
|
|
39106
39187
|
|
|
39107
|
-
const HAS_NUMBER =
|
|
39108
|
-
const HAS_NUMBER_ERROR$1 =
|
|
39188
|
+
const HAS_NUMBER = 'validator/HAS_NUMBER';
|
|
39189
|
+
const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
|
|
39109
39190
|
const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
39110
39191
|
validatorFns[HAS_NUMBER] = (value, args, form) => {
|
|
39111
|
-
if (value ===
|
|
39192
|
+
if (value === '') {
|
|
39112
39193
|
return true;
|
|
39113
39194
|
}
|
|
39114
39195
|
return new RegExp(/[0-9]/).test(value);
|
|
39115
39196
|
};
|
|
39116
39197
|
|
|
39117
|
-
const HAS_LOWERCASE_LETTER =
|
|
39118
|
-
const HAS_LOWERCASE_LETTER_ERROR$1 =
|
|
39198
|
+
const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
|
|
39199
|
+
const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
|
|
39119
39200
|
const hasLowercaseLetter = createValidator(
|
|
39120
39201
|
HAS_LOWERCASE_LETTER,
|
|
39121
39202
|
HAS_LOWERCASE_LETTER_ERROR$1
|
|
39122
39203
|
);
|
|
39123
39204
|
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
39124
|
-
if (value ===
|
|
39205
|
+
if (value === '') {
|
|
39125
39206
|
return true;
|
|
39126
39207
|
}
|
|
39127
39208
|
return new RegExp(/[a-z]/).test(value);
|
|
39128
39209
|
};
|
|
39129
39210
|
|
|
39130
|
-
const HAS_UPPERCASE_LETTER =
|
|
39131
|
-
const HAS_UPPERCASE_LETTER_ERROR$1 =
|
|
39211
|
+
const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
|
|
39212
|
+
const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
|
|
39132
39213
|
const hasUppercaseLetter = createValidator(
|
|
39133
39214
|
HAS_UPPERCASE_LETTER,
|
|
39134
39215
|
HAS_UPPERCASE_LETTER_ERROR$1
|
|
39135
39216
|
);
|
|
39136
39217
|
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
39137
|
-
if (value ===
|
|
39218
|
+
if (value === '') {
|
|
39138
39219
|
return true;
|
|
39139
39220
|
}
|
|
39140
39221
|
return new RegExp(/[A-Z]/).test(value);
|
|
39141
39222
|
};
|
|
39142
39223
|
|
|
39143
|
-
const HAS_SPECIAL_CHARACTER =
|
|
39144
|
-
const HAS_SPECIAL_CHARACTER_ERROR$1 =
|
|
39224
|
+
const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
|
|
39225
|
+
const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
|
|
39145
39226
|
const hasSpecialCharacter = createValidator(
|
|
39146
39227
|
HAS_SPECIAL_CHARACTER,
|
|
39147
39228
|
HAS_SPECIAL_CHARACTER_ERROR$1
|
|
39148
39229
|
);
|
|
39149
39230
|
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
39150
|
-
if (value ===
|
|
39231
|
+
if (value === '') {
|
|
39151
39232
|
return true;
|
|
39152
39233
|
}
|
|
39153
39234
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
39154
39235
|
};
|
|
39155
39236
|
|
|
39156
|
-
const IS_PROBABLY_EMAIL =
|
|
39157
|
-
const IS_PROBABLY_EMAIL_ERROR =
|
|
39237
|
+
const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
|
|
39238
|
+
const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
|
|
39158
39239
|
const isProbablyEmail = createValidator(
|
|
39159
39240
|
IS_PROBABLY_EMAIL,
|
|
39160
39241
|
IS_PROBABLY_EMAIL_ERROR
|
|
39161
39242
|
);
|
|
39162
39243
|
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
39163
|
-
if (value ===
|
|
39244
|
+
if (value === '') {
|
|
39164
39245
|
return true;
|
|
39165
39246
|
}
|
|
39166
39247
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
39167
39248
|
};
|
|
39168
39249
|
|
|
39169
|
-
const runValidatorErrorMessage = type =>
|
|
39250
|
+
const runValidatorErrorMessage = (type) =>
|
|
39170
39251
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
39171
39252
|
Please check that you are only calling validator creator functions exported from
|
|
39172
39253
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -39181,1165 +39262,53 @@ const runValidator = (validator, value, form) => {
|
|
|
39181
39262
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
39182
39263
|
};
|
|
39183
39264
|
|
|
39184
|
-
const
|
|
39265
|
+
const runFormValidators = (fieldName, form, validators) => {
|
|
39185
39266
|
return validators
|
|
39186
|
-
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
39187
|
-
.filter(x => x !== null);
|
|
39267
|
+
.map((v) => runValidator(v, form[fieldName].rawValue, form))
|
|
39268
|
+
.filter((x) => x !== null);
|
|
39188
39269
|
};
|
|
39189
39270
|
|
|
39190
39271
|
const computeConstraints = (fieldName, form) => {
|
|
39191
39272
|
const constraints = form[fieldName].constraints;
|
|
39192
|
-
return
|
|
39273
|
+
return runFormValidators(fieldName, form, constraints);
|
|
39193
39274
|
};
|
|
39194
39275
|
|
|
39195
39276
|
const computeErrors = (fieldName, form) => {
|
|
39196
39277
|
const validators = form[fieldName].validators;
|
|
39197
|
-
return
|
|
39198
|
-
};
|
|
39199
|
-
|
|
39200
|
-
var obj;
|
|
39201
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
|
|
39202
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
39203
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
|
|
39204
|
-
function isDraft(value) {
|
|
39205
|
-
return !!value && !!value[DRAFT_STATE];
|
|
39206
|
-
}
|
|
39207
|
-
function isDraftable(value) {
|
|
39208
|
-
if (!value) { return false; }
|
|
39209
|
-
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
39210
|
-
}
|
|
39211
|
-
function isPlainObject(value) {
|
|
39212
|
-
if (!value || typeof value !== "object") { return false; }
|
|
39213
|
-
if (Array.isArray(value)) { return true; }
|
|
39214
|
-
var proto = Object.getPrototypeOf(value);
|
|
39215
|
-
return !proto || proto === Object.prototype;
|
|
39216
|
-
}
|
|
39217
|
-
var assign = Object.assign || function assign(target, value) {
|
|
39218
|
-
for (var key in value) {
|
|
39219
|
-
if (has$1(value, key)) {
|
|
39220
|
-
target[key] = value[key];
|
|
39221
|
-
}
|
|
39222
|
-
}
|
|
39223
|
-
|
|
39224
|
-
return target;
|
|
39225
|
-
};
|
|
39226
|
-
var ownKeys$2 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : Object.getOwnPropertyNames;
|
|
39227
|
-
function shallowCopy(base, invokeGetters) {
|
|
39228
|
-
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
39229
|
-
|
|
39230
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
39231
|
-
var clone = Object.create(Object.getPrototypeOf(base));
|
|
39232
|
-
ownKeys$2(base).forEach(function (key) {
|
|
39233
|
-
if (key === DRAFT_STATE) {
|
|
39234
|
-
return; // Never copy over draft state.
|
|
39235
|
-
}
|
|
39236
|
-
|
|
39237
|
-
var desc = Object.getOwnPropertyDescriptor(base, key);
|
|
39238
|
-
var value = desc.value;
|
|
39239
|
-
|
|
39240
|
-
if (desc.get) {
|
|
39241
|
-
if (!invokeGetters) {
|
|
39242
|
-
throw new Error("Immer drafts cannot have computed properties");
|
|
39243
|
-
}
|
|
39244
|
-
|
|
39245
|
-
value = desc.get.call(base);
|
|
39246
|
-
}
|
|
39247
|
-
|
|
39248
|
-
if (desc.enumerable) {
|
|
39249
|
-
clone[key] = value;
|
|
39250
|
-
} else {
|
|
39251
|
-
Object.defineProperty(clone, key, {
|
|
39252
|
-
value: value,
|
|
39253
|
-
writable: true,
|
|
39254
|
-
configurable: true
|
|
39255
|
-
});
|
|
39256
|
-
}
|
|
39257
|
-
});
|
|
39258
|
-
return clone;
|
|
39259
|
-
}
|
|
39260
|
-
function each(value, cb) {
|
|
39261
|
-
if (Array.isArray(value)) {
|
|
39262
|
-
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
39263
|
-
} else {
|
|
39264
|
-
ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
39265
|
-
}
|
|
39266
|
-
}
|
|
39267
|
-
function isEnumerable(base, prop) {
|
|
39268
|
-
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
39269
|
-
return !!desc && desc.enumerable;
|
|
39270
|
-
}
|
|
39271
|
-
function has$1(thing, prop) {
|
|
39272
|
-
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
39273
|
-
}
|
|
39274
|
-
function is(x, y) {
|
|
39275
|
-
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
39276
|
-
if (x === y) {
|
|
39277
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
39278
|
-
} else {
|
|
39279
|
-
return x !== x && y !== y;
|
|
39280
|
-
}
|
|
39281
|
-
}
|
|
39282
|
-
function clone(obj) {
|
|
39283
|
-
if (!isDraftable(obj)) { return obj; }
|
|
39284
|
-
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
39285
|
-
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
39286
|
-
|
|
39287
|
-
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
39288
|
-
|
|
39289
|
-
return cloned;
|
|
39290
|
-
}
|
|
39291
|
-
|
|
39292
|
-
/** Each scope represents a `produce` call. */
|
|
39293
|
-
|
|
39294
|
-
var ImmerScope = function ImmerScope(parent) {
|
|
39295
|
-
this.drafts = [];
|
|
39296
|
-
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
39297
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
39298
|
-
|
|
39299
|
-
this.canAutoFreeze = true; // To avoid prototype lookups:
|
|
39300
|
-
|
|
39301
|
-
this.patches = null;
|
|
39302
|
-
};
|
|
39303
|
-
|
|
39304
|
-
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
39305
|
-
if (patchListener) {
|
|
39306
|
-
this.patches = [];
|
|
39307
|
-
this.inversePatches = [];
|
|
39308
|
-
this.patchListener = patchListener;
|
|
39309
|
-
}
|
|
39310
|
-
};
|
|
39311
|
-
|
|
39312
|
-
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
39313
|
-
this.leave();
|
|
39314
|
-
this.drafts.forEach(revoke);
|
|
39315
|
-
this.drafts = null; // Make draft-related methods throw.
|
|
39316
|
-
};
|
|
39317
|
-
|
|
39318
|
-
ImmerScope.prototype.leave = function leave () {
|
|
39319
|
-
if (this === ImmerScope.current) {
|
|
39320
|
-
ImmerScope.current = this.parent;
|
|
39321
|
-
}
|
|
39322
|
-
};
|
|
39323
|
-
ImmerScope.current = null;
|
|
39324
|
-
|
|
39325
|
-
ImmerScope.enter = function () {
|
|
39326
|
-
return this.current = new ImmerScope(this.current);
|
|
39327
|
-
};
|
|
39328
|
-
|
|
39329
|
-
function revoke(draft) {
|
|
39330
|
-
draft[DRAFT_STATE].revoke();
|
|
39331
|
-
}
|
|
39332
|
-
|
|
39333
|
-
// but share them all instead
|
|
39334
|
-
|
|
39335
|
-
var descriptors$1 = {};
|
|
39336
|
-
function willFinalize(scope, result, isReplaced) {
|
|
39337
|
-
scope.drafts.forEach(function (draft) {
|
|
39338
|
-
draft[DRAFT_STATE].finalizing = true;
|
|
39339
|
-
});
|
|
39340
|
-
|
|
39341
|
-
if (!isReplaced) {
|
|
39342
|
-
if (scope.patches) {
|
|
39343
|
-
markChangesRecursively(scope.drafts[0]);
|
|
39344
|
-
} // This is faster when we don't care about which attributes changed.
|
|
39345
|
-
|
|
39346
|
-
|
|
39347
|
-
markChangesSweep(scope.drafts);
|
|
39348
|
-
} // When a child draft is returned, look for changes.
|
|
39349
|
-
else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
|
|
39350
|
-
markChangesSweep(scope.drafts);
|
|
39351
|
-
}
|
|
39352
|
-
}
|
|
39353
|
-
function createProxy(base, parent) {
|
|
39354
|
-
var isArray = Array.isArray(base);
|
|
39355
|
-
var draft = clonePotentialDraft(base);
|
|
39356
|
-
each(draft, function (prop) {
|
|
39357
|
-
proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
|
|
39358
|
-
}); // See "proxy.js" for property documentation.
|
|
39359
|
-
|
|
39360
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39361
|
-
var state = {
|
|
39362
|
-
scope: scope,
|
|
39363
|
-
modified: false,
|
|
39364
|
-
finalizing: false,
|
|
39365
|
-
// es5 only
|
|
39366
|
-
finalized: false,
|
|
39367
|
-
assigned: {},
|
|
39368
|
-
parent: parent,
|
|
39369
|
-
base: base,
|
|
39370
|
-
draft: draft,
|
|
39371
|
-
copy: null,
|
|
39372
|
-
revoke: revoke$1,
|
|
39373
|
-
revoked: false // es5 only
|
|
39374
|
-
|
|
39375
|
-
};
|
|
39376
|
-
createHiddenProperty(draft, DRAFT_STATE, state);
|
|
39377
|
-
scope.drafts.push(draft);
|
|
39378
|
-
return draft;
|
|
39379
|
-
}
|
|
39380
|
-
|
|
39381
|
-
function revoke$1() {
|
|
39382
|
-
this.revoked = true;
|
|
39383
|
-
}
|
|
39384
|
-
|
|
39385
|
-
function source(state) {
|
|
39386
|
-
return state.copy || state.base;
|
|
39387
|
-
} // Access a property without creating an Immer draft.
|
|
39388
|
-
|
|
39389
|
-
|
|
39390
|
-
function peek(draft, prop) {
|
|
39391
|
-
var state = draft[DRAFT_STATE];
|
|
39392
|
-
|
|
39393
|
-
if (state && !state.finalizing) {
|
|
39394
|
-
state.finalizing = true;
|
|
39395
|
-
var value = draft[prop];
|
|
39396
|
-
state.finalizing = false;
|
|
39397
|
-
return value;
|
|
39398
|
-
}
|
|
39399
|
-
|
|
39400
|
-
return draft[prop];
|
|
39401
|
-
}
|
|
39402
|
-
|
|
39403
|
-
function get$1(state, prop) {
|
|
39404
|
-
assertUnrevoked(state);
|
|
39405
|
-
var value = peek(source(state), prop);
|
|
39406
|
-
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
39407
|
-
|
|
39408
|
-
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
39409
|
-
prepareCopy(state);
|
|
39410
|
-
return state.copy[prop] = createProxy(value, state);
|
|
39411
|
-
}
|
|
39412
|
-
|
|
39413
|
-
return value;
|
|
39414
|
-
}
|
|
39415
|
-
|
|
39416
|
-
function set$1(state, prop, value) {
|
|
39417
|
-
assertUnrevoked(state);
|
|
39418
|
-
state.assigned[prop] = true;
|
|
39419
|
-
|
|
39420
|
-
if (!state.modified) {
|
|
39421
|
-
if (is(value, peek(source(state), prop))) { return; }
|
|
39422
|
-
markChanged(state);
|
|
39423
|
-
prepareCopy(state);
|
|
39424
|
-
}
|
|
39425
|
-
|
|
39426
|
-
state.copy[prop] = value;
|
|
39427
|
-
}
|
|
39428
|
-
|
|
39429
|
-
function markChanged(state) {
|
|
39430
|
-
if (!state.modified) {
|
|
39431
|
-
state.modified = true;
|
|
39432
|
-
if (state.parent) { markChanged(state.parent); }
|
|
39433
|
-
}
|
|
39434
|
-
}
|
|
39435
|
-
|
|
39436
|
-
function prepareCopy(state) {
|
|
39437
|
-
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
39438
|
-
}
|
|
39439
|
-
|
|
39440
|
-
function clonePotentialDraft(base) {
|
|
39441
|
-
var state = base && base[DRAFT_STATE];
|
|
39442
|
-
|
|
39443
|
-
if (state) {
|
|
39444
|
-
state.finalizing = true;
|
|
39445
|
-
var draft = shallowCopy(state.draft, true);
|
|
39446
|
-
state.finalizing = false;
|
|
39447
|
-
return draft;
|
|
39448
|
-
}
|
|
39449
|
-
|
|
39450
|
-
return shallowCopy(base);
|
|
39451
|
-
}
|
|
39452
|
-
|
|
39453
|
-
function proxyProperty(draft, prop, enumerable) {
|
|
39454
|
-
var desc = descriptors$1[prop];
|
|
39455
|
-
|
|
39456
|
-
if (desc) {
|
|
39457
|
-
desc.enumerable = enumerable;
|
|
39458
|
-
} else {
|
|
39459
|
-
descriptors$1[prop] = desc = {
|
|
39460
|
-
configurable: true,
|
|
39461
|
-
enumerable: enumerable,
|
|
39462
|
-
|
|
39463
|
-
get: function get$1$1() {
|
|
39464
|
-
return get$1(this[DRAFT_STATE], prop);
|
|
39465
|
-
},
|
|
39466
|
-
|
|
39467
|
-
set: function set$1$1(value) {
|
|
39468
|
-
set$1(this[DRAFT_STATE], prop, value);
|
|
39469
|
-
}
|
|
39470
|
-
|
|
39471
|
-
};
|
|
39472
|
-
}
|
|
39473
|
-
|
|
39474
|
-
Object.defineProperty(draft, prop, desc);
|
|
39475
|
-
}
|
|
39476
|
-
|
|
39477
|
-
function assertUnrevoked(state) {
|
|
39478
|
-
if (state.revoked === true) { throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + JSON.stringify(source(state))); }
|
|
39479
|
-
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
39480
|
-
|
|
39481
|
-
|
|
39482
|
-
function markChangesSweep(drafts) {
|
|
39483
|
-
// The natural order of drafts in the `scope` array is based on when they
|
|
39484
|
-
// were accessed. By processing drafts in reverse natural order, we have a
|
|
39485
|
-
// better chance of processing leaf nodes first. When a leaf node is known to
|
|
39486
|
-
// have changed, we can avoid any traversal of its ancestor nodes.
|
|
39487
|
-
for (var i = drafts.length - 1; i >= 0; i--) {
|
|
39488
|
-
var state = drafts[i][DRAFT_STATE];
|
|
39489
|
-
|
|
39490
|
-
if (!state.modified) {
|
|
39491
|
-
if (Array.isArray(state.base)) {
|
|
39492
|
-
if (hasArrayChanges(state)) { markChanged(state); }
|
|
39493
|
-
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
39494
|
-
}
|
|
39495
|
-
}
|
|
39496
|
-
}
|
|
39497
|
-
|
|
39498
|
-
function markChangesRecursively(object) {
|
|
39499
|
-
if (!object || typeof object !== "object") { return; }
|
|
39500
|
-
var state = object[DRAFT_STATE];
|
|
39501
|
-
if (!state) { return; }
|
|
39502
|
-
var base = state.base;
|
|
39503
|
-
var draft = state.draft;
|
|
39504
|
-
var assigned = state.assigned;
|
|
39505
|
-
|
|
39506
|
-
if (!Array.isArray(object)) {
|
|
39507
|
-
// Look for added keys.
|
|
39508
|
-
Object.keys(draft).forEach(function (key) {
|
|
39509
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39510
|
-
if (base[key] === undefined && !has$1(base, key)) {
|
|
39511
|
-
assigned[key] = true;
|
|
39512
|
-
markChanged(state);
|
|
39513
|
-
} else if (!assigned[key]) {
|
|
39514
|
-
// Only untouched properties trigger recursion.
|
|
39515
|
-
markChangesRecursively(draft[key]);
|
|
39516
|
-
}
|
|
39517
|
-
}); // Look for removed keys.
|
|
39518
|
-
|
|
39519
|
-
Object.keys(base).forEach(function (key) {
|
|
39520
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39521
|
-
if (draft[key] === undefined && !has$1(draft, key)) {
|
|
39522
|
-
assigned[key] = false;
|
|
39523
|
-
markChanged(state);
|
|
39524
|
-
}
|
|
39525
|
-
});
|
|
39526
|
-
} else if (hasArrayChanges(state)) {
|
|
39527
|
-
markChanged(state);
|
|
39528
|
-
assigned.length = true;
|
|
39529
|
-
|
|
39530
|
-
if (draft.length < base.length) {
|
|
39531
|
-
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
39532
|
-
} else {
|
|
39533
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
39534
|
-
}
|
|
39535
|
-
|
|
39536
|
-
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
39537
|
-
// Only untouched indices trigger recursion.
|
|
39538
|
-
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
39539
|
-
}
|
|
39540
|
-
}
|
|
39541
|
-
}
|
|
39542
|
-
|
|
39543
|
-
function hasObjectChanges(state) {
|
|
39544
|
-
var base = state.base;
|
|
39545
|
-
var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
|
|
39546
|
-
// non-numeric keys are ordered by time of definition on the object.
|
|
39547
|
-
|
|
39548
|
-
var keys = Object.keys(draft);
|
|
39549
|
-
|
|
39550
|
-
for (var i = keys.length - 1; i >= 0; i--) {
|
|
39551
|
-
var key = keys[i];
|
|
39552
|
-
var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
|
|
39553
|
-
|
|
39554
|
-
if (baseValue === undefined && !has$1(base, key)) {
|
|
39555
|
-
return true;
|
|
39556
|
-
} // Once a base key is deleted, future changes go undetected, because its
|
|
39557
|
-
// descriptor is erased. This branch detects any missed changes.
|
|
39558
|
-
else {
|
|
39559
|
-
var value = draft[key];
|
|
39560
|
-
var state$1 = value && value[DRAFT_STATE];
|
|
39561
|
-
|
|
39562
|
-
if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
|
|
39563
|
-
return true;
|
|
39564
|
-
}
|
|
39565
|
-
}
|
|
39566
|
-
} // At this point, no keys were added or changed.
|
|
39567
|
-
// Compare key count to determine if keys were deleted.
|
|
39568
|
-
|
|
39569
|
-
|
|
39570
|
-
return keys.length !== Object.keys(base).length;
|
|
39571
|
-
}
|
|
39572
|
-
|
|
39573
|
-
function hasArrayChanges(state) {
|
|
39574
|
-
var draft = state.draft;
|
|
39575
|
-
if (draft.length !== state.base.length) { return true; } // See #116
|
|
39576
|
-
// If we first shorten the length, our array interceptors will be removed.
|
|
39577
|
-
// If after that new items are added, result in the same original length,
|
|
39578
|
-
// those last items will have no intercepting property.
|
|
39579
|
-
// So if there is no own descriptor on the last position, we know that items were removed and added
|
|
39580
|
-
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
39581
|
-
// the last one
|
|
39582
|
-
|
|
39583
|
-
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
39584
|
-
|
|
39585
|
-
if (descriptor && !descriptor.get) { return true; } // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
39586
|
-
|
|
39587
|
-
return false;
|
|
39588
|
-
}
|
|
39589
|
-
|
|
39590
|
-
function createHiddenProperty(target, prop, value) {
|
|
39591
|
-
Object.defineProperty(target, prop, {
|
|
39592
|
-
value: value,
|
|
39593
|
-
enumerable: false,
|
|
39594
|
-
writable: true
|
|
39595
|
-
});
|
|
39596
|
-
}
|
|
39597
|
-
|
|
39598
|
-
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
39599
|
-
willFinalize: willFinalize,
|
|
39600
|
-
createProxy: createProxy
|
|
39601
|
-
});
|
|
39602
|
-
|
|
39603
|
-
function willFinalize$1() {}
|
|
39604
|
-
function createProxy$1(base, parent) {
|
|
39605
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39606
|
-
var state = {
|
|
39607
|
-
// Track which produce call this is associated with.
|
|
39608
|
-
scope: scope,
|
|
39609
|
-
// True for both shallow and deep changes.
|
|
39610
|
-
modified: false,
|
|
39611
|
-
// Used during finalization.
|
|
39612
|
-
finalized: false,
|
|
39613
|
-
// Track which properties have been assigned (true) or deleted (false).
|
|
39614
|
-
assigned: {},
|
|
39615
|
-
// The parent draft state.
|
|
39616
|
-
parent: parent,
|
|
39617
|
-
// The base state.
|
|
39618
|
-
base: base,
|
|
39619
|
-
// The base proxy.
|
|
39620
|
-
draft: null,
|
|
39621
|
-
// Any property proxies.
|
|
39622
|
-
drafts: {},
|
|
39623
|
-
// The base copy with any updated values.
|
|
39624
|
-
copy: null,
|
|
39625
|
-
// Called by the `produce` function.
|
|
39626
|
-
revoke: null
|
|
39627
|
-
};
|
|
39628
|
-
var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
|
|
39629
|
-
// although state itself is an object
|
|
39630
|
-
Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
|
|
39631
|
-
var revoke = ref.revoke;
|
|
39632
|
-
var proxy = ref.proxy;
|
|
39633
|
-
state.draft = proxy;
|
|
39634
|
-
state.revoke = revoke;
|
|
39635
|
-
scope.drafts.push(proxy);
|
|
39636
|
-
return proxy;
|
|
39637
|
-
}
|
|
39638
|
-
var objectTraps = {
|
|
39639
|
-
get: get$1$1,
|
|
39640
|
-
|
|
39641
|
-
has: function has(target, prop) {
|
|
39642
|
-
return prop in source$1(target);
|
|
39643
|
-
},
|
|
39644
|
-
|
|
39645
|
-
ownKeys: function ownKeys(target) {
|
|
39646
|
-
return Reflect.ownKeys(source$1(target));
|
|
39647
|
-
},
|
|
39648
|
-
|
|
39649
|
-
set: set$1$1,
|
|
39650
|
-
deleteProperty: deleteProperty,
|
|
39651
|
-
getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
|
|
39652
|
-
|
|
39653
|
-
defineProperty: function defineProperty() {
|
|
39654
|
-
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
39655
|
-
},
|
|
39656
|
-
|
|
39657
|
-
getPrototypeOf: function getPrototypeOf(target) {
|
|
39658
|
-
return Object.getPrototypeOf(target.base);
|
|
39659
|
-
},
|
|
39660
|
-
|
|
39661
|
-
setPrototypeOf: function setPrototypeOf() {
|
|
39662
|
-
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
39663
|
-
}
|
|
39664
|
-
|
|
39665
|
-
};
|
|
39666
|
-
var arrayTraps = {};
|
|
39667
|
-
each(objectTraps, function (key, fn) {
|
|
39668
|
-
arrayTraps[key] = function () {
|
|
39669
|
-
arguments[0] = arguments[0][0];
|
|
39670
|
-
return fn.apply(this, arguments);
|
|
39671
|
-
};
|
|
39672
|
-
});
|
|
39673
|
-
|
|
39674
|
-
arrayTraps.deleteProperty = function (state, prop) {
|
|
39675
|
-
if (isNaN(parseInt(prop))) {
|
|
39676
|
-
throw new Error("Immer only supports deleting array indices"); // prettier-ignore
|
|
39677
|
-
}
|
|
39678
|
-
|
|
39679
|
-
return objectTraps.deleteProperty.call(this, state[0], prop);
|
|
39680
|
-
};
|
|
39681
|
-
|
|
39682
|
-
arrayTraps.set = function (state, prop, value) {
|
|
39683
|
-
if (prop !== "length" && isNaN(parseInt(prop))) {
|
|
39684
|
-
throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
|
|
39685
|
-
}
|
|
39686
|
-
|
|
39687
|
-
return objectTraps.set.call(this, state[0], prop, value);
|
|
39688
|
-
}; // returns the object we should be reading the current value from, which is base, until some change has been made
|
|
39689
|
-
|
|
39690
|
-
|
|
39691
|
-
function source$1(state) {
|
|
39692
|
-
return state.copy || state.base;
|
|
39693
|
-
} // Access a property without creating an Immer draft.
|
|
39694
|
-
|
|
39695
|
-
|
|
39696
|
-
function peek$1(draft, prop) {
|
|
39697
|
-
var state = draft[DRAFT_STATE];
|
|
39698
|
-
var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
|
|
39699
|
-
return desc && desc.value;
|
|
39700
|
-
}
|
|
39701
|
-
|
|
39702
|
-
function get$1$1(state, prop) {
|
|
39703
|
-
if (prop === DRAFT_STATE) { return state; }
|
|
39704
|
-
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
39705
|
-
|
|
39706
|
-
if (!state.modified && has$1(drafts, prop)) {
|
|
39707
|
-
return drafts[prop];
|
|
39708
|
-
}
|
|
39709
|
-
|
|
39710
|
-
var value = source$1(state)[prop];
|
|
39711
|
-
|
|
39712
|
-
if (state.finalized || !isDraftable(value)) {
|
|
39713
|
-
return value;
|
|
39714
|
-
} // Check for existing draft in modified state.
|
|
39715
|
-
|
|
39716
|
-
|
|
39717
|
-
if (state.modified) {
|
|
39718
|
-
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
39719
|
-
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
39720
|
-
|
|
39721
|
-
drafts = state.copy;
|
|
39722
|
-
}
|
|
39723
|
-
|
|
39724
|
-
return drafts[prop] = createProxy$1(value, state);
|
|
39725
|
-
}
|
|
39726
|
-
|
|
39727
|
-
function set$1$1(state, prop, value) {
|
|
39728
|
-
if (!state.modified) {
|
|
39729
|
-
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
39730
|
-
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
39731
|
-
// values may be drafts, but falsy values are never drafts.
|
|
39732
|
-
|
|
39733
|
-
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
39734
|
-
if (isUnchanged) { return true; }
|
|
39735
|
-
markChanged$1(state);
|
|
39736
|
-
}
|
|
39737
|
-
|
|
39738
|
-
state.assigned[prop] = true;
|
|
39739
|
-
state.copy[prop] = value;
|
|
39740
|
-
return true;
|
|
39741
|
-
}
|
|
39742
|
-
|
|
39743
|
-
function deleteProperty(state, prop) {
|
|
39744
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39745
|
-
if (peek$1(state.base, prop) !== undefined || prop in state.base) {
|
|
39746
|
-
state.assigned[prop] = false;
|
|
39747
|
-
markChanged$1(state);
|
|
39748
|
-
} else if (state.assigned[prop]) {
|
|
39749
|
-
// if an originally not assigned property was deleted
|
|
39750
|
-
delete state.assigned[prop];
|
|
39751
|
-
}
|
|
39752
|
-
|
|
39753
|
-
if (state.copy) { delete state.copy[prop]; }
|
|
39754
|
-
return true;
|
|
39755
|
-
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
39756
|
-
// the same guarantee in ES5 mode.
|
|
39757
|
-
|
|
39758
|
-
|
|
39759
|
-
function getOwnPropertyDescriptor$2(state, prop) {
|
|
39760
|
-
var owner = source$1(state);
|
|
39761
|
-
var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
39762
|
-
|
|
39763
|
-
if (desc) {
|
|
39764
|
-
desc.writable = true;
|
|
39765
|
-
desc.configurable = !Array.isArray(owner) || prop !== "length";
|
|
39766
|
-
}
|
|
39767
|
-
|
|
39768
|
-
return desc;
|
|
39769
|
-
}
|
|
39770
|
-
|
|
39771
|
-
function markChanged$1(state) {
|
|
39772
|
-
if (!state.modified) {
|
|
39773
|
-
state.modified = true;
|
|
39774
|
-
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
39775
|
-
state.drafts = null;
|
|
39776
|
-
if (state.parent) { markChanged$1(state.parent); }
|
|
39777
|
-
}
|
|
39778
|
-
}
|
|
39779
|
-
|
|
39780
|
-
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
39781
|
-
willFinalize: willFinalize$1,
|
|
39782
|
-
createProxy: createProxy$1
|
|
39783
|
-
});
|
|
39784
|
-
|
|
39785
|
-
function generatePatches(state, basePath, patches, inversePatches) {
|
|
39786
|
-
Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
|
|
39787
|
-
}
|
|
39788
|
-
|
|
39789
|
-
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
39790
|
-
var assign, assign$1;
|
|
39791
|
-
|
|
39792
|
-
var base = state.base;
|
|
39793
|
-
var copy = state.copy;
|
|
39794
|
-
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
39795
|
-
|
|
39796
|
-
if (copy.length < base.length) {
|
|
39797
|
-
(assign = [copy, base], base = assign[0], copy = assign[1]);
|
|
39798
|
-
(assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
|
|
39799
|
-
}
|
|
39800
|
-
|
|
39801
|
-
var delta = copy.length - base.length; // Find the first replaced index.
|
|
39802
|
-
|
|
39803
|
-
var start = 0;
|
|
39804
|
-
|
|
39805
|
-
while (base[start] === copy[start] && start < base.length) {
|
|
39806
|
-
++start;
|
|
39807
|
-
} // Find the last replaced index. Search from the end to optimize splice patches.
|
|
39808
|
-
|
|
39809
|
-
|
|
39810
|
-
var end = base.length;
|
|
39811
|
-
|
|
39812
|
-
while (end > start && base[end - 1] === copy[end + delta - 1]) {
|
|
39813
|
-
--end;
|
|
39814
|
-
} // Process replaced indices.
|
|
39815
|
-
|
|
39816
|
-
|
|
39817
|
-
for (var i = start; i < end; ++i) {
|
|
39818
|
-
if (assigned[i] && copy[i] !== base[i]) {
|
|
39819
|
-
var path = basePath.concat([i]);
|
|
39820
|
-
patches.push({
|
|
39821
|
-
op: "replace",
|
|
39822
|
-
path: path,
|
|
39823
|
-
value: copy[i]
|
|
39824
|
-
});
|
|
39825
|
-
inversePatches.push({
|
|
39826
|
-
op: "replace",
|
|
39827
|
-
path: path,
|
|
39828
|
-
value: base[i]
|
|
39829
|
-
});
|
|
39830
|
-
}
|
|
39831
|
-
}
|
|
39832
|
-
|
|
39833
|
-
var replaceCount = patches.length; // Process added indices.
|
|
39834
|
-
|
|
39835
|
-
for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
|
|
39836
|
-
var path$1 = basePath.concat([i$1]);
|
|
39837
|
-
patches[replaceCount + i$1 - end] = {
|
|
39838
|
-
op: "add",
|
|
39839
|
-
path: path$1,
|
|
39840
|
-
value: copy[i$1]
|
|
39841
|
-
};
|
|
39842
|
-
inversePatches.push({
|
|
39843
|
-
op: "remove",
|
|
39844
|
-
path: path$1
|
|
39845
|
-
});
|
|
39846
|
-
}
|
|
39847
|
-
}
|
|
39848
|
-
|
|
39849
|
-
function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
39850
|
-
var base = state.base;
|
|
39851
|
-
var copy = state.copy;
|
|
39852
|
-
each(state.assigned, function (key, assignedValue) {
|
|
39853
|
-
var origValue = base[key];
|
|
39854
|
-
var value = copy[key];
|
|
39855
|
-
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
39856
|
-
if (origValue === value && op === "replace") { return; }
|
|
39857
|
-
var path = basePath.concat(key);
|
|
39858
|
-
patches.push(op === "remove" ? {
|
|
39859
|
-
op: op,
|
|
39860
|
-
path: path
|
|
39861
|
-
} : {
|
|
39862
|
-
op: op,
|
|
39863
|
-
path: path,
|
|
39864
|
-
value: value
|
|
39865
|
-
});
|
|
39866
|
-
inversePatches.push(op === "add" ? {
|
|
39867
|
-
op: "remove",
|
|
39868
|
-
path: path
|
|
39869
|
-
} : op === "remove" ? {
|
|
39870
|
-
op: "add",
|
|
39871
|
-
path: path,
|
|
39872
|
-
value: origValue
|
|
39873
|
-
} : {
|
|
39874
|
-
op: "replace",
|
|
39875
|
-
path: path,
|
|
39876
|
-
value: origValue
|
|
39877
|
-
});
|
|
39878
|
-
});
|
|
39879
|
-
}
|
|
39880
|
-
|
|
39881
|
-
var applyPatches = function (draft, patches) {
|
|
39882
|
-
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
39883
|
-
var patch = list[i$1];
|
|
39884
|
-
|
|
39885
|
-
var path = patch.path;
|
|
39886
|
-
var op = patch.op;
|
|
39887
|
-
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
39888
|
-
|
|
39889
|
-
if (!path.length) { throw new Error("Illegal state"); }
|
|
39890
|
-
var base = draft;
|
|
39891
|
-
|
|
39892
|
-
for (var i = 0; i < path.length - 1; i++) {
|
|
39893
|
-
base = base[path[i]];
|
|
39894
|
-
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
39895
|
-
}
|
|
39896
|
-
|
|
39897
|
-
var key = path[path.length - 1];
|
|
39898
|
-
|
|
39899
|
-
switch (op) {
|
|
39900
|
-
case "replace":
|
|
39901
|
-
// if value is an object, then it's assigned by reference
|
|
39902
|
-
// in the following add or remove ops, the value field inside the patch will also be modifyed
|
|
39903
|
-
// so we use value from the cloned patch
|
|
39904
|
-
base[key] = value;
|
|
39905
|
-
break;
|
|
39906
|
-
|
|
39907
|
-
case "add":
|
|
39908
|
-
if (Array.isArray(base)) {
|
|
39909
|
-
// TODO: support "foo/-" paths for appending to an array
|
|
39910
|
-
base.splice(key, 0, value);
|
|
39911
|
-
} else {
|
|
39912
|
-
base[key] = value;
|
|
39913
|
-
}
|
|
39914
|
-
|
|
39915
|
-
break;
|
|
39916
|
-
|
|
39917
|
-
case "remove":
|
|
39918
|
-
if (Array.isArray(base)) {
|
|
39919
|
-
base.splice(key, 1);
|
|
39920
|
-
} else {
|
|
39921
|
-
delete base[key];
|
|
39922
|
-
}
|
|
39923
|
-
|
|
39924
|
-
break;
|
|
39925
|
-
|
|
39926
|
-
default:
|
|
39927
|
-
throw new Error("Unsupported patch operation: " + op);
|
|
39928
|
-
}
|
|
39929
|
-
}
|
|
39930
|
-
|
|
39931
|
-
return draft;
|
|
39278
|
+
return runFormValidators(fieldName, form, validators);
|
|
39932
39279
|
};
|
|
39933
39280
|
|
|
39934
|
-
|
|
39935
|
-
|
|
39936
|
-
|
|
39937
|
-
|
|
39938
|
-
|
|
39939
|
-
|
|
39940
|
-
|
|
39941
|
-
onCopy: null
|
|
39942
|
-
};
|
|
39943
|
-
var Immer = function Immer(config) {
|
|
39944
|
-
assign(this, configDefaults, config);
|
|
39945
|
-
this.setUseProxies(this.useProxies);
|
|
39946
|
-
this.produce = this.produce.bind(this);
|
|
39947
|
-
};
|
|
39948
|
-
|
|
39949
|
-
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
39950
|
-
var this$1$1 = this;
|
|
39951
|
-
|
|
39952
|
-
// curried invocation
|
|
39953
|
-
if (typeof base === "function" && typeof recipe !== "function") {
|
|
39954
|
-
var defaultBase = recipe;
|
|
39955
|
-
recipe = base;
|
|
39956
|
-
var self = this;
|
|
39957
|
-
return function curriedProduce(base) {
|
|
39958
|
-
var this$1$1 = this;
|
|
39959
|
-
if ( base === void 0 ) base = defaultBase;
|
|
39960
|
-
var args = [], len = arguments.length - 1;
|
|
39961
|
-
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
39962
|
-
|
|
39963
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
39964
|
-
};
|
|
39965
|
-
} // prettier-ignore
|
|
39966
|
-
|
|
39967
|
-
|
|
39968
|
-
{
|
|
39969
|
-
if (typeof recipe !== "function") {
|
|
39970
|
-
throw new Error("The first or second argument to `produce` must be a function");
|
|
39971
|
-
}
|
|
39972
|
-
|
|
39973
|
-
if (patchListener !== undefined && typeof patchListener !== "function") {
|
|
39974
|
-
throw new Error("The third argument to `produce` must be a function or undefined");
|
|
39975
|
-
}
|
|
39976
|
-
}
|
|
39977
|
-
var result; // Only plain objects, arrays, and "immerable classes" are drafted.
|
|
39978
|
-
|
|
39979
|
-
if (isDraftable(base)) {
|
|
39980
|
-
var scope = ImmerScope.enter();
|
|
39981
|
-
var proxy = this.createProxy(base);
|
|
39982
|
-
var hasError = true;
|
|
39983
|
-
|
|
39984
|
-
try {
|
|
39985
|
-
result = recipe(proxy);
|
|
39986
|
-
hasError = false;
|
|
39987
|
-
} finally {
|
|
39988
|
-
// finally instead of catch + rethrow better preserves original stack
|
|
39989
|
-
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
39990
|
-
}
|
|
39991
|
-
|
|
39992
|
-
if (result instanceof Promise) {
|
|
39993
|
-
return result.then(function (result) {
|
|
39994
|
-
scope.usePatches(patchListener);
|
|
39995
|
-
return this$1$1.processResult(result, scope);
|
|
39996
|
-
}, function (error) {
|
|
39997
|
-
scope.revoke();
|
|
39998
|
-
throw error;
|
|
39999
|
-
});
|
|
40000
|
-
}
|
|
40001
|
-
|
|
40002
|
-
scope.usePatches(patchListener);
|
|
40003
|
-
return this.processResult(result, scope);
|
|
40004
|
-
} else {
|
|
40005
|
-
result = recipe(base);
|
|
40006
|
-
if (result === undefined) { return base; }
|
|
40007
|
-
return result !== NOTHING ? result : undefined;
|
|
39281
|
+
const computeErrorEntries = (formState) => {
|
|
39282
|
+
const fields = Object.entries(formState);
|
|
39283
|
+
for (let entry of fields) {
|
|
39284
|
+
let fieldName = entry[0];
|
|
39285
|
+
let errors = computeErrors(fieldName, formState);
|
|
39286
|
+
formState[fieldName].errors = errors;
|
|
39287
|
+
formState[fieldName].hasErrors = errors.length > 0;
|
|
40008
39288
|
}
|
|
40009
39289
|
};
|
|
40010
39290
|
|
|
40011
|
-
|
|
40012
|
-
|
|
40013
|
-
|
|
40014
|
-
|
|
40015
|
-
|
|
40016
|
-
|
|
40017
|
-
|
|
40018
|
-
|
|
40019
|
-
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
40020
|
-
};
|
|
40021
|
-
} // non-curried form
|
|
40022
|
-
|
|
40023
|
-
|
|
40024
|
-
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
40025
|
-
var patches, inversePatches;
|
|
40026
|
-
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
40027
|
-
patches = p;
|
|
40028
|
-
inversePatches = ip;
|
|
40029
|
-
});
|
|
40030
|
-
return [nextState, patches, inversePatches];
|
|
40031
|
-
};
|
|
40032
|
-
|
|
40033
|
-
Immer.prototype.createDraft = function createDraft (base) {
|
|
40034
|
-
if (!isDraftable(base)) {
|
|
40035
|
-
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
39291
|
+
const computeDirtyEntries = (formState, changedFieldName) => {
|
|
39292
|
+
const fields = Object.entries(formState);
|
|
39293
|
+
for (let entry of fields) {
|
|
39294
|
+
let fieldName = entry[0];
|
|
39295
|
+
let field = entry[1];
|
|
39296
|
+
let dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
39297
|
+
formState[fieldName].dirty = dirty;
|
|
40036
39298
|
}
|
|
40037
|
-
|
|
40038
|
-
var scope = ImmerScope.enter();
|
|
40039
|
-
var proxy = this.createProxy(base);
|
|
40040
|
-
proxy[DRAFT_STATE].isManual = true;
|
|
40041
|
-
scope.leave();
|
|
40042
|
-
return proxy;
|
|
40043
39299
|
};
|
|
40044
39300
|
|
|
40045
|
-
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
40046
|
-
var state = draft && draft[DRAFT_STATE];
|
|
39301
|
+
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a$1(n,r){return 2===o(n)?n.get(r):n[r]}function f$6(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c$1(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$1(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b$1("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b$1("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b$1("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b$1("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f$6(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b$1("MapSet").F(r,t):v(r)?b$1("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$1("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$1("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a$1(u.t,r)===t||f$6(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c$1(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b$1("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$1("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
|
|
40047
39302
|
|
|
40048
|
-
|
|
40049
|
-
throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
|
|
40050
|
-
}
|
|
40051
|
-
|
|
40052
|
-
if (state.finalized) {
|
|
40053
|
-
throw new Error("The given draft is already finalized"); // prettier-ignore
|
|
40054
|
-
}
|
|
40055
|
-
|
|
40056
|
-
var scope = state.scope;
|
|
40057
|
-
scope.usePatches(patchListener);
|
|
40058
|
-
return this.processResult(undefined, scope);
|
|
40059
|
-
};
|
|
40060
|
-
|
|
40061
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
40062
|
-
this.autoFreeze = value;
|
|
40063
|
-
};
|
|
40064
|
-
|
|
40065
|
-
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
40066
|
-
this.useProxies = value;
|
|
40067
|
-
assign(this, value ? modernProxy : legacyProxy);
|
|
40068
|
-
};
|
|
40069
|
-
|
|
40070
|
-
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
40071
|
-
// If a patch replaces the entire state, take that replacement as base
|
|
40072
|
-
// before applying patches
|
|
40073
|
-
var i;
|
|
40074
|
-
|
|
40075
|
-
for (i = patches.length - 1; i >= 0; i--) {
|
|
40076
|
-
var patch = patches[i];
|
|
40077
|
-
|
|
40078
|
-
if (patch.path.length === 0 && patch.op === "replace") {
|
|
40079
|
-
base = patch.value;
|
|
40080
|
-
break;
|
|
40081
|
-
}
|
|
40082
|
-
}
|
|
40083
|
-
|
|
40084
|
-
if (isDraft(base)) {
|
|
40085
|
-
// N.B: never hits if some patch a replacement, patches are never drafts
|
|
40086
|
-
return applyPatches(base, patches);
|
|
40087
|
-
} // Otherwise, produce a copy of the base state.
|
|
40088
|
-
|
|
40089
|
-
|
|
40090
|
-
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
40091
|
-
};
|
|
40092
|
-
/** @internal */
|
|
40093
|
-
|
|
40094
|
-
|
|
40095
|
-
Immer.prototype.processResult = function processResult (result, scope) {
|
|
40096
|
-
var baseDraft = scope.drafts[0];
|
|
40097
|
-
var isReplaced = result !== undefined && result !== baseDraft;
|
|
40098
|
-
this.willFinalize(scope, result, isReplaced);
|
|
40099
|
-
|
|
40100
|
-
if (isReplaced) {
|
|
40101
|
-
if (baseDraft[DRAFT_STATE].modified) {
|
|
40102
|
-
scope.revoke();
|
|
40103
|
-
throw new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft."); // prettier-ignore
|
|
40104
|
-
}
|
|
40105
|
-
|
|
40106
|
-
if (isDraftable(result)) {
|
|
40107
|
-
// Finalize the result in case it contains (or is) a subset of the draft.
|
|
40108
|
-
result = this.finalize(result, null, scope);
|
|
40109
|
-
}
|
|
40110
|
-
|
|
40111
|
-
if (scope.patches) {
|
|
40112
|
-
scope.patches.push({
|
|
40113
|
-
op: "replace",
|
|
40114
|
-
path: [],
|
|
40115
|
-
value: result
|
|
40116
|
-
});
|
|
40117
|
-
scope.inversePatches.push({
|
|
40118
|
-
op: "replace",
|
|
40119
|
-
path: [],
|
|
40120
|
-
value: baseDraft[DRAFT_STATE].base
|
|
40121
|
-
});
|
|
40122
|
-
}
|
|
40123
|
-
} else {
|
|
40124
|
-
// Finalize the base draft.
|
|
40125
|
-
result = this.finalize(baseDraft, [], scope);
|
|
40126
|
-
}
|
|
40127
|
-
|
|
40128
|
-
scope.revoke();
|
|
40129
|
-
|
|
40130
|
-
if (scope.patches) {
|
|
40131
|
-
scope.patchListener(scope.patches, scope.inversePatches);
|
|
40132
|
-
}
|
|
40133
|
-
|
|
40134
|
-
return result !== NOTHING ? result : undefined;
|
|
40135
|
-
};
|
|
40136
|
-
/**
|
|
40137
|
-
* @internal
|
|
40138
|
-
* Finalize a draft, returning either the unmodified base state or a modified
|
|
40139
|
-
* copy of the base state.
|
|
40140
|
-
*/
|
|
40141
|
-
|
|
40142
|
-
|
|
40143
|
-
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
40144
|
-
var this$1$1 = this;
|
|
40145
|
-
|
|
40146
|
-
var state = draft[DRAFT_STATE];
|
|
40147
|
-
|
|
40148
|
-
if (!state) {
|
|
40149
|
-
if (Object.isFrozen(draft)) { return draft; }
|
|
40150
|
-
return this.finalizeTree(draft, null, scope);
|
|
40151
|
-
} // Never finalize drafts owned by another scope.
|
|
40152
|
-
|
|
40153
|
-
|
|
40154
|
-
if (state.scope !== scope) {
|
|
40155
|
-
return draft;
|
|
40156
|
-
}
|
|
40157
|
-
|
|
40158
|
-
if (!state.modified) {
|
|
40159
|
-
return state.base;
|
|
40160
|
-
}
|
|
40161
|
-
|
|
40162
|
-
if (!state.finalized) {
|
|
40163
|
-
state.finalized = true;
|
|
40164
|
-
this.finalizeTree(state.draft, path, scope);
|
|
40165
|
-
|
|
40166
|
-
if (this.onDelete) {
|
|
40167
|
-
// The `assigned` object is unreliable with ES5 drafts.
|
|
40168
|
-
if (this.useProxies) {
|
|
40169
|
-
var assigned = state.assigned;
|
|
40170
|
-
|
|
40171
|
-
for (var prop in assigned) {
|
|
40172
|
-
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
40173
|
-
}
|
|
40174
|
-
} else {
|
|
40175
|
-
var base = state.base;
|
|
40176
|
-
var copy = state.copy;
|
|
40177
|
-
each(base, function (prop) {
|
|
40178
|
-
if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
40179
|
-
});
|
|
40180
|
-
}
|
|
40181
|
-
}
|
|
40182
|
-
|
|
40183
|
-
if (this.onCopy) {
|
|
40184
|
-
this.onCopy(state);
|
|
40185
|
-
} // At this point, all descendants of `state.copy` have been finalized,
|
|
40186
|
-
// so we can be sure that `scope.canAutoFreeze` is accurate.
|
|
40187
|
-
|
|
40188
|
-
|
|
40189
|
-
if (this.autoFreeze && scope.canAutoFreeze) {
|
|
40190
|
-
Object.freeze(state.copy);
|
|
40191
|
-
}
|
|
40192
|
-
|
|
40193
|
-
if (path && scope.patches) {
|
|
40194
|
-
generatePatches(state, path, scope.patches, scope.inversePatches);
|
|
40195
|
-
}
|
|
40196
|
-
}
|
|
40197
|
-
|
|
40198
|
-
return state.copy;
|
|
40199
|
-
};
|
|
40200
|
-
/**
|
|
40201
|
-
* @internal
|
|
40202
|
-
* Finalize all drafts in the given state tree.
|
|
40203
|
-
*/
|
|
40204
|
-
|
|
40205
|
-
|
|
40206
|
-
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
40207
|
-
var this$1$1 = this;
|
|
40208
|
-
|
|
40209
|
-
var state = root[DRAFT_STATE];
|
|
40210
|
-
|
|
40211
|
-
if (state) {
|
|
40212
|
-
if (!this.useProxies) {
|
|
40213
|
-
// Create the final copy, with added keys and without deleted keys.
|
|
40214
|
-
state.copy = shallowCopy(state.draft, true);
|
|
40215
|
-
}
|
|
40216
|
-
|
|
40217
|
-
root = state.copy;
|
|
40218
|
-
}
|
|
40219
|
-
|
|
40220
|
-
var needPatches = !!rootPath && !!scope.patches;
|
|
40221
|
-
|
|
40222
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
40223
|
-
if (value === parent) {
|
|
40224
|
-
throw Error("Immer forbids circular references");
|
|
40225
|
-
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
40226
|
-
|
|
40227
|
-
|
|
40228
|
-
var isDraftProp = !!state && parent === root;
|
|
40229
|
-
|
|
40230
|
-
if (isDraft(value)) {
|
|
40231
|
-
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
40232
|
-
|
|
40233
|
-
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
40234
|
-
|
|
40235
|
-
if (isDraft(value)) {
|
|
40236
|
-
scope.canAutoFreeze = false;
|
|
40237
|
-
} // Preserve non-enumerable properties.
|
|
40238
|
-
|
|
40239
|
-
|
|
40240
|
-
if (Array.isArray(parent) || isEnumerable(parent, prop)) {
|
|
40241
|
-
parent[prop] = value;
|
|
40242
|
-
} else {
|
|
40243
|
-
Object.defineProperty(parent, prop, {
|
|
40244
|
-
value: value
|
|
40245
|
-
});
|
|
40246
|
-
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
40247
|
-
|
|
40248
|
-
|
|
40249
|
-
if (isDraftProp && value === state.base[prop]) { return; }
|
|
40250
|
-
} // Unchanged draft properties are ignored.
|
|
40251
|
-
else if (isDraftProp && is(value, state.base[prop])) {
|
|
40252
|
-
return;
|
|
40253
|
-
} // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
|
|
40254
|
-
else if (isDraftable(value) && !Object.isFrozen(value)) {
|
|
40255
|
-
each(value, finalizeProperty);
|
|
40256
|
-
}
|
|
40257
|
-
|
|
40258
|
-
if (isDraftProp && this$1$1.onAssign) {
|
|
40259
|
-
this$1$1.onAssign(state, prop, value);
|
|
40260
|
-
}
|
|
40261
|
-
};
|
|
40262
|
-
|
|
40263
|
-
each(root, finalizeProperty);
|
|
40264
|
-
return root;
|
|
40265
|
-
};
|
|
40266
|
-
|
|
40267
|
-
var immer = new Immer();
|
|
40268
|
-
/**
|
|
40269
|
-
* The `produce` function takes a value and a "recipe function" (whose
|
|
40270
|
-
* return value often depends on the base state). The recipe function is
|
|
40271
|
-
* free to mutate its first argument however it wants. All mutations are
|
|
40272
|
-
* only ever applied to a __copy__ of the base state.
|
|
40273
|
-
*
|
|
40274
|
-
* Pass only a function to create a "curried producer" which relieves you
|
|
40275
|
-
* from passing the recipe function every time.
|
|
40276
|
-
*
|
|
40277
|
-
* Only plain objects and arrays are made mutable. All other objects are
|
|
40278
|
-
* considered uncopyable.
|
|
40279
|
-
*
|
|
40280
|
-
* Note: This function is __bound__ to its `Immer` instance.
|
|
40281
|
-
*
|
|
40282
|
-
* @param {any} base - the initial state
|
|
40283
|
-
* @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
40284
|
-
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
40285
|
-
* @returns {any} a new state, or the initial state if nothing was modified
|
|
40286
|
-
*/
|
|
40287
|
-
|
|
40288
|
-
var produce = immer.produce;
|
|
40289
|
-
/**
|
|
40290
|
-
* Like `produce`, but `produceWithPatches` always returns a tuple
|
|
40291
|
-
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
40292
|
-
*/
|
|
40293
|
-
|
|
40294
|
-
immer.produceWithPatches.bind(immer);
|
|
40295
|
-
/**
|
|
40296
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
40297
|
-
*
|
|
40298
|
-
* By default, auto-freezing is disabled in production.
|
|
40299
|
-
*/
|
|
40300
|
-
|
|
40301
|
-
immer.setAutoFreeze.bind(immer);
|
|
40302
|
-
/**
|
|
40303
|
-
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
40304
|
-
* always faster than using ES5 proxies.
|
|
40305
|
-
*
|
|
40306
|
-
* By default, feature detection is used, so calling this is rarely necessary.
|
|
40307
|
-
*/
|
|
40308
|
-
|
|
40309
|
-
immer.setUseProxies.bind(immer);
|
|
40310
|
-
/**
|
|
40311
|
-
* Apply an array of Immer patches to the first argument.
|
|
40312
|
-
*
|
|
40313
|
-
* This function is a producer, which means copy-on-write is in effect.
|
|
40314
|
-
*/
|
|
40315
|
-
|
|
40316
|
-
immer.applyPatches.bind(immer);
|
|
40317
|
-
/**
|
|
40318
|
-
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
40319
|
-
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
40320
|
-
*/
|
|
40321
|
-
|
|
40322
|
-
immer.createDraft.bind(immer);
|
|
40323
|
-
/**
|
|
40324
|
-
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
40325
|
-
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
40326
|
-
* mutated afterwards.
|
|
40327
|
-
*
|
|
40328
|
-
* Pass a function as the 2nd argument to generate Immer patches based on the
|
|
40329
|
-
* changes that were made.
|
|
40330
|
-
*/
|
|
40331
|
-
|
|
40332
|
-
immer.finishDraft.bind(immer);
|
|
40333
|
-
|
|
40334
|
-
const createInitialState = formConfig => {
|
|
39303
|
+
const createInitialState = (formConfig) => {
|
|
40335
39304
|
let initialForm = {};
|
|
40336
39305
|
const formConfigKeys = Object.keys(formConfig);
|
|
40337
39306
|
for (let formKey of formConfigKeys) {
|
|
40338
39307
|
initialForm[formKey] = {
|
|
40339
39308
|
dirty: false,
|
|
40340
|
-
rawValue: formConfig[formKey].defaultValue ||
|
|
39309
|
+
rawValue: formConfig[formKey].defaultValue || '',
|
|
40341
39310
|
validators: formConfig[formKey].validators || [],
|
|
40342
|
-
constraints: formConfig[formKey].constraints || []
|
|
39311
|
+
constraints: formConfig[formKey].constraints || [],
|
|
40343
39312
|
};
|
|
40344
39313
|
}
|
|
40345
39314
|
// Because validators require the entire form we have to do a
|
|
@@ -40350,82 +39319,99 @@ const createInitialState = formConfig => {
|
|
|
40350
39319
|
initialForm[formKey].errors = errors;
|
|
40351
39320
|
initialForm[formKey].hasErrors = errors.length > 0;
|
|
40352
39321
|
}
|
|
39322
|
+
|
|
40353
39323
|
return initialForm;
|
|
40354
39324
|
};
|
|
40355
39325
|
|
|
40356
|
-
const SET =
|
|
40357
|
-
const set$
|
|
39326
|
+
const SET = 'field/SET';
|
|
39327
|
+
const set$1 = (fieldName) => (value) => ({
|
|
40358
39328
|
type: SET,
|
|
40359
|
-
payload: { fieldName, value }
|
|
39329
|
+
payload: { fieldName, value },
|
|
40360
39330
|
});
|
|
40361
39331
|
|
|
40362
|
-
const CLEAR =
|
|
39332
|
+
const CLEAR = 'form/CLEAR';
|
|
40363
39333
|
const clear = () => ({ type: CLEAR });
|
|
40364
39334
|
|
|
40365
|
-
const ADD_VALIDATOR =
|
|
40366
|
-
const addValidator = fieldName => validator => ({
|
|
39335
|
+
const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
|
|
39336
|
+
const addValidator = (fieldName) => (validator) => ({
|
|
40367
39337
|
type: ADD_VALIDATOR,
|
|
40368
|
-
payload: { fieldName, validator }
|
|
39338
|
+
payload: { fieldName, validator },
|
|
40369
39339
|
});
|
|
40370
39340
|
|
|
40371
|
-
const
|
|
40372
|
-
|
|
40373
|
-
|
|
40374
|
-
|
|
40375
|
-
|
|
40376
|
-
case SET:
|
|
40377
|
-
const changedFieldName = action.payload.fieldName;
|
|
40378
|
-
const newRawValue = action.payload.value;
|
|
40379
|
-
|
|
40380
|
-
return produce(state, draftState => {
|
|
40381
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
40382
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
40383
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
40384
|
-
// If the change violates constraints, revert the change
|
|
40385
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
40386
|
-
return draftState;
|
|
40387
|
-
}
|
|
39341
|
+
const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
|
|
39342
|
+
const removeValidator = (fieldName) => (validator) => ({
|
|
39343
|
+
type: REMOVE_VALIDATOR,
|
|
39344
|
+
payload: { fieldName, validator },
|
|
39345
|
+
});
|
|
40388
39346
|
|
|
40389
|
-
|
|
40390
|
-
|
|
40391
|
-
|
|
40392
|
-
|
|
40393
|
-
|
|
40394
|
-
|
|
40395
|
-
|
|
40396
|
-
|
|
40397
|
-
|
|
40398
|
-
|
|
40399
|
-
|
|
40400
|
-
|
|
40401
|
-
|
|
40402
|
-
|
|
40403
|
-
|
|
40404
|
-
|
|
40405
|
-
|
|
40406
|
-
|
|
40407
|
-
|
|
40408
|
-
|
|
40409
|
-
|
|
40410
|
-
|
|
40411
|
-
let field = entry[1];
|
|
40412
|
-
let errors = computeErrors(fieldName, draftState);
|
|
40413
|
-
let dirty = field.dirty;
|
|
40414
|
-
draftState[fieldName].errors = errors;
|
|
40415
|
-
draftState[fieldName].dirty = dirty;
|
|
40416
|
-
draftState[fieldName].hasErrors = errors.length > 0;
|
|
40417
|
-
}
|
|
40418
|
-
});
|
|
40419
|
-
default:
|
|
40420
|
-
return state;
|
|
40421
|
-
}
|
|
40422
|
-
};
|
|
39347
|
+
const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
|
|
39348
|
+
const clearFieldValidators = (fieldName) => () => ({
|
|
39349
|
+
type: CLEAR_FIELD_VALIDATORS,
|
|
39350
|
+
payload: { fieldName },
|
|
39351
|
+
});
|
|
39352
|
+
|
|
39353
|
+
const createFormReducer =
|
|
39354
|
+
(formConfig) =>
|
|
39355
|
+
(state = createInitialState(formConfig), action) => {
|
|
39356
|
+
switch (action.type) {
|
|
39357
|
+
case SET: {
|
|
39358
|
+
const changedFieldName = action.payload.fieldName;
|
|
39359
|
+
const newRawValue = action.payload.value;
|
|
39360
|
+
|
|
39361
|
+
return produce(state, (draftState) => {
|
|
39362
|
+
let originalValue = draftState[changedFieldName].rawValue;
|
|
39363
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
39364
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
39365
|
+
// If the change violates constraints, revert the change
|
|
39366
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
39367
|
+
return draftState;
|
|
39368
|
+
}
|
|
40423
39369
|
|
|
40424
|
-
|
|
39370
|
+
computeDirtyEntries(draftState, changedFieldName);
|
|
39371
|
+
computeErrorEntries(draftState);
|
|
39372
|
+
});
|
|
39373
|
+
}
|
|
39374
|
+
case CLEAR:
|
|
39375
|
+
return createInitialState(formConfig);
|
|
39376
|
+
case ADD_VALIDATOR: {
|
|
39377
|
+
const fieldWithOverride = action.payload.fieldName;
|
|
39378
|
+
const newValidator = action.payload.validator;
|
|
39379
|
+
|
|
39380
|
+
return produce(state, (draftState) => {
|
|
39381
|
+
draftState[fieldWithOverride].validators.push(newValidator);
|
|
39382
|
+
computeErrorEntries(draftState);
|
|
39383
|
+
});
|
|
39384
|
+
}
|
|
39385
|
+
case REMOVE_VALIDATOR: {
|
|
39386
|
+
const fieldToOverride = action.payload.fieldName;
|
|
39387
|
+
const targetValidator = action.payload.validator;
|
|
39388
|
+
|
|
39389
|
+
return produce(state, (draftState) => {
|
|
39390
|
+
let fieldValidators = draftState[fieldToOverride].validators;
|
|
39391
|
+
draftState[fieldToOverride].validators = fieldValidators.filter(
|
|
39392
|
+
(validator) => validator.type !== targetValidator.type
|
|
39393
|
+
);
|
|
39394
|
+
computeErrorEntries(draftState);
|
|
39395
|
+
});
|
|
39396
|
+
}
|
|
39397
|
+
case CLEAR_FIELD_VALIDATORS: {
|
|
39398
|
+
const fieldToClear = action.payload.fieldName;
|
|
39399
|
+
|
|
39400
|
+
return produce(state, (draftState) => {
|
|
39401
|
+
draftState[fieldToClear].validators = [];
|
|
39402
|
+
computeErrorEntries(draftState);
|
|
39403
|
+
});
|
|
39404
|
+
}
|
|
39405
|
+
default:
|
|
39406
|
+
return state;
|
|
39407
|
+
}
|
|
39408
|
+
};
|
|
39409
|
+
|
|
39410
|
+
const createMapDispatchToProps = (formConfig) => {
|
|
40425
39411
|
// Do memo-ization
|
|
40426
39412
|
let cachedDispatch;
|
|
40427
39413
|
let cacheValue;
|
|
40428
|
-
return dispatch => {
|
|
39414
|
+
return (dispatch) => {
|
|
40429
39415
|
if (dispatch == cachedDispatch) {
|
|
40430
39416
|
return cacheValue;
|
|
40431
39417
|
}
|
|
@@ -40434,8 +39420,11 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40434
39420
|
const keys = Object.keys(formConfig);
|
|
40435
39421
|
for (let fieldName of keys) {
|
|
40436
39422
|
dispatchObj.fields[fieldName] = {
|
|
40437
|
-
set: value => dispatch(set$
|
|
40438
|
-
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
39423
|
+
set: (value) => dispatch(set$1(fieldName)(value)),
|
|
39424
|
+
addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
|
|
39425
|
+
removeValidator: (validator) =>
|
|
39426
|
+
dispatch(removeValidator(fieldName)(validator)),
|
|
39427
|
+
clear: () => dispatch(clearFieldValidators(fieldName)()),
|
|
40439
39428
|
};
|
|
40440
39429
|
}
|
|
40441
39430
|
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
@@ -40445,12 +39434,12 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40445
39434
|
};
|
|
40446
39435
|
};
|
|
40447
39436
|
|
|
40448
|
-
const mapStateToProps = state => ({ fields: state });
|
|
39437
|
+
const mapStateToProps = (state) => ({ fields: state });
|
|
40449
39438
|
|
|
40450
|
-
const createFormState = formConfig => ({
|
|
39439
|
+
const createFormState = (formConfig) => ({
|
|
40451
39440
|
reducer: createFormReducer(formConfig),
|
|
40452
39441
|
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
40453
|
-
mapStateToProps: mapStateToProps
|
|
39442
|
+
mapStateToProps: mapStateToProps,
|
|
40454
39443
|
});
|
|
40455
39444
|
|
|
40456
39445
|
var AddressForm = function AddressForm(_ref) {
|
|
@@ -40498,6 +39487,7 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40498
39487
|
labelTextWhenNoError: "Country",
|
|
40499
39488
|
errorMessages: countryErrorMessages,
|
|
40500
39489
|
field: fields.country,
|
|
39490
|
+
isRequired: true,
|
|
40501
39491
|
onChange: function onChange(value) {
|
|
40502
39492
|
actions.fields.country.set(value); // temporary measure to not dirty fields until
|
|
40503
39493
|
// we can write a reset function for fields
|
|
@@ -40522,7 +39512,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40522
39512
|
return e.key === "Enter" && handleSubmit(e);
|
|
40523
39513
|
},
|
|
40524
39514
|
autocompleteValue: "address-line1",
|
|
40525
|
-
dataQa: "Address"
|
|
39515
|
+
dataQa: "Address",
|
|
39516
|
+
isRequired: true
|
|
40526
39517
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
40527
39518
|
labelTextWhenNoError: "Apt, Suite, Unit, Floor, etc. (Optional)",
|
|
40528
39519
|
field: fields.street2,
|
|
@@ -40532,7 +39523,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40532
39523
|
return e.key === "Enter" && handleSubmit(e);
|
|
40533
39524
|
},
|
|
40534
39525
|
autocompleteValue: "address-line2",
|
|
40535
|
-
dataQa: "Address Line 2"
|
|
39526
|
+
dataQa: "Address Line 2",
|
|
39527
|
+
isRequired: false
|
|
40536
39528
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
40537
39529
|
labelTextWhenNoError: "City",
|
|
40538
39530
|
errorMessages: cityErrorMessages,
|
|
@@ -40543,7 +39535,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40543
39535
|
return e.key === "Enter" && handleSubmit(e);
|
|
40544
39536
|
},
|
|
40545
39537
|
autocompleteValue: "address-level2",
|
|
40546
|
-
dataQa: "City"
|
|
39538
|
+
dataQa: "City",
|
|
39539
|
+
isRequired: true
|
|
40547
39540
|
}), /*#__PURE__*/React__default.createElement(FormStateDropdown, {
|
|
40548
39541
|
labelTextWhenNoError: isUS ? "State" : "State or Province",
|
|
40549
39542
|
errorMessages: stateProvinceErrorMessages,
|
|
@@ -40554,7 +39547,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40554
39547
|
onKeyDown: function onKeyDown(e) {
|
|
40555
39548
|
return e.key === "Enter" && handleSubmit(e);
|
|
40556
39549
|
},
|
|
40557
|
-
dataQa: "State or Province"
|
|
39550
|
+
dataQa: "State or Province",
|
|
39551
|
+
isRequired: true
|
|
40558
39552
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
40559
39553
|
isNum: isUS,
|
|
40560
39554
|
formatter: isUS ? zipFormat : null,
|
|
@@ -40567,7 +39561,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40567
39561
|
return e.key === "Enter" && handleSubmit(e);
|
|
40568
39562
|
},
|
|
40569
39563
|
autocompleteValue: "postal-code",
|
|
40570
|
-
dataQa: "Zip code"
|
|
39564
|
+
dataQa: "Zip code",
|
|
39565
|
+
isRequired: true
|
|
40571
39566
|
}), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
40572
39567
|
name: "address checkbox",
|
|
40573
39568
|
title: "Save address to wallet",
|
|
@@ -43315,12 +42310,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
|
|
|
43315
42310
|
* This source code is licensed under the MIT license found in the
|
|
43316
42311
|
* LICENSE file in the root directory of this source tree.
|
|
43317
42312
|
*/
|
|
43318
|
-
var b$
|
|
43319
|
-
Symbol.for("react.suspense_list"):60120,r=b$
|
|
43320
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$
|
|
43321
|
-
var Profiler=g;var StrictMode=f$
|
|
43322
|
-
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f$
|
|
43323
|
-
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$
|
|
42313
|
+
var b$2="function"===typeof Symbol&&Symbol.for,c$2=b$2?Symbol.for("react.element"):60103,d$1=b$2?Symbol.for("react.portal"):60106,e=b$2?Symbol.for("react.fragment"):60107,f$7=b$2?Symbol.for("react.strict_mode"):60108,g$1=b$2?Symbol.for("react.profiler"):60114,h$1=b$2?Symbol.for("react.provider"):60109,k$1=b$2?Symbol.for("react.context"):60110,l$1=b$2?Symbol.for("react.async_mode"):60111,m=b$2?Symbol.for("react.concurrent_mode"):60111,n$1=b$2?Symbol.for("react.forward_ref"):60112,p$1=b$2?Symbol.for("react.suspense"):60113,q$1=b$2?
|
|
42314
|
+
Symbol.for("react.suspense_list"):60120,r$1=b$2?Symbol.for("react.memo"):60115,t$1=b$2?Symbol.for("react.lazy"):60116,v$1=b$2?Symbol.for("react.block"):60121,w$1=b$2?Symbol.for("react.fundamental"):60117,x$1=b$2?Symbol.for("react.responder"):60118,y$1=b$2?Symbol.for("react.scope"):60119;
|
|
42315
|
+
function z$1(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$2:switch(a=a.type,a){case l$1:case m:case e:case g$1:case f$7:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$1:case t$1:case r$1:case h$1:return a;default:return u}}case d$1:return u}}}function A$1(a){return z$1(a)===m}var AsyncMode=l$1;var ConcurrentMode=m;var ContextConsumer=k$1;var ContextProvider=h$1;var Element$1=c$2;var ForwardRef=n$1;var Fragment=e;var Lazy=t$1;var Memo=r$1;var Portal=d$1;
|
|
42316
|
+
var Profiler=g$1;var StrictMode=f$7;var Suspense=p$1;var isAsyncMode=function(a){return A$1(a)||z$1(a)===l$1};var isConcurrentMode=A$1;var isContextConsumer=function(a){return z$1(a)===k$1};var isContextProvider=function(a){return z$1(a)===h$1};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$2};var isForwardRef=function(a){return z$1(a)===n$1};var isFragment=function(a){return z$1(a)===e};var isLazy=function(a){return z$1(a)===t$1};
|
|
42317
|
+
var isMemo=function(a){return z$1(a)===r$1};var isPortal=function(a){return z$1(a)===d$1};var isProfiler=function(a){return z$1(a)===g$1};var isStrictMode=function(a){return z$1(a)===f$7};var isSuspense=function(a){return z$1(a)===p$1};
|
|
42318
|
+
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g$1||a===f$7||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r$1||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===n$1||a.$$typeof===w$1||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};var typeOf=z$1;
|
|
43324
42319
|
|
|
43325
42320
|
var reactIs_production_min = {
|
|
43326
42321
|
AsyncMode: AsyncMode,
|
|
@@ -43691,14 +42686,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
43691
42686
|
|
|
43692
42687
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
43693
42688
|
|
|
43694
|
-
var has$
|
|
42689
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
43695
42690
|
|
|
43696
42691
|
var printWarning = function() {};
|
|
43697
42692
|
|
|
43698
42693
|
if (process.env.NODE_ENV !== 'production') {
|
|
43699
42694
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
43700
42695
|
var loggedTypeFailures = {};
|
|
43701
|
-
var has$
|
|
42696
|
+
var has$2 = has$1;
|
|
43702
42697
|
|
|
43703
42698
|
printWarning = function(text) {
|
|
43704
42699
|
var message = 'Warning: ' + text;
|
|
@@ -43728,7 +42723,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43728
42723
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
43729
42724
|
if (process.env.NODE_ENV !== 'production') {
|
|
43730
42725
|
for (var typeSpecName in typeSpecs) {
|
|
43731
|
-
if (has$
|
|
42726
|
+
if (has$2(typeSpecs, typeSpecName)) {
|
|
43732
42727
|
var error;
|
|
43733
42728
|
// Prop type validation may throw. In case they do, we don't want to
|
|
43734
42729
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -44127,7 +43122,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44127
43122
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
44128
43123
|
}
|
|
44129
43124
|
for (var key in propValue) {
|
|
44130
|
-
if (has$
|
|
43125
|
+
if (has$1(propValue, key)) {
|
|
44131
43126
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
44132
43127
|
if (error instanceof Error) {
|
|
44133
43128
|
return error;
|
|
@@ -44164,7 +43159,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44164
43159
|
if (checkerResult == null) {
|
|
44165
43160
|
return null;
|
|
44166
43161
|
}
|
|
44167
|
-
if (checkerResult.data && has$
|
|
43162
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
44168
43163
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
44169
43164
|
}
|
|
44170
43165
|
}
|
|
@@ -44224,7 +43219,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44224
43219
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
44225
43220
|
for (var key in allKeys) {
|
|
44226
43221
|
var checker = shapeTypes[key];
|
|
44227
|
-
if (has$
|
|
43222
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
44228
43223
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
44229
43224
|
}
|
|
44230
43225
|
if (!checker) {
|
|
@@ -44962,7 +43957,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
44962
43957
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
44963
43958
|
*/
|
|
44964
43959
|
|
|
44965
|
-
function ownKeys$
|
|
43960
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
44966
43961
|
var keys = Object.keys(object);
|
|
44967
43962
|
|
|
44968
43963
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -44978,9 +43973,9 @@ function ownKeys$3(object, enumerableOnly) {
|
|
|
44978
43973
|
function _objectSpread2$1(target) {
|
|
44979
43974
|
for (var i = 1; i < arguments.length; i++) {
|
|
44980
43975
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
44981
|
-
i % 2 ? ownKeys$
|
|
43976
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
44982
43977
|
_defineProperty$1(target, key, source[key]);
|
|
44983
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$
|
|
43978
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
44984
43979
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44985
43980
|
});
|
|
44986
43981
|
}
|
|
@@ -48866,43 +47861,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
48866
47861
|
})))));
|
|
48867
47862
|
};
|
|
48868
47863
|
|
|
48869
|
-
/*
|
|
48870
|
-
Hook that takes an ID selector for an element on the screen
|
|
48871
|
-
And optionally values for top position, left position, smooth behavior
|
|
48872
|
-
Finds element on screen and scrolls it to the provided coordinates
|
|
48873
|
-
|
|
48874
|
-
(string, number, number, string, number) => undefined;
|
|
48875
|
-
*/
|
|
48876
|
-
var useScrollTo = function useScrollTo(id) {
|
|
48877
|
-
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48878
|
-
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
48879
|
-
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
48880
|
-
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
48881
|
-
var scrollItem;
|
|
48882
|
-
|
|
48883
|
-
if (delay) {
|
|
48884
|
-
setTimeout(function () {
|
|
48885
|
-
var _scrollItem;
|
|
48886
|
-
|
|
48887
|
-
scrollItem = document.getElementById(id);
|
|
48888
|
-
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
48889
|
-
top: top,
|
|
48890
|
-
left: left,
|
|
48891
|
-
behavior: behavior
|
|
48892
|
-
});
|
|
48893
|
-
}, delay);
|
|
48894
|
-
} else {
|
|
48895
|
-
var _scrollItem2;
|
|
48896
|
-
|
|
48897
|
-
scrollItem = document.getElementById(id);
|
|
48898
|
-
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
48899
|
-
top: top,
|
|
48900
|
-
left: left,
|
|
48901
|
-
behavior: behavior
|
|
48902
|
-
});
|
|
48903
|
-
}
|
|
48904
|
-
};
|
|
48905
|
-
|
|
48906
47864
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48907
47865
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48908
47866
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -49071,7 +48029,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49071
48029
|
onKeyDown: function onKeyDown(e) {
|
|
49072
48030
|
return e.key === "Enter" && handleSubmit(e);
|
|
49073
48031
|
},
|
|
49074
|
-
autocompleteValue: "name"
|
|
48032
|
+
autocompleteValue: "name",
|
|
48033
|
+
isRequired: true
|
|
49075
48034
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
49076
48035
|
labelTextWhenNoError: "Routing number",
|
|
49077
48036
|
dataQa: "Routing number",
|
|
@@ -49093,7 +48052,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49093
48052
|
},
|
|
49094
48053
|
onKeyDown: function onKeyDown(e) {
|
|
49095
48054
|
return e.key === "Enter" && handleSubmit(e);
|
|
49096
|
-
}
|
|
48055
|
+
},
|
|
48056
|
+
isRequired: true
|
|
49097
48057
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
49098
48058
|
labelTextWhenNoError: "Confirm routing number",
|
|
49099
48059
|
dataQa: "Confirm routing number",
|
|
@@ -49104,6 +48064,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49104
48064
|
onKeyDown: function onKeyDown(e) {
|
|
49105
48065
|
return e.key === "Enter" && handleSubmit(e);
|
|
49106
48066
|
},
|
|
48067
|
+
isRequired: true,
|
|
49107
48068
|
isNum: true
|
|
49108
48069
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
49109
48070
|
labelTextWhenNoError: "Account number",
|
|
@@ -49112,6 +48073,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49112
48073
|
field: fields.accountNumber,
|
|
49113
48074
|
fieldActions: actions.fields.accountNumber,
|
|
49114
48075
|
showErrors: showErrors,
|
|
48076
|
+
isRequired: true,
|
|
49115
48077
|
isNum: true,
|
|
49116
48078
|
helperModal: function helperModal() {
|
|
49117
48079
|
return /*#__PURE__*/React__default.createElement(AccountAndRoutingModal$1, {
|
|
@@ -49130,6 +48092,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49130
48092
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
49131
48093
|
labelTextWhenNoError: "Confirm account number",
|
|
49132
48094
|
dataQa: "Confirm account number",
|
|
48095
|
+
isRequired: true,
|
|
49133
48096
|
errorMessages: confirmAccountNumberErrors,
|
|
49134
48097
|
field: fields.confirmAccountNumber,
|
|
49135
48098
|
fieldActions: actions.fields.confirmAccountNumber,
|
|
@@ -49140,6 +48103,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49140
48103
|
isNum: true
|
|
49141
48104
|
}), allowBankAccountType && /*#__PURE__*/React__default.createElement(FormSelect$1, {
|
|
49142
48105
|
labelTextWhenNoError: "Account type",
|
|
48106
|
+
isRequired: true,
|
|
49143
48107
|
dataQa: "Account type",
|
|
49144
48108
|
options: [{
|
|
49145
48109
|
text: "Select account type",
|
|
@@ -49270,6 +48234,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49270
48234
|
"aria-label": "Card payment"
|
|
49271
48235
|
}, /*#__PURE__*/React__default.createElement(FormInputColumn, null, !hideZipCode && /*#__PURE__*/React__default.createElement(CountryDropdown, {
|
|
49272
48236
|
labelTextWhenNoError: "Country",
|
|
48237
|
+
isRequired: true,
|
|
49273
48238
|
errorMessages: countryErrorMessages,
|
|
49274
48239
|
field: fields.country,
|
|
49275
48240
|
onChange: function onChange(value) {
|
|
@@ -49292,8 +48257,10 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49292
48257
|
onKeyDown: function onKeyDown(e) {
|
|
49293
48258
|
return e.key === "Enter" && handleSubmit(e);
|
|
49294
48259
|
},
|
|
49295
|
-
autocompleteValue: "cc-name"
|
|
48260
|
+
autocompleteValue: "cc-name",
|
|
48261
|
+
isRequired: true
|
|
49296
48262
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
48263
|
+
isRequired: true,
|
|
49297
48264
|
labelTextWhenNoError: "Credit card number",
|
|
49298
48265
|
dataQa: "Credit card number",
|
|
49299
48266
|
errorMessages: creditCardNumberErrors,
|
|
@@ -49323,7 +48290,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49323
48290
|
isNum: true,
|
|
49324
48291
|
removeFromValue: /\// // removes "/" from browser autofill
|
|
49325
48292
|
,
|
|
49326
|
-
autocompleteValue: "cc-exp"
|
|
48293
|
+
autocompleteValue: "cc-exp",
|
|
48294
|
+
isRequired: true
|
|
49327
48295
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
49328
48296
|
labelTextWhenNoError: "CVV",
|
|
49329
48297
|
dataQa: "CVV",
|
|
@@ -49336,7 +48304,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49336
48304
|
onKeyDown: function onKeyDown(e) {
|
|
49337
48305
|
return e.key === "Enter" && handleSubmit(e);
|
|
49338
48306
|
},
|
|
49339
|
-
autocompleteValue: "cc-csc"
|
|
48307
|
+
autocompleteValue: "cc-csc",
|
|
48308
|
+
isRequired: true
|
|
49340
48309
|
})), !hideZipCode && /*#__PURE__*/React__default.createElement(Box, {
|
|
49341
48310
|
padding: isMobile ? "0" : "0 0.5rem 0 0",
|
|
49342
48311
|
width: isMobile ? "100%" : "50%"
|
|
@@ -49352,7 +48321,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49352
48321
|
onKeyDown: function onKeyDown(e) {
|
|
49353
48322
|
return e.key === "Enter" && handleSubmit(e);
|
|
49354
48323
|
},
|
|
49355
|
-
autocompleteValue: "billing postal-code"
|
|
48324
|
+
autocompleteValue: "billing postal-code",
|
|
48325
|
+
isRequired: true
|
|
49356
48326
|
})), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
49357
48327
|
childGap: "4px",
|
|
49358
48328
|
align: "center"
|
|
@@ -49600,7 +48570,7 @@ PhoneForm.mapDispatchToProps = mapDispatchToProps$8;
|
|
|
49600
48570
|
var DefaultHeading = styled__default.div.withConfig({
|
|
49601
48571
|
displayName: "RadioGroup__DefaultHeading",
|
|
49602
48572
|
componentId: "sc-7lqrl8-0"
|
|
49603
|
-
})(["font-size:0.875rem;color:", "
|
|
48573
|
+
})(["font-size:0.875rem;color:", ";margin:0;padding:8px 0px;"], CHARADE_GREY);
|
|
49604
48574
|
var StyledFieldset = styled__default.fieldset.withConfig({
|
|
49605
48575
|
displayName: "RadioGroup__StyledFieldset",
|
|
49606
48576
|
componentId: "sc-7lqrl8-1"
|
|
@@ -49821,7 +48791,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
49821
48791
|
toggleRadio: section.disabled ? noop : function () {
|
|
49822
48792
|
return toggleOpenSection(section.id);
|
|
49823
48793
|
},
|
|
49824
|
-
tabIndex: "-1"
|
|
48794
|
+
tabIndex: "-1",
|
|
48795
|
+
required: section === null || section === void 0 ? void 0 : section.required
|
|
49825
48796
|
})), section.titleIcon && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
49826
48797
|
align: "center"
|
|
49827
48798
|
}, section.titleIcon), /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -50364,19 +49335,19 @@ var ToastNotification = function ToastNotification(_ref) {
|
|
|
50364
49335
|
backgroundColor = _ref.backgroundColor;
|
|
50365
49336
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
50366
49337
|
onClick: closeToastNotification,
|
|
50367
|
-
background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant ===
|
|
49338
|
+
background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant === VARIANTS.ERROR ? ERROR_BACKGROUND_COLOR : WHITE,
|
|
50368
49339
|
minWidth: minWidth,
|
|
50369
49340
|
minHeight: height && parseInt(height) < 100 ? height : "100px",
|
|
50370
49341
|
height: height ? height : "auto",
|
|
50371
49342
|
tabIndex: toastOpen ? "-1" : "0",
|
|
50372
49343
|
padding: "0rem 1rem",
|
|
50373
49344
|
borderRadius: "4px",
|
|
50374
|
-
boxShadow:
|
|
49345
|
+
boxShadow: generateShadows().standard.base,
|
|
50375
49346
|
extraStyles: "\n display: ".concat(toastOpen ? "block" : "none", ";\n position: fixed; bottom: 4rem; left: 4rem;\n ").concat(extraStyles, ";\n cursor: pointer;\n ")
|
|
50376
49347
|
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
50377
49348
|
align: "center",
|
|
50378
49349
|
childGap: childGap
|
|
50379
|
-
}, variant ===
|
|
49350
|
+
}, variant === VARIANTS.SUCCESS && /*#__PURE__*/React__default.createElement(SuccessfulIconMedium, null), variant === VARIANTS.ERROR && /*#__PURE__*/React__default.createElement(ErroredIcon, null), /*#__PURE__*/React__default.createElement(Box, {
|
|
50380
49351
|
padding: "1rem 0",
|
|
50381
49352
|
maxWidth: maxWidth
|
|
50382
49353
|
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
@@ -50757,6 +49728,38 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
|
|
|
50757
49728
|
|
|
50758
49729
|
var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$U));
|
|
50759
49730
|
|
|
49731
|
+
var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
|
|
49732
|
+
var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
49733
|
+
// Only move focus when "hasErrors" is true
|
|
49734
|
+
// "hasErrors" is managed by container page of form
|
|
49735
|
+
// typically set to "true" on attempted form submission, if errors exist
|
|
49736
|
+
// Reset errors, if provided, resets the error state tracking in order to properly re-run
|
|
49737
|
+
React.useEffect(function () {
|
|
49738
|
+
if (hasErrors) {
|
|
49739
|
+
var _inputsWithErrors$;
|
|
49740
|
+
|
|
49741
|
+
var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
|
|
49742
|
+
inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
|
|
49743
|
+
}
|
|
49744
|
+
|
|
49745
|
+
return function () {
|
|
49746
|
+
return resetHasErrors(false);
|
|
49747
|
+
};
|
|
49748
|
+
});
|
|
49749
|
+
};
|
|
49750
|
+
|
|
49751
|
+
|
|
49752
|
+
|
|
49753
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
49754
|
+
__proto__: null,
|
|
49755
|
+
formats: formats,
|
|
49756
|
+
general: general,
|
|
49757
|
+
theme: themeUtils,
|
|
49758
|
+
useFocusInvalidInput: useFocusInvalidInput,
|
|
49759
|
+
useOutsideClick: useOutsideClickHook,
|
|
49760
|
+
useToastNotification: useToastNotification
|
|
49761
|
+
});
|
|
49762
|
+
|
|
50760
49763
|
exports.AccountNumberImage = AccountNumberImage;
|
|
50761
49764
|
exports.AccountsAddIcon = AccountsAddIcon$1;
|
|
50762
49765
|
exports.AccountsIcon = AccountsIcon$1;
|
|
@@ -50968,6 +49971,7 @@ exports.cardRegistry = cardRegistry;
|
|
|
50968
49971
|
exports.constants = index$5;
|
|
50969
49972
|
exports.createPartialAmountFormState = createPartialAmountFormState;
|
|
50970
49973
|
exports.createPartialAmountFormValidators = createPartialAmountFormValidators;
|
|
50971
|
-
exports.
|
|
49974
|
+
exports.hooks = index$4;
|
|
49975
|
+
exports.util = index$6;
|
|
50972
49976
|
exports.withWindowSize = withWindowSize;
|
|
50973
49977
|
//# sourceMappingURL=index.cjs.js.map
|