@superdispatch/ui 0.21.13 → 0.22.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 (234) hide show
  1. package/LICENSE +21 -0
  2. package/{pkg/dist-node → dist-node}/index.js +73 -25
  3. package/dist-node/index.js.map +1 -0
  4. package/{pkg/dist-src → dist-src}/index.js +1 -0
  5. package/dist-src/info-tooltip/InfoTooltip.js +54 -0
  6. package/{pkg/dist-src → dist-src}/theme/Color.js +11 -11
  7. package/{pkg/dist-types → dist-types}/index.d.ts +53 -13
  8. package/{pkg/dist-web → dist-web}/index.js +75 -28
  9. package/dist-web/index.js.map +1 -0
  10. package/package.json +13 -39
  11. package/.babelrc.js +0 -5
  12. package/.turbo/turbo-version.log +0 -28
  13. package/pkg/README.md +0 -30
  14. package/pkg/dist-node/index.js.map +0 -1
  15. package/pkg/dist-web/index.js.map +0 -1
  16. package/pkg/package.json +0 -39
  17. package/playroom.ts +0 -31
  18. package/src/__tests__/index.spec.ts +0 -134
  19. package/src/adaptive-toolbar/AdaptiveToolbar.stories.tsx +0 -50
  20. package/src/adaptive-toolbar/AdaptiveToolbar.tsx +0 -199
  21. package/src/adaptive-toolbar/__tests__/AdaptiveToolbar.spec.tsx +0 -11
  22. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.stories.tsx +0 -49
  23. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.tsx +0 -171
  24. package/src/app-bar/AppBar.stories.tsx +0 -62
  25. package/src/app-bar/AppBarOverrides.ts +0 -9
  26. package/src/app-bar/__tests__/AppBar.spec.tsx +0 -86
  27. package/src/autocomplete/Autocomplete.stories.tsx +0 -76
  28. package/src/autocomplete/AutocompleteOverrides.tsx +0 -58
  29. package/src/autocomplete/__tests__/Autocomplete.spec.tsx +0 -323
  30. package/src/avatar/Avatar.stories.tsx +0 -17
  31. package/src/avatar/AvatarOverrides.ts +0 -24
  32. package/src/avatar/__tests__/Avatar.spec.tsx +0 -71
  33. package/src/avatar-button/AvatarButton.stories.tsx +0 -153
  34. package/src/avatar-button/AvatarButton.tsx +0 -223
  35. package/src/avatar-button/__tests__/AvatarButton.spec.tsx +0 -126
  36. package/src/button/Button.tsx +0 -51
  37. package/src/button/ButtonOverrides.ts +0 -375
  38. package/src/button/__tests__/Button.spec.tsx +0 -599
  39. package/src/card/Card.stories.tsx +0 -39
  40. package/src/card/CardOverrides.ts +0 -9
  41. package/src/card/__tests__/Card.spec.tsx +0 -68
  42. package/src/card-button/CardButton.stories.tsx +0 -36
  43. package/src/card-button/CardButton.tsx +0 -202
  44. package/src/card-button/__tests__/CardButton.spec.tsx +0 -95
  45. package/src/checkbox/CheckboxField.stories.tsx +0 -61
  46. package/src/checkbox/CheckboxField.tsx +0 -56
  47. package/src/checkbox/CheckboxGroudField.tsx +0 -53
  48. package/src/checkbox/CheckboxOverrides.tsx +0 -55
  49. package/src/checkbox/__tests__/Checkbox.spec.tsx +0 -105
  50. package/src/chip/Chip.stories.tsx +0 -26
  51. package/src/chip/ChipOverrides.tsx +0 -111
  52. package/src/chip/__tests__/Chip.spec.tsx +0 -308
  53. package/src/columns/Column.tsx +0 -124
  54. package/src/columns/Columns.stories.tsx +0 -426
  55. package/src/columns/Columns.tsx +0 -76
  56. package/src/description-list/DescriptionList.spec.tsx +0 -137
  57. package/src/description-list/DescriptionList.stories.tsx +0 -148
  58. package/src/description-list/DescriptionList.tsx +0 -170
  59. package/src/dialog/Dialog.playroom.tsx +0 -24
  60. package/src/dialog/Dialog.stories.tsx +0 -60
  61. package/src/dialog/DialogOverrides.ts +0 -39
  62. package/src/dialog/__tests__/Dialog.spec.tsx +0 -219
  63. package/src/drawer/Drawer.playroom.tsx +0 -22
  64. package/src/drawer/Drawer.stories.tsx +0 -194
  65. package/src/drawer/DrawerActions.tsx +0 -69
  66. package/src/drawer/DrawerContent.tsx +0 -30
  67. package/src/drawer/DrawerList.tsx +0 -60
  68. package/src/drawer/DrawerOverrides.ts +0 -19
  69. package/src/drawer/DrawerTitle.tsx +0 -143
  70. package/src/drawer/__tests__/Drawer.spec.tsx +0 -227
  71. package/src/dropdown-button/DropdownButton.stories.tsx +0 -15
  72. package/src/dropdown-button/DropdownButton.tsx +0 -131
  73. package/src/grid/GridStack.tsx +0 -45
  74. package/src/grid/InlineGrid.tsx +0 -56
  75. package/src/icon-button/IconButton.stories.tsx +0 -53
  76. package/src/icon-button/IconButtonOverrides.ts +0 -32
  77. package/src/icon-button/__tests__/IconButton.spec.tsx +0 -124
  78. package/src/index.ts +0 -47
  79. package/src/info-card/InfoCard.stories.tsx +0 -29
  80. package/src/info-card/InfoCard.tsx +0 -95
  81. package/src/info-card/__tests__/InfoCard.spec.tsx +0 -22
  82. package/src/info-tooltip/InfoTooltip.stories.tsx +0 -77
  83. package/src/info-tooltip/InfoTooltip.tsx +0 -72
  84. package/src/info-tooltip/__tests__/InfoTooltip.spec.tsx +0 -166
  85. package/src/inline/Inline.stories.tsx +0 -135
  86. package/src/inline/Inline.tsx +0 -144
  87. package/src/link/Link.stories.tsx +0 -41
  88. package/src/link/LinkOverrides.ts +0 -43
  89. package/src/link/__tests__/Link.spec.tsx +0 -98
  90. package/src/list/ListOverrides.ts +0 -11
  91. package/src/list/__tests__/List.spec.tsx +0 -182
  92. package/src/menu/Menu.stories.tsx +0 -35
  93. package/src/menu/MenuOverrides.ts +0 -17
  94. package/src/menu/__tests__/Menu.spec.tsx +0 -99
  95. package/src/number-field/NumberField.stories.tsx +0 -123
  96. package/src/number-field/NumberField.tsx +0 -98
  97. package/src/overflow-text/OverflowText.stories.tsx +0 -32
  98. package/src/overflow-text/OverflowText.tsx +0 -114
  99. package/src/overflow-text/__tests__/OverflowText.spec.tsx +0 -24
  100. package/src/pagination/Pagination.stories.tsx +0 -36
  101. package/src/pagination/PaginationOverrides.ts +0 -47
  102. package/src/pagination/__tests__/Pagination.spec.tsx +0 -228
  103. package/src/paper/PaperOverrides.ts +0 -10
  104. package/src/paper/__tests__/Paper.spec.tsx +0 -155
  105. package/src/props/AlignProps.ts +0 -22
  106. package/src/props/CollapseProp.ts +0 -13
  107. package/src/props/ResponsiveProp.ts +0 -65
  108. package/src/props/SpaceProp.ts +0 -40
  109. package/src/radio/RadioField.stories.tsx +0 -42
  110. package/src/radio/RadioField.tsx +0 -55
  111. package/src/radio/RadioGroupField.tsx +0 -64
  112. package/src/radio/RadioOverrides.tsx +0 -51
  113. package/src/radio/__tests__/Radio.spec.tsx +0 -90
  114. package/src/responsive/CollapseBreakpoint.ts +0 -21
  115. package/src/responsive/MinBreakpoint.ts +0 -21
  116. package/src/responsive/ResponsiveContext.tsx +0 -57
  117. package/src/snackbar/Snackbar.stories.tsx +0 -196
  118. package/src/snackbar/Snackbar.tsx +0 -83
  119. package/src/snackbar/SnackbarContent.tsx +0 -147
  120. package/src/snackbar/SnackbarOverrides.ts +0 -23
  121. package/src/snackbar/SnackbarStack.tsx +0 -160
  122. package/src/snackbar/__tests__/Snackbar.spec.tsx +0 -196
  123. package/src/stack/Stack.stories.tsx +0 -113
  124. package/src/stack/Stack.tsx +0 -86
  125. package/src/svg-icon/SvgIcon.stories.tsx +0 -29
  126. package/src/svg-icon/SvgIconOverrides.ts +0 -32
  127. package/src/svg-icon/__tests__/SvgIcon.spec.tsx +0 -67
  128. package/src/switch/Switch.stories.tsx +0 -60
  129. package/src/switch/SwitchOverrides.ts +0 -88
  130. package/src/switch/__tests__/Switch.spec.tsx +0 -204
  131. package/src/tabs/Tabs.stories.tsx +0 -40
  132. package/src/tabs/TabsOverrides.ts +0 -45
  133. package/src/tabs/__tests__/Tabs.spec.tsx +0 -226
  134. package/src/tag/Tag.stories.tsx +0 -53
  135. package/src/tag/Tag.tsx +0 -130
  136. package/src/tag/__tests__/Tag.spec.tsx +0 -82
  137. package/src/text-field/TextField.stories.tsx +0 -50
  138. package/src/text-field/TextFieldOverrides.tsx +0 -149
  139. package/src/text-field/__tests__/TextField.spec.tsx +0 -662
  140. package/src/theme/Color.ts +0 -117
  141. package/src/theme/SuperDispatchTheme.ts +0 -3
  142. package/src/theme/ThemeProvider.tsx +0 -179
  143. package/src/theme/__tests__/CssBaseline.spec.tsx +0 -49
  144. package/src/theme/__tests__/ThemeProvider.spec.ts +0 -40
  145. package/src/theme/__tests__/__snapshots__/ThemeProvider.spec.ts.snap +0 -204
  146. package/src/tiles/Tiles.stories.tsx +0 -69
  147. package/src/tiles/Tiles.tsx +0 -163
  148. package/src/tiles/__tests__/Tiles.spec.tsx +0 -221
  149. package/src/toolbar/ToolbarOverrides.ts +0 -14
  150. package/src/toolbar/__tests__/Toolbar.spec.tsx +0 -50
  151. package/src/tooltip/Tooltip.stories.tsx +0 -32
  152. package/src/tooltip/TooltipOverrides.ts +0 -34
  153. package/src/tooltip/__tests__/Tooltip.spec.tsx +0 -182
  154. package/src/typography/Typography.stories.tsx +0 -132
  155. package/src/typography/TypographyOverrides.ts +0 -125
  156. package/src/typography/__tests__/Typography.spec.tsx +0 -253
  157. package/src/utils/ExitTransitionPlaceholder.tsx +0 -22
  158. package/src/utils/ResizeObserver.tsx +0 -28
  159. package/src/utils/VisibilityObserver.tsx +0 -75
  160. package/src/utils/__tests__/ExitTransitionPlaceholder.spec.tsx +0 -34
  161. package/src/utils/isEmptyReactNode.ts +0 -11
  162. package/src/utils/mergeRefs.ts +0 -21
  163. package/src/utils/renderChildren.ts +0 -10
  164. package/src/utils/useUID.ts +0 -9
  165. package/tsconfig.json +0 -19
  166. /package/{pkg/dist-src → dist-src}/adaptive-toolbar/AdaptiveToolbar.js +0 -0
  167. /package/{pkg/dist-src → dist-src}/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +0 -0
  168. /package/{pkg/dist-src → dist-src}/app-bar/AppBarOverrides.js +0 -0
  169. /package/{pkg/dist-src → dist-src}/autocomplete/AutocompleteOverrides.js +0 -0
  170. /package/{pkg/dist-src → dist-src}/avatar/AvatarOverrides.js +0 -0
  171. /package/{pkg/dist-src → dist-src}/avatar-button/AvatarButton.js +0 -0
  172. /package/{pkg/dist-src → dist-src}/button/Button.js +0 -0
  173. /package/{pkg/dist-src → dist-src}/button/ButtonOverrides.js +0 -0
  174. /package/{pkg/dist-src → dist-src}/card/CardOverrides.js +0 -0
  175. /package/{pkg/dist-src → dist-src}/card-button/CardButton.js +0 -0
  176. /package/{pkg/dist-src → dist-src}/checkbox/CheckboxField.js +0 -0
  177. /package/{pkg/dist-src → dist-src}/checkbox/CheckboxGroudField.js +0 -0
  178. /package/{pkg/dist-src → dist-src}/checkbox/CheckboxOverrides.js +0 -0
  179. /package/{pkg/dist-src → dist-src}/chip/ChipOverrides.js +0 -0
  180. /package/{pkg/dist-src → dist-src}/columns/Column.js +0 -0
  181. /package/{pkg/dist-src → dist-src}/columns/Columns.js +0 -0
  182. /package/{pkg/dist-src → dist-src}/description-list/DescriptionList.js +0 -0
  183. /package/{pkg/dist-src → dist-src}/dialog/DialogOverrides.js +0 -0
  184. /package/{pkg/dist-src → dist-src}/drawer/DrawerActions.js +0 -0
  185. /package/{pkg/dist-src → dist-src}/drawer/DrawerContent.js +0 -0
  186. /package/{pkg/dist-src → dist-src}/drawer/DrawerList.js +0 -0
  187. /package/{pkg/dist-src → dist-src}/drawer/DrawerOverrides.js +0 -0
  188. /package/{pkg/dist-src → dist-src}/drawer/DrawerTitle.js +0 -0
  189. /package/{pkg/dist-src → dist-src}/dropdown-button/DropdownButton.js +0 -0
  190. /package/{pkg/dist-src → dist-src}/grid/GridStack.js +0 -0
  191. /package/{pkg/dist-src → dist-src}/grid/InlineGrid.js +0 -0
  192. /package/{pkg/dist-src → dist-src}/icon-button/IconButtonOverrides.js +0 -0
  193. /package/{pkg/dist-src → dist-src}/info-card/InfoCard.js +0 -0
  194. /package/{pkg/dist-src → dist-src}/inline/Inline.js +0 -0
  195. /package/{pkg/dist-src → dist-src}/link/LinkOverrides.js +0 -0
  196. /package/{pkg/dist-src → dist-src}/list/ListOverrides.js +0 -0
  197. /package/{pkg/dist-src → dist-src}/menu/MenuOverrides.js +0 -0
  198. /package/{pkg/dist-src → dist-src}/number-field/NumberField.js +0 -0
  199. /package/{pkg/dist-src → dist-src}/overflow-text/OverflowText.js +0 -0
  200. /package/{pkg/dist-src → dist-src}/pagination/PaginationOverrides.js +0 -0
  201. /package/{pkg/dist-src → dist-src}/paper/PaperOverrides.js +0 -0
  202. /package/{pkg/dist-src → dist-src}/props/AlignProps.js +0 -0
  203. /package/{pkg/dist-src → dist-src}/props/CollapseProp.js +0 -0
  204. /package/{pkg/dist-src → dist-src}/props/ResponsiveProp.js +0 -0
  205. /package/{pkg/dist-src → dist-src}/props/SpaceProp.js +0 -0
  206. /package/{pkg/dist-src → dist-src}/radio/RadioField.js +0 -0
  207. /package/{pkg/dist-src → dist-src}/radio/RadioGroupField.js +0 -0
  208. /package/{pkg/dist-src → dist-src}/radio/RadioOverrides.js +0 -0
  209. /package/{pkg/dist-src → dist-src}/responsive/CollapseBreakpoint.js +0 -0
  210. /package/{pkg/dist-src → dist-src}/responsive/MinBreakpoint.js +0 -0
  211. /package/{pkg/dist-src → dist-src}/responsive/ResponsiveContext.js +0 -0
  212. /package/{pkg/dist-src → dist-src}/snackbar/Snackbar.js +0 -0
  213. /package/{pkg/dist-src → dist-src}/snackbar/SnackbarContent.js +0 -0
  214. /package/{pkg/dist-src → dist-src}/snackbar/SnackbarOverrides.js +0 -0
  215. /package/{pkg/dist-src → dist-src}/snackbar/SnackbarStack.js +0 -0
  216. /package/{pkg/dist-src → dist-src}/stack/Stack.js +0 -0
  217. /package/{pkg/dist-src → dist-src}/svg-icon/SvgIconOverrides.js +0 -0
  218. /package/{pkg/dist-src → dist-src}/switch/SwitchOverrides.js +0 -0
  219. /package/{pkg/dist-src → dist-src}/tabs/TabsOverrides.js +0 -0
  220. /package/{pkg/dist-src → dist-src}/tag/Tag.js +0 -0
  221. /package/{pkg/dist-src → dist-src}/text-field/TextFieldOverrides.js +0 -0
  222. /package/{pkg/dist-src → dist-src}/theme/SuperDispatchTheme.js +0 -0
  223. /package/{pkg/dist-src → dist-src}/theme/ThemeProvider.js +0 -0
  224. /package/{pkg/dist-src → dist-src}/tiles/Tiles.js +0 -0
  225. /package/{pkg/dist-src → dist-src}/toolbar/ToolbarOverrides.js +0 -0
  226. /package/{pkg/dist-src → dist-src}/tooltip/TooltipOverrides.js +0 -0
  227. /package/{pkg/dist-src → dist-src}/typography/TypographyOverrides.js +0 -0
  228. /package/{pkg/dist-src → dist-src}/utils/ExitTransitionPlaceholder.js +0 -0
  229. /package/{pkg/dist-src → dist-src}/utils/ResizeObserver.js +0 -0
  230. /package/{pkg/dist-src → dist-src}/utils/VisibilityObserver.js +0 -0
  231. /package/{pkg/dist-src → dist-src}/utils/isEmptyReactNode.js +0 -0
  232. /package/{pkg/dist-src → dist-src}/utils/mergeRefs.js +0 -0
  233. /package/{pkg/dist-src → dist-src}/utils/renderChildren.js +0 -0
  234. /package/{pkg/dist-src → dist-src}/utils/useUID.js +0 -0
@@ -1,132 +0,0 @@
1
- import { Typography } from '@material-ui/core';
2
- import { PropsLink } from '@superdispatch/ui-docs';
3
- import { Stack } from '../stack/Stack';
4
-
5
- export default {
6
- title: 'Data Display/Typography',
7
- parameters: {
8
- componentSubtitle: (
9
- <PropsLink url="https://material-ui.com/api/typography/#props" />
10
- ),
11
- },
12
- };
13
-
14
- export const basic = () => (
15
- <Stack>
16
- <Typography variant="h1">h1</Typography>
17
- <Typography variant="h2">h2</Typography>
18
- <Typography variant="h3">h3</Typography>
19
- <Typography variant="h4">h4</Typography>
20
- <Typography variant="h5">h5</Typography>
21
- <Typography variant="h6">h6</Typography>
22
- <Typography variant="subtitle1">subtitle1</Typography>
23
- <Typography variant="subtitle2">subtitle2</Typography>
24
- <Typography variant="body1">body1</Typography>
25
- <Typography variant="body2">body2</Typography>
26
- </Stack>
27
- );
28
-
29
- export const secondary = () => (
30
- <Stack>
31
- <Typography variant="h1" color="textSecondary">
32
- h1
33
- </Typography>
34
- <Typography variant="h2" color="textSecondary">
35
- h2
36
- </Typography>
37
- <Typography variant="h3" color="textSecondary">
38
- h3
39
- </Typography>
40
- <Typography variant="h4" color="textSecondary">
41
- h4
42
- </Typography>
43
- <Typography variant="h5" color="textSecondary">
44
- h5
45
- </Typography>
46
- <Typography variant="h6" color="textSecondary">
47
- h6
48
- </Typography>
49
- <Typography variant="subtitle1" color="textSecondary">
50
- subtitle1
51
- </Typography>
52
- <Typography variant="subtitle2" color="textSecondary">
53
- subtitle2
54
- </Typography>
55
- <Typography variant="body1" color="textSecondary">
56
- body1
57
- </Typography>
58
- <Typography variant="body2" color="textSecondary">
59
- body2
60
- </Typography>
61
- </Stack>
62
- );
63
-
64
- export const primary = () => (
65
- <Stack>
66
- <Typography variant="h1" color="textPrimary">
67
- h1
68
- </Typography>
69
- <Typography variant="h2" color="textPrimary">
70
- h2
71
- </Typography>
72
- <Typography variant="h3" color="textPrimary">
73
- h3
74
- </Typography>
75
- <Typography variant="h4" color="textPrimary">
76
- h4
77
- </Typography>
78
- <Typography variant="h5" color="textPrimary">
79
- h5
80
- </Typography>
81
- <Typography variant="h6" color="textPrimary">
82
- h6
83
- </Typography>
84
- <Typography variant="subtitle1" color="textPrimary">
85
- subtitle1
86
- </Typography>
87
- <Typography variant="subtitle2" color="textPrimary">
88
- subtitle2
89
- </Typography>
90
- <Typography variant="body1" color="textPrimary">
91
- body1
92
- </Typography>
93
- <Typography variant="body2" color="textPrimary">
94
- body2
95
- </Typography>
96
- </Stack>
97
- );
98
-
99
- export const error = () => (
100
- <Stack>
101
- <Typography variant="h1" color="error">
102
- h1
103
- </Typography>
104
- <Typography variant="h2" color="error">
105
- h2
106
- </Typography>
107
- <Typography variant="h3" color="error">
108
- h3
109
- </Typography>
110
- <Typography variant="h4" color="error">
111
- h4
112
- </Typography>
113
- <Typography variant="h5" color="error">
114
- h5
115
- </Typography>
116
- <Typography variant="h6" color="error">
117
- h6
118
- </Typography>
119
- <Typography variant="subtitle1" color="error">
120
- subtitle1
121
- </Typography>
122
- <Typography variant="subtitle2" color="error">
123
- subtitle2
124
- </Typography>
125
- <Typography variant="body1" color="error">
126
- body1
127
- </Typography>
128
- <Typography variant="body2" color="error">
129
- body2
130
- </Typography>
131
- </Stack>
132
- );
@@ -1,125 +0,0 @@
1
- import { Breakpoints } from '@material-ui/core/styles/createBreakpoints';
2
- import { TypographyOptions } from '@material-ui/core/styles/createTypography';
3
- import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
4
-
5
- export function createTypographyOptions(
6
- breakpoints: Breakpoints,
7
- ): TypographyOptions {
8
- const xsOnly = breakpoints.only('xs');
9
-
10
- return {
11
- fontSize: 14,
12
- fontWeightLight: 300,
13
- fontWeightRegular: 400,
14
- fontWeightMedium: 500,
15
- fontWeightBold: 600,
16
- fontFamily: '"Inter", sans-serif',
17
-
18
- h1: {
19
- fontSize: '32px',
20
- lineHeight: '40px',
21
- fontWeight: 700,
22
- [xsOnly]: {
23
- fontSize: '28px',
24
- lineHeight: '36px',
25
- },
26
- },
27
-
28
- h2: {
29
- fontSize: '24px',
30
- lineHeight: '28px',
31
- fontWeight: 500,
32
- [xsOnly]: {
33
- fontSize: '22px',
34
- lineHeight: '26px',
35
- },
36
- },
37
-
38
- h3: {
39
- fontSize: '20px',
40
- lineHeight: '28px',
41
- fontWeight: 500,
42
- [xsOnly]: {
43
- fontSize: '20px',
44
- lineHeight: '26px',
45
- },
46
- },
47
-
48
- h4: {
49
- fontSize: '16px',
50
- lineHeight: '24px',
51
- fontWeight: 500,
52
- [xsOnly]: {
53
- fontSize: '17px',
54
- lineHeight: '26px',
55
- },
56
- },
57
-
58
- h5: {
59
- fontSize: '14px',
60
- lineHeight: '20px',
61
- fontWeight: 600,
62
- [xsOnly]: {
63
- fontSize: '16px',
64
- lineHeight: '24px',
65
- },
66
- },
67
-
68
- h6: {
69
- fontSize: '12px',
70
- lineHeight: '16px',
71
- fontWeight: 700,
72
- letterSpacing: '0.1em',
73
- textTransform: 'uppercase',
74
- [xsOnly]: {
75
- fontSize: '14px',
76
- lineHeight: '20px',
77
- },
78
- },
79
-
80
- body1: {
81
- fontSize: '14px',
82
- lineHeight: '20px',
83
- fontWeight: 600,
84
- [xsOnly]: {
85
- fontSize: '16px',
86
- lineHeight: '24px',
87
- },
88
- },
89
-
90
- body2: {
91
- fontSize: '14px',
92
- lineHeight: '20px',
93
- fontWeight: 400,
94
- [xsOnly]: {
95
- fontSize: '16px',
96
- lineHeight: '24px',
97
- },
98
- },
99
-
100
- caption: {
101
- fontSize: '12px',
102
- lineHeight: '16px',
103
- fontWeight: 400,
104
- [xsOnly]: {
105
- fontSize: '14px',
106
- lineHeight: '20px',
107
- },
108
- },
109
-
110
- button: {
111
- fontSize: '14px',
112
- lineHeight: '20px',
113
- fontWeight: 600,
114
- textTransform: undefined,
115
- [xsOnly]: {
116
- fontSize: '16px',
117
- lineHeight: '24px',
118
- },
119
- },
120
- };
121
- }
122
-
123
- export function overrideTypography(theme: SuperDispatchTheme): void {
124
- theme.props.MuiTypography = { variant: 'body2' };
125
- }
@@ -1,253 +0,0 @@
1
- import { Typography } from '@material-ui/core';
2
- import { renderCSS, renderTheme } from '@superdispatch/ui-testutils';
3
-
4
- it('checks default props', () => {
5
- const { props } = renderTheme();
6
-
7
- expect(props.MuiTypography).toMatchInlineSnapshot(`
8
- Object {
9
- "variant": "body2",
10
- }
11
- `);
12
- });
13
-
14
- it('checks component css', () => {
15
- expect(renderCSS(<Typography />, ['MuiTypography'])).toMatchInlineSnapshot(`
16
- .MuiTypography-root {
17
- margin: 0;
18
- }
19
-
20
- .MuiTypography-body2 {
21
- font-size: 14px;
22
- font-family: 'Inter', sans-serif;
23
- font-weight: 400;
24
- line-height: 20px;
25
- }
26
-
27
- @media (min-width: 0px) and (max-width: 599.95px) {
28
- .MuiTypography-body2 {
29
- font-size: 16px;
30
- line-height: 24px;
31
- }
32
- }
33
-
34
- .MuiTypography-body1 {
35
- font-size: 14px;
36
- font-family: 'Inter', sans-serif;
37
- font-weight: 600;
38
- line-height: 20px;
39
- }
40
-
41
- @media (min-width: 0px) and (max-width: 599.95px) {
42
- .MuiTypography-body1 {
43
- font-size: 16px;
44
- line-height: 24px;
45
- }
46
- }
47
-
48
- .MuiTypography-caption {
49
- font-size: 12px;
50
- font-family: 'Inter', sans-serif;
51
- font-weight: 400;
52
- line-height: 16px;
53
- }
54
-
55
- @media (min-width: 0px) and (max-width: 599.95px) {
56
- .MuiTypography-caption {
57
- font-size: 14px;
58
- line-height: 20px;
59
- }
60
- }
61
-
62
- .MuiTypography-button {
63
- font-size: 14px;
64
- font-family: 'Inter', sans-serif;
65
- font-weight: 600;
66
- line-height: 20px;
67
- }
68
-
69
- @media (min-width: 0px) and (max-width: 599.95px) {
70
- .MuiTypography-button {
71
- font-size: 16px;
72
- line-height: 24px;
73
- }
74
- }
75
-
76
- .MuiTypography-h1 {
77
- font-size: 32px;
78
- font-family: 'Inter', sans-serif;
79
- font-weight: 700;
80
- line-height: 40px;
81
- }
82
-
83
- @media (min-width: 0px) and (max-width: 599.95px) {
84
- .MuiTypography-h1 {
85
- font-size: 28px;
86
- line-height: 36px;
87
- }
88
- }
89
-
90
- .MuiTypography-h2 {
91
- font-size: 24px;
92
- font-family: 'Inter', sans-serif;
93
- font-weight: 500;
94
- line-height: 28px;
95
- }
96
-
97
- @media (min-width: 0px) and (max-width: 599.95px) {
98
- .MuiTypography-h2 {
99
- font-size: 22px;
100
- line-height: 26px;
101
- }
102
- }
103
-
104
- .MuiTypography-h3 {
105
- font-size: 20px;
106
- font-family: 'Inter', sans-serif;
107
- font-weight: 500;
108
- line-height: 28px;
109
- }
110
-
111
- @media (min-width: 0px) and (max-width: 599.95px) {
112
- .MuiTypography-h3 {
113
- font-size: 20px;
114
- line-height: 26px;
115
- }
116
- }
117
-
118
- .MuiTypography-h4 {
119
- font-size: 16px;
120
- font-family: 'Inter', sans-serif;
121
- font-weight: 500;
122
- line-height: 24px;
123
- }
124
-
125
- @media (min-width: 0px) and (max-width: 599.95px) {
126
- .MuiTypography-h4 {
127
- font-size: 17px;
128
- line-height: 26px;
129
- }
130
- }
131
-
132
- .MuiTypography-h5 {
133
- font-size: 14px;
134
- font-family: 'Inter', sans-serif;
135
- font-weight: 600;
136
- line-height: 20px;
137
- }
138
-
139
- @media (min-width: 0px) and (max-width: 599.95px) {
140
- .MuiTypography-h5 {
141
- font-size: 16px;
142
- line-height: 24px;
143
- }
144
- }
145
-
146
- .MuiTypography-h6 {
147
- font-size: 12px;
148
- font-family: 'Inter', sans-serif;
149
- font-weight: 700;
150
- line-height: 16px;
151
- letter-spacing: 0.1em;
152
- text-transform: uppercase;
153
- }
154
-
155
- @media (min-width: 0px) and (max-width: 599.95px) {
156
- .MuiTypography-h6 {
157
- font-size: 14px;
158
- line-height: 20px;
159
- }
160
- }
161
-
162
- .MuiTypography-subtitle1 {
163
- font-size: 1rem;
164
- font-family: 'Inter', sans-serif;
165
- font-weight: 400;
166
- line-height: 1.75;
167
- }
168
-
169
- .MuiTypography-subtitle2 {
170
- font-size: 0.875rem;
171
- font-family: 'Inter', sans-serif;
172
- font-weight: 500;
173
- line-height: 1.57;
174
- }
175
-
176
- .MuiTypography-overline {
177
- font-size: 0.75rem;
178
- font-family: 'Inter', sans-serif;
179
- font-weight: 400;
180
- line-height: 2.66;
181
- text-transform: uppercase;
182
- }
183
-
184
- .MuiTypography-srOnly {
185
- width: 1px;
186
- height: 1px;
187
- overflow: hidden;
188
- position: absolute;
189
- }
190
-
191
- .MuiTypography-alignLeft {
192
- text-align: left;
193
- }
194
-
195
- .MuiTypography-alignCenter {
196
- text-align: center;
197
- }
198
-
199
- .MuiTypography-alignRight {
200
- text-align: right;
201
- }
202
-
203
- .MuiTypography-alignJustify {
204
- text-align: justify;
205
- }
206
-
207
- .MuiTypography-noWrap {
208
- overflow: hidden;
209
- white-space: nowrap;
210
- text-overflow: ellipsis;
211
- }
212
-
213
- .MuiTypography-gutterBottom {
214
- margin-bottom: 0.35em;
215
- }
216
-
217
- .MuiTypography-paragraph {
218
- margin-bottom: 16px;
219
- }
220
-
221
- .MuiTypography-colorInherit {
222
- color: inherit;
223
- }
224
-
225
- .MuiTypography-colorPrimary {
226
- color: Color.Blue300;
227
- }
228
-
229
- .MuiTypography-colorSecondary {
230
- color: #f50057;
231
- }
232
-
233
- .MuiTypography-colorTextPrimary {
234
- color: Color.Dark500;
235
- }
236
-
237
- .MuiTypography-colorTextSecondary {
238
- color: Color.Dark200;
239
- }
240
-
241
- .MuiTypography-colorError {
242
- color: Color.Red300;
243
- }
244
-
245
- .MuiTypography-displayInline {
246
- display: inline;
247
- }
248
-
249
- .MuiTypography-displayBlock {
250
- display: block;
251
- }
252
- `);
253
- });
@@ -1,22 +0,0 @@
1
- import { ReactElement, ReactNode, useEffect, useState } from 'react';
2
- import { renderChildren } from './renderChildren';
3
-
4
- interface ExitTransitionPlaceholderProps {
5
- in: boolean;
6
- children: ReactNode;
7
- }
8
-
9
- export function ExitTransitionPlaceholder({
10
- in: inProp,
11
- children: childrenProp,
12
- }: ExitTransitionPlaceholderProps): null | ReactElement {
13
- const [children, setChildren] = useState(childrenProp);
14
-
15
- useEffect(() => {
16
- if (inProp) {
17
- setChildren(childrenProp);
18
- }
19
- }, [inProp, childrenProp]);
20
-
21
- return renderChildren(children);
22
- }
@@ -1,28 +0,0 @@
1
- import { ResizeObserver } from '@juggle/resize-observer';
2
- import { useEventHandler } from '@superdispatch/hooks';
3
- import { useLayoutEffect } from 'react';
4
-
5
- export function useResizeObserver<T extends HTMLElement>(
6
- node: null | undefined | T,
7
- observer: (node: T) => void,
8
- ): void {
9
- const handler = useEventHandler(observer);
10
-
11
- useLayoutEffect(() => {
12
- if (!node) {
13
- return;
14
- }
15
-
16
- const resizeObserver = new ResizeObserver(() => {
17
- handler(node);
18
- });
19
-
20
- resizeObserver.observe(node);
21
-
22
- handler(node);
23
-
24
- return () => {
25
- resizeObserver.disconnect();
26
- };
27
- }, [node, handler]);
28
- }
@@ -1,75 +0,0 @@
1
- import { useValueObserver } from '@superdispatch/hooks';
2
- import { ReactElement, ReactNode, useLayoutEffect, useState } from 'react';
3
- import { renderChildren } from './renderChildren';
4
-
5
- export type ElementVisibility = 'undetermined' | 'visible' | 'invisible';
6
-
7
- export interface VisibilityObserverOptions {
8
- threshold?: number;
9
- marginTop?: string;
10
- marginLeft?: string;
11
- marginRight?: string;
12
- marginBottom?: string;
13
- }
14
-
15
- export function useVisibilityObserver<T extends Element>(
16
- node: null | undefined | T,
17
- {
18
- threshold = 0,
19
- marginTop = '0px',
20
- marginLeft = '0px',
21
- marginRight = '0px',
22
- marginBottom = '0px',
23
- }: VisibilityObserverOptions = {},
24
- ): ElementVisibility {
25
- const [state, setState] = useState<ElementVisibility>('undetermined');
26
- const rootMargin = `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`;
27
-
28
- useLayoutEffect(() => {
29
- if (!node || !('IntersectionObserver' in window)) {
30
- setState('undetermined');
31
- return;
32
- }
33
-
34
- const observer = new IntersectionObserver(
35
- ([entry]) => {
36
- setState(entry?.isIntersecting ? 'visible' : 'invisible');
37
- },
38
- { rootMargin, threshold },
39
- );
40
-
41
- observer.observe(node);
42
-
43
- return () => {
44
- observer.disconnect();
45
- };
46
- }, [node, threshold, rootMargin]);
47
-
48
- return state;
49
- }
50
-
51
- export interface VisibilityObserverRenderProps {
52
- visibility: ElementVisibility;
53
- ref: <T extends HTMLElement>(node: null | T) => void;
54
- }
55
-
56
- export interface VisibilityObserverProps extends VisibilityObserverOptions {
57
- render: (props: VisibilityObserverRenderProps) => ReactNode;
58
- onChange?: (visibility: ElementVisibility) => void;
59
- }
60
-
61
- export function VisibilityObserver({
62
- render,
63
- onChange,
64
- ...options
65
- }: VisibilityObserverProps): null | ReactElement {
66
- const [node, setNode] = useState<null | HTMLElement>(null);
67
- const visibility = useVisibilityObserver(node, options);
68
- const children = render({ ref: setNode, visibility });
69
-
70
- useValueObserver(visibility, () => {
71
- onChange?.(visibility);
72
- });
73
-
74
- return renderChildren(children);
75
- }
@@ -1,34 +0,0 @@
1
- import { render, screen } from '@testing-library/react';
2
- import { ExitTransitionPlaceholder } from '../ExitTransitionPlaceholder';
3
-
4
- it('render null child', () => {
5
- const child = null;
6
- const { container } = render(
7
- <ExitTransitionPlaceholder in={true}>{child}</ExitTransitionPlaceholder>,
8
- );
9
- expect(container).toBeEmptyDOMElement();
10
- });
11
-
12
- it('render null with boolean child', () => {
13
- const child = true;
14
- const { container } = render(
15
- <ExitTransitionPlaceholder in={true}>{child}</ExitTransitionPlaceholder>,
16
- );
17
- expect(container).toBeEmptyDOMElement();
18
- });
19
-
20
- it('render child', () => {
21
- const { rerender } = render(
22
- <ExitTransitionPlaceholder in={true}>
23
- <p>Test</p>
24
- </ExitTransitionPlaceholder>,
25
- );
26
- expect(screen.getByText('Test')).toBeInTheDocument();
27
-
28
- rerender(
29
- <ExitTransitionPlaceholder in={false}>
30
- <p />
31
- </ExitTransitionPlaceholder>,
32
- );
33
- expect(screen.getByText('Test')).toBeInTheDocument();
34
- });
@@ -1,11 +0,0 @@
1
- import { ReactNode } from 'react';
2
-
3
- export function isEmptyReactNode(
4
- node: ReactNode,
5
- ): node is null | undefined | boolean | string {
6
- return (
7
- node == null ||
8
- typeof node == 'boolean' ||
9
- (typeof node == 'string' && node.length === 0)
10
- );
11
- }
@@ -1,21 +0,0 @@
1
- import { MutableRefObject, Ref } from 'react';
2
-
3
- export function mergeRefs<T>(
4
- ...refs: Array<null | undefined | Ref<T>>
5
- ): (node: T) => void {
6
- return (node) => {
7
- refs.forEach((ref) => {
8
- assignRef(ref, node);
9
- });
10
- };
11
- }
12
-
13
- export function assignRef<T>(ref: Ref<T> | undefined, value: T): void {
14
- if (ref) {
15
- if (typeof ref === 'function') {
16
- ref(value);
17
- } else {
18
- (ref as MutableRefObject<T>).current = value;
19
- }
20
- }
21
- }