@superdispatch/ui 0.13.0 → 0.16.0-alpha.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 (76) hide show
  1. package/dist-node/index.js +4051 -508
  2. package/dist-node/index.js.map +1 -1
  3. package/dist-src/dialog/DialogOverrides.js +8 -0
  4. package/dist-src/index.js +3 -1
  5. package/dist-src/info-card/InfoCard.js +1 -11
  6. package/dist-src/utils/mergeRefs.js +10 -7
  7. package/dist-src/v5/adaptive-toolbar/AdaptiveToolbar.js +146 -0
  8. package/dist-src/v5/app-bar/AppBarOverrides.js +9 -0
  9. package/dist-src/v5/autocomplete/AutocompleteOverrides.js +63 -0
  10. package/dist-src/v5/avatar/AvatarOverrides.js +21 -0
  11. package/dist-src/v5/avatar-button/AvatarButton.js +146 -0
  12. package/dist-src/v5/button/Button.js +32 -0
  13. package/dist-src/v5/button/ButtonOverrides.js +238 -0
  14. package/dist-src/v5/card/CardOverrides.js +16 -0
  15. package/dist-src/v5/card-button/CardButton.js +135 -0
  16. package/dist-src/v5/checkbox/CheckboxField.js +37 -0
  17. package/dist-src/v5/checkbox/CheckboxGroudField.js +32 -0
  18. package/dist-src/v5/checkbox/CheckboxOverrides.js +71 -0
  19. package/dist-src/v5/chip/ChipOverrides.js +106 -0
  20. package/dist-src/v5/columns/Column.js +75 -0
  21. package/dist-src/v5/columns/Columns.js +28 -0
  22. package/dist-src/v5/description-list/DescriptionList.js +114 -0
  23. package/dist-src/v5/dialog/DialogOverrides.js +43 -0
  24. package/dist-src/v5/drawer/DrawerActions.js +69 -0
  25. package/dist-src/v5/drawer/DrawerContent.js +15 -0
  26. package/dist-src/v5/drawer/DrawerList.js +31 -0
  27. package/dist-src/v5/drawer/DrawerOverrides.js +17 -0
  28. package/dist-src/v5/drawer/DrawerTitle.js +119 -0
  29. package/dist-src/v5/grid/GridStack.js +33 -0
  30. package/dist-src/v5/grid/InlineGrid.js +34 -0
  31. package/dist-src/v5/icon-button/IconButtonOverrides.js +60 -0
  32. package/dist-src/v5/index.js +38 -0
  33. package/dist-src/v5/info-card/InfoCard.js +59 -0
  34. package/dist-src/v5/inline/Inline.js +56 -0
  35. package/dist-src/v5/link/LinkOverrides.js +46 -0
  36. package/dist-src/v5/list/ListOverrides.js +16 -0
  37. package/dist-src/v5/menu/MenuOverrides.js +34 -0
  38. package/dist-src/v5/overflow-text/OverflowText.js +84 -0
  39. package/dist-src/v5/pagination/PaginationOverrides.js +35 -0
  40. package/dist-src/v5/paper/PaperOverrides.js +13 -0
  41. package/dist-src/v5/props/AlignProps.js +15 -0
  42. package/dist-src/v5/props/CollapseProp.js +3 -0
  43. package/dist-src/v5/props/ResponsiveProp.js +42 -0
  44. package/dist-src/v5/props/SpaceProp.js +28 -0
  45. package/dist-src/v5/radio/RadioField.js +36 -0
  46. package/dist-src/v5/radio/RadioGroupField.js +38 -0
  47. package/dist-src/v5/radio/RadioOverrides.js +49 -0
  48. package/dist-src/v5/responsive/CollapseBreakpoint.js +15 -0
  49. package/dist-src/v5/responsive/ResponsiveContext.js +31 -0
  50. package/dist-src/v5/snackbar/Snackbar.js +53 -0
  51. package/dist-src/v5/snackbar/SnackbarContent.js +105 -0
  52. package/dist-src/v5/snackbar/SnackbarOverrides.js +35 -0
  53. package/dist-src/v5/snackbar/SnackbarStack.js +113 -0
  54. package/dist-src/v5/stack/Stack.js +43 -0
  55. package/dist-src/v5/svg-icon/SvgIconOverrides.js +33 -0
  56. package/dist-src/v5/switch/SwitchOverrides.js +88 -0
  57. package/dist-src/v5/tabs/TabsOverrides.js +45 -0
  58. package/dist-src/v5/tag/Tag.js +118 -0
  59. package/dist-src/v5/text-field/TextFieldOverrides.js +205 -0
  60. package/dist-src/v5/theme/Color.js +77 -0
  61. package/dist-src/v5/theme/CssBaselineOverrides.js +8 -0
  62. package/dist-src/v5/theme/SuperDispatchTheme.js +2 -0
  63. package/dist-src/v5/theme/ThemeProvider.js +142 -0
  64. package/dist-src/v5/tiles/Tiles.js +94 -0
  65. package/dist-src/v5/toolbar/ToolbarOverrides.js +15 -0
  66. package/dist-src/v5/tooltip/TooltipOverrides.js +42 -0
  67. package/dist-src/v5/typography/TypographyOverrides.js +121 -0
  68. package/dist-src/v5/utils/VisibilityObserver.js +53 -0
  69. package/dist-src/v5/utils/isEmptyReactNode.js +3 -0
  70. package/dist-src/v5/utils/mergeRefs.js +20 -0
  71. package/dist-src/v5/utils/renderChildren.js +8 -0
  72. package/dist-src/v5/utils/useUID.js +6 -0
  73. package/dist-types/index.d.ts +643 -37
  74. package/dist-web/index.js +4214 -673
  75. package/dist-web/index.js.map +1 -1
  76. package/package.json +9 -3
@@ -0,0 +1,121 @@
1
+ import '@mui/material';
2
+
3
+ function createCSSVarName(component, property) {
4
+ return "--mui-".concat(component, "-").concat(property);
5
+ }
6
+
7
+ export var typographyVars = {
8
+ color: /*#__PURE__*/createCSSVarName('typography', 'color'),
9
+ backgroundImage: /*#__PURE__*/createCSSVarName('typography', 'backgroundImage')
10
+ };
11
+ export function createTypographyOptions(breakpoints) {
12
+ var xsOnly = breakpoints.only('xs');
13
+ return {
14
+ fontSize: 14,
15
+ fontWeightLight: 300,
16
+ fontWeightRegular: 400,
17
+ fontWeightMedium: 500,
18
+ fontWeightBold: 600,
19
+ fontFamily: '"Inter", sans-serif',
20
+ h1: {
21
+ fontSize: '32px',
22
+ lineHeight: '40px',
23
+ fontWeight: 700,
24
+ [xsOnly]: {
25
+ fontSize: '28px',
26
+ lineHeight: '36px'
27
+ }
28
+ },
29
+ h2: {
30
+ fontSize: '24px',
31
+ lineHeight: '28px',
32
+ fontWeight: 500,
33
+ [xsOnly]: {
34
+ fontSize: '22px',
35
+ lineHeight: '26px'
36
+ }
37
+ },
38
+ h3: {
39
+ fontSize: '20px',
40
+ lineHeight: '28px',
41
+ fontWeight: 500,
42
+ [xsOnly]: {
43
+ fontSize: '20px',
44
+ lineHeight: '26px'
45
+ }
46
+ },
47
+ h4: {
48
+ fontSize: '16px',
49
+ lineHeight: '24px',
50
+ fontWeight: 500,
51
+ [xsOnly]: {
52
+ fontSize: '17px',
53
+ lineHeight: '26px'
54
+ }
55
+ },
56
+ h5: {
57
+ fontSize: '14px',
58
+ lineHeight: '20px',
59
+ fontWeight: 600,
60
+ [xsOnly]: {
61
+ fontSize: '16px',
62
+ lineHeight: '24px'
63
+ }
64
+ },
65
+ h6: {
66
+ fontSize: '12px',
67
+ lineHeight: '16px',
68
+ fontWeight: 700,
69
+ letterSpacing: '0.1em',
70
+ textTransform: 'uppercase',
71
+ [xsOnly]: {
72
+ fontSize: '14px',
73
+ lineHeight: '20px'
74
+ }
75
+ },
76
+ body1: {
77
+ fontSize: '14px',
78
+ lineHeight: '20px',
79
+ fontWeight: 600,
80
+ [xsOnly]: {
81
+ fontSize: '16px',
82
+ lineHeight: '24px'
83
+ }
84
+ },
85
+ body2: {
86
+ fontSize: '14px',
87
+ lineHeight: '20px',
88
+ fontWeight: 400,
89
+ [xsOnly]: {
90
+ fontSize: '16px',
91
+ lineHeight: '24px'
92
+ }
93
+ },
94
+ caption: {
95
+ fontSize: '12px',
96
+ lineHeight: '16px',
97
+ fontWeight: 400,
98
+ [xsOnly]: {
99
+ fontSize: '14px',
100
+ lineHeight: '20px'
101
+ }
102
+ },
103
+ button: {
104
+ fontSize: '14px',
105
+ lineHeight: '20px',
106
+ fontWeight: 600,
107
+ textTransform: undefined,
108
+ [xsOnly]: {
109
+ fontSize: '16px',
110
+ lineHeight: '24px'
111
+ }
112
+ }
113
+ };
114
+ }
115
+ export function overrideTypography(theme) {
116
+ theme.components.MuiTypography = {
117
+ defaultProps: {
118
+ variant: 'body2'
119
+ }
120
+ };
121
+ }
@@ -0,0 +1,53 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ var _excluded = ["render", "onChange"];
3
+ import { useValueObserver } from '@superdispatch/hooks';
4
+ import { useLayoutEffect, useState } from 'react';
5
+ import { renderChildren } from "./renderChildren.js";
6
+ export function useVisibilityObserver(node) {
7
+ var {
8
+ threshold = 0,
9
+ marginTop = '0px',
10
+ marginLeft = '0px',
11
+ marginRight = '0px',
12
+ marginBottom = '0px'
13
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14
+ var [state, setState] = useState('undetermined');
15
+ var rootMargin = "".concat(marginTop, " ").concat(marginRight, " ").concat(marginBottom, " ").concat(marginLeft);
16
+ useLayoutEffect(() => {
17
+ if (!node || !('IntersectionObserver' in window)) {
18
+ setState('undetermined');
19
+ return;
20
+ }
21
+
22
+ var observer = new IntersectionObserver(_ref => {
23
+ var [entry] = _ref;
24
+ setState(entry !== null && entry !== void 0 && entry.isIntersecting ? 'visible' : 'invisible');
25
+ }, {
26
+ rootMargin,
27
+ threshold
28
+ });
29
+ observer.observe(node);
30
+ return () => {
31
+ observer.disconnect();
32
+ };
33
+ }, [node, threshold, rootMargin]);
34
+ return state;
35
+ }
36
+ export function VisibilityObserver(_ref2) {
37
+ var {
38
+ render,
39
+ onChange
40
+ } = _ref2,
41
+ options = _objectWithoutProperties(_ref2, _excluded);
42
+
43
+ var [node, setNode] = useState(null);
44
+ var visibility = useVisibilityObserver(node, options);
45
+ var children = render({
46
+ ref: setNode,
47
+ visibility
48
+ });
49
+ useValueObserver(visibility, () => {
50
+ onChange === null || onChange === void 0 ? void 0 : onChange(visibility);
51
+ });
52
+ return renderChildren(children);
53
+ }
@@ -0,0 +1,3 @@
1
+ export function isEmptyReactNode(node) {
2
+ return node == null || typeof node == 'boolean' || typeof node == 'string' && node.length === 0;
3
+ }
@@ -0,0 +1,20 @@
1
+ export function mergeRefs() {
2
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
3
+ refs[_key] = arguments[_key];
4
+ }
5
+
6
+ return node => {
7
+ refs.forEach(ref => {
8
+ assignRef(ref, node);
9
+ });
10
+ };
11
+ }
12
+ export function assignRef(ref, value) {
13
+ if (ref) {
14
+ if (typeof ref === 'function') {
15
+ ref(value);
16
+ } else {
17
+ ref.current = value;
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ export function renderChildren(node) {
2
+ if (node == null || typeof node == 'boolean') {
3
+ return null;
4
+ } // Workaround for https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
5
+
6
+
7
+ return node;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { useMemo } from 'react';
2
+ var current = 0;
3
+ export function useUID(defaultID) {
4
+ var uid = useMemo(() => "uid_".concat(current += 1), []);
5
+ return defaultID || uid;
6
+ }