@shipfox/react-ui 0.10.0 → 0.12.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/.turbo/turbo-build.log +6 -6
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-type.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/components/button/button.js +14 -11
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/calendar/calendar.d.ts +5 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +46 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +3 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/date-picker/date-picker.d.ts +19 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.js +114 -0
- package/dist/components/date-picker/date-picker.js.map +1 -0
- package/dist/components/date-picker/date-picker.stories.js +333 -0
- package/dist/components/date-picker/date-picker.stories.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.d.ts.map +1 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.d.ts +24 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.d.ts.map +1 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.js +130 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.js.map +1 -0
- package/dist/components/date-time-range-picker/index.d.ts +2 -0
- package/dist/components/date-time-range-picker/index.d.ts.map +1 -0
- package/dist/components/date-time-range-picker/index.js +3 -0
- package/dist/components/date-time-range-picker/index.js.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +58 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +280 -0
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.stories.js +462 -0
- package/dist/components/dropdown-menu/dropdown-menu.stories.js.map +1 -0
- package/dist/components/dropdown-menu/index.d.ts +3 -0
- package/dist/components/dropdown-menu/index.d.ts.map +1 -0
- package/dist/components/dropdown-menu/index.js +3 -0
- package/dist/components/dropdown-menu/index.js.map +1 -0
- package/dist/components/dynamic-item/dynamic-item.d.ts +1 -1
- package/dist/components/dynamic-item/dynamic-item.d.ts.map +1 -1
- package/dist/components/dynamic-item/dynamic-item.js +4 -4
- package/dist/components/dynamic-item/dynamic-item.js.map +1 -1
- package/dist/components/dynamic-item/dynamic-item.stories.js +11 -1
- package/dist/components/dynamic-item/dynamic-item.stories.js.map +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/inline-tips/inline-tips.stories.js +5 -0
- package/dist/components/inline-tips/inline-tips.stories.js.map +1 -1
- package/dist/components/item/item.stories.js +15 -8
- package/dist/components/item/item.stories.js.map +1 -1
- package/dist/components/modal/modal.stories.js +14 -6
- package/dist/components/modal/modal.stories.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.d.ts.map +1 -0
- package/dist/components/popover/index.js +3 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/popover/popover.d.ts +10 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +47 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/textarea/textarea.stories.js +8 -2
- package/dist/components/textarea/textarea.stories.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/src/components/button/button.tsx +12 -12
- package/src/components/calendar/calendar.tsx +90 -0
- package/src/components/calendar/index.ts +1 -0
- package/src/components/date-picker/date-picker.stories.tsx +230 -0
- package/src/components/date-picker/date-picker.tsx +179 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-time-range-picker/date-time-range-picker.tsx +211 -0
- package/src/components/date-time-range-picker/index.ts +1 -0
- package/src/components/dropdown-menu/dropdown-menu.stories.tsx +384 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +416 -0
- package/src/components/dropdown-menu/index.ts +29 -0
- package/src/components/dynamic-item/dynamic-item.stories.tsx +6 -1
- package/src/components/dynamic-item/dynamic-item.tsx +9 -3
- package/src/components/index.ts +5 -0
- package/src/components/inline-tips/inline-tips.stories.tsx +5 -0
- package/src/components/item/item.stories.tsx +65 -56
- package/src/components/modal/modal.stories.tsx +16 -6
- package/src/components/popover/index.ts +1 -0
- package/src/components/popover/popover.tsx +60 -0
- package/src/components/textarea/textarea.stories.tsx +8 -2
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import {cva, type VariantProps} from 'class-variance-authority';
|
|
3
|
+
import type {ComponentProps} from 'react';
|
|
4
|
+
import {cn} from 'utils/cn';
|
|
5
|
+
import {Icon, type IconName} from '../icon';
|
|
6
|
+
|
|
7
|
+
function DropdownMenu({...props}: ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
8
|
+
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function DropdownMenuTrigger({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
15
|
+
return (
|
|
16
|
+
<DropdownMenuPrimitive.Trigger
|
|
17
|
+
data-slot="dropdown-menu-trigger"
|
|
18
|
+
className={cn('outline-none', className)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function DropdownMenuPortal({...props}: ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
25
|
+
return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const dropdownMenuContentVariants = cva(
|
|
29
|
+
[
|
|
30
|
+
'z-50 min-w-[180px] overflow-hidden rounded-10 p-4',
|
|
31
|
+
'bg-background-neutral-overlay text-foreground-neutral-subtle',
|
|
32
|
+
'shadow-tooltip',
|
|
33
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
34
|
+
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
35
|
+
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
36
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
|
37
|
+
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
38
|
+
],
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
size: {
|
|
42
|
+
sm: 'min-w-[160px]',
|
|
43
|
+
md: 'min-w-[200px]',
|
|
44
|
+
lg: 'min-w-[240px]',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: 'md',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
type DropdownMenuContentProps = ComponentProps<typeof DropdownMenuPrimitive.Content> &
|
|
54
|
+
VariantProps<typeof dropdownMenuContentVariants> & {
|
|
55
|
+
container?: HTMLElement | null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function DropdownMenuContent({
|
|
59
|
+
className,
|
|
60
|
+
sideOffset = 4,
|
|
61
|
+
size,
|
|
62
|
+
onCloseAutoFocus,
|
|
63
|
+
container,
|
|
64
|
+
...props
|
|
65
|
+
}: DropdownMenuContentProps) {
|
|
66
|
+
return (
|
|
67
|
+
<DropdownMenuPrimitive.Portal container={container}>
|
|
68
|
+
<DropdownMenuPrimitive.Content
|
|
69
|
+
data-slot="dropdown-menu-content"
|
|
70
|
+
sideOffset={sideOffset}
|
|
71
|
+
className={cn(dropdownMenuContentVariants({size}), className)}
|
|
72
|
+
onCloseAutoFocus={(e) => {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
onCloseAutoFocus?.(e);
|
|
75
|
+
}}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
</DropdownMenuPrimitive.Portal>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function DropdownMenuGroup({
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
86
|
+
return (
|
|
87
|
+
<DropdownMenuPrimitive.Group
|
|
88
|
+
data-slot="dropdown-menu-group"
|
|
89
|
+
className={cn('flex flex-col', className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const dropdownMenuLabelVariants = cva(
|
|
96
|
+
'px-8 py-4 text-xs leading-20 text-foreground-neutral-subtle select-none',
|
|
97
|
+
{
|
|
98
|
+
variants: {
|
|
99
|
+
inset: {
|
|
100
|
+
true: 'pl-32',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
type DropdownMenuLabelProps = ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
107
|
+
inset?: boolean;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
function DropdownMenuLabel({className, inset, ...props}: DropdownMenuLabelProps) {
|
|
111
|
+
return (
|
|
112
|
+
<DropdownMenuPrimitive.Label
|
|
113
|
+
data-slot="dropdown-menu-label"
|
|
114
|
+
className={cn(dropdownMenuLabelVariants({inset}), className)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const dropdownMenuItemVariants = cva(
|
|
121
|
+
[
|
|
122
|
+
'relative flex cursor-pointer select-none items-center gap-8 rounded-6 px-8 py-6',
|
|
123
|
+
'text-sm leading-20 text-foreground-neutral-subtle outline-none transition-colors',
|
|
124
|
+
'focus:bg-background-components-hover',
|
|
125
|
+
'data-disabled:pointer-events-none data-disabled:text-foreground-neutral-disabled',
|
|
126
|
+
],
|
|
127
|
+
{
|
|
128
|
+
variants: {
|
|
129
|
+
inset: {
|
|
130
|
+
true: 'pl-32',
|
|
131
|
+
},
|
|
132
|
+
variant: {
|
|
133
|
+
default: '',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
defaultVariants: {
|
|
137
|
+
variant: 'default',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
type DropdownMenuItemProps = ComponentProps<typeof DropdownMenuPrimitive.Item> &
|
|
143
|
+
VariantProps<typeof dropdownMenuItemVariants> & {
|
|
144
|
+
icon?: IconName;
|
|
145
|
+
shortcut?: string;
|
|
146
|
+
closeOnSelect?: boolean;
|
|
147
|
+
iconStyle?: string;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
function DropdownMenuItem({
|
|
151
|
+
className,
|
|
152
|
+
inset,
|
|
153
|
+
variant,
|
|
154
|
+
icon,
|
|
155
|
+
shortcut,
|
|
156
|
+
children,
|
|
157
|
+
closeOnSelect = true,
|
|
158
|
+
iconStyle,
|
|
159
|
+
onSelect,
|
|
160
|
+
...props
|
|
161
|
+
}: DropdownMenuItemProps) {
|
|
162
|
+
return (
|
|
163
|
+
<DropdownMenuPrimitive.Item
|
|
164
|
+
data-slot="dropdown-menu-item"
|
|
165
|
+
className={cn(dropdownMenuItemVariants({inset, variant}), className)}
|
|
166
|
+
onSelect={(e) => {
|
|
167
|
+
if (!closeOnSelect) e.preventDefault();
|
|
168
|
+
onSelect?.(e);
|
|
169
|
+
}}
|
|
170
|
+
{...props}
|
|
171
|
+
>
|
|
172
|
+
{icon && (
|
|
173
|
+
<Icon
|
|
174
|
+
name={icon}
|
|
175
|
+
className={cn('size-16 shrink-0 text-foreground-neutral-subtle', iconStyle)}
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
<span className="flex-1 truncate">{children}</span>
|
|
179
|
+
{shortcut && <DropdownMenuShortcut>{shortcut}</DropdownMenuShortcut>}
|
|
180
|
+
</DropdownMenuPrimitive.Item>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
type DropdownMenuCheckboxItemProps = ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
|
|
185
|
+
icon?: IconName;
|
|
186
|
+
shortcut?: string;
|
|
187
|
+
closeOnSelect?: boolean;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
function DropdownMenuCheckboxItem({
|
|
191
|
+
className,
|
|
192
|
+
children,
|
|
193
|
+
checked,
|
|
194
|
+
icon,
|
|
195
|
+
shortcut,
|
|
196
|
+
closeOnSelect = true,
|
|
197
|
+
onSelect,
|
|
198
|
+
...props
|
|
199
|
+
}: DropdownMenuCheckboxItemProps) {
|
|
200
|
+
return (
|
|
201
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
202
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
203
|
+
className={cn(
|
|
204
|
+
[
|
|
205
|
+
'relative flex cursor-pointer select-none items-center gap-8 rounded-6 py-6 pl-32 pr-8',
|
|
206
|
+
'text-sm leading-20 text-foreground-neutral-subtle outline-none transition-colors',
|
|
207
|
+
'focus:bg-background-components-hover',
|
|
208
|
+
'data-disabled:pointer-events-none data-disabled:text-foreground-neutral-disabled',
|
|
209
|
+
'data-[state=checked]:text-foreground-neutral-base',
|
|
210
|
+
],
|
|
211
|
+
className,
|
|
212
|
+
)}
|
|
213
|
+
checked={checked}
|
|
214
|
+
onSelect={(e) => {
|
|
215
|
+
if (!closeOnSelect) e.preventDefault();
|
|
216
|
+
onSelect?.(e);
|
|
217
|
+
}}
|
|
218
|
+
{...props}
|
|
219
|
+
>
|
|
220
|
+
<span className="absolute left-8 flex size-16 items-center justify-center">
|
|
221
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
222
|
+
<Icon name="check" className="size-14 text-foreground-neutral-base" />
|
|
223
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
224
|
+
</span>
|
|
225
|
+
{icon && <Icon name={icon} className="size-16 shrink-0 text-foreground-neutral-subtle" />}
|
|
226
|
+
<span className="flex-1 truncate">{children}</span>
|
|
227
|
+
{shortcut && <DropdownMenuShortcut>{shortcut}</DropdownMenuShortcut>}
|
|
228
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function DropdownMenuRadioGroup({
|
|
233
|
+
className,
|
|
234
|
+
...props
|
|
235
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
236
|
+
return (
|
|
237
|
+
<DropdownMenuPrimitive.RadioGroup
|
|
238
|
+
data-slot="dropdown-menu-radio-group"
|
|
239
|
+
className={cn('flex flex-col', className)}
|
|
240
|
+
{...props}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
type DropdownMenuRadioItemProps = ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
|
|
246
|
+
icon?: IconName;
|
|
247
|
+
closeOnSelect?: boolean;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
function DropdownMenuRadioItem({
|
|
251
|
+
className,
|
|
252
|
+
children,
|
|
253
|
+
icon,
|
|
254
|
+
closeOnSelect = true,
|
|
255
|
+
onSelect,
|
|
256
|
+
...props
|
|
257
|
+
}: DropdownMenuRadioItemProps) {
|
|
258
|
+
return (
|
|
259
|
+
<DropdownMenuPrimitive.RadioItem
|
|
260
|
+
data-slot="dropdown-menu-radio-item"
|
|
261
|
+
className={cn(
|
|
262
|
+
[
|
|
263
|
+
'relative flex cursor-pointer select-none items-center gap-8 rounded-6 py-6 pl-32 pr-8',
|
|
264
|
+
'text-sm leading-20 text-foreground-neutral-subtle outline-none transition-colors',
|
|
265
|
+
'focus:bg-background-components-hover',
|
|
266
|
+
'data-disabled:pointer-events-none data-disabled:text-foreground-neutral-disabled',
|
|
267
|
+
'data-[state=checked]:text-foreground-neutral-base',
|
|
268
|
+
],
|
|
269
|
+
className,
|
|
270
|
+
)}
|
|
271
|
+
onSelect={(e) => {
|
|
272
|
+
if (!closeOnSelect) e.preventDefault();
|
|
273
|
+
onSelect?.(e);
|
|
274
|
+
}}
|
|
275
|
+
{...props}
|
|
276
|
+
>
|
|
277
|
+
<span className="absolute left-8 flex size-16 items-center justify-center">
|
|
278
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
279
|
+
<Icon name="ellipseMiniSolid" className="size-6 text-foreground-neutral-base" />
|
|
280
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
281
|
+
</span>
|
|
282
|
+
{icon && <Icon name={icon} className="size-16 shrink-0 text-foreground-neutral-subtle" />}
|
|
283
|
+
<span className="flex-1 truncate">{children}</span>
|
|
284
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function DropdownMenuSeparator({
|
|
289
|
+
className,
|
|
290
|
+
...props
|
|
291
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
292
|
+
return (
|
|
293
|
+
<DropdownMenuPrimitive.Separator
|
|
294
|
+
data-slot="dropdown-menu-separator"
|
|
295
|
+
className={cn(
|
|
296
|
+
'relative -mx-4 my-4 h-px',
|
|
297
|
+
'bg-border-neutral-menu-top',
|
|
298
|
+
'after:absolute after:inset-x-0 after:top-px after:h-px',
|
|
299
|
+
'after:bg-border-neutral-menu-bottom',
|
|
300
|
+
className,
|
|
301
|
+
)}
|
|
302
|
+
{...props}
|
|
303
|
+
/>
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
type DropdownMenuShortcutProps = ComponentProps<'span'>;
|
|
308
|
+
|
|
309
|
+
function DropdownMenuShortcut({className, ...props}: DropdownMenuShortcutProps) {
|
|
310
|
+
return (
|
|
311
|
+
<span
|
|
312
|
+
data-slot="dropdown-menu-shortcut"
|
|
313
|
+
className={cn(
|
|
314
|
+
'ml-auto text-xs leading-20 text-foreground-neutral-muted tabular-nums',
|
|
315
|
+
className,
|
|
316
|
+
)}
|
|
317
|
+
{...props}
|
|
318
|
+
/>
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function DropdownMenuSub({...props}: ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
323
|
+
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
type DropdownMenuSubTriggerProps = ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
327
|
+
inset?: boolean;
|
|
328
|
+
icon?: IconName;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
function DropdownMenuSubTrigger({
|
|
332
|
+
className,
|
|
333
|
+
inset,
|
|
334
|
+
icon,
|
|
335
|
+
children,
|
|
336
|
+
...props
|
|
337
|
+
}: DropdownMenuSubTriggerProps) {
|
|
338
|
+
return (
|
|
339
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
340
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
341
|
+
className={cn(
|
|
342
|
+
[
|
|
343
|
+
'relative flex cursor-pointer select-none items-center gap-8 rounded-6 px-8 py-6',
|
|
344
|
+
'text-sm leading-20 text-foreground-neutral-subtle outline-none transition-colors',
|
|
345
|
+
'focus:bg-background-components-hover',
|
|
346
|
+
'data-[state=open]:bg-background-components-hover',
|
|
347
|
+
'data-disabled:pointer-events-none data-disabled:text-foreground-neutral-disabled',
|
|
348
|
+
'data-[state=checked]:text-foreground-neutral-base',
|
|
349
|
+
],
|
|
350
|
+
inset && 'pl-32',
|
|
351
|
+
className,
|
|
352
|
+
)}
|
|
353
|
+
{...props}
|
|
354
|
+
>
|
|
355
|
+
{icon && <Icon name={icon} className="size-16 shrink-0 text-foreground-neutral-subtle" />}
|
|
356
|
+
<span className="flex-1 truncate">{children}</span>
|
|
357
|
+
<Icon name="chevronRight" className="ml-auto size-14 text-foreground-neutral-muted" />
|
|
358
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function DropdownMenuSubContent({
|
|
363
|
+
className,
|
|
364
|
+
...props
|
|
365
|
+
}: ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
366
|
+
return (
|
|
367
|
+
<DropdownMenuPrimitive.SubContent
|
|
368
|
+
data-slot="dropdown-menu-sub-content"
|
|
369
|
+
className={cn(
|
|
370
|
+
[
|
|
371
|
+
'z-50 min-w-180 overflow-hidden rounded-10 p-4',
|
|
372
|
+
'bg-background-neutral-overlay text-foreground-neutral-subtle',
|
|
373
|
+
'shadow-tooltip',
|
|
374
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out',
|
|
375
|
+
'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
376
|
+
'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
|
|
377
|
+
'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2',
|
|
378
|
+
'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
379
|
+
],
|
|
380
|
+
className,
|
|
381
|
+
)}
|
|
382
|
+
{...props}
|
|
383
|
+
/>
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export {
|
|
388
|
+
DropdownMenu,
|
|
389
|
+
DropdownMenuTrigger,
|
|
390
|
+
DropdownMenuPortal,
|
|
391
|
+
DropdownMenuContent,
|
|
392
|
+
DropdownMenuGroup,
|
|
393
|
+
DropdownMenuLabel,
|
|
394
|
+
DropdownMenuItem,
|
|
395
|
+
DropdownMenuCheckboxItem,
|
|
396
|
+
DropdownMenuRadioGroup,
|
|
397
|
+
DropdownMenuRadioItem,
|
|
398
|
+
DropdownMenuSeparator,
|
|
399
|
+
DropdownMenuShortcut,
|
|
400
|
+
DropdownMenuSub,
|
|
401
|
+
DropdownMenuSubTrigger,
|
|
402
|
+
DropdownMenuSubContent,
|
|
403
|
+
dropdownMenuContentVariants,
|
|
404
|
+
dropdownMenuItemVariants,
|
|
405
|
+
dropdownMenuLabelVariants,
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
export type {
|
|
409
|
+
DropdownMenuContentProps,
|
|
410
|
+
DropdownMenuLabelProps,
|
|
411
|
+
DropdownMenuItemProps,
|
|
412
|
+
DropdownMenuCheckboxItemProps,
|
|
413
|
+
DropdownMenuRadioItemProps,
|
|
414
|
+
DropdownMenuSubTriggerProps,
|
|
415
|
+
DropdownMenuShortcutProps,
|
|
416
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
DropdownMenuCheckboxItemProps,
|
|
3
|
+
DropdownMenuContentProps,
|
|
4
|
+
DropdownMenuItemProps,
|
|
5
|
+
DropdownMenuLabelProps,
|
|
6
|
+
DropdownMenuRadioItemProps,
|
|
7
|
+
DropdownMenuShortcutProps,
|
|
8
|
+
DropdownMenuSubTriggerProps,
|
|
9
|
+
} from './dropdown-menu';
|
|
10
|
+
export {
|
|
11
|
+
DropdownMenu,
|
|
12
|
+
DropdownMenuCheckboxItem,
|
|
13
|
+
DropdownMenuContent,
|
|
14
|
+
DropdownMenuGroup,
|
|
15
|
+
DropdownMenuItem,
|
|
16
|
+
DropdownMenuLabel,
|
|
17
|
+
DropdownMenuPortal,
|
|
18
|
+
DropdownMenuRadioGroup,
|
|
19
|
+
DropdownMenuRadioItem,
|
|
20
|
+
DropdownMenuSeparator,
|
|
21
|
+
DropdownMenuShortcut,
|
|
22
|
+
DropdownMenuSub,
|
|
23
|
+
DropdownMenuSubContent,
|
|
24
|
+
DropdownMenuSubTrigger,
|
|
25
|
+
DropdownMenuTrigger,
|
|
26
|
+
dropdownMenuContentVariants,
|
|
27
|
+
dropdownMenuItemVariants,
|
|
28
|
+
dropdownMenuLabelVariants,
|
|
29
|
+
} from './dropdown-menu';
|
|
@@ -144,7 +144,12 @@ export const ConnectGithubAccountItem: Story = {
|
|
|
144
144
|
</div>
|
|
145
145
|
}
|
|
146
146
|
title="Slack"
|
|
147
|
-
description=
|
|
147
|
+
description={
|
|
148
|
+
<p className="text-xs leading-20 text-tag-warning-icon inline-flex items-center gap-2">
|
|
149
|
+
Personal account (kyle-nguyen)
|
|
150
|
+
<Icon name="info" size="sm" className="shrink-0 size-16 text-tag-warning-icon" />
|
|
151
|
+
</p>
|
|
152
|
+
}
|
|
148
153
|
rightElement={
|
|
149
154
|
<Button variant="primary" size="sm">
|
|
150
155
|
Change account
|
|
@@ -14,7 +14,7 @@ export type DynamicItemProps = Omit<ItemProps, 'variant' | 'children' | 'title'>
|
|
|
14
14
|
variant?: 'default' | 'neutral';
|
|
15
15
|
leftElement?: ReactNode;
|
|
16
16
|
title?: ReactNode;
|
|
17
|
-
description?:
|
|
17
|
+
description?: ReactNode;
|
|
18
18
|
action?: ReactNode;
|
|
19
19
|
rightElement?: ReactNode;
|
|
20
20
|
contentClassName?: string;
|
|
@@ -49,8 +49,14 @@ export function DynamicItem({
|
|
|
49
49
|
|
|
50
50
|
{hasContent && (
|
|
51
51
|
<ItemContent className="text-center sm:text-left">
|
|
52
|
-
{title
|
|
53
|
-
{description
|
|
52
|
+
{title ? typeof title === 'string' ? <ItemTitle>{title}</ItemTitle> : title : null}
|
|
53
|
+
{description ? (
|
|
54
|
+
typeof description === 'string' ? (
|
|
55
|
+
<ItemDescription>{description}</ItemDescription>
|
|
56
|
+
) : (
|
|
57
|
+
description
|
|
58
|
+
)
|
|
59
|
+
) : null}
|
|
54
60
|
{action && (
|
|
55
61
|
<ItemActions className={cn('mt-8 flex flex-wrap items-center gap-16')}>
|
|
56
62
|
{action}
|
package/src/components/index.ts
CHANGED
|
@@ -2,9 +2,13 @@ export * from './alert';
|
|
|
2
2
|
export * from './avatar';
|
|
3
3
|
export * from './badge';
|
|
4
4
|
export * from './button';
|
|
5
|
+
export * from './calendar';
|
|
5
6
|
export * from './checkbox';
|
|
6
7
|
export * from './code-block';
|
|
8
|
+
export * from './date-picker';
|
|
9
|
+
export * from './date-time-range-picker';
|
|
7
10
|
export * from './dot-grid';
|
|
11
|
+
export * from './dropdown-menu';
|
|
8
12
|
export * from './dynamic-item';
|
|
9
13
|
export * from './form';
|
|
10
14
|
export * from './icon';
|
|
@@ -13,6 +17,7 @@ export * from './input';
|
|
|
13
17
|
export * from './item';
|
|
14
18
|
export * from './label';
|
|
15
19
|
export * from './modal';
|
|
20
|
+
export * from './popover';
|
|
16
21
|
export * from './textarea';
|
|
17
22
|
export * from './theme';
|
|
18
23
|
export * from './toast';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {argosScreenshot} from '@argos-ci/storybook/vitest';
|
|
1
2
|
import type {Meta, StoryObj} from '@storybook/react';
|
|
2
3
|
import {Code, Header} from 'components/typography';
|
|
3
4
|
import {
|
|
@@ -37,6 +38,10 @@ const types = ['default', 'info', 'success', 'error'] as const;
|
|
|
37
38
|
const variants = ['primary', 'secondary'] as const;
|
|
38
39
|
|
|
39
40
|
export const Default: Story = {
|
|
41
|
+
play: async (ctx) => {
|
|
42
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
43
|
+
await argosScreenshot(ctx, 'InlineTips Default');
|
|
44
|
+
},
|
|
40
45
|
render: (args) => {
|
|
41
46
|
return (
|
|
42
47
|
<InlineTips {...args}>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type {Meta, StoryObj} from '@storybook/react';
|
|
2
2
|
import {Button} from 'components/button/button';
|
|
3
|
+
import {DatePicker} from 'components/date-picker';
|
|
3
4
|
import {Icon} from 'components/icon/icon';
|
|
4
5
|
import {Input} from 'components/input/input';
|
|
5
6
|
import {Label} from 'components/label/label';
|
|
7
|
+
import {useState} from 'react';
|
|
6
8
|
import {
|
|
7
9
|
Item,
|
|
8
10
|
ItemActions,
|
|
@@ -38,6 +40,8 @@ const meta = {
|
|
|
38
40
|
export default meta;
|
|
39
41
|
type Story = StoryObj<typeof meta>;
|
|
40
42
|
|
|
43
|
+
const DEFAULT_START_DATE = new Date('2024-01-01T00:00:00.000Z');
|
|
44
|
+
|
|
41
45
|
export const Default: Story = {
|
|
42
46
|
args: {
|
|
43
47
|
variant: 'default',
|
|
@@ -89,62 +93,67 @@ export const Variants: Story = {
|
|
|
89
93
|
|
|
90
94
|
export const ImportPastJobsModal: Story = {
|
|
91
95
|
args: {},
|
|
92
|
-
render: () =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<ItemContent className="px-24 py-16">
|
|
114
|
-
<ItemDescription className="mb-16 text-sm text-foreground-neutral-subtle">
|
|
115
|
-
Backfill your CI history by importing past runs from your Github repo. We'll handle the
|
|
116
|
-
rest by creating a background task to import the data for you.
|
|
117
|
-
</ItemDescription>
|
|
118
|
-
<div className="flex flex-col gap-20">
|
|
119
|
-
<div className="flex flex-col gap-8">
|
|
120
|
-
<Label htmlFor="repo-owner">Repository owner</Label>
|
|
121
|
-
<Input id="repo-owner" type="text" defaultValue="apache" />
|
|
122
|
-
</div>
|
|
123
|
-
<div className="flex flex-col gap-8">
|
|
124
|
-
<Label htmlFor="repo-name">Repository name</Label>
|
|
125
|
-
<Input id="repo-name" type="text" defaultValue="kafka" />
|
|
96
|
+
render: () => {
|
|
97
|
+
const [date, setDate] = useState<Date | undefined>(DEFAULT_START_DATE);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div className="flex w-full max-w-lg flex-col">
|
|
101
|
+
<Item variant="neutral">
|
|
102
|
+
<ItemHeader className="justify-between px-24 py-16">
|
|
103
|
+
<ItemTitle className="text-lg font-medium text-foreground-neutral-base">
|
|
104
|
+
Import past jobs from GitHub
|
|
105
|
+
</ItemTitle>
|
|
106
|
+
<div className="flex items-center gap-8">
|
|
107
|
+
<kbd className="flex items-center justify-center rounded-8 border border-border-neutral-base shadow-button-neutral bg-background-field-base text-xs text-foreground-neutral-subtle px-4">
|
|
108
|
+
esc
|
|
109
|
+
</kbd>
|
|
110
|
+
<Button
|
|
111
|
+
variant="transparent"
|
|
112
|
+
size="xs"
|
|
113
|
+
className="rounded-4 p-2 cursor-pointer bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2 w-24 h-24"
|
|
114
|
+
>
|
|
115
|
+
<Icon name="close" />
|
|
116
|
+
</Button>
|
|
126
117
|
</div>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
</ItemHeader>
|
|
119
|
+
<ItemSeparator />
|
|
120
|
+
<ItemContent className="px-24 py-16">
|
|
121
|
+
<ItemDescription className="mb-16 text-sm text-foreground-neutral-subtle">
|
|
122
|
+
Backfill your CI history by importing past runs from your GitHub repo. We'll handle
|
|
123
|
+
the rest by creating a background task to import the data for you.
|
|
124
|
+
</ItemDescription>
|
|
125
|
+
<div className="flex flex-col gap-20">
|
|
126
|
+
<div className="flex flex-col gap-8">
|
|
127
|
+
<Label htmlFor="repo-owner">Repository owner</Label>
|
|
128
|
+
<Input id="repo-owner" type="text" defaultValue="apache" />
|
|
129
|
+
</div>
|
|
130
|
+
<div className="flex flex-col gap-8">
|
|
131
|
+
<Label htmlFor="repo-name">Repository name</Label>
|
|
132
|
+
<Input id="repo-name" type="text" defaultValue="kafka" />
|
|
133
|
+
</div>
|
|
134
|
+
<div className="flex flex-col gap-8">
|
|
135
|
+
<Label htmlFor="start-date">Start date</Label>
|
|
136
|
+
<DatePicker
|
|
137
|
+
id="start-date"
|
|
138
|
+
date={date}
|
|
139
|
+
onDateSelect={setDate}
|
|
140
|
+
onClear={() => setDate(undefined)}
|
|
141
|
+
placeholder="DD/MM/YYYY"
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
135
144
|
</div>
|
|
136
|
-
</
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</
|
|
146
|
-
</
|
|
147
|
-
</
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
</ItemContent>
|
|
146
|
+
<ItemSeparator />
|
|
147
|
+
<ItemFooter className="justify-end gap-8 px-24 py-16">
|
|
148
|
+
<Button variant="transparent" size="sm">
|
|
149
|
+
Cancel
|
|
150
|
+
</Button>
|
|
151
|
+
<Button variant="primary" size="sm">
|
|
152
|
+
Import
|
|
153
|
+
</Button>
|
|
154
|
+
</ItemFooter>
|
|
155
|
+
</Item>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
},
|
|
150
159
|
};
|