@superdispatch/ui 0.21.5-alpha.0 → 0.21.5-alpha.2

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.
@@ -11,13 +11,13 @@ var material = require('@mui/material');
11
11
  var React = require('react');
12
12
  var lab = require('@mui/lab');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
- var core = require('@material-ui/core');
15
14
  var styled = require('styled-components');
16
15
  var styled__default = _interopDefault(styled);
17
16
  var resizeObserver = require('@juggle/resize-observer');
18
17
  var hooks = require('@superdispatch/hooks');
19
18
  var styles = require('@mui/styles');
20
19
  var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
20
+ var NumberFormat = _interopDefault(require('react-number-format'));
21
21
  var clsx = _interopDefault(require('clsx'));
22
22
  var system = require('@mui/system');
23
23
 
@@ -106,7 +106,7 @@ var DropdownButton = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
106
106
  }
107
107
 
108
108
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
109
- children: [/*#__PURE__*/jsxRuntime.jsxs(core.ButtonGroup, _objectSpread(_objectSpread({}, ButtonGroupProps), {}, {
109
+ children: [/*#__PURE__*/jsxRuntime.jsxs(material.ButtonGroup, _objectSpread(_objectSpread({}, ButtonGroupProps), {}, {
110
110
  ref: mergeRefs(ButtonGroupProps === null || ButtonGroupProps === void 0 ? void 0 : ButtonGroupProps.ref, anchorRef),
111
111
  fullWidth: (ButtonGroupProps === null || ButtonGroupProps === void 0 ? void 0 : ButtonGroupProps.fullWidth) || buttonProps.fullWidth,
112
112
  children: [/*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread(_objectSpread({
@@ -126,7 +126,7 @@ var DropdownButton = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
126
126
  "aria-expanded": open ? 'true' : undefined,
127
127
  children: /*#__PURE__*/jsxRuntime.jsx(CaretDownIcon, {})
128
128
  })]
129
- })), /*#__PURE__*/jsxRuntime.jsx(core.Popover, {
129
+ })), /*#__PURE__*/jsxRuntime.jsx(material.Popover, {
130
130
  open: open,
131
131
  onClose: handleClose,
132
132
  anchorEl: anchorRef.current,
@@ -138,7 +138,7 @@ var DropdownButton = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
138
138
  style: {
139
139
  minWidth: (_anchorRef$current2 = anchorRef.current) === null || _anchorRef$current2 === void 0 ? void 0 : _anchorRef$current2.clientWidth
140
140
  },
141
- children: /*#__PURE__*/jsxRuntime.jsx(core.MenuList, _objectSpread(_objectSpread({}, MenuListProps), {}, {
141
+ children: /*#__PURE__*/jsxRuntime.jsx(material.MenuList, _objectSpread(_objectSpread({}, MenuListProps), {}, {
142
142
  id: uid,
143
143
  onClick: () => {
144
144
  setOpen(false);
@@ -1685,7 +1685,58 @@ var Inline = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1685
1685
  });
1686
1686
  if (process.env.NODE_ENV !== "production") Inline.displayName = "Inline";
1687
1687
 
1688
- 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"];
1689
1740
  var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1690
1741
  var {
1691
1742
  label,
@@ -1696,7 +1747,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1696
1747
  helperText,
1697
1748
  FormControlLabelProps: formControlLabelProps
1698
1749
  } = _ref,
1699
- props = _objectWithoutProperties(_ref, _excluded$f);
1750
+ props = _objectWithoutProperties(_ref, _excluded$g);
1700
1751
 
1701
1752
  return /*#__PURE__*/jsxRuntime.jsxs(material.FormControl, {
1702
1753
  error: error,
@@ -1716,7 +1767,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1716
1767
  });
1717
1768
  if (process.env.NODE_ENV !== "production") RadioField.displayName = "RadioField";
1718
1769
 
1719
- 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"];
1720
1771
  var RadioGroupField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1721
1772
  var {
1722
1773
  name,
@@ -1729,7 +1780,7 @@ var RadioGroupField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1729
1780
  FormHelperTextProps: formHelperTextProps,
1730
1781
  children
1731
1782
  } = _ref,
1732
- formControlProps = _objectWithoutProperties(_ref, _excluded$g);
1783
+ formControlProps = _objectWithoutProperties(_ref, _excluded$h);
1733
1784
 
1734
1785
  return /*#__PURE__*/jsxRuntime.jsxs(material.FormControl, _objectSpread(_objectSpread({}, formControlProps), {}, {
1735
1786
  hiddenLabel: !label,
@@ -1779,8 +1830,8 @@ function useMinBreakpoint(minBreakpoint) {
1779
1830
  return minBreakpointIDX < breakpointIDX;
1780
1831
  }
1781
1832
 
1782
- var _excluded$h = ["action", "children", "onClose", "className", "classes", "variant"],
1783
- _excluded2$1 = ["icon", "closeButton", "variantError", "variantSuccess"];
1833
+ var _excluded$i = ["action", "children", "onClose", "className", "classes", "variant"],
1834
+ _excluded2$2 = ["icon", "closeButton", "variantError", "variantSuccess"];
1784
1835
  var useStyles$1 = /*#__PURE__*/styles.makeStyles(theme => ({
1785
1836
  root: {
1786
1837
  color: exports.Color.White,
@@ -1824,7 +1875,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1824
1875
  classes,
1825
1876
  variant = 'default'
1826
1877
  } = _ref,
1827
- props = _objectWithoutProperties(_ref, _excluded$h);
1878
+ props = _objectWithoutProperties(_ref, _excluded$i);
1828
1879
 
1829
1880
  var _useStyles = useStyles$1({
1830
1881
  classes
@@ -1835,7 +1886,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1835
1886
  variantError,
1836
1887
  variantSuccess
1837
1888
  } = _useStyles,
1838
- styles = _objectWithoutProperties(_useStyles, _excluded2$1);
1889
+ styles = _objectWithoutProperties(_useStyles, _excluded2$2);
1839
1890
 
1840
1891
  var Icon = variant === 'error' ? iconsMaterial.Warning : variant === 'success' ? iconsMaterial.CheckCircle : undefined;
1841
1892
  return /*#__PURE__*/jsxRuntime.jsx(material.SnackbarContent, _objectSpread(_objectSpread({}, props), {}, {
@@ -1874,7 +1925,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1874
1925
  });
1875
1926
  if (process.env.NODE_ENV !== "production") SnackbarContent.displayName = "SnackbarContent";
1876
1927
 
1877
- var _excluded$i = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
1928
+ var _excluded$j = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
1878
1929
 
1879
1930
  function SlideTransition(props) {
1880
1931
  return /*#__PURE__*/jsxRuntime.jsx(material.Slide, _objectSpread(_objectSpread({}, props), {}, {
@@ -1893,7 +1944,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1893
1944
  hasCloseButton = onClose != null,
1894
1945
  TransitionComponent = SlideTransition
1895
1946
  } = _ref,
1896
- props = _objectWithoutProperties(_ref, _excluded$i);
1947
+ props = _objectWithoutProperties(_ref, _excluded$j);
1897
1948
 
1898
1949
  function handleClose(reason) {
1899
1950
  if (reason !== 'clickaway') {
@@ -1922,7 +1973,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1922
1973
  });
1923
1974
  if (process.env.NODE_ENV !== "production") Snackbar.displayName = "Snackbar";
1924
1975
 
1925
- var _excluded$j = ["onClose", "variant", "key", "id", "autoHideDuration"];
1976
+ var _excluded$k = ["onClose", "variant", "key", "id", "autoHideDuration"];
1926
1977
 
1927
1978
  function warnContext() {
1928
1979
  // eslint-disable-next-line no-console
@@ -1968,7 +2019,7 @@ function SnackbarStackProvider(_ref2) {
1968
2019
  id = String(key),
1969
2020
  autoHideDuration = 5000
1970
2021
  } = _ref3,
1971
- props = _objectWithoutProperties(_ref3, _excluded$j);
2022
+ props = _objectWithoutProperties(_ref3, _excluded$k);
1972
2023
 
1973
2024
  function removeSnackbar() {
1974
2025
  setStack(prev => {
@@ -2065,7 +2116,7 @@ var Stack = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
2065
2116
  });
2066
2117
  if (process.env.NODE_ENV !== "production") Stack.displayName = "Stack";
2067
2118
 
2068
- var _excluded$k = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2119
+ var _excluded$l = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2069
2120
  var useStyles$2 = /*#__PURE__*/styles.makeStyles(theme => ({
2070
2121
  root: {
2071
2122
  maxWidth: '100%',
@@ -2149,7 +2200,7 @@ var Tag = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2149
2200
  fontWeight = 'bold',
2150
2201
  component = 'div'
2151
2202
  } = _ref,
2152
- props = _objectWithoutProperties(_ref, _excluded$k);
2203
+ props = _objectWithoutProperties(_ref, _excluded$l);
2153
2204
 
2154
2205
  var styles = useStyles$2({
2155
2206
  classes
@@ -3805,6 +3856,7 @@ exports.GridStack = GridStack;
3805
3856
  exports.InfoCard = InfoCard;
3806
3857
  exports.Inline = Inline;
3807
3858
  exports.InlineGrid = InlineGrid;
3859
+ exports.NumberField = NumberField;
3808
3860
  exports.OverflowText = OverflowText;
3809
3861
  exports.RadioField = RadioField;
3810
3862
  exports.RadioGroupField = RadioGroupField;