@epicbagel/saas-kit 1.0.0 → 1.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/README.md +72 -3
- package/THIRD_PARTY_NOTICES.md +230 -7
- package/dist/chunk-2AU7ZRGX.cjs +96 -0
- package/dist/chunk-2BTDBZYN.cjs +154 -0
- package/dist/chunk-2HV2KKOE.cjs +38 -0
- package/dist/chunk-2KFZQJH5.cjs +29 -0
- package/dist/chunk-32Q4XOTU.cjs +204 -0
- package/dist/chunk-42RTTHND.js +29 -0
- package/dist/chunk-6FC65AZQ.js +38 -0
- package/dist/chunk-B765DSRG.cjs +66 -0
- package/dist/chunk-ELPV44S6.cjs +44 -0
- package/dist/chunk-EOUO3ORO.cjs +244 -0
- package/dist/chunk-EZCKWTH7.js +204 -0
- package/dist/chunk-F366BHWH.js +116 -0
- package/dist/chunk-GFG2R5BZ.js +132 -0
- package/dist/chunk-HAC32ALJ.js +244 -0
- package/dist/chunk-INNGGLMZ.js +44 -0
- package/dist/chunk-IW4ZIXXG.js +66 -0
- package/dist/chunk-JZOBIPFC.js +96 -0
- package/dist/chunk-KADJ56AH.cjs +416 -0
- package/dist/chunk-KENBU3NV.cjs +27 -0
- package/dist/chunk-M7FYGAGO.js +416 -0
- package/dist/chunk-MHYAVXOE.js +159 -0
- package/dist/chunk-RIWLAMME.cjs +159 -0
- package/dist/chunk-SUB4BAYE.cjs +73 -0
- package/dist/chunk-THWIJG5C.js +73 -0
- package/dist/chunk-V4YWTRLD.cjs +116 -0
- package/dist/chunk-VY5U4VGV.js +27 -0
- package/dist/chunk-XABXUP6L.cjs +132 -0
- package/dist/chunk-Z45YKVAM.js +154 -0
- package/dist/primitives/action-dock.cjs +8 -0
- package/dist/primitives/action-dock.d.cts +10 -0
- package/dist/primitives/action-dock.d.ts +10 -0
- package/dist/primitives/action-dock.js +8 -0
- package/dist/primitives/attachment.cjs +25 -203
- package/dist/primitives/attachment.d.cts +1 -1
- package/dist/primitives/attachment.d.ts +1 -1
- package/dist/primitives/attachment.js +12 -190
- package/dist/primitives/badge.d.cts +1 -1
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/board-view.cjs +3 -3
- package/dist/primitives/board-view.js +2 -2
- package/dist/primitives/bubble.cjs +14 -0
- package/dist/primitives/bubble.d.cts +21 -0
- package/dist/primitives/bubble.d.ts +21 -0
- package/dist/primitives/bubble.js +14 -0
- package/dist/primitives/button.d.cts +3 -3
- package/dist/primitives/button.d.ts +3 -3
- package/dist/primitives/chat.cjs +881 -0
- package/dist/primitives/chat.d.cts +345 -0
- package/dist/primitives/chat.d.ts +345 -0
- package/dist/primitives/chat.js +881 -0
- package/dist/primitives/connection.cjs +6 -6
- package/dist/primitives/connection.js +7 -7
- package/dist/primitives/file-dropzone.cjs +7 -107
- package/dist/primitives/file-dropzone.d.cts +66 -3
- package/dist/primitives/file-dropzone.d.ts +66 -3
- package/dist/primitives/file-dropzone.js +13 -113
- package/dist/primitives/input-group.cjs +21 -0
- package/dist/primitives/input-group.d.cts +20 -0
- package/dist/primitives/input-group.d.ts +20 -0
- package/dist/primitives/input-group.js +21 -0
- package/dist/primitives/item.cjs +197 -0
- package/dist/primitives/item.d.cts +28 -0
- package/dist/primitives/item.d.ts +28 -0
- package/dist/primitives/item.js +197 -0
- package/dist/primitives/lazy-markdown.cjs +10 -0
- package/dist/primitives/lazy-markdown.d.cts +20 -0
- package/dist/primitives/lazy-markdown.d.ts +20 -0
- package/dist/primitives/lazy-markdown.js +10 -0
- package/dist/primitives/markdown.cjs +17 -0
- package/dist/primitives/markdown.d.cts +32 -0
- package/dist/primitives/markdown.d.ts +32 -0
- package/dist/primitives/markdown.js +17 -0
- package/dist/primitives/marker.cjs +14 -0
- package/dist/primitives/marker.d.cts +15 -0
- package/dist/primitives/marker.d.ts +15 -0
- package/dist/primitives/marker.js +14 -0
- package/dist/primitives/message-scroller.cjs +26 -0
- package/dist/primitives/message-scroller.d.cts +16 -0
- package/dist/primitives/message-scroller.d.ts +16 -0
- package/dist/primitives/message-scroller.js +26 -0
- package/dist/primitives/message.cjs +7 -84
- package/dist/primitives/message.js +8 -85
- package/dist/primitives/resource-list.cjs +3 -3
- package/dist/primitives/resource-list.js +2 -2
- package/dist/primitives/rich-text.cjs +3 -38
- package/dist/primitives/rich-text.js +3 -38
- package/dist/primitives/section-header.d.cts +1 -1
- package/dist/primitives/section-header.d.ts +1 -1
- package/dist/primitives/spinner.cjs +23 -0
- package/dist/primitives/spinner.d.cts +6 -0
- package/dist/primitives/spinner.d.ts +6 -0
- package/dist/primitives/spinner.js +23 -0
- package/dist/primitives/suggestion.cjs +11 -0
- package/dist/primitives/suggestion.d.cts +19 -0
- package/dist/primitives/suggestion.d.ts +19 -0
- package/dist/primitives/suggestion.js +11 -0
- package/dist/primitives/switch-field.cjs +2 -2
- package/dist/primitives/switch-field.js +3 -3
- package/dist/primitives/textarea.cjs +4 -33
- package/dist/primitives/textarea.js +3 -32
- package/dist/primitives/toggle-group.d.cts +2 -2
- package/dist/primitives/toggle-group.d.ts +2 -2
- package/dist/primitives/toggle.d.cts +2 -2
- package/dist/primitives/toggle.d.ts +2 -2
- package/dist/primitives/trace.cjs +23 -0
- package/dist/primitives/trace.d.cts +22 -0
- package/dist/primitives/trace.d.ts +22 -0
- package/dist/primitives/trace.js +23 -0
- package/dist/primitives/voice-dictation-button.cjs +5 -239
- package/dist/primitives/voice-dictation-button.js +4 -238
- package/package.json +125 -2
- package/src/styles/components/bubble.css +81 -0
- package/src/styles/components/marker.css +27 -0
- package/src/styles/components/message-scroller.css +11 -0
- package/src/styles/components.css +3 -0
- package/src/styles/utilities.css +3 -2
- package/dist/{chunk-UGF2K6NR.js → chunk-HRLP4BHJ.js} +6 -6
- package/dist/{chunk-RWWOFWLP.cjs → chunk-IH3COANJ.cjs} +3 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-G6SRSWXB.js";
|
|
5
|
+
|
|
6
|
+
// src/primitives/rich-text.tsx
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function RichText({ size = "sm", tone = "default", className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "rich-text",
|
|
13
|
+
className: cn(
|
|
14
|
+
size === "sm" ? "text-sm" : "text-base",
|
|
15
|
+
tone === "soft" && "text-foreground/90",
|
|
16
|
+
tone === "muted" && "text-muted-foreground",
|
|
17
|
+
"leading-relaxed",
|
|
18
|
+
"[&_p]:mb-2 [&_p:last-child]:mb-0",
|
|
19
|
+
"[&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4",
|
|
20
|
+
"[&_strong]:font-semibold",
|
|
21
|
+
"[&_h1]:mb-3 [&_h1]:mt-6 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:tracking-tight [&_h1:first-child]:mt-0",
|
|
22
|
+
"[&_h2]:mb-2 [&_h2]:mt-5 [&_h2]:text-base [&_h2]:font-semibold [&_h2]:tracking-tight [&_h2:first-child]:mt-0",
|
|
23
|
+
"[&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:font-semibold [&_h3:first-child]:mt-0",
|
|
24
|
+
"[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5",
|
|
25
|
+
"[&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5",
|
|
26
|
+
"[&_li]:my-1 [&_li>p]:mb-0",
|
|
27
|
+
"[&_blockquote]:my-3 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground",
|
|
28
|
+
"[&_hr]:my-4 [&_hr]:border-border",
|
|
29
|
+
"[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.875em]",
|
|
30
|
+
"[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/40 [&_pre]:p-3",
|
|
31
|
+
"[&_pre_code]:bg-transparent [&_pre_code]:p-0",
|
|
32
|
+
"[&_table]:my-3 [&_table]:w-full [&_table]:border-collapse [&_table]:text-left",
|
|
33
|
+
"[&_th]:border-b [&_th]:border-border [&_th]:px-2 [&_th]:py-1.5 [&_th]:font-semibold",
|
|
34
|
+
"[&_td]:border-b [&_td]:border-border/70 [&_td]:px-2 [&_td]:py-1.5",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
RichText
|
|
44
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-G6SRSWXB.js";
|
|
5
|
+
|
|
6
|
+
// src/primitives/marker.tsx
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
import { Slot } from "radix-ui";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var markerVariants = cva(
|
|
11
|
+
"cn-marker group/marker relative flex w-full items-center",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default: "cn-marker-variant-default",
|
|
16
|
+
separator: "cn-marker-variant-separator",
|
|
17
|
+
border: "cn-marker-variant-border"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
function Marker({
|
|
23
|
+
className,
|
|
24
|
+
variant = "default",
|
|
25
|
+
asChild = false,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
const Comp = asChild ? Slot.Root : "div";
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
Comp,
|
|
31
|
+
{
|
|
32
|
+
"data-slot": "marker",
|
|
33
|
+
"data-variant": variant,
|
|
34
|
+
className: cn(markerVariants({ variant, className })),
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function MarkerIcon({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "marker-icon",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
className: cn("cn-marker-icon shrink-0", className),
|
|
46
|
+
...props
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function MarkerContent({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "marker-content",
|
|
55
|
+
className: cn("cn-marker-content min-w-0 wrap-break-word", className),
|
|
56
|
+
...props
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
markerVariants,
|
|
63
|
+
Marker,
|
|
64
|
+
MarkerIcon,
|
|
65
|
+
MarkerContent
|
|
66
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-G6SRSWXB.js";
|
|
5
|
+
|
|
6
|
+
// src/primitives/message.tsx
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function MessageGroup({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "message-group",
|
|
13
|
+
className: cn("cn-message-group flex min-w-0 flex-col", className),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function Message({
|
|
19
|
+
className,
|
|
20
|
+
align = "start",
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "message",
|
|
27
|
+
"data-align": align,
|
|
28
|
+
className: cn(
|
|
29
|
+
"cn-message group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function MessageAvatar({ className, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "message-avatar",
|
|
41
|
+
className: cn(
|
|
42
|
+
"cn-message-avatar flex w-fit shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted",
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function MessageContent({ className, ...props }) {
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
"data-slot": "message-content",
|
|
54
|
+
className: cn(
|
|
55
|
+
"cn-message-content flex w-full min-w-0 flex-col wrap-break-word",
|
|
56
|
+
className
|
|
57
|
+
),
|
|
58
|
+
...props
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
function MessageHeader({ className, ...props }) {
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "message-header",
|
|
67
|
+
className: cn(
|
|
68
|
+
"cn-message-header flex max-w-full min-w-0 items-center",
|
|
69
|
+
className
|
|
70
|
+
),
|
|
71
|
+
...props
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function MessageFooter({ className, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-slot": "message-footer",
|
|
80
|
+
className: cn(
|
|
81
|
+
"cn-message-footer flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end",
|
|
82
|
+
className
|
|
83
|
+
),
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
MessageGroup,
|
|
91
|
+
Message,
|
|
92
|
+
MessageAvatar,
|
|
93
|
+
MessageContent,
|
|
94
|
+
MessageHeader,
|
|
95
|
+
MessageFooter
|
|
96
|
+
};
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk373W6VADcjs = require('./chunk-373W6VAD.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkU2NES7VRcjs = require('./chunk-U2NES7VR.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkL4DH72UFcjs = require('./chunk-L4DH72UF.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
16
|
+
|
|
17
|
+
// src/primitives/file-dropzone.tsx
|
|
18
|
+
var _lucidereact = require('lucide-react');
|
|
19
|
+
var _reactdom = require('react-dom');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var _react = require('react');
|
|
27
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
28
|
+
function FileDropzone({
|
|
29
|
+
onFile,
|
|
30
|
+
onFiles,
|
|
31
|
+
multiple = false,
|
|
32
|
+
accept,
|
|
33
|
+
disabled = false,
|
|
34
|
+
busy: externalBusy = false,
|
|
35
|
+
label = "Drop a file, or choose one",
|
|
36
|
+
description,
|
|
37
|
+
busyLabel = "Reading file\u2026",
|
|
38
|
+
icon,
|
|
39
|
+
variant = "dropzone",
|
|
40
|
+
className
|
|
41
|
+
}) {
|
|
42
|
+
const inputRef = _react.useRef.call(void 0, null);
|
|
43
|
+
const [dragging, setDragging] = _react.useState.call(void 0, false);
|
|
44
|
+
const [internalBusy, setInternalBusy] = _react.useState.call(void 0, false);
|
|
45
|
+
const busy = externalBusy || internalBusy;
|
|
46
|
+
useFileDropGuard();
|
|
47
|
+
async function select(files) {
|
|
48
|
+
if (files.length === 0 || disabled || busy) return;
|
|
49
|
+
setInternalBusy(true);
|
|
50
|
+
try {
|
|
51
|
+
if (multiple) {
|
|
52
|
+
await _optionalChain([onFiles, 'optionalCall', _ => _(files)]);
|
|
53
|
+
} else {
|
|
54
|
+
const first = files[0];
|
|
55
|
+
if (first) await _optionalChain([onFile, 'optionalCall', _2 => _2(first)]);
|
|
56
|
+
}
|
|
57
|
+
} finally {
|
|
58
|
+
setInternalBusy(false);
|
|
59
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function onDrop(event) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
setDragging(false);
|
|
65
|
+
void select(Array.from(_nullishCoalesce(event.dataTransfer.files, () => ( []))));
|
|
66
|
+
}
|
|
67
|
+
const trigger = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
68
|
+
_chunkL4DH72UFcjs.Button,
|
|
69
|
+
{
|
|
70
|
+
type: "button",
|
|
71
|
+
"data-file-dropzone": "true",
|
|
72
|
+
variant: "outline",
|
|
73
|
+
size: variant === "icon" ? "icon" : "default",
|
|
74
|
+
"aria-label": variant === "icon" ? String(busy ? busyLabel : label) : void 0,
|
|
75
|
+
disabled: disabled || busy,
|
|
76
|
+
onClick: () => _optionalChain([inputRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.click, 'call', _5 => _5()]),
|
|
77
|
+
onDragEnter: (event) => {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
setDragging(true);
|
|
80
|
+
},
|
|
81
|
+
onDragOver: (event) => {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
setDragging(true);
|
|
84
|
+
},
|
|
85
|
+
onDragLeave: () => setDragging(false),
|
|
86
|
+
onDrop,
|
|
87
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
88
|
+
variant === "dropzone" ? "h-auto w-full flex-col whitespace-normal border-2 border-dashed px-6 py-8 text-center" : variant === "button" ? "w-fit" : "",
|
|
89
|
+
dragging && "border-primary bg-primary/5",
|
|
90
|
+
className
|
|
91
|
+
),
|
|
92
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
93
|
+
FileDropPrompt,
|
|
94
|
+
{
|
|
95
|
+
variant,
|
|
96
|
+
icon: busy ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-5 w-5 animate-spin" }) : _nullishCoalesce(icon, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FileUp, { className: "h-5 w-5" }))),
|
|
97
|
+
label: busy ? busyLabel : label,
|
|
98
|
+
description
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
104
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
105
|
+
"input",
|
|
106
|
+
{
|
|
107
|
+
ref: inputRef,
|
|
108
|
+
type: "file",
|
|
109
|
+
accept,
|
|
110
|
+
multiple,
|
|
111
|
+
disabled: disabled || busy,
|
|
112
|
+
onChange: (event) => void select(Array.from(_nullishCoalesce(event.target.files, () => ( [])))),
|
|
113
|
+
className: "sr-only",
|
|
114
|
+
tabIndex: -1,
|
|
115
|
+
"aria-hidden": "true"
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
variant === "icon" && description ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkU2NES7VRcjs.Tooltip, { children: [
|
|
119
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkU2NES7VRcjs.TooltipTrigger, { asChild: true, children: trigger }),
|
|
120
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkU2NES7VRcjs.TooltipContent, { children: description })
|
|
121
|
+
] }) : trigger
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
function carriesFiles(data) {
|
|
125
|
+
if (!data) return false;
|
|
126
|
+
return Array.from(_nullishCoalesce(data.types, () => ( []))).includes("Files") || (_nullishCoalesce(_optionalChain([data, 'access', _6 => _6.files, 'optionalAccess', _7 => _7.length]), () => ( 0))) > 0;
|
|
127
|
+
}
|
|
128
|
+
function isNativeFileInput(target) {
|
|
129
|
+
const element = target;
|
|
130
|
+
return _optionalChain([element, 'optionalAccess', _8 => _8.tagName]) === "INPUT" && element.type === "file";
|
|
131
|
+
}
|
|
132
|
+
var inPageDrag = false;
|
|
133
|
+
var inPageDragUsers = 0;
|
|
134
|
+
var markInPageDrag = () => {
|
|
135
|
+
inPageDrag = true;
|
|
136
|
+
};
|
|
137
|
+
var clearInPageDrag = () => {
|
|
138
|
+
inPageDrag = false;
|
|
139
|
+
};
|
|
140
|
+
var clearAfterDrop = () => {
|
|
141
|
+
window.setTimeout(clearInPageDrag, 0);
|
|
142
|
+
};
|
|
143
|
+
var clearOnMove = () => {
|
|
144
|
+
if (inPageDrag) inPageDrag = false;
|
|
145
|
+
};
|
|
146
|
+
function trackInPageDrags() {
|
|
147
|
+
if (inPageDragUsers++ === 0) {
|
|
148
|
+
window.addEventListener("dragstart", markInPageDrag, true);
|
|
149
|
+
window.addEventListener("dragend", clearInPageDrag, true);
|
|
150
|
+
window.addEventListener("drop", clearAfterDrop);
|
|
151
|
+
window.addEventListener("mousemove", clearOnMove, { passive: true });
|
|
152
|
+
}
|
|
153
|
+
return () => {
|
|
154
|
+
if (--inPageDragUsers > 0) return;
|
|
155
|
+
window.removeEventListener("dragstart", markInPageDrag, true);
|
|
156
|
+
window.removeEventListener("dragend", clearInPageDrag, true);
|
|
157
|
+
window.removeEventListener("drop", clearAfterDrop);
|
|
158
|
+
window.removeEventListener("mousemove", clearOnMove);
|
|
159
|
+
inPageDrag = false;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function isUnclaimedFileDrag(event) {
|
|
163
|
+
return !event.defaultPrevented && !inPageDrag && carriesFiles(event.dataTransfer) && !isNativeFileInput(event.target);
|
|
164
|
+
}
|
|
165
|
+
function installFileDropGuard() {
|
|
166
|
+
if (typeof window === "undefined") return () => void 0;
|
|
167
|
+
const release = trackInPageDrags();
|
|
168
|
+
const onDragOver = (event) => {
|
|
169
|
+
if (!isUnclaimedFileDrag(event)) return;
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "none";
|
|
172
|
+
};
|
|
173
|
+
const onDrop = (event) => {
|
|
174
|
+
if (isUnclaimedFileDrag(event)) event.preventDefault();
|
|
175
|
+
};
|
|
176
|
+
window.addEventListener("dragover", onDragOver);
|
|
177
|
+
window.addEventListener("drop", onDrop);
|
|
178
|
+
let installed = true;
|
|
179
|
+
return () => {
|
|
180
|
+
if (!installed) return;
|
|
181
|
+
installed = false;
|
|
182
|
+
window.removeEventListener("dragover", onDragOver);
|
|
183
|
+
window.removeEventListener("drop", onDrop);
|
|
184
|
+
release();
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function useFileDropGuard(enabled = true) {
|
|
188
|
+
_react.useEffect.call(void 0, () => enabled ? installFileDropGuard() : void 0, [enabled]);
|
|
189
|
+
}
|
|
190
|
+
function FileDropPrompt({
|
|
191
|
+
icon,
|
|
192
|
+
label,
|
|
193
|
+
description,
|
|
194
|
+
variant = "dropzone"
|
|
195
|
+
}) {
|
|
196
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
197
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
198
|
+
"flex items-center justify-center text-muted-foreground",
|
|
199
|
+
variant === "dropzone" && "mb-2 h-10 w-10 rounded-full bg-muted"
|
|
200
|
+
), children: icon }),
|
|
201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: variant === "icon" ? "sr-only" : "font-medium", children: label }),
|
|
202
|
+
description && variant === "dropzone" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { variant: "muted", className: "mt-1 max-w-md text-xs", children: description })
|
|
203
|
+
] });
|
|
204
|
+
}
|
|
205
|
+
var DRAG_HEARTBEAT_MS = 1e3;
|
|
206
|
+
function visibleBand(element) {
|
|
207
|
+
const rect = element.getBoundingClientRect();
|
|
208
|
+
const viewport = window.innerHeight;
|
|
209
|
+
if (rect.top >= 0 && rect.bottom <= viewport) return null;
|
|
210
|
+
const top = Math.max(rect.top, 0);
|
|
211
|
+
const bottom = Math.min(rect.bottom, viewport);
|
|
212
|
+
return bottom > top ? { top: top - rect.top, height: bottom - top } : null;
|
|
213
|
+
}
|
|
214
|
+
var FileDropArea = _react.forwardRef.call(void 0, function FileDropArea2({
|
|
215
|
+
onFiles,
|
|
216
|
+
disabled = false,
|
|
217
|
+
scope = "area",
|
|
218
|
+
label = "Drop to attach",
|
|
219
|
+
description,
|
|
220
|
+
icon,
|
|
221
|
+
className,
|
|
222
|
+
children,
|
|
223
|
+
onDragEnter,
|
|
224
|
+
onDragOver,
|
|
225
|
+
onDragLeave,
|
|
226
|
+
...props
|
|
227
|
+
}, ref) {
|
|
228
|
+
const active = Boolean(onFiles) && !disabled;
|
|
229
|
+
const [dragging, setDragging] = _react.useState.call(void 0, false);
|
|
230
|
+
const [band, setBand] = _react.useState.call(void 0, null);
|
|
231
|
+
const root = _react.useRef.call(void 0, null);
|
|
232
|
+
const entered = _react.useRef.call(void 0, []);
|
|
233
|
+
useFileDropGuard(Boolean(onFiles));
|
|
234
|
+
const setRoot = _react.useCallback.call(void 0,
|
|
235
|
+
(node) => {
|
|
236
|
+
root.current = node;
|
|
237
|
+
if (typeof ref === "function") ref(node);
|
|
238
|
+
else if (ref) ref.current = node;
|
|
239
|
+
},
|
|
240
|
+
[ref]
|
|
241
|
+
);
|
|
242
|
+
const reset = _react.useCallback.call(void 0, () => {
|
|
243
|
+
entered.current = [];
|
|
244
|
+
setDragging(false);
|
|
245
|
+
}, []);
|
|
246
|
+
const enter = _react.useCallback.call(void 0, (target) => {
|
|
247
|
+
if (target && !entered.current.includes(target)) entered.current.push(target);
|
|
248
|
+
setDragging(true);
|
|
249
|
+
}, []);
|
|
250
|
+
const leave = _react.useCallback.call(void 0, (target, container) => {
|
|
251
|
+
entered.current = entered.current.filter(
|
|
252
|
+
(node) => node !== target && node instanceof Node && node.isConnected && container.contains(node)
|
|
253
|
+
);
|
|
254
|
+
if (entered.current.length === 0) setDragging(false);
|
|
255
|
+
}, []);
|
|
256
|
+
const deliver = _react.useCallback.call(void 0,
|
|
257
|
+
(data) => {
|
|
258
|
+
const files = Array.from(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _9 => _9.files]), () => ( [])));
|
|
259
|
+
if (files.length > 0) void _optionalChain([onFiles, 'optionalCall', _10 => _10(files)]);
|
|
260
|
+
},
|
|
261
|
+
[onFiles]
|
|
262
|
+
);
|
|
263
|
+
_react.useEffect.call(void 0, () => {
|
|
264
|
+
if (scope !== "page" || !active) return;
|
|
265
|
+
const onEnter = (event) => {
|
|
266
|
+
if (!isUnclaimedFileDrag(event)) return;
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
enter(event.target);
|
|
269
|
+
};
|
|
270
|
+
const onOver = (event) => {
|
|
271
|
+
if (!isUnclaimedFileDrag(event)) return;
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = "copy";
|
|
274
|
+
if (entered.current.length === 0) enter(event.target);
|
|
275
|
+
};
|
|
276
|
+
const onLeave = (event) => leave(event.target, document);
|
|
277
|
+
const onDrop = (event) => {
|
|
278
|
+
reset();
|
|
279
|
+
if (!isUnclaimedFileDrag(event)) return;
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
deliver(event.dataTransfer);
|
|
282
|
+
};
|
|
283
|
+
document.addEventListener("dragenter", onEnter);
|
|
284
|
+
document.addEventListener("dragover", onOver);
|
|
285
|
+
document.addEventListener("dragleave", onLeave);
|
|
286
|
+
document.addEventListener("drop", onDrop);
|
|
287
|
+
return () => {
|
|
288
|
+
document.removeEventListener("dragenter", onEnter);
|
|
289
|
+
document.removeEventListener("dragover", onOver);
|
|
290
|
+
document.removeEventListener("dragleave", onLeave);
|
|
291
|
+
document.removeEventListener("drop", onDrop);
|
|
292
|
+
};
|
|
293
|
+
}, [active, deliver, enter, leave, reset, scope]);
|
|
294
|
+
_react.useEffect.call(void 0, () => {
|
|
295
|
+
if (!dragging) return;
|
|
296
|
+
let heartbeat = window.setTimeout(reset, DRAG_HEARTBEAT_MS);
|
|
297
|
+
const onDragOverAnywhere = () => {
|
|
298
|
+
window.clearTimeout(heartbeat);
|
|
299
|
+
heartbeat = window.setTimeout(reset, DRAG_HEARTBEAT_MS);
|
|
300
|
+
};
|
|
301
|
+
const onLeaveWindow = (event) => {
|
|
302
|
+
if (event.relatedTarget) return;
|
|
303
|
+
const { clientX: x, clientY: y } = event;
|
|
304
|
+
if (x <= 0 || y <= 0 || x >= window.innerWidth || y >= window.innerHeight) reset();
|
|
305
|
+
};
|
|
306
|
+
window.addEventListener("dragover", onDragOverAnywhere, true);
|
|
307
|
+
window.addEventListener("drop", reset);
|
|
308
|
+
window.addEventListener("dragend", reset);
|
|
309
|
+
window.addEventListener("dragleave", onLeaveWindow);
|
|
310
|
+
window.addEventListener("mousemove", reset, { passive: true });
|
|
311
|
+
return () => {
|
|
312
|
+
window.clearTimeout(heartbeat);
|
|
313
|
+
window.removeEventListener("dragover", onDragOverAnywhere, true);
|
|
314
|
+
window.removeEventListener("drop", reset);
|
|
315
|
+
window.removeEventListener("dragend", reset);
|
|
316
|
+
window.removeEventListener("dragleave", onLeaveWindow);
|
|
317
|
+
window.removeEventListener("mousemove", reset);
|
|
318
|
+
};
|
|
319
|
+
}, [dragging, reset]);
|
|
320
|
+
const showOverlay = dragging && active;
|
|
321
|
+
_react.useEffect.call(void 0, () => {
|
|
322
|
+
if (!showOverlay || scope !== "area") return;
|
|
323
|
+
const measure = () => {
|
|
324
|
+
if (root.current) setBand(visibleBand(root.current));
|
|
325
|
+
};
|
|
326
|
+
measure();
|
|
327
|
+
window.addEventListener("scroll", measure, { capture: true, passive: true });
|
|
328
|
+
window.addEventListener("resize", measure);
|
|
329
|
+
return () => {
|
|
330
|
+
window.removeEventListener("scroll", measure, { capture: true });
|
|
331
|
+
window.removeEventListener("resize", measure);
|
|
332
|
+
setBand(null);
|
|
333
|
+
};
|
|
334
|
+
}, [scope, showOverlay]);
|
|
335
|
+
const handlesHere = active && scope === "area";
|
|
336
|
+
const prompt = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FileDropPrompt, { icon: _nullishCoalesce(icon, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FileUp, { className: "h-5 w-5" }))), label, description });
|
|
337
|
+
let overlay = null;
|
|
338
|
+
if (showOverlay && scope === "page" && typeof document !== "undefined") {
|
|
339
|
+
overlay = _reactdom.createPortal.call(void 0,
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
"data-slot": "file-drop-overlay",
|
|
344
|
+
"data-scope": "page",
|
|
345
|
+
"aria-hidden": "true",
|
|
346
|
+
className: "pointer-events-none fixed inset-0 z-50 bg-background/80 p-3 supports-backdrop-filter:backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in-0",
|
|
347
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full flex-col items-center justify-center rounded-xl border-2 border-dashed border-primary p-6 text-center text-sm", children: prompt })
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
document.body
|
|
351
|
+
);
|
|
352
|
+
} else if (showOverlay && scope === "area") {
|
|
353
|
+
overlay = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
"data-slot": "file-drop-overlay",
|
|
357
|
+
"data-scope": "area",
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
className: "absolute inset-0 z-30 rounded-[inherit] border-2 border-dashed border-primary bg-background/90 text-sm supports-backdrop-filter:backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in-0 [&_*]:pointer-events-none",
|
|
360
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
361
|
+
"div",
|
|
362
|
+
{
|
|
363
|
+
"data-slot": "file-drop-prompt",
|
|
364
|
+
className: "absolute inset-x-0 flex flex-col items-center justify-center p-6 text-center",
|
|
365
|
+
style: _nullishCoalesce(band, () => ( { top: 0, height: "100%" })),
|
|
366
|
+
children: prompt
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
ref: setRoot,
|
|
376
|
+
"data-file-drop": showOverlay ? "active" : void 0,
|
|
377
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0, "relative", className),
|
|
378
|
+
...props,
|
|
379
|
+
onDragEnter: (event) => {
|
|
380
|
+
_optionalChain([onDragEnter, 'optionalCall', _11 => _11(event)]);
|
|
381
|
+
if (!handlesHere || !isUnclaimedFileDrag(event.nativeEvent)) return;
|
|
382
|
+
event.preventDefault();
|
|
383
|
+
enter(event.target);
|
|
384
|
+
},
|
|
385
|
+
onDragOver: (event) => {
|
|
386
|
+
_optionalChain([onDragOver, 'optionalCall', _12 => _12(event)]);
|
|
387
|
+
if (!handlesHere || !isUnclaimedFileDrag(event.nativeEvent)) return;
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
event.dataTransfer.dropEffect = "copy";
|
|
390
|
+
if (entered.current.length === 0) enter(event.target);
|
|
391
|
+
},
|
|
392
|
+
onDragLeave: (event) => {
|
|
393
|
+
_optionalChain([onDragLeave, 'optionalCall', _13 => _13(event)]);
|
|
394
|
+
if (scope === "area") leave(event.target, event.currentTarget);
|
|
395
|
+
},
|
|
396
|
+
onDrop: (event) => {
|
|
397
|
+
if (scope !== "area") return;
|
|
398
|
+
reset();
|
|
399
|
+
if (!onFiles || !isUnclaimedFileDrag(event.nativeEvent)) return;
|
|
400
|
+
event.preventDefault();
|
|
401
|
+
if (!disabled) deliver(event.dataTransfer);
|
|
402
|
+
},
|
|
403
|
+
children: [
|
|
404
|
+
children,
|
|
405
|
+
overlay
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
exports.FileDropzone = FileDropzone; exports.installFileDropGuard = installFileDropGuard; exports.useFileDropGuard = useFileDropGuard; exports.FileDropArea = FileDropArea;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkELPV44S6cjs = require('./chunk-ELPV44S6.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
8
|
+
|
|
9
|
+
// src/primitives/lazy-markdown.tsx
|
|
10
|
+
var _react = require('react');
|
|
11
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
12
|
+
var Markdown = _react.lazy.call(void 0,
|
|
13
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./primitives/markdown.cjs"))).then((module) => ({ default: module.Markdown }))
|
|
14
|
+
);
|
|
15
|
+
function LazyMarkdown({ children, components, className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
17
|
+
_react.Suspense,
|
|
18
|
+
{
|
|
19
|
+
fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkELPV44S6cjs.RichText, { ...props, className: _chunkKWLSBTB2cjs.cn.call(void 0, "whitespace-pre-wrap", className), children }),
|
|
20
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Markdown, { ...props, className, components, children })
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
exports.LazyMarkdown = LazyMarkdown;
|