@superdispatch/ui 0.26.1 → 0.28.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.
@@ -75,30 +75,40 @@ export var DrawerTitle = /*#__PURE__*/forwardRef((_ref, appBarRef) => {
75
75
  className: styles.toolbar,
76
76
  children: /*#__PURE__*/_jsxs(Grid, {
77
77
  container: true,
78
- alignItems: "center",
79
- children: [!!startAction && /*#__PURE__*/_jsx(Grid, {
78
+ direction: "column",
79
+ children: [/*#__PURE__*/_jsx(Grid, {
80
80
  item: true,
81
- className: styles.startAction,
82
- children: startAction
83
- }), /*#__PURE__*/_jsxs(Grid, {
81
+ children: /*#__PURE__*/_jsxs(Grid, {
82
+ container: true,
83
+ alignItems: "center",
84
+ children: [!!startAction && /*#__PURE__*/_jsx(Grid, {
85
+ item: true,
86
+ className: styles.startAction,
87
+ children: startAction
88
+ }), /*#__PURE__*/_jsx(Grid, {
89
+ item: true,
90
+ xs: true,
91
+ zeroMinWidth: true,
92
+ children: /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
93
+ variant: "h3",
94
+ noWrap: true
95
+ }, titleTypographyProps), {}, {
96
+ children: title
97
+ }))
98
+ }), !!endAction && /*#__PURE__*/_jsx(Grid, {
99
+ item: true,
100
+ className: styles.endAction,
101
+ children: endAction
102
+ })]
103
+ })
104
+ }), /*#__PURE__*/_jsx(Grid, {
84
105
  item: true,
85
- xs: true,
86
- zeroMinWidth: true,
87
- children: [/*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
88
- variant: "h3",
89
- noWrap: true
90
- }, titleTypographyProps), {}, {
91
- children: title
92
- })), !!subtitle && /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
106
+ children: !!subtitle && /*#__PURE__*/_jsx(Typography, _objectSpread(_objectSpread({
93
107
  variant: "body2",
94
108
  noWrap: true
95
109
  }, subtitleTypographyProps), {}, {
96
110
  children: subtitle
97
- }))]
98
- }), !!endAction && /*#__PURE__*/_jsx(Grid, {
99
- item: true,
100
- className: styles.endAction,
101
- children: endAction
111
+ }))
102
112
  })]
103
113
  })
104
114
  })
@@ -1,7 +1,8 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["value", "inputRef", "onChange", "valueIsNumericString", "thousandSeparator", "disableValueParsing"],
4
- _excluded2 = ["id", "InputProps"];
4
+ _excluded2 = ["value", "inputRef", "onChange", "valueIsNumericString", "thousandSeparator", "disableValueParsing"],
5
+ _excluded3 = ["id", "InputProps", "isText"];
5
6
  import { TextField } from '@material-ui/core';
6
7
  import { forwardRef } from 'react';
7
8
  import { NumericFormat } from 'react-number-format';
@@ -37,18 +38,49 @@ function NumberInputComponent(_ref) {
37
38
  }
38
39
  }));
39
40
  }
40
- export var NumberField = /*#__PURE__*/forwardRef((_ref2, ref) => {
41
+ function TextInputComponent(_ref2) {
41
42
  var {
42
- id,
43
- InputProps
43
+ value,
44
+ inputRef,
45
+ onChange,
46
+ valueIsNumericString = true,
47
+ thousandSeparator = true,
48
+ disableValueParsing
44
49
  } = _ref2,
45
50
  props = _objectWithoutProperties(_ref2, _excluded2);
51
+ return /*#__PURE__*/_jsx(NumericFormat, _objectSpread(_objectSpread({}, props), {}, {
52
+ value: value !== null && value !== void 0 ? value : '',
53
+ inputMode: "decimal",
54
+ getInputRef: inputRef,
55
+ valueIsNumericString: valueIsNumericString,
56
+ thousandSeparator: thousandSeparator,
57
+ allowedDecimalSeparators: ['.', ','],
58
+ onValueChange: (values, sourceInfo) => {
59
+ var {
60
+ event
61
+ } = sourceInfo;
62
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
63
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, event), {}, {
64
+ target: _objectSpread(_objectSpread({}, event === null || event === void 0 ? void 0 : event.target), {}, {
65
+ value: values.value
66
+ })
67
+ }));
68
+ }
69
+ }));
70
+ }
71
+ export var NumberField = /*#__PURE__*/forwardRef((_ref3, ref) => {
72
+ var {
73
+ id,
74
+ InputProps,
75
+ isText = false
76
+ } = _ref3,
77
+ props = _objectWithoutProperties(_ref3, _excluded3);
46
78
  var uid = useUID(id);
47
79
  return /*#__PURE__*/_jsx(TextField, _objectSpread(_objectSpread({}, props), {}, {
48
80
  ref: ref,
49
81
  id: uid,
50
82
  InputProps: _objectSpread(_objectSpread({}, InputProps), {}, {
51
- inputComponent: NumberInputComponent
83
+ inputComponent: isText ? TextInputComponent : NumberInputComponent
52
84
  })
53
85
  }));
54
86
  });
@@ -253,6 +253,7 @@ interface NumberFormatCustomProps extends Omit<SafeNumberFormatProps, 'getInputR
253
253
  interface NumberFieldProps extends Omit<StandardTextFieldProps, 'InputProps' | 'inputProps'>, Omit<SafeNumberFormatProps, keyof StandardTextFieldProps> {
254
254
  InputProps?: Partial<Omit<InputProps, 'inputComponent'>>;
255
255
  inputProps?: NumberFormatCustomProps & StandardTextFieldProps['inputProps'];
256
+ isText?: boolean;
256
257
  }
257
258
  declare const NumberField: ForwardRefExoticComponent<NumberFieldProps>;
258
259
 
package/dist-web/index.js CHANGED
@@ -1461,30 +1461,40 @@ var DrawerTitle = /*#__PURE__*/forwardRef((_ref, appBarRef) => {
1461
1461
  className: styles.toolbar,
1462
1462
  children: /*#__PURE__*/jsxs(Grid, {
1463
1463
  container: true,
1464
- alignItems: "center",
1465
- children: [!!startAction && /*#__PURE__*/jsx(Grid, {
1464
+ direction: "column",
1465
+ children: [/*#__PURE__*/jsx(Grid, {
1466
1466
  item: true,
1467
- className: styles.startAction,
1468
- children: startAction
1469
- }), /*#__PURE__*/jsxs(Grid, {
1467
+ children: /*#__PURE__*/jsxs(Grid, {
1468
+ container: true,
1469
+ alignItems: "center",
1470
+ children: [!!startAction && /*#__PURE__*/jsx(Grid, {
1471
+ item: true,
1472
+ className: styles.startAction,
1473
+ children: startAction
1474
+ }), /*#__PURE__*/jsx(Grid, {
1475
+ item: true,
1476
+ xs: true,
1477
+ zeroMinWidth: true,
1478
+ children: /*#__PURE__*/jsx(Typography, _objectSpread(_objectSpread({
1479
+ variant: "h3",
1480
+ noWrap: true
1481
+ }, titleTypographyProps), {}, {
1482
+ children: title
1483
+ }))
1484
+ }), !!endAction && /*#__PURE__*/jsx(Grid, {
1485
+ item: true,
1486
+ className: styles.endAction,
1487
+ children: endAction
1488
+ })]
1489
+ })
1490
+ }), /*#__PURE__*/jsx(Grid, {
1470
1491
  item: true,
1471
- xs: true,
1472
- zeroMinWidth: true,
1473
- children: [/*#__PURE__*/jsx(Typography, _objectSpread(_objectSpread({
1474
- variant: "h3",
1475
- noWrap: true
1476
- }, titleTypographyProps), {}, {
1477
- children: title
1478
- })), !!subtitle && /*#__PURE__*/jsx(Typography, _objectSpread(_objectSpread({
1492
+ children: !!subtitle && /*#__PURE__*/jsx(Typography, _objectSpread(_objectSpread({
1479
1493
  variant: "body2",
1480
1494
  noWrap: true
1481
1495
  }, subtitleTypographyProps), {}, {
1482
1496
  children: subtitle
1483
- }))]
1484
- }), !!endAction && /*#__PURE__*/jsx(Grid, {
1485
- item: true,
1486
- className: styles.endAction,
1487
- children: endAction
1497
+ }))
1488
1498
  })]
1489
1499
  })
1490
1500
  })
@@ -1704,7 +1714,8 @@ var Inline = /*#__PURE__*/forwardRef((_ref2, ref) => {
1704
1714
  if (process.env.NODE_ENV !== "production") Inline.displayName = "Inline";
1705
1715
 
1706
1716
  var _excluded$i = ["value", "inputRef", "onChange", "valueIsNumericString", "thousandSeparator", "disableValueParsing"],
1707
- _excluded2$3 = ["id", "InputProps"];
1717
+ _excluded2$3 = ["value", "inputRef", "onChange", "valueIsNumericString", "thousandSeparator", "disableValueParsing"],
1718
+ _excluded3 = ["id", "InputProps", "isText"];
1708
1719
  function NumberInputComponent(_ref) {
1709
1720
  var {
1710
1721
  value,
@@ -1735,18 +1746,49 @@ function NumberInputComponent(_ref) {
1735
1746
  }
1736
1747
  }));
1737
1748
  }
1738
- var NumberField = /*#__PURE__*/forwardRef((_ref2, ref) => {
1749
+ function TextInputComponent(_ref2) {
1739
1750
  var {
1740
- id,
1741
- InputProps
1751
+ value,
1752
+ inputRef,
1753
+ onChange,
1754
+ valueIsNumericString = true,
1755
+ thousandSeparator = true,
1756
+ disableValueParsing
1742
1757
  } = _ref2,
1743
1758
  props = _objectWithoutProperties(_ref2, _excluded2$3);
1759
+ return /*#__PURE__*/jsx(NumericFormat, _objectSpread(_objectSpread({}, props), {}, {
1760
+ value: value !== null && value !== void 0 ? value : '',
1761
+ inputMode: "decimal",
1762
+ getInputRef: inputRef,
1763
+ valueIsNumericString: valueIsNumericString,
1764
+ thousandSeparator: thousandSeparator,
1765
+ allowedDecimalSeparators: ['.', ','],
1766
+ onValueChange: (values, sourceInfo) => {
1767
+ var {
1768
+ event
1769
+ } = sourceInfo;
1770
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
1771
+ onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, event), {}, {
1772
+ target: _objectSpread(_objectSpread({}, event === null || event === void 0 ? void 0 : event.target), {}, {
1773
+ value: values.value
1774
+ })
1775
+ }));
1776
+ }
1777
+ }));
1778
+ }
1779
+ var NumberField = /*#__PURE__*/forwardRef((_ref3, ref) => {
1780
+ var {
1781
+ id,
1782
+ InputProps,
1783
+ isText = false
1784
+ } = _ref3,
1785
+ props = _objectWithoutProperties(_ref3, _excluded3);
1744
1786
  var uid = useUID(id);
1745
1787
  return /*#__PURE__*/jsx(TextField, _objectSpread(_objectSpread({}, props), {}, {
1746
1788
  ref: ref,
1747
1789
  id: uid,
1748
1790
  InputProps: _objectSpread(_objectSpread({}, InputProps), {}, {
1749
- inputComponent: NumberInputComponent
1791
+ inputComponent: isText ? TextInputComponent : NumberInputComponent
1750
1792
  })
1751
1793
  }));
1752
1794
  });