@superdispatch/ui 0.24.8 → 0.25.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.
@@ -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"];
@@ -1119,7 +1119,7 @@ function useVisibilityObserver(node) {
1119
1119
 
1120
1120
  var observer = new IntersectionObserver(_ref => {
1121
1121
  var [entry] = _ref;
1122
- setState(entry !== null && entry !== void 0 && entry.isIntersecting ? 'visible' : 'invisible');
1122
+ setState(entry !== null && entry !== void 0 && entry.isIntersecting && document.visibilityState === 'visible' ? 'visible' : 'invisible');
1123
1123
  }, {
1124
1124
  rootMargin,
1125
1125
  threshold
@@ -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,17 +1793,17 @@ 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
1809
  onValueChange: values => {
@@ -1812,7 +1812,8 @@ function NumberInputComponent(_ref) {
1812
1812
  target: {
1813
1813
  value: disableValueParsing ? values.value : floatValue
1814
1814
  }
1815
- };
1815
+ }; // eslint-disable-next-line @typescript-eslint/no-unsafe-call
1816
+
1816
1817
  onChange === null || onChange === void 0 ? void 0 : onChange(event);
1817
1818
  }
1818
1819
  }));
@@ -1837,7 +1838,41 @@ var NumberField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1837
1838
  if (process.env.NODE_ENV !== "production") NumberField.displayName = "NumberField";
1838
1839
  NumberField.displayName = 'NumberField';
1839
1840
 
1840
- var _excluded$j = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
1841
+ var _excluded$j = ["id", "value", "onChange", "inputMode", "valueIsNumericString"];
1842
+ var PatternField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1843
+ var {
1844
+ id,
1845
+ value,
1846
+ onChange,
1847
+ inputMode = 'decimal',
1848
+ valueIsNumericString = true
1849
+ } = _ref,
1850
+ props = _objectWithoutProperties(_ref, _excluded$j);
1851
+
1852
+ var uid = useUID(id);
1853
+ return /*#__PURE__*/jsxRuntime.jsx(reactNumberFormat.PatternFormat, _objectSpread(_objectSpread({}, props), {}, {
1854
+ id: uid,
1855
+ value: value !== null && value !== void 0 ? value : '' // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1856
+ ,
1857
+ inputMode: inputMode,
1858
+ getInputRef: ref,
1859
+ valueIsNumericString: valueIsNumericString,
1860
+ customInput: core.TextField,
1861
+ onValueChange: values => {
1862
+ var event = {
1863
+ target: {
1864
+ name: props.name,
1865
+ value: values.value
1866
+ }
1867
+ };
1868
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
1869
+ }
1870
+ }));
1871
+ });
1872
+ if (process.env.NODE_ENV !== "production") PatternField.displayName = "PatternField";
1873
+ PatternField.displayName = 'PatternField';
1874
+
1875
+ var _excluded$k = ["label", "error", "checked", "onBlur", "onChange", "helperText", "FormControlLabelProps"];
1841
1876
  var FormControl$1 = /*#__PURE__*/styled__default(core.FormControl).withConfig({
1842
1877
  displayName: "RadioField__FormControl",
1843
1878
  componentId: "SD__sc-6ey4qt-0"
@@ -1856,7 +1891,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1856
1891
  helperText,
1857
1892
  FormControlLabelProps: formControlLabelProps
1858
1893
  } = _ref,
1859
- props = _objectWithoutProperties(_ref, _excluded$j);
1894
+ props = _objectWithoutProperties(_ref, _excluded$k);
1860
1895
 
1861
1896
  return /*#__PURE__*/jsxRuntime.jsxs(FormControl$1, {
1862
1897
  error: error,
@@ -1876,7 +1911,7 @@ var RadioField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1876
1911
  });
1877
1912
  if (process.env.NODE_ENV !== "production") RadioField.displayName = "RadioField";
1878
1913
 
1879
- var _excluded$k = ["name", "value", "label", "caption", "disabled", "icon", "checked", "onChange"];
1914
+ var _excluded$l = ["name", "value", "label", "caption", "disabled", "icon", "checked", "onChange"];
1880
1915
  var ClickableCard = /*#__PURE__*/styled__default(core.ButtonBase).withConfig({
1881
1916
  displayName: "RadioFieldCard__ClickableCard",
1882
1917
  componentId: "SD__sc-5etge2-0"
@@ -1913,7 +1948,7 @@ var RadioFieldCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1913
1948
  checked,
1914
1949
  onChange
1915
1950
  } = _ref2,
1916
- props = _objectWithoutProperties(_ref2, _excluded$k);
1951
+ props = _objectWithoutProperties(_ref2, _excluded$l);
1917
1952
 
1918
1953
  return /*#__PURE__*/jsxRuntime.jsx(Card, {
1919
1954
  disabled: disabled,
@@ -1955,7 +1990,7 @@ var RadioFieldCard = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
1955
1990
  });
1956
1991
  if (process.env.NODE_ENV !== "production") RadioFieldCard.displayName = "RadioFieldCard";
1957
1992
 
1958
- var _excluded$l = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
1993
+ var _excluded$m = ["name", "value", "onChange", "RadioGroupProps", "label", "FormLabelProps", "helperText", "FormHelperTextProps", "children"];
1959
1994
  var FormLabel$1 = /*#__PURE__*/styled__default(core.FormLabel).withConfig({
1960
1995
  displayName: "RadioGroupField__FormLabel",
1961
1996
  componentId: "SD__sc-1udxviq-0"
@@ -1976,7 +2011,7 @@ var RadioGroupField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
1976
2011
  FormHelperTextProps: formHelperTextProps,
1977
2012
  children
1978
2013
  } = _ref,
1979
- formControlProps = _objectWithoutProperties(_ref, _excluded$l);
2014
+ formControlProps = _objectWithoutProperties(_ref, _excluded$m);
1980
2015
 
1981
2016
  return /*#__PURE__*/jsxRuntime.jsxs(core.FormControl, _objectSpread(_objectSpread({}, formControlProps), {}, {
1982
2017
  hiddenLabel: !label,
@@ -2026,7 +2061,7 @@ function useMinBreakpoint(minBreakpoint) {
2026
2061
  return minBreakpointIDX < breakpointIDX;
2027
2062
  }
2028
2063
 
2029
- var _excluded$m = ["action", "children", "onClose", "className", "classes", "variant"],
2064
+ var _excluded$n = ["action", "children", "onClose", "className", "classes", "variant"],
2030
2065
  _excluded2$4 = ["icon", "closeButton", "variantError", "variantSuccess"];
2031
2066
  var PaddedContent = /*#__PURE__*/styled__default.span.withConfig({
2032
2067
  displayName: "SnackbarContent__PaddedContent",
@@ -2084,7 +2119,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2084
2119
  classes,
2085
2120
  variant = 'default'
2086
2121
  } = _ref,
2087
- props = _objectWithoutProperties(_ref, _excluded$m);
2122
+ props = _objectWithoutProperties(_ref, _excluded$n);
2088
2123
 
2089
2124
  var _useStyles = useStyles$b({
2090
2125
  classes
@@ -2136,7 +2171,7 @@ var SnackbarContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2136
2171
  });
2137
2172
  if (process.env.NODE_ENV !== "production") SnackbarContent.displayName = "SnackbarContent";
2138
2173
 
2139
- var _excluded$n = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
2174
+ var _excluded$o = ["open", "action", "variant", "onClose", "children", "ContentProps", "hasCloseButton", "TransitionComponent"];
2140
2175
 
2141
2176
  function SlideTransition(props) {
2142
2177
  return /*#__PURE__*/jsxRuntime.jsx(core.Slide, _objectSpread(_objectSpread({}, props), {}, {
@@ -2155,7 +2190,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2155
2190
  hasCloseButton = onClose != null,
2156
2191
  TransitionComponent = SlideTransition
2157
2192
  } = _ref,
2158
- props = _objectWithoutProperties(_ref, _excluded$n);
2193
+ props = _objectWithoutProperties(_ref, _excluded$o);
2159
2194
 
2160
2195
  function handleClose(reason) {
2161
2196
  if (reason !== 'clickaway') {
@@ -2184,7 +2219,7 @@ var Snackbar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2184
2219
  });
2185
2220
  if (process.env.NODE_ENV !== "production") Snackbar.displayName = "Snackbar";
2186
2221
 
2187
- var _excluded$o = ["onClose", "variant", "key", "id", "autoHideDuration"];
2222
+ var _excluded$p = ["onClose", "variant", "key", "id", "autoHideDuration"];
2188
2223
 
2189
2224
  function warnContext() {
2190
2225
  // eslint-disable-next-line no-console
@@ -2230,7 +2265,7 @@ function SnackbarStackProvider(_ref2) {
2230
2265
  id = String(key),
2231
2266
  autoHideDuration = 5000
2232
2267
  } = _ref3,
2233
- props = _objectWithoutProperties(_ref3, _excluded$o);
2268
+ props = _objectWithoutProperties(_ref3, _excluded$p);
2234
2269
 
2235
2270
  function removeSnackbar() {
2236
2271
  setStack(prev => {
@@ -2327,7 +2362,7 @@ var Stack = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
2327
2362
  });
2328
2363
  if (process.env.NODE_ENV !== "production") Stack.displayName = "Stack";
2329
2364
 
2330
- var _excluded$p = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2365
+ var _excluded$q = ["color", "variant", "children", "classes", "className", "noWrap", "fontWeight", "component"];
2331
2366
  var useStyles$c = /*#__PURE__*/styles.makeStyles(theme => ({
2332
2367
  root: {
2333
2368
  maxWidth: '100%',
@@ -2411,7 +2446,7 @@ var Tag = /*#__PURE__*/React.forwardRef((_ref, ref) => {
2411
2446
  fontWeight = 'bold',
2412
2447
  component = 'div'
2413
2448
  } = _ref,
2414
- props = _objectWithoutProperties(_ref, _excluded$p);
2449
+ props = _objectWithoutProperties(_ref, _excluded$q);
2415
2450
 
2416
2451
  var styles = useStyles$c({
2417
2452
  classes
@@ -3842,6 +3877,14 @@ function overrideTypography(theme) {
3842
3877
  theme.props.MuiTypography = {
3843
3878
  variant: 'body2'
3844
3879
  };
3880
+ theme.overrides.MuiTypography = {
3881
+ colorError: {
3882
+ color: exports.Color.Red500
3883
+ },
3884
+ colorPrimary: {
3885
+ color: exports.Color.Blue500
3886
+ }
3887
+ };
3845
3888
  }
3846
3889
 
3847
3890
  function createSuperDispatchTheme() {
@@ -4086,6 +4129,7 @@ exports.Inline = Inline;
4086
4129
  exports.InlineGrid = InlineGrid;
4087
4130
  exports.NumberField = NumberField;
4088
4131
  exports.OverflowText = OverflowText;
4132
+ exports.PatternField = PatternField;
4089
4133
  exports.RadioField = RadioField;
4090
4134
  exports.RadioFieldCard = RadioFieldCard;
4091
4135
  exports.RadioGroupField = RadioGroupField;