@epicbagel/saas-kit 1.3.0 → 1.5.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 +91 -0
- package/dist/chunk-D5EHW3O2.cjs +52 -0
- package/dist/chunk-F3DAFAMD.js +271 -0
- package/dist/{chunk-JZOBIPFC.js → chunk-FGISSYXG.js} +61 -2
- package/dist/chunk-HAP6USTP.cjs +46 -0
- package/dist/chunk-HAQOT2CD.js +46 -0
- package/dist/{chunk-2AU7ZRGX.cjs → chunk-LAN3K2JI.cjs} +61 -2
- package/dist/chunk-TWCJMFST.js +260 -0
- package/dist/chunk-U3YFP6ZV.cjs +273 -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/chat.cjs +65 -12
- package/dist/primitives/chat.d.cts +46 -2
- package/dist/primitives/chat.d.ts +46 -2
- package/dist/primitives/chat.js +55 -2
- package/dist/primitives/field.cjs +12 -239
- package/dist/primitives/field.js +16 -243
- package/dist/primitives/message.cjs +8 -2
- package/dist/primitives/message.d.cts +35 -1
- package/dist/primitives/message.d.ts +35 -1
- package/dist/primitives/message.js +7 -1
- package/dist/primitives/radio-group.cjs +4 -39
- package/dist/primitives/radio-group.js +4 -39
- 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 +11 -1
package/dist/primitives/chat.js
CHANGED
|
@@ -22,8 +22,10 @@ import {
|
|
|
22
22
|
} from "../chunk-GFG2R5BZ.js";
|
|
23
23
|
import {
|
|
24
24
|
Message,
|
|
25
|
+
MessageAction,
|
|
26
|
+
MessageActions,
|
|
25
27
|
MessageContent
|
|
26
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-FGISSYXG.js";
|
|
27
29
|
import {
|
|
28
30
|
Marker,
|
|
29
31
|
MarkerContent
|
|
@@ -73,6 +75,9 @@ import "../chunk-QMA3WVB7.js";
|
|
|
73
75
|
import {
|
|
74
76
|
Button
|
|
75
77
|
} from "../chunk-HQRWRRZJ.js";
|
|
78
|
+
import {
|
|
79
|
+
useCopyToClipboard
|
|
80
|
+
} from "../chunk-ZWZAAGQF.js";
|
|
76
81
|
import {
|
|
77
82
|
useIsMobile
|
|
78
83
|
} from "../chunk-PIU5SSUV.js";
|
|
@@ -98,6 +103,8 @@ import {
|
|
|
98
103
|
ArrowRight,
|
|
99
104
|
ArrowUp,
|
|
100
105
|
ArrowUpRight,
|
|
106
|
+
Check,
|
|
107
|
+
Copy,
|
|
101
108
|
Download,
|
|
102
109
|
FileText,
|
|
103
110
|
LockKeyhole,
|
|
@@ -106,6 +113,10 @@ import {
|
|
|
106
113
|
X
|
|
107
114
|
} from "lucide-react";
|
|
108
115
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
116
|
+
function offersActions(message) {
|
|
117
|
+
if (message.status) return false;
|
|
118
|
+
return message.actions ?? message.role === "assistant";
|
|
119
|
+
}
|
|
109
120
|
function useArrivingUserTurnId(messages) {
|
|
110
121
|
const seen = useRef(null);
|
|
111
122
|
seen.current ??= new Set(messages.map((m) => m.id));
|
|
@@ -153,6 +164,7 @@ var ChatThread = forwardRef(
|
|
|
153
164
|
markdownComponents,
|
|
154
165
|
onOpenAttachment,
|
|
155
166
|
attachmentAction = "open",
|
|
167
|
+
messageActions,
|
|
156
168
|
className
|
|
157
169
|
}, ref) {
|
|
158
170
|
const markers = timelineMarkers(messages, /* @__PURE__ */ new Date());
|
|
@@ -186,6 +198,7 @@ var ChatThread = forwardRef(
|
|
|
186
198
|
}
|
|
187
199
|
const isFullWidth = m.width === "full";
|
|
188
200
|
const marker = markers[index];
|
|
201
|
+
const actions = messageActions && offersActions(m) ? messageActions(m) : null;
|
|
189
202
|
return /* @__PURE__ */ jsxs(
|
|
190
203
|
MessageScrollerItem,
|
|
191
204
|
{
|
|
@@ -222,7 +235,21 @@ var ChatThread = forwardRef(
|
|
|
222
235
|
uploadingLabel,
|
|
223
236
|
className: "px-0 pt-0"
|
|
224
237
|
}
|
|
225
|
-
)
|
|
238
|
+
),
|
|
239
|
+
actions != null && actions !== false ? (
|
|
240
|
+
// Unboxed workspace turns pull the row out by the
|
|
241
|
+
// button's inset, so the first icon lines up with
|
|
242
|
+
// the text above it.
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
MessageActions,
|
|
245
|
+
{
|
|
246
|
+
className: cn(
|
|
247
|
+
workspace && (isUser ? "-me-2 pointer-coarse:-me-3.5" : "-ms-2 pointer-coarse:-ms-3.5")
|
|
248
|
+
),
|
|
249
|
+
children: actions
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
) : null
|
|
226
253
|
] }) })
|
|
227
254
|
]
|
|
228
255
|
},
|
|
@@ -246,6 +273,29 @@ var ChatThread = forwardRef(
|
|
|
246
273
|
) });
|
|
247
274
|
}
|
|
248
275
|
);
|
|
276
|
+
function ChatCopyAction({
|
|
277
|
+
message,
|
|
278
|
+
label = "Copy",
|
|
279
|
+
copiedLabel = "Copied",
|
|
280
|
+
onCopy,
|
|
281
|
+
resetAfter = 2e3
|
|
282
|
+
}) {
|
|
283
|
+
const { copied, copy } = useCopyToClipboard({ resetAfter });
|
|
284
|
+
const text = message.text;
|
|
285
|
+
if (!text) return null;
|
|
286
|
+
return /* @__PURE__ */ jsx(
|
|
287
|
+
MessageAction,
|
|
288
|
+
{
|
|
289
|
+
tooltip: copied ? copiedLabel : label,
|
|
290
|
+
"data-copied": copied || void 0,
|
|
291
|
+
onClick: async () => {
|
|
292
|
+
const ok = await copy(text);
|
|
293
|
+
onCopy?.(ok);
|
|
294
|
+
},
|
|
295
|
+
children: copied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {})
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}
|
|
249
299
|
function formatFileSize(size) {
|
|
250
300
|
if (size === void 0) return "File";
|
|
251
301
|
if (size < 1024) return `${size} B`;
|
|
@@ -655,6 +705,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
655
705
|
markdownComponents,
|
|
656
706
|
onOpenAttachment,
|
|
657
707
|
attachmentAction,
|
|
708
|
+
messageActions,
|
|
658
709
|
className
|
|
659
710
|
}, ref) {
|
|
660
711
|
const isMobile = useIsMobile();
|
|
@@ -851,6 +902,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
851
902
|
markdownComponents,
|
|
852
903
|
onOpenAttachment,
|
|
853
904
|
attachmentAction,
|
|
905
|
+
messageActions,
|
|
854
906
|
className: cn(
|
|
855
907
|
"mb-3",
|
|
856
908
|
application && "min-h-0 flex-1 px-4 py-4 md:px-0 md:py-0",
|
|
@@ -903,6 +955,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
903
955
|
});
|
|
904
956
|
export {
|
|
905
957
|
Chat,
|
|
958
|
+
ChatCopyAction,
|
|
906
959
|
ChatInput,
|
|
907
960
|
ChatThread
|
|
908
961
|
};
|
|
@@ -1,255 +1,22 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var _chunkNQK5ZWC7cjs = require('../chunk-NQK5ZWC7.cjs');
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
var _chunkIQZLUT2Ycjs = require('../chunk-IQZLUT2Y.cjs');
|
|
9
7
|
|
|
10
8
|
|
|
11
|
-
var _chunkKWLSBTB2cjs = require('../chunk-KWLSBTB2.cjs');
|
|
12
9
|
|
|
13
|
-
// src/primitives/field.tsx
|
|
14
|
-
var _react = require('react');
|
|
15
|
-
var _classvarianceauthority = require('class-variance-authority');
|
|
16
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
17
|
-
function FieldSet({ className, ...props }) {
|
|
18
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
19
|
-
"fieldset",
|
|
20
|
-
{
|
|
21
|
-
"data-slot": "field-set",
|
|
22
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
23
|
-
"flex flex-col gap-6",
|
|
24
|
-
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
25
|
-
className
|
|
26
|
-
),
|
|
27
|
-
...props
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function FieldLegend({
|
|
32
|
-
className,
|
|
33
|
-
variant = "legend",
|
|
34
|
-
...props
|
|
35
|
-
}) {
|
|
36
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
37
|
-
"legend",
|
|
38
|
-
{
|
|
39
|
-
"data-slot": "field-legend",
|
|
40
|
-
"data-variant": variant,
|
|
41
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
42
|
-
"mb-3 font-medium",
|
|
43
|
-
"data-[variant=legend]:text-base",
|
|
44
|
-
"data-[variant=label]:text-sm",
|
|
45
|
-
className
|
|
46
|
-
),
|
|
47
|
-
...props
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
function FieldGroup({ className, ...props }) {
|
|
52
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
"data-slot": "field-group",
|
|
56
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
57
|
-
"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",
|
|
58
|
-
className
|
|
59
|
-
),
|
|
60
|
-
...props
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
var fieldVariants = _classvarianceauthority.cva.call(void 0,
|
|
65
|
-
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
66
|
-
{
|
|
67
|
-
variants: {
|
|
68
|
-
orientation: {
|
|
69
|
-
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
70
|
-
horizontal: [
|
|
71
|
-
"flex-row items-center",
|
|
72
|
-
"[&>[data-slot=field-label]]:flex-auto",
|
|
73
|
-
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
74
|
-
],
|
|
75
|
-
responsive: [
|
|
76
|
-
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
77
|
-
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
78
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
defaultVariants: { orientation: "vertical" }
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
function Field({
|
|
86
|
-
className,
|
|
87
|
-
orientation = "vertical",
|
|
88
|
-
...props
|
|
89
|
-
}) {
|
|
90
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
91
|
-
"div",
|
|
92
|
-
{
|
|
93
|
-
role: "group",
|
|
94
|
-
"data-slot": "field",
|
|
95
|
-
"data-orientation": orientation,
|
|
96
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0, fieldVariants({ orientation }), className),
|
|
97
|
-
...props
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
function FieldContent({ className, ...props }) {
|
|
102
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
"data-slot": "field-content",
|
|
106
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
107
|
-
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
108
|
-
className
|
|
109
|
-
),
|
|
110
|
-
...props
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
function FieldLabel({ className, ...props }) {
|
|
115
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
116
|
-
_chunkIQZLUT2Ycjs.Label,
|
|
117
|
-
{
|
|
118
|
-
"data-slot": "field-label",
|
|
119
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
120
|
-
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
121
|
-
"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",
|
|
122
|
-
"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",
|
|
123
|
-
className
|
|
124
|
-
),
|
|
125
|
-
...props
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function FieldTitle({ className, ...props }) {
|
|
130
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
"data-slot": "field-label",
|
|
134
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
135
|
-
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
136
|
-
className
|
|
137
|
-
),
|
|
138
|
-
...props
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
function FieldDescription({ className, ...props }) {
|
|
143
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
144
|
-
"p",
|
|
145
|
-
{
|
|
146
|
-
"data-slot": "field-description",
|
|
147
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
148
|
-
"text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
149
|
-
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
150
|
-
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
151
|
-
className
|
|
152
|
-
),
|
|
153
|
-
...props
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function FieldSeparator({
|
|
158
|
-
children,
|
|
159
|
-
className,
|
|
160
|
-
...props
|
|
161
|
-
}) {
|
|
162
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
"data-slot": "field-separator",
|
|
166
|
-
"data-content": !!children,
|
|
167
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
168
|
-
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
169
|
-
className
|
|
170
|
-
),
|
|
171
|
-
...props,
|
|
172
|
-
children: [
|
|
173
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNQK5ZWC7cjs.Separator, { className: "absolute inset-0 top-1/2" }),
|
|
174
|
-
children && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
175
|
-
"span",
|
|
176
|
-
{
|
|
177
|
-
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
178
|
-
"data-slot": "field-separator-content",
|
|
179
|
-
children
|
|
180
|
-
}
|
|
181
|
-
)
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
function FieldError({
|
|
187
|
-
className,
|
|
188
|
-
children,
|
|
189
|
-
errors,
|
|
190
|
-
...props
|
|
191
|
-
}) {
|
|
192
|
-
const content = _react.useMemo.call(void 0, () => {
|
|
193
|
-
if (children) return children;
|
|
194
|
-
if (!_optionalChain([errors, 'optionalAccess', _ => _.length])) return null;
|
|
195
|
-
const uniqueErrors = [
|
|
196
|
-
...new Map(errors.map((error) => [_optionalChain([error, 'optionalAccess', _2 => _2.message]), error])).values()
|
|
197
|
-
];
|
|
198
|
-
if (uniqueErrors.length === 1) return _optionalChain([uniqueErrors, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.message]);
|
|
199
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
200
|
-
(error, index) => _optionalChain([error, 'optionalAccess', _5 => _5.message]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: error.message }, index)
|
|
201
|
-
) });
|
|
202
|
-
}, [children, errors]);
|
|
203
|
-
if (!content) return null;
|
|
204
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
role: "alert",
|
|
208
|
-
"data-slot": "field-error",
|
|
209
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0, "text-sm font-normal text-destructive", className),
|
|
210
|
-
...props,
|
|
211
|
-
children: content
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
function FormField({
|
|
216
|
-
label,
|
|
217
|
-
htmlFor,
|
|
218
|
-
actions,
|
|
219
|
-
description,
|
|
220
|
-
children,
|
|
221
|
-
className,
|
|
222
|
-
...props
|
|
223
|
-
}) {
|
|
224
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkKWLSBTB2cjs.cn.call(void 0, "space-y-1.5", className), ...props, children: [
|
|
225
|
-
(label || actions) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between gap-2", children: [
|
|
226
|
-
typeof label === "string" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIQZLUT2Ycjs.Label, { htmlFor, children: label }) : label,
|
|
227
|
-
actions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-1", children: actions })
|
|
228
|
-
] }),
|
|
229
|
-
children,
|
|
230
|
-
description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm leading-relaxed text-muted-foreground", children: description })
|
|
231
|
-
] });
|
|
232
|
-
}
|
|
233
|
-
var columnStyles = {
|
|
234
|
-
1: "grid-cols-1",
|
|
235
|
-
2: "grid-cols-1 sm:grid-cols-2",
|
|
236
|
-
3: "grid-cols-1 sm:grid-cols-3"
|
|
237
|
-
};
|
|
238
|
-
function FieldGrid({ columns = 2, gap = "default", className, ...props }) {
|
|
239
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
240
|
-
"div",
|
|
241
|
-
{
|
|
242
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0, "grid", gap === "default" ? "gap-4" : "gap-8", columnStyles[columns], className),
|
|
243
|
-
...props
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
10
|
|
|
248
11
|
|
|
249
12
|
|
|
250
13
|
|
|
251
14
|
|
|
252
15
|
|
|
16
|
+
var _chunkZJFYOXSMcjs = require('../chunk-ZJFYOXSM.cjs');
|
|
17
|
+
require('../chunk-NQK5ZWC7.cjs');
|
|
18
|
+
require('../chunk-IQZLUT2Y.cjs');
|
|
19
|
+
require('../chunk-KWLSBTB2.cjs');
|
|
253
20
|
|
|
254
21
|
|
|
255
22
|
|
|
@@ -257,4 +24,10 @@ function FieldGrid({ columns = 2, gap = "default", className, ...props }) {
|
|
|
257
24
|
|
|
258
25
|
|
|
259
26
|
|
|
260
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
exports.Field = _chunkZJFYOXSMcjs.Field; exports.FieldContent = _chunkZJFYOXSMcjs.FieldContent; exports.FieldDescription = _chunkZJFYOXSMcjs.FieldDescription; exports.FieldError = _chunkZJFYOXSMcjs.FieldError; exports.FieldGrid = _chunkZJFYOXSMcjs.FieldGrid; exports.FieldGroup = _chunkZJFYOXSMcjs.FieldGroup; exports.FieldLabel = _chunkZJFYOXSMcjs.FieldLabel; exports.FieldLegend = _chunkZJFYOXSMcjs.FieldLegend; exports.FieldSeparator = _chunkZJFYOXSMcjs.FieldSeparator; exports.FieldSet = _chunkZJFYOXSMcjs.FieldSet; exports.FieldTitle = _chunkZJFYOXSMcjs.FieldTitle; exports.FormField = _chunkZJFYOXSMcjs.FormField;
|
package/dist/primitives/field.js
CHANGED
|
@@ -1,249 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
"data-slot": "field-set",
|
|
22
|
-
className: cn(
|
|
23
|
-
"flex flex-col gap-6",
|
|
24
|
-
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
25
|
-
className
|
|
26
|
-
),
|
|
27
|
-
...props
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function FieldLegend({
|
|
32
|
-
className,
|
|
33
|
-
variant = "legend",
|
|
34
|
-
...props
|
|
35
|
-
}) {
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
37
|
-
"legend",
|
|
38
|
-
{
|
|
39
|
-
"data-slot": "field-legend",
|
|
40
|
-
"data-variant": variant,
|
|
41
|
-
className: cn(
|
|
42
|
-
"mb-3 font-medium",
|
|
43
|
-
"data-[variant=legend]:text-base",
|
|
44
|
-
"data-[variant=label]:text-sm",
|
|
45
|
-
className
|
|
46
|
-
),
|
|
47
|
-
...props
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
function FieldGroup({ className, ...props }) {
|
|
52
|
-
return /* @__PURE__ */ jsx(
|
|
53
|
-
"div",
|
|
54
|
-
{
|
|
55
|
-
"data-slot": "field-group",
|
|
56
|
-
className: cn(
|
|
57
|
-
"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",
|
|
58
|
-
className
|
|
59
|
-
),
|
|
60
|
-
...props
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
var fieldVariants = cva(
|
|
65
|
-
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
66
|
-
{
|
|
67
|
-
variants: {
|
|
68
|
-
orientation: {
|
|
69
|
-
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
70
|
-
horizontal: [
|
|
71
|
-
"flex-row items-center",
|
|
72
|
-
"[&>[data-slot=field-label]]:flex-auto",
|
|
73
|
-
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
74
|
-
],
|
|
75
|
-
responsive: [
|
|
76
|
-
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
77
|
-
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
78
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
defaultVariants: { orientation: "vertical" }
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
function Field({
|
|
86
|
-
className,
|
|
87
|
-
orientation = "vertical",
|
|
88
|
-
...props
|
|
89
|
-
}) {
|
|
90
|
-
return /* @__PURE__ */ jsx(
|
|
91
|
-
"div",
|
|
92
|
-
{
|
|
93
|
-
role: "group",
|
|
94
|
-
"data-slot": "field",
|
|
95
|
-
"data-orientation": orientation,
|
|
96
|
-
className: cn(fieldVariants({ orientation }), className),
|
|
97
|
-
...props
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
function FieldContent({ className, ...props }) {
|
|
102
|
-
return /* @__PURE__ */ jsx(
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
"data-slot": "field-content",
|
|
106
|
-
className: cn(
|
|
107
|
-
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
108
|
-
className
|
|
109
|
-
),
|
|
110
|
-
...props
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
function FieldLabel({ className, ...props }) {
|
|
115
|
-
return /* @__PURE__ */ jsx(
|
|
116
|
-
Label,
|
|
117
|
-
{
|
|
118
|
-
"data-slot": "field-label",
|
|
119
|
-
className: cn(
|
|
120
|
-
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
121
|
-
"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",
|
|
122
|
-
"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10",
|
|
123
|
-
className
|
|
124
|
-
),
|
|
125
|
-
...props
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function FieldTitle({ className, ...props }) {
|
|
130
|
-
return /* @__PURE__ */ jsx(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
"data-slot": "field-label",
|
|
134
|
-
className: cn(
|
|
135
|
-
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
136
|
-
className
|
|
137
|
-
),
|
|
138
|
-
...props
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
function FieldDescription({ className, ...props }) {
|
|
143
|
-
return /* @__PURE__ */ jsx(
|
|
144
|
-
"p",
|
|
145
|
-
{
|
|
146
|
-
"data-slot": "field-description",
|
|
147
|
-
className: cn(
|
|
148
|
-
"text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
149
|
-
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
150
|
-
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
151
|
-
className
|
|
152
|
-
),
|
|
153
|
-
...props
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function FieldSeparator({
|
|
158
|
-
children,
|
|
159
|
-
className,
|
|
160
|
-
...props
|
|
161
|
-
}) {
|
|
162
|
-
return /* @__PURE__ */ jsxs(
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
"data-slot": "field-separator",
|
|
166
|
-
"data-content": !!children,
|
|
167
|
-
className: cn(
|
|
168
|
-
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
169
|
-
className
|
|
170
|
-
),
|
|
171
|
-
...props,
|
|
172
|
-
children: [
|
|
173
|
-
/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
174
|
-
children && /* @__PURE__ */ jsx(
|
|
175
|
-
"span",
|
|
176
|
-
{
|
|
177
|
-
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
178
|
-
"data-slot": "field-separator-content",
|
|
179
|
-
children
|
|
180
|
-
}
|
|
181
|
-
)
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
function FieldError({
|
|
187
|
-
className,
|
|
188
|
-
children,
|
|
189
|
-
errors,
|
|
190
|
-
...props
|
|
191
|
-
}) {
|
|
192
|
-
const content = useMemo(() => {
|
|
193
|
-
if (children) return children;
|
|
194
|
-
if (!errors?.length) return null;
|
|
195
|
-
const uniqueErrors = [
|
|
196
|
-
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
197
|
-
];
|
|
198
|
-
if (uniqueErrors.length === 1) return uniqueErrors[0]?.message;
|
|
199
|
-
return /* @__PURE__ */ jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
200
|
-
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
201
|
-
) });
|
|
202
|
-
}, [children, errors]);
|
|
203
|
-
if (!content) return null;
|
|
204
|
-
return /* @__PURE__ */ jsx(
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
role: "alert",
|
|
208
|
-
"data-slot": "field-error",
|
|
209
|
-
className: cn("text-sm font-normal text-destructive", className),
|
|
210
|
-
...props,
|
|
211
|
-
children: content
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
function FormField({
|
|
216
|
-
label,
|
|
217
|
-
htmlFor,
|
|
218
|
-
actions,
|
|
219
|
-
description,
|
|
220
|
-
children,
|
|
221
|
-
className,
|
|
222
|
-
...props
|
|
223
|
-
}) {
|
|
224
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1.5", className), ...props, children: [
|
|
225
|
-
(label || actions) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
226
|
-
typeof label === "string" ? /* @__PURE__ */ jsx(Label, { htmlFor, children: label }) : label,
|
|
227
|
-
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: actions })
|
|
228
|
-
] }),
|
|
229
|
-
children,
|
|
230
|
-
description && /* @__PURE__ */ jsx("p", { className: "text-sm leading-relaxed text-muted-foreground", children: description })
|
|
231
|
-
] });
|
|
232
|
-
}
|
|
233
|
-
var columnStyles = {
|
|
234
|
-
1: "grid-cols-1",
|
|
235
|
-
2: "grid-cols-1 sm:grid-cols-2",
|
|
236
|
-
3: "grid-cols-1 sm:grid-cols-3"
|
|
237
|
-
};
|
|
238
|
-
function FieldGrid({ columns = 2, gap = "default", className, ...props }) {
|
|
239
|
-
return /* @__PURE__ */ jsx(
|
|
240
|
-
"div",
|
|
241
|
-
{
|
|
242
|
-
className: cn("grid", gap === "default" ? "gap-4" : "gap-8", columnStyles[columns], className),
|
|
243
|
-
...props
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
}
|
|
4
|
+
Field,
|
|
5
|
+
FieldContent,
|
|
6
|
+
FieldDescription,
|
|
7
|
+
FieldError,
|
|
8
|
+
FieldGrid,
|
|
9
|
+
FieldGroup,
|
|
10
|
+
FieldLabel,
|
|
11
|
+
FieldLegend,
|
|
12
|
+
FieldSeparator,
|
|
13
|
+
FieldSet,
|
|
14
|
+
FieldTitle,
|
|
15
|
+
FormField
|
|
16
|
+
} from "../chunk-TWCJMFST.js";
|
|
17
|
+
import "../chunk-HYTILYE5.js";
|
|
18
|
+
import "../chunk-E2TQMDO7.js";
|
|
19
|
+
import "../chunk-G6SRSWXB.js";
|
|
247
20
|
export {
|
|
248
21
|
Field,
|
|
249
22
|
FieldContent,
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkLAN3K2JIcjs = require('../chunk-LAN3K2JI.cjs');
|
|
12
|
+
require('../chunk-U2NES7VR.cjs');
|
|
13
|
+
require('../chunk-L4DH72UF.cjs');
|
|
10
14
|
require('../chunk-KWLSBTB2.cjs');
|
|
11
15
|
|
|
12
16
|
|
|
@@ -15,4 +19,6 @@ require('../chunk-KWLSBTB2.cjs');
|
|
|
15
19
|
|
|
16
20
|
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
exports.Message = _chunkLAN3K2JIcjs.Message; exports.MessageAction = _chunkLAN3K2JIcjs.MessageAction; exports.MessageActions = _chunkLAN3K2JIcjs.MessageActions; exports.MessageAvatar = _chunkLAN3K2JIcjs.MessageAvatar; exports.MessageContent = _chunkLAN3K2JIcjs.MessageContent; exports.MessageFooter = _chunkLAN3K2JIcjs.MessageFooter; exports.MessageGroup = _chunkLAN3K2JIcjs.MessageGroup; exports.MessageHeader = _chunkLAN3K2JIcjs.MessageHeader;
|