orbital-ds 0.1.0 → 0.2.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/contract.json +38 -0
- package/dist/styles.css +98 -18
- package/dist/themes/qratia.css +13 -13
- package/dist/themes/zyro.css +189 -0
- package/dist/ui/accordion.d.ts +9 -0
- package/dist/ui/accordion.js +79 -0
- package/dist/ui/alert-dialog.d.ts +23 -0
- package/dist/ui/alert-dialog.js +173 -0
- package/dist/ui/alert.d.ts +13 -0
- package/dist/ui/alert.js +77 -0
- package/dist/ui/aspect-ratio.d.ts +7 -0
- package/dist/ui/aspect-ratio.js +22 -0
- package/dist/ui/attachment.d.ts +26 -0
- package/dist/ui/attachment.js +197 -0
- package/dist/ui/avatar.js +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/bubble.d.ts +19 -0
- package/dist/ui/bubble.js +115 -0
- package/dist/ui/button-group.d.ts +15 -0
- package/dist/ui/button-group.js +82 -0
- package/dist/ui/button.d.ts +5 -3
- package/dist/ui/button.js +9 -6
- package/dist/ui/calendar.d.ts +15 -0
- package/dist/ui/calendar.js +190 -0
- package/dist/ui/card.js +4 -4
- package/dist/ui/carousel.d.ts +33 -0
- package/dist/ui/carousel.js +199 -0
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/combobox.d.ts +26 -0
- package/dist/ui/combobox.js +281 -0
- package/dist/ui/command.d.ts +22 -0
- package/dist/ui/command.js +183 -0
- package/dist/ui/context-menu.d.ts +31 -0
- package/dist/ui/context-menu.js +242 -0
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/direction.d.ts +1 -0
- package/dist/ui/direction.js +8 -0
- package/dist/ui/drawer.d.ts +18 -0
- package/dist/ui/drawer.js +208 -0
- package/dist/ui/dropdown-menu.d.ts +1 -1
- package/dist/ui/dropdown-menu.js +13 -9
- package/dist/ui/empty.d.ts +15 -0
- package/dist/ui/empty.js +102 -0
- package/dist/ui/field.d.ts +28 -0
- package/dist/ui/field.js +217 -0
- package/dist/ui/hover-card.d.ts +8 -0
- package/dist/ui/hover-card.js +45 -0
- package/dist/ui/input-group.d.ts +22 -0
- package/dist/ui/input-group.js +145 -0
- package/dist/ui/input-otp.d.ts +13 -0
- package/dist/ui/input-otp.js +82 -0
- package/dist/ui/input.js +1 -1
- package/dist/ui/item.d.ts +26 -0
- package/dist/ui/item.js +195 -0
- package/dist/ui/kbd.d.ts +6 -0
- package/dist/ui/kbd.js +29 -0
- package/dist/ui/marker.d.ts +13 -0
- package/dist/ui/marker.js +71 -0
- package/dist/ui/menubar.d.ts +31 -0
- package/dist/ui/menubar.js +259 -0
- package/dist/ui/message-scroller.d.ts +16 -0
- package/dist/ui/message-scroller.js +120 -0
- package/dist/ui/message.d.ts +12 -0
- package/dist/ui/message.js +90 -0
- package/dist/ui/native-select.d.ts +10 -0
- package/dist/ui/native-select.js +63 -0
- package/dist/ui/navigation-menu.d.ts +15 -0
- package/dist/ui/navigation-menu.js +162 -0
- package/dist/ui/pagination.d.ts +22 -0
- package/dist/ui/pagination.js +128 -0
- package/dist/ui/popover.js +2 -2
- package/dist/ui/questionnaire.d.ts +24 -0
- package/dist/ui/questionnaire.js +331 -0
- package/dist/ui/radio-group.d.ts +8 -0
- package/dist/ui/radio-group.js +39 -0
- package/dist/ui/resizable.d.ts +10 -0
- package/dist/ui/resizable.js +46 -0
- package/dist/ui/scroll-area.js +1 -1
- package/dist/ui/select.js +5 -5
- package/dist/ui/sheet.js +4 -4
- package/dist/ui/sidebar.js +4 -4
- package/dist/ui/slider.d.ts +6 -0
- package/dist/ui/slider.js +53 -0
- package/dist/ui/spinner.d.ts +5 -0
- package/dist/ui/spinner.js +9 -0
- package/dist/ui/switch.d.ts +8 -0
- package/dist/ui/switch.js +32 -0
- package/dist/ui/table.js +2 -2
- package/dist/ui/tabs.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/toast.d.ts +19 -0
- package/dist/ui/toast.js +193 -0
- package/dist/ui/toggle-group.d.ts +14 -0
- package/dist/ui/toggle-group.js +77 -0
- package/dist/ui/toggle.d.ts +12 -0
- package/dist/ui/toggle.js +43 -0
- package/dist/ui/tooltip.js +3 -3
- package/docs/CONTRACT.md +113 -0
- package/package.json +50 -12
- package/scripts/doctor.mjs +142 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer";
|
|
5
|
+
import { cn } from "../lib/utils";
|
|
6
|
+
const DrawerContext = React.createContext(null);
|
|
7
|
+
function useDrawer() {
|
|
8
|
+
const context = React.useContext(DrawerContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error("useDrawer must be used within a Drawer.");
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
14
|
+
function Drawer({
|
|
15
|
+
modal = true,
|
|
16
|
+
showSwipeHandle = false,
|
|
17
|
+
snapPoints,
|
|
18
|
+
swipeDirection = "down",
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
|
|
22
|
+
const contextValue = React.useMemo(
|
|
23
|
+
() => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }),
|
|
24
|
+
[hasSnapPoints, modal, showSwipeHandle, swipeDirection]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ jsx(DrawerContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
27
|
+
DrawerPrimitive.Root,
|
|
28
|
+
{
|
|
29
|
+
"data-slot": "drawer",
|
|
30
|
+
modal,
|
|
31
|
+
snapPoints,
|
|
32
|
+
swipeDirection,
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
) });
|
|
36
|
+
}
|
|
37
|
+
function DrawerTrigger({ ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
39
|
+
}
|
|
40
|
+
function DrawerPortal({ ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Portal, { "data-slot": "drawer-portal", ...props });
|
|
42
|
+
}
|
|
43
|
+
function DrawerClose({ ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx(DrawerPrimitive.Close, { "data-slot": "drawer-close", ...props });
|
|
45
|
+
}
|
|
46
|
+
function DrawerOverlay({
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
DrawerPrimitive.Backdrop,
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "drawer-overlay",
|
|
54
|
+
className: cn(
|
|
55
|
+
"fixed inset-0 z-(--ds-z-overlay) min-h-dvh bg-scrim opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))] transition-opacity duration-(--ds-motion-slow) ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-snap-points:[--drawer-overlay-min-opacity:0.5] data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs supports-[-webkit-touch-callout:none]:absolute",
|
|
56
|
+
className
|
|
57
|
+
),
|
|
58
|
+
...props
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
function DrawerSwipeHandle({
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
"data-slot": "drawer-swipe-handle",
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
className: cn(
|
|
72
|
+
"relative z-(--ds-z-raised) flex shrink-0 cursor-grab transition-opacity duration-(--ds-motion-base) group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-[swipe-axis=x]/drawer-popup:h-full group-data-[swipe-axis=x]/drawer-popup:w-3 group-data-[swipe-axis=x]/drawer-popup:items-center group-data-[swipe-axis=y]/drawer-popup:h-3 group-data-[swipe-axis=y]/drawer-popup:w-full group-data-[swipe-axis=y]/drawer-popup:justify-center group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:items-start after:block after:shrink-0 after:rounded-full after:bg-muted group-data-[swipe-axis=x]/drawer-popup:after:h-[100px] group-data-[swipe-axis=x]/drawer-popup:after:w-1.5 group-data-[swipe-axis=y]/drawer-popup:after:h-1.5 group-data-[swipe-axis=y]/drawer-popup:after:w-[100px] active:cursor-grabbing",
|
|
73
|
+
className
|
|
74
|
+
),
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function DrawerContent({
|
|
80
|
+
className,
|
|
81
|
+
children,
|
|
82
|
+
...props
|
|
83
|
+
}) {
|
|
84
|
+
const { hasSnapPoints, modal, showSwipeHandle, swipeDirection } = useDrawer();
|
|
85
|
+
const swipeAxis = swipeDirection === "down" || swipeDirection === "up" ? "y" : "x";
|
|
86
|
+
return /* @__PURE__ */ jsxs(DrawerPortal, { "data-slot": "drawer-portal", children: [
|
|
87
|
+
modal === true && /* @__PURE__ */ jsx(DrawerOverlay, { "data-snap-points": hasSnapPoints ? "" : void 0 }),
|
|
88
|
+
/* @__PURE__ */ jsx(
|
|
89
|
+
DrawerPrimitive.Viewport,
|
|
90
|
+
{
|
|
91
|
+
"data-slot": "drawer-viewport",
|
|
92
|
+
"data-modal": modal,
|
|
93
|
+
className: "pointer-events-none fixed inset-0 z-(--ds-z-overlay) select-none data-[modal=true]:pointer-events-auto",
|
|
94
|
+
children: /* @__PURE__ */ jsxs(
|
|
95
|
+
DrawerPrimitive.Popup,
|
|
96
|
+
{
|
|
97
|
+
"data-slot": "drawer-popup",
|
|
98
|
+
"data-swipe-axis": swipeAxis,
|
|
99
|
+
"data-snap-points": hasSnapPoints ? "" : void 0,
|
|
100
|
+
className: cn(
|
|
101
|
+
// Base.
|
|
102
|
+
"group/drawer-popup pointer-events-auto fixed z-(--ds-z-overlay) m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col rounded-control border border-popover bg-popover text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-(--ds-motion-slow) ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [--drawer-bleed-background:transparent] [--drawer-inset:--spacing(2)] [interpolate-size:allow-keywords] dark:border-border",
|
|
103
|
+
// Nested.
|
|
104
|
+
"data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95",
|
|
105
|
+
// Bleed.
|
|
106
|
+
"after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full",
|
|
107
|
+
// Sizing.
|
|
108
|
+
"[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem]",
|
|
109
|
+
// Stack.
|
|
110
|
+
"[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05]",
|
|
111
|
+
// Transitions.
|
|
112
|
+
"data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)]",
|
|
113
|
+
// Axis: y.
|
|
114
|
+
"data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height)",
|
|
115
|
+
// Axis: x.
|
|
116
|
+
"data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row",
|
|
117
|
+
// Direction: down.
|
|
118
|
+
"data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]",
|
|
119
|
+
// Direction: up.
|
|
120
|
+
"data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]",
|
|
121
|
+
// Direction: left.
|
|
122
|
+
"data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]",
|
|
123
|
+
// Direction: right.
|
|
124
|
+
"data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]",
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
...props,
|
|
128
|
+
children: [
|
|
129
|
+
showSwipeHandle && /* @__PURE__ */ jsx(DrawerSwipeHandle, {}),
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
DrawerPrimitive.Content,
|
|
132
|
+
{
|
|
133
|
+
"data-slot": "drawer-content",
|
|
134
|
+
className: cn(
|
|
135
|
+
"flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-(--ds-motion-slow) ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none"
|
|
136
|
+
),
|
|
137
|
+
children
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] });
|
|
146
|
+
}
|
|
147
|
+
function DrawerHeader({ className, ...props }) {
|
|
148
|
+
return /* @__PURE__ */ jsx(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
"data-slot": "drawer-header",
|
|
152
|
+
className: cn(
|
|
153
|
+
"flex shrink-0 flex-col gap-0.5 p-4 pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-1.5 md:text-left",
|
|
154
|
+
className
|
|
155
|
+
),
|
|
156
|
+
...props
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function DrawerFooter({ className, ...props }) {
|
|
161
|
+
return /* @__PURE__ */ jsx(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
"data-slot": "drawer-footer",
|
|
165
|
+
className: cn("mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0", className),
|
|
166
|
+
...props
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
function DrawerTitle({ className, ...props }) {
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
DrawerPrimitive.Title,
|
|
173
|
+
{
|
|
174
|
+
"data-slot": "drawer-title",
|
|
175
|
+
className: cn(
|
|
176
|
+
"text-base font-medium text-foreground",
|
|
177
|
+
className
|
|
178
|
+
),
|
|
179
|
+
...props
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
function DrawerDescription({
|
|
184
|
+
className,
|
|
185
|
+
...props
|
|
186
|
+
}) {
|
|
187
|
+
return /* @__PURE__ */ jsx(
|
|
188
|
+
DrawerPrimitive.Description,
|
|
189
|
+
{
|
|
190
|
+
"data-slot": "drawer-description",
|
|
191
|
+
className: cn("text-sm text-balance text-muted-foreground", className),
|
|
192
|
+
...props
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
export {
|
|
197
|
+
Drawer,
|
|
198
|
+
DrawerClose,
|
|
199
|
+
DrawerContent,
|
|
200
|
+
DrawerDescription,
|
|
201
|
+
DrawerFooter,
|
|
202
|
+
DrawerHeader,
|
|
203
|
+
DrawerOverlay,
|
|
204
|
+
DrawerPortal,
|
|
205
|
+
DrawerSwipeHandle,
|
|
206
|
+
DrawerTitle,
|
|
207
|
+
DrawerTrigger
|
|
208
|
+
};
|
|
@@ -4,7 +4,7 @@ import { Menu } from '@base-ui/react/menu';
|
|
|
4
4
|
declare function DropdownMenu({ ...props }: Menu.Root.Props): React.JSX.Element;
|
|
5
5
|
declare function DropdownMenuPortal({ ...props }: Menu.Portal.Props): React.JSX.Element;
|
|
6
6
|
declare function DropdownMenuTrigger({ ...props }: Menu.Trigger.Props): React.JSX.Element;
|
|
7
|
-
declare function DropdownMenuContent({ className, align, sideOffset, ...props }: Menu.Popup.Props & Pick<Menu.Positioner.Props, "align" | "sideOffset">): React.JSX.Element;
|
|
7
|
+
declare function DropdownMenuContent({ className, align, alignOffset, side, sideOffset, ...props }: Menu.Popup.Props & Pick<Menu.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset">): React.JSX.Element;
|
|
8
8
|
declare function DropdownMenuGroup({ ...props }: Menu.Group.Props): React.JSX.Element;
|
|
9
9
|
declare function DropdownMenuItem({ className, inset, variant, ...props }: Menu.Item.Props & {
|
|
10
10
|
inset?: boolean;
|
package/dist/ui/dropdown-menu.js
CHANGED
|
@@ -23,6 +23,8 @@ function DropdownMenuTrigger({
|
|
|
23
23
|
function DropdownMenuContent({
|
|
24
24
|
className,
|
|
25
25
|
align = "start",
|
|
26
|
+
alignOffset = 0,
|
|
27
|
+
side = "bottom",
|
|
26
28
|
sideOffset = 4,
|
|
27
29
|
...props
|
|
28
30
|
}) {
|
|
@@ -31,13 +33,15 @@ function DropdownMenuContent({
|
|
|
31
33
|
{
|
|
32
34
|
sideOffset,
|
|
33
35
|
align,
|
|
34
|
-
|
|
36
|
+
alignOffset,
|
|
37
|
+
side,
|
|
38
|
+
className: "z-(--ds-z-overlay)",
|
|
35
39
|
children: /* @__PURE__ */ jsx(
|
|
36
40
|
DropdownMenuPrimitive.Popup,
|
|
37
41
|
{
|
|
38
42
|
"data-slot": "dropdown-menu-content",
|
|
39
43
|
className: cn(
|
|
40
|
-
"max-h-(--available-height) w-(--anchor-width) min-w-48 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-
|
|
44
|
+
"max-h-(--available-height) w-(--anchor-width) min-w-48 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-(--ds-menu-p) text-popover-foreground shadow-popover ring-1 ring-foreground/5 duration-(--ds-motion-fast) data-[side=bottom]:slide-in-from-top-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-closed:overflow-hidden dark:ring-foreground/10 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",
|
|
41
45
|
className
|
|
42
46
|
),
|
|
43
47
|
...props
|
|
@@ -62,7 +66,7 @@ function DropdownMenuItem({
|
|
|
62
66
|
"data-inset": inset,
|
|
63
67
|
"data-variant": variant,
|
|
64
68
|
className: cn(
|
|
65
|
-
"group/dropdown-menu-item relative flex cursor-default items-center gap-2.5 rounded-xl px-
|
|
69
|
+
"group/dropdown-menu-item relative flex cursor-default items-center gap-2.5 rounded-xl px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
66
70
|
className
|
|
67
71
|
),
|
|
68
72
|
...props
|
|
@@ -82,7 +86,7 @@ function DropdownMenuCheckboxItem({
|
|
|
82
86
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
83
87
|
"data-inset": inset,
|
|
84
88
|
className: cn(
|
|
85
|
-
"relative flex cursor-default items-center gap-2.5 rounded-xl py-
|
|
89
|
+
"relative flex cursor-default items-center gap-2.5 rounded-xl py-(--ds-menu-item-py) pr-8 pl-3 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
86
90
|
className
|
|
87
91
|
),
|
|
88
92
|
checked,
|
|
@@ -124,7 +128,7 @@ function DropdownMenuRadioItem({
|
|
|
124
128
|
"data-slot": "dropdown-menu-radio-item",
|
|
125
129
|
"data-inset": inset,
|
|
126
130
|
className: cn(
|
|
127
|
-
"relative flex cursor-default items-center gap-2.5 rounded-xl py-
|
|
131
|
+
"relative flex cursor-default items-center gap-2.5 rounded-xl py-(--ds-menu-item-py) pr-8 pl-3 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
128
132
|
className
|
|
129
133
|
),
|
|
130
134
|
...props,
|
|
@@ -153,7 +157,7 @@ function DropdownMenuLabel({
|
|
|
153
157
|
"data-slot": "dropdown-menu-label",
|
|
154
158
|
"data-inset": inset,
|
|
155
159
|
className: cn(
|
|
156
|
-
"px-
|
|
160
|
+
"px-(--ds-menu-item-px) py-(--ds-menu-item-py).5 text-xs text-muted-foreground data-inset:pl-9.5",
|
|
157
161
|
className
|
|
158
162
|
),
|
|
159
163
|
...props
|
|
@@ -212,7 +216,7 @@ function DropdownMenuSubTrigger({
|
|
|
212
216
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
213
217
|
"data-inset": inset,
|
|
214
218
|
className: cn(
|
|
215
|
-
"flex cursor-default items-center gap-2 rounded-xl px-
|
|
219
|
+
"flex cursor-default items-center gap-2 rounded-xl px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-popup-open:bg-accent data-popup-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
216
220
|
className
|
|
217
221
|
),
|
|
218
222
|
...props,
|
|
@@ -227,12 +231,12 @@ function DropdownMenuSubContent({
|
|
|
227
231
|
className,
|
|
228
232
|
...props
|
|
229
233
|
}) {
|
|
230
|
-
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Positioner, { className: "z-(--z-overlay)", children: /* @__PURE__ */ jsx(
|
|
234
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Positioner, { className: "z-(--ds-z-overlay)", children: /* @__PURE__ */ jsx(
|
|
231
235
|
DropdownMenuPrimitive.Popup,
|
|
232
236
|
{
|
|
233
237
|
"data-slot": "dropdown-menu-sub-content",
|
|
234
238
|
className: cn(
|
|
235
|
-
"z-(--z-overlay) min-w-36 origin-(--transform-origin) overflow-hidden rounded-2xl bg-popover p-
|
|
239
|
+
"z-(--ds-z-overlay) min-w-36 origin-(--transform-origin) overflow-hidden rounded-2xl bg-popover p-(--ds-menu-p) text-popover-foreground shadow-popover ring-1 ring-foreground/5 duration-(--ds-motion-fast) data-[side=bottom]:slide-in-from-top-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",
|
|
236
240
|
className
|
|
237
241
|
),
|
|
238
242
|
...props
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare function Empty({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
6
|
+
declare function EmptyHeader({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
7
|
+
declare const emptyMediaVariants: (props?: ({
|
|
8
|
+
variant?: "default" | "icon" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare function EmptyMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>): React$1.JSX.Element;
|
|
11
|
+
declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
12
|
+
declare function EmptyDescription({ className, ...props }: React.ComponentProps<"p">): React$1.JSX.Element;
|
|
13
|
+
declare function EmptyContent({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle };
|
package/dist/ui/empty.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
function Empty({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "empty",
|
|
9
|
+
className: cn(
|
|
10
|
+
"flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function EmptyHeader({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
"data-slot": "empty-header",
|
|
22
|
+
className: cn("flex max-w-sm flex-col items-center gap-2", className),
|
|
23
|
+
...props
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const emptyMediaVariants = cva(
|
|
28
|
+
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: "bg-transparent",
|
|
33
|
+
icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
variant: "default"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
function EmptyMedia({
|
|
42
|
+
className,
|
|
43
|
+
variant = "default",
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "empty-icon",
|
|
50
|
+
"data-variant": variant,
|
|
51
|
+
className: cn(emptyMediaVariants({ variant, className })),
|
|
52
|
+
...props
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function EmptyTitle({ className, ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "empty-title",
|
|
61
|
+
className: cn(
|
|
62
|
+
"text-lg font-medium tracking-tight",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function EmptyDescription({ className, ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
"data-slot": "empty-description",
|
|
74
|
+
className: cn(
|
|
75
|
+
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
76
|
+
className
|
|
77
|
+
),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function EmptyContent({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
"data-slot": "empty-content",
|
|
87
|
+
className: cn(
|
|
88
|
+
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
...props
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
Empty,
|
|
97
|
+
EmptyContent,
|
|
98
|
+
EmptyDescription,
|
|
99
|
+
EmptyHeader,
|
|
100
|
+
EmptyMedia,
|
|
101
|
+
EmptyTitle
|
|
102
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { Label } from './label.js';
|
|
5
|
+
|
|
6
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): React$1.JSX.Element;
|
|
7
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
|
|
8
|
+
variant?: "legend" | "label";
|
|
9
|
+
}): React$1.JSX.Element;
|
|
10
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
11
|
+
declare const fieldVariants: (props?: ({
|
|
12
|
+
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React$1.JSX.Element;
|
|
15
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
16
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): React$1.JSX.Element;
|
|
17
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
18
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): React$1.JSX.Element;
|
|
19
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}): React$1.JSX.Element;
|
|
22
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
|
|
23
|
+
errors?: Array<{
|
|
24
|
+
message?: string;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
}): React$1.JSX.Element | null;
|
|
27
|
+
|
|
28
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
package/dist/ui/field.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../lib/utils";
|
|
5
|
+
import { Label } from "./label";
|
|
6
|
+
import { Separator } from "./separator";
|
|
7
|
+
function FieldSet({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"fieldset",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "field-set",
|
|
12
|
+
className: cn(
|
|
13
|
+
"flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
14
|
+
className
|
|
15
|
+
),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function FieldLegend({
|
|
21
|
+
className,
|
|
22
|
+
variant = "legend",
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"legend",
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "field-legend",
|
|
29
|
+
"data-variant": variant,
|
|
30
|
+
className: cn(
|
|
31
|
+
"mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function FieldGroup({ className, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "field-group",
|
|
43
|
+
className: cn(
|
|
44
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const fieldVariants = cva(
|
|
52
|
+
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
53
|
+
{
|
|
54
|
+
variants: {
|
|
55
|
+
orientation: {
|
|
56
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
57
|
+
horizontal: "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",
|
|
58
|
+
responsive: "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"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
orientation: "vertical"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
function Field({
|
|
67
|
+
className,
|
|
68
|
+
orientation = "vertical",
|
|
69
|
+
...props
|
|
70
|
+
}) {
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
role: "group",
|
|
75
|
+
"data-slot": "field",
|
|
76
|
+
"data-orientation": orientation,
|
|
77
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
78
|
+
...props
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function FieldContent({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
"data-slot": "field-content",
|
|
87
|
+
className: cn(
|
|
88
|
+
"group/field-content flex flex-1 flex-col gap-1 leading-snug",
|
|
89
|
+
className
|
|
90
|
+
),
|
|
91
|
+
...props
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function FieldLabel({
|
|
96
|
+
className,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
return /* @__PURE__ */ jsx(
|
|
100
|
+
Label,
|
|
101
|
+
{
|
|
102
|
+
"data-slot": "field-label",
|
|
103
|
+
className: cn(
|
|
104
|
+
"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-xl has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-(length:--ds-ring-width) has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-4 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10",
|
|
105
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",
|
|
106
|
+
className
|
|
107
|
+
),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function FieldTitle({ className, ...props }) {
|
|
113
|
+
return /* @__PURE__ */ jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
"data-slot": "field-label",
|
|
117
|
+
className: cn(
|
|
118
|
+
"flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",
|
|
119
|
+
className
|
|
120
|
+
),
|
|
121
|
+
...props
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
function FieldDescription({ className, ...props }) {
|
|
126
|
+
return /* @__PURE__ */ jsx(
|
|
127
|
+
"p",
|
|
128
|
+
{
|
|
129
|
+
"data-slot": "field-description",
|
|
130
|
+
className: cn(
|
|
131
|
+
"text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
|
|
132
|
+
"last:mt-0 nth-last-2:-mt-1",
|
|
133
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
134
|
+
className
|
|
135
|
+
),
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function FieldSeparator({
|
|
141
|
+
children,
|
|
142
|
+
className,
|
|
143
|
+
...props
|
|
144
|
+
}) {
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
"data-slot": "field-separator",
|
|
149
|
+
"data-content": !!children,
|
|
150
|
+
className: cn(
|
|
151
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
152
|
+
className
|
|
153
|
+
),
|
|
154
|
+
...props,
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
157
|
+
children && /* @__PURE__ */ jsx(
|
|
158
|
+
"span",
|
|
159
|
+
{
|
|
160
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
161
|
+
"data-slot": "field-separator-content",
|
|
162
|
+
children
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
function FieldError({
|
|
170
|
+
className,
|
|
171
|
+
children,
|
|
172
|
+
errors,
|
|
173
|
+
...props
|
|
174
|
+
}) {
|
|
175
|
+
const content = useMemo(() => {
|
|
176
|
+
if (children) {
|
|
177
|
+
return children;
|
|
178
|
+
}
|
|
179
|
+
if (!errors?.length) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const uniqueErrors = [
|
|
183
|
+
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
184
|
+
];
|
|
185
|
+
if (uniqueErrors?.length == 1) {
|
|
186
|
+
return uniqueErrors[0]?.message;
|
|
187
|
+
}
|
|
188
|
+
return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
189
|
+
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
190
|
+
) });
|
|
191
|
+
}, [children, errors]);
|
|
192
|
+
if (!content) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
return /* @__PURE__ */ jsx(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
role: "alert",
|
|
199
|
+
"data-slot": "field-error",
|
|
200
|
+
className: cn("text-sm font-normal text-destructive", className),
|
|
201
|
+
...props,
|
|
202
|
+
children: content
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
Field,
|
|
208
|
+
FieldContent,
|
|
209
|
+
FieldDescription,
|
|
210
|
+
FieldError,
|
|
211
|
+
FieldGroup,
|
|
212
|
+
FieldLabel,
|
|
213
|
+
FieldLegend,
|
|
214
|
+
FieldSeparator,
|
|
215
|
+
FieldSet,
|
|
216
|
+
FieldTitle
|
|
217
|
+
};
|