@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.
- 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-types → pkg/dist-types}/index.d.ts +364 -364
- 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 → pkg/dist-node}/index.js +0 -0
- /package/{dist-node → pkg/dist-node}/index.js.map +0 -0
- /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}/number-field/NumberField.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/{dist-web → pkg/dist-web}/index.js +0 -0
- /package/{dist-web → pkg/dist-web}/index.js.map +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AppBar, IconButton, Toolbar, Typography } from '@material-ui/core';
|
|
2
|
+
import { ArrowBack, Close } from '@material-ui/icons';
|
|
3
|
+
import { Meta } from '@storybook/react';
|
|
4
|
+
import { PropsLink } from '@superdispatch/ui-docs';
|
|
5
|
+
import { Column, Columns } from '..';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Surfaces/AppBar',
|
|
9
|
+
parameters: {
|
|
10
|
+
componentSubtitle: (
|
|
11
|
+
<PropsLink url="https://material-ui.com/api/app-bar/#props" />
|
|
12
|
+
),
|
|
13
|
+
},
|
|
14
|
+
} as Meta;
|
|
15
|
+
|
|
16
|
+
export const basic = () => (
|
|
17
|
+
<AppBar>
|
|
18
|
+
<Toolbar>
|
|
19
|
+
<Columns align="center">
|
|
20
|
+
<Column width="content">
|
|
21
|
+
<IconButton edge="start" aria-label="back">
|
|
22
|
+
<ArrowBack />
|
|
23
|
+
</IconButton>
|
|
24
|
+
</Column>
|
|
25
|
+
|
|
26
|
+
<Column>
|
|
27
|
+
<Typography variant="h2">App Bar</Typography>
|
|
28
|
+
</Column>
|
|
29
|
+
|
|
30
|
+
<Column width="content">
|
|
31
|
+
<IconButton edge="end" aria-label="close">
|
|
32
|
+
<Close />
|
|
33
|
+
</IconButton>
|
|
34
|
+
</Column>
|
|
35
|
+
</Columns>
|
|
36
|
+
</Toolbar>
|
|
37
|
+
</AppBar>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export const dense = () => (
|
|
41
|
+
<AppBar>
|
|
42
|
+
<Toolbar variant="dense">
|
|
43
|
+
<Columns align="center">
|
|
44
|
+
<Column width="content">
|
|
45
|
+
<IconButton edge="start" aria-label="back">
|
|
46
|
+
<ArrowBack />
|
|
47
|
+
</IconButton>
|
|
48
|
+
</Column>
|
|
49
|
+
|
|
50
|
+
<Column>
|
|
51
|
+
<Typography variant="h2">App Bar</Typography>
|
|
52
|
+
</Column>
|
|
53
|
+
|
|
54
|
+
<Column width="content">
|
|
55
|
+
<IconButton edge="end" aria-label="close">
|
|
56
|
+
<Close />
|
|
57
|
+
</IconButton>
|
|
58
|
+
</Column>
|
|
59
|
+
</Columns>
|
|
60
|
+
</Toolbar>
|
|
61
|
+
</AppBar>
|
|
62
|
+
);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { AppBar } 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.MuiAppBar).toMatchInlineSnapshot(`
|
|
8
|
+
Object {
|
|
9
|
+
"color": "inherit",
|
|
10
|
+
"elevation": 0,
|
|
11
|
+
"position": "static",
|
|
12
|
+
}
|
|
13
|
+
`);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('checks component css', () => {
|
|
17
|
+
expect(renderCSS(<AppBar />, ['MuiAppBar'])).toMatchInlineSnapshot(`
|
|
18
|
+
.MuiAppBar-root {
|
|
19
|
+
width: 100%;
|
|
20
|
+
display: flex;
|
|
21
|
+
z-index: 1100;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.MuiAppBar-positionFixed {
|
|
28
|
+
top: 0;
|
|
29
|
+
left: auto;
|
|
30
|
+
right: 0;
|
|
31
|
+
position: fixed;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media print {
|
|
35
|
+
.MuiAppBar-positionFixed {
|
|
36
|
+
position: absolute;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.MuiAppBar-positionAbsolute {
|
|
41
|
+
top: 0;
|
|
42
|
+
left: auto;
|
|
43
|
+
right: 0;
|
|
44
|
+
position: absolute;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.MuiAppBar-positionSticky {
|
|
48
|
+
top: 0;
|
|
49
|
+
left: auto;
|
|
50
|
+
right: 0;
|
|
51
|
+
position: sticky;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.MuiAppBar-positionStatic {
|
|
55
|
+
position: static;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.MuiAppBar-positionRelative {
|
|
59
|
+
position: relative;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.MuiAppBar-colorDefault {
|
|
63
|
+
color: rgba(0, 0, 0, 0.87);
|
|
64
|
+
background-color: #f5f5f5;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.MuiAppBar-colorPrimary {
|
|
68
|
+
color: Color.White;
|
|
69
|
+
background-color: Color.Blue300;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.MuiAppBar-colorSecondary {
|
|
73
|
+
color: Color.White;
|
|
74
|
+
background-color: #f50057;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.MuiAppBar-colorInherit {
|
|
78
|
+
color: inherit;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.MuiAppBar-colorTransparent {
|
|
82
|
+
color: inherit;
|
|
83
|
+
background-color: transparent;
|
|
84
|
+
}
|
|
85
|
+
`);
|
|
86
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { TextField } from '@material-ui/core';
|
|
2
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
3
|
+
import { Meta } from '@storybook/react';
|
|
4
|
+
import { PropsLink } from '@superdispatch/ui-docs';
|
|
5
|
+
import { Box } from '@superdispatch/ui-lab';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Inputs/Autocomplete',
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<Box maxWidth="240px">
|
|
12
|
+
<Story />
|
|
13
|
+
</Box>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
componentSubtitle: (
|
|
18
|
+
<PropsLink url="https://material-ui.com/api/autocomplete/#props" />
|
|
19
|
+
),
|
|
20
|
+
},
|
|
21
|
+
} as Meta;
|
|
22
|
+
|
|
23
|
+
export const basic = () => (
|
|
24
|
+
<Autocomplete
|
|
25
|
+
options={['Option 1', 'Option 2']}
|
|
26
|
+
renderInput={(params) => (
|
|
27
|
+
<TextField {...params} label="Label" helperText="Helper text" />
|
|
28
|
+
)}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const error = () => (
|
|
33
|
+
<Autocomplete
|
|
34
|
+
options={['Option 1', 'Option 2']}
|
|
35
|
+
renderInput={(params) => (
|
|
36
|
+
<TextField
|
|
37
|
+
{...params}
|
|
38
|
+
error={true}
|
|
39
|
+
label="Label"
|
|
40
|
+
helperText="Error text"
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const disabled = () => (
|
|
47
|
+
<Autocomplete
|
|
48
|
+
disabled={true}
|
|
49
|
+
options={[]}
|
|
50
|
+
renderInput={(params) => <TextField {...params} />}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export const loading = () => (
|
|
55
|
+
<Autocomplete
|
|
56
|
+
loading={true}
|
|
57
|
+
options={[]}
|
|
58
|
+
renderInput={(params) => <TextField {...params} />}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
export const disableClearable = () => (
|
|
63
|
+
<Autocomplete
|
|
64
|
+
disableClearable={true}
|
|
65
|
+
options={['Option 1', 'Option 2']}
|
|
66
|
+
renderInput={(params) => <TextField {...params} />}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export const forcePopupIcon = () => (
|
|
71
|
+
<Autocomplete
|
|
72
|
+
forcePopupIcon={true}
|
|
73
|
+
options={['John Doe', 'Richard Roe']}
|
|
74
|
+
renderInput={(params) => <TextField {...params} />}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SvgIcon } from '@material-ui/core';
|
|
2
|
+
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
|
|
3
|
+
|
|
4
|
+
export function overrideAutocomplete(theme: SuperDispatchTheme): void {
|
|
5
|
+
const sm = theme.breakpoints.up('sm');
|
|
6
|
+
|
|
7
|
+
// Remove `Object.assign` after official release of `Autocomplete`.
|
|
8
|
+
Object.assign(theme.props, {
|
|
9
|
+
MuiAutocomplete: {
|
|
10
|
+
popupIcon: (
|
|
11
|
+
<SvgIcon>
|
|
12
|
+
<path d="M12 16.5L6 9h12l-6 7.5z" fill="currentColor" />
|
|
13
|
+
</SvgIcon>
|
|
14
|
+
),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
Object.assign(theme.overrides, {
|
|
19
|
+
MuiAutocomplete: {
|
|
20
|
+
paper: { ...theme.typography.body2 },
|
|
21
|
+
tag: {
|
|
22
|
+
margin: '4px',
|
|
23
|
+
[sm]: { margin: '2px' },
|
|
24
|
+
},
|
|
25
|
+
endAdornment: {
|
|
26
|
+
top: 0,
|
|
27
|
+
bottom: 0,
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
},
|
|
31
|
+
popupIndicator: {
|
|
32
|
+
'& .MuiSvgIcon-root': {
|
|
33
|
+
fontSize: '24px',
|
|
34
|
+
[sm]: { fontSize: '16px' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
inputRoot: {
|
|
38
|
+
'&[class*="MuiOutlinedInput-root"]': {
|
|
39
|
+
padding: '6px 8px',
|
|
40
|
+
|
|
41
|
+
'& $input': {
|
|
42
|
+
width: '144px',
|
|
43
|
+
padding: '4px',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
'& $input:first-child': { paddingLeft: undefined },
|
|
47
|
+
'& $endAdornment': { right: '12px' },
|
|
48
|
+
|
|
49
|
+
[sm]: {
|
|
50
|
+
padding: theme.spacing(0.5, 0.75),
|
|
51
|
+
'& $input': { padding: '2px' },
|
|
52
|
+
'& $endAdornment': { right: '8px' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
2
|
+
import { renderCSS, renderTheme } from '@superdispatch/ui-testutils';
|
|
3
|
+
|
|
4
|
+
it('checks default props', () => {
|
|
5
|
+
const { props } = renderTheme();
|
|
6
|
+
|
|
7
|
+
// Remove `any` after official release.
|
|
8
|
+
expect((props as any).MuiAutocomplete).toMatchInlineSnapshot(`
|
|
9
|
+
Object {
|
|
10
|
+
"popupIcon": <WithStyles(ForwardRef(SvgIcon))>
|
|
11
|
+
<path
|
|
12
|
+
d="M12 16.5L6 9h12l-6 7.5z"
|
|
13
|
+
fill="currentColor"
|
|
14
|
+
/>
|
|
15
|
+
</WithStyles(ForwardRef(SvgIcon))>,
|
|
16
|
+
}
|
|
17
|
+
`);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('checks component css', () => {
|
|
21
|
+
expect(
|
|
22
|
+
renderCSS(<Autocomplete options={[]} renderInput={() => <div />} />, [
|
|
23
|
+
'MuiAutocomplete',
|
|
24
|
+
]),
|
|
25
|
+
).toMatchInlineSnapshot(`
|
|
26
|
+
.MuiAutocomplete-root.Mui-focused .MuiAutocomplete-clearIndicatorDirty {
|
|
27
|
+
visibility: visible;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (pointer: fine) {
|
|
31
|
+
.MuiAutocomplete-root:hover .MuiAutocomplete-clearIndicatorDirty {
|
|
32
|
+
visibility: visible;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.MuiAutocomplete-fullWidth {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.MuiAutocomplete-tag {
|
|
41
|
+
margin: 4px;
|
|
42
|
+
max-width: calc(100% - 6px);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (min-width: 600px) {
|
|
46
|
+
.MuiAutocomplete-tag {
|
|
47
|
+
margin: 2px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.MuiAutocomplete-tagSizeSmall {
|
|
52
|
+
margin: 2px;
|
|
53
|
+
max-width: calc(100% - 4px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.MuiAutocomplete-inputRoot {
|
|
57
|
+
flex-wrap: wrap;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.MuiAutocomplete-hasPopupIcon .MuiAutocomplete-inputRoot,
|
|
61
|
+
.MuiAutocomplete-hasClearIcon .MuiAutocomplete-inputRoot {
|
|
62
|
+
padding-right: 30px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon
|
|
66
|
+
.MuiAutocomplete-inputRoot {
|
|
67
|
+
padding-right: 56px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.MuiAutocomplete-inputRoot .MuiAutocomplete-input {
|
|
71
|
+
width: 0;
|
|
72
|
+
min-width: 30px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.MuiAutocomplete-inputRoot[class*='MuiInput-root'] {
|
|
76
|
+
padding-bottom: 1px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {
|
|
80
|
+
padding: 6px 8px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'][class*='MuiOutlinedInput-marginDense'] {
|
|
84
|
+
padding: 6px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root'] {
|
|
88
|
+
padding-top: 19px;
|
|
89
|
+
padding-left: 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root'][class*='MuiFilledInput-marginDense'] {
|
|
93
|
+
padding-bottom: 1px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root'][class*='MuiFilledInput-marginDense']
|
|
97
|
+
.MuiAutocomplete-input {
|
|
98
|
+
padding: 4.5px 4px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.MuiAutocomplete-hasPopupIcon
|
|
102
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root'],
|
|
103
|
+
.MuiAutocomplete-hasClearIcon
|
|
104
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root'] {
|
|
105
|
+
padding-right: 39px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon
|
|
109
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root'] {
|
|
110
|
+
padding-right: 65px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root']
|
|
114
|
+
.MuiAutocomplete-input {
|
|
115
|
+
padding: 9px 4px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.MuiAutocomplete-inputRoot[class*='MuiFilledInput-root']
|
|
119
|
+
.MuiAutocomplete-endAdornment {
|
|
120
|
+
right: 9px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'][class*='MuiOutlinedInput-marginDense']
|
|
124
|
+
.MuiAutocomplete-input {
|
|
125
|
+
padding: 4.5px 4px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.MuiAutocomplete-hasPopupIcon
|
|
129
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'],
|
|
130
|
+
.MuiAutocomplete-hasClearIcon
|
|
131
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {
|
|
132
|
+
padding-right: 39px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon
|
|
136
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {
|
|
137
|
+
padding-right: 65px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']
|
|
141
|
+
.MuiAutocomplete-input {
|
|
142
|
+
width: 144px;
|
|
143
|
+
padding: 4px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']
|
|
147
|
+
.MuiAutocomplete-endAdornment {
|
|
148
|
+
right: 12px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@media (min-width: 600px) {
|
|
152
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {
|
|
153
|
+
padding: 4px 6px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']
|
|
157
|
+
.MuiAutocomplete-input {
|
|
158
|
+
padding: 2px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root']
|
|
162
|
+
.MuiAutocomplete-endAdornment {
|
|
163
|
+
right: 8px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.MuiAutocomplete-inputRoot[class*='MuiInput-root'][class*='MuiInput-marginDense']
|
|
168
|
+
.MuiAutocomplete-input {
|
|
169
|
+
padding: 4px 4px 5px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.MuiAutocomplete-inputRoot[class*='MuiInput-root'][class*='MuiInput-marginDense']
|
|
173
|
+
.MuiAutocomplete-input:first-child {
|
|
174
|
+
padding: 3px 0 6px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.MuiAutocomplete-inputRoot[class*='MuiInput-root'] .MuiAutocomplete-input {
|
|
178
|
+
padding: 4px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.MuiAutocomplete-inputRoot[class*='MuiInput-root']
|
|
182
|
+
.MuiAutocomplete-input:first-child {
|
|
183
|
+
padding: 6px 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.MuiAutocomplete-input {
|
|
187
|
+
opacity: 0;
|
|
188
|
+
flex-grow: 1;
|
|
189
|
+
text-overflow: ellipsis;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.MuiAutocomplete-inputFocused {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.MuiAutocomplete-endAdornment {
|
|
197
|
+
top: 0;
|
|
198
|
+
right: 0;
|
|
199
|
+
bottom: 0;
|
|
200
|
+
display: flex;
|
|
201
|
+
position: absolute;
|
|
202
|
+
align-items: center;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.MuiAutocomplete-clearIndicator {
|
|
206
|
+
padding: 4px;
|
|
207
|
+
visibility: hidden;
|
|
208
|
+
margin-right: -2px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.MuiAutocomplete-popupIndicator {
|
|
212
|
+
padding: 2px;
|
|
213
|
+
margin-right: -2px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.MuiAutocomplete-popupIndicator .MuiSvgIcon-root {
|
|
217
|
+
font-size: 24px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@media (min-width: 600px) {
|
|
221
|
+
.MuiAutocomplete-popupIndicator .MuiSvgIcon-root {
|
|
222
|
+
font-size: 16px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.MuiAutocomplete-popupIndicatorOpen {
|
|
227
|
+
transform: rotate(180deg);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.MuiAutocomplete-popper {
|
|
231
|
+
z-index: 1300;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.MuiAutocomplete-popperDisablePortal {
|
|
235
|
+
position: absolute;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.MuiAutocomplete-paper {
|
|
239
|
+
margin: 4px 0;
|
|
240
|
+
overflow: hidden;
|
|
241
|
+
font-size: 14px;
|
|
242
|
+
font-family: 'Inter', sans-serif;
|
|
243
|
+
font-weight: 400;
|
|
244
|
+
line-height: 20px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@media (min-width: 0px) and (max-width: 599.95px) {
|
|
248
|
+
.MuiAutocomplete-paper {
|
|
249
|
+
font-size: 16px;
|
|
250
|
+
line-height: 24px;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.MuiAutocomplete-listbox {
|
|
255
|
+
margin: 0;
|
|
256
|
+
padding: 8px 0;
|
|
257
|
+
overflow: auto;
|
|
258
|
+
list-style: none;
|
|
259
|
+
max-height: 40vh;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.MuiAutocomplete-loading {
|
|
263
|
+
color: Color.Dark200;
|
|
264
|
+
padding: 14px 16px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.MuiAutocomplete-noOptions {
|
|
268
|
+
color: Color.Dark200;
|
|
269
|
+
padding: 14px 16px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.MuiAutocomplete-option {
|
|
273
|
+
cursor: pointer;
|
|
274
|
+
display: flex;
|
|
275
|
+
outline: 0;
|
|
276
|
+
box-sizing: border-box;
|
|
277
|
+
min-height: 48px;
|
|
278
|
+
align-items: center;
|
|
279
|
+
padding-top: 6px;
|
|
280
|
+
padding-left: 16px;
|
|
281
|
+
padding-right: 16px;
|
|
282
|
+
padding-bottom: 6px;
|
|
283
|
+
justify-content: flex-start;
|
|
284
|
+
-webkit-tap-highlight-color: transparent;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@media (min-width: 600px) {
|
|
288
|
+
.MuiAutocomplete-option {
|
|
289
|
+
min-height: auto;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.MuiAutocomplete-option[aria-selected='true'] {
|
|
294
|
+
background-color: Color.Silver300;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.MuiAutocomplete-option[data-focus='true'] {
|
|
298
|
+
background-color: Color.Silver100;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.MuiAutocomplete-option:active {
|
|
302
|
+
background-color: Color.Silver300;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.MuiAutocomplete-option[aria-disabled='true'] {
|
|
306
|
+
opacity: 0.38;
|
|
307
|
+
pointer-events: none;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.MuiAutocomplete-groupLabel {
|
|
311
|
+
top: -8px;
|
|
312
|
+
background-color: Color.White;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.MuiAutocomplete-groupUl {
|
|
316
|
+
padding: 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.MuiAutocomplete-groupUl .MuiAutocomplete-option {
|
|
320
|
+
padding-left: 24px;
|
|
321
|
+
}
|
|
322
|
+
`);
|
|
323
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Avatar } from '@material-ui/core';
|
|
2
|
+
import { PropsLink } from '@superdispatch/ui-docs';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Data Display/Avatar',
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: (
|
|
8
|
+
<PropsLink url="https://material-ui.com/api/avatar/#props" />
|
|
9
|
+
),
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const basic = () => <Avatar />;
|
|
14
|
+
export const text = () => <Avatar>A1</Avatar>;
|
|
15
|
+
export const image = () => (
|
|
16
|
+
<Avatar src="https://images.unsplash.com/photo-1571816119607-57e48af1caa9?q=80" />
|
|
17
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Color } from '../theme/Color';
|
|
2
|
+
import { SuperDispatchTheme } from '../theme/SuperDispatchTheme';
|
|
3
|
+
|
|
4
|
+
export function overrideAvatar(theme: SuperDispatchTheme): void {
|
|
5
|
+
theme.overrides.MuiAvatar = {
|
|
6
|
+
root: {
|
|
7
|
+
...theme.typography.h5,
|
|
8
|
+
textTransform: 'uppercase',
|
|
9
|
+
|
|
10
|
+
width: theme.spacing(5),
|
|
11
|
+
height: theme.spacing(5),
|
|
12
|
+
|
|
13
|
+
[theme.breakpoints.up('sm')]: {
|
|
14
|
+
width: theme.spacing(4),
|
|
15
|
+
height: theme.spacing(4),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
colorDefault: {
|
|
20
|
+
color: Color.Dark300,
|
|
21
|
+
backgroundColor: Color.Silver300,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|