@superdispatch/ui 0.25.2 → 0.26.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.
Files changed (55) hide show
  1. package/dist-node/index.js +273 -391
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/adaptive-toolbar/AdaptiveToolbar.js +6 -15
  4. package/dist-src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +3 -10
  5. package/dist-src/autocomplete/AutocompleteOverrides.js +2 -1
  6. package/dist-src/avatar-button/AvatarButton.js +28 -31
  7. package/dist-src/button/Button.js +9 -12
  8. package/dist-src/button/ButtonOverrides.js +0 -6
  9. package/dist-src/card-button/CardButton.js +12 -15
  10. package/dist-src/checkbox/CheckboxField.js +10 -12
  11. package/dist-src/checkbox/CheckboxGroudField.js +9 -11
  12. package/dist-src/checkbox/CheckboxOverrides.js +1 -2
  13. package/dist-src/columns/Column.js +0 -13
  14. package/dist-src/columns/Columns.js +0 -2
  15. package/dist-src/description-list/DescriptionList.js +10 -12
  16. package/dist-src/drawer/DrawerActions.js +5 -8
  17. package/dist-src/drawer/DrawerContent.js +3 -4
  18. package/dist-src/drawer/DrawerList.js +3 -6
  19. package/dist-src/drawer/DrawerTitle.js +10 -13
  20. package/dist-src/dropdown-button/DropdownButton.js +9 -21
  21. package/dist-src/grid/GridStack.js +4 -6
  22. package/dist-src/grid/InlineGrid.js +6 -8
  23. package/dist-src/info-card/InfoCard.js +17 -19
  24. package/dist-src/info-tooltip/InfoTooltip.js +11 -14
  25. package/dist-src/inline/Inline.js +0 -2
  26. package/dist-src/link/LinkOverrides.js +0 -2
  27. package/dist-src/number-field/NumberField.js +17 -23
  28. package/dist-src/overflow-text/OverflowText.js +13 -15
  29. package/dist-src/pagination/PaginationOverrides.js +2 -1
  30. package/dist-src/pattern-field/PatternField.js +10 -10
  31. package/dist-src/props/AlignProps.js +0 -2
  32. package/dist-src/props/ResponsiveProp.js +0 -1
  33. package/dist-src/props/SpaceProp.js +0 -7
  34. package/dist-src/radio/RadioField.js +10 -12
  35. package/dist-src/radio/RadioFieldCard.js +11 -13
  36. package/dist-src/radio/RadioGroupField.js +12 -14
  37. package/dist-src/radio/RadioOverrides.js +1 -2
  38. package/dist-src/responsive/CollapseBreakpoint.js +0 -2
  39. package/dist-src/responsive/MinBreakpoint.js +0 -2
  40. package/dist-src/responsive/ResponsiveContext.js +0 -2
  41. package/dist-src/snackbar/Snackbar.js +10 -14
  42. package/dist-src/snackbar/SnackbarContent.js +19 -23
  43. package/dist-src/snackbar/SnackbarStack.js +13 -20
  44. package/dist-src/stack/Stack.js +0 -2
  45. package/dist-src/tag/Tag.js +10 -11
  46. package/dist-src/theme/Color.js +0 -2
  47. package/dist-src/theme/ThemeProvider.js +1 -12
  48. package/dist-src/tiles/Tiles.js +0 -3
  49. package/dist-src/utils/ResizeObserver.js +0 -1
  50. package/dist-src/utils/VisibilityObserver.js +4 -6
  51. package/dist-src/utils/mergeRefs.js +0 -1
  52. package/dist-src/utils/renderChildren.js +2 -2
  53. package/dist-web/index.js +272 -392
  54. package/dist-web/index.js.map +1 -1
  55. package/package.json +2 -2
@@ -5,32 +5,28 @@ import { Portal, Slide, Snackbar as MaterialSnackbar } from '@material-ui/core';
5
5
  import { forwardRef } from 'react';
6
6
  import { SnackbarContent } from "./SnackbarContent.js";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
-
9
8
  function SlideTransition(props) {
10
9
  return /*#__PURE__*/_jsx(Slide, _objectSpread(_objectSpread({}, props), {}, {
11
10
  direction: "up"
12
11
  }));
13
12
  }
14
-
15
13
  export var Snackbar = /*#__PURE__*/forwardRef((_ref, ref) => {
16
14
  var {
17
- open,
18
- action,
19
- variant,
20
- onClose,
21
- children,
22
- ContentProps,
23
- hasCloseButton = onClose != null,
24
- TransitionComponent = SlideTransition
25
- } = _ref,
26
- props = _objectWithoutProperties(_ref, _excluded);
27
-
15
+ open,
16
+ action,
17
+ variant,
18
+ onClose,
19
+ children,
20
+ ContentProps,
21
+ hasCloseButton = onClose != null,
22
+ TransitionComponent = SlideTransition
23
+ } = _ref,
24
+ props = _objectWithoutProperties(_ref, _excluded);
28
25
  function handleClose(reason) {
29
26
  if (reason !== 'clickaway') {
30
27
  onClose === null || onClose === void 0 ? void 0 : onClose(reason === 'timeout' ? 'timeout' : 'explicit');
31
28
  }
32
29
  }
33
-
34
30
  return /*#__PURE__*/_jsx(Portal, {
35
31
  children: /*#__PURE__*/_jsx(MaterialSnackbar, _objectSpread(_objectSpread({}, props), {}, {
36
32
  ref: ref,
@@ -1,7 +1,7 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["action", "children", "onClose", "className", "classes", "variant"],
4
- _excluded2 = ["icon", "closeButton", "variantError", "variantSuccess"];
4
+ _excluded2 = ["icon", "closeButton", "variantError", "variantSuccess"];
5
5
  import { Grid, IconButton, SnackbarContent as MuiSnackbarContent } from '@material-ui/core';
6
6
  import { CheckCircle, Close, Error } from '@material-ui/icons';
7
7
  import { makeStyles } from '@material-ui/styles';
@@ -9,9 +9,7 @@ import clsx from 'clsx';
9
9
  import { forwardRef } from 'react';
10
10
  import styled from 'styled-components';
11
11
  import { Color } from "../theme/Color.js";
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { Fragment as _Fragment } from "react/jsx-runtime";
14
- import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
13
  var PaddedContent = /*#__PURE__*/styled.span.withConfig({
16
14
  displayName: "SnackbarContent__PaddedContent",
17
15
  componentId: "SD__sc-1jca4d5-0"
@@ -61,26 +59,24 @@ var useStyles = /*#__PURE__*/makeStyles(theme => ({
61
59
  });
62
60
  export var SnackbarContent = /*#__PURE__*/forwardRef((_ref, ref) => {
63
61
  var {
64
- action,
65
- children,
66
- onClose,
67
- className,
68
- classes,
69
- variant = 'default'
70
- } = _ref,
71
- props = _objectWithoutProperties(_ref, _excluded);
72
-
62
+ action,
63
+ children,
64
+ onClose,
65
+ className,
66
+ classes,
67
+ variant = 'default'
68
+ } = _ref,
69
+ props = _objectWithoutProperties(_ref, _excluded);
73
70
  var _useStyles = useStyles({
74
- classes
75
- }),
76
- {
77
- icon,
78
- closeButton,
79
- variantError,
80
- variantSuccess
81
- } = _useStyles,
82
- styles = _objectWithoutProperties(_useStyles, _excluded2);
83
-
71
+ classes
72
+ }),
73
+ {
74
+ icon,
75
+ closeButton,
76
+ variantError,
77
+ variantSuccess
78
+ } = _useStyles,
79
+ styles = _objectWithoutProperties(_useStyles, _excluded2);
84
80
  var Icon = variant === 'error' ? Error : variant === 'success' ? CheckCircle : undefined;
85
81
  return /*#__PURE__*/_jsx(MuiSnackbarContent, _objectSpread(_objectSpread({}, props), {}, {
86
82
  ref: ref,
@@ -4,14 +4,11 @@ var _excluded = ["onClose", "variant", "key", "id", "autoHideDuration"];
4
4
  import { useDeepEqualMemo } from '@superdispatch/hooks';
5
5
  import { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';
6
6
  import { Snackbar } from "./Snackbar.js";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
-
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
8
  function warnContext() {
11
9
  // eslint-disable-next-line no-console
12
10
  console.log('`useSnackbarStack` is used outside of `SnackbarStackProvider`.');
13
11
  }
14
-
15
12
  var Context = /*#__PURE__*/createContext({
16
13
  clearStack: warnContext,
17
14
  addSnackbar: () => {
@@ -43,16 +40,16 @@ export function SnackbarStackProvider(_ref2) {
43
40
  }, []);
44
41
  var addSnackbar = useCallback(function (message) {
45
42
  var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
46
- {
47
- onClose: _onClose,
48
- variant,
49
- key = variant !== 'error' ? // We don't want non error snackbars without key to pop back.
50
- getNextTransientKey() : typeof message === 'string' ? message : Math.random(),
51
- id = String(key),
52
- autoHideDuration = 5000
53
- } = _ref3,
54
- props = _objectWithoutProperties(_ref3, _excluded);
55
-
43
+ {
44
+ onClose: _onClose,
45
+ variant,
46
+ key = variant !== 'error' ?
47
+ // We don't want non error snackbars without key to pop back.
48
+ getNextTransientKey() : typeof message === 'string' ? message : Math.random(),
49
+ id = String(key),
50
+ autoHideDuration = 5000
51
+ } = _ref3,
52
+ props = _objectWithoutProperties(_ref3, _excluded);
56
53
  function removeSnackbar() {
57
54
  setStack(prev => {
58
55
  if (prev.has(key)) {
@@ -60,26 +57,22 @@ export function SnackbarStackProvider(_ref2) {
60
57
  next.delete(key);
61
58
  return next;
62
59
  }
63
-
64
60
  return prev;
65
61
  });
66
62
  }
67
-
68
63
  setStack(prev => {
69
64
  var next = new Map(prev);
70
-
71
65
  for (var prevKey of prev.keys()) {
72
66
  // Ensure that we insert value to the end of the map.
73
67
  if (Object.is(key, prevKey)) {
74
68
  next.delete(key);
75
- } // Ensure that transient snackbar will not pop back.
76
-
69
+ }
77
70
 
71
+ // Ensure that transient snackbar will not pop back.
78
72
  if (typeof prevKey == 'string' && prevKey.startsWith(TRANSIENT_KEY)) {
79
73
  next.delete(prevKey);
80
74
  }
81
75
  }
82
-
83
76
  return next.set(key, _objectSpread(_objectSpread({}, props), {}, {
84
77
  id,
85
78
  key,
@@ -5,11 +5,9 @@ import { parseAlignProp } from "../props/AlignProps.js";
5
5
  import { parseResponsiveProp } from "../props/ResponsiveProp.js";
6
6
  import { parseSpaceProp } from "../props/SpaceProp.js";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
-
9
8
  function stackItemMixin(space, align) {
10
9
  return css(["flex-direction:column;align-items:", ";display:", ";&:empty{display:none;}&:not(:empty) ~ div{padding-top:", "px;}"], parseAlignProp(align), align === 'left' ? 'block' : 'flex', parseSpaceProp(space));
11
10
  }
12
-
13
11
  var StackRoot = /*#__PURE__*/styled.div.withConfig({
14
12
  displayName: "Stack__StackRoot",
15
13
  componentId: "SD__sc-qkml7c-0"
@@ -81,17 +81,16 @@ var useStyles = /*#__PURE__*/makeStyles(theme => ({
81
81
  });
82
82
  export var Tag = /*#__PURE__*/forwardRef((_ref, ref) => {
83
83
  var {
84
- color,
85
- variant,
86
- children,
87
- classes,
88
- className,
89
- noWrap = true,
90
- fontWeight = 'bold',
91
- component = 'div'
92
- } = _ref,
93
- props = _objectWithoutProperties(_ref, _excluded);
94
-
84
+ color,
85
+ variant,
86
+ children,
87
+ classes,
88
+ className,
89
+ noWrap = true,
90
+ fontWeight = 'bold',
91
+ component = 'div'
92
+ } = _ref,
93
+ props = _objectWithoutProperties(_ref, _excluded);
95
94
  var styles = useStyles({
96
95
  classes
97
96
  });
@@ -1,5 +1,4 @@
1
1
  export var Color;
2
-
3
2
  (function (Color) {
4
3
  Color["White"] = "#fff";
5
4
  Color["White50"] = "rgba(255, 255, 255, 0.5)";
@@ -79,7 +78,6 @@ export var Color;
79
78
  Color["Yellow300"] = "#E8671C";
80
79
  Color["Yellow500"] = "#B84807";
81
80
  })(Color || (Color = {}));
82
-
83
81
  export function isColorProp(name) {
84
82
  return typeof name == 'string' && Object.prototype.hasOwnProperty.call(Color, name);
85
83
  }
@@ -31,9 +31,7 @@ import { overrideToolbar } from "../toolbar/ToolbarOverrides.js";
31
31
  import { overrideTooltip } from "../tooltip/TooltipOverrides.js";
32
32
  import { createTypographyOptions, overrideTypography } from "../typography/TypographyOverrides.js";
33
33
  import { Color } from "./Color.js";
34
- import { jsx as _jsx } from "react/jsx-runtime";
35
- import { jsxs as _jsxs } from "react/jsx-runtime";
36
-
34
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
37
35
  function createSuperDispatchTheme() {
38
36
  var breakpoints = createBreakpoints({});
39
37
  var theme = createTheme({
@@ -89,40 +87,31 @@ function createSuperDispatchTheme() {
89
87
  overridePreloader(theme);
90
88
  return theme;
91
89
  }
92
-
93
90
  var generateMaterialClassName = /*#__PURE__*/createGenerateClassName();
94
-
95
91
  function generateClassName(rule, sheet) {
96
92
  var {
97
93
  meta,
98
94
  link
99
95
  } = (sheet === null || sheet === void 0 ? void 0 : sheet.options) || {};
100
-
101
96
  if (meta && rule.type === 'style') {
102
97
  if (meta.startsWith('MuiSnackbar') && sheet) {
103
98
  return "SDSnackbar-".concat(rule.key);
104
99
  }
105
-
106
100
  if (meta.startsWith('SD-')) {
107
101
  return "".concat(meta, "-").concat(rule.key);
108
102
  }
109
-
110
103
  if (meta.startsWith('Mui')) {
111
104
  var isPseudoClass = ['checked', 'disabled', 'error', 'focused', 'focusVisible', 'required', 'expanded', 'selected'].includes(rule.key);
112
-
113
105
  if (isPseudoClass) {
114
106
  return "Mui-".concat(rule.key);
115
107
  }
116
-
117
108
  if (!link) {
118
109
  return "".concat(meta, "-").concat(rule.key);
119
110
  }
120
111
  }
121
112
  }
122
-
123
113
  return generateMaterialClassName(rule, sheet);
124
114
  }
125
-
126
115
  export function ThemeProvider(_ref) {
127
116
  var {
128
117
  modifier,
@@ -5,7 +5,6 @@ import flattenChildren from 'react-keyed-flatten-children';
5
5
  import { useResponsivePropRecord } from "../props/ResponsiveProp.js";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  var PREVENT_COLLAPSE = 1;
8
-
9
8
  function spaceVariant(theme, space) {
10
9
  var gap = theme.spacing(space);
11
10
  return {
@@ -21,13 +20,11 @@ function spaceVariant(theme, space) {
21
20
  }
22
21
  };
23
22
  }
24
-
25
23
  function columnVariant(columns) {
26
24
  return {
27
25
  flex: "0 0 ".concat(100 / columns, "%")
28
26
  };
29
27
  }
30
-
31
28
  var useStyles = /*#__PURE__*/makeStyles(theme => ({
32
29
  root: {
33
30
  paddingTop: PREVENT_COLLAPSE,
@@ -7,7 +7,6 @@ export function useResizeObserver(node, observer) {
7
7
  if (!node) {
8
8
  return;
9
9
  }
10
-
11
10
  var resizeObserver = new ResizeObserver(() => {
12
11
  handler(node);
13
12
  });
@@ -18,7 +18,6 @@ export function useVisibilityObserver(node) {
18
18
  setState('undetermined');
19
19
  return;
20
20
  }
21
-
22
21
  var observer = new IntersectionObserver(_ref => {
23
22
  var [entry] = _ref;
24
23
  setState(entry !== null && entry !== void 0 && entry.isIntersecting && document.visibilityState === 'visible' ? 'visible' : 'invisible');
@@ -35,11 +34,10 @@ export function useVisibilityObserver(node) {
35
34
  }
36
35
  export function VisibilityObserver(_ref2) {
37
36
  var {
38
- render,
39
- onChange
40
- } = _ref2,
41
- options = _objectWithoutProperties(_ref2, _excluded);
42
-
37
+ render,
38
+ onChange
39
+ } = _ref2,
40
+ options = _objectWithoutProperties(_ref2, _excluded);
43
41
  var [node, setNode] = useState(null);
44
42
  var visibility = useVisibilityObserver(node, options);
45
43
  var children = render({
@@ -2,7 +2,6 @@ export function mergeRefs() {
2
2
  for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
3
3
  refs[_key] = arguments[_key];
4
4
  }
5
-
6
5
  return node => {
7
6
  refs.forEach(ref => {
8
7
  assignRef(ref, node);
@@ -1,8 +1,8 @@
1
1
  export function renderChildren(node) {
2
2
  if (node == null || typeof node == 'boolean') {
3
3
  return null;
4
- } // Workaround for https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
5
-
4
+ }
6
5
 
6
+ // Workaround for https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
7
7
  return node;
8
8
  }