@superdispatch/ui 0.21.6 → 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 (233) 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-node → pkg/dist-node}/index.js +2 -1
  6. package/pkg/dist-node/index.js.map +1 -0
  7. package/{dist-src → pkg/dist-src}/number-field/NumberField.js +2 -1
  8. package/{dist-types → pkg/dist-types}/index.d.ts +364 -364
  9. package/{dist-web → pkg/dist-web}/index.js +2 -1
  10. package/pkg/dist-web/index.js.map +1 -0
  11. package/pkg/package.json +39 -0
  12. package/playroom.ts +31 -0
  13. package/src/__tests__/index.spec.ts +134 -0
  14. package/src/adaptive-toolbar/AdaptiveToolbar.stories.tsx +50 -0
  15. package/src/adaptive-toolbar/AdaptiveToolbar.tsx +199 -0
  16. package/src/adaptive-toolbar/__tests__/AdaptiveToolbar.spec.tsx +11 -0
  17. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.stories.tsx +49 -0
  18. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.tsx +171 -0
  19. package/src/app-bar/AppBar.stories.tsx +62 -0
  20. package/src/app-bar/AppBarOverrides.ts +9 -0
  21. package/src/app-bar/__tests__/AppBar.spec.tsx +86 -0
  22. package/src/autocomplete/Autocomplete.stories.tsx +76 -0
  23. package/src/autocomplete/AutocompleteOverrides.tsx +58 -0
  24. package/src/autocomplete/__tests__/Autocomplete.spec.tsx +323 -0
  25. package/src/avatar/Avatar.stories.tsx +17 -0
  26. package/src/avatar/AvatarOverrides.ts +24 -0
  27. package/src/avatar/__tests__/Avatar.spec.tsx +71 -0
  28. package/src/avatar-button/AvatarButton.stories.tsx +153 -0
  29. package/src/avatar-button/AvatarButton.tsx +223 -0
  30. package/src/avatar-button/__tests__/AvatarButton.spec.tsx +126 -0
  31. package/src/button/Button.tsx +51 -0
  32. package/src/button/ButtonOverrides.ts +375 -0
  33. package/src/button/__tests__/Button.spec.tsx +599 -0
  34. package/src/card/Card.stories.tsx +39 -0
  35. package/src/card/CardOverrides.ts +9 -0
  36. package/src/card/__tests__/Card.spec.tsx +68 -0
  37. package/src/card-button/CardButton.stories.tsx +36 -0
  38. package/src/card-button/CardButton.tsx +202 -0
  39. package/src/card-button/__tests__/CardButton.spec.tsx +95 -0
  40. package/src/checkbox/CheckboxField.stories.tsx +61 -0
  41. package/src/checkbox/CheckboxField.tsx +56 -0
  42. package/src/checkbox/CheckboxGroudField.tsx +53 -0
  43. package/src/checkbox/CheckboxOverrides.tsx +55 -0
  44. package/src/checkbox/__tests__/Checkbox.spec.tsx +105 -0
  45. package/src/chip/Chip.stories.tsx +26 -0
  46. package/src/chip/ChipOverrides.tsx +111 -0
  47. package/src/chip/__tests__/Chip.spec.tsx +308 -0
  48. package/src/columns/Column.tsx +124 -0
  49. package/src/columns/Columns.stories.tsx +426 -0
  50. package/src/columns/Columns.tsx +76 -0
  51. package/src/description-list/DescriptionList.spec.tsx +137 -0
  52. package/src/description-list/DescriptionList.stories.tsx +148 -0
  53. package/src/description-list/DescriptionList.tsx +170 -0
  54. package/src/dialog/Dialog.playroom.tsx +24 -0
  55. package/src/dialog/Dialog.stories.tsx +60 -0
  56. package/src/dialog/DialogOverrides.ts +39 -0
  57. package/src/dialog/__tests__/Dialog.spec.tsx +219 -0
  58. package/src/drawer/Drawer.playroom.tsx +22 -0
  59. package/src/drawer/Drawer.stories.tsx +194 -0
  60. package/src/drawer/DrawerActions.tsx +69 -0
  61. package/src/drawer/DrawerContent.tsx +30 -0
  62. package/src/drawer/DrawerList.tsx +60 -0
  63. package/src/drawer/DrawerOverrides.ts +19 -0
  64. package/src/drawer/DrawerTitle.tsx +143 -0
  65. package/src/drawer/__tests__/Drawer.spec.tsx +227 -0
  66. package/src/dropdown-button/DropdownButton.stories.tsx +15 -0
  67. package/src/dropdown-button/DropdownButton.tsx +131 -0
  68. package/src/grid/GridStack.tsx +45 -0
  69. package/src/grid/InlineGrid.tsx +56 -0
  70. package/src/icon-button/IconButton.stories.tsx +53 -0
  71. package/src/icon-button/IconButtonOverrides.ts +32 -0
  72. package/src/icon-button/__tests__/IconButton.spec.tsx +124 -0
  73. package/src/index.ts +47 -0
  74. package/src/info-card/InfoCard.stories.tsx +29 -0
  75. package/src/info-card/InfoCard.tsx +95 -0
  76. package/src/info-card/__tests__/InfoCard.spec.tsx +22 -0
  77. package/src/info-tooltip/InfoTooltip.stories.tsx +77 -0
  78. package/src/info-tooltip/InfoTooltip.tsx +72 -0
  79. package/src/info-tooltip/__tests__/InfoTooltip.spec.tsx +166 -0
  80. package/src/inline/Inline.stories.tsx +135 -0
  81. package/src/inline/Inline.tsx +144 -0
  82. package/src/link/Link.stories.tsx +41 -0
  83. package/src/link/LinkOverrides.ts +43 -0
  84. package/src/link/__tests__/Link.spec.tsx +98 -0
  85. package/src/list/ListOverrides.ts +11 -0
  86. package/src/list/__tests__/List.spec.tsx +182 -0
  87. package/src/menu/Menu.stories.tsx +35 -0
  88. package/src/menu/MenuOverrides.ts +17 -0
  89. package/src/menu/__tests__/Menu.spec.tsx +99 -0
  90. package/src/number-field/NumberField.stories.tsx +123 -0
  91. package/src/number-field/NumberField.tsx +98 -0
  92. package/src/overflow-text/OverflowText.stories.tsx +32 -0
  93. package/src/overflow-text/OverflowText.tsx +114 -0
  94. package/src/overflow-text/__tests__/OverflowText.spec.tsx +24 -0
  95. package/src/pagination/Pagination.stories.tsx +36 -0
  96. package/src/pagination/PaginationOverrides.ts +47 -0
  97. package/src/pagination/__tests__/Pagination.spec.tsx +228 -0
  98. package/src/paper/PaperOverrides.ts +10 -0
  99. package/src/paper/__tests__/Paper.spec.tsx +155 -0
  100. package/src/props/AlignProps.ts +22 -0
  101. package/src/props/CollapseProp.ts +13 -0
  102. package/src/props/ResponsiveProp.ts +65 -0
  103. package/src/props/SpaceProp.ts +40 -0
  104. package/src/radio/RadioField.stories.tsx +42 -0
  105. package/src/radio/RadioField.tsx +55 -0
  106. package/src/radio/RadioGroupField.tsx +64 -0
  107. package/src/radio/RadioOverrides.tsx +51 -0
  108. package/src/radio/__tests__/Radio.spec.tsx +90 -0
  109. package/src/responsive/CollapseBreakpoint.ts +21 -0
  110. package/src/responsive/MinBreakpoint.ts +21 -0
  111. package/src/responsive/ResponsiveContext.tsx +57 -0
  112. package/src/snackbar/Snackbar.stories.tsx +196 -0
  113. package/src/snackbar/Snackbar.tsx +83 -0
  114. package/src/snackbar/SnackbarContent.tsx +147 -0
  115. package/src/snackbar/SnackbarOverrides.ts +23 -0
  116. package/src/snackbar/SnackbarStack.tsx +160 -0
  117. package/src/snackbar/__tests__/Snackbar.spec.tsx +196 -0
  118. package/src/stack/Stack.stories.tsx +113 -0
  119. package/src/stack/Stack.tsx +86 -0
  120. package/src/svg-icon/SvgIcon.stories.tsx +29 -0
  121. package/src/svg-icon/SvgIconOverrides.ts +32 -0
  122. package/src/svg-icon/__tests__/SvgIcon.spec.tsx +67 -0
  123. package/src/switch/Switch.stories.tsx +60 -0
  124. package/src/switch/SwitchOverrides.ts +88 -0
  125. package/src/switch/__tests__/Switch.spec.tsx +204 -0
  126. package/src/tabs/Tabs.stories.tsx +40 -0
  127. package/src/tabs/TabsOverrides.ts +45 -0
  128. package/src/tabs/__tests__/Tabs.spec.tsx +226 -0
  129. package/src/tag/Tag.stories.tsx +53 -0
  130. package/src/tag/Tag.tsx +130 -0
  131. package/src/tag/__tests__/Tag.spec.tsx +82 -0
  132. package/src/text-field/TextField.stories.tsx +50 -0
  133. package/src/text-field/TextFieldOverrides.tsx +149 -0
  134. package/src/text-field/__tests__/TextField.spec.tsx +662 -0
  135. package/src/theme/Color.ts +117 -0
  136. package/src/theme/SuperDispatchTheme.ts +3 -0
  137. package/src/theme/ThemeProvider.tsx +179 -0
  138. package/src/theme/__tests__/CssBaseline.spec.tsx +49 -0
  139. package/src/theme/__tests__/ThemeProvider.spec.ts +40 -0
  140. package/src/theme/__tests__/__snapshots__/ThemeProvider.spec.ts.snap +204 -0
  141. package/src/tiles/Tiles.stories.tsx +69 -0
  142. package/src/tiles/Tiles.tsx +163 -0
  143. package/src/tiles/__tests__/Tiles.spec.tsx +221 -0
  144. package/src/toolbar/ToolbarOverrides.ts +14 -0
  145. package/src/toolbar/__tests__/Toolbar.spec.tsx +50 -0
  146. package/src/tooltip/Tooltip.stories.tsx +32 -0
  147. package/src/tooltip/TooltipOverrides.ts +34 -0
  148. package/src/tooltip/__tests__/Tooltip.spec.tsx +182 -0
  149. package/src/typography/Typography.stories.tsx +132 -0
  150. package/src/typography/TypographyOverrides.ts +125 -0
  151. package/src/typography/__tests__/Typography.spec.tsx +253 -0
  152. package/src/utils/ExitTransitionPlaceholder.tsx +22 -0
  153. package/src/utils/ResizeObserver.tsx +28 -0
  154. package/src/utils/VisibilityObserver.tsx +75 -0
  155. package/src/utils/__tests__/ExitTransitionPlaceholder.spec.tsx +34 -0
  156. package/src/utils/isEmptyReactNode.ts +11 -0
  157. package/src/utils/mergeRefs.ts +21 -0
  158. package/src/utils/renderChildren.ts +10 -0
  159. package/src/utils/useUID.ts +9 -0
  160. package/tsconfig.json +19 -0
  161. package/LICENSE +0 -21
  162. package/dist-node/index.js.map +0 -1
  163. package/dist-web/index.js.map +0 -1
  164. /package/{dist-src → pkg/dist-src}/adaptive-toolbar/AdaptiveToolbar.js +0 -0
  165. /package/{dist-src → pkg/dist-src}/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +0 -0
  166. /package/{dist-src → pkg/dist-src}/app-bar/AppBarOverrides.js +0 -0
  167. /package/{dist-src → pkg/dist-src}/autocomplete/AutocompleteOverrides.js +0 -0
  168. /package/{dist-src → pkg/dist-src}/avatar/AvatarOverrides.js +0 -0
  169. /package/{dist-src → pkg/dist-src}/avatar-button/AvatarButton.js +0 -0
  170. /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
  171. /package/{dist-src → pkg/dist-src}/button/ButtonOverrides.js +0 -0
  172. /package/{dist-src → pkg/dist-src}/card/CardOverrides.js +0 -0
  173. /package/{dist-src → pkg/dist-src}/card-button/CardButton.js +0 -0
  174. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxField.js +0 -0
  175. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxGroudField.js +0 -0
  176. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxOverrides.js +0 -0
  177. /package/{dist-src → pkg/dist-src}/chip/ChipOverrides.js +0 -0
  178. /package/{dist-src → pkg/dist-src}/columns/Column.js +0 -0
  179. /package/{dist-src → pkg/dist-src}/columns/Columns.js +0 -0
  180. /package/{dist-src → pkg/dist-src}/description-list/DescriptionList.js +0 -0
  181. /package/{dist-src → pkg/dist-src}/dialog/DialogOverrides.js +0 -0
  182. /package/{dist-src → pkg/dist-src}/drawer/DrawerActions.js +0 -0
  183. /package/{dist-src → pkg/dist-src}/drawer/DrawerContent.js +0 -0
  184. /package/{dist-src → pkg/dist-src}/drawer/DrawerList.js +0 -0
  185. /package/{dist-src → pkg/dist-src}/drawer/DrawerOverrides.js +0 -0
  186. /package/{dist-src → pkg/dist-src}/drawer/DrawerTitle.js +0 -0
  187. /package/{dist-src → pkg/dist-src}/dropdown-button/DropdownButton.js +0 -0
  188. /package/{dist-src → pkg/dist-src}/grid/GridStack.js +0 -0
  189. /package/{dist-src → pkg/dist-src}/grid/InlineGrid.js +0 -0
  190. /package/{dist-src → pkg/dist-src}/icon-button/IconButtonOverrides.js +0 -0
  191. /package/{dist-src → pkg/dist-src}/index.js +0 -0
  192. /package/{dist-src → pkg/dist-src}/info-card/InfoCard.js +0 -0
  193. /package/{dist-src → pkg/dist-src}/inline/Inline.js +0 -0
  194. /package/{dist-src → pkg/dist-src}/link/LinkOverrides.js +0 -0
  195. /package/{dist-src → pkg/dist-src}/list/ListOverrides.js +0 -0
  196. /package/{dist-src → pkg/dist-src}/menu/MenuOverrides.js +0 -0
  197. /package/{dist-src → pkg/dist-src}/overflow-text/OverflowText.js +0 -0
  198. /package/{dist-src → pkg/dist-src}/pagination/PaginationOverrides.js +0 -0
  199. /package/{dist-src → pkg/dist-src}/paper/PaperOverrides.js +0 -0
  200. /package/{dist-src → pkg/dist-src}/props/AlignProps.js +0 -0
  201. /package/{dist-src → pkg/dist-src}/props/CollapseProp.js +0 -0
  202. /package/{dist-src → pkg/dist-src}/props/ResponsiveProp.js +0 -0
  203. /package/{dist-src → pkg/dist-src}/props/SpaceProp.js +0 -0
  204. /package/{dist-src → pkg/dist-src}/radio/RadioField.js +0 -0
  205. /package/{dist-src → pkg/dist-src}/radio/RadioGroupField.js +0 -0
  206. /package/{dist-src → pkg/dist-src}/radio/RadioOverrides.js +0 -0
  207. /package/{dist-src → pkg/dist-src}/responsive/CollapseBreakpoint.js +0 -0
  208. /package/{dist-src → pkg/dist-src}/responsive/MinBreakpoint.js +0 -0
  209. /package/{dist-src → pkg/dist-src}/responsive/ResponsiveContext.js +0 -0
  210. /package/{dist-src → pkg/dist-src}/snackbar/Snackbar.js +0 -0
  211. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarContent.js +0 -0
  212. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarOverrides.js +0 -0
  213. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarStack.js +0 -0
  214. /package/{dist-src → pkg/dist-src}/stack/Stack.js +0 -0
  215. /package/{dist-src → pkg/dist-src}/svg-icon/SvgIconOverrides.js +0 -0
  216. /package/{dist-src → pkg/dist-src}/switch/SwitchOverrides.js +0 -0
  217. /package/{dist-src → pkg/dist-src}/tabs/TabsOverrides.js +0 -0
  218. /package/{dist-src → pkg/dist-src}/tag/Tag.js +0 -0
  219. /package/{dist-src → pkg/dist-src}/text-field/TextFieldOverrides.js +0 -0
  220. /package/{dist-src → pkg/dist-src}/theme/Color.js +0 -0
  221. /package/{dist-src → pkg/dist-src}/theme/SuperDispatchTheme.js +0 -0
  222. /package/{dist-src → pkg/dist-src}/theme/ThemeProvider.js +0 -0
  223. /package/{dist-src → pkg/dist-src}/tiles/Tiles.js +0 -0
  224. /package/{dist-src → pkg/dist-src}/toolbar/ToolbarOverrides.js +0 -0
  225. /package/{dist-src → pkg/dist-src}/tooltip/TooltipOverrides.js +0 -0
  226. /package/{dist-src → pkg/dist-src}/typography/TypographyOverrides.js +0 -0
  227. /package/{dist-src → pkg/dist-src}/utils/ExitTransitionPlaceholder.js +0 -0
  228. /package/{dist-src → pkg/dist-src}/utils/ResizeObserver.js +0 -0
  229. /package/{dist-src → pkg/dist-src}/utils/VisibilityObserver.js +0 -0
  230. /package/{dist-src → pkg/dist-src}/utils/isEmptyReactNode.js +0 -0
  231. /package/{dist-src → pkg/dist-src}/utils/mergeRefs.js +0 -0
  232. /package/{dist-src → pkg/dist-src}/utils/renderChildren.js +0 -0
  233. /package/{dist-src → pkg/dist-src}/utils/useUID.js +0 -0
@@ -0,0 +1,148 @@
1
+ import { Link } from '@material-ui/core';
2
+ import CalendarTodayIcon from '@material-ui/icons/CalendarToday';
3
+ import ChatIcon from '@material-ui/icons/Chat';
4
+ import NotesIcon from '@material-ui/icons/Notes';
5
+ import PersonIcon from '@material-ui/icons/Person';
6
+ import PhoneIcon from '@material-ui/icons/Phone';
7
+ import RoomIcon from '@material-ui/icons/Room';
8
+ import { Meta } from '@storybook/react';
9
+ import { PhoneLink, PhoneText } from '@superdispatch/phones';
10
+ import { Box } from '@superdispatch/ui-lab';
11
+ import { DescriptionList, DescriptionListItem } from './DescriptionList';
12
+
13
+ export default {
14
+ title: 'Data Display/DescriptionList',
15
+ component: DescriptionList,
16
+ subcomponents: { DescriptionListItem },
17
+ decorators: [
18
+ (Story) => (
19
+ <Box maxWidth="200px">
20
+ <Story />
21
+ </Box>
22
+ ),
23
+ ],
24
+ } as Meta;
25
+
26
+ export const small = () => (
27
+ <DescriptionList size="small">
28
+ <DescriptionListItem
29
+ icon={<CalendarTodayIcon />}
30
+ label="Posted on"
31
+ content="Feb 03, 2020"
32
+ />
33
+ <DescriptionListItem
34
+ icon={<RoomIcon />}
35
+ content="167 Zosh Rd, Dallas, PA 18612"
36
+ />
37
+ <DescriptionListItem icon={<NotesIcon />} label="Notes" />
38
+ </DescriptionList>
39
+ );
40
+
41
+ export const medium = () => (
42
+ <DescriptionList size="medium">
43
+ <DescriptionListItem
44
+ icon={<CalendarTodayIcon />}
45
+ label="Posted on"
46
+ content="Feb 03, 2020"
47
+ />
48
+ <DescriptionListItem
49
+ icon={<RoomIcon />}
50
+ content="167 Zosh Rd, Dallas, PA 18612"
51
+ />
52
+ <DescriptionListItem icon={<NotesIcon />} label="Notes" />
53
+ </DescriptionList>
54
+ );
55
+
56
+ export const large = () => (
57
+ <DescriptionList size="large">
58
+ <DescriptionListItem
59
+ icon={<CalendarTodayIcon />}
60
+ label="Posted on"
61
+ content="Feb 03, 2020"
62
+ />
63
+ <DescriptionListItem
64
+ icon={<RoomIcon />}
65
+ content="167 Zosh Rd, Dallas, PA 18612"
66
+ />
67
+ <DescriptionListItem icon={<NotesIcon />} label="Notes" />
68
+ </DescriptionList>
69
+ );
70
+
71
+ export const fallback = () => (
72
+ <DescriptionList>
73
+ <DescriptionListItem
74
+ icon={<CalendarTodayIcon />}
75
+ label="Posted on"
76
+ content={null}
77
+ fallback="N/A"
78
+ />
79
+ <DescriptionListItem
80
+ icon={<RoomIcon />}
81
+ content=""
82
+ fallback="No address available"
83
+ />
84
+ <DescriptionListItem
85
+ icon={<NotesIcon />}
86
+ content={false}
87
+ fallback="No delivery notes"
88
+ />
89
+ </DescriptionList>
90
+ );
91
+
92
+ export const inset = () => (
93
+ <DescriptionList size="small">
94
+ <DescriptionListItem
95
+ icon={<PersonIcon />}
96
+ content={<b>Antony Hoffman</b>}
97
+ />
98
+
99
+ <DescriptionListItem
100
+ inset={true}
101
+ content={<PhoneLink phone="303 555 0105" format="national" />}
102
+ />
103
+
104
+ <DescriptionListItem
105
+ inset={true}
106
+ content={
107
+ <Link href="mailto:dustin.russel@example.com">
108
+ dustin.russel@example.com
109
+ </Link>
110
+ }
111
+ contentTypographyProps={{
112
+ disableUnderline: true,
113
+ TooltipProps: {
114
+ interactive: true,
115
+ title: 'dustin.russel@example.com',
116
+ },
117
+ }}
118
+ />
119
+ </DescriptionList>
120
+ );
121
+
122
+ export const nested = () => (
123
+ <DescriptionList>
124
+ <DescriptionListItem
125
+ icon={<RoomIcon />}
126
+ content="NISSAN WAY, CANTON, MS 39046"
127
+ />
128
+ <DescriptionListItem
129
+ icon={<PhoneIcon />}
130
+ content=""
131
+ fallback="No pickup date"
132
+ />
133
+
134
+ <DescriptionList size="small">
135
+ <DescriptionListItem icon={<PersonIcon />} content="MGR MGR" />
136
+ <DescriptionListItem
137
+ inset={true}
138
+ content={<PhoneText phone="6018550402" format="national" />}
139
+ />
140
+ </DescriptionList>
141
+
142
+ <DescriptionListItem
143
+ icon={<ChatIcon />}
144
+ content=""
145
+ fallback="No pickup notes"
146
+ />
147
+ </DescriptionList>
148
+ );
@@ -0,0 +1,170 @@
1
+ import { SvgIcon, Typography, TypographyProps } from '@material-ui/core';
2
+ import { CSSProperties, makeStyles } from '@material-ui/styles';
3
+ import clsx from 'clsx';
4
+ import { forwardRef, ReactNode } from 'react';
5
+ import { OverflowText, OverflowTextProps } from '../overflow-text/OverflowText';
6
+ import { Color } from '../theme/Color';
7
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
8
+ import { isEmptyReactNode } from '../utils/isEmptyReactNode';
9
+ import { useUID } from '../utils/useUID';
10
+
11
+ function sizeVariant(
12
+ theme: SuperDispatchTheme,
13
+ mobileSpacing: number,
14
+ desktopSpacing: number,
15
+ ): CSSProperties {
16
+ return {
17
+ '& > $list, & > $item': {
18
+ '&:not(:last-child)': {
19
+ paddingBottom: theme.spacing(mobileSpacing),
20
+
21
+ [theme.breakpoints.up('sm')]: {
22
+ paddingBottom: theme.spacing(desktopSpacing),
23
+ },
24
+ },
25
+ },
26
+ };
27
+ }
28
+
29
+ const useStyles = makeStyles(
30
+ (theme: SuperDispatchTheme) => ({
31
+ list: sizeVariant(theme, 2, 1),
32
+ listSmall: sizeVariant(theme, 1, 0.5),
33
+ listLarge: sizeVariant(theme, 3, 2),
34
+
35
+ item: {
36
+ display: 'flex',
37
+ alignItems: 'center',
38
+ },
39
+
40
+ icon: {
41
+ display: 'inline-flex',
42
+ marginRight: theme.spacing(1),
43
+
44
+ '& > .MuiSvgIcon-root': {
45
+ color: Color.Dark100,
46
+ fontSize: theme.spacing(3),
47
+
48
+ [theme.breakpoints.up('sm')]: {
49
+ fontSize: theme.spacing(2),
50
+ },
51
+ },
52
+ },
53
+ }),
54
+ { name: 'SD-DescriptionList' },
55
+ );
56
+
57
+ //
58
+ // DescriptionList
59
+ //
60
+
61
+ export interface DescriptionListProps {
62
+ children?: ReactNode;
63
+ size?: 'small' | 'medium' | 'large';
64
+ }
65
+
66
+ export const DescriptionList = forwardRef<HTMLDivElement, DescriptionListProps>(
67
+ ({ size, ...props }, ref) => {
68
+ const styles = useStyles();
69
+
70
+ return (
71
+ <div
72
+ {...props}
73
+ ref={ref}
74
+ data-size={size}
75
+ className={clsx(styles.list, {
76
+ [styles.listSmall]: size === 'small',
77
+ [styles.listLarge]: size === 'large',
78
+ })}
79
+ />
80
+ );
81
+ },
82
+ );
83
+
84
+ //
85
+ // DescriptionListItem
86
+ //
87
+
88
+ export interface DescriptionListItemProps {
89
+ icon?: ReactNode;
90
+ inset?: boolean;
91
+
92
+ label?: ReactNode;
93
+ labelTypographyProps?: Omit<
94
+ TypographyProps,
95
+ 'noWrap' | 'variant' | 'component' | 'color'
96
+ >;
97
+
98
+ content?: ReactNode;
99
+ contentTypographyProps?: Omit<OverflowTextProps, 'component' | 'color'>;
100
+
101
+ fallback?: ReactNode;
102
+ }
103
+
104
+ export const DescriptionListItem = forwardRef<
105
+ HTMLDivElement,
106
+ DescriptionListItemProps
107
+ >(
108
+ (
109
+ {
110
+ inset,
111
+ icon = inset ? <SvgIcon /> : null,
112
+
113
+ label,
114
+ labelTypographyProps,
115
+
116
+ content,
117
+ contentTypographyProps,
118
+
119
+ fallback,
120
+ },
121
+ ref,
122
+ ) => {
123
+ const styles = useStyles();
124
+ const labelID = useUID(labelTypographyProps?.id);
125
+
126
+ const shouldRenderFallback = isEmptyReactNode(content);
127
+
128
+ return (
129
+ <div
130
+ ref={ref}
131
+ className={styles.item}
132
+ aria-labelledby={label != null ? labelID : undefined}
133
+ >
134
+ {!!icon && <div className={styles.icon}>{icon}</div>}
135
+
136
+ <OverflowText
137
+ {...contentTypographyProps}
138
+ component="span"
139
+ color={
140
+ shouldRenderFallback && label == null
141
+ ? 'textSecondary'
142
+ : 'textPrimary'
143
+ }
144
+ TooltipProps={{
145
+ ...contentTypographyProps?.TooltipProps,
146
+ title:
147
+ contentTypographyProps?.TooltipProps?.title ??
148
+ content ??
149
+ undefined,
150
+ }}
151
+ >
152
+ {label != null && (
153
+ <Typography
154
+ {...labelTypographyProps}
155
+ id={labelID}
156
+ variant="body2"
157
+ component="span"
158
+ color="textSecondary"
159
+ >
160
+ {label}
161
+ </Typography>
162
+ )}
163
+
164
+ {label != null && ' '}
165
+ {!shouldRenderFallback ? content : fallback}
166
+ </OverflowText>
167
+ </div>
168
+ );
169
+ },
170
+ );
@@ -0,0 +1,24 @@
1
+ import { Dialog as MuiDialog, DialogProps } from '@material-ui/core';
2
+ import { forwardRef } from 'react';
3
+
4
+ export const Dialog = forwardRef<HTMLDivElement, DialogProps>(
5
+ (
6
+ {
7
+ open = true,
8
+ disableAutoFocus = true,
9
+ disableEnforceFocus = true,
10
+ disableRestoreFocus = true,
11
+ ...props
12
+ },
13
+ ref,
14
+ ) => (
15
+ <MuiDialog
16
+ {...props}
17
+ ref={ref}
18
+ open={open}
19
+ disableAutoFocus={disableAutoFocus}
20
+ disableEnforceFocus={disableEnforceFocus}
21
+ disableRestoreFocus={disableRestoreFocus}
22
+ />
23
+ ),
24
+ );
@@ -0,0 +1,60 @@
1
+ import { DialogActions, DialogContent, DialogTitle } from '@material-ui/core';
2
+ import { PropsLink, UseState } from '@superdispatch/ui-docs';
3
+ import { Button } from '..';
4
+ import { Dialog } from './Dialog.playroom';
5
+
6
+ export default {
7
+ title: 'Feedback/Dialog',
8
+ parameters: {
9
+ componentSubtitle: (
10
+ <PropsLink url="https://material-ui.com/api/dialog/#props" />
11
+ ),
12
+ },
13
+ };
14
+
15
+ export const basic = () => (
16
+ <UseState initialState={false}>
17
+ {(open, setOpen) => (
18
+ <>
19
+ <Button
20
+ onClick={() => {
21
+ setOpen(true);
22
+ }}
23
+ >
24
+ Open Dialog
25
+ </Button>
26
+
27
+ <Dialog
28
+ open={open}
29
+ disablePortal={true}
30
+ onClose={() => {
31
+ setOpen(false);
32
+ }}
33
+ >
34
+ <DialogTitle>Use Google’s location service?</DialogTitle>
35
+ <DialogContent>
36
+ Let Google help apps determine location. This means sending
37
+ anonymous location data to Google, even when no apps are running.
38
+ </DialogContent>
39
+ <DialogActions>
40
+ <Button
41
+ onClick={() => {
42
+ setOpen(false);
43
+ }}
44
+ >
45
+ Disagree
46
+ </Button>
47
+ <Button
48
+ onClick={() => {
49
+ setOpen(false);
50
+ }}
51
+ variant="contained"
52
+ >
53
+ Agree
54
+ </Button>
55
+ </DialogActions>
56
+ </Dialog>
57
+ </>
58
+ )}
59
+ </UseState>
60
+ );
@@ -0,0 +1,39 @@
1
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
2
+
3
+ export function overrideDialog(theme: SuperDispatchTheme): void {
4
+ theme.props.MuiDialogTitle = { disableTypography: true };
5
+
6
+ theme.overrides.MuiDialog = {
7
+ paper: {
8
+ margin: theme.spacing(3),
9
+ },
10
+
11
+ paperWidthXs: {
12
+ maxWidth: Math.max(theme.breakpoints.values.xs, 360),
13
+
14
+ '&$paperScrollBody': {
15
+ [theme.breakpoints.down(
16
+ Math.max(theme.breakpoints.values.xs, 360) + 32 * 2,
17
+ )]: {
18
+ maxWidth: 'calc(100% - 64px)',
19
+ },
20
+ },
21
+ },
22
+ };
23
+
24
+ theme.overrides.MuiDialogTitle = {
25
+ root: { ...theme.typography.h3 },
26
+ };
27
+
28
+ theme.overrides.MuiDialogContent = {
29
+ root: { padding: theme.spacing(0, 3) },
30
+ };
31
+
32
+ theme.overrides.MuiDialogActions = {
33
+ root: { padding: theme.spacing(3) },
34
+
35
+ spacing: {
36
+ '& > :not(:first-child)': { marginLeft: theme.spacing(2) },
37
+ },
38
+ };
39
+ }
@@ -0,0 +1,219 @@
1
+ import {
2
+ Dialog,
3
+ DialogActions,
4
+ DialogContent,
5
+ DialogTitle,
6
+ } from '@material-ui/core';
7
+ import { renderCSS, renderTheme } from '@superdispatch/ui-testutils';
8
+
9
+ it('checks default props', () => {
10
+ const { props } = renderTheme();
11
+
12
+ expect(props.MuiDialog).toMatchInlineSnapshot(`undefined`);
13
+ expect(props.MuiDialogTitle).toMatchInlineSnapshot(`
14
+ Object {
15
+ "disableTypography": true,
16
+ }
17
+ `);
18
+ expect(props.MuiDialogContent).toMatchInlineSnapshot(`undefined`);
19
+ expect(props.MuiDialogActions).toMatchInlineSnapshot(`undefined`);
20
+ });
21
+
22
+ it('checks component css', () => {
23
+ expect(
24
+ renderCSS(
25
+ <Dialog open={true}>
26
+ <DialogTitle>Text</DialogTitle>
27
+ <DialogContent />
28
+ <DialogActions />
29
+ </Dialog>,
30
+ ['MuiDialog', 'MuiDialogTitle', 'MuiDialogContent', 'MuiDialogActions'],
31
+ ),
32
+ ).toMatchInlineSnapshot(`
33
+ @media print {
34
+ .MuiDialog-root {
35
+ position: absolute !important;
36
+ }
37
+ }
38
+
39
+ .MuiDialog-scrollPaper {
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ }
44
+
45
+ .MuiDialog-scrollBody {
46
+ overflow-x: hidden;
47
+ overflow-y: auto;
48
+ text-align: center;
49
+ }
50
+
51
+ .MuiDialog-scrollBody:after {
52
+ width: 0;
53
+ height: 100%;
54
+ content: '';
55
+ display: inline-block;
56
+ vertical-align: middle;
57
+ }
58
+
59
+ .MuiDialog-container {
60
+ height: 100%;
61
+ outline: 0;
62
+ }
63
+
64
+ @media print {
65
+ .MuiDialog-container {
66
+ height: auto;
67
+ }
68
+ }
69
+
70
+ .MuiDialog-paper {
71
+ margin: 24px;
72
+ position: relative;
73
+ overflow-y: auto;
74
+ }
75
+
76
+ @media print {
77
+ .MuiDialog-paper {
78
+ box-shadow: none;
79
+ overflow-y: visible;
80
+ }
81
+ }
82
+
83
+ .MuiDialog-paperScrollPaper {
84
+ display: flex;
85
+ max-height: calc(100% - 64px);
86
+ flex-direction: column;
87
+ }
88
+
89
+ .MuiDialog-paperScrollBody {
90
+ display: inline-block;
91
+ text-align: left;
92
+ vertical-align: middle;
93
+ }
94
+
95
+ .MuiDialog-paperWidthFalse {
96
+ max-width: calc(100% - 64px);
97
+ }
98
+
99
+ .MuiDialog-paperWidthXs {
100
+ max-width: 360px;
101
+ }
102
+
103
+ @media (max-width: 507.95px) {
104
+ .MuiDialog-paperWidthXs.MuiDialog-paperScrollBody {
105
+ max-width: calc(100% - 64px);
106
+ }
107
+ }
108
+
109
+ @media (max-width: 423.95px) {
110
+ .MuiDialog-paperWidthXs.MuiDialog-paperScrollBody {
111
+ max-width: calc(100% - 64px);
112
+ }
113
+ }
114
+
115
+ .MuiDialog-paperWidthSm {
116
+ max-width: 600px;
117
+ }
118
+
119
+ @media (max-width: 663.95px) {
120
+ .MuiDialog-paperWidthSm.MuiDialog-paperScrollBody {
121
+ max-width: calc(100% - 64px);
122
+ }
123
+ }
124
+
125
+ .MuiDialog-paperWidthMd {
126
+ max-width: 960px;
127
+ }
128
+
129
+ @media (max-width: 1023.95px) {
130
+ .MuiDialog-paperWidthMd.MuiDialog-paperScrollBody {
131
+ max-width: calc(100% - 64px);
132
+ }
133
+ }
134
+
135
+ .MuiDialog-paperWidthLg {
136
+ max-width: 1280px;
137
+ }
138
+
139
+ @media (max-width: 1343.95px) {
140
+ .MuiDialog-paperWidthLg.MuiDialog-paperScrollBody {
141
+ max-width: calc(100% - 64px);
142
+ }
143
+ }
144
+
145
+ .MuiDialog-paperWidthXl {
146
+ max-width: 1920px;
147
+ }
148
+
149
+ @media (max-width: 1983.95px) {
150
+ .MuiDialog-paperWidthXl.MuiDialog-paperScrollBody {
151
+ max-width: calc(100% - 64px);
152
+ }
153
+ }
154
+
155
+ .MuiDialog-paperFullWidth {
156
+ width: calc(100% - 64px);
157
+ }
158
+
159
+ .MuiDialog-paperFullScreen {
160
+ width: 100%;
161
+ height: 100%;
162
+ margin: 0;
163
+ max-width: 100%;
164
+ max-height: none;
165
+ border-radius: 0;
166
+ }
167
+
168
+ .MuiDialog-paperFullScreen.MuiDialog-paperScrollBody {
169
+ margin: 0;
170
+ max-width: 100%;
171
+ }
172
+
173
+ .MuiDialogActions-root {
174
+ flex: 0 0 auto;
175
+ display: flex;
176
+ padding: 24px;
177
+ align-items: center;
178
+ justify-content: flex-end;
179
+ }
180
+
181
+ .MuiDialogActions-spacing > :not(:first-child) {
182
+ margin-left: 16px;
183
+ }
184
+
185
+ .MuiDialogContent-root {
186
+ flex: 1 1 auto;
187
+ padding: 0px 24px;
188
+ overflow-y: auto;
189
+ -webkit-overflow-scrolling: touch;
190
+ }
191
+
192
+ .MuiDialogContent-root:first-child {
193
+ padding-top: 20px;
194
+ }
195
+
196
+ .MuiDialogContent-dividers {
197
+ padding: 16px 24px;
198
+ border-top: 1px solid Color.Silver400;
199
+ border-bottom: 1px solid Color.Silver400;
200
+ }
201
+
202
+ .MuiDialogTitle-root {
203
+ flex: 0 0 auto;
204
+ margin: 0;
205
+ padding: 16px 24px;
206
+ font-size: 20px;
207
+ font-family: 'Inter', sans-serif;
208
+ font-weight: 500;
209
+ line-height: 28px;
210
+ }
211
+
212
+ @media (min-width: 0px) and (max-width: 599.95px) {
213
+ .MuiDialogTitle-root {
214
+ font-size: 20px;
215
+ line-height: 26px;
216
+ }
217
+ }
218
+ `);
219
+ });
@@ -0,0 +1,22 @@
1
+ import { Drawer as MuiDrawer, DrawerProps } from '@material-ui/core';
2
+ import { forwardRef } from 'react';
3
+
4
+ export const Drawer = forwardRef<HTMLDivElement, DrawerProps>(
5
+ (
6
+ {
7
+ disableAutoFocus = true,
8
+ disableEnforceFocus = true,
9
+ disableRestoreFocus = true,
10
+ ...props
11
+ },
12
+ ref,
13
+ ) => (
14
+ <MuiDrawer
15
+ {...props}
16
+ ref={ref}
17
+ disableAutoFocus={disableAutoFocus}
18
+ disableEnforceFocus={disableEnforceFocus}
19
+ disableRestoreFocus={disableRestoreFocus}
20
+ />
21
+ ),
22
+ );