@superdispatch/ui-lab 0.21.8 → 0.21.12
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 +59 -34
- package/pkg/README.md +10 -0
- package/{dist-node → pkg/dist-node}/index.js +25 -23
- package/pkg/dist-node/index.js.map +1 -0
- package/{dist-src → pkg/dist-src}/alert/Alert.js +2 -4
- 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}/container/Container.js +0 -0
- package/{dist-src → pkg/dist-src}/description-item/DescriptionItem.js +0 -0
- package/{dist-src → pkg/dist-src}/file-drop-zone/FileDropZone.js +0 -0
- package/{dist-src → pkg/dist-src}/file-list-item/FileListItem.js +0 -0
- package/{dist-src → pkg/dist-src}/index.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/Navbar.js +0 -0
- package/{dist-src → pkg/dist-src}/navbar/NavbarAccordion.js +5 -10
- package/{dist-src → pkg/dist-src}/navbar/NavbarAvatar.js +0 -0
- package/{dist-src → pkg/dist-src}/navbar/NavbarBottomBar.js +16 -6
- 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/NavbarList.js +0 -0
- package/{dist-src → pkg/dist-src}/navbar/NavbarMenu.js +0 -0
- package/{dist-src → pkg/dist-src}/sidebar/Sidebar.js +0 -0
- package/{dist-src → pkg/dist-src}/sidebar/SidebarBackButton.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/SidebarMenuItem.js +0 -0
- package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
- package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAvatar.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
- package/{dist-types → pkg/dist-types}/index.d.ts +308 -308
- package/{dist-web → pkg/dist-web}/index.js +26 -24
- package/pkg/dist-web/index.js.map +1 -0
- package/pkg/package.json +34 -0
- package/playroom.ts +23 -0
- package/src/alert/Alert.stories.tsx +105 -0
- package/src/alert/Alert.tsx +108 -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 +252 -0
- package/src/button/Button.stories.tsx +717 -0
- package/src/button/Button.tsx +460 -0
- package/src/button-area/ButtonArea.stories.tsx +65 -0
- package/src/button-area/ButtonArea.tsx +88 -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/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 +145 -0
- package/src/file-list-item/__tests__/FileListItem.spec.tsx +339 -0
- package/src/index.spec.ts +43 -0
- package/src/index.ts +28 -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 +135 -0
- package/src/navbar/Navbar.tsx +111 -0
- package/src/navbar/NavbarAccordion.tsx +171 -0
- package/src/navbar/NavbarAvatar.tsx +51 -0
- package/src/navbar/NavbarBottomBar.tsx +135 -0
- package/src/navbar/NavbarContext.tsx +23 -0
- package/src/navbar/NavbarItem.tsx +119 -0
- package/src/navbar/NavbarList.tsx +225 -0
- package/src/navbar/NavbarMenu.tsx +102 -0
- package/src/sidebar/Sidebar.stories.tsx +363 -0
- package/src/sidebar/Sidebar.tsx +73 -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 +211 -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 +108 -0
- package/src/text-box/TextBox.tsx +229 -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
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { Stack } from '@superdispatch/ui';
|
|
2
|
+
import { renderComponent } from '@superdispatch/ui-testutils';
|
|
3
|
+
import { screen } from '@testing-library/react';
|
|
4
|
+
import { FileListItem } from '../FileListItem';
|
|
5
|
+
|
|
6
|
+
it('checks if delete button appears', () => {
|
|
7
|
+
renderComponent(<FileListItem name="TST1208 Dispatcher Info.pdf" />);
|
|
8
|
+
|
|
9
|
+
expect(screen.getAllByTitle('Delete')).toHaveLength(1);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('checks if delete button dont appear', () => {
|
|
13
|
+
renderComponent(
|
|
14
|
+
<FileListItem name="TST1208 Dispatcher Info.pdf" canDelete={false} />,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(screen.queryByTitle('Delete')).toBeNull();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('checks if FileListItem renders properly', () => {
|
|
21
|
+
renderComponent(
|
|
22
|
+
<FileListItem name="TST1208 Dispatcher Info.pdf" canDelete={false} />,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(screen.getByLabelText('file-list-item')).toMatchInlineSnapshot(`
|
|
26
|
+
<div
|
|
27
|
+
aria-label="file-list-item"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="Columns-SD__sc-1a73118-0 iVMHMK"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
34
|
+
>
|
|
35
|
+
<div>
|
|
36
|
+
<svg
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
class="MuiSvgIcon-root MuiSvgIcon-colorAction MuiSvgIcon-fontSizeSmall"
|
|
39
|
+
focusable="false"
|
|
40
|
+
viewBox="0 0 24 24"
|
|
41
|
+
>
|
|
42
|
+
<path
|
|
43
|
+
d="M12,10.5H13V13.5H12V10.5M7,11.5H8V10.5H7V11.5M20,6V18A2,2 0 0,1 18,20H6A2,2 0 0,1 4,18V6A2,2 0 0,1 6,4H18A2,2 0 0,1 20,6M9.5,10.5A1.5,1.5 0 0,0 8,9H5.5V15H7V13H8A1.5,1.5 0 0,0 9.5,11.5V10.5M14.5,10.5A1.5,1.5 0 0,0 13,9H10.5V15H13A1.5,1.5 0 0,0 14.5,13.5V10.5M18.5,9H15.5V15H17V13H18.5V11.5H17V10.5H18.5V9Z"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div
|
|
49
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 hbBUFf"
|
|
50
|
+
>
|
|
51
|
+
<div>
|
|
52
|
+
<div
|
|
53
|
+
class="FileListItem__FileListItemName-SD__sc-hxbsiy-0 gMzDXg"
|
|
54
|
+
id="uid_3"
|
|
55
|
+
>
|
|
56
|
+
TST1208 Dispatcher Info.pdf
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
<div
|
|
61
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
62
|
+
>
|
|
63
|
+
<div />
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
`);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('checks if FileListItem renders', () => {
|
|
71
|
+
renderComponent(
|
|
72
|
+
<Stack aria-label="file-list-items-stack">
|
|
73
|
+
<FileListItem name="Read this document.txt" />
|
|
74
|
+
<FileListItem name="TST1208 Dispatcher Info.pdf" />
|
|
75
|
+
<FileListItem name="TST1208 Dispatcher Info.pdf" canDelete={false} />
|
|
76
|
+
<FileListItem
|
|
77
|
+
name="attachment.jpg"
|
|
78
|
+
url="https://picsum.photos/seed/picsum/1024/768"
|
|
79
|
+
/>
|
|
80
|
+
</Stack>,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
expect(screen.getByLabelText('file-list-items-stack')).toMatchInlineSnapshot(`
|
|
84
|
+
<div
|
|
85
|
+
aria-label="file-list-items-stack"
|
|
86
|
+
class="Stack__StackRoot-SD__sc-qkml7c-0 cNqlNY"
|
|
87
|
+
>
|
|
88
|
+
<div>
|
|
89
|
+
<div
|
|
90
|
+
aria-label="file-list-item"
|
|
91
|
+
>
|
|
92
|
+
<div
|
|
93
|
+
class="Columns-SD__sc-1a73118-0 iVMHMK"
|
|
94
|
+
>
|
|
95
|
+
<div
|
|
96
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
97
|
+
>
|
|
98
|
+
<div>
|
|
99
|
+
<svg
|
|
100
|
+
aria-hidden="true"
|
|
101
|
+
class="MuiSvgIcon-root MuiSvgIcon-colorAction MuiSvgIcon-fontSizeSmall"
|
|
102
|
+
focusable="false"
|
|
103
|
+
viewBox="0 0 24 24"
|
|
104
|
+
>
|
|
105
|
+
<path
|
|
106
|
+
d="M14,17H7V15H14M17,13H7V11H17M17,9H7V7H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z"
|
|
107
|
+
/>
|
|
108
|
+
</svg>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div
|
|
112
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 hbBUFf"
|
|
113
|
+
>
|
|
114
|
+
<div>
|
|
115
|
+
<div
|
|
116
|
+
class="FileListItem__FileListItemName-SD__sc-hxbsiy-0 gMzDXg"
|
|
117
|
+
id="uid_4"
|
|
118
|
+
>
|
|
119
|
+
Read this document.txt
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
<div
|
|
124
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
125
|
+
>
|
|
126
|
+
<div>
|
|
127
|
+
<button
|
|
128
|
+
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall"
|
|
129
|
+
tabindex="0"
|
|
130
|
+
title="Delete"
|
|
131
|
+
type="button"
|
|
132
|
+
>
|
|
133
|
+
<span
|
|
134
|
+
class="MuiIconButton-label"
|
|
135
|
+
>
|
|
136
|
+
<svg
|
|
137
|
+
aria-hidden="true"
|
|
138
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeSmall"
|
|
139
|
+
focusable="false"
|
|
140
|
+
viewBox="0 0 24 24"
|
|
141
|
+
>
|
|
142
|
+
<path
|
|
143
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
144
|
+
/>
|
|
145
|
+
</svg>
|
|
146
|
+
</span>
|
|
147
|
+
<span
|
|
148
|
+
class="MuiTouchRipple-root"
|
|
149
|
+
/>
|
|
150
|
+
</button>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
<div>
|
|
157
|
+
<div
|
|
158
|
+
aria-label="file-list-item"
|
|
159
|
+
>
|
|
160
|
+
<div
|
|
161
|
+
class="Columns-SD__sc-1a73118-0 iVMHMK"
|
|
162
|
+
>
|
|
163
|
+
<div
|
|
164
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
165
|
+
>
|
|
166
|
+
<div>
|
|
167
|
+
<svg
|
|
168
|
+
aria-hidden="true"
|
|
169
|
+
class="MuiSvgIcon-root MuiSvgIcon-colorAction MuiSvgIcon-fontSizeSmall"
|
|
170
|
+
focusable="false"
|
|
171
|
+
viewBox="0 0 24 24"
|
|
172
|
+
>
|
|
173
|
+
<path
|
|
174
|
+
d="M12,10.5H13V13.5H12V10.5M7,11.5H8V10.5H7V11.5M20,6V18A2,2 0 0,1 18,20H6A2,2 0 0,1 4,18V6A2,2 0 0,1 6,4H18A2,2 0 0,1 20,6M9.5,10.5A1.5,1.5 0 0,0 8,9H5.5V15H7V13H8A1.5,1.5 0 0,0 9.5,11.5V10.5M14.5,10.5A1.5,1.5 0 0,0 13,9H10.5V15H13A1.5,1.5 0 0,0 14.5,13.5V10.5M18.5,9H15.5V15H17V13H18.5V11.5H17V10.5H18.5V9Z"
|
|
175
|
+
/>
|
|
176
|
+
</svg>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
<div
|
|
180
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 hbBUFf"
|
|
181
|
+
>
|
|
182
|
+
<div>
|
|
183
|
+
<div
|
|
184
|
+
class="FileListItem__FileListItemName-SD__sc-hxbsiy-0 gMzDXg"
|
|
185
|
+
id="uid_5"
|
|
186
|
+
>
|
|
187
|
+
TST1208 Dispatcher Info.pdf
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
<div
|
|
192
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
193
|
+
>
|
|
194
|
+
<div>
|
|
195
|
+
<button
|
|
196
|
+
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall"
|
|
197
|
+
tabindex="0"
|
|
198
|
+
title="Delete"
|
|
199
|
+
type="button"
|
|
200
|
+
>
|
|
201
|
+
<span
|
|
202
|
+
class="MuiIconButton-label"
|
|
203
|
+
>
|
|
204
|
+
<svg
|
|
205
|
+
aria-hidden="true"
|
|
206
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeSmall"
|
|
207
|
+
focusable="false"
|
|
208
|
+
viewBox="0 0 24 24"
|
|
209
|
+
>
|
|
210
|
+
<path
|
|
211
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
212
|
+
/>
|
|
213
|
+
</svg>
|
|
214
|
+
</span>
|
|
215
|
+
<span
|
|
216
|
+
class="MuiTouchRipple-root"
|
|
217
|
+
/>
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
<div>
|
|
225
|
+
<div
|
|
226
|
+
aria-label="file-list-item"
|
|
227
|
+
>
|
|
228
|
+
<div
|
|
229
|
+
class="Columns-SD__sc-1a73118-0 iVMHMK"
|
|
230
|
+
>
|
|
231
|
+
<div
|
|
232
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
233
|
+
>
|
|
234
|
+
<div>
|
|
235
|
+
<svg
|
|
236
|
+
aria-hidden="true"
|
|
237
|
+
class="MuiSvgIcon-root MuiSvgIcon-colorAction MuiSvgIcon-fontSizeSmall"
|
|
238
|
+
focusable="false"
|
|
239
|
+
viewBox="0 0 24 24"
|
|
240
|
+
>
|
|
241
|
+
<path
|
|
242
|
+
d="M12,10.5H13V13.5H12V10.5M7,11.5H8V10.5H7V11.5M20,6V18A2,2 0 0,1 18,20H6A2,2 0 0,1 4,18V6A2,2 0 0,1 6,4H18A2,2 0 0,1 20,6M9.5,10.5A1.5,1.5 0 0,0 8,9H5.5V15H7V13H8A1.5,1.5 0 0,0 9.5,11.5V10.5M14.5,10.5A1.5,1.5 0 0,0 13,9H10.5V15H13A1.5,1.5 0 0,0 14.5,13.5V10.5M18.5,9H15.5V15H17V13H18.5V11.5H17V10.5H18.5V9Z"
|
|
243
|
+
/>
|
|
244
|
+
</svg>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
<div
|
|
248
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 hbBUFf"
|
|
249
|
+
>
|
|
250
|
+
<div>
|
|
251
|
+
<div
|
|
252
|
+
class="FileListItem__FileListItemName-SD__sc-hxbsiy-0 gMzDXg"
|
|
253
|
+
id="uid_6"
|
|
254
|
+
>
|
|
255
|
+
TST1208 Dispatcher Info.pdf
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
<div
|
|
260
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
261
|
+
>
|
|
262
|
+
<div />
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
<div>
|
|
268
|
+
<div
|
|
269
|
+
aria-label="file-list-item"
|
|
270
|
+
>
|
|
271
|
+
<div
|
|
272
|
+
class="Columns-SD__sc-1a73118-0 iVMHMK"
|
|
273
|
+
>
|
|
274
|
+
<div
|
|
275
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
276
|
+
>
|
|
277
|
+
<div>
|
|
278
|
+
<svg
|
|
279
|
+
aria-hidden="true"
|
|
280
|
+
class="MuiSvgIcon-root MuiSvgIcon-colorAction MuiSvgIcon-fontSizeSmall"
|
|
281
|
+
focusable="false"
|
|
282
|
+
viewBox="0 0 24 24"
|
|
283
|
+
>
|
|
284
|
+
<path
|
|
285
|
+
d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"
|
|
286
|
+
/>
|
|
287
|
+
</svg>
|
|
288
|
+
</div>
|
|
289
|
+
</div>
|
|
290
|
+
<div
|
|
291
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 hbBUFf"
|
|
292
|
+
>
|
|
293
|
+
<div>
|
|
294
|
+
<div
|
|
295
|
+
class="FileListItem__FileListItemName-SD__sc-hxbsiy-0 gMzDXg"
|
|
296
|
+
id="uid_7"
|
|
297
|
+
>
|
|
298
|
+
Object {
|
|
299
|
+
"pathname": "/seed/picsum/1024/768",
|
|
300
|
+
}
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
<div
|
|
305
|
+
class="Column__ColumnRoot-SD__sc-m9n6o6-0 jNPayl"
|
|
306
|
+
>
|
|
307
|
+
<div>
|
|
308
|
+
<button
|
|
309
|
+
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall"
|
|
310
|
+
tabindex="0"
|
|
311
|
+
title="Delete"
|
|
312
|
+
type="button"
|
|
313
|
+
>
|
|
314
|
+
<span
|
|
315
|
+
class="MuiIconButton-label"
|
|
316
|
+
>
|
|
317
|
+
<svg
|
|
318
|
+
aria-hidden="true"
|
|
319
|
+
class="MuiSvgIcon-root MuiSvgIcon-fontSizeSmall"
|
|
320
|
+
focusable="false"
|
|
321
|
+
viewBox="0 0 24 24"
|
|
322
|
+
>
|
|
323
|
+
<path
|
|
324
|
+
d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"
|
|
325
|
+
/>
|
|
326
|
+
</svg>
|
|
327
|
+
</span>
|
|
328
|
+
<span
|
|
329
|
+
class="MuiTouchRipple-root"
|
|
330
|
+
/>
|
|
331
|
+
</button>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
`);
|
|
339
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as api from '.';
|
|
2
|
+
|
|
3
|
+
test('api', () => {
|
|
4
|
+
expect(api).toMatchInlineSnapshot(`
|
|
5
|
+
Object {
|
|
6
|
+
"Alert": React.forwardRef(Alert),
|
|
7
|
+
"AnchorButton": React.forwardRef(AnchorButton),
|
|
8
|
+
"Banner": React.forwardRef(Banner),
|
|
9
|
+
"Box": React.forwardRef(Box),
|
|
10
|
+
"Button": React.forwardRef(Button),
|
|
11
|
+
"ButtonArea": React.forwardRef(ButtonArea),
|
|
12
|
+
"Container": React.forwardRef(Container),
|
|
13
|
+
"DescriptionItem": React.forwardRef(DescriptionItem),
|
|
14
|
+
"FileDropZone": React.forwardRef(FileDropZone),
|
|
15
|
+
"FileListItem": React.forwardRef(FileListItem),
|
|
16
|
+
"LinkedText": [Function],
|
|
17
|
+
"MultilineText": React.forwardRef(MultilineText),
|
|
18
|
+
"Navbar": [Function],
|
|
19
|
+
"NavbarAvatar": [Function],
|
|
20
|
+
"NavbarBadge": React.forwardRef(NavbarItem__NavbarBadge),
|
|
21
|
+
"NavbarBottomBar": [Function],
|
|
22
|
+
"NavbarItem": [Function],
|
|
23
|
+
"NavbarLabel": React.forwardRef(NavbarItem__NavbarLabel),
|
|
24
|
+
"NavbarList": [Function],
|
|
25
|
+
"NavbarMenu": [Function],
|
|
26
|
+
"NavbarMenuItem": [Function],
|
|
27
|
+
"Sidebar": React.forwardRef(Sidebar),
|
|
28
|
+
"SidebarBackButton": [Function],
|
|
29
|
+
"SidebarContainer": React.forwardRef(SidebarContainer),
|
|
30
|
+
"SidebarContent": [Function],
|
|
31
|
+
"SidebarDivider": React.forwardRef(SidebarDivider),
|
|
32
|
+
"SidebarMenuItem": React.forwardRef(SidebarMenuItem),
|
|
33
|
+
"SidebarMenuItemAction": React.forwardRef(SidebarMenuItemAction),
|
|
34
|
+
"SidebarMenuItemAvatar": React.forwardRef(SidebarMenuItemAvatar),
|
|
35
|
+
"SidebarSubheader": React.forwardRef(SidebarSubheader),
|
|
36
|
+
"TextBox": React.forwardRef(TextBox),
|
|
37
|
+
"formatBytes": [Function],
|
|
38
|
+
"toBytes": [Function],
|
|
39
|
+
"useNavbarContext": [Function],
|
|
40
|
+
"useSidebarContext": [Function],
|
|
41
|
+
}
|
|
42
|
+
`);
|
|
43
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from './alert/Alert';
|
|
2
|
+
export * from './banner/Banner';
|
|
3
|
+
export * from './box/Box';
|
|
4
|
+
export * from './button-area/ButtonArea';
|
|
5
|
+
export * from './button/Button';
|
|
6
|
+
export * from './container/Container';
|
|
7
|
+
export * from './description-item/DescriptionItem';
|
|
8
|
+
export * from './file-drop-zone/FileDropZone';
|
|
9
|
+
export * from './file-list-item/FileListItem';
|
|
10
|
+
export * from './linked-text/LinkedText';
|
|
11
|
+
export * from './multiline-text/MultilineText';
|
|
12
|
+
export * from './navbar/Navbar';
|
|
13
|
+
export * from './navbar/NavbarAvatar';
|
|
14
|
+
export * from './navbar/NavbarBottomBar';
|
|
15
|
+
export { useNavbarContext } from './navbar/NavbarContext';
|
|
16
|
+
export * from './navbar/NavbarItem';
|
|
17
|
+
export * from './navbar/NavbarList';
|
|
18
|
+
export * from './navbar/NavbarMenu';
|
|
19
|
+
export * from './sidebar/Sidebar';
|
|
20
|
+
export * from './sidebar/SidebarBackButton';
|
|
21
|
+
export * from './sidebar/SidebarContainer';
|
|
22
|
+
export * from './sidebar/SidebarContent';
|
|
23
|
+
export * from './sidebar/SidebarDivider';
|
|
24
|
+
export * from './sidebar/SidebarMenuItem';
|
|
25
|
+
export * from './sidebar/SidebarMenuItemAction';
|
|
26
|
+
export * from './sidebar/SidebarMenuItemAvatar';
|
|
27
|
+
export * from './sidebar/SidebarSubheader';
|
|
28
|
+
export * from './text-box/TextBox';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { Stack } from '@superdispatch/ui';
|
|
3
|
+
import { Box } from '../box/Box';
|
|
4
|
+
import { LinkComponentProps, LinkedText } from './LinkedText';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Lab/LinkedText',
|
|
8
|
+
component: LinkedText,
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<Box maxWidth="200px">
|
|
12
|
+
<Story />
|
|
13
|
+
</Box>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
} as Meta;
|
|
17
|
+
|
|
18
|
+
export const basic = () => (
|
|
19
|
+
<Stack>
|
|
20
|
+
<LinkedText>
|
|
21
|
+
Component works with (http://www.google.com) or without (www.google.com)
|
|
22
|
+
protocols in link. Emails are detected too: email@ex.com
|
|
23
|
+
</LinkedText>
|
|
24
|
+
</Stack>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const customLinkComponent = () => {
|
|
28
|
+
const CustomLinkComponent = ({ children, ...props }: LinkComponentProps) => (
|
|
29
|
+
<a {...props}>
|
|
30
|
+
<i>{children}</i>
|
|
31
|
+
</a>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Stack>
|
|
36
|
+
<LinkedText linkComponent={CustomLinkComponent}>
|
|
37
|
+
Component works with (http://www.google.com) or without (www.google.com)
|
|
38
|
+
protocols in link. Emails are detected too: email@ex.com
|
|
39
|
+
</LinkedText>
|
|
40
|
+
</Stack>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Link } from '@material-ui/core';
|
|
2
|
+
import {
|
|
3
|
+
AnchorHTMLAttributes,
|
|
4
|
+
forwardRef,
|
|
5
|
+
FunctionComponent,
|
|
6
|
+
ReactElement,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { Anchorme } from 'react-anchorme';
|
|
9
|
+
|
|
10
|
+
export type LinkComponentProps = Omit<
|
|
11
|
+
AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
12
|
+
'href'
|
|
13
|
+
> & {
|
|
14
|
+
href: string;
|
|
15
|
+
truncate?: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const DefaultLinkComponent = forwardRef<HTMLAnchorElement, LinkComponentProps>(
|
|
19
|
+
(
|
|
20
|
+
{ color, target = '_blank', rel = 'noreferrer noopener', ...props },
|
|
21
|
+
ref,
|
|
22
|
+
) => <Link {...props} ref={ref} rel={rel} target={target} />,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
DefaultLinkComponent.displayName = 'DefaultLinkComponent';
|
|
26
|
+
|
|
27
|
+
export interface LinkedTextProps
|
|
28
|
+
extends Omit<LinkComponentProps, 'ref' | 'href'> {
|
|
29
|
+
children?: null | string;
|
|
30
|
+
linkComponent?: FunctionComponent<LinkComponentProps>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function LinkedText({
|
|
34
|
+
children,
|
|
35
|
+
linkComponent = DefaultLinkComponent,
|
|
36
|
+
...props
|
|
37
|
+
}: LinkedTextProps): ReactElement | null {
|
|
38
|
+
if (!children) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Anchorme {...props} linkComponent={linkComponent}>
|
|
44
|
+
{children}
|
|
45
|
+
</Anchorme>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { Box } from '../box/Box';
|
|
3
|
+
import { MultilineText } from './MultilineText';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Lab/MultilineText',
|
|
7
|
+
component: MultilineText,
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<Box maxWidth="300px">
|
|
11
|
+
<Story />
|
|
12
|
+
</Box>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
} as Meta;
|
|
16
|
+
|
|
17
|
+
export const basic = () => (
|
|
18
|
+
<Box>
|
|
19
|
+
<MultilineText>{`This is a multiline text with a lot of white space.
|
|
20
|
+
|
|
21
|
+
Lorem ipsum dolor sit amet,
|
|
22
|
+
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
23
|
+
|
|
24
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.`}</MultilineText>
|
|
29
|
+
</Box>
|
|
30
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Property } from 'csstype';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export interface MultilineTextProps {
|
|
5
|
+
overflowWrap?: Extract<
|
|
6
|
+
Property.OverflowWrap,
|
|
7
|
+
'anywhere' | 'break-word' | 'normal'
|
|
8
|
+
>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const MultilineText = styled.span<MultilineTextProps>`
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
overflow-wrap: ${({ overflowWrap = 'normal' }) => overflowWrap};
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
MultilineText.displayName = 'MultilineText';
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountCircle as ProfileIcon,
|
|
3
|
+
AllInbox,
|
|
4
|
+
Dashboard,
|
|
5
|
+
ExitToApp,
|
|
6
|
+
Notifications,
|
|
7
|
+
People,
|
|
8
|
+
Settings,
|
|
9
|
+
} from '@material-ui/icons';
|
|
10
|
+
import { Meta } from '@storybook/react';
|
|
11
|
+
import { noop } from 'lodash';
|
|
12
|
+
import { Box, Navbar, NavbarAvatar, NavbarMenu, TextBox } from '../..';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Lab/Navbar',
|
|
16
|
+
component: Navbar,
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
},
|
|
20
|
+
} as Meta;
|
|
21
|
+
|
|
22
|
+
const bottomItems = [
|
|
23
|
+
{
|
|
24
|
+
value: '/orders',
|
|
25
|
+
label: 'All Orders',
|
|
26
|
+
icon: <AllInbox fontSize="small" />,
|
|
27
|
+
active: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: 'Customers',
|
|
31
|
+
value: 'Customers',
|
|
32
|
+
icon: <People />,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 'profile',
|
|
36
|
+
label: 'Profile',
|
|
37
|
+
icon: <ProfileIcon />,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const menuItems = [
|
|
42
|
+
{
|
|
43
|
+
key: 'profile',
|
|
44
|
+
icon: <ProfileIcon />,
|
|
45
|
+
label: 'Profile',
|
|
46
|
+
onClick: noop,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: 'notification-settings',
|
|
50
|
+
icon: <Notifications />,
|
|
51
|
+
label: 'Notification Settings',
|
|
52
|
+
onClick: noop,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'logout',
|
|
56
|
+
icon: <ExitToApp />,
|
|
57
|
+
label: 'Log Out',
|
|
58
|
+
onClick: noop,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
const items = [
|
|
63
|
+
{
|
|
64
|
+
icon: <People />,
|
|
65
|
+
label: 'Customers',
|
|
66
|
+
groupKey: 1,
|
|
67
|
+
key: 'Customers',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
icon: <Settings />,
|
|
71
|
+
label: 'Settings',
|
|
72
|
+
groupKey: 2,
|
|
73
|
+
key: 'Settings',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
icon: <Dashboard />,
|
|
77
|
+
label: 'Dashboard',
|
|
78
|
+
groupKey: 2,
|
|
79
|
+
key: 'Dashbaord',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
icon: <AllInbox />,
|
|
83
|
+
label: 'Orders',
|
|
84
|
+
groupKey: 3,
|
|
85
|
+
key: 'Orders',
|
|
86
|
+
items: [
|
|
87
|
+
{
|
|
88
|
+
label: 'Customers',
|
|
89
|
+
groupKey: 2,
|
|
90
|
+
key: 'Customers',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: 'Settings',
|
|
94
|
+
groupKey: 2,
|
|
95
|
+
key: 'Settings',
|
|
96
|
+
active: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
ident: 1,
|
|
100
|
+
groupKey: 2,
|
|
101
|
+
label: 'Requests',
|
|
102
|
+
key: 'Requests',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
export const basic = () => {
|
|
109
|
+
return (
|
|
110
|
+
<Box height="100vh">
|
|
111
|
+
<Navbar
|
|
112
|
+
items={items}
|
|
113
|
+
bottomItems={bottomItems}
|
|
114
|
+
header={
|
|
115
|
+
<TextBox variant="heading-3" color="white">
|
|
116
|
+
Super Navbar
|
|
117
|
+
</TextBox>
|
|
118
|
+
}
|
|
119
|
+
footer={
|
|
120
|
+
<NavbarMenu items={menuItems}>
|
|
121
|
+
<NavbarAvatar
|
|
122
|
+
title="John"
|
|
123
|
+
subtitle="Smith"
|
|
124
|
+
src="https://images.unsplash.com/photo-1571816119607-57e48af1caa9?q=80&w=256&h=256"
|
|
125
|
+
>
|
|
126
|
+
JS
|
|
127
|
+
</NavbarAvatar>
|
|
128
|
+
</NavbarMenu>
|
|
129
|
+
}
|
|
130
|
+
>
|
|
131
|
+
Hello
|
|
132
|
+
</Navbar>
|
|
133
|
+
</Box>
|
|
134
|
+
);
|
|
135
|
+
};
|