@thecb/components 5.0.0-beta.9 → 5.0.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 CHANGED
@@ -5014,10 +5014,6 @@ var TextSpan = styled__default.span.withConfig({
5014
5014
 
5015
5015
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5016
5016
 
5017
- function unwrapExports (x) {
5018
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5019
- }
5020
-
5021
5017
  function createCommonjsModule(fn, module) {
5022
5018
  return module = { exports: {} }, fn(module, module.exports), module.exports;
5023
5019
  }
@@ -20675,303 +20671,283 @@ var DisplayCard = function DisplayCard(_ref) {
20675
20671
  }) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
20676
20672
  };
20677
20673
 
20678
- var src = createCommonjsModule(function (module, exports) {
20679
- (function (global, factory) {
20680
- factory(exports, React__default) ;
20681
- }(commonjsGlobal, function (exports, React) {
20682
- var React__default = 'default' in React ? React['default'] : React;
20683
-
20684
- function _extends() {
20685
- _extends = Object.assign || function (target) {
20686
- for (var i = 1; i < arguments.length; i++) {
20687
- var source = arguments[i];
20674
+ function _extends$2() {
20675
+ _extends$2 = Object.assign || function (target) {
20676
+ for (var i = 1; i < arguments.length; i++) {
20677
+ var source = arguments[i];
20688
20678
 
20689
- for (var key in source) {
20690
- if (Object.prototype.hasOwnProperty.call(source, key)) {
20691
- target[key] = source[key];
20692
- }
20679
+ for (var key in source) {
20680
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20681
+ target[key] = source[key];
20693
20682
  }
20694
20683
  }
20684
+ }
20695
20685
 
20696
- return target;
20697
- };
20698
-
20699
- return _extends.apply(this, arguments);
20700
- }
20686
+ return target;
20687
+ };
20701
20688
 
20702
- function _objectWithoutPropertiesLoose(source, excluded) {
20703
- if (source == null) return {};
20704
- var target = {};
20705
- var sourceKeys = Object.keys(source);
20706
- var key, i;
20689
+ return _extends$2.apply(this, arguments);
20690
+ }
20707
20691
 
20708
- for (i = 0; i < sourceKeys.length; i++) {
20709
- key = sourceKeys[i];
20710
- if (excluded.indexOf(key) >= 0) continue;
20711
- target[key] = source[key];
20712
- }
20692
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
20693
+ if (source == null) return {};
20694
+ var target = {};
20695
+ var sourceKeys = Object.keys(source);
20696
+ var key, i;
20713
20697
 
20714
- return target;
20698
+ for (i = 0; i < sourceKeys.length; i++) {
20699
+ key = sourceKeys[i];
20700
+ if (excluded.indexOf(key) >= 0) continue;
20701
+ target[key] = source[key];
20715
20702
  }
20716
20703
 
20717
- function _objectWithoutProperties(source, excluded) {
20718
- if (source == null) return {};
20704
+ return target;
20705
+ }
20719
20706
 
20720
- var target = _objectWithoutPropertiesLoose(source, excluded);
20707
+ function _objectWithoutProperties$1(source, excluded) {
20708
+ if (source == null) return {};
20721
20709
 
20722
- var key, i;
20710
+ var target = _objectWithoutPropertiesLoose$1(source, excluded);
20723
20711
 
20724
- if (Object.getOwnPropertySymbols) {
20725
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
20712
+ var key, i;
20726
20713
 
20727
- for (i = 0; i < sourceSymbolKeys.length; i++) {
20728
- key = sourceSymbolKeys[i];
20729
- if (excluded.indexOf(key) >= 0) continue;
20730
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
20731
- target[key] = source[key];
20732
- }
20733
- }
20714
+ if (Object.getOwnPropertySymbols) {
20715
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
20734
20716
 
20735
- return target;
20717
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
20718
+ key = sourceSymbolKeys[i];
20719
+ if (excluded.indexOf(key) >= 0) continue;
20720
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
20721
+ target[key] = source[key];
20722
+ }
20736
20723
  }
20737
20724
 
20738
- function _slicedToArray(arr, i) {
20739
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
20740
- }
20725
+ return target;
20726
+ }
20741
20727
 
20742
- function _toConsumableArray(arr) {
20743
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
20744
- }
20728
+ function _slicedToArray$1(arr, i) {
20729
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
20730
+ }
20745
20731
 
20746
- function _arrayWithoutHoles(arr) {
20747
- if (Array.isArray(arr)) {
20748
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
20732
+ function _toConsumableArray$1(arr) {
20733
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
20734
+ }
20749
20735
 
20750
- return arr2;
20751
- }
20752
- }
20736
+ function _arrayWithoutHoles$1(arr) {
20737
+ if (Array.isArray(arr)) {
20738
+ for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
20753
20739
 
20754
- function _arrayWithHoles(arr) {
20755
- if (Array.isArray(arr)) return arr;
20740
+ return arr2;
20756
20741
  }
20742
+ }
20743
+
20744
+ function _arrayWithHoles$1(arr) {
20745
+ if (Array.isArray(arr)) return arr;
20746
+ }
20757
20747
 
20758
- function _iterableToArray(iter) {
20759
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
20748
+ function _iterableToArray$1(iter) {
20749
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
20750
+ }
20751
+
20752
+ function _iterableToArrayLimit$1(arr, i) {
20753
+ if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
20754
+ return;
20760
20755
  }
20761
20756
 
20762
- function _iterableToArrayLimit(arr, i) {
20763
- if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
20764
- return;
20765
- }
20757
+ var _arr = [];
20758
+ var _n = true;
20759
+ var _d = false;
20760
+ var _e = undefined;
20766
20761
 
20767
- var _arr = [];
20768
- var _n = true;
20769
- var _d = false;
20770
- var _e = undefined;
20762
+ try {
20763
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
20764
+ _arr.push(_s.value);
20771
20765
 
20766
+ if (i && _arr.length === i) break;
20767
+ }
20768
+ } catch (err) {
20769
+ _d = true;
20770
+ _e = err;
20771
+ } finally {
20772
20772
  try {
20773
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
20774
- _arr.push(_s.value);
20775
-
20776
- if (i && _arr.length === i) break;
20777
- }
20778
- } catch (err) {
20779
- _d = true;
20780
- _e = err;
20773
+ if (!_n && _i["return"] != null) _i["return"]();
20781
20774
  } finally {
20782
- try {
20783
- if (!_n && _i["return"] != null) _i["return"]();
20784
- } finally {
20785
- if (_d) throw _e;
20786
- }
20775
+ if (_d) throw _e;
20787
20776
  }
20788
-
20789
- return _arr;
20790
20777
  }
20791
20778
 
20792
- function _nonIterableSpread() {
20793
- throw new TypeError("Invalid attempt to spread non-iterable instance");
20794
- }
20779
+ return _arr;
20780
+ }
20795
20781
 
20796
- function _nonIterableRest() {
20797
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
20798
- }
20782
+ function _nonIterableSpread$1() {
20783
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
20784
+ }
20799
20785
 
20800
- var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
20801
- return _toConsumableArray(new Set(formats.join("").split(formatChar).join("").split("")));
20802
- };
20803
- var format = function format(formatter) {
20804
- return function (value) {
20805
- var usedFormat = formatter.formats[value.length];
20786
+ function _nonIterableRest$1() {
20787
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
20788
+ }
20806
20789
 
20807
- if (!usedFormat) {
20808
- return value;
20809
- }
20790
+ var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
20791
+ return _toConsumableArray$1(new Set(formats.join("").split(formatChar).join("").split("")));
20792
+ };
20793
+ var format$1 = function format(formatter) {
20794
+ return function (value) {
20795
+ var usedFormat = formatter.formats[value.length];
20810
20796
 
20811
- var formatPieces = usedFormat.split(formatter.formatChar);
20812
- var valuePieces = value.split("");
20813
- var zipped = formatPieces.map(function (v, i) {
20814
- return v + (valuePieces[i] || "");
20815
- });
20816
- return zipped.join("");
20817
- };
20818
- };
20797
+ if (!usedFormat) {
20798
+ return value;
20799
+ }
20819
20800
 
20820
- var countDelims = function countDelims(formatter, index) {
20821
- var count = 0;
20822
- var format = formatter.formats[index];
20823
- if (!format) return 0;
20824
- formatter.uniqueDelimiters.forEach(function (delim) {
20825
- return count += format.split(delim).length - 1;
20801
+ var formatPieces = usedFormat.split(formatter.formatChar);
20802
+ var valuePieces = value.split("");
20803
+ var zipped = formatPieces.map(function (v, i) {
20804
+ return v + (valuePieces[i] || "");
20826
20805
  });
20827
- return count;
20806
+ return zipped.join("");
20828
20807
  };
20808
+ };
20829
20809
 
20830
- var unformat = function unformat(formatter) {
20831
- return function (formattedValue, formatIndex) {
20832
- if (formatIndex >= formatter.formats.length) {
20833
- return formattedValue;
20834
- }
20835
-
20836
- var format = formatter.formats[formatIndex];
20837
- return formattedValue.split("").filter(function (_, i) {
20838
- return !(format[i] != formatter.formatChar);
20839
- }).join("");
20840
- };
20841
- };
20842
- var inject = function inject(baseString) {
20843
- return function (start, end, newString) {
20844
- return baseString.substring(0, start) + newString + baseString.substring(end);
20845
- };
20846
- };
20847
- var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
20848
- var maxFormatExceeded = rawValue.length >= formatter.formats.length;
20810
+ var countDelims = function countDelims(formatter, index) {
20811
+ var count = 0;
20812
+ var format = formatter.formats[index];
20813
+ if (!format) return 0;
20814
+ formatter.uniqueDelimiters.forEach(function (delim) {
20815
+ return count += format.split(delim).length - 1;
20816
+ });
20817
+ return count;
20818
+ };
20849
20819
 
20850
- if (maxFormatExceeded) {
20851
- return formattedIndex;
20852
- } else {
20853
- var formatString = formatter.formats[rawValue.length];
20854
- var beforeString = formatString.slice(0, formattedIndex);
20855
- return beforeString.split("").filter(function (c) {
20856
- return c === formatter.formatChar;
20857
- }).length;
20820
+ var unformat = function unformat(formatter) {
20821
+ return function (formattedValue, formatIndex) {
20822
+ if (formatIndex >= formatter.formats.length) {
20823
+ return formattedValue;
20858
20824
  }
20859
- };
20860
- var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
20861
- var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
20862
- // This is done so the component doesn't assume that any added chars will be kept
20863
- // (i.e. if an external constraint is applied)
20864
-
20865
- if (maxFormatExceeded) {
20866
- var delims = countDelims(formatter, rawValue.length - 1);
20867
- return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
20868
- } else {
20869
- return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
20870
- return curr.length + acc;
20871
- }, 0) + rawIndex;
20872
- }
20873
- };
20874
20825
 
20875
- var createFormat = function createFormat(formats, formatChar) {
20876
- return {
20877
- uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
20878
- formats: formats,
20879
- formatChar: formatChar
20880
- };
20826
+ var format = formatter.formats[formatIndex];
20827
+ return formattedValue.split("").filter(function (_, i) {
20828
+ return !(format[i] != formatter.formatChar);
20829
+ }).join("");
20881
20830
  };
20831
+ };
20832
+ var inject = function inject(baseString) {
20833
+ return function (start, end, newString) {
20834
+ return baseString.substring(0, start) + newString + baseString.substring(end);
20835
+ };
20836
+ };
20837
+ var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
20838
+ var maxFormatExceeded = rawValue.length >= formatter.formats.length;
20882
20839
 
20883
- var FormattedInput = function FormattedInput(_ref) {
20884
- var value = _ref.value,
20885
- formatter = _ref.formatter,
20886
- _onChange = _ref.onChange,
20887
- props = _objectWithoutProperties(_ref, ["value", "formatter", "onChange"]);
20888
-
20889
- var inputEl = React.useRef(null);
20890
-
20891
- var _useState = React.useState({
20892
- selectionStart: 0,
20893
- selectionEnd: 0,
20894
- rawValue: value,
20895
- "delete": false,
20896
- formattedValue: format(formatter)(value)
20897
- }),
20898
- _useState2 = _slicedToArray(_useState, 2),
20899
- state = _useState2[0],
20900
- setState = _useState2[1];
20901
-
20902
- React.useLayoutEffect(function () {
20903
- // A lot of the work here is cursor manipulation
20904
- if (inputEl.current && inputEl.current === document.activeElement) {
20905
- inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
20906
- }
20907
- });
20908
- return React__default.createElement("input", _extends({}, props, {
20909
- ref: inputEl,
20910
- value: format(formatter)(value),
20911
- onKeyDown: function onKeyDown(event) {
20912
- // Keep track of the state of the input before onChange, including if user is hitting delete
20913
- setState({
20914
- rawValue: value,
20915
- selectionStart: event.target.selectionStart,
20916
- selectionEnd: event.target.selectionEnd,
20917
- "delete": event.key === "Backspace" || event.key === "Delete",
20918
- formattedValue: event.target.value
20919
- });
20920
- },
20921
- onChange: function onChange(event) {
20922
- /* At the beginning of onChange, event.target.value is a concat of the previous formatted value
20923
- * and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
20924
- * the unformatted value for the user's onChange, the formatted string and unformatted injection need
20925
- * to be separated, then unformat the formatted string, then insert (or delete) the injection from the
20926
- * old unformatted value.
20927
- */
20928
- var injectionLength = event.target.value.length - state.formattedValue.length;
20929
- var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
20930
- var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
20931
- // Need to find where to put it
20932
-
20933
- var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
20934
- var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
20935
- // Using the relevant format string, strips away chars not marked with the formatChar
20936
-
20937
- var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
20840
+ if (maxFormatExceeded) {
20841
+ return formattedIndex;
20842
+ } else {
20843
+ var formatString = formatter.formats[rawValue.length];
20844
+ var beforeString = formatString.slice(0, formattedIndex);
20845
+ return beforeString.split("").filter(function (c) {
20846
+ return c === formatter.formatChar;
20847
+ }).length;
20848
+ }
20849
+ };
20850
+ var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
20851
+ var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
20852
+ // This is done so the component doesn't assume that any added chars will be kept
20853
+ // (i.e. if an external constraint is applied)
20938
20854
 
20939
- var injectIntoOldValue = inject(unformattedOldValue);
20940
- var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
20941
- var lengthDifference = unformattedNewValue.length - state.rawValue.length;
20942
- var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
20943
- // Applied by useLayoutEffect
20855
+ if (maxFormatExceeded) {
20856
+ var delims = countDelims(formatter, rawValue.length - 1);
20857
+ return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
20858
+ } else {
20859
+ return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
20860
+ return curr.length + acc;
20861
+ }, 0) + rawIndex;
20862
+ }
20863
+ };
20944
20864
 
20945
- var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
20946
- setState({
20947
- selectionStart: newFormattedCursorPosition,
20948
- selectionEnd: newFormattedCursorPosition,
20949
- rawValue: state.rawValue,
20950
- "delete": false,
20951
- formattedValue: state.formattedValue
20952
- }); // Apply the external onChange function to the raw underlying string
20953
- // This is where the user generally updates the input value
20954
-
20955
- if (_onChange) {
20956
- _onChange(unformattedNewValue);
20957
- }
20958
- }
20959
- }));
20865
+ var createFormat = function createFormat(formats, formatChar) {
20866
+ return {
20867
+ uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
20868
+ formats: formats,
20869
+ formatChar: formatChar
20960
20870
  };
20871
+ };
20961
20872
 
20962
- exports.FormattedInput = FormattedInput;
20963
- exports.createFormat = createFormat;
20964
- exports.format = format;
20873
+ var FormattedInput = function FormattedInput(_ref) {
20874
+ var value = _ref.value,
20875
+ formatter = _ref.formatter,
20876
+ _onChange = _ref.onChange,
20877
+ props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
20965
20878
 
20966
- Object.defineProperty(exports, '__esModule', { value: true });
20879
+ var inputEl = React.useRef(null);
20967
20880
 
20968
- }));
20969
- });
20881
+ var _useState = React.useState({
20882
+ selectionStart: 0,
20883
+ selectionEnd: 0,
20884
+ rawValue: value,
20885
+ "delete": false,
20886
+ formattedValue: format$1(formatter)(value)
20887
+ }),
20888
+ _useState2 = _slicedToArray$1(_useState, 2),
20889
+ state = _useState2[0],
20890
+ setState = _useState2[1];
20970
20891
 
20971
- unwrapExports(src);
20972
- var src_1 = src.FormattedInput;
20973
- var src_2 = src.createFormat;
20974
- var src_3 = src.format;
20892
+ React.useLayoutEffect(function () {
20893
+ // A lot of the work here is cursor manipulation
20894
+ if (inputEl.current && inputEl.current === document.activeElement) {
20895
+ inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
20896
+ }
20897
+ });
20898
+ return React__default.createElement("input", _extends$2({}, props, {
20899
+ ref: inputEl,
20900
+ value: format$1(formatter)(value),
20901
+ onKeyDown: function onKeyDown(event) {
20902
+ // Keep track of the state of the input before onChange, including if user is hitting delete
20903
+ setState({
20904
+ rawValue: value,
20905
+ selectionStart: event.target.selectionStart,
20906
+ selectionEnd: event.target.selectionEnd,
20907
+ "delete": event.key === "Backspace" || event.key === "Delete",
20908
+ formattedValue: event.target.value
20909
+ });
20910
+ },
20911
+ onChange: function onChange(event) {
20912
+ /* At the beginning of onChange, event.target.value is a concat of the previous formatted value
20913
+ * and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
20914
+ * the unformatted value for the user's onChange, the formatted string and unformatted injection need
20915
+ * to be separated, then unformat the formatted string, then insert (or delete) the injection from the
20916
+ * old unformatted value.
20917
+ */
20918
+ var injectionLength = event.target.value.length - state.formattedValue.length;
20919
+ var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
20920
+ var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
20921
+ // Need to find where to put it
20922
+
20923
+ var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
20924
+ var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
20925
+ // Using the relevant format string, strips away chars not marked with the formatChar
20926
+
20927
+ var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
20928
+
20929
+ var injectIntoOldValue = inject(unformattedOldValue);
20930
+ var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
20931
+ var lengthDifference = unformattedNewValue.length - state.rawValue.length;
20932
+ var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
20933
+ // Applied by useLayoutEffect
20934
+
20935
+ var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
20936
+ setState({
20937
+ selectionStart: newFormattedCursorPosition,
20938
+ selectionEnd: newFormattedCursorPosition,
20939
+ rawValue: state.rawValue,
20940
+ "delete": false,
20941
+ formattedValue: state.formattedValue
20942
+ }); // Apply the external onChange function to the raw underlying string
20943
+ // This is where the user generally updates the input value
20944
+
20945
+ if (_onChange) {
20946
+ _onChange(unformattedNewValue);
20947
+ }
20948
+ }
20949
+ }));
20950
+ };
20975
20951
 
20976
20952
  var linkColor$2 = {
20977
20953
  "default": "".concat(MATISSE_BLUE),
@@ -21073,7 +21049,7 @@ var FormattedInputField = styled__default(function (_ref8) {
21073
21049
  themeValues = _ref8.themeValues,
21074
21050
  props = _objectWithoutProperties(_ref8, _excluded$p);
21075
21051
 
21076
- return /*#__PURE__*/React__default.createElement(src_1, props);
21052
+ return /*#__PURE__*/React__default.createElement(FormattedInput, props);
21077
21053
  }).withConfig({
21078
21054
  displayName: "FormInput__FormattedInputField",
21079
21055
  componentId: "sc-l094r1-1"
@@ -34865,11 +34841,11 @@ var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "
34865
34841
  var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
34866
34842
  var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
34867
34843
  var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
34868
- var zipFormat = src_2(zipFormats, formatDelimiter);
34869
- var creditCardFormat = src_2(creditCardFormats, formatDelimiter);
34870
- var expirationDateFormat = src_2(expirationDateFormats, formatDelimiter);
34871
- var phoneFormat = src_2(phoneFormats, formatDelimiter);
34872
- var moneyFormat = src_2(moneyFormats, formatDelimiter);
34844
+ var zipFormat = createFormat(zipFormats, formatDelimiter);
34845
+ var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
34846
+ var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
34847
+ var phoneFormat = createFormat(phoneFormats, formatDelimiter);
34848
+ var moneyFormat = createFormat(moneyFormats, formatDelimiter);
34873
34849
 
34874
34850
  var formats = /*#__PURE__*/Object.freeze({
34875
34851
  __proto__: null,
@@ -38693,7 +38669,7 @@ Styling accomplished with our atoms / layout primitives
38693
38669
 
38694
38670
  Cancel button will (for now) always use hideModal as its action
38695
38671
  Continue button takes an action, if you want to navigate to
38696
- a different route (as with a link) connect() and use "push" from connected-react-router
38672
+ a different route (as with a link) connect() and use "push" from @thecb/connected-react-router
38697
38673
  */
38698
38674
 
38699
38675
  var getApplicationNode = function getApplicationNode() {
@@ -40335,7 +40311,7 @@ var formConfig$8 = {
40335
40311
  constraints: [onlyIntegers(), hasLength(0, 16)]
40336
40312
  },
40337
40313
  expirationDate: {
40338
- validators: [required(), hasLength(4, 4), dateAfterToday("MM/YY", "month", true)],
40314
+ validators: [required(), hasLength(4, 4), dateAfterToday("MMYY", "month", true)],
40339
40315
  constraints: [onlyIntegers(), hasLength(0, 4)]
40340
40316
  },
40341
40317
  cvv: {
@@ -40391,7 +40367,7 @@ var PhoneForm = function PhoneForm(_ref) {
40391
40367
  field: fields.phone,
40392
40368
  fieldActions: actions.fields.phone,
40393
40369
  showErrors: showErrors,
40394
- formatter: src_2(phoneFormats, formatDelimiter),
40370
+ formatter: createFormat(phoneFormats, formatDelimiter),
40395
40371
  onKeyUp: function onKeyUp(e) {
40396
40372
  return e.key === "Enter" && handleSubmit(e);
40397
40373
  },