@epicbagel/saas-kit 1.2.3 → 1.4.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 +115 -0
- package/dist/chunk-2TKLS73N.js +121 -0
- package/dist/chunk-4UUTKR3V.cjs +53 -0
- package/dist/chunk-BTHYGHOH.cjs +143 -0
- package/dist/chunk-D5EHW3O2.cjs +52 -0
- package/dist/chunk-F3DAFAMD.js +271 -0
- package/dist/chunk-GRY77463.cjs +121 -0
- package/dist/chunk-HAP6USTP.cjs +46 -0
- package/dist/chunk-HAQOT2CD.js +46 -0
- package/dist/chunk-HHV4G77I.js +55 -0
- package/dist/{chunk-KYQPX754.js → chunk-HRLP4BHJ.js} +7 -7
- package/dist/{chunk-N6V3DDKU.cjs → chunk-IH3COANJ.cjs} +7 -7
- package/dist/chunk-JTI4244T.js +143 -0
- package/dist/chunk-QEJ2STIV.js +53 -0
- package/dist/chunk-TWCJMFST.js +260 -0
- package/dist/chunk-U3YFP6ZV.cjs +273 -0
- package/dist/chunk-VLXPLKFR.cjs +55 -0
- package/dist/chunk-X3PRMR5G.js +52 -0
- package/dist/chunk-ZJFYOXSM.cjs +260 -0
- package/dist/lib/neutral-theme.cjs +39 -236
- package/dist/lib/neutral-theme.d.cts +44 -2
- package/dist/lib/neutral-theme.d.ts +44 -2
- package/dist/lib/neutral-theme.js +23 -219
- package/dist/primitives/activity-feed.cjs +3 -3
- package/dist/primitives/activity-feed.js +4 -4
- package/dist/primitives/board-view.cjs +6 -6
- package/dist/primitives/board-view.js +5 -5
- package/dist/primitives/chat.cjs +14 -14
- package/dist/primitives/chat.js +12 -12
- package/dist/primitives/code-block.cjs +5 -50
- package/dist/primitives/code-block.js +5 -50
- package/dist/primitives/connection.cjs +6 -6
- package/dist/primitives/connection.js +7 -7
- package/dist/primitives/copy-button.cjs +3 -3
- package/dist/primitives/copy-button.js +2 -2
- package/dist/primitives/document-preview.cjs +54 -0
- package/dist/primitives/document-preview.d.cts +30 -0
- package/dist/primitives/document-preview.d.ts +30 -0
- package/dist/primitives/document-preview.js +54 -0
- package/dist/primitives/editable-list.cjs +1 -1
- package/dist/primitives/editable-list.js +1 -1
- package/dist/primitives/field.cjs +12 -239
- package/dist/primitives/field.js +16 -243
- package/dist/primitives/file-dropzone.cjs +3 -3
- package/dist/primitives/file-dropzone.js +2 -2
- package/dist/primitives/file-preview-internals.cjs +20 -0
- package/dist/primitives/file-preview-internals.d.cts +44 -0
- package/dist/primitives/file-preview-internals.d.ts +44 -0
- package/dist/primitives/file-preview-internals.js +20 -0
- package/dist/primitives/file-preview.cjs +327 -0
- package/dist/primitives/file-preview.d.cts +92 -0
- package/dist/primitives/file-preview.d.ts +92 -0
- package/dist/primitives/file-preview.js +327 -0
- package/dist/primitives/filter-bar.cjs +4 -4
- package/dist/primitives/filter-bar.js +3 -3
- package/dist/primitives/image.cjs +4 -48
- package/dist/primitives/image.js +3 -47
- package/dist/primitives/radio-group.cjs +4 -39
- package/dist/primitives/radio-group.js +4 -39
- package/dist/primitives/resource-list.cjs +6 -6
- package/dist/primitives/resource-list.js +5 -5
- package/dist/primitives/responsive-dialog.cjs +26 -142
- package/dist/primitives/responsive-dialog.js +13 -129
- package/dist/primitives/section.cjs +2 -2
- package/dist/primitives/section.js +3 -3
- package/dist/primitives/switch-field.cjs +2 -2
- package/dist/primitives/switch-field.js +3 -3
- package/dist/primitives/theme-selector.cjs +188 -0
- package/dist/primitives/theme-selector.d.cts +78 -0
- package/dist/primitives/theme-selector.d.ts +78 -0
- package/dist/primitives/theme-selector.js +188 -0
- package/dist/primitives/toggle-group.cjs +5 -45
- package/dist/primitives/toggle-group.js +5 -45
- package/package.json +31 -1
- package/dist/{chunk-6OTAGP2I.cjs → chunk-KADJ56AH.cjs} +2 -2
- package/dist/{chunk-EHKMVJ6O.js → chunk-M7FYGAGO.js} +3 -3
- package/dist/{chunk-PVZ4JGDU.js → chunk-MLHNYRFX.js} +6 -6
- package/dist/{chunk-PWOQMTPX.js → chunk-NW3OWKBN.js} +3 -3
- package/dist/{chunk-CYH63OCL.cjs → chunk-SGW4FWBX.cjs} +6 -6
- package/dist/{chunk-ENJNZ323.cjs → chunk-VKIGJNJR.cjs} +2 -2
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Drawer,
|
|
4
|
+
DrawerClose,
|
|
5
|
+
DrawerContent,
|
|
6
|
+
DrawerDescription,
|
|
7
|
+
DrawerFooter,
|
|
8
|
+
DrawerHeader,
|
|
9
|
+
DrawerTitle,
|
|
10
|
+
DrawerTrigger
|
|
11
|
+
} from "./chunk-4HWCNRK4.js";
|
|
12
|
+
import {
|
|
13
|
+
Dialog,
|
|
14
|
+
DialogClose,
|
|
15
|
+
DialogContent,
|
|
16
|
+
DialogDescription,
|
|
17
|
+
DialogFooter,
|
|
18
|
+
DialogHeader,
|
|
19
|
+
DialogTitle,
|
|
20
|
+
DialogTrigger
|
|
21
|
+
} from "./chunk-3QT5VYZ3.js";
|
|
22
|
+
import {
|
|
23
|
+
cn
|
|
24
|
+
} from "./chunk-G6SRSWXB.js";
|
|
25
|
+
|
|
26
|
+
// src/primitives/responsive-dialog.tsx
|
|
27
|
+
import * as React from "react";
|
|
28
|
+
import { useMediaQuery } from "react-responsive";
|
|
29
|
+
import { jsx } from "react/jsx-runtime";
|
|
30
|
+
var DesktopContext = React.createContext(false);
|
|
31
|
+
var useIsDesktop = () => React.useContext(DesktopContext);
|
|
32
|
+
var DESKTOP_QUERY = { minWidth: 1024 };
|
|
33
|
+
var ResponsiveDialog = ({ children, ...props }) => {
|
|
34
|
+
const isDesktop = useMediaQuery(DESKTOP_QUERY);
|
|
35
|
+
const Root = isDesktop ? Dialog : Drawer;
|
|
36
|
+
return /* @__PURE__ */ jsx(DesktopContext.Provider, { value: isDesktop, children: /* @__PURE__ */ jsx(Root, { ...props, children }) });
|
|
37
|
+
};
|
|
38
|
+
ResponsiveDialog.displayName = "ResponsiveDialog";
|
|
39
|
+
var ResponsiveDialogTrigger = ({
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}) => {
|
|
43
|
+
const Trigger = useIsDesktop() ? DialogTrigger : DrawerTrigger;
|
|
44
|
+
return /* @__PURE__ */ jsx(Trigger, { ...props, children });
|
|
45
|
+
};
|
|
46
|
+
ResponsiveDialogTrigger.displayName = "ResponsiveDialogTrigger";
|
|
47
|
+
var ResponsiveDialogClose = ({
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
51
|
+
const Close = useIsDesktop() ? DialogClose : DrawerClose;
|
|
52
|
+
return /* @__PURE__ */ jsx(Close, { ...props, children });
|
|
53
|
+
};
|
|
54
|
+
ResponsiveDialogClose.displayName = "ResponsiveDialogClose";
|
|
55
|
+
var ResponsiveDialogContent = React.forwardRef(({ className, children, presentation = "default", ...props }, ref) => {
|
|
56
|
+
if (useIsDesktop()) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
DialogContent,
|
|
59
|
+
{
|
|
60
|
+
ref,
|
|
61
|
+
className: cn(
|
|
62
|
+
"flex max-h-[85vh] max-w-md flex-col gap-0 overflow-hidden p-0",
|
|
63
|
+
presentation === "preview" && "max-w-2xl sm:h-[85vh] [&>button:last-child]:hidden",
|
|
64
|
+
className
|
|
65
|
+
),
|
|
66
|
+
...props,
|
|
67
|
+
children
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
DrawerContent,
|
|
73
|
+
{
|
|
74
|
+
ref,
|
|
75
|
+
className: cn("max-h-[92vh]", className),
|
|
76
|
+
...props,
|
|
77
|
+
children
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
ResponsiveDialogContent.displayName = "ResponsiveDialogContent";
|
|
82
|
+
var ResponsiveDialogHeader = ({
|
|
83
|
+
className,
|
|
84
|
+
visibility = "visible",
|
|
85
|
+
...props
|
|
86
|
+
}) => {
|
|
87
|
+
const Header = useIsDesktop() ? DialogHeader : DrawerHeader;
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
Header,
|
|
90
|
+
{
|
|
91
|
+
className: cn(useIsDesktop() && "p-4", visibility === "screen-reader" && "sr-only", className),
|
|
92
|
+
...props
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
ResponsiveDialogHeader.displayName = "ResponsiveDialogHeader";
|
|
97
|
+
var ResponsiveDialogBody = ({
|
|
98
|
+
className,
|
|
99
|
+
...props
|
|
100
|
+
}) => /* @__PURE__ */ jsx("div", { className: cn("min-h-0 flex-1 overflow-y-auto px-4 pb-6", className), ...props });
|
|
101
|
+
ResponsiveDialogBody.displayName = "ResponsiveDialogBody";
|
|
102
|
+
var ResponsiveDialogFooter = ({
|
|
103
|
+
className,
|
|
104
|
+
layout = "auto",
|
|
105
|
+
...props
|
|
106
|
+
}) => {
|
|
107
|
+
const isDesktop = useIsDesktop();
|
|
108
|
+
const Footer = isDesktop ? DialogFooter : DrawerFooter;
|
|
109
|
+
return /* @__PURE__ */ jsx(
|
|
110
|
+
Footer,
|
|
111
|
+
{
|
|
112
|
+
className: cn(
|
|
113
|
+
"mt-0 shrink-0 gap-2 border-t bg-background p-4",
|
|
114
|
+
layout === "fill" ? "flex-row space-x-0 [&>*]:min-w-0 [&>*]:flex-1" : isDesktop ? "flex-row justify-end space-x-0 [&>*]:flex-none" : "grid grid-cols-2 [&>*]:w-full",
|
|
115
|
+
className
|
|
116
|
+
),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
ResponsiveDialogFooter.displayName = "ResponsiveDialogFooter";
|
|
122
|
+
var ResponsiveDialogTitle = React.forwardRef(({ className, visuallyHidden = false, ...props }, ref) => {
|
|
123
|
+
const Title = useIsDesktop() ? DialogTitle : DrawerTitle;
|
|
124
|
+
return /* @__PURE__ */ jsx(Title, { ref, className: cn(visuallyHidden && "sr-only", className), ...props });
|
|
125
|
+
});
|
|
126
|
+
ResponsiveDialogTitle.displayName = "ResponsiveDialogTitle";
|
|
127
|
+
var ResponsiveDialogDescription = React.forwardRef(({ className, visuallyHidden = false, ...props }, ref) => {
|
|
128
|
+
const Description = useIsDesktop() ? DialogDescription : DrawerDescription;
|
|
129
|
+
return /* @__PURE__ */ jsx(Description, { ref, className: cn(visuallyHidden && "sr-only", className), ...props });
|
|
130
|
+
});
|
|
131
|
+
ResponsiveDialogDescription.displayName = "ResponsiveDialogDescription";
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
ResponsiveDialog,
|
|
135
|
+
ResponsiveDialogTrigger,
|
|
136
|
+
ResponsiveDialogClose,
|
|
137
|
+
ResponsiveDialogContent,
|
|
138
|
+
ResponsiveDialogHeader,
|
|
139
|
+
ResponsiveDialogBody,
|
|
140
|
+
ResponsiveDialogFooter,
|
|
141
|
+
ResponsiveDialogTitle,
|
|
142
|
+
ResponsiveDialogDescription
|
|
143
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-G6SRSWXB.js";
|
|
5
|
+
|
|
6
|
+
// src/primitives/image.tsx
|
|
7
|
+
import { forwardRef, useEffect, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var fitStyles = { cover: "object-cover", contain: "object-contain" };
|
|
10
|
+
var radiusStyles = { none: "", sm: "rounded-sm", md: "rounded-md", xl: "rounded-xl", full: "rounded-full" };
|
|
11
|
+
var Image = forwardRef(function Image2({ fit = "cover", frameHeight, radius = "none", width = "auto", align = "start", border = false, shadow = "none", emphasis = "full", loadingIndicator = "none", className, onLoad, onError, src, ...props }, ref) {
|
|
12
|
+
const [loaded, setLoaded] = useState(loadingIndicator === "none" || !src);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setLoaded(loadingIndicator === "none" || !src);
|
|
15
|
+
}, [loadingIndicator, src]);
|
|
16
|
+
const loading = loadingIndicator === "pulse" && !loaded;
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"img",
|
|
19
|
+
{
|
|
20
|
+
ref,
|
|
21
|
+
className: cn(
|
|
22
|
+
fitStyles[fit],
|
|
23
|
+
radiusStyles[radius],
|
|
24
|
+
frameHeight === "sm" && "h-16",
|
|
25
|
+
frameHeight === "md" && "h-28",
|
|
26
|
+
width === "full" && "w-full",
|
|
27
|
+
width === "preview" && "w-full max-w-[380px]",
|
|
28
|
+
width === "preview-lg" && "w-full max-w-[440px]",
|
|
29
|
+
align === "center" && "mx-auto",
|
|
30
|
+
border && "border",
|
|
31
|
+
shadow === "subtle" && "shadow-xs",
|
|
32
|
+
loading && "animate-pulse bg-muted",
|
|
33
|
+
emphasis === "soft-until-parent-hover" && "transition-opacity duration-200 md:opacity-70 md:group-hover:opacity-100",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
src,
|
|
37
|
+
...props,
|
|
38
|
+
"aria-busy": loading || void 0,
|
|
39
|
+
onLoad: (event) => {
|
|
40
|
+
setLoaded(true);
|
|
41
|
+
onLoad?.(event);
|
|
42
|
+
},
|
|
43
|
+
onError: (event) => {
|
|
44
|
+
setLoaded(true);
|
|
45
|
+
onError?.(event);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
Image
|
|
53
|
+
};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Separator
|
|
4
|
+
} from "./chunk-HYTILYE5.js";
|
|
5
|
+
import {
|
|
6
|
+
Label
|
|
7
|
+
} from "./chunk-E2TQMDO7.js";
|
|
8
|
+
import {
|
|
9
|
+
cn
|
|
10
|
+
} from "./chunk-G6SRSWXB.js";
|
|
11
|
+
|
|
12
|
+
// src/primitives/field.tsx
|
|
13
|
+
import { useMemo } from "react";
|
|
14
|
+
import { cva } from "class-variance-authority";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
function FieldSet({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"fieldset",
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "field-set",
|
|
21
|
+
className: cn(
|
|
22
|
+
"flex flex-col gap-6",
|
|
23
|
+
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function FieldLegend({
|
|
31
|
+
className,
|
|
32
|
+
variant = "legend",
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"legend",
|
|
37
|
+
{
|
|
38
|
+
"data-slot": "field-legend",
|
|
39
|
+
"data-variant": variant,
|
|
40
|
+
className: cn(
|
|
41
|
+
"mb-3 font-medium",
|
|
42
|
+
"data-[variant=legend]:text-base",
|
|
43
|
+
"data-[variant=label]:text-sm",
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
...props
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function FieldGroup({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "field-group",
|
|
55
|
+
className: cn(
|
|
56
|
+
"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",
|
|
57
|
+
className
|
|
58
|
+
),
|
|
59
|
+
...props
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
var fieldVariants = cva(
|
|
64
|
+
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
65
|
+
{
|
|
66
|
+
variants: {
|
|
67
|
+
orientation: {
|
|
68
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
69
|
+
horizontal: [
|
|
70
|
+
"flex-row items-center",
|
|
71
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
72
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
73
|
+
],
|
|
74
|
+
responsive: [
|
|
75
|
+
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
76
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
77
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
defaultVariants: { orientation: "vertical" }
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
function Field({
|
|
85
|
+
className,
|
|
86
|
+
orientation = "vertical",
|
|
87
|
+
...props
|
|
88
|
+
}) {
|
|
89
|
+
return /* @__PURE__ */ jsx(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
role: "group",
|
|
93
|
+
"data-slot": "field",
|
|
94
|
+
"data-orientation": orientation,
|
|
95
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function FieldContent({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "field-content",
|
|
105
|
+
className: cn(
|
|
106
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
107
|
+
className
|
|
108
|
+
),
|
|
109
|
+
...props
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
function FieldLabel({ className, ...props }) {
|
|
114
|
+
return /* @__PURE__ */ jsx(
|
|
115
|
+
Label,
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "field-label",
|
|
118
|
+
className: cn(
|
|
119
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
120
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
|
|
121
|
+
"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",
|
|
122
|
+
className
|
|
123
|
+
),
|
|
124
|
+
...props
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function FieldTitle({ className, ...props }) {
|
|
129
|
+
return /* @__PURE__ */ jsx(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
"data-slot": "field-label",
|
|
133
|
+
className: cn(
|
|
134
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
135
|
+
className
|
|
136
|
+
),
|
|
137
|
+
...props
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function FieldDescription({ className, ...props }) {
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
"p",
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "field-description",
|
|
146
|
+
className: cn(
|
|
147
|
+
"text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
148
|
+
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
149
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
150
|
+
className
|
|
151
|
+
),
|
|
152
|
+
...props
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function FieldSeparator({
|
|
157
|
+
children,
|
|
158
|
+
className,
|
|
159
|
+
...props
|
|
160
|
+
}) {
|
|
161
|
+
return /* @__PURE__ */ jsxs(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
"data-slot": "field-separator",
|
|
165
|
+
"data-content": !!children,
|
|
166
|
+
className: cn(
|
|
167
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
168
|
+
className
|
|
169
|
+
),
|
|
170
|
+
...props,
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
173
|
+
children && /* @__PURE__ */ jsx(
|
|
174
|
+
"span",
|
|
175
|
+
{
|
|
176
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
177
|
+
"data-slot": "field-separator-content",
|
|
178
|
+
children
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function FieldError({
|
|
186
|
+
className,
|
|
187
|
+
children,
|
|
188
|
+
errors,
|
|
189
|
+
...props
|
|
190
|
+
}) {
|
|
191
|
+
const content = useMemo(() => {
|
|
192
|
+
if (children) return children;
|
|
193
|
+
if (!errors?.length) return null;
|
|
194
|
+
const uniqueErrors = [
|
|
195
|
+
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
196
|
+
];
|
|
197
|
+
if (uniqueErrors.length === 1) return uniqueErrors[0]?.message;
|
|
198
|
+
return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
199
|
+
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
200
|
+
) });
|
|
201
|
+
}, [children, errors]);
|
|
202
|
+
if (!content) return null;
|
|
203
|
+
return /* @__PURE__ */ jsx(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
role: "alert",
|
|
207
|
+
"data-slot": "field-error",
|
|
208
|
+
className: cn("text-sm font-normal text-destructive", className),
|
|
209
|
+
...props,
|
|
210
|
+
children: content
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function FormField({
|
|
215
|
+
label,
|
|
216
|
+
htmlFor,
|
|
217
|
+
actions,
|
|
218
|
+
description,
|
|
219
|
+
children,
|
|
220
|
+
className,
|
|
221
|
+
...props
|
|
222
|
+
}) {
|
|
223
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1.5", className), ...props, children: [
|
|
224
|
+
(label || actions) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
225
|
+
typeof label === "string" ? /* @__PURE__ */ jsx(Label, { htmlFor, children: label }) : label,
|
|
226
|
+
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: actions })
|
|
227
|
+
] }),
|
|
228
|
+
children,
|
|
229
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-sm leading-relaxed text-muted-foreground", children: description })
|
|
230
|
+
] });
|
|
231
|
+
}
|
|
232
|
+
var columnStyles = {
|
|
233
|
+
1: "grid-cols-1",
|
|
234
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
235
|
+
3: "grid-cols-1 sm:grid-cols-3"
|
|
236
|
+
};
|
|
237
|
+
function FieldGrid({ columns = 2, gap = "default", className, ...props }) {
|
|
238
|
+
return /* @__PURE__ */ jsx(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
className: cn("grid", gap === "default" ? "gap-4" : "gap-8", columnStyles[columns], className),
|
|
242
|
+
...props
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export {
|
|
248
|
+
FieldSet,
|
|
249
|
+
FieldLegend,
|
|
250
|
+
FieldGroup,
|
|
251
|
+
Field,
|
|
252
|
+
FieldContent,
|
|
253
|
+
FieldLabel,
|
|
254
|
+
FieldTitle,
|
|
255
|
+
FieldDescription,
|
|
256
|
+
FieldSeparator,
|
|
257
|
+
FieldError,
|
|
258
|
+
FormField,
|
|
259
|
+
FieldGrid
|
|
260
|
+
};
|