@thecb/components 10.8.3-beta.2 → 10.8.3-beta.3
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 +62 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +62 -46
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/search/Search.js +3 -1
- 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
|
@@ -26834,11 +26834,15 @@ var createFormat = function createFormat(formats, formatChar) {
|
|
|
26834
26834
|
};
|
|
26835
26835
|
|
|
26836
26836
|
var FormattedInput = function FormattedInput(_ref) {
|
|
26837
|
-
var
|
|
26837
|
+
var _ref$isMobile = _ref.isMobile,
|
|
26838
|
+
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
|
|
26839
|
+
value = _ref.value,
|
|
26838
26840
|
formatter = _ref.formatter,
|
|
26839
|
-
|
|
26840
|
-
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
26841
|
+
onChange = _ref.onChange,
|
|
26842
|
+
props = _objectWithoutProperties$1(_ref, ["isMobile", "value", "formatter", "onChange"]);
|
|
26841
26843
|
|
|
26844
|
+
console.log("🚀 ~ FormattedInput ~ props:", props);
|
|
26845
|
+
console.log('isMobile line', isMobile);
|
|
26842
26846
|
var inputEl = React.useRef(null);
|
|
26843
26847
|
|
|
26844
26848
|
var _useState = React.useState({
|
|
@@ -26858,6 +26862,48 @@ var FormattedInput = function FormattedInput(_ref) {
|
|
|
26858
26862
|
inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
26859
26863
|
}
|
|
26860
26864
|
});
|
|
26865
|
+
|
|
26866
|
+
var handleFormat = function handleFormat(event) {
|
|
26867
|
+
console.log('in handle format');
|
|
26868
|
+
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
26869
|
+
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
26870
|
+
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
26871
|
+
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
26872
|
+
* old unformatted value.
|
|
26873
|
+
*/
|
|
26874
|
+
|
|
26875
|
+
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
26876
|
+
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
26877
|
+
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
26878
|
+
// Need to find where to put it
|
|
26879
|
+
|
|
26880
|
+
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
26881
|
+
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
26882
|
+
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
26883
|
+
|
|
26884
|
+
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
26885
|
+
|
|
26886
|
+
var injectIntoOldValue = inject(unformattedOldValue);
|
|
26887
|
+
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
26888
|
+
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
26889
|
+
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
26890
|
+
// Applied by useLayoutEffect
|
|
26891
|
+
|
|
26892
|
+
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
26893
|
+
setState({
|
|
26894
|
+
selectionStart: newFormattedCursorPosition,
|
|
26895
|
+
selectionEnd: newFormattedCursorPosition,
|
|
26896
|
+
rawValue: state.rawValue,
|
|
26897
|
+
"delete": false,
|
|
26898
|
+
formattedValue: state.formattedValue
|
|
26899
|
+
}); // Apply the external onChange function to the raw underlying string
|
|
26900
|
+
// This is where the user generally updates the input value
|
|
26901
|
+
|
|
26902
|
+
if (onChange) {
|
|
26903
|
+
onChange(unformattedNewValue);
|
|
26904
|
+
}
|
|
26905
|
+
};
|
|
26906
|
+
|
|
26861
26907
|
return React__default.createElement("input", _extends$2({}, props, {
|
|
26862
26908
|
ref: inputEl,
|
|
26863
26909
|
value: format$1(formatter)(value),
|
|
@@ -26870,44 +26916,16 @@ var FormattedInput = function FormattedInput(_ref) {
|
|
|
26870
26916
|
"delete": event.key === "Backspace" || event.key === "Delete",
|
|
26871
26917
|
formattedValue: event.target.value
|
|
26872
26918
|
});
|
|
26873
|
-
}
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
|
|
26883
|
-
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
26884
|
-
// Need to find where to put it
|
|
26885
|
-
|
|
26886
|
-
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
26887
|
-
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
26888
|
-
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
26889
|
-
|
|
26890
|
-
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
26891
|
-
|
|
26892
|
-
var injectIntoOldValue = inject(unformattedOldValue);
|
|
26893
|
-
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
26894
|
-
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
26895
|
-
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
26896
|
-
// Applied by useLayoutEffect
|
|
26897
|
-
|
|
26898
|
-
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
26899
|
-
setState({
|
|
26900
|
-
selectionStart: newFormattedCursorPosition,
|
|
26901
|
-
selectionEnd: newFormattedCursorPosition,
|
|
26902
|
-
rawValue: state.rawValue,
|
|
26903
|
-
"delete": false,
|
|
26904
|
-
formattedValue: state.formattedValue
|
|
26905
|
-
}); // Apply the external onChange function to the raw underlying string
|
|
26906
|
-
// This is where the user generally updates the input value
|
|
26907
|
-
|
|
26908
|
-
if (_onChange) {
|
|
26909
|
-
_onChange(unformattedNewValue);
|
|
26910
|
-
}
|
|
26919
|
+
}
|
|
26920
|
+
}, isMobile ? {
|
|
26921
|
+
onBlur: function onBlur(e) {
|
|
26922
|
+
debugger;
|
|
26923
|
+
handleFormat(e);
|
|
26924
|
+
}
|
|
26925
|
+
} : {
|
|
26926
|
+
onChange: function onChange(e) {
|
|
26927
|
+
debugger;
|
|
26928
|
+
handleFormat(e);
|
|
26911
26929
|
}
|
|
26912
26930
|
}));
|
|
26913
26931
|
};
|
|
@@ -28602,7 +28620,7 @@ var Search = function Search(_ref) {
|
|
|
28602
28620
|
id: "searchInput",
|
|
28603
28621
|
role: "search",
|
|
28604
28622
|
"aria-controls": ariaControlsId,
|
|
28605
|
-
extraStyles: "border-radius: 4px 0 0 4px
|
|
28623
|
+
extraStyles: "border-radius: 4px 0 0 4px; border: none; box-shadow: 0px 1px 2px 0px ".concat(CHARADE_GREY, "1A; font-size: 0.875rem;"),
|
|
28606
28624
|
onKeyDown: function onKeyDown(e) {
|
|
28607
28625
|
return searchOnKeypress || e.key === "Enter" ? handleSubmit() : noop;
|
|
28608
28626
|
},
|
|
@@ -28630,7 +28648,7 @@ var Search = function Search(_ref) {
|
|
|
28630
28648
|
minWidth: "0",
|
|
28631
28649
|
width: "3rem",
|
|
28632
28650
|
padding: ".5rem",
|
|
28633
|
-
extraStyles: "\n height: 48px; \n margin: 4px 0 0;\n border-radius: 0 4px 4px 0;\n background: ".concat(themeValues.searchIconBackgroundColor, ";\n "),
|
|
28651
|
+
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 "),
|
|
28634
28652
|
variant: "primary",
|
|
28635
28653
|
contentOverride: true,
|
|
28636
28654
|
action: handleSubmit
|
|
@@ -48024,8 +48042,6 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
48024
48042
|
isLoading = _ref4$isLoading === void 0 ? false : _ref4$isLoading,
|
|
48025
48043
|
_ref4$isError = _ref4.isError,
|
|
48026
48044
|
isError = _ref4$isError === void 0 ? false : _ref4$isError,
|
|
48027
|
-
_ref4$multiCartEnable = _ref4.multiCartEnabled,
|
|
48028
|
-
multiCartEnabled = _ref4$multiCartEnable === void 0 ? false : _ref4$multiCartEnable,
|
|
48029
48045
|
agencyDisplayName = _ref4.agencyDisplayName;
|
|
48030
48046
|
var _useState = React.useState(initiallyOpen),
|
|
48031
48047
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -48066,7 +48082,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
48066
48082
|
variant: themeValues.labeledAmountSubtotal
|
|
48067
48083
|
}, fee)));
|
|
48068
48084
|
});
|
|
48069
|
-
var agencySubheading = /*#__PURE__*/React__default.createElement(React__default.Fragment, null,
|
|
48085
|
+
var agencySubheading = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, agencyDisplayName && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48070
48086
|
justify: "space-between",
|
|
48071
48087
|
align: "center",
|
|
48072
48088
|
style: {
|