@superdispatch/ui 0.21.13 → 0.21.14
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/LICENSE +21 -0
- package/{pkg/dist-node → dist-node}/index.js +62 -14
- package/dist-node/index.js.map +1 -0
- package/{pkg/dist-src → dist-src}/index.js +1 -0
- package/dist-src/info-tooltip/InfoTooltip.js +54 -0
- package/{pkg/dist-types → dist-types}/index.d.ts +14 -2
- package/{pkg/dist-web → dist-web}/index.js +64 -17
- package/dist-web/index.js.map +1 -0
- package/package.json +12 -38
- package/.babelrc.js +0 -5
- package/.turbo/turbo-version.log +0 -28
- package/pkg/README.md +0 -30
- package/pkg/dist-node/index.js.map +0 -1
- package/pkg/dist-web/index.js.map +0 -1
- package/pkg/package.json +0 -39
- package/playroom.ts +0 -31
- package/src/__tests__/index.spec.ts +0 -134
- package/src/adaptive-toolbar/AdaptiveToolbar.stories.tsx +0 -50
- package/src/adaptive-toolbar/AdaptiveToolbar.tsx +0 -199
- package/src/adaptive-toolbar/__tests__/AdaptiveToolbar.spec.tsx +0 -11
- package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.stories.tsx +0 -49
- package/src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.tsx +0 -171
- package/src/app-bar/AppBar.stories.tsx +0 -62
- package/src/app-bar/AppBarOverrides.ts +0 -9
- package/src/app-bar/__tests__/AppBar.spec.tsx +0 -86
- package/src/autocomplete/Autocomplete.stories.tsx +0 -76
- package/src/autocomplete/AutocompleteOverrides.tsx +0 -58
- package/src/autocomplete/__tests__/Autocomplete.spec.tsx +0 -323
- package/src/avatar/Avatar.stories.tsx +0 -17
- package/src/avatar/AvatarOverrides.ts +0 -24
- package/src/avatar/__tests__/Avatar.spec.tsx +0 -71
- package/src/avatar-button/AvatarButton.stories.tsx +0 -153
- package/src/avatar-button/AvatarButton.tsx +0 -223
- package/src/avatar-button/__tests__/AvatarButton.spec.tsx +0 -126
- package/src/button/Button.tsx +0 -51
- package/src/button/ButtonOverrides.ts +0 -375
- package/src/button/__tests__/Button.spec.tsx +0 -599
- package/src/card/Card.stories.tsx +0 -39
- package/src/card/CardOverrides.ts +0 -9
- package/src/card/__tests__/Card.spec.tsx +0 -68
- package/src/card-button/CardButton.stories.tsx +0 -36
- package/src/card-button/CardButton.tsx +0 -202
- package/src/card-button/__tests__/CardButton.spec.tsx +0 -95
- package/src/checkbox/CheckboxField.stories.tsx +0 -61
- package/src/checkbox/CheckboxField.tsx +0 -56
- package/src/checkbox/CheckboxGroudField.tsx +0 -53
- package/src/checkbox/CheckboxOverrides.tsx +0 -55
- package/src/checkbox/__tests__/Checkbox.spec.tsx +0 -105
- package/src/chip/Chip.stories.tsx +0 -26
- package/src/chip/ChipOverrides.tsx +0 -111
- package/src/chip/__tests__/Chip.spec.tsx +0 -308
- package/src/columns/Column.tsx +0 -124
- package/src/columns/Columns.stories.tsx +0 -426
- package/src/columns/Columns.tsx +0 -76
- package/src/description-list/DescriptionList.spec.tsx +0 -137
- package/src/description-list/DescriptionList.stories.tsx +0 -148
- package/src/description-list/DescriptionList.tsx +0 -170
- package/src/dialog/Dialog.playroom.tsx +0 -24
- package/src/dialog/Dialog.stories.tsx +0 -60
- package/src/dialog/DialogOverrides.ts +0 -39
- package/src/dialog/__tests__/Dialog.spec.tsx +0 -219
- package/src/drawer/Drawer.playroom.tsx +0 -22
- package/src/drawer/Drawer.stories.tsx +0 -194
- package/src/drawer/DrawerActions.tsx +0 -69
- package/src/drawer/DrawerContent.tsx +0 -30
- package/src/drawer/DrawerList.tsx +0 -60
- package/src/drawer/DrawerOverrides.ts +0 -19
- package/src/drawer/DrawerTitle.tsx +0 -143
- package/src/drawer/__tests__/Drawer.spec.tsx +0 -227
- package/src/dropdown-button/DropdownButton.stories.tsx +0 -15
- package/src/dropdown-button/DropdownButton.tsx +0 -131
- package/src/grid/GridStack.tsx +0 -45
- package/src/grid/InlineGrid.tsx +0 -56
- package/src/icon-button/IconButton.stories.tsx +0 -53
- package/src/icon-button/IconButtonOverrides.ts +0 -32
- package/src/icon-button/__tests__/IconButton.spec.tsx +0 -124
- package/src/index.ts +0 -47
- package/src/info-card/InfoCard.stories.tsx +0 -29
- package/src/info-card/InfoCard.tsx +0 -95
- package/src/info-card/__tests__/InfoCard.spec.tsx +0 -22
- package/src/info-tooltip/InfoTooltip.stories.tsx +0 -77
- package/src/info-tooltip/InfoTooltip.tsx +0 -72
- package/src/info-tooltip/__tests__/InfoTooltip.spec.tsx +0 -166
- package/src/inline/Inline.stories.tsx +0 -135
- package/src/inline/Inline.tsx +0 -144
- package/src/link/Link.stories.tsx +0 -41
- package/src/link/LinkOverrides.ts +0 -43
- package/src/link/__tests__/Link.spec.tsx +0 -98
- package/src/list/ListOverrides.ts +0 -11
- package/src/list/__tests__/List.spec.tsx +0 -182
- package/src/menu/Menu.stories.tsx +0 -35
- package/src/menu/MenuOverrides.ts +0 -17
- package/src/menu/__tests__/Menu.spec.tsx +0 -99
- package/src/number-field/NumberField.stories.tsx +0 -123
- package/src/number-field/NumberField.tsx +0 -98
- package/src/overflow-text/OverflowText.stories.tsx +0 -32
- package/src/overflow-text/OverflowText.tsx +0 -114
- package/src/overflow-text/__tests__/OverflowText.spec.tsx +0 -24
- package/src/pagination/Pagination.stories.tsx +0 -36
- package/src/pagination/PaginationOverrides.ts +0 -47
- package/src/pagination/__tests__/Pagination.spec.tsx +0 -228
- package/src/paper/PaperOverrides.ts +0 -10
- package/src/paper/__tests__/Paper.spec.tsx +0 -155
- package/src/props/AlignProps.ts +0 -22
- package/src/props/CollapseProp.ts +0 -13
- package/src/props/ResponsiveProp.ts +0 -65
- package/src/props/SpaceProp.ts +0 -40
- package/src/radio/RadioField.stories.tsx +0 -42
- package/src/radio/RadioField.tsx +0 -55
- package/src/radio/RadioGroupField.tsx +0 -64
- package/src/radio/RadioOverrides.tsx +0 -51
- package/src/radio/__tests__/Radio.spec.tsx +0 -90
- package/src/responsive/CollapseBreakpoint.ts +0 -21
- package/src/responsive/MinBreakpoint.ts +0 -21
- package/src/responsive/ResponsiveContext.tsx +0 -57
- package/src/snackbar/Snackbar.stories.tsx +0 -196
- package/src/snackbar/Snackbar.tsx +0 -83
- package/src/snackbar/SnackbarContent.tsx +0 -147
- package/src/snackbar/SnackbarOverrides.ts +0 -23
- package/src/snackbar/SnackbarStack.tsx +0 -160
- package/src/snackbar/__tests__/Snackbar.spec.tsx +0 -196
- package/src/stack/Stack.stories.tsx +0 -113
- package/src/stack/Stack.tsx +0 -86
- package/src/svg-icon/SvgIcon.stories.tsx +0 -29
- package/src/svg-icon/SvgIconOverrides.ts +0 -32
- package/src/svg-icon/__tests__/SvgIcon.spec.tsx +0 -67
- package/src/switch/Switch.stories.tsx +0 -60
- package/src/switch/SwitchOverrides.ts +0 -88
- package/src/switch/__tests__/Switch.spec.tsx +0 -204
- package/src/tabs/Tabs.stories.tsx +0 -40
- package/src/tabs/TabsOverrides.ts +0 -45
- package/src/tabs/__tests__/Tabs.spec.tsx +0 -226
- package/src/tag/Tag.stories.tsx +0 -53
- package/src/tag/Tag.tsx +0 -130
- package/src/tag/__tests__/Tag.spec.tsx +0 -82
- package/src/text-field/TextField.stories.tsx +0 -50
- package/src/text-field/TextFieldOverrides.tsx +0 -149
- package/src/text-field/__tests__/TextField.spec.tsx +0 -662
- package/src/theme/Color.ts +0 -117
- package/src/theme/SuperDispatchTheme.ts +0 -3
- package/src/theme/ThemeProvider.tsx +0 -179
- package/src/theme/__tests__/CssBaseline.spec.tsx +0 -49
- package/src/theme/__tests__/ThemeProvider.spec.ts +0 -40
- package/src/theme/__tests__/__snapshots__/ThemeProvider.spec.ts.snap +0 -204
- package/src/tiles/Tiles.stories.tsx +0 -69
- package/src/tiles/Tiles.tsx +0 -163
- package/src/tiles/__tests__/Tiles.spec.tsx +0 -221
- package/src/toolbar/ToolbarOverrides.ts +0 -14
- package/src/toolbar/__tests__/Toolbar.spec.tsx +0 -50
- package/src/tooltip/Tooltip.stories.tsx +0 -32
- package/src/tooltip/TooltipOverrides.ts +0 -34
- package/src/tooltip/__tests__/Tooltip.spec.tsx +0 -182
- package/src/typography/Typography.stories.tsx +0 -132
- package/src/typography/TypographyOverrides.ts +0 -125
- package/src/typography/__tests__/Typography.spec.tsx +0 -253
- package/src/utils/ExitTransitionPlaceholder.tsx +0 -22
- package/src/utils/ResizeObserver.tsx +0 -28
- package/src/utils/VisibilityObserver.tsx +0 -75
- package/src/utils/__tests__/ExitTransitionPlaceholder.spec.tsx +0 -34
- package/src/utils/isEmptyReactNode.ts +0 -11
- package/src/utils/mergeRefs.ts +0 -21
- package/src/utils/renderChildren.ts +0 -10
- package/src/utils/useUID.ts +0 -9
- package/tsconfig.json +0 -19
- /package/{pkg/dist-src → dist-src}/adaptive-toolbar/AdaptiveToolbar.js +0 -0
- /package/{pkg/dist-src → dist-src}/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +0 -0
- /package/{pkg/dist-src → dist-src}/app-bar/AppBarOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/autocomplete/AutocompleteOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/avatar/AvatarOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/avatar-button/AvatarButton.js +0 -0
- /package/{pkg/dist-src → dist-src}/button/Button.js +0 -0
- /package/{pkg/dist-src → dist-src}/button/ButtonOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/card/CardOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/card-button/CardButton.js +0 -0
- /package/{pkg/dist-src → dist-src}/checkbox/CheckboxField.js +0 -0
- /package/{pkg/dist-src → dist-src}/checkbox/CheckboxGroudField.js +0 -0
- /package/{pkg/dist-src → dist-src}/checkbox/CheckboxOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/chip/ChipOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/columns/Column.js +0 -0
- /package/{pkg/dist-src → dist-src}/columns/Columns.js +0 -0
- /package/{pkg/dist-src → dist-src}/description-list/DescriptionList.js +0 -0
- /package/{pkg/dist-src → dist-src}/dialog/DialogOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/drawer/DrawerActions.js +0 -0
- /package/{pkg/dist-src → dist-src}/drawer/DrawerContent.js +0 -0
- /package/{pkg/dist-src → dist-src}/drawer/DrawerList.js +0 -0
- /package/{pkg/dist-src → dist-src}/drawer/DrawerOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/drawer/DrawerTitle.js +0 -0
- /package/{pkg/dist-src → dist-src}/dropdown-button/DropdownButton.js +0 -0
- /package/{pkg/dist-src → dist-src}/grid/GridStack.js +0 -0
- /package/{pkg/dist-src → dist-src}/grid/InlineGrid.js +0 -0
- /package/{pkg/dist-src → dist-src}/icon-button/IconButtonOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/info-card/InfoCard.js +0 -0
- /package/{pkg/dist-src → dist-src}/inline/Inline.js +0 -0
- /package/{pkg/dist-src → dist-src}/link/LinkOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/list/ListOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/menu/MenuOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/number-field/NumberField.js +0 -0
- /package/{pkg/dist-src → dist-src}/overflow-text/OverflowText.js +0 -0
- /package/{pkg/dist-src → dist-src}/pagination/PaginationOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/paper/PaperOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/props/AlignProps.js +0 -0
- /package/{pkg/dist-src → dist-src}/props/CollapseProp.js +0 -0
- /package/{pkg/dist-src → dist-src}/props/ResponsiveProp.js +0 -0
- /package/{pkg/dist-src → dist-src}/props/SpaceProp.js +0 -0
- /package/{pkg/dist-src → dist-src}/radio/RadioField.js +0 -0
- /package/{pkg/dist-src → dist-src}/radio/RadioGroupField.js +0 -0
- /package/{pkg/dist-src → dist-src}/radio/RadioOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/responsive/CollapseBreakpoint.js +0 -0
- /package/{pkg/dist-src → dist-src}/responsive/MinBreakpoint.js +0 -0
- /package/{pkg/dist-src → dist-src}/responsive/ResponsiveContext.js +0 -0
- /package/{pkg/dist-src → dist-src}/snackbar/Snackbar.js +0 -0
- /package/{pkg/dist-src → dist-src}/snackbar/SnackbarContent.js +0 -0
- /package/{pkg/dist-src → dist-src}/snackbar/SnackbarOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/snackbar/SnackbarStack.js +0 -0
- /package/{pkg/dist-src → dist-src}/stack/Stack.js +0 -0
- /package/{pkg/dist-src → dist-src}/svg-icon/SvgIconOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/switch/SwitchOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/tabs/TabsOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/tag/Tag.js +0 -0
- /package/{pkg/dist-src → dist-src}/text-field/TextFieldOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/theme/Color.js +0 -0
- /package/{pkg/dist-src → dist-src}/theme/SuperDispatchTheme.js +0 -0
- /package/{pkg/dist-src → dist-src}/theme/ThemeProvider.js +0 -0
- /package/{pkg/dist-src → dist-src}/tiles/Tiles.js +0 -0
- /package/{pkg/dist-src → dist-src}/toolbar/ToolbarOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/tooltip/TooltipOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/typography/TypographyOverrides.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/ExitTransitionPlaceholder.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/ResizeObserver.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/VisibilityObserver.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/isEmptyReactNode.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/mergeRefs.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/renderChildren.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/useUID.js +0 -0
package/src/inline/Inline.tsx
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { forwardRef, ReactNode } from 'react';
|
|
2
|
-
import flattenChildren from 'react-keyed-flatten-children';
|
|
3
|
-
import styled, { css, SimpleInterpolation } from 'styled-components';
|
|
4
|
-
import {
|
|
5
|
-
HorizontalAlign,
|
|
6
|
-
parseAlignProp,
|
|
7
|
-
VerticalAlign,
|
|
8
|
-
} from '../props/AlignProps';
|
|
9
|
-
import {
|
|
10
|
-
ResponsiveProp,
|
|
11
|
-
ResponsivePropTuple,
|
|
12
|
-
useResponsiveProp,
|
|
13
|
-
} from '../props/ResponsiveProp';
|
|
14
|
-
import { parseSpaceProp, SpaceProp } from '../props/SpaceProp';
|
|
15
|
-
|
|
16
|
-
function inlineRootMixin(
|
|
17
|
-
spaceProp: SpaceProp,
|
|
18
|
-
noWrap: boolean,
|
|
19
|
-
verticalAlign: VerticalAlign,
|
|
20
|
-
horizontalAlign: HorizontalAlign,
|
|
21
|
-
): readonly SimpleInterpolation[] {
|
|
22
|
-
const space = parseSpaceProp(spaceProp);
|
|
23
|
-
|
|
24
|
-
return css`
|
|
25
|
-
&:before {
|
|
26
|
-
margin-top: ${-space - 1}px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
& > div {
|
|
30
|
-
display: flex;
|
|
31
|
-
margin-left: -${space}px;
|
|
32
|
-
flex-wrap: ${noWrap ? 'nowrap' : 'wrap'};
|
|
33
|
-
align-items: ${parseAlignProp(verticalAlign)};
|
|
34
|
-
justify-content: ${parseAlignProp(horizontalAlign)};
|
|
35
|
-
|
|
36
|
-
& > div {
|
|
37
|
-
&:empty {
|
|
38
|
-
display: none;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
min-width: 0;
|
|
42
|
-
flex-shrink: 0;
|
|
43
|
-
max-width: 100%;
|
|
44
|
-
|
|
45
|
-
margin-top: ${space}px;
|
|
46
|
-
margin-left: ${space}px;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface InlineRootProps {
|
|
53
|
-
space: ResponsivePropTuple<SpaceProp>;
|
|
54
|
-
noWrap: ResponsivePropTuple<boolean>;
|
|
55
|
-
verticalAlign: ResponsivePropTuple<VerticalAlign>;
|
|
56
|
-
horizontalAlign: ResponsivePropTuple<HorizontalAlign>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const InlineRoot = styled.div<InlineRootProps>(
|
|
60
|
-
({ theme, space, noWrap, verticalAlign, horizontalAlign }) =>
|
|
61
|
-
css`
|
|
62
|
-
padding-top: 1px;
|
|
63
|
-
|
|
64
|
-
&:before {
|
|
65
|
-
content: '';
|
|
66
|
-
display: block;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
${inlineRootMixin(
|
|
70
|
-
space[0],
|
|
71
|
-
noWrap[0],
|
|
72
|
-
verticalAlign[0],
|
|
73
|
-
horizontalAlign[0],
|
|
74
|
-
)}
|
|
75
|
-
|
|
76
|
-
${theme.breakpoints.up('sm')} {
|
|
77
|
-
${inlineRootMixin(
|
|
78
|
-
space[1],
|
|
79
|
-
noWrap[1],
|
|
80
|
-
verticalAlign[1],
|
|
81
|
-
horizontalAlign[1],
|
|
82
|
-
)}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
${theme.breakpoints.up('md')} {
|
|
86
|
-
${inlineRootMixin(
|
|
87
|
-
space[2],
|
|
88
|
-
noWrap[2],
|
|
89
|
-
verticalAlign[2],
|
|
90
|
-
horizontalAlign[2],
|
|
91
|
-
)}
|
|
92
|
-
}
|
|
93
|
-
`,
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
export interface InlineProps {
|
|
97
|
-
children?: ReactNode;
|
|
98
|
-
'aria-label'?: string;
|
|
99
|
-
'aria-labelledby'?: string;
|
|
100
|
-
|
|
101
|
-
noWrap?: ResponsiveProp<boolean>;
|
|
102
|
-
space?: ResponsiveProp<SpaceProp>;
|
|
103
|
-
verticalAlign?: ResponsiveProp<VerticalAlign>;
|
|
104
|
-
horizontalAlign?: ResponsiveProp<HorizontalAlign>;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const Inline = forwardRef<HTMLDivElement, InlineProps>(
|
|
108
|
-
(
|
|
109
|
-
{
|
|
110
|
-
children,
|
|
111
|
-
'aria-label': ariaLabel,
|
|
112
|
-
'aria-labelledby': ariaLabelledBy,
|
|
113
|
-
|
|
114
|
-
noWrap: noWrapProp = false,
|
|
115
|
-
space: spaceProp = 'xsmall',
|
|
116
|
-
verticalAlign: verticalAlignProp = 'top',
|
|
117
|
-
horizontalAlign: horizontalAlignProp = 'left',
|
|
118
|
-
},
|
|
119
|
-
ref,
|
|
120
|
-
) => {
|
|
121
|
-
const space = useResponsiveProp(spaceProp);
|
|
122
|
-
const noWrap = useResponsiveProp(noWrapProp);
|
|
123
|
-
const verticalAlign = useResponsiveProp(verticalAlignProp);
|
|
124
|
-
const horizontalAlign = useResponsiveProp(horizontalAlignProp);
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<InlineRoot
|
|
128
|
-
ref={ref}
|
|
129
|
-
space={space}
|
|
130
|
-
noWrap={noWrap}
|
|
131
|
-
verticalAlign={verticalAlign}
|
|
132
|
-
horizontalAlign={horizontalAlign}
|
|
133
|
-
aria-label={ariaLabel}
|
|
134
|
-
aria-labelledby={ariaLabelledBy}
|
|
135
|
-
>
|
|
136
|
-
<div>
|
|
137
|
-
{flattenChildren(children).map((child, idx) => (
|
|
138
|
-
<div key={idx}>{child}</div>
|
|
139
|
-
))}
|
|
140
|
-
</div>
|
|
141
|
-
</InlineRoot>
|
|
142
|
-
);
|
|
143
|
-
},
|
|
144
|
-
);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Link, Typography } from '@material-ui/core';
|
|
2
|
-
import { Meta } from '@storybook/react';
|
|
3
|
-
import { Box } from '@superdispatch/ui-lab';
|
|
4
|
-
import { Stack } from '../stack/Stack';
|
|
5
|
-
|
|
6
|
-
export default { title: 'Navigation/Link' } as Meta;
|
|
7
|
-
|
|
8
|
-
export const basic = () => (
|
|
9
|
-
<Typography>
|
|
10
|
-
This is a{' '}
|
|
11
|
-
<Link href="#" target="_blank">
|
|
12
|
-
link
|
|
13
|
-
</Link>{' '}
|
|
14
|
-
in text with a <Link component="button">button link</Link>.
|
|
15
|
-
</Typography>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
export const multiline = () => (
|
|
19
|
-
<Box maxWidth="64px">
|
|
20
|
-
<Link href="#" target="_blank">
|
|
21
|
-
This is multi-line link
|
|
22
|
-
</Link>
|
|
23
|
-
</Box>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export const multilineButton = () => (
|
|
27
|
-
<Box maxWidth="64px">
|
|
28
|
-
<Link component="button">This is multi-line button link</Link>
|
|
29
|
-
</Box>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export const colors = () => (
|
|
33
|
-
<Stack>
|
|
34
|
-
<Link href="#" target="_blank" color="primary">
|
|
35
|
-
Primary
|
|
36
|
-
</Link>
|
|
37
|
-
<Link href="#" target="_blank" color="textPrimary">
|
|
38
|
-
Text Primary
|
|
39
|
-
</Link>
|
|
40
|
-
</Stack>
|
|
41
|
-
);
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Color } from '../theme/Color';
|
|
2
|
-
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
|
|
3
|
-
|
|
4
|
-
function line(color: string): string {
|
|
5
|
-
return `linear-gradient(to right, ${color} 0%, ${color} 100%)`;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function overrideLink(theme: SuperDispatchTheme): void {
|
|
9
|
-
theme.props.MuiLink = { underline: 'none', color: 'textPrimary' };
|
|
10
|
-
|
|
11
|
-
theme.overrides.MuiLink = {
|
|
12
|
-
root: {
|
|
13
|
-
backgroundSize: '100% 1px',
|
|
14
|
-
backgroundRepeat: 'repeat-x',
|
|
15
|
-
backgroundPosition: '0 100%',
|
|
16
|
-
backgroundColor: Color.Transparent,
|
|
17
|
-
|
|
18
|
-
'&:focus': { outline: 'none' },
|
|
19
|
-
'&:hover, &:active': { backgroundImage: line('currentColor') },
|
|
20
|
-
|
|
21
|
-
'&.MuiTypography-colorTextPrimary': {
|
|
22
|
-
backgroundImage: line(Color.Silver500),
|
|
23
|
-
|
|
24
|
-
'&:focus, &:hover, &:active': {
|
|
25
|
-
color: Color.Blue300,
|
|
26
|
-
backgroundImage: line(Color.Blue300),
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
button: {
|
|
32
|
-
// Reset button styles.
|
|
33
|
-
backgroundColor: undefined,
|
|
34
|
-
|
|
35
|
-
// Override browser defaults.
|
|
36
|
-
fontSize: 'inherit',
|
|
37
|
-
textAlign: 'inherit',
|
|
38
|
-
lineHeight: 'inherit',
|
|
39
|
-
userSelect: 'inherit',
|
|
40
|
-
verticalAlign: 'inherit',
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Link } 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.MuiLink).toMatchInlineSnapshot(`
|
|
8
|
-
Object {
|
|
9
|
-
"color": "textPrimary",
|
|
10
|
-
"underline": "none",
|
|
11
|
-
}
|
|
12
|
-
`);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('checks component css', () => {
|
|
16
|
-
expect(renderCSS(<Link>Text</Link>, ['MuiLink'])).toMatchInlineSnapshot(`
|
|
17
|
-
.MuiLink-root {
|
|
18
|
-
background-size: 100% 1px;
|
|
19
|
-
background-color: Color.Transparent;
|
|
20
|
-
background-repeat: repeat-x;
|
|
21
|
-
background-position: 0 100%;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.MuiLink-root:focus {
|
|
25
|
-
outline: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.MuiLink-root:hover,
|
|
29
|
-
.MuiLink-root:active {
|
|
30
|
-
background-image: linear-gradient(
|
|
31
|
-
to right,
|
|
32
|
-
currentColor 0%,
|
|
33
|
-
currentColor 100%
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.MuiLink-root.MuiTypography-colorTextPrimary {
|
|
38
|
-
background-image: linear-gradient(
|
|
39
|
-
to right,
|
|
40
|
-
Color.Silver500 0%,
|
|
41
|
-
Color.Silver500 100%
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.MuiLink-root.MuiTypography-colorTextPrimary:focus,
|
|
46
|
-
.MuiLink-root.MuiTypography-colorTextPrimary:hover,
|
|
47
|
-
.MuiLink-root.MuiTypography-colorTextPrimary:active {
|
|
48
|
-
color: Color.Blue300;
|
|
49
|
-
background-image: linear-gradient(
|
|
50
|
-
to right,
|
|
51
|
-
Color.Blue300 0%,
|
|
52
|
-
Color.Blue300 100%
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.MuiLink-underlineNone {
|
|
57
|
-
text-decoration: none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.MuiLink-underlineHover {
|
|
61
|
-
text-decoration: none;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.MuiLink-underlineHover:hover {
|
|
65
|
-
text-decoration: underline;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.MuiLink-underlineAlways {
|
|
69
|
-
text-decoration: underline;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.MuiLink-button {
|
|
73
|
-
border: 0;
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
margin: 0;
|
|
76
|
-
outline: 0;
|
|
77
|
-
padding: 0;
|
|
78
|
-
position: relative;
|
|
79
|
-
font-size: inherit;
|
|
80
|
-
text-align: inherit;
|
|
81
|
-
line-height: inherit;
|
|
82
|
-
user-select: inherit;
|
|
83
|
-
border-radius: 0;
|
|
84
|
-
vertical-align: inherit;
|
|
85
|
-
-moz-appearance: none;
|
|
86
|
-
-webkit-appearance: none;
|
|
87
|
-
-webkit-tap-highlight-color: transparent;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.MuiLink-button::-moz-focus-inner {
|
|
91
|
-
border-style: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.MuiLink-button.Mui-focusVisible {
|
|
95
|
-
outline: auto;
|
|
96
|
-
}
|
|
97
|
-
`);
|
|
98
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Color } from '../theme/Color';
|
|
2
|
-
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
|
|
3
|
-
|
|
4
|
-
export function overrideList(theme: SuperDispatchTheme): void {
|
|
5
|
-
theme.overrides.MuiListItem = {
|
|
6
|
-
root: {
|
|
7
|
-
'&$selected, &$selected:hover': { backgroundColor: Color.Blue50 },
|
|
8
|
-
'& .MuiTouchRipple-root': { color: Color.Blue100 },
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
List,
|
|
3
|
-
ListItem,
|
|
4
|
-
ListItemAvatar,
|
|
5
|
-
ListItemIcon,
|
|
6
|
-
ListItemSecondaryAction,
|
|
7
|
-
ListItemText,
|
|
8
|
-
} from '@material-ui/core';
|
|
9
|
-
import { renderCSS, renderTheme } from '@superdispatch/ui-testutils';
|
|
10
|
-
|
|
11
|
-
it('checks default props', () => {
|
|
12
|
-
const { props } = renderTheme();
|
|
13
|
-
|
|
14
|
-
expect(props.MuiList).toMatchInlineSnapshot(`undefined`);
|
|
15
|
-
expect(props.MuiListItem).toMatchInlineSnapshot(`undefined`);
|
|
16
|
-
expect(props.MuiListItemAvatar).toMatchInlineSnapshot(`undefined`);
|
|
17
|
-
expect(props.MuiListItemIcon).toMatchInlineSnapshot(`undefined`);
|
|
18
|
-
expect(props.MuiListItemSecondaryAction).toMatchInlineSnapshot(`undefined`);
|
|
19
|
-
expect(props.MuiListItemText).toMatchInlineSnapshot(`undefined`);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('checks component css', () => {
|
|
23
|
-
expect(
|
|
24
|
-
renderCSS(
|
|
25
|
-
<List>
|
|
26
|
-
<ListItem>
|
|
27
|
-
<ListItemAvatar>
|
|
28
|
-
<span />
|
|
29
|
-
</ListItemAvatar>
|
|
30
|
-
|
|
31
|
-
<ListItemIcon>
|
|
32
|
-
<span />
|
|
33
|
-
</ListItemIcon>
|
|
34
|
-
|
|
35
|
-
<ListItemText />
|
|
36
|
-
<ListItemSecondaryAction />
|
|
37
|
-
</ListItem>
|
|
38
|
-
|
|
39
|
-
<ListItem button={true} />
|
|
40
|
-
</List>,
|
|
41
|
-
[
|
|
42
|
-
'MuiList',
|
|
43
|
-
'MuiListItem',
|
|
44
|
-
'MuiListItemAvatar',
|
|
45
|
-
'MuiListItemIcon',
|
|
46
|
-
'MuiListItemSecondaryAction',
|
|
47
|
-
'MuiListItemText',
|
|
48
|
-
],
|
|
49
|
-
),
|
|
50
|
-
).toMatchInlineSnapshot(`
|
|
51
|
-
.MuiList-root {
|
|
52
|
-
margin: 0;
|
|
53
|
-
padding: 0;
|
|
54
|
-
position: relative;
|
|
55
|
-
list-style: none;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.MuiList-padding {
|
|
59
|
-
padding-top: 8px;
|
|
60
|
-
padding-bottom: 8px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.MuiList-subheader {
|
|
64
|
-
padding-top: 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.MuiListItem-root {
|
|
68
|
-
width: 100%;
|
|
69
|
-
display: flex;
|
|
70
|
-
position: relative;
|
|
71
|
-
box-sizing: border-box;
|
|
72
|
-
text-align: left;
|
|
73
|
-
align-items: center;
|
|
74
|
-
padding-top: 8px;
|
|
75
|
-
padding-bottom: 8px;
|
|
76
|
-
justify-content: flex-start;
|
|
77
|
-
text-decoration: none;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.MuiListItem-root.Mui-focusVisible {
|
|
81
|
-
background-color: Color.Silver300;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.MuiListItem-root.Mui-selected,
|
|
85
|
-
.MuiListItem-root.Mui-selected:hover {
|
|
86
|
-
background-color: Color.Blue50;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.MuiListItem-root.Mui-disabled {
|
|
90
|
-
opacity: 0.5;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.MuiListItem-root .MuiTouchRipple-root {
|
|
94
|
-
color: Color.Blue100;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.MuiListItem-container {
|
|
98
|
-
position: relative;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.MuiListItem-dense {
|
|
102
|
-
padding-top: 4px;
|
|
103
|
-
padding-bottom: 4px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.MuiListItem-alignItemsFlexStart {
|
|
107
|
-
align-items: flex-start;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.MuiListItem-divider {
|
|
111
|
-
border-bottom: 1px solid Color.Silver400;
|
|
112
|
-
background-clip: padding-box;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.MuiListItem-gutters {
|
|
116
|
-
padding-left: 16px;
|
|
117
|
-
padding-right: 16px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.MuiListItem-button {
|
|
121
|
-
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.MuiListItem-button:hover {
|
|
125
|
-
text-decoration: none;
|
|
126
|
-
background-color: Color.Silver100;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@media (hover: none) {
|
|
130
|
-
.MuiListItem-button:hover {
|
|
131
|
-
background-color: transparent;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.MuiListItem-secondaryAction {
|
|
136
|
-
padding-right: 48px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.MuiListItemAvatar-root {
|
|
140
|
-
min-width: 56px;
|
|
141
|
-
flex-shrink: 0;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.MuiListItemAvatar-alignItemsFlexStart {
|
|
145
|
-
margin-top: 8px;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.MuiListItemIcon-root {
|
|
149
|
-
color: rgba(0, 0, 0, 0.54);
|
|
150
|
-
display: inline-flex;
|
|
151
|
-
min-width: 56px;
|
|
152
|
-
flex-shrink: 0;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.MuiListItemIcon-alignItemsFlexStart {
|
|
156
|
-
margin-top: 8px;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.MuiListItemSecondaryAction-root {
|
|
160
|
-
top: 50%;
|
|
161
|
-
right: 16px;
|
|
162
|
-
position: absolute;
|
|
163
|
-
transform: translateY(-50%);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.MuiListItemText-root {
|
|
167
|
-
flex: 1 1 auto;
|
|
168
|
-
min-width: 0;
|
|
169
|
-
margin-top: 4px;
|
|
170
|
-
margin-bottom: 4px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.MuiListItemText-multiline {
|
|
174
|
-
margin-top: 6px;
|
|
175
|
-
margin-bottom: 6px;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.MuiListItemText-inset {
|
|
179
|
-
padding-left: 56px;
|
|
180
|
-
}
|
|
181
|
-
`);
|
|
182
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Button, Menu, MenuItem } from '@material-ui/core';
|
|
2
|
-
import { Meta } from '@storybook/react';
|
|
3
|
-
import { UseState } from '@superdispatch/ui-docs';
|
|
4
|
-
|
|
5
|
-
export default { title: 'Navigation/Menu' } as Meta;
|
|
6
|
-
|
|
7
|
-
export const basic = () => (
|
|
8
|
-
<UseState initialState={null}>
|
|
9
|
-
{(state, setState) => (
|
|
10
|
-
<>
|
|
11
|
-
<Button
|
|
12
|
-
color="primary"
|
|
13
|
-
variant="contained"
|
|
14
|
-
onClick={(event) => {
|
|
15
|
-
setState(event.currentTarget);
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
Menu
|
|
19
|
-
</Button>
|
|
20
|
-
|
|
21
|
-
<Menu
|
|
22
|
-
open={!!state}
|
|
23
|
-
anchorEl={state}
|
|
24
|
-
onClose={() => {
|
|
25
|
-
setState(false);
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<MenuItem>Option 1</MenuItem>
|
|
29
|
-
<MenuItem>Option 2</MenuItem>
|
|
30
|
-
<MenuItem>Option 3</MenuItem>
|
|
31
|
-
</Menu>
|
|
32
|
-
</>
|
|
33
|
-
)}
|
|
34
|
-
</UseState>
|
|
35
|
-
);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
|
|
2
|
-
|
|
3
|
-
export function overrideMenu(theme: SuperDispatchTheme): void {
|
|
4
|
-
theme.props.MuiMenu = {
|
|
5
|
-
getContentAnchorEl: null,
|
|
6
|
-
anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
|
|
7
|
-
transformOrigin: { vertical: 'top', horizontal: 'left' },
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
theme.overrides.MuiMenuItem = {
|
|
11
|
-
root: {
|
|
12
|
-
...theme.typography.body2,
|
|
13
|
-
paddingTop: theme.spacing(1),
|
|
14
|
-
paddingBottom: theme.spacing(1),
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Menu, MenuItem } 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.MuiMenu).toMatchInlineSnapshot(`
|
|
8
|
-
Object {
|
|
9
|
-
"anchorOrigin": Object {
|
|
10
|
-
"horizontal": "left",
|
|
11
|
-
"vertical": "bottom",
|
|
12
|
-
},
|
|
13
|
-
"getContentAnchorEl": null,
|
|
14
|
-
"transformOrigin": Object {
|
|
15
|
-
"horizontal": "left",
|
|
16
|
-
"vertical": "top",
|
|
17
|
-
},
|
|
18
|
-
}
|
|
19
|
-
`);
|
|
20
|
-
expect(props.MuiMenuItem).toMatchInlineSnapshot(`undefined`);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('checks component css', () => {
|
|
24
|
-
expect(
|
|
25
|
-
renderCSS(
|
|
26
|
-
<Menu open={true} anchorEl={document.body}>
|
|
27
|
-
<MenuItem />
|
|
28
|
-
</Menu>,
|
|
29
|
-
[
|
|
30
|
-
'MuiMenu',
|
|
31
|
-
'MuiMenuItem',
|
|
32
|
-
// Move to `Popover` component styles.
|
|
33
|
-
'MuiPopover',
|
|
34
|
-
],
|
|
35
|
-
),
|
|
36
|
-
).toMatchInlineSnapshot(`
|
|
37
|
-
.MuiMenu-paper {
|
|
38
|
-
max-height: calc(100% - 96px);
|
|
39
|
-
-webkit-overflow-scrolling: touch;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.MuiMenu-list {
|
|
43
|
-
outline: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.MuiMenuItem-root {
|
|
47
|
-
width: auto;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
font-size: 14px;
|
|
50
|
-
box-sizing: border-box;
|
|
51
|
-
min-height: 48px;
|
|
52
|
-
font-family: 'Inter', sans-serif;
|
|
53
|
-
font-weight: 400;
|
|
54
|
-
line-height: 20px;
|
|
55
|
-
padding-top: 8px;
|
|
56
|
-
white-space: nowrap;
|
|
57
|
-
padding-bottom: 8px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@media (min-width: 0px) and (max-width: 599.95px) {
|
|
61
|
-
.MuiMenuItem-root {
|
|
62
|
-
font-size: 16px;
|
|
63
|
-
line-height: 24px;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@media (min-width: 600px) {
|
|
68
|
-
.MuiMenuItem-root {
|
|
69
|
-
min-height: auto;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.MuiMenuItem-dense {
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
min-height: auto;
|
|
76
|
-
font-family: 'Inter', sans-serif;
|
|
77
|
-
font-weight: 400;
|
|
78
|
-
line-height: 20px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@media (min-width: 0px) and (max-width: 599.95px) {
|
|
82
|
-
.MuiMenuItem-dense {
|
|
83
|
-
font-size: 16px;
|
|
84
|
-
line-height: 24px;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.MuiPopover-paper {
|
|
89
|
-
outline: 0;
|
|
90
|
-
position: absolute;
|
|
91
|
-
max-width: calc(100% - 32px);
|
|
92
|
-
min-width: 16px;
|
|
93
|
-
max-height: calc(100% - 32px);
|
|
94
|
-
min-height: 16px;
|
|
95
|
-
overflow-x: hidden;
|
|
96
|
-
overflow-y: auto;
|
|
97
|
-
}
|
|
98
|
-
`);
|
|
99
|
-
});
|