@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.
- package/.babelrc.js +5 -0
- package/.turbo/turbo-version.log +28 -0
- package/package.json +65 -39
- package/pkg/README.md +30 -0
- package/{dist-node → pkg/dist-node}/index.js +2 -1
- package/pkg/dist-node/index.js.map +1 -0
- package/{dist-src → pkg/dist-src}/number-field/NumberField.js +2 -1
- package/{dist-types → pkg/dist-types}/index.d.ts +364 -364
- package/{dist-web → pkg/dist-web}/index.js +2 -1
- package/pkg/dist-web/index.js.map +1 -0
- package/pkg/package.json +39 -0
- package/playroom.ts +31 -0
- package/src/__tests__/index.spec.ts +134 -0
- package/src/adaptive-toolbar/AdaptiveToolbar.stories.tsx +50 -0
- package/src/adaptive-toolbar/AdaptiveToolbar.tsx +199 -0
- package/src/adaptive-toolbar/__tests__/AdaptiveToolbar.spec.tsx +11 -0
- package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.stories.tsx +49 -0
- package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.tsx +171 -0
- package/src/app-bar/AppBar.stories.tsx +62 -0
- package/src/app-bar/AppBarOverrides.ts +9 -0
- package/src/app-bar/__tests__/AppBar.spec.tsx +86 -0
- package/src/autocomplete/Autocomplete.stories.tsx +76 -0
- package/src/autocomplete/AutocompleteOverrides.tsx +58 -0
- package/src/autocomplete/__tests__/Autocomplete.spec.tsx +323 -0
- package/src/avatar/Avatar.stories.tsx +17 -0
- package/src/avatar/AvatarOverrides.ts +24 -0
- package/src/avatar/__tests__/Avatar.spec.tsx +71 -0
- package/src/avatar-button/AvatarButton.stories.tsx +153 -0
- package/src/avatar-button/AvatarButton.tsx +223 -0
- package/src/avatar-button/__tests__/AvatarButton.spec.tsx +126 -0
- package/src/button/Button.tsx +51 -0
- package/src/button/ButtonOverrides.ts +375 -0
- package/src/button/__tests__/Button.spec.tsx +599 -0
- package/src/card/Card.stories.tsx +39 -0
- package/src/card/CardOverrides.ts +9 -0
- package/src/card/__tests__/Card.spec.tsx +68 -0
- package/src/card-button/CardButton.stories.tsx +36 -0
- package/src/card-button/CardButton.tsx +202 -0
- package/src/card-button/__tests__/CardButton.spec.tsx +95 -0
- package/src/checkbox/CheckboxField.stories.tsx +61 -0
- package/src/checkbox/CheckboxField.tsx +56 -0
- package/src/checkbox/CheckboxGroudField.tsx +53 -0
- package/src/checkbox/CheckboxOverrides.tsx +55 -0
- package/src/checkbox/__tests__/Checkbox.spec.tsx +105 -0
- package/src/chip/Chip.stories.tsx +26 -0
- package/src/chip/ChipOverrides.tsx +111 -0
- package/src/chip/__tests__/Chip.spec.tsx +308 -0
- package/src/columns/Column.tsx +124 -0
- package/src/columns/Columns.stories.tsx +426 -0
- package/src/columns/Columns.tsx +76 -0
- package/src/description-list/DescriptionList.spec.tsx +137 -0
- package/src/description-list/DescriptionList.stories.tsx +148 -0
- package/src/description-list/DescriptionList.tsx +170 -0
- package/src/dialog/Dialog.playroom.tsx +24 -0
- package/src/dialog/Dialog.stories.tsx +60 -0
- package/src/dialog/DialogOverrides.ts +39 -0
- package/src/dialog/__tests__/Dialog.spec.tsx +219 -0
- package/src/drawer/Drawer.playroom.tsx +22 -0
- package/src/drawer/Drawer.stories.tsx +194 -0
- package/src/drawer/DrawerActions.tsx +69 -0
- package/src/drawer/DrawerContent.tsx +30 -0
- package/src/drawer/DrawerList.tsx +60 -0
- package/src/drawer/DrawerOverrides.ts +19 -0
- package/src/drawer/DrawerTitle.tsx +143 -0
- package/src/drawer/__tests__/Drawer.spec.tsx +227 -0
- package/src/dropdown-button/DropdownButton.stories.tsx +15 -0
- package/src/dropdown-button/DropdownButton.tsx +131 -0
- package/src/grid/GridStack.tsx +45 -0
- package/src/grid/InlineGrid.tsx +56 -0
- package/src/icon-button/IconButton.stories.tsx +53 -0
- package/src/icon-button/IconButtonOverrides.ts +32 -0
- package/src/icon-button/__tests__/IconButton.spec.tsx +124 -0
- package/src/index.ts +47 -0
- package/src/info-card/InfoCard.stories.tsx +29 -0
- package/src/info-card/InfoCard.tsx +95 -0
- package/src/info-card/__tests__/InfoCard.spec.tsx +22 -0
- package/src/info-tooltip/InfoTooltip.stories.tsx +77 -0
- package/src/info-tooltip/InfoTooltip.tsx +72 -0
- package/src/info-tooltip/__tests__/InfoTooltip.spec.tsx +166 -0
- package/src/inline/Inline.stories.tsx +135 -0
- package/src/inline/Inline.tsx +144 -0
- package/src/link/Link.stories.tsx +41 -0
- package/src/link/LinkOverrides.ts +43 -0
- package/src/link/__tests__/Link.spec.tsx +98 -0
- package/src/list/ListOverrides.ts +11 -0
- package/src/list/__tests__/List.spec.tsx +182 -0
- package/src/menu/Menu.stories.tsx +35 -0
- package/src/menu/MenuOverrides.ts +17 -0
- package/src/menu/__tests__/Menu.spec.tsx +99 -0
- package/src/number-field/NumberField.stories.tsx +123 -0
- package/src/number-field/NumberField.tsx +98 -0
- package/src/overflow-text/OverflowText.stories.tsx +32 -0
- package/src/overflow-text/OverflowText.tsx +114 -0
- package/src/overflow-text/__tests__/OverflowText.spec.tsx +24 -0
- package/src/pagination/Pagination.stories.tsx +36 -0
- package/src/pagination/PaginationOverrides.ts +47 -0
- package/src/pagination/__tests__/Pagination.spec.tsx +228 -0
- package/src/paper/PaperOverrides.ts +10 -0
- package/src/paper/__tests__/Paper.spec.tsx +155 -0
- package/src/props/AlignProps.ts +22 -0
- package/src/props/CollapseProp.ts +13 -0
- package/src/props/ResponsiveProp.ts +65 -0
- package/src/props/SpaceProp.ts +40 -0
- package/src/radio/RadioField.stories.tsx +42 -0
- package/src/radio/RadioField.tsx +55 -0
- package/src/radio/RadioGroupField.tsx +64 -0
- package/src/radio/RadioOverrides.tsx +51 -0
- package/src/radio/__tests__/Radio.spec.tsx +90 -0
- package/src/responsive/CollapseBreakpoint.ts +21 -0
- package/src/responsive/MinBreakpoint.ts +21 -0
- package/src/responsive/ResponsiveContext.tsx +57 -0
- package/src/snackbar/Snackbar.stories.tsx +196 -0
- package/src/snackbar/Snackbar.tsx +83 -0
- package/src/snackbar/SnackbarContent.tsx +147 -0
- package/src/snackbar/SnackbarOverrides.ts +23 -0
- package/src/snackbar/SnackbarStack.tsx +160 -0
- package/src/snackbar/__tests__/Snackbar.spec.tsx +196 -0
- package/src/stack/Stack.stories.tsx +113 -0
- package/src/stack/Stack.tsx +86 -0
- package/src/svg-icon/SvgIcon.stories.tsx +29 -0
- package/src/svg-icon/SvgIconOverrides.ts +32 -0
- package/src/svg-icon/__tests__/SvgIcon.spec.tsx +67 -0
- package/src/switch/Switch.stories.tsx +60 -0
- package/src/switch/SwitchOverrides.ts +88 -0
- package/src/switch/__tests__/Switch.spec.tsx +204 -0
- package/src/tabs/Tabs.stories.tsx +40 -0
- package/src/tabs/TabsOverrides.ts +45 -0
- package/src/tabs/__tests__/Tabs.spec.tsx +226 -0
- package/src/tag/Tag.stories.tsx +53 -0
- package/src/tag/Tag.tsx +130 -0
- package/src/tag/__tests__/Tag.spec.tsx +82 -0
- package/src/text-field/TextField.stories.tsx +50 -0
- package/src/text-field/TextFieldOverrides.tsx +149 -0
- package/src/text-field/__tests__/TextField.spec.tsx +662 -0
- package/src/theme/Color.ts +117 -0
- package/src/theme/SuperDispatchTheme.ts +3 -0
- package/src/theme/ThemeProvider.tsx +179 -0
- package/src/theme/__tests__/CssBaseline.spec.tsx +49 -0
- package/src/theme/__tests__/ThemeProvider.spec.ts +40 -0
- package/src/theme/__tests__/__snapshots__/ThemeProvider.spec.ts.snap +204 -0
- package/src/tiles/Tiles.stories.tsx +69 -0
- package/src/tiles/Tiles.tsx +163 -0
- package/src/tiles/__tests__/Tiles.spec.tsx +221 -0
- package/src/toolbar/ToolbarOverrides.ts +14 -0
- package/src/toolbar/__tests__/Toolbar.spec.tsx +50 -0
- package/src/tooltip/Tooltip.stories.tsx +32 -0
- package/src/tooltip/TooltipOverrides.ts +34 -0
- package/src/tooltip/__tests__/Tooltip.spec.tsx +182 -0
- package/src/typography/Typography.stories.tsx +132 -0
- package/src/typography/TypographyOverrides.ts +125 -0
- package/src/typography/__tests__/Typography.spec.tsx +253 -0
- package/src/utils/ExitTransitionPlaceholder.tsx +22 -0
- package/src/utils/ResizeObserver.tsx +28 -0
- package/src/utils/VisibilityObserver.tsx +75 -0
- package/src/utils/__tests__/ExitTransitionPlaceholder.spec.tsx +34 -0
- package/src/utils/isEmptyReactNode.ts +11 -0
- package/src/utils/mergeRefs.ts +21 -0
- package/src/utils/renderChildren.ts +10 -0
- package/src/utils/useUID.ts +9 -0
- package/tsconfig.json +19 -0
- package/LICENSE +0 -21
- package/dist-node/index.js.map +0 -1
- package/dist-web/index.js.map +0 -1
- /package/{dist-src → pkg/dist-src}/adaptive-toolbar/AdaptiveToolbar.js +0 -0
- /package/{dist-src → pkg/dist-src}/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +0 -0
- /package/{dist-src → pkg/dist-src}/app-bar/AppBarOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/autocomplete/AutocompleteOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/avatar/AvatarOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/avatar-button/AvatarButton.js +0 -0
- /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
- /package/{dist-src → pkg/dist-src}/button/ButtonOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/card/CardOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/card-button/CardButton.js +0 -0
- /package/{dist-src → pkg/dist-src}/checkbox/CheckboxField.js +0 -0
- /package/{dist-src → pkg/dist-src}/checkbox/CheckboxGroudField.js +0 -0
- /package/{dist-src → pkg/dist-src}/checkbox/CheckboxOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/chip/ChipOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/columns/Column.js +0 -0
- /package/{dist-src → pkg/dist-src}/columns/Columns.js +0 -0
- /package/{dist-src → pkg/dist-src}/description-list/DescriptionList.js +0 -0
- /package/{dist-src → pkg/dist-src}/dialog/DialogOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/drawer/DrawerActions.js +0 -0
- /package/{dist-src → pkg/dist-src}/drawer/DrawerContent.js +0 -0
- /package/{dist-src → pkg/dist-src}/drawer/DrawerList.js +0 -0
- /package/{dist-src → pkg/dist-src}/drawer/DrawerOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/drawer/DrawerTitle.js +0 -0
- /package/{dist-src → pkg/dist-src}/dropdown-button/DropdownButton.js +0 -0
- /package/{dist-src → pkg/dist-src}/grid/GridStack.js +0 -0
- /package/{dist-src → pkg/dist-src}/grid/InlineGrid.js +0 -0
- /package/{dist-src → pkg/dist-src}/icon-button/IconButtonOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/index.js +0 -0
- /package/{dist-src → pkg/dist-src}/info-card/InfoCard.js +0 -0
- /package/{dist-src → pkg/dist-src}/inline/Inline.js +0 -0
- /package/{dist-src → pkg/dist-src}/link/LinkOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/list/ListOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/menu/MenuOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/overflow-text/OverflowText.js +0 -0
- /package/{dist-src → pkg/dist-src}/pagination/PaginationOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/paper/PaperOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/props/AlignProps.js +0 -0
- /package/{dist-src → pkg/dist-src}/props/CollapseProp.js +0 -0
- /package/{dist-src → pkg/dist-src}/props/ResponsiveProp.js +0 -0
- /package/{dist-src → pkg/dist-src}/props/SpaceProp.js +0 -0
- /package/{dist-src → pkg/dist-src}/radio/RadioField.js +0 -0
- /package/{dist-src → pkg/dist-src}/radio/RadioGroupField.js +0 -0
- /package/{dist-src → pkg/dist-src}/radio/RadioOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/responsive/CollapseBreakpoint.js +0 -0
- /package/{dist-src → pkg/dist-src}/responsive/MinBreakpoint.js +0 -0
- /package/{dist-src → pkg/dist-src}/responsive/ResponsiveContext.js +0 -0
- /package/{dist-src → pkg/dist-src}/snackbar/Snackbar.js +0 -0
- /package/{dist-src → pkg/dist-src}/snackbar/SnackbarContent.js +0 -0
- /package/{dist-src → pkg/dist-src}/snackbar/SnackbarOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/snackbar/SnackbarStack.js +0 -0
- /package/{dist-src → pkg/dist-src}/stack/Stack.js +0 -0
- /package/{dist-src → pkg/dist-src}/svg-icon/SvgIconOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/switch/SwitchOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/tabs/TabsOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/tag/Tag.js +0 -0
- /package/{dist-src → pkg/dist-src}/text-field/TextFieldOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/theme/Color.js +0 -0
- /package/{dist-src → pkg/dist-src}/theme/SuperDispatchTheme.js +0 -0
- /package/{dist-src → pkg/dist-src}/theme/ThemeProvider.js +0 -0
- /package/{dist-src → pkg/dist-src}/tiles/Tiles.js +0 -0
- /package/{dist-src → pkg/dist-src}/toolbar/ToolbarOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/tooltip/TooltipOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/typography/TypographyOverrides.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/ExitTransitionPlaceholder.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/ResizeObserver.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/VisibilityObserver.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/isEmptyReactNode.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/mergeRefs.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/renderChildren.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/useUID.js +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
|
+
);
|