@thecb/components 10.8.3-beta.1 → 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.esm.js
CHANGED
|
@@ -26826,11 +26826,15 @@ var createFormat = function createFormat(formats, formatChar) {
|
|
|
26826
26826
|
};
|
|
26827
26827
|
|
|
26828
26828
|
var FormattedInput = function FormattedInput(_ref) {
|
|
26829
|
-
var
|
|
26829
|
+
var _ref$isMobile = _ref.isMobile,
|
|
26830
|
+
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
|
|
26831
|
+
value = _ref.value,
|
|
26830
26832
|
formatter = _ref.formatter,
|
|
26831
|
-
|
|
26832
|
-
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
26833
|
+
onChange = _ref.onChange,
|
|
26834
|
+
props = _objectWithoutProperties$1(_ref, ["isMobile", "value", "formatter", "onChange"]);
|
|
26833
26835
|
|
|
26836
|
+
console.log("🚀 ~ FormattedInput ~ props:", props);
|
|
26837
|
+
console.log('isMobile line', isMobile);
|
|
26834
26838
|
var inputEl = useRef(null);
|
|
26835
26839
|
|
|
26836
26840
|
var _useState = useState({
|
|
@@ -26850,6 +26854,48 @@ var FormattedInput = function FormattedInput(_ref) {
|
|
|
26850
26854
|
inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
26851
26855
|
}
|
|
26852
26856
|
});
|
|
26857
|
+
|
|
26858
|
+
var handleFormat = function handleFormat(event) {
|
|
26859
|
+
console.log('in handle format');
|
|
26860
|
+
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
26861
|
+
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
26862
|
+
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
26863
|
+
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
26864
|
+
* old unformatted value.
|
|
26865
|
+
*/
|
|
26866
|
+
|
|
26867
|
+
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
26868
|
+
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
26869
|
+
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
26870
|
+
// Need to find where to put it
|
|
26871
|
+
|
|
26872
|
+
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
26873
|
+
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
26874
|
+
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
26875
|
+
|
|
26876
|
+
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
26877
|
+
|
|
26878
|
+
var injectIntoOldValue = inject(unformattedOldValue);
|
|
26879
|
+
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
26880
|
+
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
26881
|
+
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
26882
|
+
// Applied by useLayoutEffect
|
|
26883
|
+
|
|
26884
|
+
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
26885
|
+
setState({
|
|
26886
|
+
selectionStart: newFormattedCursorPosition,
|
|
26887
|
+
selectionEnd: newFormattedCursorPosition,
|
|
26888
|
+
rawValue: state.rawValue,
|
|
26889
|
+
"delete": false,
|
|
26890
|
+
formattedValue: state.formattedValue
|
|
26891
|
+
}); // Apply the external onChange function to the raw underlying string
|
|
26892
|
+
// This is where the user generally updates the input value
|
|
26893
|
+
|
|
26894
|
+
if (onChange) {
|
|
26895
|
+
onChange(unformattedNewValue);
|
|
26896
|
+
}
|
|
26897
|
+
};
|
|
26898
|
+
|
|
26853
26899
|
return React.createElement("input", _extends$2({}, props, {
|
|
26854
26900
|
ref: inputEl,
|
|
26855
26901
|
value: format$1(formatter)(value),
|
|
@@ -26862,44 +26908,16 @@ var FormattedInput = function FormattedInput(_ref) {
|
|
|
26862
26908
|
"delete": event.key === "Backspace" || event.key === "Delete",
|
|
26863
26909
|
formattedValue: event.target.value
|
|
26864
26910
|
});
|
|
26865
|
-
}
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
26876
|
-
// Need to find where to put it
|
|
26877
|
-
|
|
26878
|
-
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
26879
|
-
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
26880
|
-
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
26881
|
-
|
|
26882
|
-
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
26883
|
-
|
|
26884
|
-
var injectIntoOldValue = inject(unformattedOldValue);
|
|
26885
|
-
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
26886
|
-
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
26887
|
-
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
26888
|
-
// Applied by useLayoutEffect
|
|
26889
|
-
|
|
26890
|
-
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
26891
|
-
setState({
|
|
26892
|
-
selectionStart: newFormattedCursorPosition,
|
|
26893
|
-
selectionEnd: newFormattedCursorPosition,
|
|
26894
|
-
rawValue: state.rawValue,
|
|
26895
|
-
"delete": false,
|
|
26896
|
-
formattedValue: state.formattedValue
|
|
26897
|
-
}); // Apply the external onChange function to the raw underlying string
|
|
26898
|
-
// This is where the user generally updates the input value
|
|
26899
|
-
|
|
26900
|
-
if (_onChange) {
|
|
26901
|
-
_onChange(unformattedNewValue);
|
|
26902
|
-
}
|
|
26911
|
+
}
|
|
26912
|
+
}, isMobile ? {
|
|
26913
|
+
onBlur: function onBlur(e) {
|
|
26914
|
+
debugger;
|
|
26915
|
+
handleFormat(e);
|
|
26916
|
+
}
|
|
26917
|
+
} : {
|
|
26918
|
+
onChange: function onChange(e) {
|
|
26919
|
+
debugger;
|
|
26920
|
+
handleFormat(e);
|
|
26903
26921
|
}
|
|
26904
26922
|
}));
|
|
26905
26923
|
};
|
|
@@ -28594,7 +28612,7 @@ var Search = function Search(_ref) {
|
|
|
28594
28612
|
id: "searchInput",
|
|
28595
28613
|
role: "search",
|
|
28596
28614
|
"aria-controls": ariaControlsId,
|
|
28597
|
-
extraStyles: "border: none; box-shadow: 0px 1px 2px 0px ".concat(CHARADE_GREY, "1A; font-size: 0.875rem;"),
|
|
28615
|
+
extraStyles: "border-radius: 4px 0 0 4px; border: none; box-shadow: 0px 1px 2px 0px ".concat(CHARADE_GREY, "1A; font-size: 0.875rem;"),
|
|
28598
28616
|
onKeyDown: function onKeyDown(e) {
|
|
28599
28617
|
return searchOnKeypress || e.key === "Enter" ? handleSubmit() : noop;
|
|
28600
28618
|
},
|
|
@@ -28622,7 +28640,7 @@ var Search = function Search(_ref) {
|
|
|
28622
28640
|
minWidth: "0",
|
|
28623
28641
|
width: "3rem",
|
|
28624
28642
|
padding: ".5rem",
|
|
28625
|
-
extraStyles: "\n height: 48px; \n margin: 4px 0 0;\n border-radius: 0 4px 4px 0;\n background: ".concat(themeValues.searchIconBackgroundColor, ";\n "),
|
|
28643
|
+
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 "),
|
|
28626
28644
|
variant: "primary",
|
|
28627
28645
|
contentOverride: true,
|
|
28628
28646
|
action: handleSubmit
|
|
@@ -48016,8 +48034,6 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
48016
48034
|
isLoading = _ref4$isLoading === void 0 ? false : _ref4$isLoading,
|
|
48017
48035
|
_ref4$isError = _ref4.isError,
|
|
48018
48036
|
isError = _ref4$isError === void 0 ? false : _ref4$isError,
|
|
48019
|
-
_ref4$multiCartEnable = _ref4.multiCartEnabled,
|
|
48020
|
-
multiCartEnabled = _ref4$multiCartEnable === void 0 ? false : _ref4$multiCartEnable,
|
|
48021
48037
|
agencyDisplayName = _ref4.agencyDisplayName;
|
|
48022
48038
|
var _useState = useState(initiallyOpen),
|
|
48023
48039
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -48058,7 +48074,7 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
48058
48074
|
variant: themeValues.labeledAmountSubtotal
|
|
48059
48075
|
}, fee)));
|
|
48060
48076
|
});
|
|
48061
|
-
var agencySubheading = /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
48077
|
+
var agencySubheading = /*#__PURE__*/React.createElement(React.Fragment, null, agencyDisplayName && /*#__PURE__*/React.createElement(Cluster, {
|
|
48062
48078
|
justify: "space-between",
|
|
48063
48079
|
align: "center",
|
|
48064
48080
|
style: {
|