@superdispatch/ui 0.24.9 → 0.25.1

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,7 +17,7 @@ var resizeObserver = require('@juggle/resize-observer');
17
17
  var hooks = require('@superdispatch/hooks');
18
18
  var clsx = _interopDefault(require('clsx'));
19
19
  var flattenChildren = _interopDefault(require('react-keyed-flatten-children'));
20
- var NumberFormat = _interopDefault(require('react-number-format'));
20
+ var reactNumberFormat = require('react-number-format');
21
21
  var createBreakpoints = _interopDefault(require('@material-ui/core/styles/createBreakpoints'));
22
22
 
23
23
  var _excluded = ["size", "children", "disabled", "isActive", "isLoading", "color"];
@@ -1785,7 +1785,7 @@ var Inline = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1785
1785
  });
1786
1786
  if (process.env.NODE_ENV !== "production") Inline.displayName = "Inline";
1787
1787
 
1788
- var _excluded$i = ["value", "inputRef", "onChange", "isNumericString", "thousandSeparator", "disableValueParsing"],
1788
+ var _excluded$i = ["value", "inputRef", "onChange", "valueIsNumericString", "thousandSeparator", "disableValueParsing"],
1789
1789
  _excluded2$3 = ["id", "InputProps"];
1790
1790
 
1791
1791
  function NumberInputComponent(_ref) {
@@ -1793,27 +1793,32 @@ function NumberInputComponent(_ref) {
1793
1793
  value,
1794
1794
  inputRef,
1795
1795
  onChange,
1796
- isNumericString = true,
1796
+ valueIsNumericString = true,
1797
1797
  thousandSeparator = true,
1798
1798
  disableValueParsing
1799
1799
  } = _ref,
1800
1800
  props = _objectWithoutProperties(_ref, _excluded$i);
1801
1801
 
1802
- return /*#__PURE__*/jsxRuntime.jsx(NumberFormat, _objectSpread(_objectSpread({}, props), {}, {
1802
+ return /*#__PURE__*/jsxRuntime.jsx(reactNumberFormat.NumericFormat, _objectSpread(_objectSpread({}, props), {}, {
1803
1803
  value: value !== null && value !== void 0 ? value : '',
1804
1804
  inputMode: "decimal",
1805
1805
  getInputRef: inputRef,
1806
- isNumericString: isNumericString,
1806
+ valueIsNumericString: valueIsNumericString,
1807
1807
  thousandSeparator: thousandSeparator,
1808
1808
  allowedDecimalSeparators: ['.', ','],
1809
- onValueChange: values => {
1810
- var floatValue = !Number.isNaN(Number(values.floatValue)) ? values.floatValue : null;
1811
- var event = {
1812
- target: {
1809
+ onValueChange: (values, sourceInfo) => {
1810
+ var _values$floatValue;
1811
+
1812
+ var floatValue = (_values$floatValue = values.floatValue) !== null && _values$floatValue !== void 0 ? _values$floatValue : null;
1813
+ var {
1814
+ event
1815
+ } = sourceInfo; // eslint-disable-next-line @typescript-eslint/no-unsafe-call
1816
+
1817
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, event), {}, {
1818
+ target: _objectSpread(_objectSpread({}, event === null || event === void 0 ? void 0 : event.target), {}, {
1813
1819
  value: disableValueParsing ? values.value : floatValue
1814
- }
1815
- };
1816
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
1820
+ })
1821
+ }));
1817
1822
  }
1818
1823
  }));
1819
1824
  }
@@ -1837,7 +1842,44 @@ var NumberField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1837
1842
  if (process.env.NODE_ENV !== "production") NumberField.displayName = "NumberField";
1838
1843
  NumberField.displayName = 'NumberField';
1839
1844
 
1840
- var _excluded$j = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
1845
+ var _excluded$j = ["id", "value", "onChange", "inputMode", "valueIsNumericString", "onValueChange"];
1846
+ var PatternField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1847
+ var {
1848
+ id,
1849
+ value,
1850
+ onChange,
1851
+ inputMode = 'decimal',
1852
+ valueIsNumericString = true,
1853
+ onValueChange: _onValueChange
1854
+ } = _ref,
1855
+ props = _objectWithoutProperties(_ref, _excluded$j);
1856
+
1857
+ var uid = useUID(id);
1858
+ return /*#__PURE__*/jsxRuntime.jsx(reactNumberFormat.PatternFormat, _objectSpread(_objectSpread({}, props), {}, {
1859
+ id: uid,
1860
+ value: value !== null && value !== void 0 ? value : '' // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1861
+ ,
1862
+ inputMode: inputMode,
1863
+ getInputRef: ref,
1864
+ valueIsNumericString: valueIsNumericString,
1865
+ customInput: core.TextField,
1866
+ onValueChange: (values, sourceInfo) => {
1867
+ var {
1868
+ event
1869
+ } = sourceInfo;
1870
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, event), {}, {
1871
+ target: _objectSpread(_objectSpread({}, event === null || event === void 0 ? void 0 : event.target), {}, {
1872
+ value: values.value
1873
+ })
1874
+ }));
1875
+ _onValueChange === null || _onValueChange === void 0 ? void 0 : _onValueChange(values, sourceInfo);
1876
+ }
1877
+ }));
1878
+ });
1879
+ if (process.env.NODE_ENV !== "production") PatternField.displayName = "PatternField";
1880
+ PatternField.displayName = 'PatternField';
1881
+
1882
+ var _excluded$k = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
1841
1883
  var FormControl$1 = /*#__PURE__*/styled__default(core.FormControl).withConfig({
1842
1884
  displayName: "RadioField__FormControl",
1843
1885
  componentId: "SD__sc-6ey4qt-0"
@@ -1856,7 +1898,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1856
1898
  helperText,
1857
1899
  FormControlLabelProps: formControlLabelProps
1858
1900
  } = _ref,
1859
- props = _objectWithoutProperties(_ref, _excluded$j);
1901
+ props = _objectWithoutProperties(_ref, _excluded$k);
1860
1902
 
1861
1903
  return /*#__PURE__*/jsxRuntime.jsxs(FormControl$1, {
1862
1904
  error: error,
@@ -1876,7 +1918,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1876
1918
  });
1877
1919
  if (process.env.NODE_ENV !== "production") RadioField.displayName = "RadioField";
1878
1920
 
1879
- var _excluded$k = ["name", "value", "label", "caption", "disabled", "icon", "checked", "onChange"];
1921
+ var _excluded$l = ["name", "value", "label", "caption", "disabled", "icon", "checked", "onChange"];
1880
1922
  var ClickableCard = /*#__PURE__*/styled__default(core.ButtonBase).withConfig({
1881
1923
  displayName: "RadioFieldCard__ClickableCard",
1882
1924
  componentId: "SD__sc-5etge2-0"
@@ -1913,7 +1955,7 @@ var RadioFieldCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1913
1955
  checked,
1914
1956
  onChange
1915
1957
  } = _ref2,
1916
- props = _objectWithoutProperties(_ref2, _excluded$k);
1958
+ props = _objectWithoutProperties(_ref2, _excluded$l);
1917
1959
 
1918
1960
  return /*#__PURE__*/jsxRuntime.jsx(Card, {
1919
1961
  disabled: disabled,
@@ -1955,7 +1997,7 @@ var RadioFieldCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1955
1997
  });
1956
1998
  if (process.env.NODE_ENV !== "production") RadioFieldCard.displayName = "RadioFieldCard";
1957
1999
 
1958
- var _excluded$l = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
2000
+ var _excluded$m = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
1959
2001
  var FormLabel$1 = /*#__PURE__*/styled__default(core.FormLabel).withConfig({
1960
2002
  displayName: "RadioGroupField__FormLabel",
1961
2003
  componentId: "SD__sc-1udxviq-0"
@@ -1976,7 +2018,7 @@ var RadioGroupField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1976
2018
  FormHelperTextProps: formHelperTextProps,
1977
2019
  children
1978
2020
  } = _ref,
1979
- formControlProps = _objectWithoutProperties(_ref, _excluded$l);
2021
+ formControlProps = _objectWithoutProperties(_ref, _excluded$m);
1980
2022
 
1981
2023
  return /*#__PURE__*/jsxRuntime.jsxs(core.FormControl, _objectSpread(_objectSpread({}, formControlProps), {}, {
1982
2024
  hiddenLabel: !label,
@@ -2026,7 +2068,7 @@ function useMinBreakpoint(minBreakpoint) {
2026
2068
  return minBreakpointIDX < breakpointIDX;
2027
2069
  }
2028
2070
 
2029
- var _excluded$m = ["action", "children", "onClose", "className", "classes", "variant"],
2071
+ var _excluded$n = ["action", "children", "onClose", "className", "classes", "variant"],
2030
2072
  _excluded2$4 = ["icon", "closeButton", "variantError", "variantSuccess"];
2031
2073
  var PaddedContent = /*#__PURE__*/styled__default.span.withConfig({
2032
2074
  displayName: "SnackbarContent__PaddedContent",
@@ -2084,7 +2126,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2084
2126
  classes,
2085
2127
  variant = 'default'
2086
2128
  } = _ref,
2087
- props = _objectWithoutProperties(_ref, _excluded$m);
2129
+ props = _objectWithoutProperties(_ref, _excluded$n);
2088
2130
 
2089
2131
  var _useStyles = useStyles$b({
2090
2132
  classes
@@ -2136,7 +2178,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2136
2178
  });
2137
2179
  if (process.env.NODE_ENV !== "production") SnackbarContent.displayName = "SnackbarContent";
2138
2180
 
2139
- var _excluded$n = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
2181
+ var _excluded$o = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
2140
2182
 
2141
2183
  function SlideTransition(props) {
2142
2184
  return /*#__PURE__*/jsxRuntime.jsx(core.Slide, _objectSpread(_objectSpread({}, props), {}, {
@@ -2155,7 +2197,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2155
2197
  hasCloseButton = onClose != null,
2156
2198
  TransitionComponent = SlideTransition
2157
2199
  } = _ref,
2158
- props = _objectWithoutProperties(_ref, _excluded$n);
2200
+ props = _objectWithoutProperties(_ref, _excluded$o);
2159
2201
 
2160
2202
  function handleClose(reason) {
2161
2203
  if (reason !== 'clickaway') {
@@ -2184,7 +2226,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2184
2226
  });
2185
2227
  if (process.env.NODE_ENV !== "production") Snackbar.displayName = "Snackbar";
2186
2228
 
2187
- var _excluded$o = ["onClose", "variant", "key", "id", "autoHideDuration"];
2229
+ var _excluded$p = ["onClose", "variant", "key", "id", "autoHideDuration"];
2188
2230
 
2189
2231
  function warnContext() {
2190
2232
  // eslint-disable-next-line no-console
@@ -2230,7 +2272,7 @@ function SnackbarStackProvider(_ref2) {
2230
2272
  id = String(key),
2231
2273
  autoHideDuration = 5000
2232
2274
  } = _ref3,
2233
- props = _objectWithoutProperties(_ref3, _excluded$o);
2275
+ props = _objectWithoutProperties(_ref3, _excluded$p);
2234
2276
 
2235
2277
  function removeSnackbar() {
2236
2278
  setStack(prev => {
@@ -2327,7 +2369,7 @@ var Stack = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
2327
2369
  });
2328
2370
  if (process.env.NODE_ENV !== "production") Stack.displayName = "Stack";
2329
2371
 
2330
- var _excluded$p = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2372
+ var _excluded$q = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2331
2373
  var useStyles$c = /*#__PURE__*/styles.makeStyles(theme => ({
2332
2374
  root: {
2333
2375
  maxWidth: '100%',
@@ -2411,7 +2453,7 @@ var Tag = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2411
2453
  fontWeight = 'bold',
2412
2454
  component = 'div'
2413
2455
  } = _ref,
2414
- props = _objectWithoutProperties(_ref, _excluded$p);
2456
+ props = _objectWithoutProperties(_ref, _excluded$q);
2415
2457
 
2416
2458
  var styles = useStyles$c({
2417
2459
  classes
@@ -3842,6 +3884,14 @@ function overrideTypography(theme) {
3842
3884
  theme.props.MuiTypography = {
3843
3885
  variant: 'body2'
3844
3886
  };
3887
+ theme.overrides.MuiTypography = {
3888
+ colorError: {
3889
+ color: exports.Color.Red500
3890
+ },
3891
+ colorPrimary: {
3892
+ color: exports.Color.Blue500
3893
+ }
3894
+ };
3845
3895
  }
3846
3896
 
3847
3897
  function createSuperDispatchTheme() {
@@ -4086,6 +4136,7 @@ exports.Inline = Inline;
4086
4136
  exports.InlineGrid = InlineGrid;
4087
4137
  exports.NumberField = NumberField;
4088
4138
  exports.OverflowText = OverflowText;
4139
+ exports.PatternField = PatternField;
4089
4140
  exports.RadioField = RadioField;
4090
4141
  exports.RadioFieldCard = RadioFieldCard;
4091
4142
  exports.RadioGroupField = RadioGroupField;