@thecb/components 5.0.0-beta.10 → 5.0.0-beta.13

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.esm.js CHANGED
@@ -5006,10 +5006,6 @@ var TextSpan = styled.span.withConfig({
5006
5006
 
5007
5007
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5008
5008
 
5009
- function unwrapExports (x) {
5010
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5011
- }
5012
-
5013
5009
  function createCommonjsModule(fn, module) {
5014
5010
  return module = { exports: {} }, fn(module, module.exports), module.exports;
5015
5011
  }
@@ -20667,303 +20663,283 @@ var DisplayCard = function DisplayCard(_ref) {
20667
20663
  }) : /*#__PURE__*/React.createElement(Fragment, null))))));
20668
20664
  };
20669
20665
 
20670
- var src = createCommonjsModule(function (module, exports) {
20671
- (function (global, factory) {
20672
- factory(exports, React) ;
20673
- }(commonjsGlobal, function (exports, React) {
20674
- var React__default = 'default' in React ? React['default'] : React;
20675
-
20676
- function _extends() {
20677
- _extends = Object.assign || function (target) {
20678
- for (var i = 1; i < arguments.length; i++) {
20679
- var source = arguments[i];
20666
+ function _extends$2() {
20667
+ _extends$2 = Object.assign || function (target) {
20668
+ for (var i = 1; i < arguments.length; i++) {
20669
+ var source = arguments[i];
20680
20670
 
20681
- for (var key in source) {
20682
- if (Object.prototype.hasOwnProperty.call(source, key)) {
20683
- target[key] = source[key];
20684
- }
20671
+ for (var key in source) {
20672
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20673
+ target[key] = source[key];
20685
20674
  }
20686
20675
  }
20676
+ }
20687
20677
 
20688
- return target;
20689
- };
20690
-
20691
- return _extends.apply(this, arguments);
20692
- }
20678
+ return target;
20679
+ };
20693
20680
 
20694
- function _objectWithoutPropertiesLoose(source, excluded) {
20695
- if (source == null) return {};
20696
- var target = {};
20697
- var sourceKeys = Object.keys(source);
20698
- var key, i;
20681
+ return _extends$2.apply(this, arguments);
20682
+ }
20699
20683
 
20700
- for (i = 0; i < sourceKeys.length; i++) {
20701
- key = sourceKeys[i];
20702
- if (excluded.indexOf(key) >= 0) continue;
20703
- target[key] = source[key];
20704
- }
20684
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
20685
+ if (source == null) return {};
20686
+ var target = {};
20687
+ var sourceKeys = Object.keys(source);
20688
+ var key, i;
20705
20689
 
20706
- return target;
20690
+ for (i = 0; i < sourceKeys.length; i++) {
20691
+ key = sourceKeys[i];
20692
+ if (excluded.indexOf(key) >= 0) continue;
20693
+ target[key] = source[key];
20707
20694
  }
20708
20695
 
20709
- function _objectWithoutProperties(source, excluded) {
20710
- if (source == null) return {};
20696
+ return target;
20697
+ }
20711
20698
 
20712
- var target = _objectWithoutPropertiesLoose(source, excluded);
20699
+ function _objectWithoutProperties$1(source, excluded) {
20700
+ if (source == null) return {};
20713
20701
 
20714
- var key, i;
20702
+ var target = _objectWithoutPropertiesLoose$1(source, excluded);
20715
20703
 
20716
- if (Object.getOwnPropertySymbols) {
20717
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
20704
+ var key, i;
20718
20705
 
20719
- for (i = 0; i < sourceSymbolKeys.length; i++) {
20720
- key = sourceSymbolKeys[i];
20721
- if (excluded.indexOf(key) >= 0) continue;
20722
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
20723
- target[key] = source[key];
20724
- }
20725
- }
20706
+ if (Object.getOwnPropertySymbols) {
20707
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
20726
20708
 
20727
- return target;
20709
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
20710
+ key = sourceSymbolKeys[i];
20711
+ if (excluded.indexOf(key) >= 0) continue;
20712
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
20713
+ target[key] = source[key];
20714
+ }
20728
20715
  }
20729
20716
 
20730
- function _slicedToArray(arr, i) {
20731
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
20732
- }
20717
+ return target;
20718
+ }
20733
20719
 
20734
- function _toConsumableArray(arr) {
20735
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
20736
- }
20720
+ function _slicedToArray$1(arr, i) {
20721
+ return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
20722
+ }
20737
20723
 
20738
- function _arrayWithoutHoles(arr) {
20739
- if (Array.isArray(arr)) {
20740
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
20724
+ function _toConsumableArray$1(arr) {
20725
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
20726
+ }
20741
20727
 
20742
- return arr2;
20743
- }
20744
- }
20728
+ function _arrayWithoutHoles$1(arr) {
20729
+ if (Array.isArray(arr)) {
20730
+ for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
20745
20731
 
20746
- function _arrayWithHoles(arr) {
20747
- if (Array.isArray(arr)) return arr;
20732
+ return arr2;
20748
20733
  }
20734
+ }
20749
20735
 
20750
- function _iterableToArray(iter) {
20751
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
20736
+ function _arrayWithHoles$1(arr) {
20737
+ if (Array.isArray(arr)) return arr;
20738
+ }
20739
+
20740
+ function _iterableToArray$1(iter) {
20741
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
20742
+ }
20743
+
20744
+ function _iterableToArrayLimit$1(arr, i) {
20745
+ if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
20746
+ return;
20752
20747
  }
20753
20748
 
20754
- function _iterableToArrayLimit(arr, i) {
20755
- if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
20756
- return;
20757
- }
20749
+ var _arr = [];
20750
+ var _n = true;
20751
+ var _d = false;
20752
+ var _e = undefined;
20758
20753
 
20759
- var _arr = [];
20760
- var _n = true;
20761
- var _d = false;
20762
- var _e = undefined;
20754
+ try {
20755
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
20756
+ _arr.push(_s.value);
20763
20757
 
20758
+ if (i && _arr.length === i) break;
20759
+ }
20760
+ } catch (err) {
20761
+ _d = true;
20762
+ _e = err;
20763
+ } finally {
20764
20764
  try {
20765
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
20766
- _arr.push(_s.value);
20767
-
20768
- if (i && _arr.length === i) break;
20769
- }
20770
- } catch (err) {
20771
- _d = true;
20772
- _e = err;
20765
+ if (!_n && _i["return"] != null) _i["return"]();
20773
20766
  } finally {
20774
- try {
20775
- if (!_n && _i["return"] != null) _i["return"]();
20776
- } finally {
20777
- if (_d) throw _e;
20778
- }
20767
+ if (_d) throw _e;
20779
20768
  }
20780
-
20781
- return _arr;
20782
20769
  }
20783
20770
 
20784
- function _nonIterableSpread() {
20785
- throw new TypeError("Invalid attempt to spread non-iterable instance");
20786
- }
20771
+ return _arr;
20772
+ }
20787
20773
 
20788
- function _nonIterableRest() {
20789
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
20790
- }
20774
+ function _nonIterableSpread$1() {
20775
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
20776
+ }
20791
20777
 
20792
- var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
20793
- return _toConsumableArray(new Set(formats.join("").split(formatChar).join("").split("")));
20794
- };
20795
- var format = function format(formatter) {
20796
- return function (value) {
20797
- var usedFormat = formatter.formats[value.length];
20778
+ function _nonIterableRest$1() {
20779
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
20780
+ }
20798
20781
 
20799
- if (!usedFormat) {
20800
- return value;
20801
- }
20782
+ var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
20783
+ return _toConsumableArray$1(new Set(formats.join("").split(formatChar).join("").split("")));
20784
+ };
20785
+ var format$1 = function format(formatter) {
20786
+ return function (value) {
20787
+ var usedFormat = formatter.formats[value.length];
20802
20788
 
20803
- var formatPieces = usedFormat.split(formatter.formatChar);
20804
- var valuePieces = value.split("");
20805
- var zipped = formatPieces.map(function (v, i) {
20806
- return v + (valuePieces[i] || "");
20807
- });
20808
- return zipped.join("");
20809
- };
20810
- };
20789
+ if (!usedFormat) {
20790
+ return value;
20791
+ }
20811
20792
 
20812
- var countDelims = function countDelims(formatter, index) {
20813
- var count = 0;
20814
- var format = formatter.formats[index];
20815
- if (!format) return 0;
20816
- formatter.uniqueDelimiters.forEach(function (delim) {
20817
- return count += format.split(delim).length - 1;
20793
+ var formatPieces = usedFormat.split(formatter.formatChar);
20794
+ var valuePieces = value.split("");
20795
+ var zipped = formatPieces.map(function (v, i) {
20796
+ return v + (valuePieces[i] || "");
20818
20797
  });
20819
- return count;
20798
+ return zipped.join("");
20820
20799
  };
20800
+ };
20821
20801
 
20822
- var unformat = function unformat(formatter) {
20823
- return function (formattedValue, formatIndex) {
20824
- if (formatIndex >= formatter.formats.length) {
20825
- return formattedValue;
20826
- }
20827
-
20828
- var format = formatter.formats[formatIndex];
20829
- return formattedValue.split("").filter(function (_, i) {
20830
- return !(format[i] != formatter.formatChar);
20831
- }).join("");
20832
- };
20833
- };
20834
- var inject = function inject(baseString) {
20835
- return function (start, end, newString) {
20836
- return baseString.substring(0, start) + newString + baseString.substring(end);
20837
- };
20838
- };
20839
- var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
20840
- var maxFormatExceeded = rawValue.length >= formatter.formats.length;
20802
+ var countDelims = function countDelims(formatter, index) {
20803
+ var count = 0;
20804
+ var format = formatter.formats[index];
20805
+ if (!format) return 0;
20806
+ formatter.uniqueDelimiters.forEach(function (delim) {
20807
+ return count += format.split(delim).length - 1;
20808
+ });
20809
+ return count;
20810
+ };
20841
20811
 
20842
- if (maxFormatExceeded) {
20843
- return formattedIndex;
20844
- } else {
20845
- var formatString = formatter.formats[rawValue.length];
20846
- var beforeString = formatString.slice(0, formattedIndex);
20847
- return beforeString.split("").filter(function (c) {
20848
- return c === formatter.formatChar;
20849
- }).length;
20812
+ var unformat = function unformat(formatter) {
20813
+ return function (formattedValue, formatIndex) {
20814
+ if (formatIndex >= formatter.formats.length) {
20815
+ return formattedValue;
20850
20816
  }
20851
- };
20852
- var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
20853
- var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
20854
- // This is done so the component doesn't assume that any added chars will be kept
20855
- // (i.e. if an external constraint is applied)
20856
-
20857
- if (maxFormatExceeded) {
20858
- var delims = countDelims(formatter, rawValue.length - 1);
20859
- return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
20860
- } else {
20861
- return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
20862
- return curr.length + acc;
20863
- }, 0) + rawIndex;
20864
- }
20865
- };
20866
20817
 
20867
- var createFormat = function createFormat(formats, formatChar) {
20868
- return {
20869
- uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
20870
- formats: formats,
20871
- formatChar: formatChar
20872
- };
20818
+ var format = formatter.formats[formatIndex];
20819
+ return formattedValue.split("").filter(function (_, i) {
20820
+ return !(format[i] != formatter.formatChar);
20821
+ }).join("");
20873
20822
  };
20823
+ };
20824
+ var inject = function inject(baseString) {
20825
+ return function (start, end, newString) {
20826
+ return baseString.substring(0, start) + newString + baseString.substring(end);
20827
+ };
20828
+ };
20829
+ var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
20830
+ var maxFormatExceeded = rawValue.length >= formatter.formats.length;
20874
20831
 
20875
- var FormattedInput = function FormattedInput(_ref) {
20876
- var value = _ref.value,
20877
- formatter = _ref.formatter,
20878
- _onChange = _ref.onChange,
20879
- props = _objectWithoutProperties(_ref, ["value", "formatter", "onChange"]);
20880
-
20881
- var inputEl = React.useRef(null);
20882
-
20883
- var _useState = React.useState({
20884
- selectionStart: 0,
20885
- selectionEnd: 0,
20886
- rawValue: value,
20887
- "delete": false,
20888
- formattedValue: format(formatter)(value)
20889
- }),
20890
- _useState2 = _slicedToArray(_useState, 2),
20891
- state = _useState2[0],
20892
- setState = _useState2[1];
20893
-
20894
- React.useLayoutEffect(function () {
20895
- // A lot of the work here is cursor manipulation
20896
- if (inputEl.current && inputEl.current === document.activeElement) {
20897
- inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
20898
- }
20899
- });
20900
- return React__default.createElement("input", _extends({}, props, {
20901
- ref: inputEl,
20902
- value: format(formatter)(value),
20903
- onKeyDown: function onKeyDown(event) {
20904
- // Keep track of the state of the input before onChange, including if user is hitting delete
20905
- setState({
20906
- rawValue: value,
20907
- selectionStart: event.target.selectionStart,
20908
- selectionEnd: event.target.selectionEnd,
20909
- "delete": event.key === "Backspace" || event.key === "Delete",
20910
- formattedValue: event.target.value
20911
- });
20912
- },
20913
- onChange: function onChange(event) {
20914
- /* At the beginning of onChange, event.target.value is a concat of the previous formatted value
20915
- * and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
20916
- * the unformatted value for the user's onChange, the formatted string and unformatted injection need
20917
- * to be separated, then unformat the formatted string, then insert (or delete) the injection from the
20918
- * old unformatted value.
20919
- */
20920
- var injectionLength = event.target.value.length - state.formattedValue.length;
20921
- var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
20922
- var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
20923
- // Need to find where to put it
20924
-
20925
- var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
20926
- var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
20927
- // Using the relevant format string, strips away chars not marked with the formatChar
20928
-
20929
- var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
20832
+ if (maxFormatExceeded) {
20833
+ return formattedIndex;
20834
+ } else {
20835
+ var formatString = formatter.formats[rawValue.length];
20836
+ var beforeString = formatString.slice(0, formattedIndex);
20837
+ return beforeString.split("").filter(function (c) {
20838
+ return c === formatter.formatChar;
20839
+ }).length;
20840
+ }
20841
+ };
20842
+ var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
20843
+ var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
20844
+ // This is done so the component doesn't assume that any added chars will be kept
20845
+ // (i.e. if an external constraint is applied)
20930
20846
 
20931
- var injectIntoOldValue = inject(unformattedOldValue);
20932
- var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
20933
- var lengthDifference = unformattedNewValue.length - state.rawValue.length;
20934
- var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
20935
- // Applied by useLayoutEffect
20847
+ if (maxFormatExceeded) {
20848
+ var delims = countDelims(formatter, rawValue.length - 1);
20849
+ return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
20850
+ } else {
20851
+ return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
20852
+ return curr.length + acc;
20853
+ }, 0) + rawIndex;
20854
+ }
20855
+ };
20936
20856
 
20937
- var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
20938
- setState({
20939
- selectionStart: newFormattedCursorPosition,
20940
- selectionEnd: newFormattedCursorPosition,
20941
- rawValue: state.rawValue,
20942
- "delete": false,
20943
- formattedValue: state.formattedValue
20944
- }); // Apply the external onChange function to the raw underlying string
20945
- // This is where the user generally updates the input value
20946
-
20947
- if (_onChange) {
20948
- _onChange(unformattedNewValue);
20949
- }
20950
- }
20951
- }));
20857
+ var createFormat = function createFormat(formats, formatChar) {
20858
+ return {
20859
+ uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
20860
+ formats: formats,
20861
+ formatChar: formatChar
20952
20862
  };
20863
+ };
20953
20864
 
20954
- exports.FormattedInput = FormattedInput;
20955
- exports.createFormat = createFormat;
20956
- exports.format = format;
20865
+ var FormattedInput = function FormattedInput(_ref) {
20866
+ var value = _ref.value,
20867
+ formatter = _ref.formatter,
20868
+ _onChange = _ref.onChange,
20869
+ props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
20957
20870
 
20958
- Object.defineProperty(exports, '__esModule', { value: true });
20871
+ var inputEl = useRef(null);
20959
20872
 
20960
- }));
20961
- });
20873
+ var _useState = useState({
20874
+ selectionStart: 0,
20875
+ selectionEnd: 0,
20876
+ rawValue: value,
20877
+ "delete": false,
20878
+ formattedValue: format$1(formatter)(value)
20879
+ }),
20880
+ _useState2 = _slicedToArray$1(_useState, 2),
20881
+ state = _useState2[0],
20882
+ setState = _useState2[1];
20962
20883
 
20963
- unwrapExports(src);
20964
- var src_1 = src.FormattedInput;
20965
- var src_2 = src.createFormat;
20966
- var src_3 = src.format;
20884
+ useLayoutEffect(function () {
20885
+ // A lot of the work here is cursor manipulation
20886
+ if (inputEl.current && inputEl.current === document.activeElement) {
20887
+ inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
20888
+ }
20889
+ });
20890
+ return React.createElement("input", _extends$2({}, props, {
20891
+ ref: inputEl,
20892
+ value: format$1(formatter)(value),
20893
+ onKeyDown: function onKeyDown(event) {
20894
+ // Keep track of the state of the input before onChange, including if user is hitting delete
20895
+ setState({
20896
+ rawValue: value,
20897
+ selectionStart: event.target.selectionStart,
20898
+ selectionEnd: event.target.selectionEnd,
20899
+ "delete": event.key === "Backspace" || event.key === "Delete",
20900
+ formattedValue: event.target.value
20901
+ });
20902
+ },
20903
+ onChange: function onChange(event) {
20904
+ /* At the beginning of onChange, event.target.value is a concat of the previous formatted value
20905
+ * and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
20906
+ * the unformatted value for the user's onChange, the formatted string and unformatted injection need
20907
+ * to be separated, then unformat the formatted string, then insert (or delete) the injection from the
20908
+ * old unformatted value.
20909
+ */
20910
+ var injectionLength = event.target.value.length - state.formattedValue.length;
20911
+ var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
20912
+ var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
20913
+ // Need to find where to put it
20914
+
20915
+ var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
20916
+ var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
20917
+ // Using the relevant format string, strips away chars not marked with the formatChar
20918
+
20919
+ var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
20920
+
20921
+ var injectIntoOldValue = inject(unformattedOldValue);
20922
+ var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
20923
+ var lengthDifference = unformattedNewValue.length - state.rawValue.length;
20924
+ var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
20925
+ // Applied by useLayoutEffect
20926
+
20927
+ var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
20928
+ setState({
20929
+ selectionStart: newFormattedCursorPosition,
20930
+ selectionEnd: newFormattedCursorPosition,
20931
+ rawValue: state.rawValue,
20932
+ "delete": false,
20933
+ formattedValue: state.formattedValue
20934
+ }); // Apply the external onChange function to the raw underlying string
20935
+ // This is where the user generally updates the input value
20936
+
20937
+ if (_onChange) {
20938
+ _onChange(unformattedNewValue);
20939
+ }
20940
+ }
20941
+ }));
20942
+ };
20967
20943
 
20968
20944
  var linkColor$2 = {
20969
20945
  "default": "".concat(MATISSE_BLUE),
@@ -21065,7 +21041,7 @@ var FormattedInputField = styled(function (_ref8) {
21065
21041
  themeValues = _ref8.themeValues,
21066
21042
  props = _objectWithoutProperties(_ref8, _excluded$p);
21067
21043
 
21068
- return /*#__PURE__*/React.createElement(src_1, props);
21044
+ return /*#__PURE__*/React.createElement(FormattedInput, props);
21069
21045
  }).withConfig({
21070
21046
  displayName: "FormInput__FormattedInputField",
21071
21047
  componentId: "sc-l094r1-1"
@@ -34857,11 +34833,11 @@ var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "
34857
34833
  var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
34858
34834
  var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
34859
34835
  var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
34860
- var zipFormat = src_2(zipFormats, formatDelimiter);
34861
- var creditCardFormat = src_2(creditCardFormats, formatDelimiter);
34862
- var expirationDateFormat = src_2(expirationDateFormats, formatDelimiter);
34863
- var phoneFormat = src_2(phoneFormats, formatDelimiter);
34864
- var moneyFormat = src_2(moneyFormats, formatDelimiter);
34836
+ var zipFormat = createFormat(zipFormats, formatDelimiter);
34837
+ var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
34838
+ var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
34839
+ var phoneFormat = createFormat(phoneFormats, formatDelimiter);
34840
+ var moneyFormat = createFormat(moneyFormats, formatDelimiter);
34865
34841
 
34866
34842
  var formats = /*#__PURE__*/Object.freeze({
34867
34843
  __proto__: null,
@@ -38685,7 +38661,7 @@ Styling accomplished with our atoms / layout primitives
38685
38661
 
38686
38662
  Cancel button will (for now) always use hideModal as its action
38687
38663
  Continue button takes an action, if you want to navigate to
38688
- a different route (as with a link) connect() and use "push" from connected-react-router
38664
+ a different route (as with a link) connect() and use "push" from @thecb/connected-react-router
38689
38665
  */
38690
38666
 
38691
38667
  var getApplicationNode = function getApplicationNode() {
@@ -40383,7 +40359,7 @@ var PhoneForm = function PhoneForm(_ref) {
40383
40359
  field: fields.phone,
40384
40360
  fieldActions: actions.fields.phone,
40385
40361
  showErrors: showErrors,
40386
- formatter: src_2(phoneFormats, formatDelimiter),
40362
+ formatter: createFormat(phoneFormats, formatDelimiter),
40387
40363
  onKeyUp: function onKeyUp(e) {
40388
40364
  return e.key === "Enter" && handleSubmit(e);
40389
40365
  },