@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,426 @@
1
+ import { IconButton, Link } from '@material-ui/core';
2
+ import EditIcon from '@material-ui/icons/Edit';
3
+ import RoomIcon from '@material-ui/icons/Room';
4
+ import { Meta } from '@storybook/react';
5
+ import { Placeholder } from '@superdispatch/ui-docs';
6
+ import { Box } from '@superdispatch/ui-lab';
7
+ import { OverflowText } from '../overflow-text/OverflowText';
8
+ import { Stack } from '../stack/Stack';
9
+ import { Column } from './Column';
10
+ import { Columns } from './Columns';
11
+
12
+ export default {
13
+ title: 'Layout/Columns',
14
+ component: Columns,
15
+ subcomponents: { Column },
16
+ decorators: [
17
+ (Story) => (
18
+ <Box
19
+ maxWidth="320px"
20
+ padding="xxsmall"
21
+ borderRadius="small"
22
+ backgroundColor="Silver100"
23
+ >
24
+ <Story />
25
+ </Box>
26
+ ),
27
+ ],
28
+ parameters: {
29
+ componentSubtitle: (
30
+ <>
31
+ Heavily inspired by the{' '}
32
+ <Link href="https://seek-oss.github.io/braid-design-system/components/Column">
33
+ Column
34
+ </Link>{' '}
35
+ and{' '}
36
+ <Link href="https://seek-oss.github.io/braid-design-system/components/Columns">
37
+ Columns
38
+ </Link>{' '}
39
+ components from the{' '}
40
+ <Link href="https://seek-oss.github.io/braid-design-system">
41
+ BRAID Design System
42
+ </Link>
43
+ .
44
+ </>
45
+ ),
46
+ },
47
+ } as Meta;
48
+
49
+ export const noSpace = () => (
50
+ <Columns>
51
+ <Column>
52
+ <Placeholder height={48} text="First" />
53
+ </Column>
54
+
55
+ <Column>
56
+ <Placeholder height={48} text="Second" />
57
+ </Column>
58
+ </Columns>
59
+ );
60
+
61
+ export const customSpace = () => (
62
+ <Columns space="xsmall">
63
+ <Column>
64
+ <Placeholder height={48} text="First" />
65
+ </Column>
66
+
67
+ <Column>
68
+ <Placeholder height={48} text="Second" />
69
+ </Column>
70
+ </Columns>
71
+ );
72
+
73
+ export const responsiveSpace = () => (
74
+ <Columns space={['small', 'xsmall']}>
75
+ <Column>
76
+ <Placeholder height={48} text="First" />
77
+ </Column>
78
+
79
+ <Column>
80
+ <Placeholder height={48} text="Second" />
81
+ </Column>
82
+ </Columns>
83
+ );
84
+
85
+ export const alignment = () => (
86
+ <Columns space="xsmall" align="center">
87
+ <Column>
88
+ <Placeholder height={48} text="First" />
89
+ </Column>
90
+
91
+ <Column>
92
+ <Placeholder height={64} text="Second" />
93
+ </Column>
94
+ </Columns>
95
+ );
96
+
97
+ export const responsiveAlignment = () => (
98
+ <Columns space="xsmall" align={['top', 'center']}>
99
+ <Column>
100
+ <Placeholder height={48} text="First" />
101
+ </Column>
102
+
103
+ <Column>
104
+ <Placeholder height={64} text="Second" />
105
+ </Column>
106
+ </Columns>
107
+ );
108
+
109
+ export const reverse = () => (
110
+ <Columns space="xsmall" reverse={true}>
111
+ <Column>
112
+ <Placeholder height={48} text="First" />
113
+ </Column>
114
+
115
+ <Column>
116
+ <Placeholder height={48} text="Second" />
117
+ </Column>
118
+
119
+ <Column>
120
+ <Placeholder height={48} text="Third" />
121
+ </Column>
122
+ </Columns>
123
+ );
124
+
125
+ export const responsiveReverse = () => (
126
+ <Columns space="xsmall" reverse={[true, false]}>
127
+ <Column>
128
+ <Placeholder height={48} text="First" />
129
+ </Column>
130
+
131
+ <Column>
132
+ <Placeholder height={48} text="Second" />
133
+ </Column>
134
+
135
+ <Column>
136
+ <Placeholder height={48} text="Third" />
137
+ </Column>
138
+ </Columns>
139
+ );
140
+
141
+ export const collapseBelowTablet = () => (
142
+ <Columns space="xsmall" collapseBelow="tablet">
143
+ <Column width="1/2">
144
+ <Placeholder height={48} text="First" />
145
+ </Column>
146
+
147
+ <Column width="1/3">
148
+ <Placeholder height={48} text="Second" />
149
+ </Column>
150
+
151
+ <Column>
152
+ <Placeholder height={48} text="Third" />
153
+ </Column>
154
+ </Columns>
155
+ );
156
+
157
+ export const collapseBelowDesktop = () => (
158
+ <Columns space="xsmall" collapseBelow="desktop">
159
+ <Column width="1/2">
160
+ <Placeholder height={48} text="First" />
161
+ </Column>
162
+
163
+ <Column width="1/3">
164
+ <Placeholder height={48} text="Second" />
165
+ </Column>
166
+
167
+ <Column>
168
+ <Placeholder height={48} text="Third" />
169
+ </Column>
170
+ </Columns>
171
+ );
172
+
173
+ export const reverseAndCollapseBelowTablet = () => (
174
+ <Columns space="xsmall" collapseBelow="tablet" reverse={[true, false]}>
175
+ <Column>
176
+ <Placeholder height={48} text="First" />
177
+ </Column>
178
+
179
+ <Column>
180
+ <Placeholder height={48} text="Second" />
181
+ </Column>
182
+
183
+ <Column>
184
+ <Placeholder height={48} text="Third" />
185
+ </Column>
186
+ </Columns>
187
+ );
188
+
189
+ export const availableWidths = () => (
190
+ <Stack space="xsmall">
191
+ <Columns space="xsmall">
192
+ <Column width="adaptive">
193
+ <Placeholder height={48} text="Adaptive" />
194
+ </Column>
195
+
196
+ <Column>
197
+ <Placeholder height={48} text="Fluid" />
198
+ </Column>
199
+ </Columns>
200
+
201
+ <Columns space="xsmall">
202
+ <Column width="content">
203
+ <Placeholder height={48} text="Content" />
204
+ </Column>
205
+
206
+ <Column>
207
+ <Placeholder height={48} text="Fluid" />
208
+ </Column>
209
+ </Columns>
210
+
211
+ <Columns space="xsmall">
212
+ <Column width="adaptive">
213
+ <Placeholder height={48} text="Adaptive" />
214
+ </Column>
215
+
216
+ <Column width="content">
217
+ <Placeholder height={48} text="Content" />
218
+ </Column>
219
+
220
+ <Column>
221
+ <Placeholder height={48} text="Fluid" />
222
+ </Column>
223
+ </Columns>
224
+
225
+ <Columns space="xsmall">
226
+ <Column width="adaptive">
227
+ <Placeholder height={48} text="Adaptive" />
228
+ </Column>
229
+
230
+ <Column width="adaptive">
231
+ <Placeholder height={48} text="Adaptive" />
232
+ </Column>
233
+
234
+ <Column width="adaptive">
235
+ <Placeholder height={48} text="Adaptive" />
236
+ </Column>
237
+
238
+ <Column width="adaptive">
239
+ <Placeholder height={48} text="Adaptive" />
240
+ </Column>
241
+ </Columns>
242
+
243
+ <Columns space="xsmall">
244
+ <Column width="adaptive">
245
+ <Placeholder height={48} text="Adaptive" />
246
+ </Column>
247
+
248
+ <Column width="adaptive">
249
+ <Placeholder height={48} text="Adaptive" />
250
+ </Column>
251
+
252
+ <Column width="adaptive">
253
+ <Placeholder height={48} text="Adaptive" />
254
+ </Column>
255
+
256
+ <Column width="adaptive">
257
+ <Placeholder height={48} text="Adaptive" />
258
+ </Column>
259
+
260
+ <Column width="adaptive">
261
+ <Placeholder height={48} text="Adaptive" />
262
+ </Column>
263
+ </Columns>
264
+
265
+ <Columns space="xsmall">
266
+ <Column width="content">
267
+ <Placeholder height={48} text="Content" />
268
+ </Column>
269
+
270
+ <Column width="content">
271
+ <Placeholder height={48} text="Content" />
272
+ </Column>
273
+
274
+ <Column width="content">
275
+ <Placeholder height={48} text="Content" />
276
+ </Column>
277
+
278
+ <Column width="content">
279
+ <Placeholder height={48} text="Content" />
280
+ </Column>
281
+ </Columns>
282
+
283
+ <Columns space="xsmall">
284
+ <Column width="1/2">
285
+ <Placeholder height={48} text="1/2" />
286
+ </Column>
287
+
288
+ <Column>
289
+ <Placeholder height={48} text="Fluid" />
290
+ </Column>
291
+ </Columns>
292
+
293
+ <Columns space="xsmall">
294
+ <Column width="1/3">
295
+ <Placeholder height={48} text="1/3" />
296
+ </Column>
297
+
298
+ <Column>
299
+ <Placeholder height={48} text="Fluid" />
300
+ </Column>
301
+ </Columns>
302
+
303
+ <Columns space="xsmall">
304
+ <Column width="2/3">
305
+ <Placeholder height={48} text="2/3" />
306
+ </Column>
307
+
308
+ <Column>
309
+ <Placeholder height={48} text="Fluid" />
310
+ </Column>
311
+ </Columns>
312
+
313
+ <Columns space="xsmall">
314
+ <Column width="1/4">
315
+ <Placeholder height={48} text="1/4" />
316
+ </Column>
317
+
318
+ <Column>
319
+ <Placeholder height={48} text="Fluid" />
320
+ </Column>
321
+ </Columns>
322
+
323
+ <Columns space="xsmall">
324
+ <Column width="3/4">
325
+ <Placeholder height={48} text="3/4" />
326
+ </Column>
327
+
328
+ <Column>
329
+ <Placeholder height={48} text="Fluid" />
330
+ </Column>
331
+ </Columns>
332
+
333
+ <Columns space="xsmall">
334
+ <Column width="1/5">
335
+ <Placeholder height={48} text="1/5" />
336
+ </Column>
337
+
338
+ <Column>
339
+ <Placeholder height={48} text="Fluid" />
340
+ </Column>
341
+ </Columns>
342
+
343
+ <Columns space="xsmall">
344
+ <Column width="2/5">
345
+ <Placeholder height={48} text="2/5" />
346
+ </Column>
347
+
348
+ <Column>
349
+ <Placeholder height={48} text="Fluid" />
350
+ </Column>
351
+ </Columns>
352
+
353
+ <Columns space="xsmall">
354
+ <Column width="3/5">
355
+ <Placeholder height={48} text="3/5" />
356
+ </Column>
357
+
358
+ <Column>
359
+ <Placeholder height={48} text="Fluid" />
360
+ </Column>
361
+ </Columns>
362
+
363
+ <Columns space="xsmall">
364
+ <Column width="4/5">
365
+ <Placeholder height={48} text="4/5" />
366
+ </Column>
367
+
368
+ <Column>
369
+ <Placeholder height={48} text="Fluid" />
370
+ </Column>
371
+ </Columns>
372
+ </Stack>
373
+ );
374
+
375
+ export const responsiveWidths = () => (
376
+ <Columns space="xsmall">
377
+ <Column width={['1/2', '3/5']}>
378
+ <Placeholder
379
+ height={112}
380
+ code={JSON.stringify(['1/2', '3/5'], null, 2)}
381
+ />
382
+ </Column>
383
+
384
+ <Column>
385
+ <Placeholder height={112} text="Fluid" />
386
+ </Column>
387
+ </Columns>
388
+ );
389
+
390
+ export const overflowText = () => (
391
+ <Stack>
392
+ <Columns space="xsmall" align="center">
393
+ <Column width="content">
394
+ <RoomIcon color="action" />
395
+ </Column>
396
+
397
+ <Column width="adaptive">
398
+ <OverflowText>1617 Main St Fl 3</OverflowText>
399
+ </Column>
400
+
401
+ <Column width="content">
402
+ <IconButton size="small">
403
+ <EditIcon />
404
+ </IconButton>
405
+ </Column>
406
+ </Columns>
407
+
408
+ <Columns space="xsmall" align="center">
409
+ <Column width="content">
410
+ <RoomIcon color="action" />
411
+ </Column>
412
+
413
+ <Column width="adaptive">
414
+ <OverflowText>
415
+ 1617 Main St Fl 3 Kansas City, MO 64108-1326
416
+ </OverflowText>
417
+ </Column>
418
+
419
+ <Column width="content">
420
+ <IconButton size="small">
421
+ <EditIcon />
422
+ </IconButton>
423
+ </Column>
424
+ </Columns>
425
+ </Stack>
426
+ );
@@ -0,0 +1,76 @@
1
+ import { ForwardRefExoticComponent, ReactNode, Ref } from 'react';
2
+ import styled, { css, SimpleInterpolation } from 'styled-components';
3
+ import { parseAlignProp, VerticalAlign } from '../props/AlignProps';
4
+ import { CollapseProp, parseCollapsedBelow } from '../props/CollapseProp';
5
+ import { parseResponsiveProp, ResponsiveProp } from '../props/ResponsiveProp';
6
+ import { parseSpaceProp, SpaceProp } from '../props/SpaceProp';
7
+
8
+ function columnsRootMixin(
9
+ align: VerticalAlign,
10
+ spaceProp: SpaceProp,
11
+ isReversed: boolean,
12
+ isCollapsed: boolean,
13
+ ): readonly SimpleInterpolation[] {
14
+ const space = parseSpaceProp(spaceProp);
15
+
16
+ return css`
17
+ --column-space-left: ${isCollapsed ? 0 : space}px;
18
+ --column-space-top: ${isCollapsed && isReversed ? space : 0}px;
19
+ --column-space-bottom: ${isCollapsed && !isReversed ? space : 0}px;
20
+
21
+ align-items: ${parseAlignProp(align)};
22
+ margin-left: ${isCollapsed ? 0 : `-${space}`}px;
23
+ width: ${isCollapsed ? '100%' : `calc(100% + ${space}px)`};
24
+ flex-direction: ${isCollapsed
25
+ ? !isReversed
26
+ ? 'column'
27
+ : 'column-reverse'
28
+ : !isReversed
29
+ ? 'row'
30
+ : 'row-reverse'};
31
+ `;
32
+ }
33
+
34
+ export interface ColumnsProps {
35
+ id?: string;
36
+ children?: ReactNode;
37
+ 'aria-label'?: string;
38
+ 'aria-labelledby'?: string;
39
+ ref?: Ref<HTMLDivElement>;
40
+
41
+ reverse?: ResponsiveProp<boolean>;
42
+ space?: ResponsiveProp<SpaceProp>;
43
+ align?: ResponsiveProp<VerticalAlign>;
44
+ collapseBelow?: CollapseProp;
45
+ }
46
+
47
+ export const Columns: ForwardRefExoticComponent<ColumnsProps> =
48
+ styled.div<ColumnsProps>(
49
+ ({
50
+ theme,
51
+ collapseBelow,
52
+ align: alignProp = 'top',
53
+ space: spaceProp = 'none',
54
+ reverse: reverseProp = false,
55
+ }) => {
56
+ const align = parseResponsiveProp(alignProp);
57
+ const space = parseResponsiveProp(spaceProp);
58
+ const reverse = parseResponsiveProp(reverseProp);
59
+ const collapsed = parseCollapsedBelow(collapseBelow);
60
+
61
+ return css`
62
+ width: 100%;
63
+ display: flex;
64
+
65
+ ${columnsRootMixin(align[0], space[0], reverse[0], collapsed[0])};
66
+
67
+ ${theme.breakpoints.up('sm')} {
68
+ ${columnsRootMixin(align[1], space[1], reverse[1], collapsed[1])};
69
+ }
70
+
71
+ ${theme.breakpoints.up('md')} {
72
+ ${columnsRootMixin(align[2], space[2], reverse[2], collapsed[2])};
73
+ }
74
+ `;
75
+ },
76
+ );
@@ -0,0 +1,137 @@
1
+ import { renderComponent, renderCSS } from '@superdispatch/ui-testutils';
2
+ import { screen } from '@testing-library/react';
3
+ import { DescriptionList, DescriptionListItem } from './DescriptionList';
4
+
5
+ test('label id', () => {
6
+ renderComponent(
7
+ <DescriptionListItem
8
+ label="Label"
9
+ labelTypographyProps={{ id: 'label-id' }}
10
+ content="Text"
11
+ />,
12
+ );
13
+
14
+ expect(screen.getByLabelText('Label')).toMatchInlineSnapshot(`
15
+ <div
16
+ aria-labelledby="label-id"
17
+ class="SD-DescriptionList-item"
18
+ >
19
+ <span
20
+ class="MuiTypography-root SD-OverflowText-root MuiTypography-body2 MuiTypography-colorTextPrimary MuiTypography-noWrap"
21
+ title="Text"
22
+ >
23
+ <span
24
+ class="MuiTypography-root MuiTypography-body2 MuiTypography-colorTextSecondary"
25
+ id="label-id"
26
+ >
27
+ Label
28
+ </span>
29
+
30
+ Text
31
+ <span
32
+ class="SD-OverflowText-sentinel"
33
+ />
34
+ </span>
35
+ </div>
36
+ `);
37
+ });
38
+
39
+ test('dynamic label id', () => {
40
+ renderComponent(<DescriptionListItem label="Label" content="Text" />);
41
+
42
+ expect(screen.getByLabelText('Label')).toMatchInlineSnapshot(`
43
+ <div
44
+ aria-labelledby="uid_2"
45
+ class="SD-DescriptionList-item"
46
+ >
47
+ <span
48
+ class="MuiTypography-root SD-OverflowText-root MuiTypography-body2 MuiTypography-colorTextPrimary MuiTypography-noWrap"
49
+ title="Text"
50
+ >
51
+ <span
52
+ class="MuiTypography-root MuiTypography-body2 MuiTypography-colorTextSecondary"
53
+ id="uid_2"
54
+ >
55
+ Label
56
+ </span>
57
+
58
+ Text
59
+ <span
60
+ class="SD-OverflowText-sentinel"
61
+ />
62
+ </span>
63
+ </div>
64
+ `);
65
+ });
66
+
67
+ test('css', () => {
68
+ expect(
69
+ renderCSS(
70
+ <DescriptionList>
71
+ <DescriptionListItem />
72
+ <DescriptionListItem icon={<div />} />
73
+ <DescriptionListItem label={<div />} />
74
+ <DescriptionListItem content={<div />} />
75
+ <DescriptionListItem label={<div />} content={<div />} />
76
+ </DescriptionList>,
77
+ ['SD-DescriptionList'],
78
+ ),
79
+ ).toMatchInlineSnapshot(`
80
+ .SD-DescriptionList-list > .SD-DescriptionList-list:not(:last-child),
81
+ .SD-DescriptionList-list > .SD-DescriptionList-item:not(:last-child) {
82
+ padding-bottom: 16px;
83
+ }
84
+
85
+ @media (min-width: 600px) {
86
+ .SD-DescriptionList-list > .SD-DescriptionList-list:not(:last-child),
87
+ .SD-DescriptionList-list > .SD-DescriptionList-item:not(:last-child) {
88
+ padding-bottom: 8px;
89
+ }
90
+ }
91
+
92
+ .SD-DescriptionList-listSmall > .SD-DescriptionList-list:not(:last-child),
93
+ .SD-DescriptionList-listSmall > .SD-DescriptionList-item:not(:last-child) {
94
+ padding-bottom: 8px;
95
+ }
96
+
97
+ @media (min-width: 600px) {
98
+ .SD-DescriptionList-listSmall > .SD-DescriptionList-list:not(:last-child),
99
+ .SD-DescriptionList-listSmall > .SD-DescriptionList-item:not(:last-child) {
100
+ padding-bottom: 4px;
101
+ }
102
+ }
103
+
104
+ .SD-DescriptionList-listLarge > .SD-DescriptionList-list:not(:last-child),
105
+ .SD-DescriptionList-listLarge > .SD-DescriptionList-item:not(:last-child) {
106
+ padding-bottom: 24px;
107
+ }
108
+
109
+ @media (min-width: 600px) {
110
+ .SD-DescriptionList-listLarge > .SD-DescriptionList-list:not(:last-child),
111
+ .SD-DescriptionList-listLarge > .SD-DescriptionList-item:not(:last-child) {
112
+ padding-bottom: 16px;
113
+ }
114
+ }
115
+
116
+ .SD-DescriptionList-item {
117
+ display: flex;
118
+ align-items: center;
119
+ }
120
+
121
+ .SD-DescriptionList-icon {
122
+ display: inline-flex;
123
+ margin-right: 8px;
124
+ }
125
+
126
+ .SD-DescriptionList-icon > .MuiSvgIcon-root {
127
+ color: Color.Dark100;
128
+ font-size: 24px;
129
+ }
130
+
131
+ @media (min-width: 600px) {
132
+ .SD-DescriptionList-icon > .MuiSvgIcon-root {
133
+ font-size: 16px;
134
+ }
135
+ }
136
+ `);
137
+ });