@superdispatch/ui 0.21.8 → 0.21.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/.babelrc.js +5 -0
  2. package/.turbo/turbo-version.log +28 -0
  3. package/package.json +65 -39
  4. package/pkg/README.md +30 -0
  5. package/{dist-types → pkg/dist-types}/index.d.ts +364 -364
  6. package/pkg/package.json +39 -0
  7. package/playroom.ts +31 -0
  8. package/src/__tests__/index.spec.ts +134 -0
  9. package/src/adaptive-toolbar/AdaptiveToolbar.stories.tsx +50 -0
  10. package/src/adaptive-toolbar/AdaptiveToolbar.tsx +199 -0
  11. package/src/adaptive-toolbar/__tests__/AdaptiveToolbar.spec.tsx +11 -0
  12. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.stories.tsx +49 -0
  13. package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.tsx +171 -0
  14. package/src/app-bar/AppBar.stories.tsx +62 -0
  15. package/src/app-bar/AppBarOverrides.ts +9 -0
  16. package/src/app-bar/__tests__/AppBar.spec.tsx +86 -0
  17. package/src/autocomplete/Autocomplete.stories.tsx +76 -0
  18. package/src/autocomplete/AutocompleteOverrides.tsx +58 -0
  19. package/src/autocomplete/__tests__/Autocomplete.spec.tsx +323 -0
  20. package/src/avatar/Avatar.stories.tsx +17 -0
  21. package/src/avatar/AvatarOverrides.ts +24 -0
  22. package/src/avatar/__tests__/Avatar.spec.tsx +71 -0
  23. package/src/avatar-button/AvatarButton.stories.tsx +153 -0
  24. package/src/avatar-button/AvatarButton.tsx +223 -0
  25. package/src/avatar-button/__tests__/AvatarButton.spec.tsx +126 -0
  26. package/src/button/Button.tsx +51 -0
  27. package/src/button/ButtonOverrides.ts +375 -0
  28. package/src/button/__tests__/Button.spec.tsx +599 -0
  29. package/src/card/Card.stories.tsx +39 -0
  30. package/src/card/CardOverrides.ts +9 -0
  31. package/src/card/__tests__/Card.spec.tsx +68 -0
  32. package/src/card-button/CardButton.stories.tsx +36 -0
  33. package/src/card-button/CardButton.tsx +202 -0
  34. package/src/card-button/__tests__/CardButton.spec.tsx +95 -0
  35. package/src/checkbox/CheckboxField.stories.tsx +61 -0
  36. package/src/checkbox/CheckboxField.tsx +56 -0
  37. package/src/checkbox/CheckboxGroudField.tsx +53 -0
  38. package/src/checkbox/CheckboxOverrides.tsx +55 -0
  39. package/src/checkbox/__tests__/Checkbox.spec.tsx +105 -0
  40. package/src/chip/Chip.stories.tsx +26 -0
  41. package/src/chip/ChipOverrides.tsx +111 -0
  42. package/src/chip/__tests__/Chip.spec.tsx +308 -0
  43. package/src/columns/Column.tsx +124 -0
  44. package/src/columns/Columns.stories.tsx +426 -0
  45. package/src/columns/Columns.tsx +76 -0
  46. package/src/description-list/DescriptionList.spec.tsx +137 -0
  47. package/src/description-list/DescriptionList.stories.tsx +148 -0
  48. package/src/description-list/DescriptionList.tsx +170 -0
  49. package/src/dialog/Dialog.playroom.tsx +24 -0
  50. package/src/dialog/Dialog.stories.tsx +60 -0
  51. package/src/dialog/DialogOverrides.ts +39 -0
  52. package/src/dialog/__tests__/Dialog.spec.tsx +219 -0
  53. package/src/drawer/Drawer.playroom.tsx +22 -0
  54. package/src/drawer/Drawer.stories.tsx +194 -0
  55. package/src/drawer/DrawerActions.tsx +69 -0
  56. package/src/drawer/DrawerContent.tsx +30 -0
  57. package/src/drawer/DrawerList.tsx +60 -0
  58. package/src/drawer/DrawerOverrides.ts +19 -0
  59. package/src/drawer/DrawerTitle.tsx +143 -0
  60. package/src/drawer/__tests__/Drawer.spec.tsx +227 -0
  61. package/src/dropdown-button/DropdownButton.stories.tsx +15 -0
  62. package/src/dropdown-button/DropdownButton.tsx +131 -0
  63. package/src/grid/GridStack.tsx +45 -0
  64. package/src/grid/InlineGrid.tsx +56 -0
  65. package/src/icon-button/IconButton.stories.tsx +53 -0
  66. package/src/icon-button/IconButtonOverrides.ts +32 -0
  67. package/src/icon-button/__tests__/IconButton.spec.tsx +124 -0
  68. package/src/index.ts +47 -0
  69. package/src/info-card/InfoCard.stories.tsx +29 -0
  70. package/src/info-card/InfoCard.tsx +95 -0
  71. package/src/info-card/__tests__/InfoCard.spec.tsx +22 -0
  72. package/src/info-tooltip/InfoTooltip.stories.tsx +77 -0
  73. package/src/info-tooltip/InfoTooltip.tsx +72 -0
  74. package/src/info-tooltip/__tests__/InfoTooltip.spec.tsx +166 -0
  75. package/src/inline/Inline.stories.tsx +135 -0
  76. package/src/inline/Inline.tsx +144 -0
  77. package/src/link/Link.stories.tsx +41 -0
  78. package/src/link/LinkOverrides.ts +43 -0
  79. package/src/link/__tests__/Link.spec.tsx +98 -0
  80. package/src/list/ListOverrides.ts +11 -0
  81. package/src/list/__tests__/List.spec.tsx +182 -0
  82. package/src/menu/Menu.stories.tsx +35 -0
  83. package/src/menu/MenuOverrides.ts +17 -0
  84. package/src/menu/__tests__/Menu.spec.tsx +99 -0
  85. package/src/number-field/NumberField.stories.tsx +123 -0
  86. package/src/number-field/NumberField.tsx +98 -0
  87. package/src/overflow-text/OverflowText.stories.tsx +32 -0
  88. package/src/overflow-text/OverflowText.tsx +114 -0
  89. package/src/overflow-text/__tests__/OverflowText.spec.tsx +24 -0
  90. package/src/pagination/Pagination.stories.tsx +36 -0
  91. package/src/pagination/PaginationOverrides.ts +47 -0
  92. package/src/pagination/__tests__/Pagination.spec.tsx +228 -0
  93. package/src/paper/PaperOverrides.ts +10 -0
  94. package/src/paper/__tests__/Paper.spec.tsx +155 -0
  95. package/src/props/AlignProps.ts +22 -0
  96. package/src/props/CollapseProp.ts +13 -0
  97. package/src/props/ResponsiveProp.ts +65 -0
  98. package/src/props/SpaceProp.ts +40 -0
  99. package/src/radio/RadioField.stories.tsx +42 -0
  100. package/src/radio/RadioField.tsx +55 -0
  101. package/src/radio/RadioGroupField.tsx +64 -0
  102. package/src/radio/RadioOverrides.tsx +51 -0
  103. package/src/radio/__tests__/Radio.spec.tsx +90 -0
  104. package/src/responsive/CollapseBreakpoint.ts +21 -0
  105. package/src/responsive/MinBreakpoint.ts +21 -0
  106. package/src/responsive/ResponsiveContext.tsx +57 -0
  107. package/src/snackbar/Snackbar.stories.tsx +196 -0
  108. package/src/snackbar/Snackbar.tsx +83 -0
  109. package/src/snackbar/SnackbarContent.tsx +147 -0
  110. package/src/snackbar/SnackbarOverrides.ts +23 -0
  111. package/src/snackbar/SnackbarStack.tsx +160 -0
  112. package/src/snackbar/__tests__/Snackbar.spec.tsx +196 -0
  113. package/src/stack/Stack.stories.tsx +113 -0
  114. package/src/stack/Stack.tsx +86 -0
  115. package/src/svg-icon/SvgIcon.stories.tsx +29 -0
  116. package/src/svg-icon/SvgIconOverrides.ts +32 -0
  117. package/src/svg-icon/__tests__/SvgIcon.spec.tsx +67 -0
  118. package/src/switch/Switch.stories.tsx +60 -0
  119. package/src/switch/SwitchOverrides.ts +88 -0
  120. package/src/switch/__tests__/Switch.spec.tsx +204 -0
  121. package/src/tabs/Tabs.stories.tsx +40 -0
  122. package/src/tabs/TabsOverrides.ts +45 -0
  123. package/src/tabs/__tests__/Tabs.spec.tsx +226 -0
  124. package/src/tag/Tag.stories.tsx +53 -0
  125. package/src/tag/Tag.tsx +130 -0
  126. package/src/tag/__tests__/Tag.spec.tsx +82 -0
  127. package/src/text-field/TextField.stories.tsx +50 -0
  128. package/src/text-field/TextFieldOverrides.tsx +149 -0
  129. package/src/text-field/__tests__/TextField.spec.tsx +662 -0
  130. package/src/theme/Color.ts +117 -0
  131. package/src/theme/SuperDispatchTheme.ts +3 -0
  132. package/src/theme/ThemeProvider.tsx +179 -0
  133. package/src/theme/__tests__/CssBaseline.spec.tsx +49 -0
  134. package/src/theme/__tests__/ThemeProvider.spec.ts +40 -0
  135. package/src/theme/__tests__/__snapshots__/ThemeProvider.spec.ts.snap +204 -0
  136. package/src/tiles/Tiles.stories.tsx +69 -0
  137. package/src/tiles/Tiles.tsx +163 -0
  138. package/src/tiles/__tests__/Tiles.spec.tsx +221 -0
  139. package/src/toolbar/ToolbarOverrides.ts +14 -0
  140. package/src/toolbar/__tests__/Toolbar.spec.tsx +50 -0
  141. package/src/tooltip/Tooltip.stories.tsx +32 -0
  142. package/src/tooltip/TooltipOverrides.ts +34 -0
  143. package/src/tooltip/__tests__/Tooltip.spec.tsx +182 -0
  144. package/src/typography/Typography.stories.tsx +132 -0
  145. package/src/typography/TypographyOverrides.ts +125 -0
  146. package/src/typography/__tests__/Typography.spec.tsx +253 -0
  147. package/src/utils/ExitTransitionPlaceholder.tsx +22 -0
  148. package/src/utils/ResizeObserver.tsx +28 -0
  149. package/src/utils/VisibilityObserver.tsx +75 -0
  150. package/src/utils/__tests__/ExitTransitionPlaceholder.spec.tsx +34 -0
  151. package/src/utils/isEmptyReactNode.ts +11 -0
  152. package/src/utils/mergeRefs.ts +21 -0
  153. package/src/utils/renderChildren.ts +10 -0
  154. package/src/utils/useUID.ts +9 -0
  155. package/tsconfig.json +19 -0
  156. package/LICENSE +0 -21
  157. /package/{dist-node → pkg/dist-node}/index.js +0 -0
  158. /package/{dist-node → pkg/dist-node}/index.js.map +0 -0
  159. /package/{dist-src → pkg/dist-src}/adaptive-toolbar/AdaptiveToolbar.js +0 -0
  160. /package/{dist-src → pkg/dist-src}/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +0 -0
  161. /package/{dist-src → pkg/dist-src}/app-bar/AppBarOverrides.js +0 -0
  162. /package/{dist-src → pkg/dist-src}/autocomplete/AutocompleteOverrides.js +0 -0
  163. /package/{dist-src → pkg/dist-src}/avatar/AvatarOverrides.js +0 -0
  164. /package/{dist-src → pkg/dist-src}/avatar-button/AvatarButton.js +0 -0
  165. /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
  166. /package/{dist-src → pkg/dist-src}/button/ButtonOverrides.js +0 -0
  167. /package/{dist-src → pkg/dist-src}/card/CardOverrides.js +0 -0
  168. /package/{dist-src → pkg/dist-src}/card-button/CardButton.js +0 -0
  169. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxField.js +0 -0
  170. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxGroudField.js +0 -0
  171. /package/{dist-src → pkg/dist-src}/checkbox/CheckboxOverrides.js +0 -0
  172. /package/{dist-src → pkg/dist-src}/chip/ChipOverrides.js +0 -0
  173. /package/{dist-src → pkg/dist-src}/columns/Column.js +0 -0
  174. /package/{dist-src → pkg/dist-src}/columns/Columns.js +0 -0
  175. /package/{dist-src → pkg/dist-src}/description-list/DescriptionList.js +0 -0
  176. /package/{dist-src → pkg/dist-src}/dialog/DialogOverrides.js +0 -0
  177. /package/{dist-src → pkg/dist-src}/drawer/DrawerActions.js +0 -0
  178. /package/{dist-src → pkg/dist-src}/drawer/DrawerContent.js +0 -0
  179. /package/{dist-src → pkg/dist-src}/drawer/DrawerList.js +0 -0
  180. /package/{dist-src → pkg/dist-src}/drawer/DrawerOverrides.js +0 -0
  181. /package/{dist-src → pkg/dist-src}/drawer/DrawerTitle.js +0 -0
  182. /package/{dist-src → pkg/dist-src}/dropdown-button/DropdownButton.js +0 -0
  183. /package/{dist-src → pkg/dist-src}/grid/GridStack.js +0 -0
  184. /package/{dist-src → pkg/dist-src}/grid/InlineGrid.js +0 -0
  185. /package/{dist-src → pkg/dist-src}/icon-button/IconButtonOverrides.js +0 -0
  186. /package/{dist-src → pkg/dist-src}/index.js +0 -0
  187. /package/{dist-src → pkg/dist-src}/info-card/InfoCard.js +0 -0
  188. /package/{dist-src → pkg/dist-src}/inline/Inline.js +0 -0
  189. /package/{dist-src → pkg/dist-src}/link/LinkOverrides.js +0 -0
  190. /package/{dist-src → pkg/dist-src}/list/ListOverrides.js +0 -0
  191. /package/{dist-src → pkg/dist-src}/menu/MenuOverrides.js +0 -0
  192. /package/{dist-src → pkg/dist-src}/number-field/NumberField.js +0 -0
  193. /package/{dist-src → pkg/dist-src}/overflow-text/OverflowText.js +0 -0
  194. /package/{dist-src → pkg/dist-src}/pagination/PaginationOverrides.js +0 -0
  195. /package/{dist-src → pkg/dist-src}/paper/PaperOverrides.js +0 -0
  196. /package/{dist-src → pkg/dist-src}/props/AlignProps.js +0 -0
  197. /package/{dist-src → pkg/dist-src}/props/CollapseProp.js +0 -0
  198. /package/{dist-src → pkg/dist-src}/props/ResponsiveProp.js +0 -0
  199. /package/{dist-src → pkg/dist-src}/props/SpaceProp.js +0 -0
  200. /package/{dist-src → pkg/dist-src}/radio/RadioField.js +0 -0
  201. /package/{dist-src → pkg/dist-src}/radio/RadioGroupField.js +0 -0
  202. /package/{dist-src → pkg/dist-src}/radio/RadioOverrides.js +0 -0
  203. /package/{dist-src → pkg/dist-src}/responsive/CollapseBreakpoint.js +0 -0
  204. /package/{dist-src → pkg/dist-src}/responsive/MinBreakpoint.js +0 -0
  205. /package/{dist-src → pkg/dist-src}/responsive/ResponsiveContext.js +0 -0
  206. /package/{dist-src → pkg/dist-src}/snackbar/Snackbar.js +0 -0
  207. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarContent.js +0 -0
  208. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarOverrides.js +0 -0
  209. /package/{dist-src → pkg/dist-src}/snackbar/SnackbarStack.js +0 -0
  210. /package/{dist-src → pkg/dist-src}/stack/Stack.js +0 -0
  211. /package/{dist-src → pkg/dist-src}/svg-icon/SvgIconOverrides.js +0 -0
  212. /package/{dist-src → pkg/dist-src}/switch/SwitchOverrides.js +0 -0
  213. /package/{dist-src → pkg/dist-src}/tabs/TabsOverrides.js +0 -0
  214. /package/{dist-src → pkg/dist-src}/tag/Tag.js +0 -0
  215. /package/{dist-src → pkg/dist-src}/text-field/TextFieldOverrides.js +0 -0
  216. /package/{dist-src → pkg/dist-src}/theme/Color.js +0 -0
  217. /package/{dist-src → pkg/dist-src}/theme/SuperDispatchTheme.js +0 -0
  218. /package/{dist-src → pkg/dist-src}/theme/ThemeProvider.js +0 -0
  219. /package/{dist-src → pkg/dist-src}/tiles/Tiles.js +0 -0
  220. /package/{dist-src → pkg/dist-src}/toolbar/ToolbarOverrides.js +0 -0
  221. /package/{dist-src → pkg/dist-src}/tooltip/TooltipOverrides.js +0 -0
  222. /package/{dist-src → pkg/dist-src}/typography/TypographyOverrides.js +0 -0
  223. /package/{dist-src → pkg/dist-src}/utils/ExitTransitionPlaceholder.js +0 -0
  224. /package/{dist-src → pkg/dist-src}/utils/ResizeObserver.js +0 -0
  225. /package/{dist-src → pkg/dist-src}/utils/VisibilityObserver.js +0 -0
  226. /package/{dist-src → pkg/dist-src}/utils/isEmptyReactNode.js +0 -0
  227. /package/{dist-src → pkg/dist-src}/utils/mergeRefs.js +0 -0
  228. /package/{dist-src → pkg/dist-src}/utils/renderChildren.js +0 -0
  229. /package/{dist-src → pkg/dist-src}/utils/useUID.js +0 -0
  230. /package/{dist-web → pkg/dist-web}/index.js +0 -0
  231. /package/{dist-web → pkg/dist-web}/index.js.map +0 -0
package/src/index.ts ADDED
@@ -0,0 +1,47 @@
1
+ export * from './adaptive-toolbar/AdaptiveToolbar';
2
+ export * from './adaptive-vertical-toolbar/AdaptiveVerticalToolbar';
3
+ export * from './avatar-button/AvatarButton';
4
+ export * from './button/Button';
5
+ export * from './card-button/CardButton';
6
+ export * from './checkbox/CheckboxField';
7
+ export * from './checkbox/CheckboxGroudField';
8
+ export * from './columns/Column';
9
+ export * from './columns/Columns';
10
+ export * from './description-list/DescriptionList';
11
+ export * from './drawer/DrawerActions';
12
+ export * from './drawer/DrawerContent';
13
+ export * from './drawer/DrawerList';
14
+ export * from './drawer/DrawerTitle';
15
+ export * from './dropdown-button/DropdownButton';
16
+ export * from './grid/GridStack';
17
+ export * from './grid/InlineGrid';
18
+ export * from './info-card/InfoCard';
19
+ export * from './info-tooltip/InfoTooltip';
20
+ export * from './inline/Inline';
21
+ export * from './number-field/NumberField';
22
+ export * from './overflow-text/OverflowText';
23
+ export * from './props/AlignProps';
24
+ export * from './props/CollapseProp';
25
+ export * from './props/ResponsiveProp';
26
+ export * from './props/SpaceProp';
27
+ export * from './radio/RadioField';
28
+ export * from './radio/RadioGroupField';
29
+ export * from './responsive/CollapseBreakpoint';
30
+ export * from './responsive/MinBreakpoint';
31
+ export * from './responsive/ResponsiveContext';
32
+ export * from './snackbar/Snackbar';
33
+ export * from './snackbar/SnackbarContent';
34
+ export * from './snackbar/SnackbarStack';
35
+ export * from './stack/Stack';
36
+ export * from './tag/Tag';
37
+ export * from './theme/Color';
38
+ export * from './theme/SuperDispatchTheme';
39
+ export * from './theme/ThemeProvider';
40
+ export * from './tiles/Tiles';
41
+ export * from './utils/ExitTransitionPlaceholder';
42
+ export * from './utils/isEmptyReactNode';
43
+ export * from './utils/mergeRefs';
44
+ export * from './utils/renderChildren';
45
+ export * from './utils/ResizeObserver';
46
+ export * from './utils/useUID';
47
+ export * from './utils/VisibilityObserver';
@@ -0,0 +1,29 @@
1
+ import { Typography } from '@material-ui/core';
2
+ import { Meta } from '@storybook/react';
3
+ import { Button } from '../button/Button';
4
+ import { Stack } from '../stack/Stack';
5
+ import { InfoCard } from './InfoCard';
6
+
7
+ export default { title: 'Surfaces/InfoCard', component: InfoCard } as Meta;
8
+
9
+ export const basic = () => (
10
+ <InfoCard>
11
+ <Stack space="small">
12
+ <Typography variant="h3">Title</Typography>
13
+ <Typography>Content</Typography>
14
+
15
+ <Button>Button</Button>
16
+ </Stack>
17
+ </InfoCard>
18
+ );
19
+
20
+ export const large = () => (
21
+ <InfoCard size="large">
22
+ <Stack space="small">
23
+ <Typography variant="h3">Title</Typography>
24
+ <Typography>Content</Typography>
25
+
26
+ <Button>Button</Button>
27
+ </Stack>
28
+ </InfoCard>
29
+ );
@@ -0,0 +1,95 @@
1
+ import {
2
+ Card,
3
+ CardClassKey,
4
+ CardContent,
5
+ CardContentProps,
6
+ CardProps,
7
+ } from '@material-ui/core';
8
+ import { CSSProperties, makeStyles } from '@material-ui/styles';
9
+ import clsx from 'clsx';
10
+ import { forwardRef, ForwardRefExoticComponent, useState } from 'react';
11
+ import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
12
+ import { assignRef } from '../utils/mergeRefs';
13
+
14
+ export type InfoCardClassKey =
15
+ | 'sizeLarge'
16
+ | 'content'
17
+ | 'fullWidth'
18
+ | CardClassKey;
19
+
20
+ const useStyles = makeStyles(
21
+ (theme: SuperDispatchTheme): Record<InfoCardClassKey, CSSProperties> => ({
22
+ root: {
23
+ '&$fullWidth': {
24
+ borderRadius: 0,
25
+ borderLeftWidth: 0,
26
+ borderRightWidth: 0,
27
+ },
28
+ },
29
+ fullWidth: {},
30
+ sizeLarge: {},
31
+ content: {
32
+ padding: theme.spacing(2),
33
+
34
+ '$sizeLarge > &': {
35
+ [theme.breakpoints.up('sm')]: {
36
+ padding: theme.spacing(3),
37
+ },
38
+ },
39
+ },
40
+ }),
41
+ { name: 'SD-InfoCard' },
42
+ );
43
+
44
+ export interface InfoCardProps extends CardProps {
45
+ size?: 'medium' | 'large';
46
+ CardContentProps?: CardContentProps;
47
+ }
48
+
49
+ export const InfoCard: ForwardRefExoticComponent<InfoCardProps> = forwardRef(
50
+ (
51
+ {
52
+ size,
53
+ square,
54
+ classes,
55
+ children,
56
+ className,
57
+ CardContentProps: cardContentProps = {},
58
+ ...props
59
+ },
60
+ ref,
61
+ ) => {
62
+ const {
63
+ content: contentClassName,
64
+ sizeLarge: sizeLargeClassName,
65
+ fullWidth: fullWidthClassName,
66
+ ...styles
67
+ } = useStyles({ classes });
68
+ const [rootNode, setRootNode] = useState<HTMLElement | null>(null);
69
+
70
+ const clientRect = rootNode?.getBoundingClientRect();
71
+ const isFullWidth = clientRect?.width === window.innerWidth;
72
+
73
+ return (
74
+ <Card
75
+ {...props}
76
+ ref={(node) => {
77
+ assignRef(ref, node);
78
+ setRootNode(node as HTMLElement);
79
+ }}
80
+ classes={styles}
81
+ className={clsx(className, {
82
+ [sizeLargeClassName]: size === 'large',
83
+ [fullWidthClassName]: isFullWidth,
84
+ })}
85
+ >
86
+ <CardContent
87
+ {...cardContentProps}
88
+ className={clsx(cardContentProps.className, contentClassName)}
89
+ >
90
+ {children}
91
+ </CardContent>
92
+ </Card>
93
+ );
94
+ },
95
+ );
@@ -0,0 +1,22 @@
1
+ import { renderCSS } from '@superdispatch/ui-testutils';
2
+ import { InfoCard } from '../..';
3
+
4
+ it('checks component css', () => {
5
+ expect(renderCSS(<InfoCard />, ['SD-InfoCard'])).toMatchInlineSnapshot(`
6
+ .SD-InfoCard-root.SD-InfoCard-fullWidth {
7
+ border-radius: 0;
8
+ border-left-width: 0;
9
+ border-right-width: 0;
10
+ }
11
+
12
+ .SD-InfoCard-content {
13
+ padding: 16px;
14
+ }
15
+
16
+ @media (min-width: 600px) {
17
+ .SD-InfoCard-sizeLarge > .SD-InfoCard-content {
18
+ padding: 24px;
19
+ }
20
+ }
21
+ `);
22
+ });
@@ -0,0 +1,77 @@
1
+ import { Typography } from '@material-ui/core';
2
+ import { Meta } from '@storybook/react';
3
+ import { Button } from '../button/Button';
4
+ import { InfoTooltip } from './InfoTooltip';
5
+
6
+ export default {
7
+ title: 'Surfaces/InfoTooltip',
8
+ component: InfoTooltip,
9
+ } as Meta;
10
+
11
+ export const basic = () => (
12
+ <InfoTooltip
13
+ interactive={true}
14
+ iconButtonProps={{
15
+ 'aria-label': 'aria label info',
16
+ }}
17
+ title={
18
+ <>
19
+ <Typography variant="h3">Title</Typography>
20
+ <Typography>Content</Typography>
21
+ <Button>Button</Button>
22
+ </>
23
+ }
24
+ />
25
+ );
26
+
27
+ export const withLabel = () => (
28
+ <InfoTooltip
29
+ interactive={true}
30
+ iconButtonProps={{
31
+ 'aria-label': 'aria label info',
32
+ }}
33
+ title={
34
+ <>
35
+ <Typography variant="h3">Title</Typography>
36
+ <Typography>Content</Typography>
37
+ <Button>Button</Button>
38
+ </>
39
+ }
40
+ >
41
+ <Typography>Label</Typography>
42
+ </InfoTooltip>
43
+ );
44
+
45
+ export const medium = () => (
46
+ <InfoTooltip
47
+ interactive={false}
48
+ fontSize="medium"
49
+ iconButtonProps={{
50
+ 'aria-label': 'aria label info',
51
+ }}
52
+ title={
53
+ <>
54
+ <Typography variant="h3">Title</Typography>
55
+ <Typography>Non-Interactive Content</Typography>
56
+ <Button>Button</Button>
57
+ </>
58
+ }
59
+ />
60
+ );
61
+
62
+ export const large = () => (
63
+ <InfoTooltip
64
+ interactive={false}
65
+ fontSize="large"
66
+ iconButtonProps={{
67
+ 'aria-label': 'aria label info',
68
+ }}
69
+ title={
70
+ <>
71
+ <Typography variant="h3">Title</Typography>
72
+ <Typography>Non-Interactive Content</Typography>
73
+ <Button>Button</Button>
74
+ </>
75
+ }
76
+ />
77
+ );
@@ -0,0 +1,72 @@
1
+ import {
2
+ IconButton,
3
+ IconButtonProps,
4
+ Tooltip,
5
+ TooltipProps,
6
+ Typography,
7
+ TypographyProps,
8
+ } from '@material-ui/core';
9
+ import { Info } from '@material-ui/icons';
10
+ import { forwardRef, ForwardRefExoticComponent, ReactNode } from 'react';
11
+ import styled from 'styled-components';
12
+
13
+ interface InfoTooltipProps extends Omit<TooltipProps, 'title' | 'children'> {
14
+ title: NonNullable<ReactNode>;
15
+ children?: ReactNode;
16
+ iconButtonProps?: IconButtonProps;
17
+ fontSize?: 'inherit' | 'default' | 'small' | 'medium' | 'large' | undefined;
18
+ TextProps?: TypographyProps;
19
+ isOpen?: boolean;
20
+ onClose?: () => void;
21
+ onClick?: () => void;
22
+ }
23
+
24
+ const Root = styled.div`
25
+ display: flex;
26
+ align-items: center;
27
+ `;
28
+
29
+ export const InfoTooltip: ForwardRefExoticComponent<InfoTooltipProps> =
30
+ forwardRef(
31
+ (
32
+ {
33
+ children,
34
+ iconButtonProps,
35
+ fontSize = 'small',
36
+ TextProps,
37
+ title,
38
+ isOpen,
39
+ onClick,
40
+ onClose,
41
+ ...props
42
+ },
43
+ ref,
44
+ ) => {
45
+ const tooltip = (
46
+ <Tooltip
47
+ open={isOpen}
48
+ title={title}
49
+ placement="top"
50
+ onClose={onClose}
51
+ disableFocusListener={true}
52
+ disableTouchListener={true}
53
+ onClick={onClick}
54
+ ref={ref}
55
+ {...props}
56
+ >
57
+ <IconButton {...iconButtonProps} size="small" onMouseOver={onClick}>
58
+ <Info color="action" fontSize={fontSize} />
59
+ </IconButton>
60
+ </Tooltip>
61
+ );
62
+
63
+ if (!children) return tooltip;
64
+
65
+ return (
66
+ <Root>
67
+ <Typography {...TextProps}>{children}</Typography>
68
+ {tooltip}
69
+ </Root>
70
+ );
71
+ },
72
+ );
@@ -0,0 +1,166 @@
1
+ import { renderCSS } from '@superdispatch/ui-testutils';
2
+ import { InfoTooltip } from '../..';
3
+
4
+ it('checks component css InfoTooltip', () => {
5
+ expect(renderCSS(<InfoTooltip title={<span />} />, ['MuiTooltip']))
6
+ .toMatchInlineSnapshot(`
7
+ .MuiTooltip-popper {
8
+ z-index: 1500;
9
+ pointer-events: none;
10
+ }
11
+
12
+ .MuiTooltip-popperInteractive {
13
+ pointer-events: auto;
14
+ }
15
+
16
+ .MuiTooltip-popperArrow[x-placement*='bottom'] .MuiTooltip-arrow {
17
+ top: 0;
18
+ left: 0;
19
+ margin-top: -0.71em;
20
+ margin-left: 4px;
21
+ margin-right: 4px;
22
+ }
23
+
24
+ .MuiTooltip-popperArrow[x-placement*='top'] .MuiTooltip-arrow {
25
+ left: 0;
26
+ bottom: 0;
27
+ margin-left: 4px;
28
+ margin-right: 4px;
29
+ margin-bottom: -0.71em;
30
+ }
31
+
32
+ .MuiTooltip-popperArrow[x-placement*='right'] .MuiTooltip-arrow {
33
+ left: 0;
34
+ width: 0.71em;
35
+ height: 1em;
36
+ margin-top: 4px;
37
+ margin-left: -0.71em;
38
+ margin-bottom: 4px;
39
+ }
40
+
41
+ .MuiTooltip-popperArrow[x-placement*='left'] .MuiTooltip-arrow {
42
+ right: 0;
43
+ width: 0.71em;
44
+ height: 1em;
45
+ margin-top: 4px;
46
+ margin-right: -0.71em;
47
+ margin-bottom: 4px;
48
+ }
49
+
50
+ .MuiTooltip-popperArrow[x-placement*='left'] .MuiTooltip-arrow::before {
51
+ transform-origin: 0 0;
52
+ border-top-right-radius: 2px;
53
+ }
54
+
55
+ .MuiTooltip-popperArrow[x-placement*='right'] .MuiTooltip-arrow::before {
56
+ transform-origin: 100% 100%;
57
+ border-bottom-left-radius: 2px;
58
+ }
59
+
60
+ .MuiTooltip-popperArrow[x-placement*='top'] .MuiTooltip-arrow::before {
61
+ transform-origin: 100% 0;
62
+ border-bottom-right-radius: 2px;
63
+ }
64
+
65
+ .MuiTooltip-popperArrow[x-placement*='bottom'] .MuiTooltip-arrow::before {
66
+ transform-origin: 0 100%;
67
+ border-top-left-radius: 2px;
68
+ }
69
+
70
+ .MuiTooltip-tooltip {
71
+ color: Color.White;
72
+ padding: 8px 12px;
73
+ font-size: 14px;
74
+ max-width: 300px;
75
+ word-wrap: break-word;
76
+ font-family: 'Inter', sans-serif;
77
+ font-weight: 400;
78
+ line-height: 20px;
79
+ border-radius: 4px;
80
+ background-color: Color.Dark400;
81
+ }
82
+
83
+ @media (min-width: 0px) and (max-width: 599.95px) {
84
+ .MuiTooltip-tooltip {
85
+ font-size: 16px;
86
+ line-height: 24px;
87
+ }
88
+ }
89
+
90
+ .MuiTooltip-tooltipArrow {
91
+ margin: 0;
92
+ position: relative;
93
+ }
94
+
95
+ .MuiTooltip-arrow {
96
+ color: Color.Dark400;
97
+ width: 1em;
98
+ height: 0.71em;
99
+ overflow: hidden;
100
+ position: absolute;
101
+ font-size: 8px;
102
+ box-sizing: border-box;
103
+ }
104
+
105
+ .MuiTooltip-arrow::before {
106
+ width: 100%;
107
+ height: 100%;
108
+ margin: auto;
109
+ content: '';
110
+ display: block;
111
+ transform: rotate(45deg);
112
+ background-color: currentColor;
113
+ }
114
+
115
+ .MuiTooltip-touch {
116
+ padding: 8px 16px;
117
+ font-size: 0.875rem;
118
+ font-weight: 400;
119
+ line-height: 1.14286em;
120
+ }
121
+
122
+ .MuiTooltip-tooltipPlacementLeft {
123
+ margin: 0 24px;
124
+ transform-origin: right center;
125
+ }
126
+
127
+ @media (min-width: 600px) {
128
+ .MuiTooltip-tooltipPlacementLeft {
129
+ margin: 0 14px;
130
+ }
131
+ }
132
+
133
+ .MuiTooltip-tooltipPlacementRight {
134
+ margin: 0 24px;
135
+ transform-origin: left center;
136
+ }
137
+
138
+ @media (min-width: 600px) {
139
+ .MuiTooltip-tooltipPlacementRight {
140
+ margin: 0 14px;
141
+ }
142
+ }
143
+
144
+ .MuiTooltip-tooltipPlacementTop {
145
+ margin: 24px 0;
146
+ transform-origin: center bottom;
147
+ }
148
+
149
+ @media (min-width: 600px) {
150
+ .MuiTooltip-tooltipPlacementTop {
151
+ margin: 14px 0;
152
+ }
153
+ }
154
+
155
+ .MuiTooltip-tooltipPlacementBottom {
156
+ margin: 24px 0;
157
+ transform-origin: center top;
158
+ }
159
+
160
+ @media (min-width: 600px) {
161
+ .MuiTooltip-tooltipPlacementBottom {
162
+ margin: 14px 0;
163
+ }
164
+ }
165
+ `);
166
+ });
@@ -0,0 +1,135 @@
1
+ import { Link } from '@material-ui/core';
2
+ import { Meta } from '@storybook/react';
3
+ import { Empty, Placeholder } from '@superdispatch/ui-docs';
4
+ import { Box } from '@superdispatch/ui-lab';
5
+ import { Inline } from './Inline';
6
+
7
+ export default {
8
+ title: 'Layout/Inline',
9
+ component: Inline,
10
+ decorators: [
11
+ (Story) => (
12
+ <Box maxWidth="240px">
13
+ <Story />
14
+ </Box>
15
+ ),
16
+ ],
17
+ parameters: {
18
+ componentSubtitle: (
19
+ <>
20
+ Heavily inspired by the{' '}
21
+ <Link href="https://seek-oss.github.io/braid-design-system/components/Inline">
22
+ Inline
23
+ </Link>{' '}
24
+ component from the{' '}
25
+ <Link href="https://seek-oss.github.io/braid-design-system">
26
+ BRAID Design System
27
+ </Link>
28
+ .
29
+ </>
30
+ ),
31
+ },
32
+ } as Meta;
33
+
34
+ export const basic = () => (
35
+ <Inline>
36
+ <Placeholder width={48} height={48} />
37
+ <Placeholder width={48} height={48} />
38
+ <Placeholder width={48} height={48} />
39
+ <Placeholder width={48} height={48} />
40
+ <Placeholder width={48} height={48} />
41
+ <Placeholder width={48} height={48} />
42
+ <Placeholder width={48} height={48} />
43
+ <Placeholder width={48} height={48} />
44
+ <Placeholder width={48} height={48} />
45
+ <Placeholder width={48} height={48} />
46
+ </Inline>
47
+ );
48
+
49
+ export const emptyElements = () => (
50
+ <Inline>
51
+ <Empty />
52
+ <Placeholder width={48} height={48} />
53
+ <Empty />
54
+ <Placeholder width={48} height={48} />
55
+ <Empty />
56
+ <Placeholder width={48} height={48} />
57
+ <Empty />
58
+ <Placeholder width={48} height={48} />
59
+ <Empty />
60
+ <Placeholder width={48} height={48} />
61
+ </Inline>
62
+ );
63
+
64
+ export const responsiveSpace = () => (
65
+ <Inline space={['xsmall', 'small']}>
66
+ <Placeholder width={48} height={48} />
67
+ <Placeholder width={48} height={48} />
68
+ <Placeholder width={48} height={48} />
69
+ <Placeholder width={48} height={48} />
70
+ <Placeholder width={48} height={48} />
71
+ <Placeholder width={48} height={48} />
72
+ <Placeholder width={48} height={48} />
73
+ <Placeholder width={48} height={48} />
74
+ <Placeholder width={48} height={48} />
75
+ <Placeholder width={48} height={48} />
76
+ </Inline>
77
+ );
78
+
79
+ export const horizontalAlignment = () => (
80
+ <Inline horizontalAlign="center">
81
+ <Placeholder width={48} height={48} />
82
+ <Placeholder width={48} height={48} />
83
+ <Placeholder width={48} height={48} />
84
+ <Placeholder width={48} height={48} />
85
+ <Placeholder width={48} height={48} />
86
+ <Placeholder width={48} height={48} />
87
+ <Placeholder width={48} height={48} />
88
+ <Placeholder width={48} height={48} />
89
+ <Placeholder width={48} height={48} />
90
+ <Placeholder width={48} height={48} />
91
+ </Inline>
92
+ );
93
+
94
+ export const responsiveHorizontalAlignment = () => (
95
+ <Inline horizontalAlign={['center', 'left']}>
96
+ <Placeholder width={48} height={48} />
97
+ <Placeholder width={48} height={48} />
98
+ <Placeholder width={48} height={48} />
99
+ <Placeholder width={48} height={48} />
100
+ <Placeholder width={48} height={48} />
101
+ <Placeholder width={48} height={48} />
102
+ <Placeholder width={48} height={48} />
103
+ <Placeholder width={48} height={48} />
104
+ <Placeholder width={48} height={48} />
105
+ <Placeholder width={48} height={48} />
106
+ </Inline>
107
+ );
108
+
109
+ export const verticalAlignment = () => (
110
+ <Inline verticalAlign="center">
111
+ <Placeholder width={48} height={48} />
112
+ <Placeholder width={48} height={64} />
113
+ <Placeholder width={48} height={24} />
114
+ </Inline>
115
+ );
116
+
117
+ export const responsiveVerticalAlignment = () => (
118
+ <Inline verticalAlign={['center', 'bottom']}>
119
+ <Placeholder width={48} height={48} />
120
+ <Placeholder width={48} height={64} />
121
+ <Placeholder width={48} height={24} />
122
+ </Inline>
123
+ );
124
+
125
+ export const noWrap = () => (
126
+ <Box maxWidth="240px" overflow="hidden">
127
+ <Inline noWrap={true}>
128
+ <Placeholder width={48} height={48} />
129
+ <Placeholder width={48} height={48} />
130
+ <Placeholder width={48} height={48} />
131
+ <Placeholder width={48} height={48} />
132
+ <Placeholder width={48} height={48} />
133
+ </Inline>
134
+ </Box>
135
+ );