@superdispatch/ui 0.21.8 → 0.21.13

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 (231) hide show
  1. package/.babelrc.js +5 -0
  2. package/.turbo/turbo-version.log +28 -0
  3. package/package.json +65 -39
  4. package/pkg/README.md +30 -0
  5. package/{dist-types → pkg/dist-types}/index.d.ts +364 -364
  6. package/pkg/package.json +39 -0
  7. package/playroom.ts +31 -0
  8. package/src/__tests__/index.spec.ts +134 -0
  9. package/src/adaptive-toolbar/AdaptiveToolbar.stories.tsx +50 -0
  10. package/src/adaptive-toolbar/AdaptiveToolbar.tsx +199 -0
  11. package/src/adaptive-toolbar/__tests__/AdaptiveToolbar.spec.tsx +11 -0
  12. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.stories.tsx +49 -0
  13. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.tsx +171 -0
  14. package/src/app-bar/AppBar.stories.tsx +62 -0
  15. package/src/app-bar/AppBarOverrides.ts +9 -0
  16. package/src/app-bar/__tests__/AppBar.spec.tsx +86 -0
  17. package/src/autocomplete/Autocomplete.stories.tsx +76 -0
  18. package/src/autocomplete/AutocompleteOverrides.tsx +58 -0
  19. package/src/autocomplete/__tests__/Autocomplete.spec.tsx +323 -0
  20. package/src/avatar/Avatar.stories.tsx +17 -0
  21. package/src/avatar/AvatarOverrides.ts +24 -0
  22. package/src/avatar/__tests__/Avatar.spec.tsx +71 -0
  23. package/src/avatar-button/AvatarButton.stories.tsx +153 -0
  24. package/src/avatar-button/AvatarButton.tsx +223 -0
  25. package/src/avatar-button/__tests__/AvatarButton.spec.tsx +126 -0
  26. package/src/button/Button.tsx +51 -0
  27. package/src/button/ButtonOverrides.ts +375 -0
  28. package/src/button/__tests__/Button.spec.tsx +599 -0
  29. package/src/card/Card.stories.tsx +39 -0
  30. package/src/card/CardOverrides.ts +9 -0
  31. package/src/card/__tests__/Card.spec.tsx +68 -0
  32. package/src/card-button/CardButton.stories.tsx +36 -0
  33. package/src/card-button/CardButton.tsx +202 -0
  34. package/src/card-button/__tests__/CardButton.spec.tsx +95 -0
  35. package/src/checkbox/CheckboxField.stories.tsx +61 -0
  36. package/src/checkbox/CheckboxField.tsx +56 -0
  37. package/src/checkbox/CheckboxGroudField.tsx +53 -0
  38. package/src/checkbox/CheckboxOverrides.tsx +55 -0
  39. package/src/checkbox/__tests__/Checkbox.spec.tsx +105 -0
  40. package/src/chip/Chip.stories.tsx +26 -0
  41. package/src/chip/ChipOverrides.tsx +111 -0
  42. package/src/chip/__tests__/Chip.spec.tsx +308 -0
  43. package/src/columns/Column.tsx +124 -0
  44. package/src/columns/Columns.stories.tsx +426 -0
  45. package/src/columns/Columns.tsx +76 -0
  46. package/src/description-list/DescriptionList.spec.tsx +137 -0
  47. package/src/description-list/DescriptionList.stories.tsx +148 -0
  48. package/src/description-list/DescriptionList.tsx +170 -0
  49. package/src/dialog/Dialog.playroom.tsx +24 -0
  50. package/src/dialog/Dialog.stories.tsx +60 -0
  51. package/src/dialog/DialogOverrides.ts +39 -0
  52. package/src/dialog/__tests__/Dialog.spec.tsx +219 -0
  53. package/src/drawer/Drawer.playroom.tsx +22 -0
  54. package/src/drawer/Drawer.stories.tsx +194 -0
  55. package/src/drawer/DrawerActions.tsx +69 -0
  56. package/src/drawer/DrawerContent.tsx +30 -0
  57. package/src/drawer/DrawerList.tsx +60 -0
  58. package/src/drawer/DrawerOverrides.ts +19 -0
  59. package/src/drawer/DrawerTitle.tsx +143 -0
  60. package/src/drawer/__tests__/Drawer.spec.tsx +227 -0
  61. package/src/dropdown-button/DropdownButton.stories.tsx +15 -0
  62. package/src/dropdown-button/DropdownButton.tsx +131 -0
  63. package/src/grid/GridStack.tsx +45 -0
  64. package/src/grid/InlineGrid.tsx +56 -0
  65. package/src/icon-button/IconButton.stories.tsx +53 -0
  66. package/src/icon-button/IconButtonOverrides.ts +32 -0
  67. package/src/icon-button/__tests__/IconButton.spec.tsx +124 -0
  68. package/src/index.ts +47 -0
  69. package/src/info-card/InfoCard.stories.tsx +29 -0
  70. package/src/info-card/InfoCard.tsx +95 -0
  71. package/src/info-card/__tests__/InfoCard.spec.tsx +22 -0
  72. package/src/info-tooltip/InfoTooltip.stories.tsx +77 -0
  73. package/src/info-tooltip/InfoTooltip.tsx +72 -0
  74. package/src/info-tooltip/__tests__/InfoTooltip.spec.tsx +166 -0
  75. package/src/inline/Inline.stories.tsx +135 -0
  76. package/src/inline/Inline.tsx +144 -0
  77. package/src/link/Link.stories.tsx +41 -0
  78. package/src/link/LinkOverrides.ts +43 -0
  79. package/src/link/__tests__/Link.spec.tsx +98 -0
  80. package/src/list/ListOverrides.ts +11 -0
  81. package/src/list/__tests__/List.spec.tsx +182 -0
  82. package/src/menu/Menu.stories.tsx +35 -0
  83. package/src/menu/MenuOverrides.ts +17 -0
  84. package/src/menu/__tests__/Menu.spec.tsx +99 -0
  85. package/src/number-field/NumberField.stories.tsx +123 -0
  86. package/src/number-field/NumberField.tsx +98 -0
  87. package/src/overflow-text/OverflowText.stories.tsx +32 -0
  88. package/src/overflow-text/OverflowText.tsx +114 -0
  89. package/src/overflow-text/__tests__/OverflowText.spec.tsx +24 -0
  90. package/src/pagination/Pagination.stories.tsx +36 -0
  91. package/src/pagination/PaginationOverrides.ts +47 -0
  92. package/src/pagination/__tests__/Pagination.spec.tsx +228 -0
  93. package/src/paper/PaperOverrides.ts +10 -0
  94. package/src/paper/__tests__/Paper.spec.tsx +155 -0
  95. package/src/props/AlignProps.ts +22 -0
  96. package/src/props/CollapseProp.ts +13 -0
  97. package/src/props/ResponsiveProp.ts +65 -0
  98. package/src/props/SpaceProp.ts +40 -0
  99. package/src/radio/RadioField.stories.tsx +42 -0
  100. package/src/radio/RadioField.tsx +55 -0
  101. package/src/radio/RadioGroupField.tsx +64 -0
  102. package/src/radio/RadioOverrides.tsx +51 -0
  103. package/src/radio/__tests__/Radio.spec.tsx +90 -0
  104. package/src/responsive/CollapseBreakpoint.ts +21 -0
  105. package/src/responsive/MinBreakpoint.ts +21 -0
  106. package/src/responsive/ResponsiveContext.tsx +57 -0
  107. package/src/snackbar/Snackbar.stories.tsx +196 -0
  108. package/src/snackbar/Snackbar.tsx +83 -0
  109. package/src/snackbar/SnackbarContent.tsx +147 -0
  110. package/src/snackbar/SnackbarOverrides.ts +23 -0
  111. package/src/snackbar/SnackbarStack.tsx +160 -0
  112. package/src/snackbar/__tests__/Snackbar.spec.tsx +196 -0
  113. package/src/stack/Stack.stories.tsx +113 -0
  114. package/src/stack/Stack.tsx +86 -0
  115. package/src/svg-icon/SvgIcon.stories.tsx +29 -0
  116. package/src/svg-icon/SvgIconOverrides.ts +32 -0
  117. package/src/svg-icon/__tests__/SvgIcon.spec.tsx +67 -0
  118. package/src/switch/Switch.stories.tsx +60 -0
  119. package/src/switch/SwitchOverrides.ts +88 -0
  120. package/src/switch/__tests__/Switch.spec.tsx +204 -0
  121. package/src/tabs/Tabs.stories.tsx +40 -0
  122. package/src/tabs/TabsOverrides.ts +45 -0
  123. package/src/tabs/__tests__/Tabs.spec.tsx +226 -0
  124. package/src/tag/Tag.stories.tsx +53 -0
  125. package/src/tag/Tag.tsx +130 -0
  126. package/src/tag/__tests__/Tag.spec.tsx +82 -0
  127. package/src/text-field/TextField.stories.tsx +50 -0
  128. package/src/text-field/TextFieldOverrides.tsx +149 -0
  129. package/src/text-field/__tests__/TextField.spec.tsx +662 -0
  130. package/src/theme/Color.ts +117 -0
  131. package/src/theme/SuperDispatchTheme.ts +3 -0
  132. package/src/theme/ThemeProvider.tsx +179 -0
  133. package/src/theme/__tests__/CssBaseline.spec.tsx +49 -0
  134. package/src/theme/__tests__/ThemeProvider.spec.ts +40 -0
  135. package/src/theme/__tests__/__snapshots__/ThemeProvider.spec.ts.snap +204 -0
  136. package/src/tiles/Tiles.stories.tsx +69 -0
  137. package/src/tiles/Tiles.tsx +163 -0
  138. package/src/tiles/__tests__/Tiles.spec.tsx +221 -0
  139. package/src/toolbar/ToolbarOverrides.ts +14 -0
  140. package/src/toolbar/__tests__/Toolbar.spec.tsx +50 -0
  141. package/src/tooltip/Tooltip.stories.tsx +32 -0
  142. package/src/tooltip/TooltipOverrides.ts +34 -0
  143. package/src/tooltip/__tests__/Tooltip.spec.tsx +182 -0
  144. package/src/typography/Typography.stories.tsx +132 -0
  145. package/src/typography/TypographyOverrides.ts +125 -0
  146. package/src/typography/__tests__/Typography.spec.tsx +253 -0
  147. package/src/utils/ExitTransitionPlaceholder.tsx +22 -0
  148. package/src/utils/ResizeObserver.tsx +28 -0
  149. package/src/utils/VisibilityObserver.tsx +75 -0
  150. package/src/utils/__tests__/ExitTransitionPlaceholder.spec.tsx +34 -0
  151. package/src/utils/isEmptyReactNode.ts +11 -0
  152. package/src/utils/mergeRefs.ts +21 -0
  153. package/src/utils/renderChildren.ts +10 -0
  154. package/src/utils/useUID.ts +9 -0
  155. package/tsconfig.json +19 -0
  156. package/LICENSE +0 -21
  157. /package/{dist-node → pkg/dist-node}/index.js +0 -0
  158. /package/{dist-node → pkg/dist-node}/index.js.map +0 -0
  159. /package/{dist-src → pkg/dist-src}/adaptive-toolbar/AdaptiveToolbar.js +0 -0
  160. /package/{dist-src → pkg/dist-src}/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +0 -0
  161. /package/{dist-src → pkg/dist-src}/app-bar/AppBarOverrides.js +0 -0
  162. /package/{dist-src → pkg/dist-src}/autocomplete/AutocompleteOverrides.js +0 -0
  163. /package/{dist-src → pkg/dist-src}/avatar/AvatarOverrides.js +0 -0
  164. /package/{dist-src → pkg/dist-src}/avatar-button/AvatarButton.js +0 -0
  165. /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
  166. /package/{dist-src → pkg/dist-src}/button/ButtonOverrides.js +0 -0
  167. /package/{dist-src → pkg/dist-src}/card/CardOverrides.js +0 -0
  168. /package/{dist-src → pkg/dist-src}/card-button/CardButton.js +0 -0
  169. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxField.js +0 -0
  170. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxGroudField.js +0 -0
  171. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxOverrides.js +0 -0
  172. /package/{dist-src → pkg/dist-src}/chip/ChipOverrides.js +0 -0
  173. /package/{dist-src → pkg/dist-src}/columns/Column.js +0 -0
  174. /package/{dist-src → pkg/dist-src}/columns/Columns.js +0 -0
  175. /package/{dist-src → pkg/dist-src}/description-list/DescriptionList.js +0 -0
  176. /package/{dist-src → pkg/dist-src}/dialog/DialogOverrides.js +0 -0
  177. /package/{dist-src → pkg/dist-src}/drawer/DrawerActions.js +0 -0
  178. /package/{dist-src → pkg/dist-src}/drawer/DrawerContent.js +0 -0
  179. /package/{dist-src → pkg/dist-src}/drawer/DrawerList.js +0 -0
  180. /package/{dist-src → pkg/dist-src}/drawer/DrawerOverrides.js +0 -0
  181. /package/{dist-src → pkg/dist-src}/drawer/DrawerTitle.js +0 -0
  182. /package/{dist-src → pkg/dist-src}/dropdown-button/DropdownButton.js +0 -0
  183. /package/{dist-src → pkg/dist-src}/grid/GridStack.js +0 -0
  184. /package/{dist-src → pkg/dist-src}/grid/InlineGrid.js +0 -0
  185. /package/{dist-src → pkg/dist-src}/icon-button/IconButtonOverrides.js +0 -0
  186. /package/{dist-src → pkg/dist-src}/index.js +0 -0
  187. /package/{dist-src → pkg/dist-src}/info-card/InfoCard.js +0 -0
  188. /package/{dist-src → pkg/dist-src}/inline/Inline.js +0 -0
  189. /package/{dist-src → pkg/dist-src}/link/LinkOverrides.js +0 -0
  190. /package/{dist-src → pkg/dist-src}/list/ListOverrides.js +0 -0
  191. /package/{dist-src → pkg/dist-src}/menu/MenuOverrides.js +0 -0
  192. /package/{dist-src → pkg/dist-src}/number-field/NumberField.js +0 -0
  193. /package/{dist-src → pkg/dist-src}/overflow-text/OverflowText.js +0 -0
  194. /package/{dist-src → pkg/dist-src}/pagination/PaginationOverrides.js +0 -0
  195. /package/{dist-src → pkg/dist-src}/paper/PaperOverrides.js +0 -0
  196. /package/{dist-src → pkg/dist-src}/props/AlignProps.js +0 -0
  197. /package/{dist-src → pkg/dist-src}/props/CollapseProp.js +0 -0
  198. /package/{dist-src → pkg/dist-src}/props/ResponsiveProp.js +0 -0
  199. /package/{dist-src → pkg/dist-src}/props/SpaceProp.js +0 -0
  200. /package/{dist-src → pkg/dist-src}/radio/RadioField.js +0 -0
  201. /package/{dist-src → pkg/dist-src}/radio/RadioGroupField.js +0 -0
  202. /package/{dist-src → pkg/dist-src}/radio/RadioOverrides.js +0 -0
  203. /package/{dist-src → pkg/dist-src}/responsive/CollapseBreakpoint.js +0 -0
  204. /package/{dist-src → pkg/dist-src}/responsive/MinBreakpoint.js +0 -0
  205. /package/{dist-src → pkg/dist-src}/responsive/ResponsiveContext.js +0 -0
  206. /package/{dist-src → pkg/dist-src}/snackbar/Snackbar.js +0 -0
  207. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarContent.js +0 -0
  208. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarOverrides.js +0 -0
  209. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarStack.js +0 -0
  210. /package/{dist-src → pkg/dist-src}/stack/Stack.js +0 -0
  211. /package/{dist-src → pkg/dist-src}/svg-icon/SvgIconOverrides.js +0 -0
  212. /package/{dist-src → pkg/dist-src}/switch/SwitchOverrides.js +0 -0
  213. /package/{dist-src → pkg/dist-src}/tabs/TabsOverrides.js +0 -0
  214. /package/{dist-src → pkg/dist-src}/tag/Tag.js +0 -0
  215. /package/{dist-src → pkg/dist-src}/text-field/TextFieldOverrides.js +0 -0
  216. /package/{dist-src → pkg/dist-src}/theme/Color.js +0 -0
  217. /package/{dist-src → pkg/dist-src}/theme/SuperDispatchTheme.js +0 -0
  218. /package/{dist-src → pkg/dist-src}/theme/ThemeProvider.js +0 -0
  219. /package/{dist-src → pkg/dist-src}/tiles/Tiles.js +0 -0
  220. /package/{dist-src → pkg/dist-src}/toolbar/ToolbarOverrides.js +0 -0
  221. /package/{dist-src → pkg/dist-src}/tooltip/TooltipOverrides.js +0 -0
  222. /package/{dist-src → pkg/dist-src}/typography/TypographyOverrides.js +0 -0
  223. /package/{dist-src → pkg/dist-src}/utils/ExitTransitionPlaceholder.js +0 -0
  224. /package/{dist-src → pkg/dist-src}/utils/ResizeObserver.js +0 -0
  225. /package/{dist-src → pkg/dist-src}/utils/VisibilityObserver.js +0 -0
  226. /package/{dist-src → pkg/dist-src}/utils/isEmptyReactNode.js +0 -0
  227. /package/{dist-src → pkg/dist-src}/utils/mergeRefs.js +0 -0
  228. /package/{dist-src → pkg/dist-src}/utils/renderChildren.js +0 -0
  229. /package/{dist-src → pkg/dist-src}/utils/useUID.js +0 -0
  230. /package/{dist-web → pkg/dist-web}/index.js +0 -0
  231. /package/{dist-web → pkg/dist-web}/index.js.map +0 -0
@@ -0,0 +1,194 @@
1
+ import {
2
+ Drawer,
3
+ IconButton,
4
+ ListItem,
5
+ ListItemSecondaryAction,
6
+ ListItemText,
7
+ TextField,
8
+ } from '@material-ui/core';
9
+ import {
10
+ ArrowBack as ArrowBackIcon,
11
+ Delete as DeleteIcon,
12
+ } from '@material-ui/icons';
13
+ import { Meta } from '@storybook/react';
14
+ import { PropsLink, UseState } from '@superdispatch/ui-docs';
15
+ import { Button, Inline, Stack } from '..';
16
+ import { DrawerActions } from './DrawerActions';
17
+ import { DrawerContent } from './DrawerContent';
18
+ import { DrawerList } from './DrawerList';
19
+ import { DrawerTitle } from './DrawerTitle';
20
+
21
+ export default {
22
+ title: 'Navigation/Drawer',
23
+ component: DrawerTitle,
24
+ subcomponents: { DrawerList },
25
+ parameters: {
26
+ componentSubtitle: (
27
+ <PropsLink url="https://material-ui.com/api/drawer/#props" />
28
+ ),
29
+ },
30
+ } as Meta;
31
+
32
+ export const basic = () => (
33
+ <UseState initialState={false}>
34
+ {(state, setState) => (
35
+ <>
36
+ <Button
37
+ onClick={() => {
38
+ setState(true);
39
+ }}
40
+ >
41
+ Open Drawer
42
+ </Button>
43
+
44
+ <Drawer
45
+ open={state}
46
+ onClose={() => {
47
+ setState(false);
48
+ }}
49
+ >
50
+ <DrawerTitle title="Title" subtitle="Subtitle" />
51
+
52
+ <DrawerContent>
53
+ <Stack>
54
+ <TextField fullWidth={true} label="Field 1" />
55
+ <TextField fullWidth={true} label="Field 2" />
56
+ <TextField fullWidth={true} label="Field 3" />
57
+ <TextField fullWidth={true} label="Field 4" />
58
+ </Stack>
59
+ </DrawerContent>
60
+
61
+ <DrawerActions>
62
+ <Inline space="small">
63
+ <Button color="primary" variant="contained">
64
+ Primary
65
+ </Button>
66
+
67
+ <Button color="primary" variant="outlined">
68
+ Secondary
69
+ </Button>
70
+ </Inline>
71
+ </DrawerActions>
72
+ </Drawer>
73
+ </>
74
+ )}
75
+ </UseState>
76
+ );
77
+
78
+ export const titleStartAction = () => (
79
+ <UseState initialState={false}>
80
+ {(state, setState) => (
81
+ <>
82
+ <Button
83
+ onClick={() => {
84
+ setState(true);
85
+ }}
86
+ >
87
+ Open Drawer
88
+ </Button>
89
+
90
+ <Drawer
91
+ open={state}
92
+ onClose={() => {
93
+ setState(false);
94
+ }}
95
+ >
96
+ <DrawerTitle
97
+ title="Title"
98
+ startAction={
99
+ <IconButton edge="start">
100
+ <ArrowBackIcon />
101
+ </IconButton>
102
+ }
103
+ />
104
+ </Drawer>
105
+ </>
106
+ )}
107
+ </UseState>
108
+ );
109
+
110
+ export const titleEndAction = () => (
111
+ <UseState initialState={false}>
112
+ {(state, setState) => (
113
+ <>
114
+ <Button
115
+ onClick={() => {
116
+ setState(true);
117
+ }}
118
+ >
119
+ Open Drawer
120
+ </Button>
121
+
122
+ <Drawer
123
+ open={state}
124
+ onClose={() => {
125
+ setState(false);
126
+ }}
127
+ >
128
+ <DrawerTitle
129
+ title="Title"
130
+ startAction={
131
+ <IconButton edge="start">
132
+ <ArrowBackIcon />
133
+ </IconButton>
134
+ }
135
+ />
136
+ </Drawer>
137
+ </>
138
+ )}
139
+ </UseState>
140
+ );
141
+
142
+ export const drawerList = () => (
143
+ <UseState initialState={false}>
144
+ {(state, setState) => (
145
+ <>
146
+ <Button
147
+ onClick={() => {
148
+ setState(true);
149
+ }}
150
+ >
151
+ Open Drawer
152
+ </Button>
153
+
154
+ <Drawer
155
+ open={state}
156
+ onClose={() => {
157
+ setState(false);
158
+ }}
159
+ >
160
+ <DrawerTitle title="Title" />
161
+
162
+ <DrawerList>
163
+ {Array.from({ length: 30 }, (_, idx) => (
164
+ <ListItem key={idx} button={true} ContainerComponent="div">
165
+ <ListItemText
166
+ primary={`Primary text #${idx + 1}`}
167
+ secondary={`Secondary text #${idx + 1}`}
168
+ />
169
+
170
+ <ListItemSecondaryAction>
171
+ <IconButton edge="end">
172
+ <DeleteIcon />
173
+ </IconButton>
174
+ </ListItemSecondaryAction>
175
+ </ListItem>
176
+ ))}
177
+ </DrawerList>
178
+
179
+ <DrawerActions>
180
+ <Inline space="small">
181
+ <Button color="primary" variant="contained">
182
+ Primary
183
+ </Button>
184
+
185
+ <Button color="primary" variant="outlined">
186
+ Secondary
187
+ </Button>
188
+ </Inline>
189
+ </DrawerActions>
190
+ </Drawer>
191
+ </>
192
+ )}
193
+ </UseState>
194
+ );
@@ -0,0 +1,69 @@
1
+ import { AppBar, Toolbar } from '@material-ui/core';
2
+ import { makeStyles } from '@material-ui/styles';
3
+ import clsx from 'clsx';
4
+ import { forwardRef, HTMLAttributes } from 'react';
5
+ import { Color } from '../theme/Color';
6
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
7
+ import { VisibilityObserver } from '../utils/VisibilityObserver';
8
+
9
+ const useStyles = makeStyles(
10
+ (theme: SuperDispatchTheme) => ({
11
+ appBar: {
12
+ '&&': {
13
+ bottom: 0,
14
+ top: 'auto',
15
+ borderLeft: 'none',
16
+ borderRight: 'none',
17
+ borderBottom: 'none',
18
+ transition: theme.transitions.create(['border-color']),
19
+
20
+ '&:not($appBarSticky)': {
21
+ borderTopColor: Color.Transparent,
22
+ },
23
+ },
24
+ },
25
+ appBarSticky: {},
26
+
27
+ toolbar: {
28
+ '&.MuiToolbar-gutters': {
29
+ paddingLeft: theme.spacing(3),
30
+ paddingRight: theme.spacing(3),
31
+
32
+ [theme.breakpoints.up('md')]: {
33
+ paddingLeft: theme.spacing(4),
34
+ paddingRight: theme.spacing(4),
35
+ },
36
+ },
37
+ },
38
+ }),
39
+ { name: 'SD-DrawerActions' },
40
+ );
41
+
42
+ export type DrawerActionsProps = Omit<HTMLAttributes<HTMLDivElement>, 'color'>;
43
+
44
+ export const DrawerActions = forwardRef<HTMLDivElement, DrawerActionsProps>(
45
+ ({ children, className, ...props }, appBarRef) => {
46
+ const styles = useStyles();
47
+
48
+ return (
49
+ <VisibilityObserver
50
+ render={({ ref, visibility }) => (
51
+ <>
52
+ <AppBar
53
+ {...props}
54
+ ref={appBarRef}
55
+ position="sticky"
56
+ className={clsx(className, styles.appBar, {
57
+ [styles.appBarSticky]: visibility === 'invisible',
58
+ })}
59
+ >
60
+ <Toolbar className={styles.toolbar}>{children}</Toolbar>
61
+ </AppBar>
62
+
63
+ <div ref={ref} />
64
+ </>
65
+ )}
66
+ />
67
+ );
68
+ },
69
+ );
@@ -0,0 +1,30 @@
1
+ import { makeStyles } from '@material-ui/styles';
2
+ import clsx from 'clsx';
3
+ import { forwardRef, HTMLAttributes } from 'react';
4
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
5
+
6
+ const useStyles = makeStyles(
7
+ (theme: SuperDispatchTheme) => ({
8
+ root: {
9
+ maxWidth: '100%',
10
+ padding: theme.spacing(2, 3),
11
+
12
+ [theme.breakpoints.up('md')]: {
13
+ padding: theme.spacing(2, 4),
14
+ },
15
+ },
16
+ }),
17
+ { name: 'SD-DrawerContent' },
18
+ );
19
+
20
+ export type DrawerContentProps = HTMLAttributes<HTMLDivElement>;
21
+
22
+ export const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(
23
+ ({ className, ...props }, ref) => {
24
+ const styles = useStyles();
25
+
26
+ return (
27
+ <div {...props} ref={ref} className={clsx(styles.root, className)} />
28
+ );
29
+ },
30
+ );
@@ -0,0 +1,60 @@
1
+ import { List, ListProps } from '@material-ui/core';
2
+ import { CSSProperties, makeStyles } from '@material-ui/styles';
3
+ import clsx from 'clsx';
4
+ import { forwardRef } from 'react';
5
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
6
+
7
+ function listItemMixins(
8
+ theme: SuperDispatchTheme,
9
+ space: number,
10
+ ): CSSProperties {
11
+ return {
12
+ '& .MuiListItem-gutters': {
13
+ paddingLeft: theme.spacing(space),
14
+ paddingRight: theme.spacing(space),
15
+
16
+ '&.MuiListItem-secondaryAction': {
17
+ paddingRight: theme.spacing(space * 2),
18
+ },
19
+
20
+ '& .MuiListItemSecondaryAction-root': {
21
+ right: theme.spacing(space),
22
+
23
+ '& .MuiIconButton-edgeEnd': {
24
+ marginRight: theme.spacing(-(space / 2)),
25
+ },
26
+ },
27
+ },
28
+ };
29
+ }
30
+
31
+ const useStyles = makeStyles(
32
+ (theme: SuperDispatchTheme) => ({
33
+ root: {
34
+ maxWidth: '100%',
35
+ ...listItemMixins(theme, 3),
36
+
37
+ [theme.breakpoints.up('md')]: {
38
+ ...listItemMixins(theme, 4),
39
+ },
40
+ },
41
+ }),
42
+ { name: 'SD-DrawerList' },
43
+ );
44
+
45
+ export type DrawerListProps = Omit<ListProps<'div'>, 'component'>;
46
+
47
+ export const DrawerList = forwardRef<HTMLDivElement, DrawerListProps>(
48
+ ({ className, ...props }, ref) => {
49
+ const styles = useStyles();
50
+
51
+ return (
52
+ <List
53
+ {...props}
54
+ ref={ref}
55
+ component="div"
56
+ className={clsx(className, styles.root)}
57
+ />
58
+ );
59
+ },
60
+ );
@@ -0,0 +1,19 @@
1
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
2
+
3
+ export function overrideDrawer(theme: SuperDispatchTheme): void {
4
+ theme.props.MuiDrawer = {
5
+ anchor: 'right',
6
+ };
7
+
8
+ theme.overrides.MuiDrawer = {
9
+ paper: {
10
+ maxWidth: '100%',
11
+ minWidth: '100%',
12
+
13
+ [theme.breakpoints.up('sm')]: {
14
+ minWidth: theme.spacing(54),
15
+ maxWidth: theme.breakpoints.values.sm,
16
+ },
17
+ },
18
+ };
19
+ }
@@ -0,0 +1,143 @@
1
+ import {
2
+ AppBar,
3
+ Grid,
4
+ Toolbar,
5
+ Typography,
6
+ TypographyProps,
7
+ } from '@material-ui/core';
8
+ import { makeStyles } from '@material-ui/styles';
9
+ import clsx from 'clsx';
10
+ import { forwardRef, HTMLAttributes, ReactNode } from 'react';
11
+ import { Color } from '../theme/Color';
12
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
13
+ import { VisibilityObserver } from '../utils/VisibilityObserver';
14
+
15
+ const useStyles = makeStyles(
16
+ (theme: SuperDispatchTheme) => ({
17
+ appBar: {
18
+ '&&': {
19
+ borderTop: 'none',
20
+ borderLeft: 'none',
21
+ borderRight: 'none',
22
+ transition: theme.transitions.create(['border-color']),
23
+
24
+ '&:not($appBarSticky)': {
25
+ borderBottomColor: Color.Transparent,
26
+ },
27
+ },
28
+ },
29
+ appBarSticky: {},
30
+ toolbar: {
31
+ '&.MuiToolbar-gutters': {
32
+ paddingLeft: theme.spacing(3),
33
+ paddingRight: theme.spacing(3),
34
+
35
+ [theme.breakpoints.up('md')]: {
36
+ paddingLeft: theme.spacing(4),
37
+ paddingRight: theme.spacing(4),
38
+ },
39
+ },
40
+ },
41
+ startAction: {
42
+ marginRight: theme.spacing(0.5),
43
+
44
+ '& .MuiIconButton-edgeStart': {
45
+ marginLeft: theme.spacing(-2),
46
+ },
47
+ },
48
+ endAction: {
49
+ marginLeft: theme.spacing(0.5),
50
+
51
+ '& .MuiIconButton-edgeEnd': {
52
+ marginRight: theme.spacing(-2),
53
+ },
54
+ },
55
+ }),
56
+ { name: 'SD-DrawerTitle' },
57
+ );
58
+
59
+ export interface DrawerTitleProps
60
+ extends Omit<HTMLAttributes<HTMLDivElement>, 'color' | 'title'> {
61
+ children?: ReactNode;
62
+
63
+ title: ReactNode;
64
+ titleTypographyProps?: Omit<TypographyProps, 'children'>;
65
+ subtitle?: ReactNode;
66
+ subtitleTypographyProps?: Omit<TypographyProps, 'children'>;
67
+
68
+ startAction?: ReactNode;
69
+ endAction?: ReactNode;
70
+ }
71
+
72
+ export const DrawerTitle = forwardRef<HTMLDivElement, DrawerTitleProps>(
73
+ (
74
+ {
75
+ title,
76
+ titleTypographyProps,
77
+ subtitle,
78
+ subtitleTypographyProps,
79
+ startAction,
80
+ endAction,
81
+ className,
82
+ ...props
83
+ },
84
+ appBarRef,
85
+ ) => {
86
+ const styles = useStyles();
87
+
88
+ return (
89
+ <VisibilityObserver
90
+ render={({ ref, visibility }) => (
91
+ <>
92
+ <div ref={ref} />
93
+
94
+ <AppBar
95
+ {...props}
96
+ ref={appBarRef}
97
+ position="sticky"
98
+ className={clsx(styles.appBar, className, {
99
+ [styles.appBarSticky]: visibility === 'invisible',
100
+ })}
101
+ >
102
+ <Toolbar className={styles.toolbar}>
103
+ <Grid container={true} alignItems="center">
104
+ {!!startAction && (
105
+ <Grid item={true} className={styles.startAction}>
106
+ {startAction}
107
+ </Grid>
108
+ )}
109
+
110
+ <Grid item={true} xs={true} zeroMinWidth={true}>
111
+ <Typography
112
+ variant="h3"
113
+ noWrap={true}
114
+ {...titleTypographyProps}
115
+ >
116
+ {title}
117
+ </Typography>
118
+
119
+ {!!subtitle && (
120
+ <Typography
121
+ variant="body2"
122
+ noWrap={true}
123
+ {...subtitleTypographyProps}
124
+ >
125
+ {subtitle}
126
+ </Typography>
127
+ )}
128
+ </Grid>
129
+
130
+ {!!endAction && (
131
+ <Grid item={true} className={styles.endAction}>
132
+ {endAction}
133
+ </Grid>
134
+ )}
135
+ </Grid>
136
+ </Toolbar>
137
+ </AppBar>
138
+ </>
139
+ )}
140
+ />
141
+ );
142
+ },
143
+ );