@superdispatch/ui-lab 0.50.4 → 0.50.5
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/package.json +38 -13
- package/pkg/README.md +10 -0
- package/{dist-node → pkg/dist-node}/index.js +41 -21
- package/pkg/dist-node/index.js.map +1 -0
- package/{dist-src → pkg/dist-src}/email-autocomplate/EmailAutocomplete.js +3 -3
- package/{dist-src → pkg/dist-src}/file-drop-zone/FileDropZone.js +2 -2
- package/{dist-src → pkg/dist-src}/index.js +1 -0
- package/{dist-src → pkg/dist-src}/navbar/Navbar.js +13 -4
- package/{dist-src → pkg/dist-src}/navbar/NavbarAccordion.js +18 -9
- package/{dist-src → pkg/dist-src}/navbar/NavbarList.js +1 -1
- package/{dist-src → pkg/dist-src}/sidebar/SidebarBackButton.js +1 -1
- package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItem.js +1 -1
- package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAvatar.js +1 -1
- package/{dist-types → pkg/dist-types}/index.d.ts +8 -2
- package/{dist-web → pkg/dist-web}/index.js +41 -23
- package/pkg/dist-web/index.js.map +1 -0
- package/pkg/package.json +41 -0
- package/playroom.ts +24 -0
- package/src/alert/Alert.stories.tsx +162 -0
- package/src/alert/Alert.tsx +135 -0
- package/src/banner/Banner.stories.tsx +64 -0
- package/src/banner/Banner.tsx +120 -0
- package/src/box/Box.stories.tsx +20 -0
- package/src/box/Box.tsx +257 -0
- package/src/button/Button.stories.tsx +739 -0
- package/src/button/Button.tsx +498 -0
- package/src/button-area/ButtonArea.stories.tsx +65 -0
- package/src/button-area/ButtonArea.tsx +90 -0
- package/src/chat/Chat.stories.tsx +130 -0
- package/src/chat/Chat.tsx +57 -0
- package/src/chat/ChatMessage.tsx +45 -0
- package/src/chat/README.MD +7 -0
- package/src/chat/__tests__/Chat.spec.tsx +29 -0
- package/src/chat/__tests__/ChatMessage.spec.tsx +39 -0
- package/src/container/Container.tsx +48 -0
- package/src/description-item/DescriptionItem.stories.tsx +163 -0
- package/src/description-item/DescriptionItem.tsx +104 -0
- package/src/description-line-item/DescriptionLineItem.stories.tsx +23 -0
- package/src/description-line-item/DescriptionLineItem.tsx +29 -0
- package/src/email-autocomplate/CloseIcon.tsx +20 -0
- package/src/email-autocomplate/EmailAutocomplete.stories.tsx +47 -0
- package/src/email-autocomplate/EmailAutocomplete.tsx +138 -0
- package/src/file-drop-zone/FileDropZone.stories.tsx +44 -0
- package/src/file-drop-zone/FileDropZone.tsx +170 -0
- package/src/file-list-item/FileListItem.stories.tsx +37 -0
- package/src/file-list-item/FileListItem.tsx +148 -0
- package/src/file-list-item/__tests__/FileListItem.spec.tsx +339 -0
- package/src/flag-list/FlagList.stories.tsx +72 -0
- package/src/flag-list/FlagList.tsx +54 -0
- package/src/flag-list/FlagListItem.tsx +126 -0
- package/src/index.spec.ts +53 -0
- package/src/index.ts +36 -0
- package/src/linked-text/LinkeText.stories.tsx +42 -0
- package/src/linked-text/LinkedText.tsx +47 -0
- package/src/multiline-text/MultilineText.stories.tsx +30 -0
- package/src/multiline-text/MultilineText.ts +16 -0
- package/src/navbar/Navbar.stories.tsx +137 -0
- package/src/navbar/Navbar.tsx +132 -0
- package/src/navbar/NavbarAccordion.tsx +195 -0
- package/src/navbar/NavbarAvatar.tsx +51 -0
- package/src/navbar/NavbarBottomBar.tsx +135 -0
- package/src/navbar/NavbarContext.tsx +22 -0
- package/src/navbar/NavbarItem.tsx +125 -0
- package/src/navbar/NavbarList.tsx +247 -0
- package/src/navbar/NavbarMenu.tsx +102 -0
- package/src/passwordStepper/PasswordStrength.stories.tsx +95 -0
- package/src/passwordStepper/PasswordStrength.tsx +107 -0
- package/src/passwordStepper/PasswordUtils.tsx +42 -0
- package/src/passwordStepper/PasswordValidationComponents.tsx +95 -0
- package/src/sidebar/Sidebar.stories.tsx +376 -0
- package/src/sidebar/Sidebar.tsx +75 -0
- package/src/sidebar/SidebarBackButton.tsx +33 -0
- package/src/sidebar/SidebarContainer.tsx +114 -0
- package/src/sidebar/SidebarContent.tsx +119 -0
- package/src/sidebar/SidebarDivider.tsx +15 -0
- package/src/sidebar/SidebarMenuItem.tsx +196 -0
- package/src/sidebar/SidebarMenuItemAction.tsx +27 -0
- package/src/sidebar/SidebarMenuItemAvatar.tsx +59 -0
- package/src/sidebar/SidebarMenuItemContext.tsx +33 -0
- package/src/sidebar/SidebarSubheader.tsx +38 -0
- package/src/styled.d.ts +12 -0
- package/src/text-box/TextBox.stories.tsx +114 -0
- package/src/text-box/TextBox.tsx +238 -0
- package/src/utils/RuleNormalizer.ts +24 -0
- package/src/utils/mergeStyles.ts +28 -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}/alert/Alert.js +0 -0
- /package/{dist-src → pkg/dist-src}/banner/Banner.js +0 -0
- /package/{dist-src → pkg/dist-src}/box/Box.js +0 -0
- /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
- /package/{dist-src → pkg/dist-src}/button-area/ButtonArea.js +0 -0
- /package/{dist-src → pkg/dist-src}/chat/Chat.js +0 -0
- /package/{dist-src → pkg/dist-src}/chat/ChatMessage.js +0 -0
- /package/{dist-src → pkg/dist-src}/container/Container.js +0 -0
- /package/{dist-src → pkg/dist-src}/description-item/DescriptionItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/description-line-item/DescriptionLineItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/email-autocomplate/CloseIcon.js +0 -0
- /package/{dist-src → pkg/dist-src}/file-list-item/FileListItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/flag-list/FlagList.js +0 -0
- /package/{dist-src → pkg/dist-src}/flag-list/FlagListItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/linked-text/LinkedText.js +0 -0
- /package/{dist-src → pkg/dist-src}/multiline-text/MultilineText.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarAvatar.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarBottomBar.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarContext.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarItem.js +0 -0
- /package/{dist-src → pkg/dist-src}/navbar/NavbarMenu.js +0 -0
- /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordStrength.js +0 -0
- /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordUtils.js +0 -0
- /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/Sidebar.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarContainer.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarContent.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarDivider.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
- /package/{dist-src → pkg/dist-src}/sidebar/SidebarSubheader.js +0 -0
- /package/{dist-src → pkg/dist-src}/text-box/TextBox.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/RuleNormalizer.js +0 -0
- /package/{dist-src → pkg/dist-src}/utils/mergeStyles.js +0 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { InputAdornment, TextField } from '@material-ui/core';
|
|
2
|
+
import AddIcon from '@material-ui/icons/Add';
|
|
3
|
+
import DeleteIcon from '@material-ui/icons/Delete';
|
|
4
|
+
import EditIcon from '@material-ui/icons/Edit';
|
|
5
|
+
import NotificationsIcon from '@material-ui/icons/Notifications';
|
|
6
|
+
import NotificationsOffIcon from '@material-ui/icons/NotificationsOff';
|
|
7
|
+
import SearchIcon from '@material-ui/icons/Search';
|
|
8
|
+
import SettingsIcon from '@material-ui/icons/Settings';
|
|
9
|
+
import { Meta } from '@storybook/react';
|
|
10
|
+
import { Stack } from '@superdispatch/ui';
|
|
11
|
+
import { Button } from '@superdispatch/ui-lab';
|
|
12
|
+
import { Placeholder } from '../../../__docs__';
|
|
13
|
+
import { Box } from '../box/Box';
|
|
14
|
+
import { Sidebar } from './Sidebar';
|
|
15
|
+
import { SidebarContainer } from './SidebarContainer';
|
|
16
|
+
import { SidebarContent } from './SidebarContent';
|
|
17
|
+
import { SidebarDivider } from './SidebarDivider';
|
|
18
|
+
import { SidebarMenuItem } from './SidebarMenuItem';
|
|
19
|
+
import { SidebarMenuItemAction } from './SidebarMenuItemAction';
|
|
20
|
+
import { SidebarMenuItemAvatar } from './SidebarMenuItemAvatar';
|
|
21
|
+
import { SidebarSubheader } from './SidebarSubheader';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
title: 'Lab/Sidebar',
|
|
25
|
+
component: Sidebar,
|
|
26
|
+
subcomponents: {
|
|
27
|
+
SidebarContainer,
|
|
28
|
+
SidebarDivider,
|
|
29
|
+
SidebarMenuItem,
|
|
30
|
+
SidebarMenuItemAction,
|
|
31
|
+
SidebarMenuItemAvatar,
|
|
32
|
+
SidebarSubheader,
|
|
33
|
+
},
|
|
34
|
+
} as Meta;
|
|
35
|
+
|
|
36
|
+
export const basic = () => (
|
|
37
|
+
<SidebarContainer
|
|
38
|
+
sidebar={
|
|
39
|
+
<Sidebar title="Settings">
|
|
40
|
+
<SidebarMenuItem selected={true}>General</SidebarMenuItem>
|
|
41
|
+
<SidebarMenuItem>Terminals</SidebarMenuItem>
|
|
42
|
+
<SidebarMenuItem>Driver App</SidebarMenuItem>
|
|
43
|
+
<SidebarMenuItem>Billing</SidebarMenuItem>
|
|
44
|
+
<SidebarMenuItem>Factoring</SidebarMenuItem>
|
|
45
|
+
<SidebarMenuItem external={true}>
|
|
46
|
+
Quickbooks Integration
|
|
47
|
+
</SidebarMenuItem>
|
|
48
|
+
<SidebarMenuItem>Subscription Details</SidebarMenuItem>
|
|
49
|
+
<SidebarMenuItem external={true}>Notification Emails</SidebarMenuItem>
|
|
50
|
+
<SidebarMenuItem external={true}>
|
|
51
|
+
Loadboard Notifications
|
|
52
|
+
</SidebarMenuItem>
|
|
53
|
+
</Sidebar>
|
|
54
|
+
}
|
|
55
|
+
>
|
|
56
|
+
<Placeholder height="100%" width="100%" text="Content" />
|
|
57
|
+
</SidebarContainer>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
export const list = () => (
|
|
61
|
+
<SidebarContainer
|
|
62
|
+
sidebar={
|
|
63
|
+
<Sidebar
|
|
64
|
+
title="Drivers"
|
|
65
|
+
count={9}
|
|
66
|
+
header={
|
|
67
|
+
<Stack space="small">
|
|
68
|
+
<Button fullWidth={true} variant="primary" startIcon={<AddIcon />}>
|
|
69
|
+
Create New
|
|
70
|
+
</Button>
|
|
71
|
+
|
|
72
|
+
<TextField
|
|
73
|
+
fullWidth={true}
|
|
74
|
+
placeholder="Search for drivers…"
|
|
75
|
+
InputProps={{
|
|
76
|
+
startAdornment: (
|
|
77
|
+
<InputAdornment position="start">
|
|
78
|
+
<SearchIcon />
|
|
79
|
+
</InputAdornment>
|
|
80
|
+
),
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
</Stack>
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
<SidebarMenuItem
|
|
87
|
+
badge={1}
|
|
88
|
+
selected={true}
|
|
89
|
+
openContentOnClick={true}
|
|
90
|
+
avatar={<SidebarMenuItemAvatar>Eirwen Minoo</SidebarMenuItemAvatar>}
|
|
91
|
+
secondaryActions={
|
|
92
|
+
<SidebarMenuItemAction title="Edit">
|
|
93
|
+
<EditIcon />
|
|
94
|
+
</SidebarMenuItemAction>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
Eirwen Minoo
|
|
98
|
+
</SidebarMenuItem>
|
|
99
|
+
<SidebarMenuItem
|
|
100
|
+
badge={1}
|
|
101
|
+
openContentOnClick={true}
|
|
102
|
+
avatar={<SidebarMenuItemAvatar>Ole Kielo</SidebarMenuItemAvatar>}
|
|
103
|
+
secondaryActions={
|
|
104
|
+
<SidebarMenuItemAction title="Edit">
|
|
105
|
+
<EditIcon />
|
|
106
|
+
</SidebarMenuItemAction>
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
Ole Kielo
|
|
110
|
+
</SidebarMenuItem>
|
|
111
|
+
<SidebarMenuItem
|
|
112
|
+
openContentOnClick={true}
|
|
113
|
+
avatar={
|
|
114
|
+
<SidebarMenuItemAvatar>Virve Vivi Wangi</SidebarMenuItemAvatar>
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
Virve Vivi Wangi
|
|
118
|
+
</SidebarMenuItem>
|
|
119
|
+
<SidebarMenuItem
|
|
120
|
+
openContentOnClick={true}
|
|
121
|
+
avatar={
|
|
122
|
+
<SidebarMenuItemAvatar>
|
|
123
|
+
Radulf Čedomir Niĉjo Aparna
|
|
124
|
+
</SidebarMenuItemAvatar>
|
|
125
|
+
}
|
|
126
|
+
>
|
|
127
|
+
Radulf Čedomir Niĉjo Aparna
|
|
128
|
+
</SidebarMenuItem>
|
|
129
|
+
<SidebarMenuItem
|
|
130
|
+
openContentOnClick={true}
|
|
131
|
+
avatar={
|
|
132
|
+
<SidebarMenuItemAvatar>Léane Audovacar</SidebarMenuItemAvatar>
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
Léane Audovacar
|
|
136
|
+
</SidebarMenuItem>
|
|
137
|
+
<SidebarMenuItem
|
|
138
|
+
avatar={<SidebarMenuItemAvatar>Devon Vesta</SidebarMenuItemAvatar>}
|
|
139
|
+
>
|
|
140
|
+
Devon Vesta
|
|
141
|
+
</SidebarMenuItem>
|
|
142
|
+
<SidebarMenuItem
|
|
143
|
+
avatar={<SidebarMenuItemAvatar>Xenagoras Ares</SidebarMenuItemAvatar>}
|
|
144
|
+
>
|
|
145
|
+
Xenagoras Ares
|
|
146
|
+
</SidebarMenuItem>
|
|
147
|
+
<SidebarMenuItem
|
|
148
|
+
avatar={<SidebarMenuItemAvatar>Nithya Phebe</SidebarMenuItemAvatar>}
|
|
149
|
+
>
|
|
150
|
+
Nithya Phebe
|
|
151
|
+
</SidebarMenuItem>
|
|
152
|
+
<SidebarMenuItem
|
|
153
|
+
avatar={<SidebarMenuItemAvatar>Nitin Paulette</SidebarMenuItemAvatar>}
|
|
154
|
+
>
|
|
155
|
+
Nitin Paulette
|
|
156
|
+
</SidebarMenuItem>
|
|
157
|
+
</Sidebar>
|
|
158
|
+
}
|
|
159
|
+
>
|
|
160
|
+
<SidebarContent
|
|
161
|
+
title="List"
|
|
162
|
+
action={<Button variant="primary">Create</Button>}
|
|
163
|
+
>
|
|
164
|
+
<Placeholder height="100%" width="100%" text="Content" />
|
|
165
|
+
</SidebarContent>
|
|
166
|
+
</SidebarContainer>
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
export const checkbox = () => (
|
|
170
|
+
<SidebarContainer
|
|
171
|
+
sidebar={
|
|
172
|
+
<Sidebar title="Drivers">
|
|
173
|
+
<SidebarMenuItem
|
|
174
|
+
selected={true}
|
|
175
|
+
openContentOnClick={true}
|
|
176
|
+
avatar={
|
|
177
|
+
<SidebarMenuItemAvatar value={false}>
|
|
178
|
+
Eirwen Minoo
|
|
179
|
+
</SidebarMenuItemAvatar>
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
Eirwen Minoo
|
|
183
|
+
</SidebarMenuItem>
|
|
184
|
+
<SidebarMenuItem
|
|
185
|
+
openContentOnClick={true}
|
|
186
|
+
avatar={
|
|
187
|
+
<SidebarMenuItemAvatar value={true}>
|
|
188
|
+
Ole Kielo
|
|
189
|
+
</SidebarMenuItemAvatar>
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
Ole Kielo
|
|
193
|
+
</SidebarMenuItem>
|
|
194
|
+
<SidebarMenuItem
|
|
195
|
+
openContentOnClick={true}
|
|
196
|
+
avatar={
|
|
197
|
+
<SidebarMenuItemAvatar value={false}>
|
|
198
|
+
Virve Vivi Wangi
|
|
199
|
+
</SidebarMenuItemAvatar>
|
|
200
|
+
}
|
|
201
|
+
>
|
|
202
|
+
Virve Vivi Wangi
|
|
203
|
+
</SidebarMenuItem>
|
|
204
|
+
<SidebarMenuItem
|
|
205
|
+
avatar={
|
|
206
|
+
<SidebarMenuItemAvatar value={false}>
|
|
207
|
+
Radulf Čedomir Niĉjo Aparna
|
|
208
|
+
</SidebarMenuItemAvatar>
|
|
209
|
+
}
|
|
210
|
+
>
|
|
211
|
+
Radulf Čedomir Niĉjo Aparna
|
|
212
|
+
</SidebarMenuItem>
|
|
213
|
+
</Sidebar>
|
|
214
|
+
}
|
|
215
|
+
>
|
|
216
|
+
<SidebarContent title="">
|
|
217
|
+
<Placeholder height="100%" width="100%" text="Content" />
|
|
218
|
+
</SidebarContent>
|
|
219
|
+
</SidebarContainer>
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
export const checkboxMany = () => {
|
|
223
|
+
const items = Array(25)
|
|
224
|
+
.fill(null)
|
|
225
|
+
.map((_, index) => (
|
|
226
|
+
<SidebarMenuItem
|
|
227
|
+
key={index}
|
|
228
|
+
openContentOnClick={true}
|
|
229
|
+
avatar={
|
|
230
|
+
<SidebarMenuItemAvatar value={false}>
|
|
231
|
+
{`Eirwen Minoo (${index})`}
|
|
232
|
+
</SidebarMenuItemAvatar>
|
|
233
|
+
}
|
|
234
|
+
>
|
|
235
|
+
{`Eirwen Minoo (${index})`}
|
|
236
|
+
</SidebarMenuItem>
|
|
237
|
+
));
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<SidebarContainer sidebar={<Sidebar title="Drivers List">{items}</Sidebar>}>
|
|
241
|
+
<SidebarContent title="">
|
|
242
|
+
<Placeholder height="100%" width="100%" text="Content" />
|
|
243
|
+
</SidebarContent>
|
|
244
|
+
</SidebarContainer>
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const complex = () => (
|
|
249
|
+
<SidebarContainer
|
|
250
|
+
sidebar={
|
|
251
|
+
<Sidebar title="Super Loadboard">
|
|
252
|
+
<SidebarMenuItem selected={true} badge={320}>
|
|
253
|
+
Available
|
|
254
|
+
</SidebarMenuItem>
|
|
255
|
+
<SidebarMenuItem badge={5}>Requested</SidebarMenuItem>
|
|
256
|
+
<SidebarMenuItem badge={12}>Booked</SidebarMenuItem>
|
|
257
|
+
<SidebarMenuItem badge={56}>Suggested</SidebarMenuItem>
|
|
258
|
+
|
|
259
|
+
<SidebarDivider />
|
|
260
|
+
|
|
261
|
+
<SidebarSubheader
|
|
262
|
+
action={
|
|
263
|
+
<SidebarMenuItemAction
|
|
264
|
+
placement="right"
|
|
265
|
+
title="Loadboard Notifications"
|
|
266
|
+
>
|
|
267
|
+
<SettingsIcon />
|
|
268
|
+
</SidebarMenuItemAction>
|
|
269
|
+
}
|
|
270
|
+
>
|
|
271
|
+
Load Alerts
|
|
272
|
+
</SidebarSubheader>
|
|
273
|
+
|
|
274
|
+
<SidebarMenuItem
|
|
275
|
+
action={
|
|
276
|
+
<SidebarMenuItemAction title="Mute">
|
|
277
|
+
<NotificationsIcon color="primary" />
|
|
278
|
+
</SidebarMenuItemAction>
|
|
279
|
+
}
|
|
280
|
+
secondaryActions={
|
|
281
|
+
<>
|
|
282
|
+
<SidebarMenuItemAction title="Edit">
|
|
283
|
+
<EditIcon />
|
|
284
|
+
</SidebarMenuItemAction>
|
|
285
|
+
|
|
286
|
+
<SidebarMenuItemAction title="Delete">
|
|
287
|
+
<DeleteIcon />
|
|
288
|
+
</SidebarMenuItemAction>
|
|
289
|
+
</>
|
|
290
|
+
}
|
|
291
|
+
>
|
|
292
|
+
New York, NY - Kansas City, MO
|
|
293
|
+
</SidebarMenuItem>
|
|
294
|
+
|
|
295
|
+
<SidebarMenuItem
|
|
296
|
+
action={
|
|
297
|
+
<SidebarMenuItemAction title="Unmute">
|
|
298
|
+
<NotificationsOffIcon />
|
|
299
|
+
</SidebarMenuItemAction>
|
|
300
|
+
}
|
|
301
|
+
>
|
|
302
|
+
Kansas City, MO - New York, NY
|
|
303
|
+
</SidebarMenuItem>
|
|
304
|
+
|
|
305
|
+
<SidebarMenuItem
|
|
306
|
+
action={
|
|
307
|
+
<SidebarMenuItemAction title="Unmute">
|
|
308
|
+
<NotificationsOffIcon />
|
|
309
|
+
</SidebarMenuItemAction>
|
|
310
|
+
}
|
|
311
|
+
>
|
|
312
|
+
New York, NY - Kansas City, KS
|
|
313
|
+
</SidebarMenuItem>
|
|
314
|
+
|
|
315
|
+
<SidebarMenuItem
|
|
316
|
+
action={
|
|
317
|
+
<SidebarMenuItemAction title="Unmute">
|
|
318
|
+
<NotificationsOffIcon />
|
|
319
|
+
</SidebarMenuItemAction>
|
|
320
|
+
}
|
|
321
|
+
>
|
|
322
|
+
Kansas City, MO - New York, NY
|
|
323
|
+
</SidebarMenuItem>
|
|
324
|
+
|
|
325
|
+
<SidebarMenuItem
|
|
326
|
+
action={
|
|
327
|
+
<SidebarMenuItemAction title="Unmute">
|
|
328
|
+
<NotificationsOffIcon />
|
|
329
|
+
</SidebarMenuItemAction>
|
|
330
|
+
}
|
|
331
|
+
>
|
|
332
|
+
New York, NY - Kansas City, KS
|
|
333
|
+
</SidebarMenuItem>
|
|
334
|
+
|
|
335
|
+
<SidebarMenuItem
|
|
336
|
+
action={
|
|
337
|
+
<SidebarMenuItemAction title="Unmute">
|
|
338
|
+
<NotificationsOffIcon />
|
|
339
|
+
</SidebarMenuItemAction>
|
|
340
|
+
}
|
|
341
|
+
>
|
|
342
|
+
Kansas City, MO - New York, NY
|
|
343
|
+
</SidebarMenuItem>
|
|
344
|
+
|
|
345
|
+
<SidebarMenuItem
|
|
346
|
+
action={
|
|
347
|
+
<SidebarMenuItemAction title="Unmute">
|
|
348
|
+
<NotificationsOffIcon />
|
|
349
|
+
</SidebarMenuItemAction>
|
|
350
|
+
}
|
|
351
|
+
>
|
|
352
|
+
New York, NY - Kansas City, KS
|
|
353
|
+
</SidebarMenuItem>
|
|
354
|
+
|
|
355
|
+
<Box
|
|
356
|
+
bottom={0}
|
|
357
|
+
position="sticky"
|
|
358
|
+
paddingTop="small"
|
|
359
|
+
paddingBottom="small"
|
|
360
|
+
paddingLeft="medium"
|
|
361
|
+
paddingRight="medium"
|
|
362
|
+
>
|
|
363
|
+
<Button
|
|
364
|
+
fullWidth={true}
|
|
365
|
+
startIcon={<NotificationsOffIcon color="action" />}
|
|
366
|
+
variant="neutral"
|
|
367
|
+
>
|
|
368
|
+
Create Load Alert
|
|
369
|
+
</Button>
|
|
370
|
+
</Box>
|
|
371
|
+
</Sidebar>
|
|
372
|
+
}
|
|
373
|
+
>
|
|
374
|
+
<Placeholder height="100%" width="100%" text="Content" />
|
|
375
|
+
</SidebarContainer>
|
|
376
|
+
);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ColorDynamic, Column, Columns, useUID } from '@superdispatch/ui';
|
|
2
|
+
import { forwardRef, ReactNode } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { TextBox } from '../text-box/TextBox';
|
|
5
|
+
|
|
6
|
+
const SidebarRoot = styled.aside`
|
|
7
|
+
top: 0;
|
|
8
|
+
position: sticky;
|
|
9
|
+
overflow-y: auto;
|
|
10
|
+
overflow-x: hidden;
|
|
11
|
+
|
|
12
|
+
height: 100vh;
|
|
13
|
+
background-color: ${ColorDynamic.White};
|
|
14
|
+
border-right: 1px solid ${ColorDynamic.Silver400};
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const SidebarHeader = styled.div`
|
|
18
|
+
top: 0;
|
|
19
|
+
z-index: 2;
|
|
20
|
+
position: sticky;
|
|
21
|
+
padding-left: 24px;
|
|
22
|
+
padding-right: 24px;
|
|
23
|
+
padding-bottom: 8px;
|
|
24
|
+
background-color: ${ColorDynamic.White};
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const SidebarTitle = styled.div`
|
|
28
|
+
height: 64px;
|
|
29
|
+
max-height: 64px;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export interface SidebarProps {
|
|
35
|
+
id?: string;
|
|
36
|
+
title?: ReactNode;
|
|
37
|
+
count?: null | number;
|
|
38
|
+
header?: ReactNode;
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Sidebar = forwardRef<HTMLDivElement, SidebarProps>(
|
|
43
|
+
({ title, count, header, children, id: idProp }, ref) => {
|
|
44
|
+
const id = useUID(idProp);
|
|
45
|
+
const titleID = `${id}-title`;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<SidebarRoot id={id} ref={ref}>
|
|
49
|
+
<SidebarHeader>
|
|
50
|
+
{title && (
|
|
51
|
+
<SidebarTitle>
|
|
52
|
+
<Columns space="xsmall" align="center">
|
|
53
|
+
<Column width="fluid">
|
|
54
|
+
<TextBox variant="heading-2" noWrap={true} id={titleID}>
|
|
55
|
+
{title}
|
|
56
|
+
</TextBox>
|
|
57
|
+
</Column>
|
|
58
|
+
|
|
59
|
+
{!!count && (
|
|
60
|
+
<Column width="content">
|
|
61
|
+
<TextBox color="secondary">{count}</TextBox>
|
|
62
|
+
</Column>
|
|
63
|
+
)}
|
|
64
|
+
</Columns>
|
|
65
|
+
</SidebarTitle>
|
|
66
|
+
)}
|
|
67
|
+
|
|
68
|
+
{header}
|
|
69
|
+
</SidebarHeader>
|
|
70
|
+
|
|
71
|
+
<div aria-labelledby={titleID}>{children}</div>
|
|
72
|
+
</SidebarRoot>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IconButton, IconButtonProps } from '@material-ui/core';
|
|
2
|
+
import { ArrowBack } from '@material-ui/icons';
|
|
3
|
+
import { useCollapseBreakpoint } from '@superdispatch/ui';
|
|
4
|
+
import { ReactElement } from 'react';
|
|
5
|
+
import { useSidebarContext } from './SidebarContainer';
|
|
6
|
+
|
|
7
|
+
export function SidebarBackButton({
|
|
8
|
+
onClick,
|
|
9
|
+
children = <ArrowBack fontSize="small" />,
|
|
10
|
+
...props
|
|
11
|
+
}: IconButtonProps): ReactElement | null {
|
|
12
|
+
const isCollapsed = useCollapseBreakpoint('sm');
|
|
13
|
+
const { openSidebar } = useSidebarContext();
|
|
14
|
+
|
|
15
|
+
if (!isCollapsed) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<IconButton
|
|
21
|
+
{...props}
|
|
22
|
+
size="small"
|
|
23
|
+
onClick={(event) => {
|
|
24
|
+
onClick?.(event);
|
|
25
|
+
if (!event.isDefaultPrevented()) {
|
|
26
|
+
openSidebar();
|
|
27
|
+
}
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</IconButton>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useCollapseBreakpoint } from '@superdispatch/ui';
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
forwardRef,
|
|
5
|
+
ReactChild,
|
|
6
|
+
ReactNode,
|
|
7
|
+
useContext,
|
|
8
|
+
useMemo,
|
|
9
|
+
useState,
|
|
10
|
+
} from 'react';
|
|
11
|
+
import styled from 'styled-components';
|
|
12
|
+
|
|
13
|
+
interface SidebarContext {
|
|
14
|
+
openSidebar: () => void;
|
|
15
|
+
openSidebarContent: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Context = createContext<SidebarContext | null>(null);
|
|
19
|
+
|
|
20
|
+
export function useSidebarContext(): SidebarContext {
|
|
21
|
+
const context = useContext(Context);
|
|
22
|
+
|
|
23
|
+
if (!context) {
|
|
24
|
+
throw new Error('SidebarContext is used outside Provider');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const SidebarContainerSidebar = styled.div`
|
|
31
|
+
height: inherit;
|
|
32
|
+
max-height: inherit;
|
|
33
|
+
min-height: inherit;
|
|
34
|
+
|
|
35
|
+
width: 240px;
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const SidebarContainerContent = styled.div`
|
|
39
|
+
height: inherit;
|
|
40
|
+
max-height: inherit;
|
|
41
|
+
min-height: inherit;
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const SidebarContainerRoot = styled.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
|
|
47
|
+
height: inherit;
|
|
48
|
+
max-height: inherit;
|
|
49
|
+
min-height: inherit;
|
|
50
|
+
|
|
51
|
+
& ${SidebarContainerContent} {
|
|
52
|
+
width: calc(100% - 240px);
|
|
53
|
+
min-width: calc(100% - 240px);
|
|
54
|
+
max-width: calc(100% - 240px);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[data-visibility='sidebar'] ${SidebarContainerSidebar} {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&[data-visibility='sidebar'] ${SidebarContainerContent} {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&[data-visibility='content'] ${SidebarContainerSidebar} {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&[data-visibility='content'] ${SidebarContainerContent} {
|
|
70
|
+
width: 100%;
|
|
71
|
+
max-width: unset;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
export interface SidebarContainerProps {
|
|
76
|
+
sidebar: ReactChild;
|
|
77
|
+
children?: ReactNode;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
type SidebarContainerVisibility = 'both' | 'sidebar' | 'content';
|
|
81
|
+
|
|
82
|
+
export const SidebarContainer = forwardRef<
|
|
83
|
+
HTMLDivElement,
|
|
84
|
+
SidebarContainerProps
|
|
85
|
+
>(({ sidebar, children }, ref) => {
|
|
86
|
+
const isCollapsed = useCollapseBreakpoint('sm');
|
|
87
|
+
const [visibilityState, setVisibilityState] =
|
|
88
|
+
useState<SidebarContainerVisibility>('sidebar');
|
|
89
|
+
|
|
90
|
+
const visibility: SidebarContainerVisibility = isCollapsed
|
|
91
|
+
? visibilityState
|
|
92
|
+
: 'both';
|
|
93
|
+
|
|
94
|
+
const context = useMemo<SidebarContext>(() => {
|
|
95
|
+
return {
|
|
96
|
+
openSidebar: () => {
|
|
97
|
+
setVisibilityState('sidebar');
|
|
98
|
+
},
|
|
99
|
+
openSidebarContent: () => {
|
|
100
|
+
setVisibilityState('content');
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<Context.Provider value={context}>
|
|
107
|
+
<SidebarContainerRoot ref={ref} data-visibility={visibility}>
|
|
108
|
+
<SidebarContainerSidebar>{sidebar}</SidebarContainerSidebar>
|
|
109
|
+
|
|
110
|
+
<SidebarContainerContent>{children}</SidebarContainerContent>
|
|
111
|
+
</SidebarContainerRoot>
|
|
112
|
+
</Context.Provider>
|
|
113
|
+
);
|
|
114
|
+
});
|