@shipfox/react-ui 0.25.0 → 0.26.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.
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +3 -0
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +38 -0
- package/dist/styles.css +1 -1
- package/package.json +4 -4
- package/dist/colors.stories.js +0 -61
- package/dist/components/alert/alert.stories.js +0 -227
- package/dist/components/avatar/avatar.stories.js +0 -267
- package/dist/components/badge/badge.stories.js +0 -802
- package/dist/components/button/button-link.stories.js +0 -127
- package/dist/components/button/button.stories.js +0 -187
- package/dist/components/button/icon-button.stories.js +0 -344
- package/dist/components/button-group/button-group.stories.js +0 -644
- package/dist/components/card/card.stories.js +0 -216
- package/dist/components/checkbox/checkbox.stories.js +0 -566
- package/dist/components/code-block/code-block.stories.js +0 -341
- package/dist/components/combobox/combobox.stories.js +0 -191
- package/dist/components/command/command.stories.js +0 -228
- package/dist/components/confetti/confetti.stories.js +0 -41
- package/dist/components/count-up/count-up.stories.js +0 -568
- package/dist/components/dashboard/components/charts/bar-chart.stories.js +0 -287
- package/dist/components/dashboard/components/charts/line-chart.stories.js +0 -257
- package/dist/components/dashboard/dashboard.stories.js +0 -23
- package/dist/components/date-picker/date-picker.stories.js +0 -349
- package/dist/components/dropdown-input/dropdown-input.stories.js +0 -240
- package/dist/components/dropdown-menu/dropdown-menu.stories.js +0 -462
- package/dist/components/dynamic-item/dynamic-item.stories.js +0 -385
- package/dist/components/empty-state/empty-state.stories.js +0 -74
- package/dist/components/form/form.stories.js +0 -587
- package/dist/components/icon/icon.stories.js +0 -38
- package/dist/components/inline-tips/inline-tips.stories.js +0 -219
- package/dist/components/input/input.stories.js +0 -265
- package/dist/components/interval-selector/interval-selector.stories.js +0 -232
- package/dist/components/item/item.stories.js +0 -239
- package/dist/components/kbd/kbd.stories.js +0 -119
- package/dist/components/label/label.stories.js +0 -105
- package/dist/components/modal/modal.stories.js +0 -566
- package/dist/components/search/search.stories.js +0 -630
- package/dist/components/select/select.stories.js +0 -393
- package/dist/components/sheet/sheet.stories.js +0 -368
- package/dist/components/skeleton/skeleton.stories.js +0 -345
- package/dist/components/table/table.stories.js +0 -302
- package/dist/components/tabs/tabs.stories.js +0 -179
- package/dist/components/textarea/textarea.stories.js +0 -339
- package/dist/components/toast/toast.stories.js +0 -326
- package/dist/components/tooltip/tooltip.stories.js +0 -560
- package/dist/components/typography/code.stories.js +0 -54
- package/dist/components/typography/header.stories.js +0 -34
- package/dist/components/typography/text.stories.js +0 -105
- package/dist/onboarding/sign-in.stories.js +0 -101
|
@@ -1,368 +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 { Button } from '../../components/button/index.js';
|
|
6
|
-
import { Input } from '../../components/input/index.js';
|
|
7
|
-
import { Label } from '../../components/label/index.js';
|
|
8
|
-
import { Text } from '../../components/typography/index.js';
|
|
9
|
-
import { useState } from 'react';
|
|
10
|
-
import { Sheet, SheetBody, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from './sheet.js';
|
|
11
|
-
const OPEN_SHEET_REGEX = /open sheet/i;
|
|
12
|
-
const SETTINGS_REGEX = /settings/i;
|
|
13
|
-
async function openSheetAndScreenshot(ctx, triggerRegex, screenshotName) {
|
|
14
|
-
const { canvasElement, step } = ctx;
|
|
15
|
-
const canvas = within(canvasElement);
|
|
16
|
-
const user = userEvent.setup();
|
|
17
|
-
await step('Open the sheet', async ()=>{
|
|
18
|
-
const triggerButton = canvas.getByRole('button', {
|
|
19
|
-
name: triggerRegex
|
|
20
|
-
});
|
|
21
|
-
await user.click(triggerButton);
|
|
22
|
-
});
|
|
23
|
-
await step('Wait for sheet to appear and render', async ()=>{
|
|
24
|
-
await screen.findByRole('dialog');
|
|
25
|
-
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
26
|
-
});
|
|
27
|
-
await argosScreenshot(ctx, screenshotName);
|
|
28
|
-
}
|
|
29
|
-
const meta = {
|
|
30
|
-
title: 'Components/Sheet',
|
|
31
|
-
component: Sheet,
|
|
32
|
-
tags: [
|
|
33
|
-
'autodocs'
|
|
34
|
-
],
|
|
35
|
-
parameters: {
|
|
36
|
-
layout: 'centered'
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export default meta;
|
|
40
|
-
export const Default = {
|
|
41
|
-
play: (ctx)=>openSheetAndScreenshot(ctx, OPEN_SHEET_REGEX, 'Default Sheet Open'),
|
|
42
|
-
render: ()=>{
|
|
43
|
-
const [open, setOpen] = useState(false);
|
|
44
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
45
|
-
className: "flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip",
|
|
46
|
-
children: /*#__PURE__*/ _jsxs(Sheet, {
|
|
47
|
-
open: open,
|
|
48
|
-
onOpenChange: setOpen,
|
|
49
|
-
children: [
|
|
50
|
-
/*#__PURE__*/ _jsx(SheetTrigger, {
|
|
51
|
-
asChild: true,
|
|
52
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
53
|
-
children: "Open Sheet"
|
|
54
|
-
})
|
|
55
|
-
}),
|
|
56
|
-
/*#__PURE__*/ _jsxs(SheetContent, {
|
|
57
|
-
children: [
|
|
58
|
-
/*#__PURE__*/ _jsx(SheetHeader, {
|
|
59
|
-
children: /*#__PURE__*/ _jsx(SheetTitle, {
|
|
60
|
-
children: "Sheet Title"
|
|
61
|
-
})
|
|
62
|
-
}),
|
|
63
|
-
/*#__PURE__*/ _jsxs(SheetBody, {
|
|
64
|
-
children: [
|
|
65
|
-
/*#__PURE__*/ _jsx(SheetDescription, {
|
|
66
|
-
children: "This is a description of the sheet content. Sheets are useful for displaying supplementary information or actions."
|
|
67
|
-
}),
|
|
68
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
69
|
-
size: "sm",
|
|
70
|
-
className: "text-foreground-neutral-subtle w-full",
|
|
71
|
-
children: "This is the body content of the sheet. You can add any content here, including forms, lists, or other components."
|
|
72
|
-
})
|
|
73
|
-
]
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ _jsxs(SheetFooter, {
|
|
76
|
-
children: [
|
|
77
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
78
|
-
variant: "transparent",
|
|
79
|
-
onClick: ()=>setOpen(false),
|
|
80
|
-
children: "Cancel"
|
|
81
|
-
}),
|
|
82
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
83
|
-
variant: "primary",
|
|
84
|
-
onClick: ()=>setOpen(false),
|
|
85
|
-
children: "Save"
|
|
86
|
-
})
|
|
87
|
-
]
|
|
88
|
-
})
|
|
89
|
-
]
|
|
90
|
-
})
|
|
91
|
-
]
|
|
92
|
-
})
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
export const LeftSide = {
|
|
97
|
-
play: (ctx)=>openSheetAndScreenshot(ctx, OPEN_SHEET_REGEX, 'Left Side Sheet'),
|
|
98
|
-
render: ()=>{
|
|
99
|
-
const [open, setOpen] = useState(false);
|
|
100
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
101
|
-
className: "flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip",
|
|
102
|
-
children: /*#__PURE__*/ _jsxs(Sheet, {
|
|
103
|
-
open: open,
|
|
104
|
-
onOpenChange: setOpen,
|
|
105
|
-
children: [
|
|
106
|
-
/*#__PURE__*/ _jsx(SheetTrigger, {
|
|
107
|
-
asChild: true,
|
|
108
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
109
|
-
children: "Open Sheet"
|
|
110
|
-
})
|
|
111
|
-
}),
|
|
112
|
-
/*#__PURE__*/ _jsxs(SheetContent, {
|
|
113
|
-
side: "left",
|
|
114
|
-
children: [
|
|
115
|
-
/*#__PURE__*/ _jsx(SheetHeader, {
|
|
116
|
-
children: /*#__PURE__*/ _jsx(SheetTitle, {
|
|
117
|
-
children: "Left Side Sheet"
|
|
118
|
-
})
|
|
119
|
-
}),
|
|
120
|
-
/*#__PURE__*/ _jsxs(SheetBody, {
|
|
121
|
-
children: [
|
|
122
|
-
/*#__PURE__*/ _jsx(SheetDescription, {
|
|
123
|
-
children: "This sheet slides in from the left side of the screen."
|
|
124
|
-
}),
|
|
125
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
126
|
-
size: "sm",
|
|
127
|
-
className: "text-foreground-neutral-subtle w-full",
|
|
128
|
-
children: "Left side sheets are often used for navigation menus or sidebar content."
|
|
129
|
-
})
|
|
130
|
-
]
|
|
131
|
-
}),
|
|
132
|
-
/*#__PURE__*/ _jsx(SheetFooter, {
|
|
133
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
134
|
-
variant: "transparent",
|
|
135
|
-
onClick: ()=>setOpen(false),
|
|
136
|
-
children: "Close"
|
|
137
|
-
})
|
|
138
|
-
})
|
|
139
|
-
]
|
|
140
|
-
})
|
|
141
|
-
]
|
|
142
|
-
})
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
export const SettingsForm = {
|
|
147
|
-
play: (ctx)=>openSheetAndScreenshot(ctx, SETTINGS_REGEX, 'Settings Form Sheet'),
|
|
148
|
-
render: ()=>{
|
|
149
|
-
const [open, setOpen] = useState(false);
|
|
150
|
-
const [name, setName] = useState('');
|
|
151
|
-
const [email, setEmail] = useState('');
|
|
152
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
153
|
-
className: "flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip",
|
|
154
|
-
children: /*#__PURE__*/ _jsxs(Sheet, {
|
|
155
|
-
open: open,
|
|
156
|
-
onOpenChange: setOpen,
|
|
157
|
-
children: [
|
|
158
|
-
/*#__PURE__*/ _jsx(SheetTrigger, {
|
|
159
|
-
asChild: true,
|
|
160
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
161
|
-
children: "Settings"
|
|
162
|
-
})
|
|
163
|
-
}),
|
|
164
|
-
/*#__PURE__*/ _jsxs(SheetContent, {
|
|
165
|
-
children: [
|
|
166
|
-
/*#__PURE__*/ _jsx(SheetHeader, {
|
|
167
|
-
children: /*#__PURE__*/ _jsx(SheetTitle, {
|
|
168
|
-
children: "Account Settings"
|
|
169
|
-
})
|
|
170
|
-
}),
|
|
171
|
-
/*#__PURE__*/ _jsxs(SheetBody, {
|
|
172
|
-
className: "gap-20",
|
|
173
|
-
children: [
|
|
174
|
-
/*#__PURE__*/ _jsx(SheetDescription, {
|
|
175
|
-
children: "Update your account information and preferences here."
|
|
176
|
-
}),
|
|
177
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
178
|
-
className: "flex flex-col gap-20 w-full",
|
|
179
|
-
children: [
|
|
180
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
181
|
-
className: "flex flex-col gap-8 w-full",
|
|
182
|
-
children: [
|
|
183
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
184
|
-
htmlFor: "name",
|
|
185
|
-
children: "Name"
|
|
186
|
-
}),
|
|
187
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
188
|
-
id: "name",
|
|
189
|
-
placeholder: "John Doe",
|
|
190
|
-
value: name,
|
|
191
|
-
onChange: (e)=>setName(e.target.value)
|
|
192
|
-
})
|
|
193
|
-
]
|
|
194
|
-
}),
|
|
195
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
196
|
-
className: "flex flex-col gap-8 w-full",
|
|
197
|
-
children: [
|
|
198
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
199
|
-
htmlFor: "email",
|
|
200
|
-
children: "Email"
|
|
201
|
-
}),
|
|
202
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
203
|
-
id: "email",
|
|
204
|
-
type: "email",
|
|
205
|
-
placeholder: "john@example.com",
|
|
206
|
-
value: email,
|
|
207
|
-
onChange: (e)=>setEmail(e.target.value)
|
|
208
|
-
})
|
|
209
|
-
]
|
|
210
|
-
})
|
|
211
|
-
]
|
|
212
|
-
})
|
|
213
|
-
]
|
|
214
|
-
}),
|
|
215
|
-
/*#__PURE__*/ _jsxs(SheetFooter, {
|
|
216
|
-
children: [
|
|
217
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
218
|
-
variant: "transparent",
|
|
219
|
-
onClick: ()=>setOpen(false),
|
|
220
|
-
children: "Cancel"
|
|
221
|
-
}),
|
|
222
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
223
|
-
variant: "primary",
|
|
224
|
-
onClick: ()=>setOpen(false),
|
|
225
|
-
children: "Save Changes"
|
|
226
|
-
})
|
|
227
|
-
]
|
|
228
|
-
})
|
|
229
|
-
]
|
|
230
|
-
})
|
|
231
|
-
]
|
|
232
|
-
})
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
export const WithoutCloseButton = {
|
|
237
|
-
play: (ctx)=>openSheetAndScreenshot(ctx, OPEN_SHEET_REGEX, 'Sheet Without Close Button'),
|
|
238
|
-
render: ()=>{
|
|
239
|
-
const [open, setOpen] = useState(false);
|
|
240
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
241
|
-
className: "flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip",
|
|
242
|
-
children: /*#__PURE__*/ _jsxs(Sheet, {
|
|
243
|
-
open: open,
|
|
244
|
-
onOpenChange: setOpen,
|
|
245
|
-
children: [
|
|
246
|
-
/*#__PURE__*/ _jsx(SheetTrigger, {
|
|
247
|
-
asChild: true,
|
|
248
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
249
|
-
children: "Open Sheet"
|
|
250
|
-
})
|
|
251
|
-
}),
|
|
252
|
-
/*#__PURE__*/ _jsxs(SheetContent, {
|
|
253
|
-
children: [
|
|
254
|
-
/*#__PURE__*/ _jsx(SheetHeader, {
|
|
255
|
-
showClose: false,
|
|
256
|
-
children: /*#__PURE__*/ _jsx(SheetTitle, {
|
|
257
|
-
children: "Sheet Without Close Button"
|
|
258
|
-
})
|
|
259
|
-
}),
|
|
260
|
-
/*#__PURE__*/ _jsxs(SheetBody, {
|
|
261
|
-
children: [
|
|
262
|
-
/*#__PURE__*/ _jsx(SheetDescription, {
|
|
263
|
-
children: "This sheet doesn't show a close button. Users can still close it by pressing Esc or clicking outside."
|
|
264
|
-
}),
|
|
265
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
266
|
-
size: "sm",
|
|
267
|
-
className: "text-foreground-neutral-subtle w-full",
|
|
268
|
-
children: "The close button can be hidden by setting the showClose prop to false."
|
|
269
|
-
})
|
|
270
|
-
]
|
|
271
|
-
}),
|
|
272
|
-
/*#__PURE__*/ _jsx(SheetFooter, {
|
|
273
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
274
|
-
variant: "primary",
|
|
275
|
-
onClick: ()=>setOpen(false),
|
|
276
|
-
children: "Close"
|
|
277
|
-
})
|
|
278
|
-
})
|
|
279
|
-
]
|
|
280
|
-
})
|
|
281
|
-
]
|
|
282
|
-
})
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
export const LongContent = {
|
|
287
|
-
play: (ctx)=>openSheetAndScreenshot(ctx, OPEN_SHEET_REGEX, 'Sheet With Long Content'),
|
|
288
|
-
render: ()=>{
|
|
289
|
-
const [open, setOpen] = useState(false);
|
|
290
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
291
|
-
className: "flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip",
|
|
292
|
-
children: /*#__PURE__*/ _jsxs(Sheet, {
|
|
293
|
-
open: open,
|
|
294
|
-
onOpenChange: setOpen,
|
|
295
|
-
children: [
|
|
296
|
-
/*#__PURE__*/ _jsx(SheetTrigger, {
|
|
297
|
-
asChild: true,
|
|
298
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
299
|
-
children: "Open Sheet"
|
|
300
|
-
})
|
|
301
|
-
}),
|
|
302
|
-
/*#__PURE__*/ _jsxs(SheetContent, {
|
|
303
|
-
children: [
|
|
304
|
-
/*#__PURE__*/ _jsx(SheetHeader, {
|
|
305
|
-
children: /*#__PURE__*/ _jsx(SheetTitle, {
|
|
306
|
-
children: "Long Content Example"
|
|
307
|
-
})
|
|
308
|
-
}),
|
|
309
|
-
/*#__PURE__*/ _jsxs(SheetBody, {
|
|
310
|
-
children: [
|
|
311
|
-
/*#__PURE__*/ _jsx(SheetDescription, {
|
|
312
|
-
children: "This sheet demonstrates how it handles long scrollable content."
|
|
313
|
-
}),
|
|
314
|
-
/*#__PURE__*/ _jsx("div", {
|
|
315
|
-
className: "flex flex-col gap-16 w-full",
|
|
316
|
-
children: Array.from({
|
|
317
|
-
length: 20
|
|
318
|
-
}, (_, i)=>{
|
|
319
|
-
const sectionId = `section-${i + 1}`;
|
|
320
|
-
return /*#__PURE__*/ _jsxs("div", {
|
|
321
|
-
className: "flex flex-col gap-8",
|
|
322
|
-
children: [
|
|
323
|
-
/*#__PURE__*/ _jsxs(Text, {
|
|
324
|
-
size: "sm",
|
|
325
|
-
className: "font-medium text-foreground-neutral-base",
|
|
326
|
-
children: [
|
|
327
|
-
"Section ",
|
|
328
|
-
i + 1
|
|
329
|
-
]
|
|
330
|
-
}),
|
|
331
|
-
/*#__PURE__*/ _jsxs(Text, {
|
|
332
|
-
size: "sm",
|
|
333
|
-
className: "text-foreground-neutral-subtle",
|
|
334
|
-
children: [
|
|
335
|
-
"This is paragraph ",
|
|
336
|
-
i + 1,
|
|
337
|
-
" of the long content. The sheet body is scrollable, so you can scroll through all the content while the header and footer remain fixed."
|
|
338
|
-
]
|
|
339
|
-
})
|
|
340
|
-
]
|
|
341
|
-
}, sectionId);
|
|
342
|
-
})
|
|
343
|
-
})
|
|
344
|
-
]
|
|
345
|
-
}),
|
|
346
|
-
/*#__PURE__*/ _jsxs(SheetFooter, {
|
|
347
|
-
children: [
|
|
348
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
349
|
-
variant: "transparent",
|
|
350
|
-
onClick: ()=>setOpen(false),
|
|
351
|
-
children: "Cancel"
|
|
352
|
-
}),
|
|
353
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
354
|
-
variant: "primary",
|
|
355
|
-
onClick: ()=>setOpen(false),
|
|
356
|
-
children: "Save"
|
|
357
|
-
})
|
|
358
|
-
]
|
|
359
|
-
})
|
|
360
|
-
]
|
|
361
|
-
})
|
|
362
|
-
]
|
|
363
|
-
})
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
//# sourceMappingURL=sheet.stories.js.map
|