@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.esm.js
CHANGED
|
@@ -5011,6 +5011,7 @@ var INFO_BLUE = "#E4F4FD";
|
|
|
5011
5011
|
var CORNFLOWER_BLUE = "#EBEFFB";
|
|
5012
5012
|
var HOVER_LIGHT_BLUE = "#EFFAFF";
|
|
5013
5013
|
var MATISSE_BLUE = "#15749D";
|
|
5014
|
+
var MATISSE_BLUE_DARK = "#105C7D";
|
|
5014
5015
|
var ROYAL_BLUE = "#3181E3";
|
|
5015
5016
|
var ROYAL_BLUE_VIVID = "#3B5BDB";
|
|
5016
5017
|
var ASTRAL_BLUE = "#3176AA";
|
|
@@ -5146,6 +5147,7 @@ var colors = /*#__PURE__*/Object.freeze({
|
|
|
5146
5147
|
BOSTON_BLUE: BOSTON_BLUE,
|
|
5147
5148
|
HOVER_LIGHT_BLUE: HOVER_LIGHT_BLUE,
|
|
5148
5149
|
MATISSE_BLUE: MATISSE_BLUE,
|
|
5150
|
+
MATISSE_BLUE_DARK: MATISSE_BLUE_DARK,
|
|
5149
5151
|
ROYAL_BLUE: ROYAL_BLUE,
|
|
5150
5152
|
ROYAL_BLUE_VIVID: ROYAL_BLUE_VIVID,
|
|
5151
5153
|
ASTRAL_BLUE: ASTRAL_BLUE,
|
|
@@ -22124,7 +22126,9 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22124
22126
|
extraStyles = _ref4.extraStyles,
|
|
22125
22127
|
textExtraStyles = _ref4.textExtraStyles,
|
|
22126
22128
|
_ref4$dataQa = _ref4.dataQa,
|
|
22127
|
-
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa
|
|
22129
|
+
dataQa = _ref4$dataQa === void 0 ? null : _ref4$dataQa,
|
|
22130
|
+
_ref4$isRequired = _ref4.isRequired,
|
|
22131
|
+
isRequired = _ref4$isRequired === void 0 ? false : _ref4$isRequired;
|
|
22128
22132
|
|
|
22129
22133
|
var _useState = useState(false),
|
|
22130
22134
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -22178,7 +22182,8 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
22178
22182
|
errorStyles: themeValues.errorStyles,
|
|
22179
22183
|
disabledStyles: themeValues.disabledStyles,
|
|
22180
22184
|
disabledCheckedStyles: themeValues.disabledCheckedStyles,
|
|
22181
|
-
focusedStyles: themeValues.focusedStyles
|
|
22185
|
+
focusedStyles: themeValues.focusedStyles,
|
|
22186
|
+
"aria-required": isRequired
|
|
22182
22187
|
}, /*#__PURE__*/React.createElement(CheckboxIcon, {
|
|
22183
22188
|
viewBox: "0 0 24 24",
|
|
22184
22189
|
disabled: disabled,
|
|
@@ -23692,9 +23697,11 @@ exportTypedArrayMethod$1('at', function at(index) {
|
|
|
23692
23697
|
|
|
23693
23698
|
var selectedColor = "".concat(MATISSE_BLUE);
|
|
23694
23699
|
var hoverColor$3 = "".concat(HOVER_LIGHT_BLUE);
|
|
23700
|
+
var focusColor = "".concat(MATISSE_BLUE_DARK);
|
|
23695
23701
|
var fallbackValues$f = {
|
|
23696
23702
|
selectedColor: selectedColor,
|
|
23697
|
-
hoverColor: hoverColor$3
|
|
23703
|
+
hoverColor: hoverColor$3,
|
|
23704
|
+
focusColor: focusColor
|
|
23698
23705
|
};
|
|
23699
23706
|
|
|
23700
23707
|
var IconWrapper = styled.div.withConfig({
|
|
@@ -23717,7 +23724,7 @@ var DropdownContentWrapper = styled.div.withConfig({
|
|
|
23717
23724
|
var DropdownItemWrapper = styled.li.withConfig({
|
|
23718
23725
|
displayName: "Dropdown__DropdownItemWrapper",
|
|
23719
23726
|
componentId: "sc-pn6m0h-2"
|
|
23720
|
-
})(["
|
|
23727
|
+
})(["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) {
|
|
23721
23728
|
var selected = _ref4.selected,
|
|
23722
23729
|
themeValues = _ref4.themeValues;
|
|
23723
23730
|
return selected ? themeValues.selectedColor : WHITE;
|
|
@@ -23725,44 +23732,73 @@ var DropdownItemWrapper = styled.li.withConfig({
|
|
|
23725
23732
|
var disabled = _ref5.disabled;
|
|
23726
23733
|
return disabled ? "default" : "pointer";
|
|
23727
23734
|
}, function (_ref6) {
|
|
23728
|
-
var
|
|
23729
|
-
|
|
23735
|
+
var disabled = _ref6.disabled,
|
|
23736
|
+
selected = _ref6.selected,
|
|
23730
23737
|
themeValues = _ref6.themeValues;
|
|
23731
|
-
return selected ? themeValues.
|
|
23738
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23732
23739
|
}, function (_ref7) {
|
|
23733
23740
|
var selected = _ref7.selected,
|
|
23734
23741
|
disabled = _ref7.disabled,
|
|
23735
23742
|
themeValues = _ref7.themeValues;
|
|
23736
|
-
return selected ? themeValues.
|
|
23743
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23744
|
+
}, function (_ref8) {
|
|
23745
|
+
var selected = _ref8.selected,
|
|
23746
|
+
disabled = _ref8.disabled,
|
|
23747
|
+
themeValues = _ref8.themeValues;
|
|
23748
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23749
|
+
}, function (_ref9) {
|
|
23750
|
+
var themeValues = _ref9.themeValues;
|
|
23751
|
+
return themeValues.selectedColor;
|
|
23752
|
+
}, function (_ref10) {
|
|
23753
|
+
var selected = _ref10.selected,
|
|
23754
|
+
disabled = _ref10.disabled,
|
|
23755
|
+
themeValues = _ref10.themeValues;
|
|
23756
|
+
return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
|
|
23757
|
+
});
|
|
23758
|
+
var DropdownItemBorder = styled.div.withConfig({
|
|
23759
|
+
displayName: "Dropdown__DropdownItemBorder",
|
|
23760
|
+
componentId: "sc-pn6m0h-3"
|
|
23761
|
+
})(["background:", ";border-color:", ";border-width:2px;border-style:solid;padding:12px;"], function (_ref11) {
|
|
23762
|
+
var selected = _ref11.selected,
|
|
23763
|
+
themeValues = _ref11.themeValues;
|
|
23764
|
+
return selected ? themeValues.selectedColor : WHITE;
|
|
23765
|
+
}, function (_ref12) {
|
|
23766
|
+
var selected = _ref12.selected,
|
|
23767
|
+
themeValues = _ref12.themeValues;
|
|
23768
|
+
return selected ? themeValues.selectedColor : WHITE;
|
|
23737
23769
|
});
|
|
23738
23770
|
|
|
23739
|
-
var Dropdown = function Dropdown(
|
|
23740
|
-
var placeholder =
|
|
23741
|
-
options =
|
|
23742
|
-
value =
|
|
23743
|
-
isOpen =
|
|
23744
|
-
isError =
|
|
23745
|
-
onSelect =
|
|
23746
|
-
|
|
23747
|
-
disabledValues =
|
|
23748
|
-
|
|
23749
|
-
_onClick =
|
|
23750
|
-
themeValues =
|
|
23751
|
-
maxHeight =
|
|
23752
|
-
|
|
23753
|
-
widthFitOptions =
|
|
23754
|
-
disabled =
|
|
23755
|
-
|
|
23756
|
-
hasTitles =
|
|
23757
|
-
|
|
23758
|
-
autoEraseTypeAhead =
|
|
23759
|
-
ariaLabelledby =
|
|
23760
|
-
ariaDescribedby =
|
|
23761
|
-
autocompleteValue =
|
|
23762
|
-
|
|
23763
|
-
smoothScroll =
|
|
23764
|
-
|
|
23765
|
-
ariaInvalid =
|
|
23771
|
+
var Dropdown = function Dropdown(_ref13) {
|
|
23772
|
+
var placeholder = _ref13.placeholder,
|
|
23773
|
+
options = _ref13.options,
|
|
23774
|
+
value = _ref13.value,
|
|
23775
|
+
isOpen = _ref13.isOpen,
|
|
23776
|
+
isError = _ref13.isError,
|
|
23777
|
+
onSelect = _ref13.onSelect,
|
|
23778
|
+
_ref13$disabledValues = _ref13.disabledValues,
|
|
23779
|
+
disabledValues = _ref13$disabledValues === void 0 ? [] : _ref13$disabledValues,
|
|
23780
|
+
_ref13$onClick = _ref13.onClick,
|
|
23781
|
+
_onClick = _ref13$onClick === void 0 ? noop : _ref13$onClick,
|
|
23782
|
+
themeValues = _ref13.themeValues,
|
|
23783
|
+
maxHeight = _ref13.maxHeight,
|
|
23784
|
+
_ref13$widthFitOption = _ref13.widthFitOptions,
|
|
23785
|
+
widthFitOptions = _ref13$widthFitOption === void 0 ? false : _ref13$widthFitOption,
|
|
23786
|
+
disabled = _ref13.disabled,
|
|
23787
|
+
_ref13$hasTitles = _ref13.hasTitles,
|
|
23788
|
+
hasTitles = _ref13$hasTitles === void 0 ? false : _ref13$hasTitles,
|
|
23789
|
+
_ref13$autoEraseTypeA = _ref13.autoEraseTypeAhead,
|
|
23790
|
+
autoEraseTypeAhead = _ref13$autoEraseTypeA === void 0 ? true : _ref13$autoEraseTypeA,
|
|
23791
|
+
ariaLabelledby = _ref13.ariaLabelledby,
|
|
23792
|
+
ariaDescribedby = _ref13.ariaDescribedby,
|
|
23793
|
+
autocompleteValue = _ref13.autocompleteValue,
|
|
23794
|
+
_ref13$smoothScroll = _ref13.smoothScroll,
|
|
23795
|
+
smoothScroll = _ref13$smoothScroll === void 0 ? true : _ref13$smoothScroll,
|
|
23796
|
+
_ref13$ariaInvalid = _ref13.ariaInvalid,
|
|
23797
|
+
ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid,
|
|
23798
|
+
_ref13$isRequired = _ref13.isRequired,
|
|
23799
|
+
isRequired = _ref13$isRequired === void 0 ? false : _ref13$isRequired;
|
|
23800
|
+
|
|
23801
|
+
var required = options.required || isRequired;
|
|
23766
23802
|
|
|
23767
23803
|
var _useState = useState(""),
|
|
23768
23804
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -24011,7 +24047,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24011
24047
|
"aria-labelledby": ariaLabelledby,
|
|
24012
24048
|
"aria-describedby": ariaDescribedby,
|
|
24013
24049
|
"aria-expanded": isOpen,
|
|
24014
|
-
"aria-required":
|
|
24050
|
+
"aria-required": required,
|
|
24015
24051
|
"aria-invalid": ariaInvalid,
|
|
24016
24052
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
24017
24053
|
borderRadius: "2px",
|
|
@@ -24033,7 +24069,6 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24033
24069
|
},
|
|
24034
24070
|
padding: "12px",
|
|
24035
24071
|
placeholder: getSelection(),
|
|
24036
|
-
required: options.required,
|
|
24037
24072
|
role: "combobox",
|
|
24038
24073
|
themeValues: themeValues,
|
|
24039
24074
|
title: hasTitles ? getSelection() : null,
|
|
@@ -24041,6 +24076,9 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24041
24076
|
tabIndex: 0,
|
|
24042
24077
|
value: inputValue,
|
|
24043
24078
|
width: "100%"
|
|
24079
|
+
/* Non-semantic elements need the aria-* version of the attribute */
|
|
24080
|
+
,
|
|
24081
|
+
"aria-disabled": disabledValues.includes(inputValue)
|
|
24044
24082
|
}), /*#__PURE__*/React.createElement(IconWrapper, {
|
|
24045
24083
|
open: isOpen,
|
|
24046
24084
|
onClick: _onClick
|
|
@@ -24051,7 +24089,8 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24051
24089
|
widthFitOptions: widthFitOptions,
|
|
24052
24090
|
tabIndex: 0,
|
|
24053
24091
|
role: "listbox",
|
|
24054
|
-
id: "".concat(ariaLabelledby, "_listbox")
|
|
24092
|
+
id: "".concat(ariaLabelledby, "_listbox"),
|
|
24093
|
+
required: required
|
|
24055
24094
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
24056
24095
|
childGap: "0",
|
|
24057
24096
|
as: "ul"
|
|
@@ -24084,11 +24123,15 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
24084
24123
|
onFocus: function onFocus() {
|
|
24085
24124
|
return setFocusedRef(optionRefs.current[i]);
|
|
24086
24125
|
}
|
|
24126
|
+
}, /*#__PURE__*/React.createElement(DropdownItemBorder, {
|
|
24127
|
+
disabled: disabledValues.includes(choice.value),
|
|
24128
|
+
selected: choice.value === value,
|
|
24129
|
+
themeValues: themeValues
|
|
24087
24130
|
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
24088
24131
|
variant: "p",
|
|
24089
24132
|
color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
|
|
24090
|
-
extraStyles: "padding-left: 16px;\n
|
|
24091
|
-
}, choice.text));
|
|
24133
|
+
extraStyles: "padding-left: 16px;\n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;")
|
|
24134
|
+
}, choice.text)));
|
|
24092
24135
|
}))) : /*#__PURE__*/React.createElement(Fragment$1, null)));
|
|
24093
24136
|
};
|
|
24094
24137
|
|
|
@@ -24197,7 +24240,9 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24197
24240
|
_ref$dataQa = _ref.dataQa,
|
|
24198
24241
|
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
|
|
24199
24242
|
_ref$widthFitOptions = _ref.widthFitOptions,
|
|
24200
|
-
widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions
|
|
24243
|
+
widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions,
|
|
24244
|
+
_ref$isRequired = _ref.isRequired,
|
|
24245
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
24201
24246
|
|
|
24202
24247
|
var _useState = useState(false),
|
|
24203
24248
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -24205,6 +24250,17 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24205
24250
|
setOpen = _useState2[1];
|
|
24206
24251
|
|
|
24207
24252
|
var dropdownRef = useRef(null);
|
|
24253
|
+
var required = (options === null || options === void 0 ? void 0 : options.required) || isRequired;
|
|
24254
|
+
var labelId = useMemo(function () {
|
|
24255
|
+
return function (labelTextWhenNoError) {
|
|
24256
|
+
return createIdFromString(labelTextWhenNoError);
|
|
24257
|
+
};
|
|
24258
|
+
}, [labelTextWhenNoError]);
|
|
24259
|
+
var descriptionId = useMemo(function () {
|
|
24260
|
+
return function (field, labelTextWhenNoError) {
|
|
24261
|
+
return field.hasErrors && field.dirty ? labelId(labelTextWhenNoError) + "error-message" : "";
|
|
24262
|
+
};
|
|
24263
|
+
}, [field, labelTextWhenNoError]);
|
|
24208
24264
|
|
|
24209
24265
|
var handleClickAway = function handleClickAway(event) {
|
|
24210
24266
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
@@ -24220,8 +24276,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24220
24276
|
});
|
|
24221
24277
|
return /*#__PURE__*/React.createElement(SelectContainer, {
|
|
24222
24278
|
ref: dropdownRef,
|
|
24279
|
+
"aria-role": "group",
|
|
24223
24280
|
disabled: disabled,
|
|
24224
|
-
"aria-disabled": disabled,
|
|
24225
24281
|
"data-qa": dataQa
|
|
24226
24282
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
24227
24283
|
padding: "0",
|
|
@@ -24235,10 +24291,10 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24235
24291
|
color: themeValues.labelColor,
|
|
24236
24292
|
weight: themeValues.fontWeight,
|
|
24237
24293
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
24238
|
-
id:
|
|
24294
|
+
id: labelId(labelTextWhenNoError)
|
|
24239
24295
|
}, labelTextWhenNoError))), /*#__PURE__*/React.createElement(Dropdown$1, {
|
|
24240
|
-
ariaLabelledby:
|
|
24241
|
-
ariaDescribedby:
|
|
24296
|
+
ariaLabelledby: labelId(labelTextWhenNoError),
|
|
24297
|
+
ariaDescribedby: descriptionId(field, labelTextWhenNoError),
|
|
24242
24298
|
maxHeight: dropdownMaxHeight,
|
|
24243
24299
|
widthFitOptions: widthFitOptions,
|
|
24244
24300
|
hasTitles: hasTitles,
|
|
@@ -24259,7 +24315,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24259
24315
|
},
|
|
24260
24316
|
disabled: disabled,
|
|
24261
24317
|
autocompleteValue: autocompleteValue,
|
|
24262
|
-
smoothScroll: smoothScroll
|
|
24318
|
+
smoothScroll: smoothScroll,
|
|
24319
|
+
isRequired: required
|
|
24263
24320
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
24264
24321
|
direction: "row",
|
|
24265
24322
|
justify: "space-between"
|
|
@@ -25029,7 +25086,9 @@ var CountryDropdown = function CountryDropdown(_ref) {
|
|
|
25029
25086
|
showErrors = _ref.showErrors,
|
|
25030
25087
|
onChange = _ref.onChange,
|
|
25031
25088
|
_ref$dataQa = _ref.dataQa,
|
|
25032
|
-
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa
|
|
25089
|
+
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
|
|
25090
|
+
_ref$isRequired = _ref.isRequired,
|
|
25091
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
25033
25092
|
return /*#__PURE__*/React.createElement(FormSelect$1, {
|
|
25034
25093
|
options: options,
|
|
25035
25094
|
field: field,
|
|
@@ -25039,7 +25098,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
|
|
|
25039
25098
|
errorMessages: errorMessages,
|
|
25040
25099
|
showErrors: showErrors,
|
|
25041
25100
|
onChange: onChange,
|
|
25042
|
-
autocompleteValue: "country-name"
|
|
25101
|
+
autocompleteValue: "country-name",
|
|
25102
|
+
isRequired: isRequired
|
|
25043
25103
|
});
|
|
25044
25104
|
};
|
|
25045
25105
|
|
|
@@ -25203,6 +25263,346 @@ var DisplayBox = function DisplayBox(_ref) {
|
|
|
25203
25263
|
|
|
25204
25264
|
var DisplayBox$1 = themeComponent(DisplayBox, "DisplayBox", fallbackValues$i);
|
|
25205
25265
|
|
|
25266
|
+
/*
|
|
25267
|
+
Hook that assigns a click event listener to the main document element
|
|
25268
|
+
Returns a ref to attach to another element (like an icon/button that triggers a popover)
|
|
25269
|
+
If a click event gets captured by the document and the assigned element isn't the target
|
|
25270
|
+
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
25271
|
+
|
|
25272
|
+
See popover component for implementation
|
|
25273
|
+
|
|
25274
|
+
*/
|
|
25275
|
+
|
|
25276
|
+
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
25277
|
+
var ref = useRef();
|
|
25278
|
+
useEffect$1(function () {
|
|
25279
|
+
}, [ref]);
|
|
25280
|
+
return ref;
|
|
25281
|
+
};
|
|
25282
|
+
|
|
25283
|
+
/*
|
|
25284
|
+
Hook that takes an ID selector for an element on the screen
|
|
25285
|
+
And optionally values for top position, left position, smooth behavior
|
|
25286
|
+
Finds element on screen and scrolls it to the provided coordinates
|
|
25287
|
+
|
|
25288
|
+
(string, number, number, string, number) => undefined;
|
|
25289
|
+
*/
|
|
25290
|
+
var useScrollTo = function useScrollTo(id) {
|
|
25291
|
+
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
25292
|
+
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
25293
|
+
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
25294
|
+
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
25295
|
+
var scrollItem;
|
|
25296
|
+
|
|
25297
|
+
if (delay) {
|
|
25298
|
+
setTimeout(function () {
|
|
25299
|
+
var _scrollItem;
|
|
25300
|
+
|
|
25301
|
+
scrollItem = document.getElementById(id);
|
|
25302
|
+
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
25303
|
+
top: top,
|
|
25304
|
+
left: left,
|
|
25305
|
+
behavior: behavior
|
|
25306
|
+
});
|
|
25307
|
+
}, delay);
|
|
25308
|
+
} else {
|
|
25309
|
+
var _scrollItem2;
|
|
25310
|
+
|
|
25311
|
+
scrollItem = document.getElementById(id);
|
|
25312
|
+
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
25313
|
+
top: top,
|
|
25314
|
+
left: left,
|
|
25315
|
+
behavior: behavior
|
|
25316
|
+
});
|
|
25317
|
+
}
|
|
25318
|
+
};
|
|
25319
|
+
|
|
25320
|
+
var initialToastState = {
|
|
25321
|
+
isOpen: false,
|
|
25322
|
+
variant: "",
|
|
25323
|
+
message: ""
|
|
25324
|
+
};
|
|
25325
|
+
|
|
25326
|
+
var useToastNotification = function useToastNotification() {
|
|
25327
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
25328
|
+
_ref$timeout = _ref.timeout,
|
|
25329
|
+
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
25330
|
+
|
|
25331
|
+
var _useState = useState(initialToastState),
|
|
25332
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25333
|
+
toastState = _useState2[0],
|
|
25334
|
+
setToastState = _useState2[1];
|
|
25335
|
+
|
|
25336
|
+
useEffect$1(function () {
|
|
25337
|
+
if (toastState.isOpen) {
|
|
25338
|
+
setTimeout(function () {
|
|
25339
|
+
setToastState(initialToastState);
|
|
25340
|
+
}, timeout);
|
|
25341
|
+
}
|
|
25342
|
+
}, [timeout, toastState.isOpen]);
|
|
25343
|
+
|
|
25344
|
+
var showToast = function showToast(_ref2) {
|
|
25345
|
+
var message = _ref2.message,
|
|
25346
|
+
variant = _ref2.variant;
|
|
25347
|
+
return setToastState({
|
|
25348
|
+
isOpen: true,
|
|
25349
|
+
variant: variant,
|
|
25350
|
+
message: message
|
|
25351
|
+
});
|
|
25352
|
+
};
|
|
25353
|
+
|
|
25354
|
+
var hideToast = function hideToast() {
|
|
25355
|
+
return setToastState(initialToastState);
|
|
25356
|
+
};
|
|
25357
|
+
|
|
25358
|
+
return {
|
|
25359
|
+
isToastOpen: toastState.isOpen,
|
|
25360
|
+
toastVariant: toastState.variant,
|
|
25361
|
+
toastMessage: toastState.message,
|
|
25362
|
+
showToast: showToast,
|
|
25363
|
+
hideToast: hideToast
|
|
25364
|
+
};
|
|
25365
|
+
};
|
|
25366
|
+
|
|
25367
|
+
|
|
25368
|
+
|
|
25369
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
25370
|
+
__proto__: null,
|
|
25371
|
+
useOutsideClick: useOutsideClickHook,
|
|
25372
|
+
useScrollTo: useScrollTo,
|
|
25373
|
+
useToastNotification: useToastNotification
|
|
25374
|
+
});
|
|
25375
|
+
|
|
25376
|
+
var hoverColor$4 = "#116285";
|
|
25377
|
+
var activeColor$4 = "#0E506D";
|
|
25378
|
+
var popoverTriggerColor = "#15749D";
|
|
25379
|
+
var fallbackValues$j = {
|
|
25380
|
+
hoverColor: hoverColor$4,
|
|
25381
|
+
activeColor: activeColor$4,
|
|
25382
|
+
popoverTriggerColor: popoverTriggerColor
|
|
25383
|
+
};
|
|
25384
|
+
|
|
25385
|
+
var arrowBorder = function arrowBorder(borderColor, direction) {
|
|
25386
|
+
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
|
|
25387
|
+
var angle = "".concat(width, " solid transparent");
|
|
25388
|
+
var straight = "".concat(width, " solid ").concat(borderColor);
|
|
25389
|
+
|
|
25390
|
+
if (direction == "down") {
|
|
25391
|
+
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
|
|
25392
|
+
} else if (direction == "up") {
|
|
25393
|
+
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
|
|
25394
|
+
} else if (direction == "left") {
|
|
25395
|
+
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
|
|
25396
|
+
} else if (direction == "right") {
|
|
25397
|
+
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
|
|
25398
|
+
}
|
|
25399
|
+
};
|
|
25400
|
+
|
|
25401
|
+
var Popover = function Popover(_ref) {
|
|
25402
|
+
var themeValues = _ref.themeValues,
|
|
25403
|
+
_ref$triggerText = _ref.triggerText,
|
|
25404
|
+
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
25405
|
+
_ref$content = _ref.content,
|
|
25406
|
+
content = _ref$content === void 0 ? "" : _ref$content,
|
|
25407
|
+
_ref$hasIcon = _ref.hasIcon,
|
|
25408
|
+
hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
|
|
25409
|
+
Icon = _ref.icon,
|
|
25410
|
+
_ref$iconHelpText = _ref.iconHelpText,
|
|
25411
|
+
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
25412
|
+
_ref$popoverID = _ref.popoverID,
|
|
25413
|
+
popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
|
|
25414
|
+
_ref$popoverFocus = _ref.popoverFocus,
|
|
25415
|
+
popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
|
|
25416
|
+
extraStyles = _ref.extraStyles,
|
|
25417
|
+
textExtraStyles = _ref.textExtraStyles,
|
|
25418
|
+
_ref$minWidth = _ref.minWidth,
|
|
25419
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
25420
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
25421
|
+
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
25422
|
+
_ref$height = _ref.height,
|
|
25423
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
25424
|
+
position = _ref.position,
|
|
25425
|
+
arrowPosition = _ref.arrowPosition,
|
|
25426
|
+
_ref$arrowDirection = _ref.arrowDirection,
|
|
25427
|
+
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
25428
|
+
_ref$transform = _ref.transform,
|
|
25429
|
+
transform = _ref$transform === void 0 ? "none" : _ref$transform,
|
|
25430
|
+
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
25431
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
25432
|
+
backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
|
|
25433
|
+
_ref$borderColor = _ref.borderColor,
|
|
25434
|
+
borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
|
|
25435
|
+
popoverExtraStyles = _ref.popoverExtraStyles;
|
|
25436
|
+
var hoverColor = themeValues.hoverColor,
|
|
25437
|
+
activeColor = themeValues.activeColor,
|
|
25438
|
+
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
25439
|
+
|
|
25440
|
+
var _ref2 = position !== null && position !== void 0 ? position : {},
|
|
25441
|
+
_ref2$top = _ref2.top,
|
|
25442
|
+
top = _ref2$top === void 0 ? "-110px" : _ref2$top,
|
|
25443
|
+
_ref2$right = _ref2.right,
|
|
25444
|
+
right = _ref2$right === void 0 ? "auto" : _ref2$right,
|
|
25445
|
+
_ref2$bottom = _ref2.bottom,
|
|
25446
|
+
bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
|
|
25447
|
+
_ref2$left = _ref2.left,
|
|
25448
|
+
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
25449
|
+
|
|
25450
|
+
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
25451
|
+
_ref3$arrowTop = _ref3.arrowTop,
|
|
25452
|
+
arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
|
|
25453
|
+
_ref3$arrowRight = _ref3.arrowRight,
|
|
25454
|
+
arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
|
|
25455
|
+
_ref3$arrowBottom = _ref3.arrowBottom,
|
|
25456
|
+
arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
|
|
25457
|
+
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
25458
|
+
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
25459
|
+
|
|
25460
|
+
var _useState = useState(false),
|
|
25461
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25462
|
+
popoverOpen = _useState2[0],
|
|
25463
|
+
togglePopover = _useState2[1];
|
|
25464
|
+
|
|
25465
|
+
var handleTogglePopover = function handleTogglePopover(popoverState) {
|
|
25466
|
+
if (popoverOpen !== popoverState) {
|
|
25467
|
+
togglePopover(popoverState);
|
|
25468
|
+
}
|
|
25469
|
+
};
|
|
25470
|
+
|
|
25471
|
+
var triggerRef = useOutsideClickHook();
|
|
25472
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
25473
|
+
padding: "0",
|
|
25474
|
+
extraStyles: "position: relative; ".concat(extraStyles)
|
|
25475
|
+
}, /*#__PURE__*/React.createElement(ButtonWithAction, {
|
|
25476
|
+
action: function action() {
|
|
25477
|
+
return noop;
|
|
25478
|
+
},
|
|
25479
|
+
onFocus: function onFocus() {
|
|
25480
|
+
handleTogglePopover(true);
|
|
25481
|
+
},
|
|
25482
|
+
onBlur: function onBlur() {
|
|
25483
|
+
handleTogglePopover(false);
|
|
25484
|
+
},
|
|
25485
|
+
onKeyDown: function onKeyDown(e) {
|
|
25486
|
+
if (e.keyCode === 27) {
|
|
25487
|
+
handleTogglePopover(false);
|
|
25488
|
+
}
|
|
25489
|
+
},
|
|
25490
|
+
onTouchStart: function onTouchStart() {
|
|
25491
|
+
return handleTogglePopover(true);
|
|
25492
|
+
},
|
|
25493
|
+
onTouchEnd: function onTouchEnd() {
|
|
25494
|
+
return handleTogglePopover(false);
|
|
25495
|
+
},
|
|
25496
|
+
onMouseEnter: function onMouseEnter() {
|
|
25497
|
+
return handleTogglePopover(true);
|
|
25498
|
+
},
|
|
25499
|
+
onMouseLeave: function onMouseLeave() {
|
|
25500
|
+
return handleTogglePopover(false);
|
|
25501
|
+
},
|
|
25502
|
+
contentOverride: true,
|
|
25503
|
+
variant: "smallGhost",
|
|
25504
|
+
tabIndex: "0",
|
|
25505
|
+
id: "btnPopover".concat(popoverID),
|
|
25506
|
+
"aria-expanded": popoverOpen,
|
|
25507
|
+
"aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
|
|
25508
|
+
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25509
|
+
"aria-controls": "Disclosed".concat(popoverID),
|
|
25510
|
+
ref: triggerRef,
|
|
25511
|
+
extraStyles: buttonExtraStyles
|
|
25512
|
+
}, hasIcon && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, null), /*#__PURE__*/React.createElement(Box, {
|
|
25513
|
+
padding: "0",
|
|
25514
|
+
srOnly: true
|
|
25515
|
+
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
25516
|
+
id: "btnPopover".concat(popoverID, "_info")
|
|
25517
|
+
}, iconHelpText))), !hasIcon && /*#__PURE__*/React.createElement(Text$1, {
|
|
25518
|
+
color: popoverTriggerColor,
|
|
25519
|
+
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
25520
|
+
}, triggerText)), /*#__PURE__*/React.createElement(Box, {
|
|
25521
|
+
background: backgroundColor,
|
|
25522
|
+
borderRadius: "4px",
|
|
25523
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25524
|
+
id: "Disclosed".concat(popoverID),
|
|
25525
|
+
role: "region",
|
|
25526
|
+
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25527
|
+
tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
|
|
25528
|
+
minWidth: minWidth,
|
|
25529
|
+
maxWidth: maxWidth,
|
|
25530
|
+
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 ")
|
|
25531
|
+
}, /*#__PURE__*/React.createElement(Paragraph$1, null, content), /*#__PURE__*/React.createElement(Box, {
|
|
25532
|
+
padding: "0",
|
|
25533
|
+
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 ")
|
|
25534
|
+
})));
|
|
25535
|
+
};
|
|
25536
|
+
|
|
25537
|
+
var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
|
|
25538
|
+
|
|
25539
|
+
var DisplayCard = function DisplayCard(_ref) {
|
|
25540
|
+
var title = _ref.title,
|
|
25541
|
+
item = _ref.item,
|
|
25542
|
+
buttonText = _ref.buttonText,
|
|
25543
|
+
buttonAction = _ref.buttonAction,
|
|
25544
|
+
url = _ref.url,
|
|
25545
|
+
_ref$link = _ref.link,
|
|
25546
|
+
link = _ref$link === void 0 ? false : _ref$link,
|
|
25547
|
+
helpText = _ref.helpText,
|
|
25548
|
+
_ref$hasPopover = _ref.hasPopover,
|
|
25549
|
+
hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
|
|
25550
|
+
_ref$popoverTriggerTe = _ref.popoverTriggerText,
|
|
25551
|
+
popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
|
|
25552
|
+
_ref$popoverContent = _ref.popoverContent,
|
|
25553
|
+
popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
|
|
25554
|
+
popoverExtraStyles = _ref.popoverExtraStyles,
|
|
25555
|
+
popoverTextExtraStyles = _ref.popoverTextExtraStyles;
|
|
25556
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
25557
|
+
padding: "0 0 16px"
|
|
25558
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
25559
|
+
childGap: "0rem"
|
|
25560
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
25561
|
+
padding: "0 0 8px 0"
|
|
25562
|
+
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
25563
|
+
justify: "space-between",
|
|
25564
|
+
align: "center",
|
|
25565
|
+
overflow: true
|
|
25566
|
+
}, /*#__PURE__*/React.createElement(Paragraph$1, {
|
|
25567
|
+
variant: "pL",
|
|
25568
|
+
color: CHARADE_GREY,
|
|
25569
|
+
extraStyles: "letter-spacing: 0.29px"
|
|
25570
|
+
}, title), hasPopover && /*#__PURE__*/React.createElement(Popover$1, {
|
|
25571
|
+
triggerText: popoverTriggerText,
|
|
25572
|
+
content: popoverContent,
|
|
25573
|
+
popoverExtraStyles: popoverExtraStyles,
|
|
25574
|
+
popoverTextExtraStyles: popoverTextExtraStyles
|
|
25575
|
+
}))), /*#__PURE__*/React.createElement(Box, {
|
|
25576
|
+
padding: "0"
|
|
25577
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
25578
|
+
padding: "24px",
|
|
25579
|
+
borderSize: "1px",
|
|
25580
|
+
borderRadius: "4px",
|
|
25581
|
+
background: WHITE,
|
|
25582
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
25583
|
+
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
25584
|
+
justify: "space-between",
|
|
25585
|
+
align: "center"
|
|
25586
|
+
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
25587
|
+
color: CHARADE_GREY
|
|
25588
|
+
}, item), link ? /*#__PURE__*/React.createElement(ButtonWithLink, {
|
|
25589
|
+
text: buttonText,
|
|
25590
|
+
url: url,
|
|
25591
|
+
variant: "smallGhost",
|
|
25592
|
+
dataQa: buttonText,
|
|
25593
|
+
extraStyles: "min-width: 0;"
|
|
25594
|
+
}) : buttonAction ? /*#__PURE__*/React.createElement(ButtonWithAction, {
|
|
25595
|
+
text: buttonText,
|
|
25596
|
+
action: buttonAction,
|
|
25597
|
+
variant: "smallGhost",
|
|
25598
|
+
dataQa: buttonText,
|
|
25599
|
+
extraStyles: "min-width: 0;"
|
|
25600
|
+
}) : helpText ? /*#__PURE__*/React.createElement(Text$1, {
|
|
25601
|
+
color: STORM_GREY,
|
|
25602
|
+
extraStyles: "font-style: italic;"
|
|
25603
|
+
}, helpText) : /*#__PURE__*/React.createElement(Fragment$1, null))))));
|
|
25604
|
+
};
|
|
25605
|
+
|
|
25206
25606
|
function _extends$2() {
|
|
25207
25607
|
_extends$2 = Object.assign || function (target) {
|
|
25208
25608
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -25481,392 +25881,6 @@ var FormattedInput = function FormattedInput(_ref) {
|
|
|
25481
25881
|
}));
|
|
25482
25882
|
};
|
|
25483
25883
|
|
|
25484
|
-
var formatDelimiter = "_";
|
|
25485
|
-
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
25486
|
-
var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
|
|
25487
|
-
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
25488
|
-
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
25489
|
-
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
25490
|
-
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
25491
|
-
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
25492
|
-
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
25493
|
-
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
25494
|
-
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
25495
|
-
var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
25496
|
-
var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
|
|
25497
|
-
var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
|
|
25498
|
-
var ACTIVE = "ACTIVE";
|
|
25499
|
-
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
25500
|
-
var EXPIRED = "EXPIRED";
|
|
25501
|
-
var textMargin = textAlign === "right" ? "auto" : "0";
|
|
25502
|
-
|
|
25503
|
-
switch (expirationStatus) {
|
|
25504
|
-
case ACTIVE:
|
|
25505
|
-
return /*#__PURE__*/React.createElement(Text$1, {
|
|
25506
|
-
as: as,
|
|
25507
|
-
variant: "pXS",
|
|
25508
|
-
color: ASH_GREY,
|
|
25509
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25510
|
-
}, "Exp Date ", expireDate);
|
|
25511
|
-
|
|
25512
|
-
case EXPIRING_SOON:
|
|
25513
|
-
return /*#__PURE__*/React.createElement(Text$1, {
|
|
25514
|
-
as: as,
|
|
25515
|
-
variant: "pXS",
|
|
25516
|
-
color: FIRE_YELLOW,
|
|
25517
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25518
|
-
}, "Expiring Soon ", expireDate);
|
|
25519
|
-
|
|
25520
|
-
case EXPIRED:
|
|
25521
|
-
return /*#__PURE__*/React.createElement(Text$1, {
|
|
25522
|
-
as: as,
|
|
25523
|
-
variant: "pXS",
|
|
25524
|
-
color: ASH_GREY,
|
|
25525
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25526
|
-
}, "Expired");
|
|
25527
|
-
}
|
|
25528
|
-
};
|
|
25529
|
-
|
|
25530
|
-
var formats = /*#__PURE__*/Object.freeze({
|
|
25531
|
-
__proto__: null,
|
|
25532
|
-
formatDelimiter: formatDelimiter,
|
|
25533
|
-
phoneFormats: phoneFormats,
|
|
25534
|
-
moneyFormats: moneyFormats,
|
|
25535
|
-
expirationDateFormats: expirationDateFormats,
|
|
25536
|
-
zipFormat: zipFormat,
|
|
25537
|
-
creditCardFormat: creditCardFormat,
|
|
25538
|
-
expirationDateFormat: expirationDateFormat,
|
|
25539
|
-
phoneFormat: phoneFormat,
|
|
25540
|
-
moneyFormat: moneyFormat,
|
|
25541
|
-
renderCardStatus: renderCardStatus
|
|
25542
|
-
});
|
|
25543
|
-
|
|
25544
|
-
var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
|
|
25545
|
-
var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
25546
|
-
// Only move focus when "hasErrors" is true
|
|
25547
|
-
// "hasErrors" is managed by container page of form
|
|
25548
|
-
// typically set to "true" on attempted form submission, if errors exist
|
|
25549
|
-
// Reset errors, if provided, resets the error state tracking in order to properly re-run
|
|
25550
|
-
useEffect$1(function () {
|
|
25551
|
-
if (hasErrors) {
|
|
25552
|
-
var _inputsWithErrors$;
|
|
25553
|
-
|
|
25554
|
-
var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
|
|
25555
|
-
inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
|
|
25556
|
-
}
|
|
25557
|
-
|
|
25558
|
-
return function () {
|
|
25559
|
-
return resetHasErrors(false);
|
|
25560
|
-
};
|
|
25561
|
-
});
|
|
25562
|
-
};
|
|
25563
|
-
|
|
25564
|
-
/*
|
|
25565
|
-
Hook that assigns a click event listener to the main document element
|
|
25566
|
-
Returns a ref to attach to another element (like an icon/button that triggers a popover)
|
|
25567
|
-
If a click event gets captured by the document and the assigned element isn't the target
|
|
25568
|
-
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
25569
|
-
|
|
25570
|
-
See popover component for implementation
|
|
25571
|
-
|
|
25572
|
-
*/
|
|
25573
|
-
|
|
25574
|
-
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
25575
|
-
var ref = useRef();
|
|
25576
|
-
useEffect$1(function () {
|
|
25577
|
-
}, [ref]);
|
|
25578
|
-
return ref;
|
|
25579
|
-
};
|
|
25580
|
-
|
|
25581
|
-
var initialToastState = {
|
|
25582
|
-
isOpen: false,
|
|
25583
|
-
variant: "",
|
|
25584
|
-
message: ""
|
|
25585
|
-
};
|
|
25586
|
-
|
|
25587
|
-
var useToastNotification = function useToastNotification() {
|
|
25588
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
25589
|
-
_ref$timeout = _ref.timeout,
|
|
25590
|
-
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
25591
|
-
|
|
25592
|
-
var _useState = useState(initialToastState),
|
|
25593
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25594
|
-
toastState = _useState2[0],
|
|
25595
|
-
setToastState = _useState2[1];
|
|
25596
|
-
|
|
25597
|
-
useEffect$1(function () {
|
|
25598
|
-
if (toastState.isOpen) {
|
|
25599
|
-
setTimeout(function () {
|
|
25600
|
-
setToastState(initialToastState);
|
|
25601
|
-
}, timeout);
|
|
25602
|
-
}
|
|
25603
|
-
}, [timeout, toastState.isOpen]);
|
|
25604
|
-
|
|
25605
|
-
var showToast = function showToast(_ref2) {
|
|
25606
|
-
var message = _ref2.message,
|
|
25607
|
-
variant = _ref2.variant;
|
|
25608
|
-
return setToastState({
|
|
25609
|
-
isOpen: true,
|
|
25610
|
-
variant: variant,
|
|
25611
|
-
message: message
|
|
25612
|
-
});
|
|
25613
|
-
};
|
|
25614
|
-
|
|
25615
|
-
var hideToast = function hideToast() {
|
|
25616
|
-
return setToastState(initialToastState);
|
|
25617
|
-
};
|
|
25618
|
-
|
|
25619
|
-
return {
|
|
25620
|
-
isToastOpen: toastState.isOpen,
|
|
25621
|
-
toastVariant: toastState.variant,
|
|
25622
|
-
toastMessage: toastState.message,
|
|
25623
|
-
showToast: showToast,
|
|
25624
|
-
hideToast: hideToast
|
|
25625
|
-
};
|
|
25626
|
-
};
|
|
25627
|
-
|
|
25628
|
-
|
|
25629
|
-
|
|
25630
|
-
var index$4 = /*#__PURE__*/Object.freeze({
|
|
25631
|
-
__proto__: null,
|
|
25632
|
-
formats: formats,
|
|
25633
|
-
general: general,
|
|
25634
|
-
theme: themeUtils,
|
|
25635
|
-
useFocusInvalidInput: useFocusInvalidInput,
|
|
25636
|
-
useOutsideClick: useOutsideClickHook,
|
|
25637
|
-
useToastNotification: useToastNotification
|
|
25638
|
-
});
|
|
25639
|
-
|
|
25640
|
-
var hoverColor$4 = "#116285";
|
|
25641
|
-
var activeColor$4 = "#0E506D";
|
|
25642
|
-
var popoverTriggerColor = "#15749D";
|
|
25643
|
-
var fallbackValues$j = {
|
|
25644
|
-
hoverColor: hoverColor$4,
|
|
25645
|
-
activeColor: activeColor$4,
|
|
25646
|
-
popoverTriggerColor: popoverTriggerColor
|
|
25647
|
-
};
|
|
25648
|
-
|
|
25649
|
-
var arrowBorder = function arrowBorder(borderColor, direction) {
|
|
25650
|
-
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
|
|
25651
|
-
var angle = "".concat(width, " solid transparent");
|
|
25652
|
-
var straight = "".concat(width, " solid ").concat(borderColor);
|
|
25653
|
-
|
|
25654
|
-
if (direction == "down") {
|
|
25655
|
-
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
|
|
25656
|
-
} else if (direction == "up") {
|
|
25657
|
-
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
|
|
25658
|
-
} else if (direction == "left") {
|
|
25659
|
-
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
|
|
25660
|
-
} else if (direction == "right") {
|
|
25661
|
-
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
|
|
25662
|
-
}
|
|
25663
|
-
};
|
|
25664
|
-
|
|
25665
|
-
var Popover = function Popover(_ref) {
|
|
25666
|
-
var themeValues = _ref.themeValues,
|
|
25667
|
-
_ref$triggerText = _ref.triggerText,
|
|
25668
|
-
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
25669
|
-
_ref$content = _ref.content,
|
|
25670
|
-
content = _ref$content === void 0 ? "" : _ref$content,
|
|
25671
|
-
_ref$hasIcon = _ref.hasIcon,
|
|
25672
|
-
hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
|
|
25673
|
-
Icon = _ref.icon,
|
|
25674
|
-
_ref$iconHelpText = _ref.iconHelpText,
|
|
25675
|
-
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
25676
|
-
_ref$popoverID = _ref.popoverID,
|
|
25677
|
-
popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
|
|
25678
|
-
_ref$popoverFocus = _ref.popoverFocus,
|
|
25679
|
-
popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
|
|
25680
|
-
extraStyles = _ref.extraStyles,
|
|
25681
|
-
textExtraStyles = _ref.textExtraStyles,
|
|
25682
|
-
_ref$minWidth = _ref.minWidth,
|
|
25683
|
-
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
25684
|
-
_ref$maxWidth = _ref.maxWidth,
|
|
25685
|
-
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
25686
|
-
_ref$height = _ref.height,
|
|
25687
|
-
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
25688
|
-
position = _ref.position,
|
|
25689
|
-
arrowPosition = _ref.arrowPosition,
|
|
25690
|
-
_ref$arrowDirection = _ref.arrowDirection,
|
|
25691
|
-
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
25692
|
-
_ref$transform = _ref.transform,
|
|
25693
|
-
transform = _ref$transform === void 0 ? "none" : _ref$transform,
|
|
25694
|
-
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
25695
|
-
_ref$backgroundColor = _ref.backgroundColor,
|
|
25696
|
-
backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
|
|
25697
|
-
_ref$borderColor = _ref.borderColor,
|
|
25698
|
-
borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
|
|
25699
|
-
popoverExtraStyles = _ref.popoverExtraStyles;
|
|
25700
|
-
var hoverColor = themeValues.hoverColor,
|
|
25701
|
-
activeColor = themeValues.activeColor,
|
|
25702
|
-
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
25703
|
-
|
|
25704
|
-
var _ref2 = position !== null && position !== void 0 ? position : {},
|
|
25705
|
-
_ref2$top = _ref2.top,
|
|
25706
|
-
top = _ref2$top === void 0 ? "-110px" : _ref2$top,
|
|
25707
|
-
_ref2$right = _ref2.right,
|
|
25708
|
-
right = _ref2$right === void 0 ? "auto" : _ref2$right,
|
|
25709
|
-
_ref2$bottom = _ref2.bottom,
|
|
25710
|
-
bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
|
|
25711
|
-
_ref2$left = _ref2.left,
|
|
25712
|
-
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
25713
|
-
|
|
25714
|
-
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
25715
|
-
_ref3$arrowTop = _ref3.arrowTop,
|
|
25716
|
-
arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
|
|
25717
|
-
_ref3$arrowRight = _ref3.arrowRight,
|
|
25718
|
-
arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
|
|
25719
|
-
_ref3$arrowBottom = _ref3.arrowBottom,
|
|
25720
|
-
arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
|
|
25721
|
-
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
25722
|
-
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
25723
|
-
|
|
25724
|
-
var _useState = useState(false),
|
|
25725
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
25726
|
-
popoverOpen = _useState2[0],
|
|
25727
|
-
togglePopover = _useState2[1];
|
|
25728
|
-
|
|
25729
|
-
var handleTogglePopover = function handleTogglePopover(popoverState) {
|
|
25730
|
-
if (popoverOpen !== popoverState) {
|
|
25731
|
-
togglePopover(popoverState);
|
|
25732
|
-
}
|
|
25733
|
-
};
|
|
25734
|
-
|
|
25735
|
-
var triggerRef = useOutsideClickHook();
|
|
25736
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
25737
|
-
padding: "0",
|
|
25738
|
-
extraStyles: "position: relative; ".concat(extraStyles)
|
|
25739
|
-
}, /*#__PURE__*/React.createElement(ButtonWithAction, {
|
|
25740
|
-
action: function action() {
|
|
25741
|
-
return noop;
|
|
25742
|
-
},
|
|
25743
|
-
onFocus: function onFocus() {
|
|
25744
|
-
handleTogglePopover(true);
|
|
25745
|
-
},
|
|
25746
|
-
onBlur: function onBlur() {
|
|
25747
|
-
handleTogglePopover(false);
|
|
25748
|
-
},
|
|
25749
|
-
onKeyDown: function onKeyDown(e) {
|
|
25750
|
-
if (e.keyCode === 27) {
|
|
25751
|
-
handleTogglePopover(false);
|
|
25752
|
-
}
|
|
25753
|
-
},
|
|
25754
|
-
onTouchStart: function onTouchStart() {
|
|
25755
|
-
return handleTogglePopover(true);
|
|
25756
|
-
},
|
|
25757
|
-
onTouchEnd: function onTouchEnd() {
|
|
25758
|
-
return handleTogglePopover(false);
|
|
25759
|
-
},
|
|
25760
|
-
onMouseEnter: function onMouseEnter() {
|
|
25761
|
-
return handleTogglePopover(true);
|
|
25762
|
-
},
|
|
25763
|
-
onMouseLeave: function onMouseLeave() {
|
|
25764
|
-
return handleTogglePopover(false);
|
|
25765
|
-
},
|
|
25766
|
-
contentOverride: true,
|
|
25767
|
-
variant: "smallGhost",
|
|
25768
|
-
tabIndex: "0",
|
|
25769
|
-
id: "btnPopover".concat(popoverID),
|
|
25770
|
-
"aria-expanded": popoverOpen,
|
|
25771
|
-
"aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
|
|
25772
|
-
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25773
|
-
"aria-controls": "Disclosed".concat(popoverID),
|
|
25774
|
-
ref: triggerRef,
|
|
25775
|
-
extraStyles: buttonExtraStyles
|
|
25776
|
-
}, hasIcon && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, null), /*#__PURE__*/React.createElement(Box, {
|
|
25777
|
-
padding: "0",
|
|
25778
|
-
srOnly: true
|
|
25779
|
-
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
25780
|
-
id: "btnPopover".concat(popoverID, "_info")
|
|
25781
|
-
}, iconHelpText))), !hasIcon && /*#__PURE__*/React.createElement(Text$1, {
|
|
25782
|
-
color: popoverTriggerColor,
|
|
25783
|
-
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
25784
|
-
}, triggerText)), /*#__PURE__*/React.createElement(Box, {
|
|
25785
|
-
background: backgroundColor,
|
|
25786
|
-
borderRadius: "4px",
|
|
25787
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25788
|
-
id: "Disclosed".concat(popoverID),
|
|
25789
|
-
role: "region",
|
|
25790
|
-
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25791
|
-
tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
|
|
25792
|
-
minWidth: minWidth,
|
|
25793
|
-
maxWidth: maxWidth,
|
|
25794
|
-
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 ")
|
|
25795
|
-
}, /*#__PURE__*/React.createElement(Paragraph$1, null, content), /*#__PURE__*/React.createElement(Box, {
|
|
25796
|
-
padding: "0",
|
|
25797
|
-
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 ")
|
|
25798
|
-
})));
|
|
25799
|
-
};
|
|
25800
|
-
|
|
25801
|
-
var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
|
|
25802
|
-
|
|
25803
|
-
var DisplayCard = function DisplayCard(_ref) {
|
|
25804
|
-
var title = _ref.title,
|
|
25805
|
-
item = _ref.item,
|
|
25806
|
-
buttonText = _ref.buttonText,
|
|
25807
|
-
buttonAction = _ref.buttonAction,
|
|
25808
|
-
url = _ref.url,
|
|
25809
|
-
_ref$link = _ref.link,
|
|
25810
|
-
link = _ref$link === void 0 ? false : _ref$link,
|
|
25811
|
-
helpText = _ref.helpText,
|
|
25812
|
-
_ref$hasPopover = _ref.hasPopover,
|
|
25813
|
-
hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
|
|
25814
|
-
_ref$popoverTriggerTe = _ref.popoverTriggerText,
|
|
25815
|
-
popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
|
|
25816
|
-
_ref$popoverContent = _ref.popoverContent,
|
|
25817
|
-
popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
|
|
25818
|
-
popoverExtraStyles = _ref.popoverExtraStyles,
|
|
25819
|
-
popoverTextExtraStyles = _ref.popoverTextExtraStyles;
|
|
25820
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
25821
|
-
padding: "0 0 16px"
|
|
25822
|
-
}, /*#__PURE__*/React.createElement(Stack, {
|
|
25823
|
-
childGap: "0rem"
|
|
25824
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
25825
|
-
padding: "0 0 8px 0"
|
|
25826
|
-
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
25827
|
-
justify: "space-between",
|
|
25828
|
-
align: "center",
|
|
25829
|
-
overflow: true
|
|
25830
|
-
}, /*#__PURE__*/React.createElement(Paragraph$1, {
|
|
25831
|
-
variant: "pL",
|
|
25832
|
-
color: CHARADE_GREY,
|
|
25833
|
-
extraStyles: "letter-spacing: 0.29px"
|
|
25834
|
-
}, title), hasPopover && /*#__PURE__*/React.createElement(Popover$1, {
|
|
25835
|
-
triggerText: popoverTriggerText,
|
|
25836
|
-
content: popoverContent,
|
|
25837
|
-
popoverExtraStyles: popoverExtraStyles,
|
|
25838
|
-
popoverTextExtraStyles: popoverTextExtraStyles
|
|
25839
|
-
}))), /*#__PURE__*/React.createElement(Box, {
|
|
25840
|
-
padding: "0"
|
|
25841
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
25842
|
-
padding: "24px",
|
|
25843
|
-
borderSize: "1px",
|
|
25844
|
-
borderRadius: "4px",
|
|
25845
|
-
background: WHITE,
|
|
25846
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
25847
|
-
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
25848
|
-
justify: "space-between",
|
|
25849
|
-
align: "center"
|
|
25850
|
-
}, /*#__PURE__*/React.createElement(Text$1, {
|
|
25851
|
-
color: CHARADE_GREY
|
|
25852
|
-
}, item), link ? /*#__PURE__*/React.createElement(ButtonWithLink, {
|
|
25853
|
-
text: buttonText,
|
|
25854
|
-
url: url,
|
|
25855
|
-
variant: "smallGhost",
|
|
25856
|
-
dataQa: buttonText,
|
|
25857
|
-
extraStyles: "min-width: 0;"
|
|
25858
|
-
}) : buttonAction ? /*#__PURE__*/React.createElement(ButtonWithAction, {
|
|
25859
|
-
text: buttonText,
|
|
25860
|
-
action: buttonAction,
|
|
25861
|
-
variant: "smallGhost",
|
|
25862
|
-
dataQa: buttonText,
|
|
25863
|
-
extraStyles: "min-width: 0;"
|
|
25864
|
-
}) : helpText ? /*#__PURE__*/React.createElement(Text$1, {
|
|
25865
|
-
color: STORM_GREY,
|
|
25866
|
-
extraStyles: "font-style: italic;"
|
|
25867
|
-
}, helpText) : /*#__PURE__*/React.createElement(Fragment$1, null))))));
|
|
25868
|
-
};
|
|
25869
|
-
|
|
25870
25884
|
var linkColor$2 = {
|
|
25871
25885
|
"default": "".concat(MATISSE_BLUE),
|
|
25872
25886
|
disabled: "".concat(MATISSE_BLUE)
|
|
@@ -25932,7 +25946,7 @@ var fallbackValues$k = {
|
|
|
25932
25946
|
};
|
|
25933
25947
|
|
|
25934
25948
|
var _excluded$p = ["showErrors", "themeValues"],
|
|
25935
|
-
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa"];
|
|
25949
|
+
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"];
|
|
25936
25950
|
var InputField = styled.input.withConfig({
|
|
25937
25951
|
displayName: "FormInput__InputField",
|
|
25938
25952
|
componentId: "sc-l094r1-0"
|
|
@@ -26019,6 +26033,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
26019
26033
|
removeFromValue = _ref15.removeFromValue,
|
|
26020
26034
|
_ref15$dataQa = _ref15.dataQa,
|
|
26021
26035
|
dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
|
|
26036
|
+
_ref15$isRequired = _ref15.isRequired,
|
|
26037
|
+
isRequired = _ref15$isRequired === void 0 ? false : _ref15$isRequired,
|
|
26022
26038
|
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
26023
26039
|
|
|
26024
26040
|
var _useState = useState(false),
|
|
@@ -26105,7 +26121,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
26105
26121
|
$customHeight: customHeight,
|
|
26106
26122
|
$extraStyles: extraStyles,
|
|
26107
26123
|
"data-qa": dataQa || labelTextWhenNoError,
|
|
26108
|
-
autoComplete: autocompleteValue
|
|
26124
|
+
autoComplete: autocompleteValue,
|
|
26125
|
+
required: isRequired
|
|
26109
26126
|
}, props)) : /*#__PURE__*/React.createElement(InputField, _extends({
|
|
26110
26127
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
26111
26128
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
@@ -26124,7 +26141,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
26124
26141
|
$customHeight: customHeight,
|
|
26125
26142
|
$extraStyles: extraStyles,
|
|
26126
26143
|
"data-qa": dataQa || labelTextWhenNoError,
|
|
26127
|
-
autoComplete: autocompleteValue
|
|
26144
|
+
autoComplete: autocompleteValue,
|
|
26145
|
+
required: isRequired
|
|
26128
26146
|
}, props))), /*#__PURE__*/React.createElement(Stack, {
|
|
26129
26147
|
direction: "row",
|
|
26130
26148
|
justify: "space-between",
|
|
@@ -26333,6 +26351,66 @@ var fallbackValues$n = {
|
|
|
26333
26351
|
autopayTextColor: autopayTextColor$1
|
|
26334
26352
|
};
|
|
26335
26353
|
|
|
26354
|
+
var formatDelimiter = "_";
|
|
26355
|
+
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
26356
|
+
var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
|
|
26357
|
+
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
26358
|
+
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
26359
|
+
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
26360
|
+
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
26361
|
+
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
26362
|
+
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
26363
|
+
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
26364
|
+
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
26365
|
+
var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
26366
|
+
var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
|
|
26367
|
+
var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
|
|
26368
|
+
var ACTIVE = "ACTIVE";
|
|
26369
|
+
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
26370
|
+
var EXPIRED = "EXPIRED";
|
|
26371
|
+
var textMargin = textAlign === "right" ? "auto" : "0";
|
|
26372
|
+
|
|
26373
|
+
switch (expirationStatus) {
|
|
26374
|
+
case ACTIVE:
|
|
26375
|
+
return /*#__PURE__*/React.createElement(Text$1, {
|
|
26376
|
+
as: as,
|
|
26377
|
+
variant: "pXS",
|
|
26378
|
+
color: ASH_GREY,
|
|
26379
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26380
|
+
}, "Exp Date ", expireDate);
|
|
26381
|
+
|
|
26382
|
+
case EXPIRING_SOON:
|
|
26383
|
+
return /*#__PURE__*/React.createElement(Text$1, {
|
|
26384
|
+
as: as,
|
|
26385
|
+
variant: "pXS",
|
|
26386
|
+
color: FIRE_YELLOW,
|
|
26387
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26388
|
+
}, "Expiring Soon ", expireDate);
|
|
26389
|
+
|
|
26390
|
+
case EXPIRED:
|
|
26391
|
+
return /*#__PURE__*/React.createElement(Text$1, {
|
|
26392
|
+
as: as,
|
|
26393
|
+
variant: "pXS",
|
|
26394
|
+
color: ASH_GREY,
|
|
26395
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26396
|
+
}, "Expired");
|
|
26397
|
+
}
|
|
26398
|
+
};
|
|
26399
|
+
|
|
26400
|
+
var formats = /*#__PURE__*/Object.freeze({
|
|
26401
|
+
__proto__: null,
|
|
26402
|
+
formatDelimiter: formatDelimiter,
|
|
26403
|
+
phoneFormats: phoneFormats,
|
|
26404
|
+
moneyFormats: moneyFormats,
|
|
26405
|
+
expirationDateFormats: expirationDateFormats,
|
|
26406
|
+
zipFormat: zipFormat,
|
|
26407
|
+
creditCardFormat: creditCardFormat,
|
|
26408
|
+
expirationDateFormat: expirationDateFormat,
|
|
26409
|
+
phoneFormat: phoneFormat,
|
|
26410
|
+
moneyFormat: moneyFormat,
|
|
26411
|
+
renderCardStatus: renderCardStatus
|
|
26412
|
+
});
|
|
26413
|
+
|
|
26336
26414
|
var CreditCardWrapper = styled.div.withConfig({
|
|
26337
26415
|
displayName: "FormattedCreditCard__CreditCardWrapper",
|
|
26338
26416
|
componentId: "sc-s0ta5l-0"
|
|
@@ -27197,7 +27275,7 @@ var HiddenRadioInput = styled.input.withConfig({
|
|
|
27197
27275
|
var Circle = styled.div.withConfig({
|
|
27198
27276
|
displayName: "RadioButtonWithLabel__Circle",
|
|
27199
27277
|
componentId: "sc-1m9whwg-1"
|
|
27200
|
-
})(["flex-shrink:0;margin-right:8px;width:1.5rem;height
|
|
27278
|
+
})(["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) {
|
|
27201
27279
|
var inactiveBorderColor = _ref.inactiveBorderColor;
|
|
27202
27280
|
return "1px solid ".concat(inactiveBorderColor);
|
|
27203
27281
|
}, function (_ref2) {
|
|
@@ -27207,12 +27285,12 @@ var Circle = styled.div.withConfig({
|
|
|
27207
27285
|
var InputAndLabelContainer = styled(Cluster).withConfig({
|
|
27208
27286
|
displayName: "RadioButtonWithLabel__InputAndLabelContainer",
|
|
27209
27287
|
componentId: "sc-1m9whwg-2"
|
|
27210
|
-
})(["overflow:visible;", ":checked + label ", ":after{transform:scale(0.85);transition:transform 0.15s;}", ":checked + label ", "{border:", "}", ":focus + label ", "{
|
|
27288
|
+
})(["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) {
|
|
27211
27289
|
var activeColor = _ref3.activeColor;
|
|
27212
|
-
return "1px solid "
|
|
27290
|
+
return "1px solid " + activeColor;
|
|
27213
27291
|
}, HiddenRadioInput, Circle, function (_ref4) {
|
|
27214
27292
|
var activeColor = _ref4.activeColor;
|
|
27215
|
-
return "0px 0px 2px 1px "
|
|
27293
|
+
return "0px 0px 2px 1px " + activeColor;
|
|
27216
27294
|
});
|
|
27217
27295
|
|
|
27218
27296
|
var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
@@ -27277,7 +27355,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
|
|
|
27277
27355
|
var RadioButtonWithLabel$1 = themeComponent(RadioButtonWithLabel, "RadioButtonWithLabel", fallbackValues$u);
|
|
27278
27356
|
|
|
27279
27357
|
var activeColor$6 = "".concat(MATISSE_BLUE);
|
|
27280
|
-
var inactiveColor = "".concat(
|
|
27358
|
+
var inactiveColor = "".concat(STORM_GREY);
|
|
27281
27359
|
var fallbackValues$v = {
|
|
27282
27360
|
activeColor: activeColor$6,
|
|
27283
27361
|
inactiveColor: inactiveColor
|
|
@@ -27306,23 +27384,27 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27306
27384
|
_ref2$ariaLabelledBy = _ref2.ariaLabelledBy,
|
|
27307
27385
|
ariaLabelledBy = _ref2$ariaLabelledBy === void 0 ? "" : _ref2$ariaLabelledBy,
|
|
27308
27386
|
_ref2$ariaLabel = _ref2.ariaLabel,
|
|
27309
|
-
ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel
|
|
27387
|
+
ariaLabel = _ref2$ariaLabel === void 0 ? null : _ref2$ariaLabel,
|
|
27388
|
+
_ref2$required = _ref2.required,
|
|
27389
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
27310
27390
|
var buttonBorder = {
|
|
27311
27391
|
onFocused: {
|
|
27312
27392
|
borderColor: themeValues.activeColor,
|
|
27313
|
-
|
|
27393
|
+
outline: "3px solid ".concat(themeValues.activeColor),
|
|
27394
|
+
outlineOffset: "2px"
|
|
27314
27395
|
},
|
|
27315
27396
|
offFocused: {
|
|
27316
27397
|
borderColor: themeValues.activeColor,
|
|
27317
|
-
|
|
27398
|
+
outline: "3px solid ".concat(themeValues.activeColor),
|
|
27399
|
+
outlineOffset: "2px"
|
|
27318
27400
|
},
|
|
27319
27401
|
on: {
|
|
27320
27402
|
borderColor: themeValues.activeColor,
|
|
27321
|
-
|
|
27403
|
+
outline: "0"
|
|
27322
27404
|
},
|
|
27323
27405
|
off: {
|
|
27324
27406
|
borderColor: themeValues.inactiveColor,
|
|
27325
|
-
|
|
27407
|
+
outline: "0"
|
|
27326
27408
|
}
|
|
27327
27409
|
};
|
|
27328
27410
|
var buttonCenter = {
|
|
@@ -27364,6 +27446,8 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27364
27446
|
type: "radio",
|
|
27365
27447
|
id: "radio-".concat(name),
|
|
27366
27448
|
disabled: disabled,
|
|
27449
|
+
required: required,
|
|
27450
|
+
"aria-required": required,
|
|
27367
27451
|
onClick: toggleRadio,
|
|
27368
27452
|
"aria-describedby": ariaDescribedBy,
|
|
27369
27453
|
tabIndex: "-1"
|
|
@@ -27371,7 +27455,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
|
|
|
27371
27455
|
borderWidth: "1px",
|
|
27372
27456
|
borderStyle: "solid",
|
|
27373
27457
|
borderRadius: "12px",
|
|
27374
|
-
margin: "
|
|
27458
|
+
margin: "6px 14px 6px 6px",
|
|
27375
27459
|
height: "24px",
|
|
27376
27460
|
width: "24px",
|
|
27377
27461
|
variants: buttonBorder,
|
|
@@ -38056,7 +38140,9 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
38056
38140
|
field = _ref.field,
|
|
38057
38141
|
fieldActions = _ref.fieldActions,
|
|
38058
38142
|
showErrors = _ref.showErrors,
|
|
38059
|
-
countryCode = _ref.countryCode
|
|
38143
|
+
countryCode = _ref.countryCode,
|
|
38144
|
+
_ref$isRequired = _ref.isRequired,
|
|
38145
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
38060
38146
|
var placeholder = countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
|
|
38061
38147
|
var options = [placeholder].concat(_toConsumableArray(getOptions(countryCode)));
|
|
38062
38148
|
return /*#__PURE__*/React.createElement(FormSelect$1, {
|
|
@@ -38066,7 +38152,8 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
38066
38152
|
labelTextWhenNoError: labelTextWhenNoError,
|
|
38067
38153
|
errorMessages: errorMessages,
|
|
38068
38154
|
showErrors: showErrors,
|
|
38069
|
-
autocompleteValue: "address-level1"
|
|
38155
|
+
autocompleteValue: "address-level1",
|
|
38156
|
+
isRequired: isRequired
|
|
38070
38157
|
});
|
|
38071
38158
|
};
|
|
38072
38159
|
|
|
@@ -38690,44 +38777,52 @@ var TableHeading_styled = styled.th.withConfig({
|
|
|
38690
38777
|
return extraStyles;
|
|
38691
38778
|
});
|
|
38692
38779
|
|
|
38693
|
-
const validatorToPredicate =
|
|
38694
|
-
|
|
38695
|
-
...rest
|
|
38696
|
-
|
|
38780
|
+
const validatorToPredicate =
|
|
38781
|
+
(validatorFn, emptyCase) =>
|
|
38782
|
+
(value, ...rest) =>
|
|
38783
|
+
value === '' ? emptyCase : validatorFn(value, ...rest);
|
|
38697
38784
|
|
|
38698
38785
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
38699
38786
|
|
|
38787
|
+
function getDefaultExportFromCjs (x) {
|
|
38788
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
38789
|
+
}
|
|
38790
|
+
|
|
38700
38791
|
var dayjs_min = {exports: {}};
|
|
38701
38792
|
|
|
38702
38793
|
(function (module, exports) {
|
|
38703
|
-
!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"
|
|
38704
|
-
}(dayjs_min));
|
|
38794
|
+
!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}));
|
|
38795
|
+
} (dayjs_min));
|
|
38705
38796
|
|
|
38706
|
-
var
|
|
38797
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
38798
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
38707
38799
|
|
|
38708
38800
|
var customParseFormat$1 = {exports: {}};
|
|
38709
38801
|
|
|
38710
38802
|
(function (module, exports) {
|
|
38711
|
-
!function(t
|
|
38712
|
-
}(customParseFormat$1));
|
|
38803
|
+
!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);};}}));
|
|
38804
|
+
} (customParseFormat$1));
|
|
38713
38805
|
|
|
38714
|
-
var
|
|
38806
|
+
var customParseFormatExports = customParseFormat$1.exports;
|
|
38807
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
38715
38808
|
|
|
38716
38809
|
var isSameOrBefore$1 = {exports: {}};
|
|
38717
38810
|
|
|
38718
38811
|
(function (module, exports) {
|
|
38719
|
-
!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)};}}));
|
|
38720
|
-
}(isSameOrBefore$1));
|
|
38812
|
+
!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)};}}));
|
|
38813
|
+
} (isSameOrBefore$1));
|
|
38721
38814
|
|
|
38722
|
-
var
|
|
38815
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
38816
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
38723
38817
|
|
|
38724
38818
|
var isSameOrAfter$1 = {exports: {}};
|
|
38725
38819
|
|
|
38726
38820
|
(function (module, exports) {
|
|
38727
|
-
!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)};}}));
|
|
38728
|
-
}(isSameOrAfter$1));
|
|
38821
|
+
!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)};}}));
|
|
38822
|
+
} (isSameOrAfter$1));
|
|
38729
38823
|
|
|
38730
|
-
var
|
|
38824
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
38825
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
38731
38826
|
|
|
38732
38827
|
/* eslint-disable no-unused-vars */
|
|
38733
38828
|
|
|
@@ -38743,24 +38838,24 @@ dayjs.extend(isSameOrAfter);
|
|
|
38743
38838
|
|
|
38744
38839
|
let validatorFns = {};
|
|
38745
38840
|
|
|
38746
|
-
const INCLUDED_IN =
|
|
38747
|
-
const INCLUDED_IN_ERROR =
|
|
38841
|
+
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
38842
|
+
const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
|
|
38748
38843
|
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
38749
38844
|
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
38750
38845
|
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
38751
38846
|
|
|
38752
|
-
const REQUIRED =
|
|
38753
|
-
const REQUIRED_ERROR =
|
|
38847
|
+
const REQUIRED = 'validator/REQUIRED';
|
|
38848
|
+
const REQUIRED_ERROR = 'error/REQUIRED';
|
|
38754
38849
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
38755
|
-
validatorFns[REQUIRED] = (value, args, form) => value !==
|
|
38850
|
+
validatorFns[REQUIRED] = (value, args, form) => value !== '';
|
|
38756
38851
|
|
|
38757
|
-
const ONLY_INTEGERS =
|
|
38758
|
-
const ONLY_INTEGERS_ERROR =
|
|
38852
|
+
const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
|
|
38853
|
+
const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
|
|
38759
38854
|
const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
38760
38855
|
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
38761
38856
|
|
|
38762
|
-
const ONLY_NATURALS =
|
|
38763
|
-
const ONLY_NATURALS_ERROR =
|
|
38857
|
+
const ONLY_NATURALS = 'validator/ONLY_NATURALS';
|
|
38858
|
+
const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
|
|
38764
38859
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
38765
38860
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
38766
38861
|
|
|
@@ -38773,8 +38868,8 @@ not tested as validation function
|
|
|
38773
38868
|
to validate exp date instead use combo of:
|
|
38774
38869
|
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
38775
38870
|
*/
|
|
38776
|
-
const ONLY_EXPIRATION_DATE =
|
|
38777
|
-
const ONLY_EXPIRATION_DATE_ERROR =
|
|
38871
|
+
const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
|
|
38872
|
+
const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
|
|
38778
38873
|
const onlyExpirationDate = createValidator(
|
|
38779
38874
|
ONLY_EXPIRATION_DATE,
|
|
38780
38875
|
ONLY_EXPIRATION_DATE_ERROR
|
|
@@ -38782,64 +38877,63 @@ const onlyExpirationDate = createValidator(
|
|
|
38782
38877
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
38783
38878
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
38784
38879
|
|
|
38785
|
-
const NUMBER_LESS_THAN =
|
|
38786
|
-
const NUMBER_LESS_THAN_ERROR =
|
|
38880
|
+
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
38881
|
+
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
38787
38882
|
const numberLessThan = createValidator(
|
|
38788
38883
|
NUMBER_LESS_THAN,
|
|
38789
38884
|
NUMBER_LESS_THAN_ERROR
|
|
38790
38885
|
);
|
|
38791
38886
|
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
38792
|
-
if (value ===
|
|
38887
|
+
if (value === '') {
|
|
38793
38888
|
return true;
|
|
38794
38889
|
}
|
|
38795
38890
|
return Number(value) < args[0];
|
|
38796
38891
|
};
|
|
38797
38892
|
|
|
38798
|
-
const NUMBER_LESS_THAN_OR_EQUAL_TO =
|
|
38799
|
-
"validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
38893
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38800
38894
|
const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
|
|
38801
|
-
|
|
38895
|
+
'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38802
38896
|
const numberLessThanOrEqualTo = createValidator(
|
|
38803
38897
|
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
38804
38898
|
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
38805
38899
|
);
|
|
38806
38900
|
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38807
|
-
if (value ===
|
|
38901
|
+
if (value === '') {
|
|
38808
38902
|
return true;
|
|
38809
38903
|
}
|
|
38810
38904
|
return Number(value) <= args[0];
|
|
38811
38905
|
};
|
|
38812
38906
|
|
|
38813
|
-
const NUMBER_GREATER_THAN =
|
|
38814
|
-
const NUMBER_GREATER_THAN_ERROR =
|
|
38907
|
+
const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
|
|
38908
|
+
const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
|
|
38815
38909
|
const numberGreaterThan = createValidator(
|
|
38816
38910
|
NUMBER_GREATER_THAN,
|
|
38817
38911
|
NUMBER_GREATER_THAN_ERROR
|
|
38818
38912
|
);
|
|
38819
38913
|
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
38820
|
-
if (value ===
|
|
38914
|
+
if (value === '') {
|
|
38821
38915
|
return true;
|
|
38822
38916
|
}
|
|
38823
38917
|
return Number(value) > args[0];
|
|
38824
38918
|
};
|
|
38825
38919
|
|
|
38826
38920
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO =
|
|
38827
|
-
|
|
38921
|
+
'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38828
38922
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
|
|
38829
|
-
|
|
38923
|
+
'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38830
38924
|
const numberGreaterThanOrEqualTo = createValidator(
|
|
38831
38925
|
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
38832
38926
|
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
38833
38927
|
);
|
|
38834
38928
|
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38835
|
-
if (value ===
|
|
38929
|
+
if (value === '') {
|
|
38836
38930
|
return true;
|
|
38837
38931
|
}
|
|
38838
38932
|
return Number(value) >= args[0];
|
|
38839
38933
|
};
|
|
38840
38934
|
|
|
38841
|
-
const MATCHES_FIELD =
|
|
38842
|
-
const MATCHES_FIELD_ERROR$1 =
|
|
38935
|
+
const MATCHES_FIELD = 'validator/MATCHES_FIELD';
|
|
38936
|
+
const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
|
|
38843
38937
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
38844
38938
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
38845
38939
|
const dependentField = form[args[0]];
|
|
@@ -38852,7 +38946,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
|
38852
38946
|
return value === dependentFieldValue;
|
|
38853
38947
|
};
|
|
38854
38948
|
|
|
38855
|
-
const validateWhenErrorMessage = type =>
|
|
38949
|
+
const validateWhenErrorMessage = (type) =>
|
|
38856
38950
|
`${type} was passed to validateWhen, but that validator type does not exist.
|
|
38857
38951
|
Please check that you are only calling validator creator functions exported from
|
|
38858
38952
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -38860,25 +38954,21 @@ const validateWhenErrorMessage = type =>
|
|
|
38860
38954
|
createFormState). Also make sure you aren't passing validateWhen() to validateWhen
|
|
38861
38955
|
as the primary validator.`;
|
|
38862
38956
|
|
|
38863
|
-
const VALIDATE_WHEN =
|
|
38864
|
-
const VALIDATE_WHEN_ERROR =
|
|
38865
|
-
const validateWhen = (
|
|
38866
|
-
dependentValidator,
|
|
38867
|
-
primaryValidator,
|
|
38868
|
-
optionalFieldName
|
|
38869
|
-
) => ({
|
|
38957
|
+
const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
|
|
38958
|
+
const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
|
|
38959
|
+
const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
|
|
38870
38960
|
type: VALIDATE_WHEN,
|
|
38871
38961
|
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
38872
|
-
error: dependentValidator.error
|
|
38962
|
+
error: dependentValidator.error,
|
|
38873
38963
|
});
|
|
38874
38964
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
38875
38965
|
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
38876
38966
|
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
38877
|
-
const dependsOnOtherField = typeof optionalFieldName ===
|
|
38967
|
+
const dependsOnOtherField = typeof optionalFieldName === 'string';
|
|
38878
38968
|
|
|
38879
38969
|
if (
|
|
38880
38970
|
primaryValidator.type === undefined ||
|
|
38881
|
-
typeof validatorFns[primaryValidator.type] !==
|
|
38971
|
+
typeof validatorFns[primaryValidator.type] !== 'function'
|
|
38882
38972
|
) {
|
|
38883
38973
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
38884
38974
|
}
|
|
@@ -38902,26 +38992,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
|
38902
38992
|
);
|
|
38903
38993
|
|
|
38904
38994
|
return primaryPredicatePassed
|
|
38905
|
-
? validatorFns[dependentValidator.type](
|
|
38906
|
-
value,
|
|
38907
|
-
dependentValidator.args,
|
|
38908
|
-
form
|
|
38909
|
-
)
|
|
38995
|
+
? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
|
|
38910
38996
|
: true;
|
|
38911
38997
|
};
|
|
38912
38998
|
|
|
38913
|
-
const validateSumErrorMessage = type =>
|
|
38999
|
+
const validateSumErrorMessage = (type) =>
|
|
38914
39000
|
`${type} was passed to validateSum, but that validator type does not exist.
|
|
38915
39001
|
Please check that you are only calling validator creator functions exported from
|
|
38916
39002
|
redux-freeform in your form config and that you didn't forget to
|
|
38917
39003
|
invoke the validator creator (you cannot pass the functions themselves to
|
|
38918
39004
|
createFormState).`;
|
|
38919
|
-
const VALIDATE_SUM =
|
|
38920
|
-
const VALIDATE_SUM_ERROR =
|
|
39005
|
+
const VALIDATE_SUM = 'validator/VALIDATE_SUM';
|
|
39006
|
+
const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
|
|
38921
39007
|
const validateSum = (validator, fieldNamesArray) => ({
|
|
38922
39008
|
type: VALIDATE_SUM,
|
|
38923
39009
|
args: [validator, fieldNamesArray],
|
|
38924
|
-
error: validator.error
|
|
39010
|
+
error: validator.error,
|
|
38925
39011
|
});
|
|
38926
39012
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
38927
39013
|
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
@@ -38929,7 +39015,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38929
39015
|
|
|
38930
39016
|
if (
|
|
38931
39017
|
validator.type === undefined ||
|
|
38932
|
-
typeof validatorFns[validator.type] !==
|
|
39018
|
+
typeof validatorFns[validator.type] !== 'function'
|
|
38933
39019
|
) {
|
|
38934
39020
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
38935
39021
|
}
|
|
@@ -38950,37 +39036,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38950
39036
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
38951
39037
|
};
|
|
38952
39038
|
|
|
38953
|
-
const HAS_LENGTH =
|
|
38954
|
-
const HAS_LENGTH_ERROR =
|
|
39039
|
+
const HAS_LENGTH = 'validator/HAS_LENGTH';
|
|
39040
|
+
const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
|
|
38955
39041
|
const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
38956
39042
|
validatorFns[HAS_LENGTH] = (value, args, form) => {
|
|
38957
|
-
if (value ===
|
|
39043
|
+
if (value === '') {
|
|
38958
39044
|
return true;
|
|
38959
39045
|
}
|
|
38960
39046
|
const min = args[0];
|
|
38961
39047
|
const max = args[1];
|
|
38962
39048
|
if (max == undefined || min == undefined) {
|
|
38963
39049
|
throw new Error(
|
|
38964
|
-
|
|
39050
|
+
'Max and min need to be defined for hasLength, both or one of them is undefined'
|
|
38965
39051
|
);
|
|
38966
39052
|
}
|
|
38967
39053
|
if (max < min) {
|
|
38968
|
-
throw new Error(
|
|
38969
|
-
"hasLength validator was passed a min greater than the max"
|
|
38970
|
-
);
|
|
39054
|
+
throw new Error('hasLength validator was passed a min greater than the max');
|
|
38971
39055
|
}
|
|
38972
39056
|
const valueLength = value.length;
|
|
38973
39057
|
return max >= valueLength && valueLength >= min;
|
|
38974
39058
|
};
|
|
38975
39059
|
|
|
38976
|
-
const DATE_BEFORE_TODAY =
|
|
38977
|
-
const DATE_BEFORE_TODAY_ERROR =
|
|
39060
|
+
const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
|
|
39061
|
+
const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
|
|
38978
39062
|
const dateBeforeToday = createValidator(
|
|
38979
39063
|
DATE_BEFORE_TODAY,
|
|
38980
39064
|
DATE_BEFORE_TODAY_ERROR
|
|
38981
39065
|
);
|
|
38982
39066
|
validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
38983
|
-
if (value ===
|
|
39067
|
+
if (value === '') {
|
|
38984
39068
|
return true;
|
|
38985
39069
|
}
|
|
38986
39070
|
const dateFormat = args[0];
|
|
@@ -38989,7 +39073,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38989
39073
|
|
|
38990
39074
|
if (dateFormat == undefined || unit == undefined) {
|
|
38991
39075
|
throw new Error(
|
|
38992
|
-
|
|
39076
|
+
'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
|
|
38993
39077
|
);
|
|
38994
39078
|
}
|
|
38995
39079
|
const now = dayjs();
|
|
@@ -39001,14 +39085,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
39001
39085
|
return dateValue.isBefore(now, unit);
|
|
39002
39086
|
};
|
|
39003
39087
|
|
|
39004
|
-
const DATE_AFTER_TODAY =
|
|
39005
|
-
const DATE_AFTER_TODAY_ERROR =
|
|
39088
|
+
const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
|
|
39089
|
+
const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
|
|
39006
39090
|
const dateAfterToday = createValidator(
|
|
39007
39091
|
DATE_AFTER_TODAY,
|
|
39008
39092
|
DATE_AFTER_TODAY_ERROR
|
|
39009
39093
|
);
|
|
39010
39094
|
validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
39011
|
-
if (value ===
|
|
39095
|
+
if (value === '') {
|
|
39012
39096
|
return true;
|
|
39013
39097
|
}
|
|
39014
39098
|
const dateFormat = args[0];
|
|
@@ -39017,7 +39101,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
39017
39101
|
|
|
39018
39102
|
if (dateFormat == undefined || unit == undefined) {
|
|
39019
39103
|
throw new Error(
|
|
39020
|
-
|
|
39104
|
+
'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
|
|
39021
39105
|
);
|
|
39022
39106
|
}
|
|
39023
39107
|
const now = dayjs();
|
|
@@ -39029,14 +39113,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
39029
39113
|
return dateValue.isAfter(now, unit);
|
|
39030
39114
|
};
|
|
39031
39115
|
|
|
39032
|
-
const IS_VALID_MONTH =
|
|
39033
|
-
const IS_VALID_MONTH_ERROR =
|
|
39034
|
-
const isValidMonth = createValidator(
|
|
39035
|
-
IS_VALID_MONTH,
|
|
39036
|
-
IS_VALID_MONTH_ERROR
|
|
39037
|
-
);
|
|
39116
|
+
const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
|
|
39117
|
+
const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
|
|
39118
|
+
const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
|
|
39038
39119
|
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
39039
|
-
if (value ===
|
|
39120
|
+
if (value === '') {
|
|
39040
39121
|
return true;
|
|
39041
39122
|
}
|
|
39042
39123
|
// Function takes one argument representing the character position
|
|
@@ -39046,43 +39127,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
|
39046
39127
|
// Only works with two digit months (01, 02, 03, etc)
|
|
39047
39128
|
const monthStartPosition = parseInt(args[0]);
|
|
39048
39129
|
const monthEndPosition = monthStartPosition + 2;
|
|
39049
|
-
if (monthStartPosition
|
|
39050
|
-
throw new Error(
|
|
39130
|
+
if (isNaN(monthStartPosition)) {
|
|
39131
|
+
throw new Error('Month start position has to be a valid integer string');
|
|
39051
39132
|
}
|
|
39052
39133
|
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
39053
|
-
if (month
|
|
39134
|
+
if (isNaN(month)) {
|
|
39054
39135
|
return false;
|
|
39055
39136
|
}
|
|
39056
39137
|
return month >= 1 && month <= 12;
|
|
39057
39138
|
};
|
|
39058
39139
|
|
|
39059
|
-
const MATCHES_REGEX =
|
|
39060
|
-
const MATCHES_REGEX_ERROR =
|
|
39140
|
+
const MATCHES_REGEX = 'validator/MATCHES_REGEX';
|
|
39141
|
+
const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
|
|
39061
39142
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
39062
39143
|
validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
39063
|
-
if (value ===
|
|
39144
|
+
if (value === '') {
|
|
39064
39145
|
return true;
|
|
39065
39146
|
}
|
|
39066
39147
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
39067
39148
|
};
|
|
39068
39149
|
|
|
39069
39150
|
// based on http://www.brainjar.com/js/validation/
|
|
39070
|
-
const IS_ROUTING_NUMBER =
|
|
39071
|
-
const IS_ROUTING_NUMBER_ERROR =
|
|
39151
|
+
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
39152
|
+
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
39072
39153
|
const isRoutingNumber = createValidator(
|
|
39073
39154
|
IS_ROUTING_NUMBER,
|
|
39074
39155
|
IS_ROUTING_NUMBER_ERROR
|
|
39075
39156
|
);
|
|
39076
39157
|
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
39077
|
-
if (value ===
|
|
39158
|
+
if (value === '') {
|
|
39078
39159
|
return true;
|
|
39079
39160
|
}
|
|
39080
39161
|
if (value.length != 9) {
|
|
39081
39162
|
return false;
|
|
39082
39163
|
}
|
|
39083
39164
|
const sum = value
|
|
39084
|
-
.split(
|
|
39085
|
-
.map(ch => parseInt(ch))
|
|
39165
|
+
.split('')
|
|
39166
|
+
.map((ch) => parseInt(ch))
|
|
39086
39167
|
.reduce((acc, cur, idx) => {
|
|
39087
39168
|
switch (idx % 3) {
|
|
39088
39169
|
case 0:
|
|
@@ -39096,69 +39177,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
|
39096
39177
|
return sum != 0 && sum % 10 == 0;
|
|
39097
39178
|
};
|
|
39098
39179
|
|
|
39099
|
-
const HAS_NUMBER =
|
|
39100
|
-
const HAS_NUMBER_ERROR$1 =
|
|
39180
|
+
const HAS_NUMBER = 'validator/HAS_NUMBER';
|
|
39181
|
+
const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
|
|
39101
39182
|
const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
39102
39183
|
validatorFns[HAS_NUMBER] = (value, args, form) => {
|
|
39103
|
-
if (value ===
|
|
39184
|
+
if (value === '') {
|
|
39104
39185
|
return true;
|
|
39105
39186
|
}
|
|
39106
39187
|
return new RegExp(/[0-9]/).test(value);
|
|
39107
39188
|
};
|
|
39108
39189
|
|
|
39109
|
-
const HAS_LOWERCASE_LETTER =
|
|
39110
|
-
const HAS_LOWERCASE_LETTER_ERROR$1 =
|
|
39190
|
+
const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
|
|
39191
|
+
const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
|
|
39111
39192
|
const hasLowercaseLetter = createValidator(
|
|
39112
39193
|
HAS_LOWERCASE_LETTER,
|
|
39113
39194
|
HAS_LOWERCASE_LETTER_ERROR$1
|
|
39114
39195
|
);
|
|
39115
39196
|
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
39116
|
-
if (value ===
|
|
39197
|
+
if (value === '') {
|
|
39117
39198
|
return true;
|
|
39118
39199
|
}
|
|
39119
39200
|
return new RegExp(/[a-z]/).test(value);
|
|
39120
39201
|
};
|
|
39121
39202
|
|
|
39122
|
-
const HAS_UPPERCASE_LETTER =
|
|
39123
|
-
const HAS_UPPERCASE_LETTER_ERROR$1 =
|
|
39203
|
+
const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
|
|
39204
|
+
const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
|
|
39124
39205
|
const hasUppercaseLetter = createValidator(
|
|
39125
39206
|
HAS_UPPERCASE_LETTER,
|
|
39126
39207
|
HAS_UPPERCASE_LETTER_ERROR$1
|
|
39127
39208
|
);
|
|
39128
39209
|
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
39129
|
-
if (value ===
|
|
39210
|
+
if (value === '') {
|
|
39130
39211
|
return true;
|
|
39131
39212
|
}
|
|
39132
39213
|
return new RegExp(/[A-Z]/).test(value);
|
|
39133
39214
|
};
|
|
39134
39215
|
|
|
39135
|
-
const HAS_SPECIAL_CHARACTER =
|
|
39136
|
-
const HAS_SPECIAL_CHARACTER_ERROR$1 =
|
|
39216
|
+
const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
|
|
39217
|
+
const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
|
|
39137
39218
|
const hasSpecialCharacter = createValidator(
|
|
39138
39219
|
HAS_SPECIAL_CHARACTER,
|
|
39139
39220
|
HAS_SPECIAL_CHARACTER_ERROR$1
|
|
39140
39221
|
);
|
|
39141
39222
|
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
39142
|
-
if (value ===
|
|
39223
|
+
if (value === '') {
|
|
39143
39224
|
return true;
|
|
39144
39225
|
}
|
|
39145
39226
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
39146
39227
|
};
|
|
39147
39228
|
|
|
39148
|
-
const IS_PROBABLY_EMAIL =
|
|
39149
|
-
const IS_PROBABLY_EMAIL_ERROR =
|
|
39229
|
+
const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
|
|
39230
|
+
const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
|
|
39150
39231
|
const isProbablyEmail = createValidator(
|
|
39151
39232
|
IS_PROBABLY_EMAIL,
|
|
39152
39233
|
IS_PROBABLY_EMAIL_ERROR
|
|
39153
39234
|
);
|
|
39154
39235
|
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
39155
|
-
if (value ===
|
|
39236
|
+
if (value === '') {
|
|
39156
39237
|
return true;
|
|
39157
39238
|
}
|
|
39158
39239
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
39159
39240
|
};
|
|
39160
39241
|
|
|
39161
|
-
const runValidatorErrorMessage = type =>
|
|
39242
|
+
const runValidatorErrorMessage = (type) =>
|
|
39162
39243
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
39163
39244
|
Please check that you are only calling validator creator functions exported from
|
|
39164
39245
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -39173,1165 +39254,53 @@ const runValidator = (validator, value, form) => {
|
|
|
39173
39254
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
39174
39255
|
};
|
|
39175
39256
|
|
|
39176
|
-
const
|
|
39257
|
+
const runFormValidators = (fieldName, form, validators) => {
|
|
39177
39258
|
return validators
|
|
39178
|
-
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
39179
|
-
.filter(x => x !== null);
|
|
39259
|
+
.map((v) => runValidator(v, form[fieldName].rawValue, form))
|
|
39260
|
+
.filter((x) => x !== null);
|
|
39180
39261
|
};
|
|
39181
39262
|
|
|
39182
39263
|
const computeConstraints = (fieldName, form) => {
|
|
39183
39264
|
const constraints = form[fieldName].constraints;
|
|
39184
|
-
return
|
|
39265
|
+
return runFormValidators(fieldName, form, constraints);
|
|
39185
39266
|
};
|
|
39186
39267
|
|
|
39187
39268
|
const computeErrors = (fieldName, form) => {
|
|
39188
39269
|
const validators = form[fieldName].validators;
|
|
39189
|
-
return
|
|
39190
|
-
};
|
|
39191
|
-
|
|
39192
|
-
var obj;
|
|
39193
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
|
|
39194
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
39195
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
|
|
39196
|
-
function isDraft(value) {
|
|
39197
|
-
return !!value && !!value[DRAFT_STATE];
|
|
39198
|
-
}
|
|
39199
|
-
function isDraftable(value) {
|
|
39200
|
-
if (!value) { return false; }
|
|
39201
|
-
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
39202
|
-
}
|
|
39203
|
-
function isPlainObject(value) {
|
|
39204
|
-
if (!value || typeof value !== "object") { return false; }
|
|
39205
|
-
if (Array.isArray(value)) { return true; }
|
|
39206
|
-
var proto = Object.getPrototypeOf(value);
|
|
39207
|
-
return !proto || proto === Object.prototype;
|
|
39208
|
-
}
|
|
39209
|
-
var assign = Object.assign || function assign(target, value) {
|
|
39210
|
-
for (var key in value) {
|
|
39211
|
-
if (has$1(value, key)) {
|
|
39212
|
-
target[key] = value[key];
|
|
39213
|
-
}
|
|
39214
|
-
}
|
|
39215
|
-
|
|
39216
|
-
return target;
|
|
39217
|
-
};
|
|
39218
|
-
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;
|
|
39219
|
-
function shallowCopy(base, invokeGetters) {
|
|
39220
|
-
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
39221
|
-
|
|
39222
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
39223
|
-
var clone = Object.create(Object.getPrototypeOf(base));
|
|
39224
|
-
ownKeys$2(base).forEach(function (key) {
|
|
39225
|
-
if (key === DRAFT_STATE) {
|
|
39226
|
-
return; // Never copy over draft state.
|
|
39227
|
-
}
|
|
39228
|
-
|
|
39229
|
-
var desc = Object.getOwnPropertyDescriptor(base, key);
|
|
39230
|
-
var value = desc.value;
|
|
39231
|
-
|
|
39232
|
-
if (desc.get) {
|
|
39233
|
-
if (!invokeGetters) {
|
|
39234
|
-
throw new Error("Immer drafts cannot have computed properties");
|
|
39235
|
-
}
|
|
39236
|
-
|
|
39237
|
-
value = desc.get.call(base);
|
|
39238
|
-
}
|
|
39239
|
-
|
|
39240
|
-
if (desc.enumerable) {
|
|
39241
|
-
clone[key] = value;
|
|
39242
|
-
} else {
|
|
39243
|
-
Object.defineProperty(clone, key, {
|
|
39244
|
-
value: value,
|
|
39245
|
-
writable: true,
|
|
39246
|
-
configurable: true
|
|
39247
|
-
});
|
|
39248
|
-
}
|
|
39249
|
-
});
|
|
39250
|
-
return clone;
|
|
39251
|
-
}
|
|
39252
|
-
function each(value, cb) {
|
|
39253
|
-
if (Array.isArray(value)) {
|
|
39254
|
-
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
39255
|
-
} else {
|
|
39256
|
-
ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
39257
|
-
}
|
|
39258
|
-
}
|
|
39259
|
-
function isEnumerable(base, prop) {
|
|
39260
|
-
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
39261
|
-
return !!desc && desc.enumerable;
|
|
39262
|
-
}
|
|
39263
|
-
function has$1(thing, prop) {
|
|
39264
|
-
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
39265
|
-
}
|
|
39266
|
-
function is(x, y) {
|
|
39267
|
-
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
39268
|
-
if (x === y) {
|
|
39269
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
39270
|
-
} else {
|
|
39271
|
-
return x !== x && y !== y;
|
|
39272
|
-
}
|
|
39273
|
-
}
|
|
39274
|
-
function clone(obj) {
|
|
39275
|
-
if (!isDraftable(obj)) { return obj; }
|
|
39276
|
-
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
39277
|
-
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
39278
|
-
|
|
39279
|
-
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
39280
|
-
|
|
39281
|
-
return cloned;
|
|
39282
|
-
}
|
|
39283
|
-
|
|
39284
|
-
/** Each scope represents a `produce` call. */
|
|
39285
|
-
|
|
39286
|
-
var ImmerScope = function ImmerScope(parent) {
|
|
39287
|
-
this.drafts = [];
|
|
39288
|
-
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
39289
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
39290
|
-
|
|
39291
|
-
this.canAutoFreeze = true; // To avoid prototype lookups:
|
|
39292
|
-
|
|
39293
|
-
this.patches = null;
|
|
39294
|
-
};
|
|
39295
|
-
|
|
39296
|
-
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
39297
|
-
if (patchListener) {
|
|
39298
|
-
this.patches = [];
|
|
39299
|
-
this.inversePatches = [];
|
|
39300
|
-
this.patchListener = patchListener;
|
|
39301
|
-
}
|
|
39302
|
-
};
|
|
39303
|
-
|
|
39304
|
-
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
39305
|
-
this.leave();
|
|
39306
|
-
this.drafts.forEach(revoke);
|
|
39307
|
-
this.drafts = null; // Make draft-related methods throw.
|
|
39308
|
-
};
|
|
39309
|
-
|
|
39310
|
-
ImmerScope.prototype.leave = function leave () {
|
|
39311
|
-
if (this === ImmerScope.current) {
|
|
39312
|
-
ImmerScope.current = this.parent;
|
|
39313
|
-
}
|
|
39314
|
-
};
|
|
39315
|
-
ImmerScope.current = null;
|
|
39316
|
-
|
|
39317
|
-
ImmerScope.enter = function () {
|
|
39318
|
-
return this.current = new ImmerScope(this.current);
|
|
39319
|
-
};
|
|
39320
|
-
|
|
39321
|
-
function revoke(draft) {
|
|
39322
|
-
draft[DRAFT_STATE].revoke();
|
|
39323
|
-
}
|
|
39324
|
-
|
|
39325
|
-
// but share them all instead
|
|
39326
|
-
|
|
39327
|
-
var descriptors$1 = {};
|
|
39328
|
-
function willFinalize(scope, result, isReplaced) {
|
|
39329
|
-
scope.drafts.forEach(function (draft) {
|
|
39330
|
-
draft[DRAFT_STATE].finalizing = true;
|
|
39331
|
-
});
|
|
39332
|
-
|
|
39333
|
-
if (!isReplaced) {
|
|
39334
|
-
if (scope.patches) {
|
|
39335
|
-
markChangesRecursively(scope.drafts[0]);
|
|
39336
|
-
} // This is faster when we don't care about which attributes changed.
|
|
39337
|
-
|
|
39338
|
-
|
|
39339
|
-
markChangesSweep(scope.drafts);
|
|
39340
|
-
} // When a child draft is returned, look for changes.
|
|
39341
|
-
else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
|
|
39342
|
-
markChangesSweep(scope.drafts);
|
|
39343
|
-
}
|
|
39344
|
-
}
|
|
39345
|
-
function createProxy(base, parent) {
|
|
39346
|
-
var isArray = Array.isArray(base);
|
|
39347
|
-
var draft = clonePotentialDraft(base);
|
|
39348
|
-
each(draft, function (prop) {
|
|
39349
|
-
proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
|
|
39350
|
-
}); // See "proxy.js" for property documentation.
|
|
39351
|
-
|
|
39352
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39353
|
-
var state = {
|
|
39354
|
-
scope: scope,
|
|
39355
|
-
modified: false,
|
|
39356
|
-
finalizing: false,
|
|
39357
|
-
// es5 only
|
|
39358
|
-
finalized: false,
|
|
39359
|
-
assigned: {},
|
|
39360
|
-
parent: parent,
|
|
39361
|
-
base: base,
|
|
39362
|
-
draft: draft,
|
|
39363
|
-
copy: null,
|
|
39364
|
-
revoke: revoke$1,
|
|
39365
|
-
revoked: false // es5 only
|
|
39366
|
-
|
|
39367
|
-
};
|
|
39368
|
-
createHiddenProperty(draft, DRAFT_STATE, state);
|
|
39369
|
-
scope.drafts.push(draft);
|
|
39370
|
-
return draft;
|
|
39371
|
-
}
|
|
39372
|
-
|
|
39373
|
-
function revoke$1() {
|
|
39374
|
-
this.revoked = true;
|
|
39375
|
-
}
|
|
39376
|
-
|
|
39377
|
-
function source(state) {
|
|
39378
|
-
return state.copy || state.base;
|
|
39379
|
-
} // Access a property without creating an Immer draft.
|
|
39380
|
-
|
|
39381
|
-
|
|
39382
|
-
function peek(draft, prop) {
|
|
39383
|
-
var state = draft[DRAFT_STATE];
|
|
39384
|
-
|
|
39385
|
-
if (state && !state.finalizing) {
|
|
39386
|
-
state.finalizing = true;
|
|
39387
|
-
var value = draft[prop];
|
|
39388
|
-
state.finalizing = false;
|
|
39389
|
-
return value;
|
|
39390
|
-
}
|
|
39391
|
-
|
|
39392
|
-
return draft[prop];
|
|
39393
|
-
}
|
|
39394
|
-
|
|
39395
|
-
function get$1(state, prop) {
|
|
39396
|
-
assertUnrevoked(state);
|
|
39397
|
-
var value = peek(source(state), prop);
|
|
39398
|
-
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
39399
|
-
|
|
39400
|
-
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
39401
|
-
prepareCopy(state);
|
|
39402
|
-
return state.copy[prop] = createProxy(value, state);
|
|
39403
|
-
}
|
|
39404
|
-
|
|
39405
|
-
return value;
|
|
39406
|
-
}
|
|
39407
|
-
|
|
39408
|
-
function set$1(state, prop, value) {
|
|
39409
|
-
assertUnrevoked(state);
|
|
39410
|
-
state.assigned[prop] = true;
|
|
39411
|
-
|
|
39412
|
-
if (!state.modified) {
|
|
39413
|
-
if (is(value, peek(source(state), prop))) { return; }
|
|
39414
|
-
markChanged(state);
|
|
39415
|
-
prepareCopy(state);
|
|
39416
|
-
}
|
|
39417
|
-
|
|
39418
|
-
state.copy[prop] = value;
|
|
39419
|
-
}
|
|
39420
|
-
|
|
39421
|
-
function markChanged(state) {
|
|
39422
|
-
if (!state.modified) {
|
|
39423
|
-
state.modified = true;
|
|
39424
|
-
if (state.parent) { markChanged(state.parent); }
|
|
39425
|
-
}
|
|
39426
|
-
}
|
|
39427
|
-
|
|
39428
|
-
function prepareCopy(state) {
|
|
39429
|
-
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
39430
|
-
}
|
|
39431
|
-
|
|
39432
|
-
function clonePotentialDraft(base) {
|
|
39433
|
-
var state = base && base[DRAFT_STATE];
|
|
39434
|
-
|
|
39435
|
-
if (state) {
|
|
39436
|
-
state.finalizing = true;
|
|
39437
|
-
var draft = shallowCopy(state.draft, true);
|
|
39438
|
-
state.finalizing = false;
|
|
39439
|
-
return draft;
|
|
39440
|
-
}
|
|
39441
|
-
|
|
39442
|
-
return shallowCopy(base);
|
|
39443
|
-
}
|
|
39444
|
-
|
|
39445
|
-
function proxyProperty(draft, prop, enumerable) {
|
|
39446
|
-
var desc = descriptors$1[prop];
|
|
39447
|
-
|
|
39448
|
-
if (desc) {
|
|
39449
|
-
desc.enumerable = enumerable;
|
|
39450
|
-
} else {
|
|
39451
|
-
descriptors$1[prop] = desc = {
|
|
39452
|
-
configurable: true,
|
|
39453
|
-
enumerable: enumerable,
|
|
39454
|
-
|
|
39455
|
-
get: function get$1$1() {
|
|
39456
|
-
return get$1(this[DRAFT_STATE], prop);
|
|
39457
|
-
},
|
|
39458
|
-
|
|
39459
|
-
set: function set$1$1(value) {
|
|
39460
|
-
set$1(this[DRAFT_STATE], prop, value);
|
|
39461
|
-
}
|
|
39462
|
-
|
|
39463
|
-
};
|
|
39464
|
-
}
|
|
39465
|
-
|
|
39466
|
-
Object.defineProperty(draft, prop, desc);
|
|
39467
|
-
}
|
|
39468
|
-
|
|
39469
|
-
function assertUnrevoked(state) {
|
|
39470
|
-
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))); }
|
|
39471
|
-
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
39472
|
-
|
|
39473
|
-
|
|
39474
|
-
function markChangesSweep(drafts) {
|
|
39475
|
-
// The natural order of drafts in the `scope` array is based on when they
|
|
39476
|
-
// were accessed. By processing drafts in reverse natural order, we have a
|
|
39477
|
-
// better chance of processing leaf nodes first. When a leaf node is known to
|
|
39478
|
-
// have changed, we can avoid any traversal of its ancestor nodes.
|
|
39479
|
-
for (var i = drafts.length - 1; i >= 0; i--) {
|
|
39480
|
-
var state = drafts[i][DRAFT_STATE];
|
|
39481
|
-
|
|
39482
|
-
if (!state.modified) {
|
|
39483
|
-
if (Array.isArray(state.base)) {
|
|
39484
|
-
if (hasArrayChanges(state)) { markChanged(state); }
|
|
39485
|
-
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
39486
|
-
}
|
|
39487
|
-
}
|
|
39488
|
-
}
|
|
39489
|
-
|
|
39490
|
-
function markChangesRecursively(object) {
|
|
39491
|
-
if (!object || typeof object !== "object") { return; }
|
|
39492
|
-
var state = object[DRAFT_STATE];
|
|
39493
|
-
if (!state) { return; }
|
|
39494
|
-
var base = state.base;
|
|
39495
|
-
var draft = state.draft;
|
|
39496
|
-
var assigned = state.assigned;
|
|
39497
|
-
|
|
39498
|
-
if (!Array.isArray(object)) {
|
|
39499
|
-
// Look for added keys.
|
|
39500
|
-
Object.keys(draft).forEach(function (key) {
|
|
39501
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39502
|
-
if (base[key] === undefined && !has$1(base, key)) {
|
|
39503
|
-
assigned[key] = true;
|
|
39504
|
-
markChanged(state);
|
|
39505
|
-
} else if (!assigned[key]) {
|
|
39506
|
-
// Only untouched properties trigger recursion.
|
|
39507
|
-
markChangesRecursively(draft[key]);
|
|
39508
|
-
}
|
|
39509
|
-
}); // Look for removed keys.
|
|
39510
|
-
|
|
39511
|
-
Object.keys(base).forEach(function (key) {
|
|
39512
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39513
|
-
if (draft[key] === undefined && !has$1(draft, key)) {
|
|
39514
|
-
assigned[key] = false;
|
|
39515
|
-
markChanged(state);
|
|
39516
|
-
}
|
|
39517
|
-
});
|
|
39518
|
-
} else if (hasArrayChanges(state)) {
|
|
39519
|
-
markChanged(state);
|
|
39520
|
-
assigned.length = true;
|
|
39521
|
-
|
|
39522
|
-
if (draft.length < base.length) {
|
|
39523
|
-
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
39524
|
-
} else {
|
|
39525
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
39526
|
-
}
|
|
39527
|
-
|
|
39528
|
-
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
39529
|
-
// Only untouched indices trigger recursion.
|
|
39530
|
-
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
39531
|
-
}
|
|
39532
|
-
}
|
|
39533
|
-
}
|
|
39534
|
-
|
|
39535
|
-
function hasObjectChanges(state) {
|
|
39536
|
-
var base = state.base;
|
|
39537
|
-
var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
|
|
39538
|
-
// non-numeric keys are ordered by time of definition on the object.
|
|
39539
|
-
|
|
39540
|
-
var keys = Object.keys(draft);
|
|
39541
|
-
|
|
39542
|
-
for (var i = keys.length - 1; i >= 0; i--) {
|
|
39543
|
-
var key = keys[i];
|
|
39544
|
-
var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
|
|
39545
|
-
|
|
39546
|
-
if (baseValue === undefined && !has$1(base, key)) {
|
|
39547
|
-
return true;
|
|
39548
|
-
} // Once a base key is deleted, future changes go undetected, because its
|
|
39549
|
-
// descriptor is erased. This branch detects any missed changes.
|
|
39550
|
-
else {
|
|
39551
|
-
var value = draft[key];
|
|
39552
|
-
var state$1 = value && value[DRAFT_STATE];
|
|
39553
|
-
|
|
39554
|
-
if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
|
|
39555
|
-
return true;
|
|
39556
|
-
}
|
|
39557
|
-
}
|
|
39558
|
-
} // At this point, no keys were added or changed.
|
|
39559
|
-
// Compare key count to determine if keys were deleted.
|
|
39560
|
-
|
|
39561
|
-
|
|
39562
|
-
return keys.length !== Object.keys(base).length;
|
|
39563
|
-
}
|
|
39564
|
-
|
|
39565
|
-
function hasArrayChanges(state) {
|
|
39566
|
-
var draft = state.draft;
|
|
39567
|
-
if (draft.length !== state.base.length) { return true; } // See #116
|
|
39568
|
-
// If we first shorten the length, our array interceptors will be removed.
|
|
39569
|
-
// If after that new items are added, result in the same original length,
|
|
39570
|
-
// those last items will have no intercepting property.
|
|
39571
|
-
// So if there is no own descriptor on the last position, we know that items were removed and added
|
|
39572
|
-
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
39573
|
-
// the last one
|
|
39574
|
-
|
|
39575
|
-
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
39576
|
-
|
|
39577
|
-
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
|
|
39578
|
-
|
|
39579
|
-
return false;
|
|
39580
|
-
}
|
|
39581
|
-
|
|
39582
|
-
function createHiddenProperty(target, prop, value) {
|
|
39583
|
-
Object.defineProperty(target, prop, {
|
|
39584
|
-
value: value,
|
|
39585
|
-
enumerable: false,
|
|
39586
|
-
writable: true
|
|
39587
|
-
});
|
|
39588
|
-
}
|
|
39589
|
-
|
|
39590
|
-
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
39591
|
-
willFinalize: willFinalize,
|
|
39592
|
-
createProxy: createProxy
|
|
39593
|
-
});
|
|
39594
|
-
|
|
39595
|
-
function willFinalize$1() {}
|
|
39596
|
-
function createProxy$1(base, parent) {
|
|
39597
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39598
|
-
var state = {
|
|
39599
|
-
// Track which produce call this is associated with.
|
|
39600
|
-
scope: scope,
|
|
39601
|
-
// True for both shallow and deep changes.
|
|
39602
|
-
modified: false,
|
|
39603
|
-
// Used during finalization.
|
|
39604
|
-
finalized: false,
|
|
39605
|
-
// Track which properties have been assigned (true) or deleted (false).
|
|
39606
|
-
assigned: {},
|
|
39607
|
-
// The parent draft state.
|
|
39608
|
-
parent: parent,
|
|
39609
|
-
// The base state.
|
|
39610
|
-
base: base,
|
|
39611
|
-
// The base proxy.
|
|
39612
|
-
draft: null,
|
|
39613
|
-
// Any property proxies.
|
|
39614
|
-
drafts: {},
|
|
39615
|
-
// The base copy with any updated values.
|
|
39616
|
-
copy: null,
|
|
39617
|
-
// Called by the `produce` function.
|
|
39618
|
-
revoke: null
|
|
39619
|
-
};
|
|
39620
|
-
var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
|
|
39621
|
-
// although state itself is an object
|
|
39622
|
-
Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
|
|
39623
|
-
var revoke = ref.revoke;
|
|
39624
|
-
var proxy = ref.proxy;
|
|
39625
|
-
state.draft = proxy;
|
|
39626
|
-
state.revoke = revoke;
|
|
39627
|
-
scope.drafts.push(proxy);
|
|
39628
|
-
return proxy;
|
|
39629
|
-
}
|
|
39630
|
-
var objectTraps = {
|
|
39631
|
-
get: get$1$1,
|
|
39632
|
-
|
|
39633
|
-
has: function has(target, prop) {
|
|
39634
|
-
return prop in source$1(target);
|
|
39635
|
-
},
|
|
39636
|
-
|
|
39637
|
-
ownKeys: function ownKeys(target) {
|
|
39638
|
-
return Reflect.ownKeys(source$1(target));
|
|
39639
|
-
},
|
|
39640
|
-
|
|
39641
|
-
set: set$1$1,
|
|
39642
|
-
deleteProperty: deleteProperty,
|
|
39643
|
-
getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
|
|
39644
|
-
|
|
39645
|
-
defineProperty: function defineProperty() {
|
|
39646
|
-
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
39647
|
-
},
|
|
39648
|
-
|
|
39649
|
-
getPrototypeOf: function getPrototypeOf(target) {
|
|
39650
|
-
return Object.getPrototypeOf(target.base);
|
|
39651
|
-
},
|
|
39652
|
-
|
|
39653
|
-
setPrototypeOf: function setPrototypeOf() {
|
|
39654
|
-
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
39655
|
-
}
|
|
39656
|
-
|
|
39657
|
-
};
|
|
39658
|
-
var arrayTraps = {};
|
|
39659
|
-
each(objectTraps, function (key, fn) {
|
|
39660
|
-
arrayTraps[key] = function () {
|
|
39661
|
-
arguments[0] = arguments[0][0];
|
|
39662
|
-
return fn.apply(this, arguments);
|
|
39663
|
-
};
|
|
39664
|
-
});
|
|
39665
|
-
|
|
39666
|
-
arrayTraps.deleteProperty = function (state, prop) {
|
|
39667
|
-
if (isNaN(parseInt(prop))) {
|
|
39668
|
-
throw new Error("Immer only supports deleting array indices"); // prettier-ignore
|
|
39669
|
-
}
|
|
39670
|
-
|
|
39671
|
-
return objectTraps.deleteProperty.call(this, state[0], prop);
|
|
39672
|
-
};
|
|
39673
|
-
|
|
39674
|
-
arrayTraps.set = function (state, prop, value) {
|
|
39675
|
-
if (prop !== "length" && isNaN(parseInt(prop))) {
|
|
39676
|
-
throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
|
|
39677
|
-
}
|
|
39678
|
-
|
|
39679
|
-
return objectTraps.set.call(this, state[0], prop, value);
|
|
39680
|
-
}; // returns the object we should be reading the current value from, which is base, until some change has been made
|
|
39681
|
-
|
|
39682
|
-
|
|
39683
|
-
function source$1(state) {
|
|
39684
|
-
return state.copy || state.base;
|
|
39685
|
-
} // Access a property without creating an Immer draft.
|
|
39686
|
-
|
|
39687
|
-
|
|
39688
|
-
function peek$1(draft, prop) {
|
|
39689
|
-
var state = draft[DRAFT_STATE];
|
|
39690
|
-
var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
|
|
39691
|
-
return desc && desc.value;
|
|
39692
|
-
}
|
|
39693
|
-
|
|
39694
|
-
function get$1$1(state, prop) {
|
|
39695
|
-
if (prop === DRAFT_STATE) { return state; }
|
|
39696
|
-
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
39697
|
-
|
|
39698
|
-
if (!state.modified && has$1(drafts, prop)) {
|
|
39699
|
-
return drafts[prop];
|
|
39700
|
-
}
|
|
39701
|
-
|
|
39702
|
-
var value = source$1(state)[prop];
|
|
39703
|
-
|
|
39704
|
-
if (state.finalized || !isDraftable(value)) {
|
|
39705
|
-
return value;
|
|
39706
|
-
} // Check for existing draft in modified state.
|
|
39707
|
-
|
|
39708
|
-
|
|
39709
|
-
if (state.modified) {
|
|
39710
|
-
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
39711
|
-
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
39712
|
-
|
|
39713
|
-
drafts = state.copy;
|
|
39714
|
-
}
|
|
39715
|
-
|
|
39716
|
-
return drafts[prop] = createProxy$1(value, state);
|
|
39717
|
-
}
|
|
39718
|
-
|
|
39719
|
-
function set$1$1(state, prop, value) {
|
|
39720
|
-
if (!state.modified) {
|
|
39721
|
-
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
39722
|
-
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
39723
|
-
// values may be drafts, but falsy values are never drafts.
|
|
39724
|
-
|
|
39725
|
-
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
39726
|
-
if (isUnchanged) { return true; }
|
|
39727
|
-
markChanged$1(state);
|
|
39728
|
-
}
|
|
39729
|
-
|
|
39730
|
-
state.assigned[prop] = true;
|
|
39731
|
-
state.copy[prop] = value;
|
|
39732
|
-
return true;
|
|
39733
|
-
}
|
|
39734
|
-
|
|
39735
|
-
function deleteProperty(state, prop) {
|
|
39736
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39737
|
-
if (peek$1(state.base, prop) !== undefined || prop in state.base) {
|
|
39738
|
-
state.assigned[prop] = false;
|
|
39739
|
-
markChanged$1(state);
|
|
39740
|
-
} else if (state.assigned[prop]) {
|
|
39741
|
-
// if an originally not assigned property was deleted
|
|
39742
|
-
delete state.assigned[prop];
|
|
39743
|
-
}
|
|
39744
|
-
|
|
39745
|
-
if (state.copy) { delete state.copy[prop]; }
|
|
39746
|
-
return true;
|
|
39747
|
-
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
39748
|
-
// the same guarantee in ES5 mode.
|
|
39749
|
-
|
|
39750
|
-
|
|
39751
|
-
function getOwnPropertyDescriptor$2(state, prop) {
|
|
39752
|
-
var owner = source$1(state);
|
|
39753
|
-
var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
39754
|
-
|
|
39755
|
-
if (desc) {
|
|
39756
|
-
desc.writable = true;
|
|
39757
|
-
desc.configurable = !Array.isArray(owner) || prop !== "length";
|
|
39758
|
-
}
|
|
39759
|
-
|
|
39760
|
-
return desc;
|
|
39761
|
-
}
|
|
39762
|
-
|
|
39763
|
-
function markChanged$1(state) {
|
|
39764
|
-
if (!state.modified) {
|
|
39765
|
-
state.modified = true;
|
|
39766
|
-
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
39767
|
-
state.drafts = null;
|
|
39768
|
-
if (state.parent) { markChanged$1(state.parent); }
|
|
39769
|
-
}
|
|
39770
|
-
}
|
|
39771
|
-
|
|
39772
|
-
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
39773
|
-
willFinalize: willFinalize$1,
|
|
39774
|
-
createProxy: createProxy$1
|
|
39775
|
-
});
|
|
39776
|
-
|
|
39777
|
-
function generatePatches(state, basePath, patches, inversePatches) {
|
|
39778
|
-
Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
|
|
39779
|
-
}
|
|
39780
|
-
|
|
39781
|
-
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
39782
|
-
var assign, assign$1;
|
|
39783
|
-
|
|
39784
|
-
var base = state.base;
|
|
39785
|
-
var copy = state.copy;
|
|
39786
|
-
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
39787
|
-
|
|
39788
|
-
if (copy.length < base.length) {
|
|
39789
|
-
(assign = [copy, base], base = assign[0], copy = assign[1]);
|
|
39790
|
-
(assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
|
|
39791
|
-
}
|
|
39792
|
-
|
|
39793
|
-
var delta = copy.length - base.length; // Find the first replaced index.
|
|
39794
|
-
|
|
39795
|
-
var start = 0;
|
|
39796
|
-
|
|
39797
|
-
while (base[start] === copy[start] && start < base.length) {
|
|
39798
|
-
++start;
|
|
39799
|
-
} // Find the last replaced index. Search from the end to optimize splice patches.
|
|
39800
|
-
|
|
39801
|
-
|
|
39802
|
-
var end = base.length;
|
|
39803
|
-
|
|
39804
|
-
while (end > start && base[end - 1] === copy[end + delta - 1]) {
|
|
39805
|
-
--end;
|
|
39806
|
-
} // Process replaced indices.
|
|
39807
|
-
|
|
39808
|
-
|
|
39809
|
-
for (var i = start; i < end; ++i) {
|
|
39810
|
-
if (assigned[i] && copy[i] !== base[i]) {
|
|
39811
|
-
var path = basePath.concat([i]);
|
|
39812
|
-
patches.push({
|
|
39813
|
-
op: "replace",
|
|
39814
|
-
path: path,
|
|
39815
|
-
value: copy[i]
|
|
39816
|
-
});
|
|
39817
|
-
inversePatches.push({
|
|
39818
|
-
op: "replace",
|
|
39819
|
-
path: path,
|
|
39820
|
-
value: base[i]
|
|
39821
|
-
});
|
|
39822
|
-
}
|
|
39823
|
-
}
|
|
39824
|
-
|
|
39825
|
-
var replaceCount = patches.length; // Process added indices.
|
|
39826
|
-
|
|
39827
|
-
for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
|
|
39828
|
-
var path$1 = basePath.concat([i$1]);
|
|
39829
|
-
patches[replaceCount + i$1 - end] = {
|
|
39830
|
-
op: "add",
|
|
39831
|
-
path: path$1,
|
|
39832
|
-
value: copy[i$1]
|
|
39833
|
-
};
|
|
39834
|
-
inversePatches.push({
|
|
39835
|
-
op: "remove",
|
|
39836
|
-
path: path$1
|
|
39837
|
-
});
|
|
39838
|
-
}
|
|
39839
|
-
}
|
|
39840
|
-
|
|
39841
|
-
function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
39842
|
-
var base = state.base;
|
|
39843
|
-
var copy = state.copy;
|
|
39844
|
-
each(state.assigned, function (key, assignedValue) {
|
|
39845
|
-
var origValue = base[key];
|
|
39846
|
-
var value = copy[key];
|
|
39847
|
-
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
39848
|
-
if (origValue === value && op === "replace") { return; }
|
|
39849
|
-
var path = basePath.concat(key);
|
|
39850
|
-
patches.push(op === "remove" ? {
|
|
39851
|
-
op: op,
|
|
39852
|
-
path: path
|
|
39853
|
-
} : {
|
|
39854
|
-
op: op,
|
|
39855
|
-
path: path,
|
|
39856
|
-
value: value
|
|
39857
|
-
});
|
|
39858
|
-
inversePatches.push(op === "add" ? {
|
|
39859
|
-
op: "remove",
|
|
39860
|
-
path: path
|
|
39861
|
-
} : op === "remove" ? {
|
|
39862
|
-
op: "add",
|
|
39863
|
-
path: path,
|
|
39864
|
-
value: origValue
|
|
39865
|
-
} : {
|
|
39866
|
-
op: "replace",
|
|
39867
|
-
path: path,
|
|
39868
|
-
value: origValue
|
|
39869
|
-
});
|
|
39870
|
-
});
|
|
39871
|
-
}
|
|
39872
|
-
|
|
39873
|
-
var applyPatches = function (draft, patches) {
|
|
39874
|
-
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
39875
|
-
var patch = list[i$1];
|
|
39876
|
-
|
|
39877
|
-
var path = patch.path;
|
|
39878
|
-
var op = patch.op;
|
|
39879
|
-
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
39880
|
-
|
|
39881
|
-
if (!path.length) { throw new Error("Illegal state"); }
|
|
39882
|
-
var base = draft;
|
|
39883
|
-
|
|
39884
|
-
for (var i = 0; i < path.length - 1; i++) {
|
|
39885
|
-
base = base[path[i]];
|
|
39886
|
-
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
39887
|
-
}
|
|
39888
|
-
|
|
39889
|
-
var key = path[path.length - 1];
|
|
39890
|
-
|
|
39891
|
-
switch (op) {
|
|
39892
|
-
case "replace":
|
|
39893
|
-
// if value is an object, then it's assigned by reference
|
|
39894
|
-
// in the following add or remove ops, the value field inside the patch will also be modifyed
|
|
39895
|
-
// so we use value from the cloned patch
|
|
39896
|
-
base[key] = value;
|
|
39897
|
-
break;
|
|
39898
|
-
|
|
39899
|
-
case "add":
|
|
39900
|
-
if (Array.isArray(base)) {
|
|
39901
|
-
// TODO: support "foo/-" paths for appending to an array
|
|
39902
|
-
base.splice(key, 0, value);
|
|
39903
|
-
} else {
|
|
39904
|
-
base[key] = value;
|
|
39905
|
-
}
|
|
39906
|
-
|
|
39907
|
-
break;
|
|
39908
|
-
|
|
39909
|
-
case "remove":
|
|
39910
|
-
if (Array.isArray(base)) {
|
|
39911
|
-
base.splice(key, 1);
|
|
39912
|
-
} else {
|
|
39913
|
-
delete base[key];
|
|
39914
|
-
}
|
|
39915
|
-
|
|
39916
|
-
break;
|
|
39917
|
-
|
|
39918
|
-
default:
|
|
39919
|
-
throw new Error("Unsupported patch operation: " + op);
|
|
39920
|
-
}
|
|
39921
|
-
}
|
|
39922
|
-
|
|
39923
|
-
return draft;
|
|
39270
|
+
return runFormValidators(fieldName, form, validators);
|
|
39924
39271
|
};
|
|
39925
39272
|
|
|
39926
|
-
|
|
39927
|
-
|
|
39928
|
-
|
|
39929
|
-
|
|
39930
|
-
|
|
39931
|
-
|
|
39932
|
-
|
|
39933
|
-
onCopy: null
|
|
39934
|
-
};
|
|
39935
|
-
var Immer = function Immer(config) {
|
|
39936
|
-
assign(this, configDefaults, config);
|
|
39937
|
-
this.setUseProxies(this.useProxies);
|
|
39938
|
-
this.produce = this.produce.bind(this);
|
|
39939
|
-
};
|
|
39940
|
-
|
|
39941
|
-
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
39942
|
-
var this$1$1 = this;
|
|
39943
|
-
|
|
39944
|
-
// curried invocation
|
|
39945
|
-
if (typeof base === "function" && typeof recipe !== "function") {
|
|
39946
|
-
var defaultBase = recipe;
|
|
39947
|
-
recipe = base;
|
|
39948
|
-
var self = this;
|
|
39949
|
-
return function curriedProduce(base) {
|
|
39950
|
-
var this$1$1 = this;
|
|
39951
|
-
if ( base === void 0 ) base = defaultBase;
|
|
39952
|
-
var args = [], len = arguments.length - 1;
|
|
39953
|
-
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
39954
|
-
|
|
39955
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
39956
|
-
};
|
|
39957
|
-
} // prettier-ignore
|
|
39958
|
-
|
|
39959
|
-
|
|
39960
|
-
{
|
|
39961
|
-
if (typeof recipe !== "function") {
|
|
39962
|
-
throw new Error("The first or second argument to `produce` must be a function");
|
|
39963
|
-
}
|
|
39964
|
-
|
|
39965
|
-
if (patchListener !== undefined && typeof patchListener !== "function") {
|
|
39966
|
-
throw new Error("The third argument to `produce` must be a function or undefined");
|
|
39967
|
-
}
|
|
39968
|
-
}
|
|
39969
|
-
var result; // Only plain objects, arrays, and "immerable classes" are drafted.
|
|
39970
|
-
|
|
39971
|
-
if (isDraftable(base)) {
|
|
39972
|
-
var scope = ImmerScope.enter();
|
|
39973
|
-
var proxy = this.createProxy(base);
|
|
39974
|
-
var hasError = true;
|
|
39975
|
-
|
|
39976
|
-
try {
|
|
39977
|
-
result = recipe(proxy);
|
|
39978
|
-
hasError = false;
|
|
39979
|
-
} finally {
|
|
39980
|
-
// finally instead of catch + rethrow better preserves original stack
|
|
39981
|
-
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
39982
|
-
}
|
|
39983
|
-
|
|
39984
|
-
if (result instanceof Promise) {
|
|
39985
|
-
return result.then(function (result) {
|
|
39986
|
-
scope.usePatches(patchListener);
|
|
39987
|
-
return this$1$1.processResult(result, scope);
|
|
39988
|
-
}, function (error) {
|
|
39989
|
-
scope.revoke();
|
|
39990
|
-
throw error;
|
|
39991
|
-
});
|
|
39992
|
-
}
|
|
39993
|
-
|
|
39994
|
-
scope.usePatches(patchListener);
|
|
39995
|
-
return this.processResult(result, scope);
|
|
39996
|
-
} else {
|
|
39997
|
-
result = recipe(base);
|
|
39998
|
-
if (result === undefined) { return base; }
|
|
39999
|
-
return result !== NOTHING ? result : undefined;
|
|
39273
|
+
const computeErrorEntries = (formState) => {
|
|
39274
|
+
const fields = Object.entries(formState);
|
|
39275
|
+
for (let entry of fields) {
|
|
39276
|
+
let fieldName = entry[0];
|
|
39277
|
+
let errors = computeErrors(fieldName, formState);
|
|
39278
|
+
formState[fieldName].errors = errors;
|
|
39279
|
+
formState[fieldName].hasErrors = errors.length > 0;
|
|
40000
39280
|
}
|
|
40001
39281
|
};
|
|
40002
39282
|
|
|
40003
|
-
|
|
40004
|
-
|
|
40005
|
-
|
|
40006
|
-
|
|
40007
|
-
|
|
40008
|
-
|
|
40009
|
-
|
|
40010
|
-
|
|
40011
|
-
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
40012
|
-
};
|
|
40013
|
-
} // non-curried form
|
|
40014
|
-
|
|
40015
|
-
|
|
40016
|
-
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
40017
|
-
var patches, inversePatches;
|
|
40018
|
-
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
40019
|
-
patches = p;
|
|
40020
|
-
inversePatches = ip;
|
|
40021
|
-
});
|
|
40022
|
-
return [nextState, patches, inversePatches];
|
|
40023
|
-
};
|
|
40024
|
-
|
|
40025
|
-
Immer.prototype.createDraft = function createDraft (base) {
|
|
40026
|
-
if (!isDraftable(base)) {
|
|
40027
|
-
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
39283
|
+
const computeDirtyEntries = (formState, changedFieldName) => {
|
|
39284
|
+
const fields = Object.entries(formState);
|
|
39285
|
+
for (let entry of fields) {
|
|
39286
|
+
let fieldName = entry[0];
|
|
39287
|
+
let field = entry[1];
|
|
39288
|
+
let dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
39289
|
+
formState[fieldName].dirty = dirty;
|
|
40028
39290
|
}
|
|
40029
|
-
|
|
40030
|
-
var scope = ImmerScope.enter();
|
|
40031
|
-
var proxy = this.createProxy(base);
|
|
40032
|
-
proxy[DRAFT_STATE].isManual = true;
|
|
40033
|
-
scope.leave();
|
|
40034
|
-
return proxy;
|
|
40035
39291
|
};
|
|
40036
39292
|
|
|
40037
|
-
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
40038
|
-
var state = draft && draft[DRAFT_STATE];
|
|
39293
|
+
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;
|
|
40039
39294
|
|
|
40040
|
-
|
|
40041
|
-
throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
|
|
40042
|
-
}
|
|
40043
|
-
|
|
40044
|
-
if (state.finalized) {
|
|
40045
|
-
throw new Error("The given draft is already finalized"); // prettier-ignore
|
|
40046
|
-
}
|
|
40047
|
-
|
|
40048
|
-
var scope = state.scope;
|
|
40049
|
-
scope.usePatches(patchListener);
|
|
40050
|
-
return this.processResult(undefined, scope);
|
|
40051
|
-
};
|
|
40052
|
-
|
|
40053
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
40054
|
-
this.autoFreeze = value;
|
|
40055
|
-
};
|
|
40056
|
-
|
|
40057
|
-
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
40058
|
-
this.useProxies = value;
|
|
40059
|
-
assign(this, value ? modernProxy : legacyProxy);
|
|
40060
|
-
};
|
|
40061
|
-
|
|
40062
|
-
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
40063
|
-
// If a patch replaces the entire state, take that replacement as base
|
|
40064
|
-
// before applying patches
|
|
40065
|
-
var i;
|
|
40066
|
-
|
|
40067
|
-
for (i = patches.length - 1; i >= 0; i--) {
|
|
40068
|
-
var patch = patches[i];
|
|
40069
|
-
|
|
40070
|
-
if (patch.path.length === 0 && patch.op === "replace") {
|
|
40071
|
-
base = patch.value;
|
|
40072
|
-
break;
|
|
40073
|
-
}
|
|
40074
|
-
}
|
|
40075
|
-
|
|
40076
|
-
if (isDraft(base)) {
|
|
40077
|
-
// N.B: never hits if some patch a replacement, patches are never drafts
|
|
40078
|
-
return applyPatches(base, patches);
|
|
40079
|
-
} // Otherwise, produce a copy of the base state.
|
|
40080
|
-
|
|
40081
|
-
|
|
40082
|
-
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
40083
|
-
};
|
|
40084
|
-
/** @internal */
|
|
40085
|
-
|
|
40086
|
-
|
|
40087
|
-
Immer.prototype.processResult = function processResult (result, scope) {
|
|
40088
|
-
var baseDraft = scope.drafts[0];
|
|
40089
|
-
var isReplaced = result !== undefined && result !== baseDraft;
|
|
40090
|
-
this.willFinalize(scope, result, isReplaced);
|
|
40091
|
-
|
|
40092
|
-
if (isReplaced) {
|
|
40093
|
-
if (baseDraft[DRAFT_STATE].modified) {
|
|
40094
|
-
scope.revoke();
|
|
40095
|
-
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
|
|
40096
|
-
}
|
|
40097
|
-
|
|
40098
|
-
if (isDraftable(result)) {
|
|
40099
|
-
// Finalize the result in case it contains (or is) a subset of the draft.
|
|
40100
|
-
result = this.finalize(result, null, scope);
|
|
40101
|
-
}
|
|
40102
|
-
|
|
40103
|
-
if (scope.patches) {
|
|
40104
|
-
scope.patches.push({
|
|
40105
|
-
op: "replace",
|
|
40106
|
-
path: [],
|
|
40107
|
-
value: result
|
|
40108
|
-
});
|
|
40109
|
-
scope.inversePatches.push({
|
|
40110
|
-
op: "replace",
|
|
40111
|
-
path: [],
|
|
40112
|
-
value: baseDraft[DRAFT_STATE].base
|
|
40113
|
-
});
|
|
40114
|
-
}
|
|
40115
|
-
} else {
|
|
40116
|
-
// Finalize the base draft.
|
|
40117
|
-
result = this.finalize(baseDraft, [], scope);
|
|
40118
|
-
}
|
|
40119
|
-
|
|
40120
|
-
scope.revoke();
|
|
40121
|
-
|
|
40122
|
-
if (scope.patches) {
|
|
40123
|
-
scope.patchListener(scope.patches, scope.inversePatches);
|
|
40124
|
-
}
|
|
40125
|
-
|
|
40126
|
-
return result !== NOTHING ? result : undefined;
|
|
40127
|
-
};
|
|
40128
|
-
/**
|
|
40129
|
-
* @internal
|
|
40130
|
-
* Finalize a draft, returning either the unmodified base state or a modified
|
|
40131
|
-
* copy of the base state.
|
|
40132
|
-
*/
|
|
40133
|
-
|
|
40134
|
-
|
|
40135
|
-
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
40136
|
-
var this$1$1 = this;
|
|
40137
|
-
|
|
40138
|
-
var state = draft[DRAFT_STATE];
|
|
40139
|
-
|
|
40140
|
-
if (!state) {
|
|
40141
|
-
if (Object.isFrozen(draft)) { return draft; }
|
|
40142
|
-
return this.finalizeTree(draft, null, scope);
|
|
40143
|
-
} // Never finalize drafts owned by another scope.
|
|
40144
|
-
|
|
40145
|
-
|
|
40146
|
-
if (state.scope !== scope) {
|
|
40147
|
-
return draft;
|
|
40148
|
-
}
|
|
40149
|
-
|
|
40150
|
-
if (!state.modified) {
|
|
40151
|
-
return state.base;
|
|
40152
|
-
}
|
|
40153
|
-
|
|
40154
|
-
if (!state.finalized) {
|
|
40155
|
-
state.finalized = true;
|
|
40156
|
-
this.finalizeTree(state.draft, path, scope);
|
|
40157
|
-
|
|
40158
|
-
if (this.onDelete) {
|
|
40159
|
-
// The `assigned` object is unreliable with ES5 drafts.
|
|
40160
|
-
if (this.useProxies) {
|
|
40161
|
-
var assigned = state.assigned;
|
|
40162
|
-
|
|
40163
|
-
for (var prop in assigned) {
|
|
40164
|
-
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
40165
|
-
}
|
|
40166
|
-
} else {
|
|
40167
|
-
var base = state.base;
|
|
40168
|
-
var copy = state.copy;
|
|
40169
|
-
each(base, function (prop) {
|
|
40170
|
-
if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
40171
|
-
});
|
|
40172
|
-
}
|
|
40173
|
-
}
|
|
40174
|
-
|
|
40175
|
-
if (this.onCopy) {
|
|
40176
|
-
this.onCopy(state);
|
|
40177
|
-
} // At this point, all descendants of `state.copy` have been finalized,
|
|
40178
|
-
// so we can be sure that `scope.canAutoFreeze` is accurate.
|
|
40179
|
-
|
|
40180
|
-
|
|
40181
|
-
if (this.autoFreeze && scope.canAutoFreeze) {
|
|
40182
|
-
Object.freeze(state.copy);
|
|
40183
|
-
}
|
|
40184
|
-
|
|
40185
|
-
if (path && scope.patches) {
|
|
40186
|
-
generatePatches(state, path, scope.patches, scope.inversePatches);
|
|
40187
|
-
}
|
|
40188
|
-
}
|
|
40189
|
-
|
|
40190
|
-
return state.copy;
|
|
40191
|
-
};
|
|
40192
|
-
/**
|
|
40193
|
-
* @internal
|
|
40194
|
-
* Finalize all drafts in the given state tree.
|
|
40195
|
-
*/
|
|
40196
|
-
|
|
40197
|
-
|
|
40198
|
-
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
40199
|
-
var this$1$1 = this;
|
|
40200
|
-
|
|
40201
|
-
var state = root[DRAFT_STATE];
|
|
40202
|
-
|
|
40203
|
-
if (state) {
|
|
40204
|
-
if (!this.useProxies) {
|
|
40205
|
-
// Create the final copy, with added keys and without deleted keys.
|
|
40206
|
-
state.copy = shallowCopy(state.draft, true);
|
|
40207
|
-
}
|
|
40208
|
-
|
|
40209
|
-
root = state.copy;
|
|
40210
|
-
}
|
|
40211
|
-
|
|
40212
|
-
var needPatches = !!rootPath && !!scope.patches;
|
|
40213
|
-
|
|
40214
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
40215
|
-
if (value === parent) {
|
|
40216
|
-
throw Error("Immer forbids circular references");
|
|
40217
|
-
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
40218
|
-
|
|
40219
|
-
|
|
40220
|
-
var isDraftProp = !!state && parent === root;
|
|
40221
|
-
|
|
40222
|
-
if (isDraft(value)) {
|
|
40223
|
-
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
40224
|
-
|
|
40225
|
-
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
40226
|
-
|
|
40227
|
-
if (isDraft(value)) {
|
|
40228
|
-
scope.canAutoFreeze = false;
|
|
40229
|
-
} // Preserve non-enumerable properties.
|
|
40230
|
-
|
|
40231
|
-
|
|
40232
|
-
if (Array.isArray(parent) || isEnumerable(parent, prop)) {
|
|
40233
|
-
parent[prop] = value;
|
|
40234
|
-
} else {
|
|
40235
|
-
Object.defineProperty(parent, prop, {
|
|
40236
|
-
value: value
|
|
40237
|
-
});
|
|
40238
|
-
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
40239
|
-
|
|
40240
|
-
|
|
40241
|
-
if (isDraftProp && value === state.base[prop]) { return; }
|
|
40242
|
-
} // Unchanged draft properties are ignored.
|
|
40243
|
-
else if (isDraftProp && is(value, state.base[prop])) {
|
|
40244
|
-
return;
|
|
40245
|
-
} // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
|
|
40246
|
-
else if (isDraftable(value) && !Object.isFrozen(value)) {
|
|
40247
|
-
each(value, finalizeProperty);
|
|
40248
|
-
}
|
|
40249
|
-
|
|
40250
|
-
if (isDraftProp && this$1$1.onAssign) {
|
|
40251
|
-
this$1$1.onAssign(state, prop, value);
|
|
40252
|
-
}
|
|
40253
|
-
};
|
|
40254
|
-
|
|
40255
|
-
each(root, finalizeProperty);
|
|
40256
|
-
return root;
|
|
40257
|
-
};
|
|
40258
|
-
|
|
40259
|
-
var immer = new Immer();
|
|
40260
|
-
/**
|
|
40261
|
-
* The `produce` function takes a value and a "recipe function" (whose
|
|
40262
|
-
* return value often depends on the base state). The recipe function is
|
|
40263
|
-
* free to mutate its first argument however it wants. All mutations are
|
|
40264
|
-
* only ever applied to a __copy__ of the base state.
|
|
40265
|
-
*
|
|
40266
|
-
* Pass only a function to create a "curried producer" which relieves you
|
|
40267
|
-
* from passing the recipe function every time.
|
|
40268
|
-
*
|
|
40269
|
-
* Only plain objects and arrays are made mutable. All other objects are
|
|
40270
|
-
* considered uncopyable.
|
|
40271
|
-
*
|
|
40272
|
-
* Note: This function is __bound__ to its `Immer` instance.
|
|
40273
|
-
*
|
|
40274
|
-
* @param {any} base - the initial state
|
|
40275
|
-
* @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
40276
|
-
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
40277
|
-
* @returns {any} a new state, or the initial state if nothing was modified
|
|
40278
|
-
*/
|
|
40279
|
-
|
|
40280
|
-
var produce = immer.produce;
|
|
40281
|
-
/**
|
|
40282
|
-
* Like `produce`, but `produceWithPatches` always returns a tuple
|
|
40283
|
-
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
40284
|
-
*/
|
|
40285
|
-
|
|
40286
|
-
immer.produceWithPatches.bind(immer);
|
|
40287
|
-
/**
|
|
40288
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
40289
|
-
*
|
|
40290
|
-
* By default, auto-freezing is disabled in production.
|
|
40291
|
-
*/
|
|
40292
|
-
|
|
40293
|
-
immer.setAutoFreeze.bind(immer);
|
|
40294
|
-
/**
|
|
40295
|
-
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
40296
|
-
* always faster than using ES5 proxies.
|
|
40297
|
-
*
|
|
40298
|
-
* By default, feature detection is used, so calling this is rarely necessary.
|
|
40299
|
-
*/
|
|
40300
|
-
|
|
40301
|
-
immer.setUseProxies.bind(immer);
|
|
40302
|
-
/**
|
|
40303
|
-
* Apply an array of Immer patches to the first argument.
|
|
40304
|
-
*
|
|
40305
|
-
* This function is a producer, which means copy-on-write is in effect.
|
|
40306
|
-
*/
|
|
40307
|
-
|
|
40308
|
-
immer.applyPatches.bind(immer);
|
|
40309
|
-
/**
|
|
40310
|
-
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
40311
|
-
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
40312
|
-
*/
|
|
40313
|
-
|
|
40314
|
-
immer.createDraft.bind(immer);
|
|
40315
|
-
/**
|
|
40316
|
-
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
40317
|
-
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
40318
|
-
* mutated afterwards.
|
|
40319
|
-
*
|
|
40320
|
-
* Pass a function as the 2nd argument to generate Immer patches based on the
|
|
40321
|
-
* changes that were made.
|
|
40322
|
-
*/
|
|
40323
|
-
|
|
40324
|
-
immer.finishDraft.bind(immer);
|
|
40325
|
-
|
|
40326
|
-
const createInitialState = formConfig => {
|
|
39295
|
+
const createInitialState = (formConfig) => {
|
|
40327
39296
|
let initialForm = {};
|
|
40328
39297
|
const formConfigKeys = Object.keys(formConfig);
|
|
40329
39298
|
for (let formKey of formConfigKeys) {
|
|
40330
39299
|
initialForm[formKey] = {
|
|
40331
39300
|
dirty: false,
|
|
40332
|
-
rawValue: formConfig[formKey].defaultValue ||
|
|
39301
|
+
rawValue: formConfig[formKey].defaultValue || '',
|
|
40333
39302
|
validators: formConfig[formKey].validators || [],
|
|
40334
|
-
constraints: formConfig[formKey].constraints || []
|
|
39303
|
+
constraints: formConfig[formKey].constraints || [],
|
|
40335
39304
|
};
|
|
40336
39305
|
}
|
|
40337
39306
|
// Because validators require the entire form we have to do a
|
|
@@ -40342,82 +39311,99 @@ const createInitialState = formConfig => {
|
|
|
40342
39311
|
initialForm[formKey].errors = errors;
|
|
40343
39312
|
initialForm[formKey].hasErrors = errors.length > 0;
|
|
40344
39313
|
}
|
|
39314
|
+
|
|
40345
39315
|
return initialForm;
|
|
40346
39316
|
};
|
|
40347
39317
|
|
|
40348
|
-
const SET =
|
|
40349
|
-
const set$
|
|
39318
|
+
const SET = 'field/SET';
|
|
39319
|
+
const set$1 = (fieldName) => (value) => ({
|
|
40350
39320
|
type: SET,
|
|
40351
|
-
payload: { fieldName, value }
|
|
39321
|
+
payload: { fieldName, value },
|
|
40352
39322
|
});
|
|
40353
39323
|
|
|
40354
|
-
const CLEAR =
|
|
39324
|
+
const CLEAR = 'form/CLEAR';
|
|
40355
39325
|
const clear = () => ({ type: CLEAR });
|
|
40356
39326
|
|
|
40357
|
-
const ADD_VALIDATOR =
|
|
40358
|
-
const addValidator = fieldName => validator => ({
|
|
39327
|
+
const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
|
|
39328
|
+
const addValidator = (fieldName) => (validator) => ({
|
|
40359
39329
|
type: ADD_VALIDATOR,
|
|
40360
|
-
payload: { fieldName, validator }
|
|
39330
|
+
payload: { fieldName, validator },
|
|
40361
39331
|
});
|
|
40362
39332
|
|
|
40363
|
-
const
|
|
40364
|
-
|
|
40365
|
-
|
|
40366
|
-
|
|
40367
|
-
|
|
40368
|
-
case SET:
|
|
40369
|
-
const changedFieldName = action.payload.fieldName;
|
|
40370
|
-
const newRawValue = action.payload.value;
|
|
40371
|
-
|
|
40372
|
-
return produce(state, draftState => {
|
|
40373
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
40374
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
40375
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
40376
|
-
// If the change violates constraints, revert the change
|
|
40377
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
40378
|
-
return draftState;
|
|
40379
|
-
}
|
|
39333
|
+
const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
|
|
39334
|
+
const removeValidator = (fieldName) => (validator) => ({
|
|
39335
|
+
type: REMOVE_VALIDATOR,
|
|
39336
|
+
payload: { fieldName, validator },
|
|
39337
|
+
});
|
|
40380
39338
|
|
|
40381
|
-
|
|
40382
|
-
|
|
40383
|
-
|
|
40384
|
-
|
|
40385
|
-
|
|
40386
|
-
|
|
40387
|
-
|
|
40388
|
-
|
|
40389
|
-
|
|
40390
|
-
|
|
40391
|
-
|
|
40392
|
-
|
|
40393
|
-
|
|
40394
|
-
|
|
40395
|
-
|
|
40396
|
-
|
|
40397
|
-
|
|
40398
|
-
|
|
40399
|
-
|
|
40400
|
-
|
|
40401
|
-
|
|
40402
|
-
|
|
40403
|
-
let field = entry[1];
|
|
40404
|
-
let errors = computeErrors(fieldName, draftState);
|
|
40405
|
-
let dirty = field.dirty;
|
|
40406
|
-
draftState[fieldName].errors = errors;
|
|
40407
|
-
draftState[fieldName].dirty = dirty;
|
|
40408
|
-
draftState[fieldName].hasErrors = errors.length > 0;
|
|
40409
|
-
}
|
|
40410
|
-
});
|
|
40411
|
-
default:
|
|
40412
|
-
return state;
|
|
40413
|
-
}
|
|
40414
|
-
};
|
|
39339
|
+
const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
|
|
39340
|
+
const clearFieldValidators = (fieldName) => () => ({
|
|
39341
|
+
type: CLEAR_FIELD_VALIDATORS,
|
|
39342
|
+
payload: { fieldName },
|
|
39343
|
+
});
|
|
39344
|
+
|
|
39345
|
+
const createFormReducer =
|
|
39346
|
+
(formConfig) =>
|
|
39347
|
+
(state = createInitialState(formConfig), action) => {
|
|
39348
|
+
switch (action.type) {
|
|
39349
|
+
case SET: {
|
|
39350
|
+
const changedFieldName = action.payload.fieldName;
|
|
39351
|
+
const newRawValue = action.payload.value;
|
|
39352
|
+
|
|
39353
|
+
return produce(state, (draftState) => {
|
|
39354
|
+
let originalValue = draftState[changedFieldName].rawValue;
|
|
39355
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
39356
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
39357
|
+
// If the change violates constraints, revert the change
|
|
39358
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
39359
|
+
return draftState;
|
|
39360
|
+
}
|
|
40415
39361
|
|
|
40416
|
-
|
|
39362
|
+
computeDirtyEntries(draftState, changedFieldName);
|
|
39363
|
+
computeErrorEntries(draftState);
|
|
39364
|
+
});
|
|
39365
|
+
}
|
|
39366
|
+
case CLEAR:
|
|
39367
|
+
return createInitialState(formConfig);
|
|
39368
|
+
case ADD_VALIDATOR: {
|
|
39369
|
+
const fieldWithOverride = action.payload.fieldName;
|
|
39370
|
+
const newValidator = action.payload.validator;
|
|
39371
|
+
|
|
39372
|
+
return produce(state, (draftState) => {
|
|
39373
|
+
draftState[fieldWithOverride].validators.push(newValidator);
|
|
39374
|
+
computeErrorEntries(draftState);
|
|
39375
|
+
});
|
|
39376
|
+
}
|
|
39377
|
+
case REMOVE_VALIDATOR: {
|
|
39378
|
+
const fieldToOverride = action.payload.fieldName;
|
|
39379
|
+
const targetValidator = action.payload.validator;
|
|
39380
|
+
|
|
39381
|
+
return produce(state, (draftState) => {
|
|
39382
|
+
let fieldValidators = draftState[fieldToOverride].validators;
|
|
39383
|
+
draftState[fieldToOverride].validators = fieldValidators.filter(
|
|
39384
|
+
(validator) => validator.type !== targetValidator.type
|
|
39385
|
+
);
|
|
39386
|
+
computeErrorEntries(draftState);
|
|
39387
|
+
});
|
|
39388
|
+
}
|
|
39389
|
+
case CLEAR_FIELD_VALIDATORS: {
|
|
39390
|
+
const fieldToClear = action.payload.fieldName;
|
|
39391
|
+
|
|
39392
|
+
return produce(state, (draftState) => {
|
|
39393
|
+
draftState[fieldToClear].validators = [];
|
|
39394
|
+
computeErrorEntries(draftState);
|
|
39395
|
+
});
|
|
39396
|
+
}
|
|
39397
|
+
default:
|
|
39398
|
+
return state;
|
|
39399
|
+
}
|
|
39400
|
+
};
|
|
39401
|
+
|
|
39402
|
+
const createMapDispatchToProps = (formConfig) => {
|
|
40417
39403
|
// Do memo-ization
|
|
40418
39404
|
let cachedDispatch;
|
|
40419
39405
|
let cacheValue;
|
|
40420
|
-
return dispatch => {
|
|
39406
|
+
return (dispatch) => {
|
|
40421
39407
|
if (dispatch == cachedDispatch) {
|
|
40422
39408
|
return cacheValue;
|
|
40423
39409
|
}
|
|
@@ -40426,8 +39412,11 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40426
39412
|
const keys = Object.keys(formConfig);
|
|
40427
39413
|
for (let fieldName of keys) {
|
|
40428
39414
|
dispatchObj.fields[fieldName] = {
|
|
40429
|
-
set: value => dispatch(set$
|
|
40430
|
-
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
39415
|
+
set: (value) => dispatch(set$1(fieldName)(value)),
|
|
39416
|
+
addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
|
|
39417
|
+
removeValidator: (validator) =>
|
|
39418
|
+
dispatch(removeValidator(fieldName)(validator)),
|
|
39419
|
+
clear: () => dispatch(clearFieldValidators(fieldName)()),
|
|
40431
39420
|
};
|
|
40432
39421
|
}
|
|
40433
39422
|
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
@@ -40437,12 +39426,12 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40437
39426
|
};
|
|
40438
39427
|
};
|
|
40439
39428
|
|
|
40440
|
-
const mapStateToProps = state => ({ fields: state });
|
|
39429
|
+
const mapStateToProps = (state) => ({ fields: state });
|
|
40441
39430
|
|
|
40442
|
-
const createFormState = formConfig => ({
|
|
39431
|
+
const createFormState = (formConfig) => ({
|
|
40443
39432
|
reducer: createFormReducer(formConfig),
|
|
40444
39433
|
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
40445
|
-
mapStateToProps: mapStateToProps
|
|
39434
|
+
mapStateToProps: mapStateToProps,
|
|
40446
39435
|
});
|
|
40447
39436
|
|
|
40448
39437
|
var AddressForm = function AddressForm(_ref) {
|
|
@@ -40490,6 +39479,7 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40490
39479
|
labelTextWhenNoError: "Country",
|
|
40491
39480
|
errorMessages: countryErrorMessages,
|
|
40492
39481
|
field: fields.country,
|
|
39482
|
+
isRequired: true,
|
|
40493
39483
|
onChange: function onChange(value) {
|
|
40494
39484
|
actions.fields.country.set(value); // temporary measure to not dirty fields until
|
|
40495
39485
|
// we can write a reset function for fields
|
|
@@ -40514,7 +39504,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40514
39504
|
return e.key === "Enter" && handleSubmit(e);
|
|
40515
39505
|
},
|
|
40516
39506
|
autocompleteValue: "address-line1",
|
|
40517
|
-
dataQa: "Address"
|
|
39507
|
+
dataQa: "Address",
|
|
39508
|
+
isRequired: true
|
|
40518
39509
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
40519
39510
|
labelTextWhenNoError: "Apt, Suite, Unit, Floor, etc. (Optional)",
|
|
40520
39511
|
field: fields.street2,
|
|
@@ -40524,7 +39515,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40524
39515
|
return e.key === "Enter" && handleSubmit(e);
|
|
40525
39516
|
},
|
|
40526
39517
|
autocompleteValue: "address-line2",
|
|
40527
|
-
dataQa: "Address Line 2"
|
|
39518
|
+
dataQa: "Address Line 2",
|
|
39519
|
+
isRequired: false
|
|
40528
39520
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
40529
39521
|
labelTextWhenNoError: "City",
|
|
40530
39522
|
errorMessages: cityErrorMessages,
|
|
@@ -40535,7 +39527,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40535
39527
|
return e.key === "Enter" && handleSubmit(e);
|
|
40536
39528
|
},
|
|
40537
39529
|
autocompleteValue: "address-level2",
|
|
40538
|
-
dataQa: "City"
|
|
39530
|
+
dataQa: "City",
|
|
39531
|
+
isRequired: true
|
|
40539
39532
|
}), /*#__PURE__*/React.createElement(FormStateDropdown, {
|
|
40540
39533
|
labelTextWhenNoError: isUS ? "State" : "State or Province",
|
|
40541
39534
|
errorMessages: stateProvinceErrorMessages,
|
|
@@ -40546,7 +39539,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40546
39539
|
onKeyDown: function onKeyDown(e) {
|
|
40547
39540
|
return e.key === "Enter" && handleSubmit(e);
|
|
40548
39541
|
},
|
|
40549
|
-
dataQa: "State or Province"
|
|
39542
|
+
dataQa: "State or Province",
|
|
39543
|
+
isRequired: true
|
|
40550
39544
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
40551
39545
|
isNum: isUS,
|
|
40552
39546
|
formatter: isUS ? zipFormat : null,
|
|
@@ -40559,7 +39553,8 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40559
39553
|
return e.key === "Enter" && handleSubmit(e);
|
|
40560
39554
|
},
|
|
40561
39555
|
autocompleteValue: "postal-code",
|
|
40562
|
-
dataQa: "Zip code"
|
|
39556
|
+
dataQa: "Zip code",
|
|
39557
|
+
isRequired: true
|
|
40563
39558
|
}), showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
40564
39559
|
name: "address checkbox",
|
|
40565
39560
|
title: "Save address to wallet",
|
|
@@ -43307,12 +42302,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
|
|
|
43307
42302
|
* This source code is licensed under the MIT license found in the
|
|
43308
42303
|
* LICENSE file in the root directory of this source tree.
|
|
43309
42304
|
*/
|
|
43310
|
-
var b$
|
|
43311
|
-
Symbol.for("react.suspense_list"):60120,r=b$
|
|
43312
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$
|
|
43313
|
-
var Profiler=g;var StrictMode=f$
|
|
43314
|
-
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$
|
|
43315
|
-
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$
|
|
42305
|
+
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?
|
|
42306
|
+
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;
|
|
42307
|
+
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;
|
|
42308
|
+
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};
|
|
42309
|
+
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};
|
|
42310
|
+
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;
|
|
43316
42311
|
|
|
43317
42312
|
var reactIs_production_min = {
|
|
43318
42313
|
AsyncMode: AsyncMode,
|
|
@@ -43683,14 +42678,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
43683
42678
|
|
|
43684
42679
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
43685
42680
|
|
|
43686
|
-
var has$
|
|
42681
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
43687
42682
|
|
|
43688
42683
|
var printWarning = function() {};
|
|
43689
42684
|
|
|
43690
42685
|
if (process.env.NODE_ENV !== 'production') {
|
|
43691
42686
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
43692
42687
|
var loggedTypeFailures = {};
|
|
43693
|
-
var has$
|
|
42688
|
+
var has$2 = has$1;
|
|
43694
42689
|
|
|
43695
42690
|
printWarning = function(text) {
|
|
43696
42691
|
var message = 'Warning: ' + text;
|
|
@@ -43720,7 +42715,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43720
42715
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
43721
42716
|
if (process.env.NODE_ENV !== 'production') {
|
|
43722
42717
|
for (var typeSpecName in typeSpecs) {
|
|
43723
|
-
if (has$
|
|
42718
|
+
if (has$2(typeSpecs, typeSpecName)) {
|
|
43724
42719
|
var error;
|
|
43725
42720
|
// Prop type validation may throw. In case they do, we don't want to
|
|
43726
42721
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -44119,7 +43114,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44119
43114
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
44120
43115
|
}
|
|
44121
43116
|
for (var key in propValue) {
|
|
44122
|
-
if (has$
|
|
43117
|
+
if (has$1(propValue, key)) {
|
|
44123
43118
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
44124
43119
|
if (error instanceof Error) {
|
|
44125
43120
|
return error;
|
|
@@ -44156,7 +43151,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44156
43151
|
if (checkerResult == null) {
|
|
44157
43152
|
return null;
|
|
44158
43153
|
}
|
|
44159
|
-
if (checkerResult.data && has$
|
|
43154
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
44160
43155
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
44161
43156
|
}
|
|
44162
43157
|
}
|
|
@@ -44216,7 +43211,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44216
43211
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
44217
43212
|
for (var key in allKeys) {
|
|
44218
43213
|
var checker = shapeTypes[key];
|
|
44219
|
-
if (has$
|
|
43214
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
44220
43215
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
44221
43216
|
}
|
|
44222
43217
|
if (!checker) {
|
|
@@ -44954,7 +43949,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
44954
43949
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
44955
43950
|
*/
|
|
44956
43951
|
|
|
44957
|
-
function ownKeys$
|
|
43952
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
44958
43953
|
var keys = Object.keys(object);
|
|
44959
43954
|
|
|
44960
43955
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -44970,9 +43965,9 @@ function ownKeys$3(object, enumerableOnly) {
|
|
|
44970
43965
|
function _objectSpread2$1(target) {
|
|
44971
43966
|
for (var i = 1; i < arguments.length; i++) {
|
|
44972
43967
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
44973
|
-
i % 2 ? ownKeys$
|
|
43968
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
44974
43969
|
_defineProperty$1(target, key, source[key]);
|
|
44975
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$
|
|
43970
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
44976
43971
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44977
43972
|
});
|
|
44978
43973
|
}
|
|
@@ -48858,43 +47853,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
48858
47853
|
})))));
|
|
48859
47854
|
};
|
|
48860
47855
|
|
|
48861
|
-
/*
|
|
48862
|
-
Hook that takes an ID selector for an element on the screen
|
|
48863
|
-
And optionally values for top position, left position, smooth behavior
|
|
48864
|
-
Finds element on screen and scrolls it to the provided coordinates
|
|
48865
|
-
|
|
48866
|
-
(string, number, number, string, number) => undefined;
|
|
48867
|
-
*/
|
|
48868
|
-
var useScrollTo = function useScrollTo(id) {
|
|
48869
|
-
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48870
|
-
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
48871
|
-
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
48872
|
-
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
48873
|
-
var scrollItem;
|
|
48874
|
-
|
|
48875
|
-
if (delay) {
|
|
48876
|
-
setTimeout(function () {
|
|
48877
|
-
var _scrollItem;
|
|
48878
|
-
|
|
48879
|
-
scrollItem = document.getElementById(id);
|
|
48880
|
-
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
48881
|
-
top: top,
|
|
48882
|
-
left: left,
|
|
48883
|
-
behavior: behavior
|
|
48884
|
-
});
|
|
48885
|
-
}, delay);
|
|
48886
|
-
} else {
|
|
48887
|
-
var _scrollItem2;
|
|
48888
|
-
|
|
48889
|
-
scrollItem = document.getElementById(id);
|
|
48890
|
-
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
48891
|
-
top: top,
|
|
48892
|
-
left: left,
|
|
48893
|
-
behavior: behavior
|
|
48894
|
-
});
|
|
48895
|
-
}
|
|
48896
|
-
};
|
|
48897
|
-
|
|
48898
47856
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48899
47857
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48900
47858
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -49063,7 +48021,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49063
48021
|
onKeyDown: function onKeyDown(e) {
|
|
49064
48022
|
return e.key === "Enter" && handleSubmit(e);
|
|
49065
48023
|
},
|
|
49066
|
-
autocompleteValue: "name"
|
|
48024
|
+
autocompleteValue: "name",
|
|
48025
|
+
isRequired: true
|
|
49067
48026
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
49068
48027
|
labelTextWhenNoError: "Routing number",
|
|
49069
48028
|
dataQa: "Routing number",
|
|
@@ -49085,7 +48044,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49085
48044
|
},
|
|
49086
48045
|
onKeyDown: function onKeyDown(e) {
|
|
49087
48046
|
return e.key === "Enter" && handleSubmit(e);
|
|
49088
|
-
}
|
|
48047
|
+
},
|
|
48048
|
+
isRequired: true
|
|
49089
48049
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
49090
48050
|
labelTextWhenNoError: "Confirm routing number",
|
|
49091
48051
|
dataQa: "Confirm routing number",
|
|
@@ -49096,6 +48056,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49096
48056
|
onKeyDown: function onKeyDown(e) {
|
|
49097
48057
|
return e.key === "Enter" && handleSubmit(e);
|
|
49098
48058
|
},
|
|
48059
|
+
isRequired: true,
|
|
49099
48060
|
isNum: true
|
|
49100
48061
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
49101
48062
|
labelTextWhenNoError: "Account number",
|
|
@@ -49104,6 +48065,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49104
48065
|
field: fields.accountNumber,
|
|
49105
48066
|
fieldActions: actions.fields.accountNumber,
|
|
49106
48067
|
showErrors: showErrors,
|
|
48068
|
+
isRequired: true,
|
|
49107
48069
|
isNum: true,
|
|
49108
48070
|
helperModal: function helperModal() {
|
|
49109
48071
|
return /*#__PURE__*/React.createElement(AccountAndRoutingModal$1, {
|
|
@@ -49122,6 +48084,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49122
48084
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
49123
48085
|
labelTextWhenNoError: "Confirm account number",
|
|
49124
48086
|
dataQa: "Confirm account number",
|
|
48087
|
+
isRequired: true,
|
|
49125
48088
|
errorMessages: confirmAccountNumberErrors,
|
|
49126
48089
|
field: fields.confirmAccountNumber,
|
|
49127
48090
|
fieldActions: actions.fields.confirmAccountNumber,
|
|
@@ -49132,6 +48095,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
49132
48095
|
isNum: true
|
|
49133
48096
|
}), allowBankAccountType && /*#__PURE__*/React.createElement(FormSelect$1, {
|
|
49134
48097
|
labelTextWhenNoError: "Account type",
|
|
48098
|
+
isRequired: true,
|
|
49135
48099
|
dataQa: "Account type",
|
|
49136
48100
|
options: [{
|
|
49137
48101
|
text: "Select account type",
|
|
@@ -49262,6 +48226,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49262
48226
|
"aria-label": "Card payment"
|
|
49263
48227
|
}, /*#__PURE__*/React.createElement(FormInputColumn, null, !hideZipCode && /*#__PURE__*/React.createElement(CountryDropdown, {
|
|
49264
48228
|
labelTextWhenNoError: "Country",
|
|
48229
|
+
isRequired: true,
|
|
49265
48230
|
errorMessages: countryErrorMessages,
|
|
49266
48231
|
field: fields.country,
|
|
49267
48232
|
onChange: function onChange(value) {
|
|
@@ -49284,8 +48249,10 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49284
48249
|
onKeyDown: function onKeyDown(e) {
|
|
49285
48250
|
return e.key === "Enter" && handleSubmit(e);
|
|
49286
48251
|
},
|
|
49287
|
-
autocompleteValue: "cc-name"
|
|
48252
|
+
autocompleteValue: "cc-name",
|
|
48253
|
+
isRequired: true
|
|
49288
48254
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
48255
|
+
isRequired: true,
|
|
49289
48256
|
labelTextWhenNoError: "Credit card number",
|
|
49290
48257
|
dataQa: "Credit card number",
|
|
49291
48258
|
errorMessages: creditCardNumberErrors,
|
|
@@ -49315,7 +48282,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49315
48282
|
isNum: true,
|
|
49316
48283
|
removeFromValue: /\// // removes "/" from browser autofill
|
|
49317
48284
|
,
|
|
49318
|
-
autocompleteValue: "cc-exp"
|
|
48285
|
+
autocompleteValue: "cc-exp",
|
|
48286
|
+
isRequired: true
|
|
49319
48287
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
49320
48288
|
labelTextWhenNoError: "CVV",
|
|
49321
48289
|
dataQa: "CVV",
|
|
@@ -49328,7 +48296,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49328
48296
|
onKeyDown: function onKeyDown(e) {
|
|
49329
48297
|
return e.key === "Enter" && handleSubmit(e);
|
|
49330
48298
|
},
|
|
49331
|
-
autocompleteValue: "cc-csc"
|
|
48299
|
+
autocompleteValue: "cc-csc",
|
|
48300
|
+
isRequired: true
|
|
49332
48301
|
})), !hideZipCode && /*#__PURE__*/React.createElement(Box, {
|
|
49333
48302
|
padding: isMobile ? "0" : "0 0.5rem 0 0",
|
|
49334
48303
|
width: isMobile ? "100%" : "50%"
|
|
@@ -49344,7 +48313,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
49344
48313
|
onKeyDown: function onKeyDown(e) {
|
|
49345
48314
|
return e.key === "Enter" && handleSubmit(e);
|
|
49346
48315
|
},
|
|
49347
|
-
autocompleteValue: "billing postal-code"
|
|
48316
|
+
autocompleteValue: "billing postal-code",
|
|
48317
|
+
isRequired: true
|
|
49348
48318
|
})), (showWalletCheckbox || showTerms) && /*#__PURE__*/React.createElement(Cluster, {
|
|
49349
48319
|
childGap: "4px",
|
|
49350
48320
|
align: "center"
|
|
@@ -49592,7 +48562,7 @@ PhoneForm.mapDispatchToProps = mapDispatchToProps$8;
|
|
|
49592
48562
|
var DefaultHeading = styled.div.withConfig({
|
|
49593
48563
|
displayName: "RadioGroup__DefaultHeading",
|
|
49594
48564
|
componentId: "sc-7lqrl8-0"
|
|
49595
|
-
})(["font-size:0.875rem;color:", "
|
|
48565
|
+
})(["font-size:0.875rem;color:", ";margin:0;padding:8px 0px;"], CHARADE_GREY);
|
|
49596
48566
|
var StyledFieldset = styled.fieldset.withConfig({
|
|
49597
48567
|
displayName: "RadioGroup__StyledFieldset",
|
|
49598
48568
|
componentId: "sc-7lqrl8-1"
|
|
@@ -49813,7 +48783,8 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
49813
48783
|
toggleRadio: section.disabled ? noop : function () {
|
|
49814
48784
|
return toggleOpenSection(section.id);
|
|
49815
48785
|
},
|
|
49816
|
-
tabIndex: "-1"
|
|
48786
|
+
tabIndex: "-1",
|
|
48787
|
+
required: section === null || section === void 0 ? void 0 : section.required
|
|
49817
48788
|
})), section.titleIcon && /*#__PURE__*/React.createElement(Cluster, {
|
|
49818
48789
|
align: "center"
|
|
49819
48790
|
}, section.titleIcon), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -50356,19 +49327,19 @@ var ToastNotification = function ToastNotification(_ref) {
|
|
|
50356
49327
|
backgroundColor = _ref.backgroundColor;
|
|
50357
49328
|
return /*#__PURE__*/React.createElement(Box, {
|
|
50358
49329
|
onClick: closeToastNotification,
|
|
50359
|
-
background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant ===
|
|
49330
|
+
background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant === VARIANTS.ERROR ? ERROR_BACKGROUND_COLOR : WHITE,
|
|
50360
49331
|
minWidth: minWidth,
|
|
50361
49332
|
minHeight: height && parseInt(height) < 100 ? height : "100px",
|
|
50362
49333
|
height: height ? height : "auto",
|
|
50363
49334
|
tabIndex: toastOpen ? "-1" : "0",
|
|
50364
49335
|
padding: "0rem 1rem",
|
|
50365
49336
|
borderRadius: "4px",
|
|
50366
|
-
boxShadow:
|
|
49337
|
+
boxShadow: generateShadows().standard.base,
|
|
50367
49338
|
extraStyles: "\n display: ".concat(toastOpen ? "block" : "none", ";\n position: fixed; bottom: 4rem; left: 4rem;\n ").concat(extraStyles, ";\n cursor: pointer;\n ")
|
|
50368
49339
|
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
50369
49340
|
align: "center",
|
|
50370
49341
|
childGap: childGap
|
|
50371
|
-
}, variant ===
|
|
49342
|
+
}, variant === VARIANTS.SUCCESS && /*#__PURE__*/React.createElement(SuccessfulIconMedium, null), variant === VARIANTS.ERROR && /*#__PURE__*/React.createElement(ErroredIcon, null), /*#__PURE__*/React.createElement(Box, {
|
|
50372
49343
|
padding: "1rem 0",
|
|
50373
49344
|
maxWidth: maxWidth
|
|
50374
49345
|
}, /*#__PURE__*/React.createElement(Paragraph$1, {
|
|
@@ -50749,5 +49720,37 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
|
|
|
50749
49720
|
|
|
50750
49721
|
var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$U));
|
|
50751
49722
|
|
|
50752
|
-
|
|
49723
|
+
var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
|
|
49724
|
+
var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
49725
|
+
// Only move focus when "hasErrors" is true
|
|
49726
|
+
// "hasErrors" is managed by container page of form
|
|
49727
|
+
// typically set to "true" on attempted form submission, if errors exist
|
|
49728
|
+
// Reset errors, if provided, resets the error state tracking in order to properly re-run
|
|
49729
|
+
useEffect$1(function () {
|
|
49730
|
+
if (hasErrors) {
|
|
49731
|
+
var _inputsWithErrors$;
|
|
49732
|
+
|
|
49733
|
+
var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
|
|
49734
|
+
inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
|
|
49735
|
+
}
|
|
49736
|
+
|
|
49737
|
+
return function () {
|
|
49738
|
+
return resetHasErrors(false);
|
|
49739
|
+
};
|
|
49740
|
+
});
|
|
49741
|
+
};
|
|
49742
|
+
|
|
49743
|
+
|
|
49744
|
+
|
|
49745
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
49746
|
+
__proto__: null,
|
|
49747
|
+
formats: formats,
|
|
49748
|
+
general: general,
|
|
49749
|
+
theme: themeUtils,
|
|
49750
|
+
useFocusInvalidInput: useFocusInvalidInput,
|
|
49751
|
+
useOutsideClick: useOutsideClickHook,
|
|
49752
|
+
useToastNotification: useToastNotification
|
|
49753
|
+
});
|
|
49754
|
+
|
|
49755
|
+
export { AccountNumberImage, AccountsAddIcon$1 as AccountsAddIcon, AccountsIcon$1 as AccountsIcon, AccountsIconSmall$1 as AccountsIconSmall, AchReturnIcon, AddObligation$1 as AddObligation, AddressForm, Alert$1 as Alert, AllocatedIcon, AmountCallout$1 as AmountCallout, ArrowDownCircleIconSmall, ArrowLeftCircleIconMedium, ArrowLeftCircleIconSmall, ArrowRightCircleIconSmall, ArrowRightIcon, ArrowUpCircleIconSmall, AutopayIcon, AutopayOnIcon, Badge$1 as Badge, BankIcon, BankIconLarge, Banner$1 as Banner, Box, BoxWithShadow$1 as BoxWithShadow, Breadcrumbs as Breadcrumb, ButtonWithAction, ButtonWithLink, CalendarIcon, Card$1 as Card, CarrotIcon$1 as CarrotIcon, CashIcon, Center, CenterSingle$1 as CenterSingle, CenterStack$1 as CenterStack, ChangePasswordForm, ChargebackIcon, ChargebackIconMedium, ChargebackIconSmall, ChargebackReversalIcon, ChargebackReversalIconMedium, ChargebackReversalIconSmall, CheckIcon, Checkbox$1 as Checkbox, CheckboxList$1 as CheckboxList, CheckmarkIcon, ChevronIcon$1 as ChevronIcon, Cluster, CollapsibleSection$1 as CollapsibleSection, Copyable, CountryDropdown, Cover, CustomerSearchIcon, DefaultPageTemplate, Detail$1 as Detail, DisplayBox$1 as DisplayBox, DisplayCard, Dropdown$1 as Dropdown, DuplicateIcon, EditNameForm, EditableList, EditableTable, EmailForm, EmptyCartIcon$1 as EmptyCartIcon, ErroredIcon, ExternalLink, ExternalLinkIcon, FailedIcon, FindIconSmall$1 as FindIconSmall, FooterWithSubfooter$1 as FooterWithSubfooter, ForgotPasswordForm, ForgotPasswordIcon$1 as ForgotPasswordIcon, FormContainer$1 as FormContainer, FormFooterPanel$1 as FormFooterPanel, FormInput$1 as FormInput, FormInputColumn, FormInputRow, FormSelect$1 as FormSelect, FormattedAddress$1 as FormattedAddress, FormattedBankAccount$1 as FormattedBankAccount, FormattedCreditCard$1 as FormattedCreditCard, Frame, GenericCard, GenericCardLarge, GenericErrorIcon, GoToEmailIcon$1 as GoToEmailIcon, Grid, GuidedCheckoutImage, HamburgerButton, Heading$1 as Heading, HighlightTabRow$1 as HighlightTabRow, HistoryIconSmall$1 as HistoryIconSmall, IconAdd, IconQuitLarge, ImageBox, Imposter, InternalLink, Jumbo$1 as Jumbo, KioskImage, LabeledAmount$1 as LabeledAmount, LineItem$1 as LineItem, LinkCard$1 as LinkCard, Loading, LoadingLine, LoginForm, Modal$1 as Modal, Module$1 as Module, Motion, NavFooter, NavHeader, NavMenuDesktop$1 as NavMenuDesktop, NavMenuMobile$1 as NavMenuMobile, NavTabs, NoCustomerResultsIcon, NoPaymentResultsIcon, NotFoundIcon, Obligation, iconsMap as ObligationIcons, Pagination$1 as Pagination, Paragraph$1 as Paragraph, PartialAmountForm, PasswordRequirements, PaymentButtonBar, PaymentDetails$1 as PaymentDetails, PaymentFormACH, PaymentFormCard$1 as PaymentFormCard, PaymentMethodAddIcon$1 as PaymentMethodAddIcon, PaymentMethodIcon$1 as PaymentMethodIcon, PaymentSearchIcon, PaymentsIconSmall$1 as PaymentsIconSmall, PencilIcon$1 as PencilIcon, PendingIcon, PeriscopeDashboardIframe, PeriscopeFailedIcon, PhoneForm, Placeholder$1 as Placeholder, PlusCircleIcon, PointOfSaleImage, Popover$1 as Popover, ProcessingFee$1 as ProcessingFee, ProfileIcon$1 as ProfileIcon, ProfileIconSmall$1 as ProfileIconSmall, ProfileImage, PropertiesAddIcon$1 as PropertiesAddIcon, PropertiesIconSmall$1 as PropertiesIconSmall, RadioButton$2 as RadioButton, RadioButtonWithLabel$1 as RadioButtonWithLabel, RadioGroup, RadioSection$1 as RadioSection, Reel, RefundIcon, RefundIconMedium, RefundIconSmall, RegistrationForm, RejectedIcon, RejectedVelocityIcon, ResetConfirmationForm$1 as ResetConfirmationForm, ResetPasswordForm, ResetPasswordIcon, ResetPasswordSuccess, RevenueManagementImage, RoutingNumberImage, SearchIcon, SearchableSelect$1 as SearchableSelect, SettingsIconSmall$1 as SettingsIconSmall, ShoppingCartIcon, Sidebar, SidebarSingleContent$1 as SidebarSingleContent, SidebarStackContent$1 as SidebarStackContent, SolidDivider$1 as SolidDivider, Spinner$2 as Spinner, Stack, StandardCheckoutImage, FormStateDropdown as StateProvinceDropdown, StatusUnknownIcon, SuccessfulIcon, SuccessfulIconMedium, SuccessfulIconSmall, Switcher, TabSidebar$1 as TabSidebar, Table_styled as Table, TableBody_styled as TableBody, TableCell_styled as TableCell, TableHead$1 as TableHead, TableHeading_styled as TableHeading, TableListItem, TableRow$1 as TableRow, Tabs$1 as Tabs, TermsAndConditions, TermsAndConditionsModal$1 as TermsAndConditionsModal, Text$1 as Text, Timeout$1 as Timeout, TimeoutImage, Title$1 as Title, ToastNotification, ToggleSwitch$1 as ToggleSwitch, TrashIcon$1 as TrashIcon, TypeaheadInput, VerifiedEmailIcon$1 as VerifiedEmailIcon, VoidedIcon, WalletBannerIcon$1 as WalletBannerIcon, WalletIcon$1 as WalletIcon, WalletIconSmall$1 as WalletIconSmall, WarningIconXS, WelcomeModule$1 as WelcomeModule, WorkflowTile, XCircleIconMedium, XCircleIconSmall, cardRegistry, index$5 as constants, createPartialAmountFormState, createPartialAmountFormValidators, index$4 as hooks, index$6 as util, withWindowSize };
|
|
50753
49756
|
//# sourceMappingURL=index.esm.js.map
|