@superdispatch/ui 0.21.5-alpha.1 → 0.21.5-alpha.4

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.
@@ -17,6 +17,7 @@ var resizeObserver = require('@juggle/resize-observer');
17
17
  var hooks = require('@superdispatch/hooks');
18
18
  var styles = require('@mui/styles');
19
19
  var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
20
+ var NumberFormat = _interopDefault(require('react-number-format'));
20
21
  var clsx = _interopDefault(require('clsx'));
21
22
  var system = require('@mui/system');
22
23
 
@@ -1684,7 +1685,58 @@ var Inline = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1684
1685
  });
1685
1686
  if (process.env.NODE_ENV !== "production") Inline.displayName = "Inline";
1686
1687
 
1687
- var _excluded$f = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
1688
+ var _excluded$f = ["value", "inputRef", "onChange", "isNumericString", "thousandSeparator", "disableValueParsing"],
1689
+ _excluded2$1 = ["id", "InputProps"];
1690
+
1691
+ function NumberInputComponent(_ref) {
1692
+ var {
1693
+ value,
1694
+ inputRef,
1695
+ onChange,
1696
+ isNumericString = true,
1697
+ thousandSeparator = true,
1698
+ disableValueParsing
1699
+ } = _ref,
1700
+ props = _objectWithoutProperties(_ref, _excluded$f);
1701
+
1702
+ return /*#__PURE__*/jsxRuntime.jsx(NumberFormat, _objectSpread(_objectSpread({}, props), {}, {
1703
+ value: value !== null && value !== void 0 ? value : '',
1704
+ inputMode: "decimal",
1705
+ getInputRef: inputRef,
1706
+ isNumericString: isNumericString,
1707
+ thousandSeparator: thousandSeparator,
1708
+ allowedDecimalSeparators: ['.', ','],
1709
+ onValueChange: values => {
1710
+ var floatValue = !Number.isNaN(Number(values.floatValue)) ? values.floatValue : null;
1711
+ var event = {
1712
+ target: {
1713
+ value: disableValueParsing ? values.value : floatValue
1714
+ }
1715
+ };
1716
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
1717
+ }
1718
+ }));
1719
+ }
1720
+
1721
+ var NumberField = /*#__PURE__*/React.forwardRef(_ref2 => {
1722
+ var {
1723
+ id,
1724
+ InputProps
1725
+ } = _ref2,
1726
+ props = _objectWithoutProperties(_ref2, _excluded2$1);
1727
+
1728
+ var uid = useUID(id);
1729
+ return /*#__PURE__*/jsxRuntime.jsx(material.TextField, _objectSpread(_objectSpread({}, props), {}, {
1730
+ id: uid,
1731
+ InputProps: _objectSpread(_objectSpread({}, InputProps), {}, {
1732
+ inputComponent: NumberInputComponent
1733
+ })
1734
+ }));
1735
+ });
1736
+ if (process.env.NODE_ENV !== "production") NumberField.displayName = "NumberField";
1737
+ NumberField.displayName = 'NumberField';
1738
+
1739
+ var _excluded$g = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
1688
1740
  var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1689
1741
  var {
1690
1742
  label,
@@ -1695,7 +1747,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1695
1747
  helperText,
1696
1748
  FormControlLabelProps: formControlLabelProps
1697
1749
  } = _ref,
1698
- props = _objectWithoutProperties(_ref, _excluded$f);
1750
+ props = _objectWithoutProperties(_ref, _excluded$g);
1699
1751
 
1700
1752
  return /*#__PURE__*/jsxRuntime.jsxs(material.FormControl, {
1701
1753
  error: error,
@@ -1715,7 +1767,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1715
1767
  });
1716
1768
  if (process.env.NODE_ENV !== "production") RadioField.displayName = "RadioField";
1717
1769
 
1718
- var _excluded$g = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
1770
+ var _excluded$h = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
1719
1771
  var RadioGroupField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1720
1772
  var {
1721
1773
  name,
@@ -1728,7 +1780,7 @@ var RadioGroupField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1728
1780
  FormHelperTextProps: formHelperTextProps,
1729
1781
  children
1730
1782
  } = _ref,
1731
- formControlProps = _objectWithoutProperties(_ref, _excluded$g);
1783
+ formControlProps = _objectWithoutProperties(_ref, _excluded$h);
1732
1784
 
1733
1785
  return /*#__PURE__*/jsxRuntime.jsxs(material.FormControl, _objectSpread(_objectSpread({}, formControlProps), {}, {
1734
1786
  hiddenLabel: !label,
@@ -1778,8 +1830,8 @@ function useMinBreakpoint(minBreakpoint) {
1778
1830
  return minBreakpointIDX < breakpointIDX;
1779
1831
  }
1780
1832
 
1781
- var _excluded$h = ["action", "children", "onClose", "className", "classes", "variant"],
1782
- _excluded2$1 = ["icon", "closeButton", "variantError", "variantSuccess"];
1833
+ var _excluded$i = ["action", "children", "onClose", "className", "classes", "variant"],
1834
+ _excluded2$2 = ["icon", "closeButton", "variantError", "variantSuccess"];
1783
1835
  var useStyles$1 = /*#__PURE__*/styles.makeStyles(theme => ({
1784
1836
  root: {
1785
1837
  color: exports.Color.White,
@@ -1823,7 +1875,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1823
1875
  classes,
1824
1876
  variant = 'default'
1825
1877
  } = _ref,
1826
- props = _objectWithoutProperties(_ref, _excluded$h);
1878
+ props = _objectWithoutProperties(_ref, _excluded$i);
1827
1879
 
1828
1880
  var _useStyles = useStyles$1({
1829
1881
  classes
@@ -1834,7 +1886,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1834
1886
  variantError,
1835
1887
  variantSuccess
1836
1888
  } = _useStyles,
1837
- styles = _objectWithoutProperties(_useStyles, _excluded2$1);
1889
+ styles = _objectWithoutProperties(_useStyles, _excluded2$2);
1838
1890
 
1839
1891
  var Icon = variant === 'error' ? iconsMaterial.Warning : variant === 'success' ? iconsMaterial.CheckCircle : undefined;
1840
1892
  return /*#__PURE__*/jsxRuntime.jsx(material.SnackbarContent, _objectSpread(_objectSpread({}, props), {}, {
@@ -1873,7 +1925,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1873
1925
  });
1874
1926
  if (process.env.NODE_ENV !== "production") SnackbarContent.displayName = "SnackbarContent";
1875
1927
 
1876
- var _excluded$i = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
1928
+ var _excluded$j = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
1877
1929
 
1878
1930
  function SlideTransition(props) {
1879
1931
  return /*#__PURE__*/jsxRuntime.jsx(material.Slide, _objectSpread(_objectSpread({}, props), {}, {
@@ -1892,7 +1944,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1892
1944
  hasCloseButton = onClose != null,
1893
1945
  TransitionComponent = SlideTransition
1894
1946
  } = _ref,
1895
- props = _objectWithoutProperties(_ref, _excluded$i);
1947
+ props = _objectWithoutProperties(_ref, _excluded$j);
1896
1948
 
1897
1949
  function handleClose(reason) {
1898
1950
  if (reason !== 'clickaway') {
@@ -1921,7 +1973,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1921
1973
  });
1922
1974
  if (process.env.NODE_ENV !== "production") Snackbar.displayName = "Snackbar";
1923
1975
 
1924
- var _excluded$j = ["onClose", "variant", "key", "id", "autoHideDuration"];
1976
+ var _excluded$k = ["onClose", "variant", "key", "id", "autoHideDuration"];
1925
1977
 
1926
1978
  function warnContext() {
1927
1979
  // eslint-disable-next-line no-console
@@ -1967,7 +2019,7 @@ function SnackbarStackProvider(_ref2) {
1967
2019
  id = String(key),
1968
2020
  autoHideDuration = 5000
1969
2021
  } = _ref3,
1970
- props = _objectWithoutProperties(_ref3, _excluded$j);
2022
+ props = _objectWithoutProperties(_ref3, _excluded$k);
1971
2023
 
1972
2024
  function removeSnackbar() {
1973
2025
  setStack(prev => {
@@ -2064,7 +2116,7 @@ var Stack = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
2064
2116
  });
2065
2117
  if (process.env.NODE_ENV !== "production") Stack.displayName = "Stack";
2066
2118
 
2067
- var _excluded$k = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2119
+ var _excluded$l = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2068
2120
  var useStyles$2 = /*#__PURE__*/styles.makeStyles(theme => ({
2069
2121
  root: {
2070
2122
  maxWidth: '100%',
@@ -2148,7 +2200,7 @@ var Tag = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2148
2200
  fontWeight = 'bold',
2149
2201
  component = 'div'
2150
2202
  } = _ref,
2151
- props = _objectWithoutProperties(_ref, _excluded$k);
2203
+ props = _objectWithoutProperties(_ref, _excluded$l);
2152
2204
 
2153
2205
  var styles = useStyles$2({
2154
2206
  classes
@@ -3804,6 +3856,7 @@ exports.GridStack = GridStack;
3804
3856
  exports.InfoCard = InfoCard;
3805
3857
  exports.Inline = Inline;
3806
3858
  exports.InlineGrid = InlineGrid;
3859
+ exports.NumberField = NumberField;
3807
3860
  exports.OverflowText = OverflowText;
3808
3861
  exports.RadioField = RadioField;
3809
3862
  exports.RadioGroupField = RadioGroupField;