@shipfox/react-ui 0.25.0 → 0.27.0

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 (56) hide show
  1. package/dist/components/dot-grid/dot-grid.js +8 -2
  2. package/dist/components/index.d.ts +1 -0
  3. package/dist/components/index.js +1 -0
  4. package/dist/components/slider/index.d.ts +2 -0
  5. package/dist/components/slider/index.js +3 -0
  6. package/dist/components/slider/slider.d.ts +10 -0
  7. package/dist/components/slider/slider.js +38 -0
  8. package/dist/components/table/data-table.js +7 -6
  9. package/dist/components/table/table.stories.data.js +1 -1
  10. package/dist/styles.css +1 -1
  11. package/package.json +17 -5
  12. package/dist/colors.stories.js +0 -61
  13. package/dist/components/alert/alert.stories.js +0 -227
  14. package/dist/components/avatar/avatar.stories.js +0 -267
  15. package/dist/components/badge/badge.stories.js +0 -802
  16. package/dist/components/button/button-link.stories.js +0 -127
  17. package/dist/components/button/button.stories.js +0 -187
  18. package/dist/components/button/icon-button.stories.js +0 -344
  19. package/dist/components/button-group/button-group.stories.js +0 -644
  20. package/dist/components/card/card.stories.js +0 -216
  21. package/dist/components/checkbox/checkbox.stories.js +0 -566
  22. package/dist/components/code-block/code-block.stories.js +0 -341
  23. package/dist/components/combobox/combobox.stories.js +0 -191
  24. package/dist/components/command/command.stories.js +0 -228
  25. package/dist/components/confetti/confetti.stories.js +0 -41
  26. package/dist/components/count-up/count-up.stories.js +0 -568
  27. package/dist/components/dashboard/components/charts/bar-chart.stories.js +0 -287
  28. package/dist/components/dashboard/components/charts/line-chart.stories.js +0 -257
  29. package/dist/components/dashboard/dashboard.stories.js +0 -23
  30. package/dist/components/date-picker/date-picker.stories.js +0 -349
  31. package/dist/components/dropdown-input/dropdown-input.stories.js +0 -240
  32. package/dist/components/dropdown-menu/dropdown-menu.stories.js +0 -462
  33. package/dist/components/dynamic-item/dynamic-item.stories.js +0 -385
  34. package/dist/components/empty-state/empty-state.stories.js +0 -74
  35. package/dist/components/form/form.stories.js +0 -587
  36. package/dist/components/icon/icon.stories.js +0 -38
  37. package/dist/components/inline-tips/inline-tips.stories.js +0 -219
  38. package/dist/components/input/input.stories.js +0 -265
  39. package/dist/components/interval-selector/interval-selector.stories.js +0 -232
  40. package/dist/components/item/item.stories.js +0 -239
  41. package/dist/components/kbd/kbd.stories.js +0 -119
  42. package/dist/components/label/label.stories.js +0 -105
  43. package/dist/components/modal/modal.stories.js +0 -566
  44. package/dist/components/search/search.stories.js +0 -630
  45. package/dist/components/select/select.stories.js +0 -393
  46. package/dist/components/sheet/sheet.stories.js +0 -368
  47. package/dist/components/skeleton/skeleton.stories.js +0 -345
  48. package/dist/components/table/table.stories.js +0 -302
  49. package/dist/components/tabs/tabs.stories.js +0 -179
  50. package/dist/components/textarea/textarea.stories.js +0 -339
  51. package/dist/components/toast/toast.stories.js +0 -326
  52. package/dist/components/tooltip/tooltip.stories.js +0 -560
  53. package/dist/components/typography/code.stories.js +0 -54
  54. package/dist/components/typography/header.stories.js +0 -34
  55. package/dist/components/typography/text.stories.js +0 -105
  56. package/dist/onboarding/sign-in.stories.js +0 -101
@@ -1,462 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { argosScreenshot } from '@argos-ci/storybook/vitest';
3
- import { screen, within } from '@testing-library/react';
4
- import userEvent from '@testing-library/user-event';
5
- import { useState } from 'react';
6
- import { Avatar } from '../avatar/index.js';
7
- import { Button } from '../button/index.js';
8
- import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from './dropdown-menu.js';
9
- const OPEN_MENU_REGEX = /open menu/i;
10
- const ACTIONS_REGEX = /actions/i;
11
- const ORGANIZATION_REGEX = /organization/i;
12
- const COMPLETE_MENU_REGEX = /complete menu/i;
13
- const SWITCH_ORGANIZATION_REGEX = /switch organization/i;
14
- const isTestEnvironment = ()=>typeof navigator !== 'undefined' && navigator.webdriver === true;
15
- async function openMenuAndScreenshot(ctx, triggerRegex, screenshotName, additionalSteps) {
16
- const { canvasElement, step } = ctx;
17
- const canvas = within(canvasElement);
18
- const user = userEvent.setup();
19
- let triggerButton = null;
20
- await step('Open the dropdown menu', async ()=>{
21
- triggerButton = canvas.getByRole('button', {
22
- name: triggerRegex
23
- });
24
- await user.click(triggerButton);
25
- });
26
- await step('Wait for menu to appear and render', async ()=>{
27
- await screen.findByRole('menu');
28
- await new Promise((resolve)=>setTimeout(resolve, 300));
29
- if (isTestEnvironment() && triggerButton instanceof HTMLElement) {
30
- triggerButton.style.display = 'none';
31
- }
32
- await new Promise((resolve)=>setTimeout(resolve, 100));
33
- });
34
- await argosScreenshot(ctx, screenshotName);
35
- if (additionalSteps) {
36
- await additionalSteps(ctx, user);
37
- }
38
- }
39
- const meta = {
40
- title: 'Components/DropdownMenu',
41
- component: DropdownMenuContent,
42
- subcomponents: {
43
- DropdownMenu,
44
- DropdownMenuTrigger,
45
- DropdownMenuItem,
46
- DropdownMenuCheckboxItem,
47
- DropdownMenuRadioGroup,
48
- DropdownMenuRadioItem,
49
- DropdownMenuLabel,
50
- DropdownMenuSeparator,
51
- DropdownMenuGroup,
52
- DropdownMenuSub,
53
- DropdownMenuSubTrigger,
54
- DropdownMenuSubContent
55
- },
56
- parameters: {
57
- layout: 'centered'
58
- },
59
- tags: [
60
- 'autodocs'
61
- ],
62
- argTypes: {
63
- side: {
64
- control: 'select',
65
- options: [
66
- 'top',
67
- 'right',
68
- 'bottom',
69
- 'left'
70
- ],
71
- description: 'The preferred side of the trigger to render against',
72
- table: {
73
- defaultValue: {
74
- summary: 'bottom'
75
- }
76
- }
77
- },
78
- align: {
79
- control: 'select',
80
- options: [
81
- 'start',
82
- 'center',
83
- 'end'
84
- ],
85
- description: 'The preferred alignment against the trigger',
86
- table: {
87
- defaultValue: {
88
- summary: 'start'
89
- }
90
- }
91
- },
92
- sideOffset: {
93
- control: {
94
- type: 'number',
95
- min: 0,
96
- max: 20,
97
- step: 1
98
- },
99
- description: 'Distance in pixels from the trigger',
100
- table: {
101
- defaultValue: {
102
- summary: '4'
103
- }
104
- }
105
- },
106
- alignOffset: {
107
- control: {
108
- type: 'number',
109
- min: -20,
110
- max: 20,
111
- step: 1
112
- },
113
- description: 'Offset in pixels from the alignment edge',
114
- table: {
115
- defaultValue: {
116
- summary: '0'
117
- }
118
- }
119
- },
120
- size: {
121
- control: 'select',
122
- options: [
123
- 'sm',
124
- 'md',
125
- 'lg'
126
- ],
127
- description: 'Size variant of the dropdown content',
128
- table: {
129
- defaultValue: {
130
- summary: 'md'
131
- }
132
- }
133
- }
134
- },
135
- args: {
136
- side: 'bottom',
137
- align: 'center',
138
- sideOffset: 8,
139
- alignOffset: 0,
140
- size: 'md'
141
- }
142
- };
143
- export default meta;
144
- export const Default = {
145
- play: (ctx)=>openMenuAndScreenshot(ctx, OPEN_MENU_REGEX, 'DropdownMenu Default Open'),
146
- render: function DefaultStory(args) {
147
- const [container, setContainer] = useState(null);
148
- return /*#__PURE__*/ _jsx("div", {
149
- ref: setContainer,
150
- className: "relative flex h-500 w-500 items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip overflow-visible",
151
- children: container && /*#__PURE__*/ _jsxs(DropdownMenu, {
152
- children: [
153
- /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
154
- asChild: true,
155
- children: /*#__PURE__*/ _jsx(Button, {
156
- variant: "secondary",
157
- children: "Open Menu"
158
- })
159
- }),
160
- /*#__PURE__*/ _jsxs(DropdownMenuContent, {
161
- ...args,
162
- container: container,
163
- side: "bottom",
164
- align: "center",
165
- children: [
166
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
167
- icon: "editLine",
168
- children: "Edit"
169
- }),
170
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
171
- icon: "addLine",
172
- children: "Add"
173
- }),
174
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
175
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
176
- icon: "deleteBinLine",
177
- children: "Delete"
178
- })
179
- ]
180
- })
181
- ]
182
- })
183
- });
184
- }
185
- };
186
- export const WithShortcuts = {
187
- play: (ctx)=>openMenuAndScreenshot(ctx, ACTIONS_REGEX, 'DropdownMenu With Shortcuts Open'),
188
- render: function WithShortcutsStory(args) {
189
- const [container, setContainer] = useState(null);
190
- return /*#__PURE__*/ _jsx("div", {
191
- ref: setContainer,
192
- className: "relative flex h-500 w-500 items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip overflow-visible",
193
- children: container && /*#__PURE__*/ _jsxs(DropdownMenu, {
194
- children: [
195
- /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
196
- asChild: true,
197
- children: /*#__PURE__*/ _jsx(Button, {
198
- variant: "secondary",
199
- children: "Actions"
200
- })
201
- }),
202
- /*#__PURE__*/ _jsxs(DropdownMenuContent, {
203
- ...args,
204
- container: container,
205
- side: "bottom",
206
- align: "center",
207
- children: [
208
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
209
- icon: "fileCopyLine",
210
- shortcut: "⌘C",
211
- children: "Copy"
212
- }),
213
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
214
- icon: "clipboardLine",
215
- shortcut: "⌘V",
216
- children: "Paste"
217
- }),
218
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
219
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
220
- icon: "deleteBinLine",
221
- shortcut: "⌘⌫",
222
- children: "Delete"
223
- })
224
- ]
225
- })
226
- ]
227
- })
228
- });
229
- }
230
- };
231
- function UserProfileSection() {
232
- return /*#__PURE__*/ _jsxs("div", {
233
- className: "flex items-center gap-8 px-8 py-6",
234
- children: [
235
- /*#__PURE__*/ _jsx(Avatar, {
236
- size: "sm",
237
- content: "image",
238
- src: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=100&h=100&fit=crop&crop=faces",
239
- fallback: "John Doe"
240
- }),
241
- /*#__PURE__*/ _jsxs("div", {
242
- className: "flex flex-col",
243
- children: [
244
- /*#__PURE__*/ _jsx("span", {
245
- className: "text-sm font-medium leading-20 text-foreground-neutral-base",
246
- children: "John Doe"
247
- }),
248
- /*#__PURE__*/ _jsx("span", {
249
- className: "text-xs leading-16 text-foreground-neutral-muted",
250
- children: "john@example.com"
251
- })
252
- ]
253
- })
254
- ]
255
- });
256
- }
257
- function OrganizationItem() {
258
- return /*#__PURE__*/ _jsxs("div", {
259
- className: "flex items-center gap-8 px-8 py-6",
260
- children: [
261
- /*#__PURE__*/ _jsx(Avatar, {
262
- size: "3xs",
263
- content: "logo",
264
- logoName: "stripe",
265
- radius: "rounded"
266
- }),
267
- /*#__PURE__*/ _jsx("span", {
268
- className: "text-sm leading-20 text-foreground-neutral-subtle",
269
- children: "Stripe's organization"
270
- })
271
- ]
272
- });
273
- }
274
- export const OrganizationMenu = {
275
- args: {
276
- size: 'md'
277
- },
278
- play: (ctx)=>openMenuAndScreenshot(ctx, ORGANIZATION_REGEX, 'DropdownMenu Organization Menu Open', async ({ step }, user)=>{
279
- await step('Hover over submenu trigger', async ()=>{
280
- const submenuTrigger = screen.getByRole('menuitem', {
281
- name: SWITCH_ORGANIZATION_REGEX
282
- });
283
- await user.hover(submenuTrigger);
284
- await new Promise((resolve)=>setTimeout(resolve, 200));
285
- });
286
- await argosScreenshot(ctx, 'DropdownMenu Organization Menu Submenu Open');
287
- }),
288
- render: function OrganizationMenuStory(args) {
289
- const [container, setContainer] = useState(null);
290
- return /*#__PURE__*/ _jsx("div", {
291
- ref: setContainer,
292
- className: "relative flex h-600 w-600 items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip overflow-visible",
293
- children: container && /*#__PURE__*/ _jsxs(DropdownMenu, {
294
- children: [
295
- /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
296
- asChild: true,
297
- children: /*#__PURE__*/ _jsx(Button, {
298
- variant: "secondary",
299
- iconLeft: "buildingLine",
300
- children: "Organization"
301
- })
302
- }),
303
- /*#__PURE__*/ _jsxs(DropdownMenuContent, {
304
- ...args,
305
- container: container,
306
- side: "bottom",
307
- align: "start",
308
- children: [
309
- /*#__PURE__*/ _jsx(OrganizationItem, {}),
310
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
311
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
312
- icon: "settings3Line",
313
- children: "Settings"
314
- }),
315
- /*#__PURE__*/ _jsxs(DropdownMenuSub, {
316
- children: [
317
- /*#__PURE__*/ _jsx(DropdownMenuSubTrigger, {
318
- icon: "arrowLeftRightLine",
319
- children: "Switch organization"
320
- }),
321
- /*#__PURE__*/ _jsxs(DropdownMenuSubContent, {
322
- children: [
323
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
324
- icon: "shipfox",
325
- iconStyle: "text-foreground-neutral-base",
326
- className: "text-foreground-neutral-base",
327
- children: "Shipfox"
328
- }),
329
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
330
- icon: "github",
331
- iconStyle: "text-foreground-neutral-base",
332
- className: "text-foreground-neutral-base",
333
- children: "Github"
334
- }),
335
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
336
- icon: "google",
337
- iconStyle: "text-foreground-neutral-base",
338
- className: "text-foreground-neutral-base",
339
- children: "Google"
340
- })
341
- ]
342
- })
343
- ]
344
- }),
345
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
346
- icon: "addLine",
347
- children: "New organization"
348
- })
349
- ]
350
- })
351
- ]
352
- })
353
- });
354
- }
355
- };
356
- export const CompleteExample = {
357
- args: {
358
- size: 'lg',
359
- side: 'bottom'
360
- },
361
- play: (ctx)=>openMenuAndScreenshot(ctx, COMPLETE_MENU_REGEX, 'DropdownMenu Complete Example Open'),
362
- render: function CompleteExampleStory(args) {
363
- const [container, setContainer] = useState(null);
364
- const [showNotifications, setShowNotifications] = useState(true);
365
- const [showBadges, setShowBadges] = useState(false);
366
- const [theme, setTheme] = useState('dark');
367
- return /*#__PURE__*/ _jsx("div", {
368
- ref: setContainer,
369
- className: "relative flex h-600 w-500 items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip overflow-visible",
370
- children: container && /*#__PURE__*/ _jsxs(DropdownMenu, {
371
- children: [
372
- /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
373
- asChild: true,
374
- children: /*#__PURE__*/ _jsx(Button, {
375
- variant: "secondary",
376
- iconLeft: "menu3Line",
377
- children: "Complete Menu"
378
- })
379
- }),
380
- /*#__PURE__*/ _jsxs(DropdownMenuContent, {
381
- ...args,
382
- className: "w-260",
383
- container: container,
384
- side: "bottom",
385
- align: "start",
386
- children: [
387
- /*#__PURE__*/ _jsx(UserProfileSection, {}),
388
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
389
- /*#__PURE__*/ _jsx(DropdownMenuLabel, {
390
- children: "Actions"
391
- }),
392
- /*#__PURE__*/ _jsxs(DropdownMenuGroup, {
393
- children: [
394
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
395
- icon: "sparklingLine",
396
- children: "Getting started"
397
- }),
398
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
399
- icon: "userLine",
400
- children: "Profile settings"
401
- })
402
- ]
403
- }),
404
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
405
- /*#__PURE__*/ _jsx(DropdownMenuLabel, {
406
- children: "Preferences"
407
- }),
408
- /*#__PURE__*/ _jsxs(DropdownMenuGroup, {
409
- children: [
410
- /*#__PURE__*/ _jsx(DropdownMenuCheckboxItem, {
411
- checked: showNotifications,
412
- onCheckedChange: setShowNotifications,
413
- closeOnSelect: false,
414
- children: "Show notifications"
415
- }),
416
- /*#__PURE__*/ _jsx(DropdownMenuCheckboxItem, {
417
- checked: showBadges,
418
- onCheckedChange: setShowBadges,
419
- closeOnSelect: false,
420
- children: "Show badges"
421
- })
422
- ]
423
- }),
424
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
425
- /*#__PURE__*/ _jsx(DropdownMenuLabel, {
426
- children: "Theme"
427
- }),
428
- /*#__PURE__*/ _jsxs(DropdownMenuRadioGroup, {
429
- value: theme,
430
- onValueChange: setTheme,
431
- children: [
432
- /*#__PURE__*/ _jsx(DropdownMenuRadioItem, {
433
- value: "light",
434
- closeOnSelect: false,
435
- children: "Light"
436
- }),
437
- /*#__PURE__*/ _jsx(DropdownMenuRadioItem, {
438
- value: "dark",
439
- closeOnSelect: false,
440
- children: "Dark"
441
- }),
442
- /*#__PURE__*/ _jsx(DropdownMenuRadioItem, {
443
- value: "system",
444
- closeOnSelect: false,
445
- children: "System"
446
- })
447
- ]
448
- }),
449
- /*#__PURE__*/ _jsx(DropdownMenuSeparator, {}),
450
- /*#__PURE__*/ _jsx(DropdownMenuItem, {
451
- icon: "logoutCircleLine",
452
- children: "Log out"
453
- })
454
- ]
455
- })
456
- ]
457
- })
458
- });
459
- }
460
- };
461
-
462
- //# sourceMappingURL=dropdown-menu.stories.js.map