@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.
Files changed (124) hide show
  1. package/.babelrc.js +5 -0
  2. package/package.json +38 -13
  3. package/pkg/README.md +10 -0
  4. package/{dist-node → pkg/dist-node}/index.js +41 -21
  5. package/pkg/dist-node/index.js.map +1 -0
  6. package/{dist-src → pkg/dist-src}/email-autocomplate/EmailAutocomplete.js +3 -3
  7. package/{dist-src → pkg/dist-src}/file-drop-zone/FileDropZone.js +2 -2
  8. package/{dist-src → pkg/dist-src}/index.js +1 -0
  9. package/{dist-src → pkg/dist-src}/navbar/Navbar.js +13 -4
  10. package/{dist-src → pkg/dist-src}/navbar/NavbarAccordion.js +18 -9
  11. package/{dist-src → pkg/dist-src}/navbar/NavbarList.js +1 -1
  12. package/{dist-src → pkg/dist-src}/sidebar/SidebarBackButton.js +1 -1
  13. package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItem.js +1 -1
  14. package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAvatar.js +1 -1
  15. package/{dist-types → pkg/dist-types}/index.d.ts +8 -2
  16. package/{dist-web → pkg/dist-web}/index.js +41 -23
  17. package/pkg/dist-web/index.js.map +1 -0
  18. package/pkg/package.json +41 -0
  19. package/playroom.ts +24 -0
  20. package/src/alert/Alert.stories.tsx +162 -0
  21. package/src/alert/Alert.tsx +135 -0
  22. package/src/banner/Banner.stories.tsx +64 -0
  23. package/src/banner/Banner.tsx +120 -0
  24. package/src/box/Box.stories.tsx +20 -0
  25. package/src/box/Box.tsx +257 -0
  26. package/src/button/Button.stories.tsx +739 -0
  27. package/src/button/Button.tsx +498 -0
  28. package/src/button-area/ButtonArea.stories.tsx +65 -0
  29. package/src/button-area/ButtonArea.tsx +90 -0
  30. package/src/chat/Chat.stories.tsx +130 -0
  31. package/src/chat/Chat.tsx +57 -0
  32. package/src/chat/ChatMessage.tsx +45 -0
  33. package/src/chat/README.MD +7 -0
  34. package/src/chat/__tests__/Chat.spec.tsx +29 -0
  35. package/src/chat/__tests__/ChatMessage.spec.tsx +39 -0
  36. package/src/container/Container.tsx +48 -0
  37. package/src/description-item/DescriptionItem.stories.tsx +163 -0
  38. package/src/description-item/DescriptionItem.tsx +104 -0
  39. package/src/description-line-item/DescriptionLineItem.stories.tsx +23 -0
  40. package/src/description-line-item/DescriptionLineItem.tsx +29 -0
  41. package/src/email-autocomplate/CloseIcon.tsx +20 -0
  42. package/src/email-autocomplate/EmailAutocomplete.stories.tsx +47 -0
  43. package/src/email-autocomplate/EmailAutocomplete.tsx +138 -0
  44. package/src/file-drop-zone/FileDropZone.stories.tsx +44 -0
  45. package/src/file-drop-zone/FileDropZone.tsx +170 -0
  46. package/src/file-list-item/FileListItem.stories.tsx +37 -0
  47. package/src/file-list-item/FileListItem.tsx +148 -0
  48. package/src/file-list-item/__tests__/FileListItem.spec.tsx +339 -0
  49. package/src/flag-list/FlagList.stories.tsx +72 -0
  50. package/src/flag-list/FlagList.tsx +54 -0
  51. package/src/flag-list/FlagListItem.tsx +126 -0
  52. package/src/index.spec.ts +53 -0
  53. package/src/index.ts +36 -0
  54. package/src/linked-text/LinkeText.stories.tsx +42 -0
  55. package/src/linked-text/LinkedText.tsx +47 -0
  56. package/src/multiline-text/MultilineText.stories.tsx +30 -0
  57. package/src/multiline-text/MultilineText.ts +16 -0
  58. package/src/navbar/Navbar.stories.tsx +137 -0
  59. package/src/navbar/Navbar.tsx +132 -0
  60. package/src/navbar/NavbarAccordion.tsx +195 -0
  61. package/src/navbar/NavbarAvatar.tsx +51 -0
  62. package/src/navbar/NavbarBottomBar.tsx +135 -0
  63. package/src/navbar/NavbarContext.tsx +22 -0
  64. package/src/navbar/NavbarItem.tsx +125 -0
  65. package/src/navbar/NavbarList.tsx +247 -0
  66. package/src/navbar/NavbarMenu.tsx +102 -0
  67. package/src/passwordStepper/PasswordStrength.stories.tsx +95 -0
  68. package/src/passwordStepper/PasswordStrength.tsx +107 -0
  69. package/src/passwordStepper/PasswordUtils.tsx +42 -0
  70. package/src/passwordStepper/PasswordValidationComponents.tsx +95 -0
  71. package/src/sidebar/Sidebar.stories.tsx +376 -0
  72. package/src/sidebar/Sidebar.tsx +75 -0
  73. package/src/sidebar/SidebarBackButton.tsx +33 -0
  74. package/src/sidebar/SidebarContainer.tsx +114 -0
  75. package/src/sidebar/SidebarContent.tsx +119 -0
  76. package/src/sidebar/SidebarDivider.tsx +15 -0
  77. package/src/sidebar/SidebarMenuItem.tsx +196 -0
  78. package/src/sidebar/SidebarMenuItemAction.tsx +27 -0
  79. package/src/sidebar/SidebarMenuItemAvatar.tsx +59 -0
  80. package/src/sidebar/SidebarMenuItemContext.tsx +33 -0
  81. package/src/sidebar/SidebarSubheader.tsx +38 -0
  82. package/src/styled.d.ts +12 -0
  83. package/src/text-box/TextBox.stories.tsx +114 -0
  84. package/src/text-box/TextBox.tsx +238 -0
  85. package/src/utils/RuleNormalizer.ts +24 -0
  86. package/src/utils/mergeStyles.ts +28 -0
  87. package/tsconfig.json +19 -0
  88. package/LICENSE +0 -21
  89. package/dist-node/index.js.map +0 -1
  90. package/dist-web/index.js.map +0 -1
  91. /package/{dist-src → pkg/dist-src}/alert/Alert.js +0 -0
  92. /package/{dist-src → pkg/dist-src}/banner/Banner.js +0 -0
  93. /package/{dist-src → pkg/dist-src}/box/Box.js +0 -0
  94. /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
  95. /package/{dist-src → pkg/dist-src}/button-area/ButtonArea.js +0 -0
  96. /package/{dist-src → pkg/dist-src}/chat/Chat.js +0 -0
  97. /package/{dist-src → pkg/dist-src}/chat/ChatMessage.js +0 -0
  98. /package/{dist-src → pkg/dist-src}/container/Container.js +0 -0
  99. /package/{dist-src → pkg/dist-src}/description-item/DescriptionItem.js +0 -0
  100. /package/{dist-src → pkg/dist-src}/description-line-item/DescriptionLineItem.js +0 -0
  101. /package/{dist-src → pkg/dist-src}/email-autocomplate/CloseIcon.js +0 -0
  102. /package/{dist-src → pkg/dist-src}/file-list-item/FileListItem.js +0 -0
  103. /package/{dist-src → pkg/dist-src}/flag-list/FlagList.js +0 -0
  104. /package/{dist-src → pkg/dist-src}/flag-list/FlagListItem.js +0 -0
  105. /package/{dist-src → pkg/dist-src}/linked-text/LinkedText.js +0 -0
  106. /package/{dist-src → pkg/dist-src}/multiline-text/MultilineText.js +0 -0
  107. /package/{dist-src → pkg/dist-src}/navbar/NavbarAvatar.js +0 -0
  108. /package/{dist-src → pkg/dist-src}/navbar/NavbarBottomBar.js +0 -0
  109. /package/{dist-src → pkg/dist-src}/navbar/NavbarContext.js +0 -0
  110. /package/{dist-src → pkg/dist-src}/navbar/NavbarItem.js +0 -0
  111. /package/{dist-src → pkg/dist-src}/navbar/NavbarMenu.js +0 -0
  112. /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordStrength.js +0 -0
  113. /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordUtils.js +0 -0
  114. /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
  115. /package/{dist-src → pkg/dist-src}/sidebar/Sidebar.js +0 -0
  116. /package/{dist-src → pkg/dist-src}/sidebar/SidebarContainer.js +0 -0
  117. /package/{dist-src → pkg/dist-src}/sidebar/SidebarContent.js +0 -0
  118. /package/{dist-src → pkg/dist-src}/sidebar/SidebarDivider.js +0 -0
  119. /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
  120. /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
  121. /package/{dist-src → pkg/dist-src}/sidebar/SidebarSubheader.js +0 -0
  122. /package/{dist-src → pkg/dist-src}/text-box/TextBox.js +0 -0
  123. /package/{dist-src → pkg/dist-src}/utils/RuleNormalizer.js +0 -0
  124. /package/{dist-src → pkg/dist-src}/utils/mergeStyles.js +0 -0
@@ -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 bwYPTL"
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 bwYPTL"
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 bwYPTL"
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 bwYPTL"
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 bwYPTL"
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,72 @@
1
+ import { Link, Tooltip } from '@material-ui/core';
2
+ import { Meta } from '@storybook/react';
3
+ import { Button } from '../button/Button';
4
+ import { FlagList } from './FlagList';
5
+ import { FlagListItem } from './FlagListItem';
6
+
7
+ export default {
8
+ title: 'Lab/FlagList',
9
+ component: FlagList,
10
+ subcomponents: { FlagListItem },
11
+ } as Meta;
12
+
13
+ export const basic = () => (
14
+ <FlagList
15
+ title={<Link href="#">Alexandrino Cappuccino</Link>}
16
+ endAction={<Button variant="neutral">View Profile</Button>}
17
+ >
18
+ <FlagListItem showHelpIcon={true}>New Item</FlagListItem>
19
+ <FlagListItem
20
+ variant="warning"
21
+ showHelpIcon={true}
22
+ endAction={<Button variant="neutral">Action</Button>}
23
+ >
24
+ Warning
25
+ </FlagListItem>
26
+ <FlagListItem
27
+ variant="danger"
28
+ showHelpIcon={true}
29
+ endAction={<Button variant="neutral">Action</Button>}
30
+ >
31
+ Alert
32
+ </FlagListItem>
33
+ </FlagList>
34
+ );
35
+
36
+ export const headerless = () => (
37
+ <FlagList isStandalone={true}>
38
+ <FlagListItem
39
+ showHelpIcon={true}
40
+ endAction={<Button variant="neutral">Action</Button>}
41
+ >
42
+ New Item
43
+ </FlagListItem>
44
+ <FlagListItem
45
+ variant="warning"
46
+ showHelpIcon={true}
47
+ endAction={<Button variant="neutral">Action</Button>}
48
+ >
49
+ Warning
50
+ </FlagListItem>
51
+ <FlagListItem
52
+ variant="danger"
53
+ showHelpIcon={true}
54
+ endAction={<Button variant="neutral">Action</Button>}
55
+ >
56
+ Alert
57
+ </FlagListItem>
58
+ </FlagList>
59
+ );
60
+
61
+ export const withTooltips = () => (
62
+ <FlagList title="Flight to Mars">
63
+ <Tooltip placement="top-end" title="This is a tooltip for New Item">
64
+ <FlagListItem
65
+ showHelpIcon={true}
66
+ endAction={<Button variant="neutral">Action</Button>}
67
+ >
68
+ New Item
69
+ </FlagListItem>
70
+ </Tooltip>
71
+ </FlagList>
72
+ );
@@ -0,0 +1,54 @@
1
+ import { ColorDynamic } from '@superdispatch/ui';
2
+ import { forwardRef, ReactNode } from 'react';
3
+ import styled from 'styled-components';
4
+
5
+ const FlagListHeader = styled.div`
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: space-between;
9
+ flex-wrap: wrap;
10
+
11
+ gap: 16px;
12
+ padding: 12px 16px;
13
+
14
+ background: ${ColorDynamic.Silver200};
15
+ border: 1px solid ${ColorDynamic.Silver400};
16
+ border-bottom: none;
17
+ border-radius: 4px 4px 0 0;
18
+
19
+ ${({ theme }) => theme.breakpoints.down('xs')} {
20
+ flex-direction: column;
21
+ align-items: flex-start;
22
+ }
23
+ `;
24
+
25
+ const FlagListContainer = styled.div`
26
+ display: flex;
27
+ flex-direction: column;
28
+ `;
29
+
30
+ interface BannerListProps {
31
+ isStandalone?: boolean;
32
+ title?: ReactNode;
33
+ endAction?: ReactNode;
34
+ children: ReactNode;
35
+ }
36
+
37
+ export const FlagList = forwardRef<HTMLDivElement, BannerListProps>(
38
+ ({ isStandalone = false, title, endAction, children }, ref) => {
39
+ return (
40
+ <FlagListContainer
41
+ data-variant={isStandalone ? 'standalone' : 'with-header'}
42
+ ref={ref}
43
+ >
44
+ {(title || endAction) && (
45
+ <FlagListHeader>
46
+ {title}
47
+ {endAction}
48
+ </FlagListHeader>
49
+ )}
50
+ {children}
51
+ </FlagListContainer>
52
+ );
53
+ },
54
+ );
@@ -0,0 +1,126 @@
1
+ import { Error, Flag, Help, Warning } from '@material-ui/icons';
2
+ import { ColorDynamic } from '@superdispatch/ui';
3
+ import { forwardRef, ReactNode } from 'react';
4
+ import styled, { css } from 'styled-components';
5
+
6
+ type Variant = 'primary' | 'warning' | 'danger';
7
+
8
+ const IconContainer = styled.div`
9
+ padding: 4px;
10
+ border-radius: 50%;
11
+ background: ${ColorDynamic.Silver200};
12
+ color: ${ColorDynamic.Blue300};
13
+ transition: ${({ theme }) =>
14
+ theme.transitions.create(['color', 'background-color'])};
15
+
16
+ & .MuiSvgIcon-root {
17
+ font-size: 16px;
18
+ }
19
+ `;
20
+
21
+ const Content = styled.div`
22
+ display: flex;
23
+ align-items: center;
24
+ width: 100%;
25
+ gap: 8px;
26
+ `;
27
+
28
+ const HelpIcon = styled.div`
29
+ margin-left: auto;
30
+
31
+ & > svg {
32
+ font-size: 16px;
33
+ color: ${ColorDynamic.Dark500};
34
+ }
35
+ `;
36
+
37
+ const EndActions = styled.div`
38
+ display: flex;
39
+ align-items: center;
40
+ margin-left: auto;
41
+ gap: 8px;
42
+
43
+ ${({ theme }) => theme.breakpoints.down('xs')} {
44
+ margin-left: 0;
45
+ width: 100%;
46
+ }
47
+ `;
48
+
49
+ const BannerListItemStandalone = css`
50
+ background: ${ColorDynamic.Silver200};
51
+ `;
52
+
53
+ const BannerListContainer = styled.div`
54
+ display: flex;
55
+ align-items: center;
56
+ gap: 8px;
57
+
58
+ padding: 8px 16px 8px 12px;
59
+ border: 1px solid ${ColorDynamic.Silver400};
60
+ background: ${ColorDynamic.White};
61
+ cursor: default;
62
+
63
+ transition: ${({ theme }) =>
64
+ theme.transitions.create(['color', 'background-color'])};
65
+
66
+ & + & {
67
+ border-top: none;
68
+ }
69
+
70
+ &:last-child {
71
+ border-radius: 0 0 4px 4px;
72
+ }
73
+
74
+ &:hover {
75
+ background: ${ColorDynamic.Silver200};
76
+
77
+ & ${IconContainer} {
78
+ background: ${ColorDynamic.White};
79
+ }
80
+ }
81
+
82
+ [data-variant='standalone'] &:not(:hover) {
83
+ ${BannerListItemStandalone}
84
+ }
85
+
86
+ ${({ theme }) => theme.breakpoints.down('xs')} {
87
+ flex-direction: column;
88
+ align-items: flex-start;
89
+ }
90
+ `;
91
+
92
+ interface BannerItemProps {
93
+ variant?: Variant;
94
+ showHelpIcon?: boolean;
95
+ endAction?: ReactNode;
96
+ children?: ReactNode;
97
+ }
98
+
99
+ export const FlagListItem = forwardRef<HTMLDivElement, BannerItemProps>(
100
+ (
101
+ { variant = 'primary', showHelpIcon, endAction, children, ...rest },
102
+ ref,
103
+ ) => {
104
+ return (
105
+ <BannerListContainer {...rest} ref={ref}>
106
+ <Content>
107
+ <IconContainer>
108
+ {variant === 'danger' ? (
109
+ <Error htmlColor={ColorDynamic.Red300} />
110
+ ) : variant === 'warning' ? (
111
+ <Warning htmlColor={ColorDynamic.Yellow300} />
112
+ ) : (
113
+ <Flag />
114
+ )}
115
+ </IconContainer>
116
+
117
+ {children}
118
+
119
+ <HelpIcon>{showHelpIcon && <Help />}</HelpIcon>
120
+ </Content>
121
+
122
+ {endAction && <EndActions>{endAction}</EndActions>}
123
+ </BannerListContainer>
124
+ );
125
+ },
126
+ );
@@ -0,0 +1,53 @@
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
+ "Chat": React.forwardRef(Chat),
13
+ "ChatMessage": React.forwardRef(ChatMessage),
14
+ "Container": React.forwardRef(Container),
15
+ "DescriptionItem": React.forwardRef(DescriptionItem),
16
+ "DescriptionLineItem": React.forwardRef(DescriptionLineItem),
17
+ "DottedLine": React.forwardRef(DescriptionLineItem__DottedLine),
18
+ "EmailAutocomplete": React.forwardRef(EmailAutocomplete),
19
+ "FileDropZone": React.forwardRef(FileDropZone),
20
+ "FileListItem": React.forwardRef(FileListItem),
21
+ "FlagList": React.forwardRef(FlagList),
22
+ "FlagListItem": React.forwardRef(FlagListItem),
23
+ "LinkedText": [Function],
24
+ "MultilineText": React.forwardRef(MultilineText),
25
+ "Navbar": [Function],
26
+ "NavbarAccordion": [Function],
27
+ "NavbarAccordionLabel": React.forwardRef(NavbarAccordion__NavbarAccordionLabel),
28
+ "NavbarAvatar": [Function],
29
+ "NavbarBadge": React.forwardRef(NavbarItem__NavbarBadge),
30
+ "NavbarBottomBar": [Function],
31
+ "NavbarItem": [Function],
32
+ "NavbarLabel": React.forwardRef(NavbarItem__NavbarLabel),
33
+ "NavbarList": [Function],
34
+ "NavbarMenu": [Function],
35
+ "NavbarMenuItem": [Function],
36
+ "PasswordStrength": [Function],
37
+ "Sidebar": React.forwardRef(Sidebar),
38
+ "SidebarBackButton": [Function],
39
+ "SidebarContainer": React.forwardRef(SidebarContainer),
40
+ "SidebarContent": [Function],
41
+ "SidebarDivider": React.forwardRef(SidebarDivider),
42
+ "SidebarMenuItem": React.forwardRef(SidebarMenuItem),
43
+ "SidebarMenuItemAction": React.forwardRef(SidebarMenuItemAction),
44
+ "SidebarMenuItemAvatar": React.forwardRef(SidebarMenuItemAvatar),
45
+ "SidebarSubheader": React.forwardRef(SidebarSubheader),
46
+ "TextBox": React.forwardRef(TextBox),
47
+ "formatBytes": [Function],
48
+ "toBytes": [Function],
49
+ "useNavbarContext": [Function],
50
+ "useSidebarContext": [Function],
51
+ }
52
+ `);
53
+ });
package/src/index.ts ADDED
@@ -0,0 +1,36 @@
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 './chat/Chat';
7
+ export * from './chat/ChatMessage';
8
+ export * from './container/Container';
9
+ export * from './description-item/DescriptionItem';
10
+ export * from './description-line-item/DescriptionLineItem';
11
+ export * from './email-autocomplate/EmailAutocomplete';
12
+ export * from './file-drop-zone/FileDropZone';
13
+ export * from './file-list-item/FileListItem';
14
+ export * from './flag-list/FlagList';
15
+ export * from './flag-list/FlagListItem';
16
+ export * from './linked-text/LinkedText';
17
+ export * from './multiline-text/MultilineText';
18
+ export * from './navbar/Navbar';
19
+ export * from './navbar/NavbarAccordion';
20
+ export * from './navbar/NavbarAvatar';
21
+ export * from './navbar/NavbarBottomBar';
22
+ export { useNavbarContext } from './navbar/NavbarContext';
23
+ export * from './navbar/NavbarItem';
24
+ export * from './navbar/NavbarList';
25
+ export * from './navbar/NavbarMenu';
26
+ export * from './passwordStepper/PasswordStrength';
27
+ export * from './sidebar/Sidebar';
28
+ export * from './sidebar/SidebarBackButton';
29
+ export * from './sidebar/SidebarContainer';
30
+ export * from './sidebar/SidebarContent';
31
+ export * from './sidebar/SidebarDivider';
32
+ export * from './sidebar/SidebarMenuItem';
33
+ export * from './sidebar/SidebarMenuItemAction';
34
+ export * from './sidebar/SidebarMenuItemAvatar';
35
+ export * from './sidebar/SidebarSubheader';
36
+ export * from './text-box/TextBox';