@thecb/components 10.9.0-beta.0 → 10.9.0-beta.10
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 +71 -145
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.esm.js +71 -145
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/dropdown/Dropdown.js +1 -3
- package/src/components/atoms/form-layouts/FormInput.js +0 -6
- package/src/components/atoms/form-select/FormSelect.js +1 -5
- package/src/components/atoms/form-select/index.d.ts +0 -2
- package/src/components/atoms/layouts/Box.d.ts +0 -1
- package/src/components/atoms/layouts/Box.js +0 -2
- package/src/components/atoms/search/Search.js +5 -2
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +1 -5
- package/src/components/atoms/text/index.d.ts +0 -2
- package/src/components/molecules/address-form/AddressForm.js +0 -11
- package/src/components/molecules/payment-details/PaymentDetails.js +1 -2
- package/src/components/molecules/payment-details/PaymentDetails.stories.js +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -6548,7 +6548,7 @@ var BoxWrapper = styled__default(function (_ref) {
|
|
|
6548
6548
|
});
|
|
6549
6549
|
/* eslint-enable no-unused-vars */
|
|
6550
6550
|
|
|
6551
|
-
var _excluded$3 = ["autocompleteValue", "padding", "borderSize", "borderColor", "borderRadius", "boxShadow", "background", "color", "minHeight", "width", "minWidth", "maxWidth", "borderWidthOverride", "border", "textAlign", "hoverStyles", "activeStyles", "disabledStyles", "focusStyles", "variant", "as", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onTouchEnd", "theme", "hiddenStyles", "extraStyles", "srOnly", "dataQa", "
|
|
6551
|
+
var _excluded$3 = ["autocompleteValue", "padding", "borderSize", "borderColor", "borderRadius", "boxShadow", "background", "color", "minHeight", "width", "minWidth", "maxWidth", "borderWidthOverride", "border", "textAlign", "hoverStyles", "activeStyles", "disabledStyles", "focusStyles", "variant", "as", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onTouchEnd", "theme", "hiddenStyles", "extraStyles", "srOnly", "dataQa", "children"];
|
|
6552
6552
|
|
|
6553
6553
|
/*
|
|
6554
6554
|
Box component to create generic boxes
|
|
@@ -6597,7 +6597,6 @@ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
6597
6597
|
_ref$srOnly = _ref.srOnly,
|
|
6598
6598
|
srOnly = _ref$srOnly === void 0 ? false : _ref$srOnly,
|
|
6599
6599
|
dataQa = _ref.dataQa,
|
|
6600
|
-
id = _ref.id,
|
|
6601
6600
|
children = _ref.children,
|
|
6602
6601
|
rest = _objectWithoutProperties(_ref, _excluded$3);
|
|
6603
6602
|
return /*#__PURE__*/React__default.createElement(BoxWrapper, _extends({
|
|
@@ -6633,8 +6632,7 @@ var Box = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
6633
6632
|
onFocus: onFocus,
|
|
6634
6633
|
onBlur: onBlur,
|
|
6635
6634
|
onTouchEnd: onTouchEnd,
|
|
6636
|
-
ref: ref
|
|
6637
|
-
id: id
|
|
6635
|
+
ref: ref
|
|
6638
6636
|
}, rest), children && safeChildren(children, /*#__PURE__*/React__default.createElement(React.Fragment, null)));
|
|
6639
6637
|
});
|
|
6640
6638
|
|
|
@@ -24898,9 +24896,7 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
24898
24896
|
_ref13$ariaInvalid = _ref13.ariaInvalid,
|
|
24899
24897
|
ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid,
|
|
24900
24898
|
_ref13$isRequired = _ref13.isRequired,
|
|
24901
|
-
isRequired = _ref13$isRequired === void 0 ? false : _ref13$isRequired
|
|
24902
|
-
_ref13$inputId = _ref13.inputId,
|
|
24903
|
-
inputId = _ref13$inputId === void 0 ? false : _ref13$inputId;
|
|
24899
|
+
isRequired = _ref13$isRequired === void 0 ? false : _ref13$isRequired;
|
|
24904
24900
|
var _useState = React.useState(""),
|
|
24905
24901
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24906
24902
|
inputValue = _useState2[0],
|
|
@@ -25109,7 +25105,6 @@ var Dropdown = function Dropdown(_ref13) {
|
|
|
25109
25105
|
width: "100%",
|
|
25110
25106
|
dataQa: "".concat(ariaLabelledby, "-dropdown")
|
|
25111
25107
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25112
|
-
id: inputId,
|
|
25113
25108
|
as: "input",
|
|
25114
25109
|
autoComplete: autocompleteValue,
|
|
25115
25110
|
"aria-controls": "".concat(ariaLabelledby, "_listbox"),
|
|
@@ -25312,11 +25307,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
25312
25307
|
_ref$widthFitOptions = _ref.widthFitOptions,
|
|
25313
25308
|
widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions,
|
|
25314
25309
|
_ref$isRequired = _ref.isRequired,
|
|
25315
|
-
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired
|
|
25316
|
-
_ref$htmlFor = _ref.htmlFor,
|
|
25317
|
-
htmlFor = _ref$htmlFor === void 0 ? null : _ref$htmlFor,
|
|
25318
|
-
_ref$inputId = _ref.inputId,
|
|
25319
|
-
inputId = _ref$inputId === void 0 ? null : _ref$inputId;
|
|
25310
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
25320
25311
|
var _useState = React.useState(false),
|
|
25321
25312
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25322
25313
|
open = _useState2[0],
|
|
@@ -25350,10 +25341,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
25350
25341
|
color: themeValues.labelColor,
|
|
25351
25342
|
weight: themeValues.fontWeight,
|
|
25352
25343
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
25353
|
-
id: createIdFromString(labelTextWhenNoError)
|
|
25354
|
-
htmlFor: htmlFor
|
|
25344
|
+
id: createIdFromString(labelTextWhenNoError)
|
|
25355
25345
|
}, labelTextWhenNoError))), /*#__PURE__*/React__default.createElement(Dropdown$1, {
|
|
25356
|
-
inputId: inputId,
|
|
25357
25346
|
ariaLabelledby: createIdFromString(labelTextWhenNoError),
|
|
25358
25347
|
ariaDescribedby: createIdFromString(labelTextWhenNoError, "error message"),
|
|
25359
25348
|
maxHeight: dropdownMaxHeight,
|
|
@@ -26649,45 +26638,34 @@ function _extends$2() {
|
|
|
26649
26638
|
_extends$2 = Object.assign || function (target) {
|
|
26650
26639
|
for (var i = 1; i < arguments.length; i++) {
|
|
26651
26640
|
var source = arguments[i];
|
|
26652
|
-
|
|
26653
26641
|
for (var key in source) {
|
|
26654
26642
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
26655
26643
|
target[key] = source[key];
|
|
26656
26644
|
}
|
|
26657
26645
|
}
|
|
26658
26646
|
}
|
|
26659
|
-
|
|
26660
26647
|
return target;
|
|
26661
26648
|
};
|
|
26662
|
-
|
|
26663
26649
|
return _extends$2.apply(this, arguments);
|
|
26664
26650
|
}
|
|
26665
|
-
|
|
26666
26651
|
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
26667
26652
|
if (source == null) return {};
|
|
26668
26653
|
var target = {};
|
|
26669
26654
|
var sourceKeys = Object.keys(source);
|
|
26670
26655
|
var key, i;
|
|
26671
|
-
|
|
26672
26656
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
26673
26657
|
key = sourceKeys[i];
|
|
26674
26658
|
if (excluded.indexOf(key) >= 0) continue;
|
|
26675
26659
|
target[key] = source[key];
|
|
26676
26660
|
}
|
|
26677
|
-
|
|
26678
26661
|
return target;
|
|
26679
26662
|
}
|
|
26680
|
-
|
|
26681
26663
|
function _objectWithoutProperties$1(source, excluded) {
|
|
26682
26664
|
if (source == null) return {};
|
|
26683
|
-
|
|
26684
26665
|
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
26685
|
-
|
|
26686
26666
|
var key, i;
|
|
26687
|
-
|
|
26688
26667
|
if (Object.getOwnPropertySymbols) {
|
|
26689
26668
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
26690
|
-
|
|
26691
26669
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
26692
26670
|
key = sourceSymbolKeys[i];
|
|
26693
26671
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -26695,48 +26673,37 @@ function _objectWithoutProperties$1(source, excluded) {
|
|
|
26695
26673
|
target[key] = source[key];
|
|
26696
26674
|
}
|
|
26697
26675
|
}
|
|
26698
|
-
|
|
26699
26676
|
return target;
|
|
26700
26677
|
}
|
|
26701
|
-
|
|
26702
26678
|
function _slicedToArray$1(arr, i) {
|
|
26703
26679
|
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
|
|
26704
26680
|
}
|
|
26705
|
-
|
|
26706
26681
|
function _toConsumableArray$1(arr) {
|
|
26707
26682
|
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
|
|
26708
26683
|
}
|
|
26709
|
-
|
|
26710
26684
|
function _arrayWithoutHoles$1(arr) {
|
|
26711
26685
|
if (Array.isArray(arr)) {
|
|
26712
26686
|
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
26713
|
-
|
|
26714
26687
|
return arr2;
|
|
26715
26688
|
}
|
|
26716
26689
|
}
|
|
26717
|
-
|
|
26718
26690
|
function _arrayWithHoles$1(arr) {
|
|
26719
26691
|
if (Array.isArray(arr)) return arr;
|
|
26720
26692
|
}
|
|
26721
|
-
|
|
26722
26693
|
function _iterableToArray$1(iter) {
|
|
26723
26694
|
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
|
26724
26695
|
}
|
|
26725
|
-
|
|
26726
26696
|
function _iterableToArrayLimit$1(arr, i) {
|
|
26727
26697
|
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
|
26728
26698
|
return;
|
|
26729
26699
|
}
|
|
26730
|
-
|
|
26731
26700
|
var _arr = [];
|
|
26732
26701
|
var _n = true;
|
|
26733
26702
|
var _d = false;
|
|
26734
26703
|
var _e = undefined;
|
|
26735
|
-
|
|
26736
26704
|
try {
|
|
26737
26705
|
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
26738
26706
|
_arr.push(_s.value);
|
|
26739
|
-
|
|
26740
26707
|
if (i && _arr.length === i) break;
|
|
26741
26708
|
}
|
|
26742
26709
|
} catch (err) {
|
|
@@ -26749,29 +26716,23 @@ function _iterableToArrayLimit$1(arr, i) {
|
|
|
26749
26716
|
if (_d) throw _e;
|
|
26750
26717
|
}
|
|
26751
26718
|
}
|
|
26752
|
-
|
|
26753
26719
|
return _arr;
|
|
26754
26720
|
}
|
|
26755
|
-
|
|
26756
26721
|
function _nonIterableSpread$1() {
|
|
26757
26722
|
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
26758
26723
|
}
|
|
26759
|
-
|
|
26760
26724
|
function _nonIterableRest$1() {
|
|
26761
26725
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
26762
26726
|
}
|
|
26763
|
-
|
|
26764
26727
|
var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
|
|
26765
26728
|
return _toConsumableArray$1(new Set(formats.join("").split(formatChar).join("").split("")));
|
|
26766
26729
|
};
|
|
26767
26730
|
var format$1 = function format(formatter) {
|
|
26768
26731
|
return function (value) {
|
|
26769
26732
|
var usedFormat = formatter.formats[value.length];
|
|
26770
|
-
|
|
26771
26733
|
if (!usedFormat) {
|
|
26772
26734
|
return value;
|
|
26773
26735
|
}
|
|
26774
|
-
|
|
26775
26736
|
var formatPieces = usedFormat.split(formatter.formatChar);
|
|
26776
26737
|
var valuePieces = value.split("");
|
|
26777
26738
|
var zipped = formatPieces.map(function (v, i) {
|
|
@@ -26780,7 +26741,6 @@ var format$1 = function format(formatter) {
|
|
|
26780
26741
|
return zipped.join("");
|
|
26781
26742
|
};
|
|
26782
26743
|
};
|
|
26783
|
-
|
|
26784
26744
|
var countDelims = function countDelims(formatter, index) {
|
|
26785
26745
|
var count = 0;
|
|
26786
26746
|
var format = formatter.formats[index];
|
|
@@ -26790,13 +26750,11 @@ var countDelims = function countDelims(formatter, index) {
|
|
|
26790
26750
|
});
|
|
26791
26751
|
return count;
|
|
26792
26752
|
};
|
|
26793
|
-
|
|
26794
26753
|
var unformat = function unformat(formatter) {
|
|
26795
26754
|
return function (formattedValue, formatIndex) {
|
|
26796
26755
|
if (formatIndex >= formatter.formats.length) {
|
|
26797
26756
|
return formattedValue;
|
|
26798
26757
|
}
|
|
26799
|
-
|
|
26800
26758
|
var format = formatter.formats[formatIndex];
|
|
26801
26759
|
return formattedValue.split("").filter(function (_, i) {
|
|
26802
26760
|
return !(format[i] != formatter.formatChar);
|
|
@@ -26810,7 +26768,6 @@ var inject = function inject(baseString) {
|
|
|
26810
26768
|
};
|
|
26811
26769
|
var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
|
|
26812
26770
|
var maxFormatExceeded = rawValue.length >= formatter.formats.length;
|
|
26813
|
-
|
|
26814
26771
|
if (maxFormatExceeded) {
|
|
26815
26772
|
return formattedIndex;
|
|
26816
26773
|
} else {
|
|
@@ -26835,7 +26792,6 @@ var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex,
|
|
|
26835
26792
|
}, 0) + rawIndex;
|
|
26836
26793
|
}
|
|
26837
26794
|
};
|
|
26838
|
-
|
|
26839
26795
|
var createFormat = function createFormat(formats, formatChar) {
|
|
26840
26796
|
return {
|
|
26841
26797
|
uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
|
|
@@ -26843,83 +26799,80 @@ var createFormat = function createFormat(formats, formatChar) {
|
|
|
26843
26799
|
formatChar: formatChar
|
|
26844
26800
|
};
|
|
26845
26801
|
};
|
|
26846
|
-
|
|
26847
26802
|
var FormattedInput = function FormattedInput(_ref) {
|
|
26848
26803
|
var value = _ref.value,
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
|
|
26804
|
+
formatter = _ref.formatter,
|
|
26805
|
+
onChange = _ref.onChange,
|
|
26806
|
+
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
26807
|
+
var _useState = React.useState(format$1(formatter)(value)),
|
|
26808
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
26809
|
+
formattedValue = _useState2[0],
|
|
26810
|
+
setFormattedValue = _useState2[1];
|
|
26853
26811
|
var inputEl = React.useRef(null);
|
|
26854
|
-
|
|
26855
|
-
var _useState = React.useState({
|
|
26812
|
+
var stateRefs = React.useRef({
|
|
26856
26813
|
selectionStart: 0,
|
|
26857
26814
|
selectionEnd: 0,
|
|
26858
|
-
|
|
26859
|
-
|
|
26860
|
-
|
|
26861
|
-
}),
|
|
26862
|
-
_useState2 = _slicedToArray$1(_useState, 2),
|
|
26863
|
-
state = _useState2[0],
|
|
26864
|
-
setState = _useState2[1];
|
|
26865
|
-
|
|
26815
|
+
isDelete: false,
|
|
26816
|
+
rawValue: ''
|
|
26817
|
+
});
|
|
26866
26818
|
React.useLayoutEffect(function () {
|
|
26867
26819
|
// A lot of the work here is cursor manipulation
|
|
26868
26820
|
if (inputEl.current && inputEl.current === document.activeElement) {
|
|
26869
|
-
inputEl.current.setSelectionRange(
|
|
26821
|
+
inputEl.current.setSelectionRange(stateRefs.current.selectionStart, stateRefs.current.selectionEnd);
|
|
26870
26822
|
}
|
|
26871
|
-
});
|
|
26872
|
-
|
|
26823
|
+
}, [stateRefs]);
|
|
26824
|
+
var handleChange = function handleChange(event) {
|
|
26825
|
+
var deleteKeyPressed = stateRefs.current.isDelete;
|
|
26826
|
+
var maxFormatExceeded = stateRefs.current.rawValue.length >= formatter.formats.length - 1;
|
|
26827
|
+
if (maxFormatExceeded && !deleteKeyPressed) {
|
|
26828
|
+
return;
|
|
26829
|
+
}
|
|
26830
|
+
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
26831
|
+
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
26832
|
+
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
26833
|
+
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
26834
|
+
* old unformatted value.
|
|
26835
|
+
*/
|
|
26836
|
+
|
|
26837
|
+
var injectionLength = event.target.value.length - formattedValue.length;
|
|
26838
|
+
var end = stateRefs.current.selectionStart === stateRefs.current.selectionEnd ? stateRefs.current.selectionStart + injectionLength : stateRefs.current.selectionEnd - 1;
|
|
26839
|
+
var injection = event.target.value.substring(stateRefs.current.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
26840
|
+
// Need to find where to put it
|
|
26841
|
+
|
|
26842
|
+
var rawInjectionPointStart = formattedToUnformattedIndex(stateRefs.current.selectionStart, stateRefs.current.rawValue, formatter);
|
|
26843
|
+
var rawInjectionPointEnd = formattedToUnformattedIndex(stateRefs.current.selectionEnd, stateRefs.current.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
26844
|
+
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
26845
|
+
|
|
26846
|
+
var unformattedOldValue = unformat(formatter)(formattedValue, stateRefs.current.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
26847
|
+
|
|
26848
|
+
var injectIntoOldValue = inject(unformattedOldValue);
|
|
26849
|
+
var unformattedNewValue = deleteKeyPressed ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
26850
|
+
var lengthDifference = unformattedNewValue.length - stateRefs.current.rawValue.length;
|
|
26851
|
+
var rawIndex = formattedToUnformattedIndex(stateRefs.current.selectionStart, stateRefs.current.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
26852
|
+
// Applied by useLayoutEffect
|
|
26853
|
+
|
|
26854
|
+
var newFormattedCursorPosition = stateRefs.current.selectionStart === stateRefs.current.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, deleteKeyPressed) : deleteKeyPressed ? stateRefs.current.selectionStart : stateRefs.current.selectionEnd;
|
|
26855
|
+
var formattedNewValue = format$1(formatter)(unformattedNewValue);
|
|
26856
|
+
setFormattedValue(formattedNewValue); // Apply the external onChange function to the raw underlying string
|
|
26857
|
+
// This is where the user generally updates the input value
|
|
26858
|
+
|
|
26859
|
+
if (onChange) {
|
|
26860
|
+
onChange(unformattedNewValue);
|
|
26861
|
+
}
|
|
26862
|
+
};
|
|
26863
|
+
return /*#__PURE__*/React__default.createElement("input", _extends$2({}, props, {
|
|
26873
26864
|
ref: inputEl,
|
|
26874
26865
|
value: format$1(formatter)(value),
|
|
26875
26866
|
onKeyDown: function onKeyDown(event) {
|
|
26876
|
-
// Keep track of the state of the input before onChange
|
|
26877
|
-
|
|
26878
|
-
|
|
26867
|
+
// Keep track of the state of the input before onChange
|
|
26868
|
+
stateRefs.current = {
|
|
26869
|
+
isDelete: event.key === "Backspace" || event.key === "Delete",
|
|
26879
26870
|
selectionStart: event.target.selectionStart,
|
|
26880
26871
|
selectionEnd: event.target.selectionEnd,
|
|
26881
|
-
|
|
26882
|
-
|
|
26883
|
-
});
|
|
26872
|
+
rawValue: value
|
|
26873
|
+
};
|
|
26884
26874
|
},
|
|
26885
|
-
onChange:
|
|
26886
|
-
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
26887
|
-
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
26888
|
-
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
26889
|
-
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
26890
|
-
* old unformatted value.
|
|
26891
|
-
*/
|
|
26892
|
-
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
26893
|
-
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
26894
|
-
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
26895
|
-
// Need to find where to put it
|
|
26896
|
-
|
|
26897
|
-
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
26898
|
-
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
26899
|
-
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
26900
|
-
|
|
26901
|
-
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
26902
|
-
|
|
26903
|
-
var injectIntoOldValue = inject(unformattedOldValue);
|
|
26904
|
-
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
26905
|
-
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
26906
|
-
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
26907
|
-
// Applied by useLayoutEffect
|
|
26908
|
-
|
|
26909
|
-
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
26910
|
-
setState({
|
|
26911
|
-
selectionStart: newFormattedCursorPosition,
|
|
26912
|
-
selectionEnd: newFormattedCursorPosition,
|
|
26913
|
-
rawValue: state.rawValue,
|
|
26914
|
-
"delete": false,
|
|
26915
|
-
formattedValue: state.formattedValue
|
|
26916
|
-
}); // Apply the external onChange function to the raw underlying string
|
|
26917
|
-
// This is where the user generally updates the input value
|
|
26918
|
-
|
|
26919
|
-
if (_onChange) {
|
|
26920
|
-
_onChange(unformattedNewValue);
|
|
26921
|
-
}
|
|
26922
|
-
}
|
|
26875
|
+
onChange: handleChange
|
|
26923
26876
|
}));
|
|
26924
26877
|
};
|
|
26925
26878
|
|
|
@@ -26988,7 +26941,7 @@ var fallbackValues$k = {
|
|
|
26988
26941
|
};
|
|
26989
26942
|
|
|
26990
26943
|
var _excluded$s = ["showErrors", "themeValues"],
|
|
26991
|
-
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"
|
|
26944
|
+
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocompleteValue", "extraStyles", "removeFromValue", "dataQa", "isRequired"];
|
|
26992
26945
|
var InputField = styled__default.input.withConfig({
|
|
26993
26946
|
displayName: "FormInput__InputField",
|
|
26994
26947
|
componentId: "sc-l094r1-0"
|
|
@@ -27076,10 +27029,6 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27076
27029
|
dataQa = _ref15$dataQa === void 0 ? null : _ref15$dataQa,
|
|
27077
27030
|
_ref15$isRequired = _ref15.isRequired,
|
|
27078
27031
|
isRequired = _ref15$isRequired === void 0 ? false : _ref15$isRequired,
|
|
27079
|
-
_ref15$htmlFor = _ref15.htmlFor,
|
|
27080
|
-
htmlFor = _ref15$htmlFor === void 0 ? null : _ref15$htmlFor,
|
|
27081
|
-
_ref15$inputId = _ref15.inputId,
|
|
27082
|
-
inputId = _ref15$inputId === void 0 ? null : _ref15$inputId,
|
|
27083
27032
|
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
27084
27033
|
var _useState = React.useState(false),
|
|
27085
27034
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -27117,8 +27066,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27117
27066
|
variant: "pS",
|
|
27118
27067
|
weight: themeValues.fontWeight,
|
|
27119
27068
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
27120
|
-
id: createIdFromString(labelTextWhenNoError)
|
|
27121
|
-
htmlFor: htmlFor
|
|
27069
|
+
id: createIdFromString(labelTextWhenNoError)
|
|
27122
27070
|
}, labelTextWhenNoError), helperModal()) : /*#__PURE__*/React__default.createElement(Box, {
|
|
27123
27071
|
padding: "0",
|
|
27124
27072
|
minWidth: "100%"
|
|
@@ -27131,8 +27079,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27131
27079
|
variant: "pS",
|
|
27132
27080
|
fontWeight: themeValues.fontWeight,
|
|
27133
27081
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
27134
|
-
id: createIdFromString(labelTextWhenNoError)
|
|
27135
|
-
htmlFor: htmlFor
|
|
27082
|
+
id: createIdFromString(labelTextWhenNoError)
|
|
27136
27083
|
}, labelTextWhenNoError), type === "password" && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
27137
27084
|
variant: "pS",
|
|
27138
27085
|
color: themeValues.linkColor,
|
|
@@ -27153,7 +27100,6 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27153
27100
|
}, decorator)))), /*#__PURE__*/React__default.createElement(Box, {
|
|
27154
27101
|
padding: "0"
|
|
27155
27102
|
}, formatter ? /*#__PURE__*/React__default.createElement(FormattedInputField, _extends({
|
|
27156
|
-
id: inputId || (props === null || props === void 0 ? void 0 : props.id),
|
|
27157
27103
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
27158
27104
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
27159
27105
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
@@ -27186,7 +27132,6 @@ var FormInput = function FormInput(_ref15) {
|
|
|
27186
27132
|
}
|
|
27187
27133
|
}
|
|
27188
27134
|
}, props)) : /*#__PURE__*/React__default.createElement(InputField, _extends({
|
|
27189
|
-
id: inputId || (props === null || props === void 0 ? void 0 : props.id),
|
|
27190
27135
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
27191
27136
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
27192
27137
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
@@ -28621,7 +28566,7 @@ var Search = function Search(_ref) {
|
|
|
28621
28566
|
id: "searchInput",
|
|
28622
28567
|
role: "search",
|
|
28623
28568
|
"aria-controls": ariaControlsId,
|
|
28624
|
-
extraStyles: "border-radius:
|
|
28569
|
+
extraStyles: "border-radius: 4px 0 0 4px; border: none; box-shadow: 0px 1px 2px 0px ".concat(CHARADE_GREY, "1A; font-size: 0.875rem;"),
|
|
28625
28570
|
onKeyDown: function onKeyDown(e) {
|
|
28626
28571
|
return searchOnKeypress || e.key === "Enter" ? handleSubmit() : noop;
|
|
28627
28572
|
},
|
|
@@ -28649,7 +28594,7 @@ var Search = function Search(_ref) {
|
|
|
28649
28594
|
minWidth: "0",
|
|
28650
28595
|
width: "3rem",
|
|
28651
28596
|
padding: ".5rem",
|
|
28652
|
-
extraStyles: "\n height: 48px; \n margin: 4px 0 0;\n border-radius: 0
|
|
28597
|
+
extraStyles: "\n height: 48px; \n margin: 4px 0 0;\n border-radius: 0 4px 4px 0;\n background: ".concat(themeValues.searchIconBackgroundColor, ";\n border: none;\n box-shadow: 0px 1px 2px 0px ").concat(CHARADE_GREY, "1A;\n "),
|
|
28653
28598
|
variant: "primary",
|
|
28654
28599
|
contentOverride: true,
|
|
28655
28600
|
action: handleSubmit
|
|
@@ -39326,11 +39271,7 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
39326
39271
|
showErrors = _ref.showErrors,
|
|
39327
39272
|
countryCode = _ref.countryCode,
|
|
39328
39273
|
_ref$isRequired = _ref.isRequired,
|
|
39329
|
-
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired
|
|
39330
|
-
_ref$htmlFor = _ref.htmlFor,
|
|
39331
|
-
htmlFor = _ref$htmlFor === void 0 ? null : _ref$htmlFor,
|
|
39332
|
-
_ref$inputId = _ref.inputId,
|
|
39333
|
-
inputId = _ref$inputId === void 0 ? null : _ref$inputId;
|
|
39274
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired;
|
|
39334
39275
|
var placeholder = countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
|
|
39335
39276
|
var options = [placeholder].concat(_toConsumableArray(getOptions(countryCode)));
|
|
39336
39277
|
return /*#__PURE__*/React__default.createElement(FormSelect$1, {
|
|
@@ -39341,8 +39282,6 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
39341
39282
|
errorMessages: errorMessages,
|
|
39342
39283
|
showErrors: showErrors,
|
|
39343
39284
|
autocompleteValue: "address-level1",
|
|
39344
|
-
htmlFor: htmlFor,
|
|
39345
|
-
inputId: inputId,
|
|
39346
39285
|
isRequired: isRequired
|
|
39347
39286
|
});
|
|
39348
39287
|
};
|
|
@@ -40868,8 +40807,6 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40868
40807
|
return e.key === "Enter" && handleSubmit(e);
|
|
40869
40808
|
},
|
|
40870
40809
|
autocompleteValue: "address-line1",
|
|
40871
|
-
htmlFor: "address-line1",
|
|
40872
|
-
inputId: "address-line1",
|
|
40873
40810
|
dataQa: "Address",
|
|
40874
40811
|
isRequired: true
|
|
40875
40812
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
@@ -40881,8 +40818,6 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40881
40818
|
return e.key === "Enter" && handleSubmit(e);
|
|
40882
40819
|
},
|
|
40883
40820
|
autocompleteValue: "address-line2",
|
|
40884
|
-
htmlFor: "address-line2",
|
|
40885
|
-
inputId: "address-line2",
|
|
40886
40821
|
dataQa: "Address Line 2"
|
|
40887
40822
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
40888
40823
|
labelTextWhenNoError: "City",
|
|
@@ -40894,8 +40829,6 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40894
40829
|
return e.key === "Enter" && handleSubmit(e);
|
|
40895
40830
|
},
|
|
40896
40831
|
autocompleteValue: "address-level2",
|
|
40897
|
-
htmlFor: "city",
|
|
40898
|
-
inputId: "city",
|
|
40899
40832
|
dataQa: "City",
|
|
40900
40833
|
isRequired: true
|
|
40901
40834
|
}), /*#__PURE__*/React__default.createElement(FormStateDropdown, {
|
|
@@ -40908,9 +40841,6 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40908
40841
|
onKeyDown: function onKeyDown(e) {
|
|
40909
40842
|
return e.key === "Enter" && handleSubmit(e);
|
|
40910
40843
|
},
|
|
40911
|
-
autocompleteValue: "address-level1",
|
|
40912
|
-
htmlFor: "stateOrProvince",
|
|
40913
|
-
inputId: "stateOrProvince",
|
|
40914
40844
|
dataQa: "State or Province",
|
|
40915
40845
|
isRequired: true
|
|
40916
40846
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
@@ -40925,8 +40855,6 @@ var AddressForm = function AddressForm(_ref) {
|
|
|
40925
40855
|
return e.key === "Enter" && handleSubmit(e);
|
|
40926
40856
|
},
|
|
40927
40857
|
autocompleteValue: "postal-code",
|
|
40928
|
-
htmlFor: "postal-code",
|
|
40929
|
-
inputId: "postal-code",
|
|
40930
40858
|
dataQa: "Zip code",
|
|
40931
40859
|
isRequired: true
|
|
40932
40860
|
}), showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
@@ -48060,8 +47988,6 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
48060
47988
|
isLoading = _ref4$isLoading === void 0 ? false : _ref4$isLoading,
|
|
48061
47989
|
_ref4$isError = _ref4.isError,
|
|
48062
47990
|
isError = _ref4$isError === void 0 ? false : _ref4$isError,
|
|
48063
|
-
_ref4$multiCartEnable = _ref4.multiCartEnabled,
|
|
48064
|
-
multiCartEnabled = _ref4$multiCartEnable === void 0 ? false : _ref4$multiCartEnable,
|
|
48065
47991
|
agencyDisplayName = _ref4.agencyDisplayName;
|
|
48066
47992
|
var _useState = React.useState(initiallyOpen),
|
|
48067
47993
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -48102,7 +48028,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
48102
48028
|
variant: themeValues.labeledAmountSubtotal
|
|
48103
48029
|
}, fee)));
|
|
48104
48030
|
});
|
|
48105
|
-
var agencySubheading = /*#__PURE__*/React__default.createElement(React__default.Fragment, null,
|
|
48031
|
+
var agencySubheading = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, agencyDisplayName && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48106
48032
|
justify: "space-between",
|
|
48107
48033
|
align: "center",
|
|
48108
48034
|
style: {
|