@stagewise/ui 0.1.0 → 0.3.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/README.md +9 -3
- package/package.json +9 -15
- package/src/components/ui/accordion.tsx +13 -15
- package/src/components/ui/alert-dialog.tsx +38 -38
- package/src/components/ui/alert.tsx +22 -22
- package/src/components/ui/aspect-ratio.tsx +6 -6
- package/src/components/ui/avatar.tsx +30 -30
- package/src/components/ui/badge.tsx +24 -22
- package/src/components/ui/breadcrumb.tsx +34 -37
- package/src/components/ui/bubble.tsx +48 -48
- package/src/components/ui/button-group.tsx +24 -24
- package/src/components/ui/button.tsx +24 -24
- package/src/components/ui/calendar.tsx +94 -81
- package/src/components/ui/card.tsx +30 -30
- package/src/components/ui/carousel.tsx +95 -92
- package/src/components/ui/chart.tsx +110 -110
- package/src/components/ui/checkbox.tsx +9 -10
- package/src/components/ui/collapsible.tsx +5 -5
- package/src/components/ui/combobox.tsx +51 -44
- package/src/components/ui/command.tsx +173 -190
- package/src/components/ui/context-menu.tsx +60 -50
- package/src/components/ui/dialog.tsx +33 -34
- package/src/components/ui/direction.tsx +1 -1
- package/src/components/ui/drawer.tsx +61 -61
- package/src/components/ui/dropdown-menu.tsx +54 -50
- package/src/components/ui/empty.tsx +30 -30
- package/src/components/ui/field.tsx +64 -64
- package/src/components/ui/hover-card.tsx +12 -12
- package/src/components/ui/input-group.tsx +54 -54
- package/src/components/ui/input-otp.tsx +24 -25
- package/src/components/ui/input.tsx +8 -8
- package/src/components/ui/item.tsx +64 -64
- package/src/components/ui/kbd.tsx +8 -8
- package/src/components/ui/klex-logo-combo.tsx +69 -0
- package/src/components/ui/klex-logo-text.tsx +70 -0
- package/src/components/ui/klex-logo.tsx +146 -0
- package/src/components/ui/label.tsx +8 -8
- package/src/components/ui/marker.tsx +25 -25
- package/src/components/ui/menubar.tsx +54 -50
- package/src/components/ui/message-scroller.tsx +130 -0
- package/src/components/ui/message.tsx +27 -27
- package/src/components/ui/native-select.tsx +22 -18
- package/src/components/ui/navigation-menu.tsx +37 -34
- package/src/components/ui/pagination.tsx +34 -31
- package/src/components/ui/popover.tsx +19 -19
- package/src/components/ui/progress.tsx +16 -16
- package/src/components/ui/questionnaire.tsx +72 -69
- package/src/components/ui/radio-group.tsx +9 -9
- package/src/components/ui/resizable.tsx +19 -12
- package/src/components/ui/scroll-area.tsx +10 -10
- package/src/components/ui/select.tsx +39 -34
- package/src/components/ui/separator.tsx +7 -7
- package/src/components/ui/sheet.tsx +31 -32
- package/src/components/ui/sidebar.tsx +244 -232
- package/src/components/ui/skeleton.tsx +5 -5
- package/src/components/ui/slider.tsx +11 -7
- package/src/components/ui/spinner.tsx +15 -6
- package/src/components/ui/stagewise-logo-combo.tsx +43 -0
- package/src/components/ui/stagewise-logo-text.tsx +30 -0
- package/src/components/ui/stagewise-logo.tsx +42 -0
- package/src/components/ui/switch.tsx +9 -9
- package/src/components/ui/table.tsx +31 -31
- package/src/components/ui/tabs.tsx +37 -26
- package/src/components/ui/textarea.tsx +7 -7
- package/src/components/ui/toast.tsx +70 -70
- package/src/components/ui/toggle-group.tsx +26 -26
- package/src/components/ui/toggle.tsx +15 -15
- package/src/components/ui/tooltip.tsx +13 -13
- package/src/hooks/use-mobile.ts +13 -11
- package/src/icons/custom/ui-outline-18/IconKlexOutline18.tsx +39 -0
- package/src/icons/custom/ui-outline-18/IconLaptop.tsx +35 -0
- package/src/icons/custom/ui-outline-18/IconSignOut.tsx +33 -0
- package/src/icons/custom/ui-outline-18/index.ts +4 -1
- package/src/icons/index.ts +43 -20
- package/src/icons/nucleo/social-media/IconMicrosoftEntraId.tsx +56 -0
- package/src/icons/nucleo/social-media/index.ts +1 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowDownOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconArrowTurnRightOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowUpOutline18.tsx +35 -0
- package/src/icons/nucleo/ui-outline-18/IconChartPieOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconChevronMaximizeDiagonal2Outline18.tsx +33 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronUpOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconEmptyOutline18.tsx +41 -0
- package/src/icons/nucleo/ui-outline-18/IconEyeOffOutline18.tsx +18 -0
- package/src/icons/nucleo/ui-outline-18/IconLinkBrokenOutline18.tsx +66 -0
- package/src/icons/nucleo/ui-outline-18/IconLock18Outline.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconMinusOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconMsgs2Outline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconPanelLeftOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconSidebarLeft2HideOutline18.tsx +63 -0
- package/src/icons/nucleo/ui-outline-18/IconSidebarRight2HideOutline18.tsx +63 -0
- package/src/icons/nucleo/ui-outline-18/index.ts +11 -1
- package/src/icons/provider/IconAnthropic.tsx +15 -0
- package/src/icons/provider/IconAttio.tsx +9 -0
- package/src/icons/provider/IconCodex.tsx +18 -0
- package/src/icons/provider/IconDiscord.tsx +17 -0
- package/src/icons/provider/IconGemini.tsx +152 -0
- package/src/icons/provider/IconLinear.tsx +9 -0
- package/src/icons/provider/IconOpenAI.tsx +15 -0
- package/src/icons/provider/IconOpenRouter.tsx +24 -0
- package/src/icons/provider/IconSlack.tsx +24 -0
- package/src/icons/provider/IconTelegram.tsx +29 -0
- package/src/icons/provider/IconWhatsapp.tsx +14 -0
- package/src/icons/provider/LICENSE +21 -0
- package/src/icons/provider/index.ts +11 -0
- package/src/index.ts +68 -61
- package/src/lib/utils.ts +3 -3
- package/src/styles/bridge.css +7 -3
- package/src/styles/derived-utilities.css +129 -50
- package/src/styles/index.css +17 -2
- package/src/styles/palette.css +266 -105
- package/src/styles/scroll-fade.css +116 -0
- package/src/styles/tailwind-tokens.css +3 -0
- package/src/styles/theme.css +57 -43
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { cva, type VariantProps } from
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
2
|
|
|
3
|
-
import { cn } from
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
4
|
|
|
5
|
-
function Empty({ className, ...props }: React.ComponentProps<
|
|
5
|
+
function Empty({ className, ...props }: React.ComponentProps<'div'>) {
|
|
6
6
|
return (
|
|
7
7
|
<div
|
|
8
8
|
data-slot="empty"
|
|
9
9
|
className={cn(
|
|
10
|
-
|
|
11
|
-
className
|
|
10
|
+
'flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance',
|
|
11
|
+
className,
|
|
12
12
|
)}
|
|
13
13
|
{...props}
|
|
14
14
|
/>
|
|
15
|
-
)
|
|
15
|
+
);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function EmptyHeader({ className, ...props }: React.ComponentProps<
|
|
18
|
+
function EmptyHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
19
19
|
return (
|
|
20
20
|
<div
|
|
21
21
|
data-slot="empty-header"
|
|
22
|
-
className={cn(
|
|
22
|
+
className={cn('flex max-w-sm flex-col items-center gap-2', className)}
|
|
23
23
|
{...props}
|
|
24
24
|
/>
|
|
25
|
-
)
|
|
25
|
+
);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const emptyMediaVariants = cva(
|
|
29
|
-
|
|
29
|
+
'mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
|
30
30
|
{
|
|
31
31
|
variants: {
|
|
32
32
|
variant: {
|
|
33
|
-
default:
|
|
33
|
+
default: 'bg-transparent',
|
|
34
34
|
icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
defaultVariants: {
|
|
38
|
-
variant:
|
|
38
|
+
variant: 'default',
|
|
39
39
|
},
|
|
40
|
-
}
|
|
41
|
-
)
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
42
|
|
|
43
43
|
function EmptyMedia({
|
|
44
44
|
className,
|
|
45
|
-
variant =
|
|
45
|
+
variant = 'default',
|
|
46
46
|
...props
|
|
47
|
-
}: React.ComponentProps<
|
|
47
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>) {
|
|
48
48
|
return (
|
|
49
49
|
<div
|
|
50
50
|
data-slot="empty-icon"
|
|
@@ -52,46 +52,46 @@ function EmptyMedia({
|
|
|
52
52
|
className={cn(emptyMediaVariants({ variant, className }))}
|
|
53
53
|
{...props}
|
|
54
54
|
/>
|
|
55
|
-
)
|
|
55
|
+
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function EmptyTitle({ className, ...props }: React.ComponentProps<
|
|
58
|
+
function EmptyTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
59
59
|
return (
|
|
60
60
|
<div
|
|
61
61
|
data-slot="empty-title"
|
|
62
62
|
className={cn(
|
|
63
|
-
|
|
64
|
-
className
|
|
63
|
+
'font-heading text-sm font-medium tracking-tight',
|
|
64
|
+
className,
|
|
65
65
|
)}
|
|
66
66
|
{...props}
|
|
67
67
|
/>
|
|
68
|
-
)
|
|
68
|
+
);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function EmptyDescription({ className, ...props }: React.ComponentProps<
|
|
71
|
+
function EmptyDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
72
72
|
return (
|
|
73
73
|
<div
|
|
74
74
|
data-slot="empty-description"
|
|
75
75
|
className={cn(
|
|
76
|
-
|
|
77
|
-
className
|
|
76
|
+
'text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
|
|
77
|
+
className,
|
|
78
78
|
)}
|
|
79
79
|
{...props}
|
|
80
80
|
/>
|
|
81
|
-
)
|
|
81
|
+
);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function EmptyContent({ className, ...props }: React.ComponentProps<
|
|
84
|
+
function EmptyContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
85
85
|
return (
|
|
86
86
|
<div
|
|
87
87
|
data-slot="empty-content"
|
|
88
88
|
className={cn(
|
|
89
|
-
|
|
90
|
-
className
|
|
89
|
+
'flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance',
|
|
90
|
+
className,
|
|
91
91
|
)}
|
|
92
92
|
{...props}
|
|
93
93
|
/>
|
|
94
|
-
)
|
|
94
|
+
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export {
|
|
@@ -101,4 +101,4 @@ export {
|
|
|
101
101
|
EmptyDescription,
|
|
102
102
|
EmptyContent,
|
|
103
103
|
EmptyMedia,
|
|
104
|
-
}
|
|
104
|
+
};
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { useMemo } from
|
|
2
|
-
import { cva, type VariantProps } from
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
3
|
|
|
4
|
-
import { cn } from
|
|
5
|
-
import { Label } from
|
|
6
|
-
import { Separator } from
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
import { Label } from './label';
|
|
6
|
+
import { Separator } from './separator';
|
|
7
7
|
|
|
8
|
-
function FieldSet({ className, ...props }: React.ComponentProps<
|
|
8
|
+
function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {
|
|
9
9
|
return (
|
|
10
10
|
<fieldset
|
|
11
11
|
data-slot="field-set"
|
|
12
12
|
className={cn(
|
|
13
|
-
|
|
14
|
-
className
|
|
13
|
+
'flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',
|
|
14
|
+
className,
|
|
15
15
|
)}
|
|
16
16
|
{...props}
|
|
17
17
|
/>
|
|
18
|
-
)
|
|
18
|
+
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function FieldLegend({
|
|
22
22
|
className,
|
|
23
|
-
variant =
|
|
23
|
+
variant = 'legend',
|
|
24
24
|
...props
|
|
25
|
-
}: React.ComponentProps<
|
|
25
|
+
}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {
|
|
26
26
|
return (
|
|
27
27
|
<legend
|
|
28
28
|
data-slot="field-legend"
|
|
29
29
|
data-variant={variant}
|
|
30
30
|
className={cn(
|
|
31
|
-
|
|
32
|
-
className
|
|
31
|
+
'mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base',
|
|
32
|
+
className,
|
|
33
33
|
)}
|
|
34
34
|
{...props}
|
|
35
35
|
/>
|
|
36
|
-
)
|
|
36
|
+
);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function FieldGroup({ className, ...props }: React.ComponentProps<
|
|
39
|
+
function FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
40
40
|
return (
|
|
41
41
|
<div
|
|
42
42
|
data-slot="field-group"
|
|
43
43
|
className={cn(
|
|
44
|
-
|
|
45
|
-
className
|
|
44
|
+
'group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',
|
|
45
|
+
className,
|
|
46
46
|
)}
|
|
47
47
|
{...props}
|
|
48
48
|
/>
|
|
49
|
-
)
|
|
49
|
+
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const fieldVariants = cva(
|
|
53
|
-
|
|
53
|
+
'group/field flex w-full gap-2 data-[invalid=true]:text-destructive',
|
|
54
54
|
{
|
|
55
55
|
variants: {
|
|
56
56
|
orientation: {
|
|
57
|
-
vertical:
|
|
57
|
+
vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',
|
|
58
58
|
horizontal:
|
|
59
|
-
|
|
59
|
+
'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
60
60
|
responsive:
|
|
61
|
-
|
|
61
|
+
'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
defaultVariants: {
|
|
65
|
-
orientation:
|
|
65
|
+
orientation: 'vertical',
|
|
66
66
|
},
|
|
67
|
-
}
|
|
68
|
-
)
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
69
|
|
|
70
70
|
function Field({
|
|
71
71
|
className,
|
|
72
|
-
orientation =
|
|
72
|
+
orientation = 'vertical',
|
|
73
73
|
...props
|
|
74
|
-
}: React.ComponentProps<
|
|
74
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {
|
|
75
75
|
return (
|
|
76
76
|
<div
|
|
77
77
|
role="group"
|
|
@@ -80,20 +80,20 @@ function Field({
|
|
|
80
80
|
className={cn(fieldVariants({ orientation }), className)}
|
|
81
81
|
{...props}
|
|
82
82
|
/>
|
|
83
|
-
)
|
|
83
|
+
);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function FieldContent({ className, ...props }: React.ComponentProps<
|
|
86
|
+
function FieldContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
87
87
|
return (
|
|
88
88
|
<div
|
|
89
89
|
data-slot="field-content"
|
|
90
90
|
className={cn(
|
|
91
|
-
|
|
92
|
-
className
|
|
91
|
+
'group/field-content flex flex-1 flex-col gap-0.5 leading-snug',
|
|
92
|
+
className,
|
|
93
93
|
)}
|
|
94
94
|
{...props}
|
|
95
95
|
/>
|
|
96
|
-
)
|
|
96
|
+
);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function FieldLabel({
|
|
@@ -104,57 +104,57 @@ function FieldLabel({
|
|
|
104
104
|
<Label
|
|
105
105
|
data-slot="field-label"
|
|
106
106
|
className={cn(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
className
|
|
107
|
+
'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10',
|
|
108
|
+
'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col',
|
|
109
|
+
className,
|
|
110
110
|
)}
|
|
111
111
|
{...props}
|
|
112
112
|
/>
|
|
113
|
-
)
|
|
113
|
+
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
function FieldTitle({ className, ...props }: React.ComponentProps<
|
|
116
|
+
function FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
117
117
|
return (
|
|
118
118
|
<div
|
|
119
119
|
data-slot="field-label"
|
|
120
120
|
className={cn(
|
|
121
|
-
|
|
122
|
-
className
|
|
121
|
+
'flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50',
|
|
122
|
+
className,
|
|
123
123
|
)}
|
|
124
124
|
{...props}
|
|
125
125
|
/>
|
|
126
|
-
)
|
|
126
|
+
);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
function FieldDescription({ className, ...props }: React.ComponentProps<
|
|
129
|
+
function FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {
|
|
130
130
|
return (
|
|
131
131
|
<p
|
|
132
132
|
data-slot="field-description"
|
|
133
133
|
className={cn(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
className
|
|
134
|
+
'text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5',
|
|
135
|
+
'last:mt-0 nth-last-2:-mt-1',
|
|
136
|
+
'[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
|
|
137
|
+
className,
|
|
138
138
|
)}
|
|
139
139
|
{...props}
|
|
140
140
|
/>
|
|
141
|
-
)
|
|
141
|
+
);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
function FieldSeparator({
|
|
145
145
|
children,
|
|
146
146
|
className,
|
|
147
147
|
...props
|
|
148
|
-
}: React.ComponentProps<
|
|
149
|
-
children?: React.ReactNode
|
|
148
|
+
}: React.ComponentProps<'div'> & {
|
|
149
|
+
children?: React.ReactNode;
|
|
150
150
|
}) {
|
|
151
151
|
return (
|
|
152
152
|
<div
|
|
153
153
|
data-slot="field-separator"
|
|
154
154
|
data-content={!!children}
|
|
155
155
|
className={cn(
|
|
156
|
-
|
|
157
|
-
className
|
|
156
|
+
'relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2',
|
|
157
|
+
className,
|
|
158
158
|
)}
|
|
159
159
|
{...props}
|
|
160
160
|
>
|
|
@@ -168,7 +168,7 @@ function FieldSeparator({
|
|
|
168
168
|
</span>
|
|
169
169
|
)}
|
|
170
170
|
</div>
|
|
171
|
-
)
|
|
171
|
+
);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function FieldError({
|
|
@@ -176,50 +176,50 @@ function FieldError({
|
|
|
176
176
|
children,
|
|
177
177
|
errors,
|
|
178
178
|
...props
|
|
179
|
-
}: React.ComponentProps<
|
|
180
|
-
errors?: Array<{ message?: string } | undefined
|
|
179
|
+
}: React.ComponentProps<'div'> & {
|
|
180
|
+
errors?: Array<{ message?: string } | undefined>;
|
|
181
181
|
}) {
|
|
182
182
|
const content = useMemo(() => {
|
|
183
183
|
if (children) {
|
|
184
|
-
return children
|
|
184
|
+
return children;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
if (!errors?.length) {
|
|
188
|
-
return null
|
|
188
|
+
return null;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
const uniqueErrors = [
|
|
192
192
|
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
193
|
-
]
|
|
193
|
+
];
|
|
194
194
|
|
|
195
195
|
if (uniqueErrors?.length == 1) {
|
|
196
|
-
return uniqueErrors[0]?.message
|
|
196
|
+
return uniqueErrors[0]?.message;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
return (
|
|
200
200
|
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
201
201
|
{uniqueErrors.map(
|
|
202
202
|
(error, index) =>
|
|
203
|
-
error?.message && <li key={index}>{error.message}</li
|
|
203
|
+
error?.message && <li key={index}>{error.message}</li>,
|
|
204
204
|
)}
|
|
205
205
|
</ul>
|
|
206
|
-
)
|
|
207
|
-
}, [children, errors])
|
|
206
|
+
);
|
|
207
|
+
}, [children, errors]);
|
|
208
208
|
|
|
209
209
|
if (!content) {
|
|
210
|
-
return null
|
|
210
|
+
return null;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
return (
|
|
214
214
|
<div
|
|
215
215
|
role="alert"
|
|
216
216
|
data-slot="field-error"
|
|
217
|
-
className={cn(
|
|
217
|
+
className={cn('text-sm font-normal text-destructive', className)}
|
|
218
218
|
{...props}
|
|
219
219
|
>
|
|
220
220
|
{content}
|
|
221
221
|
</div>
|
|
222
|
-
)
|
|
222
|
+
);
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
export {
|
|
@@ -233,4 +233,4 @@ export {
|
|
|
233
233
|
FieldSet,
|
|
234
234
|
FieldContent,
|
|
235
235
|
FieldTitle,
|
|
236
|
-
}
|
|
236
|
+
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import { PreviewCard as PreviewCardPrimitive } from
|
|
3
|
+
import { PreviewCard as PreviewCardPrimitive } from '@base-ui/react/preview-card';
|
|
4
4
|
|
|
5
|
-
import { cn } from
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
6
|
|
|
7
7
|
function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
|
|
8
|
-
return <PreviewCardPrimitive.Root data-slot="hover-card" {...props}
|
|
8
|
+
return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
|
|
12
12
|
return (
|
|
13
13
|
<PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
14
|
-
)
|
|
14
|
+
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function HoverCardContent({
|
|
18
18
|
className,
|
|
19
|
-
side =
|
|
19
|
+
side = 'bottom',
|
|
20
20
|
sideOffset = 4,
|
|
21
|
-
align =
|
|
21
|
+
align = 'center',
|
|
22
22
|
alignOffset = 4,
|
|
23
23
|
...props
|
|
24
24
|
}: PreviewCardPrimitive.Popup.Props &
|
|
25
25
|
Pick<
|
|
26
26
|
PreviewCardPrimitive.Positioner.Props,
|
|
27
|
-
|
|
27
|
+
'align' | 'alignOffset' | 'side' | 'sideOffset'
|
|
28
28
|
>) {
|
|
29
29
|
return (
|
|
30
30
|
<PreviewCardPrimitive.Portal data-slot="hover-card-portal">
|
|
@@ -38,14 +38,14 @@ function HoverCardContent({
|
|
|
38
38
|
<PreviewCardPrimitive.Popup
|
|
39
39
|
data-slot="hover-card-content"
|
|
40
40
|
className={cn(
|
|
41
|
-
|
|
42
|
-
className
|
|
41
|
+
'z-50 w-64 origin-(--transform-origin) rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
42
|
+
className,
|
|
43
43
|
)}
|
|
44
44
|
{...props}
|
|
45
45
|
/>
|
|
46
46
|
</PreviewCardPrimitive.Positioner>
|
|
47
47
|
</PreviewCardPrimitive.Portal>
|
|
48
|
-
)
|
|
48
|
+
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
51
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|