@epicbagel/saas-kit 1.19.0 → 1.20.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 +13 -0
- package/dist/{chunk-TP74SBRH.cjs → chunk-E2UVQXBO.cjs} +6 -6
- package/dist/{chunk-C3VZMTVB.js → chunk-FPOJ2NGG.js} +1 -1
- package/dist/primitives/chat.cjs +159 -6
- package/dist/primitives/chat.d.cts +9 -1
- package/dist/primitives/chat.d.ts +9 -1
- package/dist/primitives/chat.js +156 -3
- package/dist/primitives/document-preview.cjs +5 -5
- package/dist/primitives/document-preview.js +3 -3
- package/dist/primitives/file-preview-internals.cjs +4 -4
- package/dist/primitives/file-preview-internals.js +3 -3
- package/dist/primitives/file-preview.cjs +12 -12
- package/dist/primitives/file-preview.js +3 -3
- package/dist/primitives/responsive-dialog.cjs +3 -3
- package/dist/primitives/responsive-dialog.js +2 -2
- package/package.json +1 -1
- package/dist/{chunk-BTHYGHOH.cjs → chunk-AO56ET4F.cjs} +2 -2
- package/dist/{chunk-JTI4244T.js → chunk-CRZ4INEJ.js} +10 -10
package/README.md
CHANGED
|
@@ -244,6 +244,19 @@ public in 1.1.0, and these were the decisions about its props then:
|
|
|
244
244
|
[])`: the draft and staged files stay, and a failure is reported without
|
|
245
245
|
touching them. Suggestions are disabled while `pending`; pass none once
|
|
246
246
|
they no longer apply.
|
|
247
|
+
- **Compact mobile suggestions (1.20.0).** Opt into `mobileCompactSuggestions`
|
|
248
|
+
to put the first reply in a shaded row inside the composer on phones
|
|
249
|
+
below 768px. Its button sends directly; the separate `+N more` button opens
|
|
250
|
+
a bottom sheet with every reply in full, wrapping onto as many lines as
|
|
251
|
+
needed. One reply needs no picker and no replies leave no row. Desktop
|
|
252
|
+
keeps the existing chips. The sheet uses `replySuggestionsLabel` as its
|
|
253
|
+
title; `replySuggestionsMoreLabel(count)` and `replySuggestionsCloseLabel`
|
|
254
|
+
replace the opener and close wording. These mobile picks preserve the
|
|
255
|
+
draft and files without focusing the textarea or opening the keyboard.
|
|
256
|
+
Pending sends, changed choices, a new latest message, or a move to desktop
|
|
257
|
+
dismiss the picker. Equivalent arrays from a refresh leave it open.
|
|
258
|
+
`ChatInput.header` provides the same inside-surface top slot for other
|
|
259
|
+
compositions; changing the header keeps its textarea mounted.
|
|
247
260
|
- **Failed sends.** When `onSend` rejects, Chat puts the text back in the
|
|
248
261
|
composer and calls `onSendError`; without one it reports the rejection
|
|
249
262
|
through `reportError`, so a failure is never silent.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkAO56ET4Fcjs = require('./chunk-AO56ET4F.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkT2ZFSPE4cjs = require('./chunk-T2ZFSPE4.cjs');
|
|
@@ -29,10 +29,10 @@ function PreviewDialog({
|
|
|
29
29
|
downloadLabel,
|
|
30
30
|
children
|
|
31
31
|
}) {
|
|
32
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
32
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAO56ET4Fcjs.ResponsiveDialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkAO56ET4Fcjs.ResponsiveDialogContent, { presentation: "preview", className: "h-[92dvh] outline-none", children: [
|
|
33
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkAO56ET4Fcjs.ResponsiveDialogHeader, { className: "shrink-0 border-b border-border", children: [
|
|
34
34
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
35
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAO56ET4Fcjs.ResponsiveDialogTitle, { className: "min-w-0 flex-1 truncate text-left", children: title }),
|
|
36
36
|
onDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
37
37
|
_chunkJDEXZGIYcjs.Button,
|
|
38
38
|
{
|
|
@@ -46,7 +46,7 @@ function PreviewDialog({
|
|
|
46
46
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2ZFSPE4cjs.Icon, { icon: downloading ? _lucidereact.Loader2 : _lucidereact.Download, size: "sm", spin: downloading })
|
|
47
47
|
}
|
|
48
48
|
),
|
|
49
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
49
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAO56ET4Fcjs.ResponsiveDialogClose, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
50
50
|
_chunkJDEXZGIYcjs.Button,
|
|
51
51
|
{
|
|
52
52
|
type: "button",
|
|
@@ -58,7 +58,7 @@ function PreviewDialog({
|
|
|
58
58
|
}
|
|
59
59
|
) })
|
|
60
60
|
] }),
|
|
61
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
61
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkAO56ET4Fcjs.ResponsiveDialogDescription, { className: "sr-only", children: [
|
|
62
62
|
"Preview of ",
|
|
63
63
|
title
|
|
64
64
|
] })
|
package/dist/primitives/chat.cjs
CHANGED
|
@@ -54,6 +54,14 @@ require('../chunk-ELPV44S6.cjs');
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
var _chunk2BHI5ZWJcjs = require('../chunk-2BHI5ZWJ.cjs');
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
57
65
|
var _chunkZAITUDYDcjs = require('../chunk-ZAITUDYD.cjs');
|
|
58
66
|
require('../chunk-U2NES7VR.cjs');
|
|
59
67
|
|
|
@@ -120,6 +128,7 @@ var _react = require('react');
|
|
|
120
128
|
|
|
121
129
|
|
|
122
130
|
|
|
131
|
+
|
|
123
132
|
var _lucidereact = require('lucide-react');
|
|
124
133
|
var _jsxruntime = require('react/jsx-runtime');
|
|
125
134
|
function offersActions(message) {
|
|
@@ -396,6 +405,7 @@ function ChatInput({
|
|
|
396
405
|
addFilesLabel = "Add files",
|
|
397
406
|
appearance = "default",
|
|
398
407
|
compactOnBlur = false,
|
|
408
|
+
header,
|
|
399
409
|
helperText,
|
|
400
410
|
privacyNote
|
|
401
411
|
}) {
|
|
@@ -469,6 +479,16 @@ function ChatInput({
|
|
|
469
479
|
className
|
|
470
480
|
),
|
|
471
481
|
children: [
|
|
482
|
+
header && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
483
|
+
_chunk7LDJAXRXcjs.InputGroupAddon,
|
|
484
|
+
{
|
|
485
|
+
align: "block-start",
|
|
486
|
+
className: "w-full cursor-default border-b border-border bg-muted/50 p-0 [.border-b]:pb-0",
|
|
487
|
+
onClick: () => {
|
|
488
|
+
},
|
|
489
|
+
children: header
|
|
490
|
+
}
|
|
491
|
+
),
|
|
472
492
|
liveVoiceActive && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7LDJAXRXcjs.InputGroupAddon, { align: "block-start", className: "w-full cursor-default border-b border-border p-0 [.border-b]:pb-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYMI3X2YLcjs.VoiceSessionControls, { ...voiceSession }) }),
|
|
473
493
|
attachments.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
474
494
|
ChatAttachmentList,
|
|
@@ -697,6 +717,123 @@ function ChatSuggestions({
|
|
|
697
717
|
)
|
|
698
718
|
] });
|
|
699
719
|
}
|
|
720
|
+
function MobileReplySuggestions({
|
|
721
|
+
items,
|
|
722
|
+
onSelect,
|
|
723
|
+
label,
|
|
724
|
+
moreLabel,
|
|
725
|
+
closeLabel,
|
|
726
|
+
disabled
|
|
727
|
+
}) {
|
|
728
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
729
|
+
const triggerRef = _react.useRef.call(void 0, null);
|
|
730
|
+
const closeRef = _react.useRef.call(void 0, null);
|
|
731
|
+
_react.useEffect.call(void 0, () => {
|
|
732
|
+
if (disabled) setOpen(false);
|
|
733
|
+
}, [disabled]);
|
|
734
|
+
const select = (item) => {
|
|
735
|
+
if (disabled) return;
|
|
736
|
+
setOpen(false);
|
|
737
|
+
onSelect(item);
|
|
738
|
+
};
|
|
739
|
+
const primary = items[0];
|
|
740
|
+
if (primary === void 0) return null;
|
|
741
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2BHI5ZWJcjs.Drawer, { open, onOpenChange: setOpen, shouldScaleBackground: false, repositionInputs: false, children: [
|
|
742
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
743
|
+
"div",
|
|
744
|
+
{
|
|
745
|
+
"data-slot": "chat-replies",
|
|
746
|
+
"data-variant": "compact",
|
|
747
|
+
role: "group",
|
|
748
|
+
"aria-label": label,
|
|
749
|
+
className: "flex w-full min-w-0 items-center text-foreground",
|
|
750
|
+
children: [
|
|
751
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
752
|
+
_chunkJDEXZGIYcjs.Button,
|
|
753
|
+
{
|
|
754
|
+
type: "button",
|
|
755
|
+
variant: "ghost",
|
|
756
|
+
size: "bare",
|
|
757
|
+
disabled,
|
|
758
|
+
className: "h-[44px] min-h-[44px] min-w-0 flex-1 justify-start gap-2 px-3 text-left focus-visible:-ring-offset-2",
|
|
759
|
+
onClick: () => select(primary),
|
|
760
|
+
children: [
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowUpRight, { "aria-hidden": "true" }),
|
|
762
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "min-w-0 truncate", children: primary })
|
|
763
|
+
]
|
|
764
|
+
}
|
|
765
|
+
),
|
|
766
|
+
items.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2BHI5ZWJcjs.DrawerTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
767
|
+
_chunkJDEXZGIYcjs.Button,
|
|
768
|
+
{
|
|
769
|
+
ref: triggerRef,
|
|
770
|
+
type: "button",
|
|
771
|
+
variant: "ghost",
|
|
772
|
+
size: "bare",
|
|
773
|
+
disabled,
|
|
774
|
+
className: "h-[44px] min-h-[44px] shrink-0 gap-1 px-3 text-muted-foreground focus-visible:-ring-offset-2",
|
|
775
|
+
children: [
|
|
776
|
+
moreLabel(items.length - 1),
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { "aria-hidden": "true" })
|
|
778
|
+
]
|
|
779
|
+
}
|
|
780
|
+
) })
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
785
|
+
_chunk2BHI5ZWJcjs.DrawerContent,
|
|
786
|
+
{
|
|
787
|
+
"aria-describedby": void 0,
|
|
788
|
+
className: "max-h-[min(85dvh,40rem)] overflow-hidden pb-[env(safe-area-inset-bottom)]",
|
|
789
|
+
onOpenAutoFocus: (event) => {
|
|
790
|
+
event.preventDefault();
|
|
791
|
+
_optionalChain([closeRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.focus, 'call', _11 => _11({ preventScroll: true })]);
|
|
792
|
+
},
|
|
793
|
+
onCloseAutoFocus: (event) => {
|
|
794
|
+
event.preventDefault();
|
|
795
|
+
if (_optionalChain([triggerRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.isConnected]) && !triggerRef.current.disabled) {
|
|
796
|
+
triggerRef.current.focus({ preventScroll: true });
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
children: [
|
|
800
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2BHI5ZWJcjs.DrawerHeader, { align: "start", className: "flex shrink-0 items-center justify-between gap-3 border-b px-4 py-2", children: [
|
|
801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2BHI5ZWJcjs.DrawerTitle, { className: "min-w-0 break-words leading-snug", children: label }),
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2BHI5ZWJcjs.DrawerClose, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
803
|
+
_chunkJDEXZGIYcjs.Button,
|
|
804
|
+
{
|
|
805
|
+
ref: closeRef,
|
|
806
|
+
type: "button",
|
|
807
|
+
variant: "ghost",
|
|
808
|
+
size: "icon",
|
|
809
|
+
"aria-label": closeLabel,
|
|
810
|
+
className: "h-[44px] w-[44px] shrink-0",
|
|
811
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { "aria-hidden": "true" })
|
|
812
|
+
}
|
|
813
|
+
) })
|
|
814
|
+
] }),
|
|
815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "min-h-0 overflow-y-auto overscroll-contain", role: "group", "aria-label": label, children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
816
|
+
_chunkJDEXZGIYcjs.Button,
|
|
817
|
+
{
|
|
818
|
+
type: "button",
|
|
819
|
+
variant: "ghost",
|
|
820
|
+
size: "bare",
|
|
821
|
+
disabled,
|
|
822
|
+
"data-slot": "chat-reply-option",
|
|
823
|
+
className: "min-h-[56px] w-full justify-between gap-4 rounded-none border-b px-4 py-4 text-left text-base font-normal whitespace-normal last:border-b-0 focus-visible:-ring-offset-2",
|
|
824
|
+
onClick: () => select(item),
|
|
825
|
+
children: [
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "min-w-0 break-words", children: item }),
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowUpRight, { "aria-hidden": "true" })
|
|
828
|
+
]
|
|
829
|
+
},
|
|
830
|
+
item
|
|
831
|
+
)) })
|
|
832
|
+
]
|
|
833
|
+
}
|
|
834
|
+
)
|
|
835
|
+
] });
|
|
836
|
+
}
|
|
700
837
|
function ExamplePromptsLoading({ label, className }) {
|
|
701
838
|
const list = Array.isArray(label) ? label : [label];
|
|
702
839
|
const [idx, setIdx] = _react.useState.call(void 0, 0);
|
|
@@ -740,6 +877,9 @@ var Chat = _react.forwardRef.call(void 0, function Chat2({
|
|
|
740
877
|
examplePromptsLoadingLabel = "Loading suggestions\u2026",
|
|
741
878
|
replySuggestions = [],
|
|
742
879
|
replySuggestionsLabel = "Suggested replies",
|
|
880
|
+
mobileCompactSuggestions = false,
|
|
881
|
+
replySuggestionsMoreLabel = (count) => `+${count} more`,
|
|
882
|
+
replySuggestionsCloseLabel = "Close suggested replies",
|
|
743
883
|
compactEmptyState = false,
|
|
744
884
|
defaultMode,
|
|
745
885
|
placeholder = "Type your message\u2026",
|
|
@@ -809,12 +949,12 @@ var Chat = _react.forwardRef.call(void 0, function Chat2({
|
|
|
809
949
|
}
|
|
810
950
|
reportSendError(cause);
|
|
811
951
|
}
|
|
812
|
-
window.setTimeout(() => _optionalChain([inputRef, 'access',
|
|
952
|
+
window.setTimeout(() => _optionalChain([inputRef, 'access', _14 => _14.current, 'optionalAccess', _15 => _15.focus, 'call', _16 => _16()]), 0);
|
|
813
953
|
},
|
|
814
954
|
[attachments, mode, onSend, pending, reportSendError]
|
|
815
955
|
);
|
|
816
956
|
const sendSuggestion = _react.useCallback.call(void 0,
|
|
817
|
-
async (text) => {
|
|
957
|
+
async (text, focusInput = true) => {
|
|
818
958
|
const trimmed = text.trim();
|
|
819
959
|
if (!trimmed || pending) return;
|
|
820
960
|
try {
|
|
@@ -822,14 +962,14 @@ var Chat = _react.forwardRef.call(void 0, function Chat2({
|
|
|
822
962
|
} catch (cause) {
|
|
823
963
|
reportSendError(cause);
|
|
824
964
|
}
|
|
825
|
-
window.setTimeout(() => _optionalChain([inputRef, 'access',
|
|
965
|
+
if (focusInput) window.setTimeout(() => _optionalChain([inputRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.focus, 'call', _19 => _19()]), 0);
|
|
826
966
|
},
|
|
827
967
|
[onSend, pending, reportSendError]
|
|
828
968
|
);
|
|
829
969
|
_react.useImperativeHandle.call(void 0,
|
|
830
970
|
ref,
|
|
831
971
|
() => ({
|
|
832
|
-
focusInput: () => _optionalChain([inputRef, 'access',
|
|
972
|
+
focusInput: () => _optionalChain([inputRef, 'access', _20 => _20.current, 'optionalAccess', _21 => _21.focus, 'call', _22 => _22()]),
|
|
833
973
|
clearInput: () => setInput("")
|
|
834
974
|
}),
|
|
835
975
|
[]
|
|
@@ -837,12 +977,13 @@ var Chat = _react.forwardRef.call(void 0, function Chat2({
|
|
|
837
977
|
const dropFiles = _react.useCallback.call(void 0,
|
|
838
978
|
(files) => {
|
|
839
979
|
if (!conversationStarted && mode === "voice") setUserMode("text");
|
|
840
|
-
return _optionalChain([onFilesSelected, 'optionalCall',
|
|
980
|
+
return _optionalChain([onFilesSelected, 'optionalCall', _23 => _23(files)]);
|
|
841
981
|
},
|
|
842
982
|
[conversationStarted, mode, onFilesSelected]
|
|
843
983
|
);
|
|
844
984
|
const application = layout === "application";
|
|
845
985
|
const workspace = layout === "workspace";
|
|
986
|
+
const compactSuggestions = mobileCompactSuggestions && isMobile;
|
|
846
987
|
const showEmptyFileDropzone = emptyFileDropzone && Boolean(onFilesSelected) && attachments.length === 0;
|
|
847
988
|
const liveVoiceActive = voiceSession && voiceSession.state !== "disconnected" && voiceSession.state !== "error";
|
|
848
989
|
const showEmptyPending = !conversationStarted && pending && Boolean(emptyPendingContent) && !liveVoiceActive;
|
|
@@ -1019,7 +1160,7 @@ var Chat = _react.forwardRef.call(void 0, function Chat2({
|
|
|
1019
1160
|
workspace && mobileCompactComposer && "max-md:pb-[max(0.75rem,env(safe-area-inset-bottom))] max-md:pt-3"
|
|
1020
1161
|
),
|
|
1021
1162
|
children: [
|
|
1022
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1163
|
+
!compactSuggestions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1023
1164
|
ChatSuggestions,
|
|
1024
1165
|
{
|
|
1025
1166
|
slot: "chat-replies",
|
|
@@ -1034,6 +1175,18 @@ var Chat = _react.forwardRef.call(void 0, function Chat2({
|
|
|
1034
1175
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1035
1176
|
ChatInput,
|
|
1036
1177
|
{
|
|
1178
|
+
header: compactSuggestions && replySuggestions.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1179
|
+
MobileReplySuggestions,
|
|
1180
|
+
{
|
|
1181
|
+
items: replySuggestions,
|
|
1182
|
+
onSelect: (reply) => void sendSuggestion(reply, false),
|
|
1183
|
+
label: replySuggestionsLabel,
|
|
1184
|
+
moreLabel: replySuggestionsMoreLabel,
|
|
1185
|
+
closeLabel: replySuggestionsCloseLabel,
|
|
1186
|
+
disabled: pending
|
|
1187
|
+
},
|
|
1188
|
+
JSON.stringify([_optionalChain([messages, 'access', _24 => _24.at, 'call', _25 => _25(-1), 'optionalAccess', _26 => _26.id]), replySuggestions])
|
|
1189
|
+
) : void 0,
|
|
1037
1190
|
value: input,
|
|
1038
1191
|
onChange: setInput,
|
|
1039
1192
|
onSend: (text) => void send(text),
|
|
@@ -197,6 +197,8 @@ interface ChatInputProps {
|
|
|
197
197
|
* this only for an active mobile conversation with `mobileCompactComposer`.
|
|
198
198
|
*/
|
|
199
199
|
compactOnBlur?: boolean;
|
|
200
|
+
/** Content inside the composer surface, above its files and text field. */
|
|
201
|
+
header?: ReactNode;
|
|
200
202
|
/** Quiet contextual copy between the composer controls. */
|
|
201
203
|
helperText?: ReactNode;
|
|
202
204
|
/** Privacy or visibility reassurance rendered below the composer. */
|
|
@@ -219,7 +221,7 @@ interface ChatInputProps {
|
|
|
219
221
|
* `<Chat>` instead of composing `<ChatInput>` directly if you want
|
|
220
222
|
* device-aware default modes.
|
|
221
223
|
*/
|
|
222
|
-
declare function ChatInput({ value, onChange, onSend, pending, disabled, placeholder, size, uploadingLabel, voice, voiceSession, voiceTitle, voiceLang, submitLabel, autoFocus, className, inputRef, attachments, onFilesSelected, onRemoveAttachment, accept, multiple, addFilesLabel, appearance, compactOnBlur, helperText, privacyNote, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
224
|
+
declare function ChatInput({ value, onChange, onSend, pending, disabled, placeholder, size, uploadingLabel, voice, voiceSession, voiceTitle, voiceLang, submitLabel, autoFocus, className, inputRef, attachments, onFilesSelected, onRemoveAttachment, accept, multiple, addFilesLabel, appearance, compactOnBlur, header, helperText, privacyNote, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
223
225
|
interface ChatProps {
|
|
224
226
|
/** Conversation messages. */
|
|
225
227
|
messages: ChatMessage[];
|
|
@@ -329,6 +331,12 @@ interface ChatProps {
|
|
|
329
331
|
replySuggestions?: ReadonlyArray<string>;
|
|
330
332
|
/** The reply suggestions' accessible name. Defaults to "Suggested replies". */
|
|
331
333
|
replySuggestionsLabel?: string;
|
|
334
|
+
/** Below 768px, show replies inside the composer as the first reply and a bottom-sheet picker. Desktop chips are unchanged. */
|
|
335
|
+
mobileCompactSuggestions?: boolean;
|
|
336
|
+
/** The mobile picker's opener, given the number of additional replies. Defaults to `+N more`. */
|
|
337
|
+
replySuggestionsMoreLabel?: (count: number) => string;
|
|
338
|
+
/** Accessible label for closing the mobile picker. Defaults to "Close suggested replies". */
|
|
339
|
+
replySuggestionsCloseLabel?: string;
|
|
332
340
|
/** Visual treatment for both empty and active text composers. */
|
|
333
341
|
composerAppearance?: ChatInputProps["appearance"];
|
|
334
342
|
/**
|
|
@@ -197,6 +197,8 @@ interface ChatInputProps {
|
|
|
197
197
|
* this only for an active mobile conversation with `mobileCompactComposer`.
|
|
198
198
|
*/
|
|
199
199
|
compactOnBlur?: boolean;
|
|
200
|
+
/** Content inside the composer surface, above its files and text field. */
|
|
201
|
+
header?: ReactNode;
|
|
200
202
|
/** Quiet contextual copy between the composer controls. */
|
|
201
203
|
helperText?: ReactNode;
|
|
202
204
|
/** Privacy or visibility reassurance rendered below the composer. */
|
|
@@ -219,7 +221,7 @@ interface ChatInputProps {
|
|
|
219
221
|
* `<Chat>` instead of composing `<ChatInput>` directly if you want
|
|
220
222
|
* device-aware default modes.
|
|
221
223
|
*/
|
|
222
|
-
declare function ChatInput({ value, onChange, onSend, pending, disabled, placeholder, size, uploadingLabel, voice, voiceSession, voiceTitle, voiceLang, submitLabel, autoFocus, className, inputRef, attachments, onFilesSelected, onRemoveAttachment, accept, multiple, addFilesLabel, appearance, compactOnBlur, helperText, privacyNote, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
224
|
+
declare function ChatInput({ value, onChange, onSend, pending, disabled, placeholder, size, uploadingLabel, voice, voiceSession, voiceTitle, voiceLang, submitLabel, autoFocus, className, inputRef, attachments, onFilesSelected, onRemoveAttachment, accept, multiple, addFilesLabel, appearance, compactOnBlur, header, helperText, privacyNote, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
223
225
|
interface ChatProps {
|
|
224
226
|
/** Conversation messages. */
|
|
225
227
|
messages: ChatMessage[];
|
|
@@ -329,6 +331,12 @@ interface ChatProps {
|
|
|
329
331
|
replySuggestions?: ReadonlyArray<string>;
|
|
330
332
|
/** The reply suggestions' accessible name. Defaults to "Suggested replies". */
|
|
331
333
|
replySuggestionsLabel?: string;
|
|
334
|
+
/** Below 768px, show replies inside the composer as the first reply and a bottom-sheet picker. Desktop chips are unchanged. */
|
|
335
|
+
mobileCompactSuggestions?: boolean;
|
|
336
|
+
/** The mobile picker's opener, given the number of additional replies. Defaults to `+N more`. */
|
|
337
|
+
replySuggestionsMoreLabel?: (count: number) => string;
|
|
338
|
+
/** Accessible label for closing the mobile picker. Defaults to "Close suggested replies". */
|
|
339
|
+
replySuggestionsCloseLabel?: string;
|
|
332
340
|
/** Visual treatment for both empty and active text composers. */
|
|
333
341
|
composerAppearance?: ChatInputProps["appearance"];
|
|
334
342
|
/**
|
package/dist/primitives/chat.js
CHANGED
|
@@ -49,6 +49,14 @@ import {
|
|
|
49
49
|
LazyMarkdown
|
|
50
50
|
} from "../chunk-VY5U4VGV.js";
|
|
51
51
|
import "../chunk-INNGGLMZ.js";
|
|
52
|
+
import {
|
|
53
|
+
Drawer,
|
|
54
|
+
DrawerClose,
|
|
55
|
+
DrawerContent,
|
|
56
|
+
DrawerHeader,
|
|
57
|
+
DrawerTitle,
|
|
58
|
+
DrawerTrigger
|
|
59
|
+
} from "../chunk-4HWCNRK4.js";
|
|
52
60
|
import {
|
|
53
61
|
DropdownMenu,
|
|
54
62
|
DropdownMenuContent,
|
|
@@ -113,6 +121,7 @@ import {
|
|
|
113
121
|
ArrowUp,
|
|
114
122
|
ArrowUpRight,
|
|
115
123
|
Check,
|
|
124
|
+
ChevronUp,
|
|
116
125
|
Copy,
|
|
117
126
|
Download,
|
|
118
127
|
FileText,
|
|
@@ -396,6 +405,7 @@ function ChatInput({
|
|
|
396
405
|
addFilesLabel = "Add files",
|
|
397
406
|
appearance = "default",
|
|
398
407
|
compactOnBlur = false,
|
|
408
|
+
header,
|
|
399
409
|
helperText,
|
|
400
410
|
privacyNote
|
|
401
411
|
}) {
|
|
@@ -469,6 +479,16 @@ function ChatInput({
|
|
|
469
479
|
className
|
|
470
480
|
),
|
|
471
481
|
children: [
|
|
482
|
+
header && /* @__PURE__ */ jsx(
|
|
483
|
+
InputGroupAddon,
|
|
484
|
+
{
|
|
485
|
+
align: "block-start",
|
|
486
|
+
className: "w-full cursor-default border-b border-border bg-muted/50 p-0 [.border-b]:pb-0",
|
|
487
|
+
onClick: () => {
|
|
488
|
+
},
|
|
489
|
+
children: header
|
|
490
|
+
}
|
|
491
|
+
),
|
|
472
492
|
liveVoiceActive && /* @__PURE__ */ jsx(InputGroupAddon, { align: "block-start", className: "w-full cursor-default border-b border-border p-0 [.border-b]:pb-0", children: /* @__PURE__ */ jsx(VoiceSessionControls, { ...voiceSession }) }),
|
|
473
493
|
attachments.length > 0 && /* @__PURE__ */ jsx(
|
|
474
494
|
ChatAttachmentList,
|
|
@@ -697,6 +717,123 @@ function ChatSuggestions({
|
|
|
697
717
|
)
|
|
698
718
|
] });
|
|
699
719
|
}
|
|
720
|
+
function MobileReplySuggestions({
|
|
721
|
+
items,
|
|
722
|
+
onSelect,
|
|
723
|
+
label,
|
|
724
|
+
moreLabel,
|
|
725
|
+
closeLabel,
|
|
726
|
+
disabled
|
|
727
|
+
}) {
|
|
728
|
+
const [open, setOpen] = useState(false);
|
|
729
|
+
const triggerRef = useRef(null);
|
|
730
|
+
const closeRef = useRef(null);
|
|
731
|
+
useEffect(() => {
|
|
732
|
+
if (disabled) setOpen(false);
|
|
733
|
+
}, [disabled]);
|
|
734
|
+
const select = (item) => {
|
|
735
|
+
if (disabled) return;
|
|
736
|
+
setOpen(false);
|
|
737
|
+
onSelect(item);
|
|
738
|
+
};
|
|
739
|
+
const primary = items[0];
|
|
740
|
+
if (primary === void 0) return null;
|
|
741
|
+
return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange: setOpen, shouldScaleBackground: false, repositionInputs: false, children: [
|
|
742
|
+
/* @__PURE__ */ jsxs(
|
|
743
|
+
"div",
|
|
744
|
+
{
|
|
745
|
+
"data-slot": "chat-replies",
|
|
746
|
+
"data-variant": "compact",
|
|
747
|
+
role: "group",
|
|
748
|
+
"aria-label": label,
|
|
749
|
+
className: "flex w-full min-w-0 items-center text-foreground",
|
|
750
|
+
children: [
|
|
751
|
+
/* @__PURE__ */ jsxs(
|
|
752
|
+
Button,
|
|
753
|
+
{
|
|
754
|
+
type: "button",
|
|
755
|
+
variant: "ghost",
|
|
756
|
+
size: "bare",
|
|
757
|
+
disabled,
|
|
758
|
+
className: "h-[44px] min-h-[44px] min-w-0 flex-1 justify-start gap-2 px-3 text-left focus-visible:-ring-offset-2",
|
|
759
|
+
onClick: () => select(primary),
|
|
760
|
+
children: [
|
|
761
|
+
/* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": "true" }),
|
|
762
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: primary })
|
|
763
|
+
]
|
|
764
|
+
}
|
|
765
|
+
),
|
|
766
|
+
items.length > 1 && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
767
|
+
Button,
|
|
768
|
+
{
|
|
769
|
+
ref: triggerRef,
|
|
770
|
+
type: "button",
|
|
771
|
+
variant: "ghost",
|
|
772
|
+
size: "bare",
|
|
773
|
+
disabled,
|
|
774
|
+
className: "h-[44px] min-h-[44px] shrink-0 gap-1 px-3 text-muted-foreground focus-visible:-ring-offset-2",
|
|
775
|
+
children: [
|
|
776
|
+
moreLabel(items.length - 1),
|
|
777
|
+
/* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true" })
|
|
778
|
+
]
|
|
779
|
+
}
|
|
780
|
+
) })
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
),
|
|
784
|
+
/* @__PURE__ */ jsxs(
|
|
785
|
+
DrawerContent,
|
|
786
|
+
{
|
|
787
|
+
"aria-describedby": void 0,
|
|
788
|
+
className: "max-h-[min(85dvh,40rem)] overflow-hidden pb-[env(safe-area-inset-bottom)]",
|
|
789
|
+
onOpenAutoFocus: (event) => {
|
|
790
|
+
event.preventDefault();
|
|
791
|
+
closeRef.current?.focus({ preventScroll: true });
|
|
792
|
+
},
|
|
793
|
+
onCloseAutoFocus: (event) => {
|
|
794
|
+
event.preventDefault();
|
|
795
|
+
if (triggerRef.current?.isConnected && !triggerRef.current.disabled) {
|
|
796
|
+
triggerRef.current.focus({ preventScroll: true });
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
children: [
|
|
800
|
+
/* @__PURE__ */ jsxs(DrawerHeader, { align: "start", className: "flex shrink-0 items-center justify-between gap-3 border-b px-4 py-2", children: [
|
|
801
|
+
/* @__PURE__ */ jsx(DrawerTitle, { className: "min-w-0 break-words leading-snug", children: label }),
|
|
802
|
+
/* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
803
|
+
Button,
|
|
804
|
+
{
|
|
805
|
+
ref: closeRef,
|
|
806
|
+
type: "button",
|
|
807
|
+
variant: "ghost",
|
|
808
|
+
size: "icon",
|
|
809
|
+
"aria-label": closeLabel,
|
|
810
|
+
className: "h-[44px] w-[44px] shrink-0",
|
|
811
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
|
|
812
|
+
}
|
|
813
|
+
) })
|
|
814
|
+
] }),
|
|
815
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 overflow-y-auto overscroll-contain", role: "group", "aria-label": label, children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
816
|
+
Button,
|
|
817
|
+
{
|
|
818
|
+
type: "button",
|
|
819
|
+
variant: "ghost",
|
|
820
|
+
size: "bare",
|
|
821
|
+
disabled,
|
|
822
|
+
"data-slot": "chat-reply-option",
|
|
823
|
+
className: "min-h-[56px] w-full justify-between gap-4 rounded-none border-b px-4 py-4 text-left text-base font-normal whitespace-normal last:border-b-0 focus-visible:-ring-offset-2",
|
|
824
|
+
onClick: () => select(item),
|
|
825
|
+
children: [
|
|
826
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 break-words", children: item }),
|
|
827
|
+
/* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": "true" })
|
|
828
|
+
]
|
|
829
|
+
},
|
|
830
|
+
item
|
|
831
|
+
)) })
|
|
832
|
+
]
|
|
833
|
+
}
|
|
834
|
+
)
|
|
835
|
+
] });
|
|
836
|
+
}
|
|
700
837
|
function ExamplePromptsLoading({ label, className }) {
|
|
701
838
|
const list = Array.isArray(label) ? label : [label];
|
|
702
839
|
const [idx, setIdx] = useState(0);
|
|
@@ -740,6 +877,9 @@ var Chat = forwardRef(function Chat2({
|
|
|
740
877
|
examplePromptsLoadingLabel = "Loading suggestions\u2026",
|
|
741
878
|
replySuggestions = [],
|
|
742
879
|
replySuggestionsLabel = "Suggested replies",
|
|
880
|
+
mobileCompactSuggestions = false,
|
|
881
|
+
replySuggestionsMoreLabel = (count) => `+${count} more`,
|
|
882
|
+
replySuggestionsCloseLabel = "Close suggested replies",
|
|
743
883
|
compactEmptyState = false,
|
|
744
884
|
defaultMode,
|
|
745
885
|
placeholder = "Type your message\u2026",
|
|
@@ -814,7 +954,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
814
954
|
[attachments, mode, onSend, pending, reportSendError]
|
|
815
955
|
);
|
|
816
956
|
const sendSuggestion = useCallback(
|
|
817
|
-
async (text) => {
|
|
957
|
+
async (text, focusInput = true) => {
|
|
818
958
|
const trimmed = text.trim();
|
|
819
959
|
if (!trimmed || pending) return;
|
|
820
960
|
try {
|
|
@@ -822,7 +962,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
822
962
|
} catch (cause) {
|
|
823
963
|
reportSendError(cause);
|
|
824
964
|
}
|
|
825
|
-
window.setTimeout(() => inputRef.current?.focus(), 0);
|
|
965
|
+
if (focusInput) window.setTimeout(() => inputRef.current?.focus(), 0);
|
|
826
966
|
},
|
|
827
967
|
[onSend, pending, reportSendError]
|
|
828
968
|
);
|
|
@@ -843,6 +983,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
843
983
|
);
|
|
844
984
|
const application = layout === "application";
|
|
845
985
|
const workspace = layout === "workspace";
|
|
986
|
+
const compactSuggestions = mobileCompactSuggestions && isMobile;
|
|
846
987
|
const showEmptyFileDropzone = emptyFileDropzone && Boolean(onFilesSelected) && attachments.length === 0;
|
|
847
988
|
const liveVoiceActive = voiceSession && voiceSession.state !== "disconnected" && voiceSession.state !== "error";
|
|
848
989
|
const showEmptyPending = !conversationStarted && pending && Boolean(emptyPendingContent) && !liveVoiceActive;
|
|
@@ -1019,7 +1160,7 @@ var Chat = forwardRef(function Chat2({
|
|
|
1019
1160
|
workspace && mobileCompactComposer && "max-md:pb-[max(0.75rem,env(safe-area-inset-bottom))] max-md:pt-3"
|
|
1020
1161
|
),
|
|
1021
1162
|
children: [
|
|
1022
|
-
/* @__PURE__ */ jsx(
|
|
1163
|
+
!compactSuggestions && /* @__PURE__ */ jsx(
|
|
1023
1164
|
ChatSuggestions,
|
|
1024
1165
|
{
|
|
1025
1166
|
slot: "chat-replies",
|
|
@@ -1034,6 +1175,18 @@ var Chat = forwardRef(function Chat2({
|
|
|
1034
1175
|
/* @__PURE__ */ jsx(
|
|
1035
1176
|
ChatInput,
|
|
1036
1177
|
{
|
|
1178
|
+
header: compactSuggestions && replySuggestions.length > 0 ? /* @__PURE__ */ jsx(
|
|
1179
|
+
MobileReplySuggestions,
|
|
1180
|
+
{
|
|
1181
|
+
items: replySuggestions,
|
|
1182
|
+
onSelect: (reply) => void sendSuggestion(reply, false),
|
|
1183
|
+
label: replySuggestionsLabel,
|
|
1184
|
+
moreLabel: replySuggestionsMoreLabel,
|
|
1185
|
+
closeLabel: replySuggestionsCloseLabel,
|
|
1186
|
+
disabled: pending
|
|
1187
|
+
},
|
|
1188
|
+
JSON.stringify([messages.at(-1)?.id, replySuggestions])
|
|
1189
|
+
) : void 0,
|
|
1037
1190
|
value: input,
|
|
1038
1191
|
onChange: setInput,
|
|
1039
1192
|
onSend: (text) => void send(text),
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-2BHI5ZWJ.cjs');
|
|
8
|
+
var _chunkE2UVQXBOcjs = require('../chunk-E2UVQXBO.cjs');
|
|
9
|
+
require('../chunk-AO56ET4F.cjs');
|
|
11
10
|
require('../chunk-WDXEJDMO.cjs');
|
|
11
|
+
require('../chunk-2BHI5ZWJ.cjs');
|
|
12
12
|
require('../chunk-T2ZFSPE4.cjs');
|
|
13
13
|
require('../chunk-JDEXZGIY.cjs');
|
|
14
14
|
require('../chunk-KWLSBTB2.cjs');
|
|
@@ -29,7 +29,7 @@ function DocumentPreview({
|
|
|
29
29
|
fallback
|
|
30
30
|
}) {
|
|
31
31
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
32
|
-
|
|
32
|
+
_chunkE2UVQXBOcjs.PreviewDialog,
|
|
33
33
|
{
|
|
34
34
|
open,
|
|
35
35
|
onOpenChange,
|
|
@@ -37,7 +37,7 @@ function DocumentPreview({
|
|
|
37
37
|
onDownload,
|
|
38
38
|
downloading,
|
|
39
39
|
downloadLabel,
|
|
40
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
40
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewLoading, { label: "Loading preview\u2026" }) : error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewNotice, { icon: _lucidereact.FileWarning, alert: true, message: error, children: fallback }) : src ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
41
41
|
"iframe",
|
|
42
42
|
{
|
|
43
43
|
src,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
PreviewLoading,
|
|
6
6
|
PreviewNotice,
|
|
7
7
|
PreviewStage
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-4HWCNRK4.js";
|
|
8
|
+
} from "../chunk-FPOJ2NGG.js";
|
|
9
|
+
import "../chunk-CRZ4INEJ.js";
|
|
11
10
|
import "../chunk-3QT5VYZ3.js";
|
|
11
|
+
import "../chunk-4HWCNRK4.js";
|
|
12
12
|
import "../chunk-KN4RPX35.js";
|
|
13
13
|
import "../chunk-W326GKML.js";
|
|
14
14
|
import "../chunk-G6SRSWXB.js";
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-2BHI5ZWJ.cjs');
|
|
8
|
+
var _chunkE2UVQXBOcjs = require('../chunk-E2UVQXBO.cjs');
|
|
9
|
+
require('../chunk-AO56ET4F.cjs');
|
|
11
10
|
require('../chunk-WDXEJDMO.cjs');
|
|
11
|
+
require('../chunk-2BHI5ZWJ.cjs');
|
|
12
12
|
require('../chunk-T2ZFSPE4.cjs');
|
|
13
13
|
require('../chunk-JDEXZGIY.cjs');
|
|
14
14
|
require('../chunk-KWLSBTB2.cjs');
|
|
@@ -17,4 +17,4 @@ require('../chunk-KWLSBTB2.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
exports.PreviewDialog =
|
|
20
|
+
exports.PreviewDialog = _chunkE2UVQXBOcjs.PreviewDialog; exports.PreviewLoading = _chunkE2UVQXBOcjs.PreviewLoading; exports.PreviewNotice = _chunkE2UVQXBOcjs.PreviewNotice; exports.PreviewStage = _chunkE2UVQXBOcjs.PreviewStage;
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
PreviewLoading,
|
|
6
6
|
PreviewNotice,
|
|
7
7
|
PreviewStage
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-4HWCNRK4.js";
|
|
8
|
+
} from "../chunk-FPOJ2NGG.js";
|
|
9
|
+
import "../chunk-CRZ4INEJ.js";
|
|
11
10
|
import "../chunk-3QT5VYZ3.js";
|
|
11
|
+
import "../chunk-4HWCNRK4.js";
|
|
12
12
|
import "../chunk-KN4RPX35.js";
|
|
13
13
|
import "../chunk-W326GKML.js";
|
|
14
14
|
import "../chunk-G6SRSWXB.js";
|
|
@@ -8,14 +8,14 @@ var _chunk4UUTKR3Vcjs = require('../chunk-4UUTKR3V.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
require('../chunk-
|
|
13
|
-
require('../chunk-2BHI5ZWJ.cjs');
|
|
11
|
+
var _chunkE2UVQXBOcjs = require('../chunk-E2UVQXBO.cjs');
|
|
12
|
+
require('../chunk-AO56ET4F.cjs');
|
|
14
13
|
require('../chunk-WDXEJDMO.cjs');
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
var _chunkKENBU3NVcjs = require('../chunk-KENBU3NV.cjs');
|
|
18
17
|
require('../chunk-ELPV44S6.cjs');
|
|
18
|
+
require('../chunk-2BHI5ZWJ.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkBGCNGYPLcjs = require('../chunk-BGCNGYPL.cjs');
|
|
@@ -155,7 +155,7 @@ function FilePreview({
|
|
|
155
155
|
truncatedLabel = "Showing the start of this file. Download it to see the rest."
|
|
156
156
|
}) {
|
|
157
157
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
158
|
-
|
|
158
|
+
_chunkE2UVQXBOcjs.PreviewDialog,
|
|
159
159
|
{
|
|
160
160
|
open,
|
|
161
161
|
onOpenChange,
|
|
@@ -266,17 +266,17 @@ function FilePreviewBody({
|
|
|
266
266
|
const reads = kind === "text" || kind === "markdown";
|
|
267
267
|
const text = useFileText(ready && reads ? file : null, ready && reads ? src : null);
|
|
268
268
|
const objectUrl = useObjectUrl(ready && !reads ? file : null, kind === "pdf" ? "application/pdf" : void 0);
|
|
269
|
-
const pending = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
-
const failed = (message) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
269
|
+
const pending = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewLoading, { label: loadingLabel }) });
|
|
270
|
+
const failed = (message) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewNotice, { icon: _lucidereact.FileWarning, alert: true, message, children: _nullishCoalesce(fallback, () => ( download)) }) });
|
|
271
271
|
if (loading) return pending;
|
|
272
272
|
if (error) return failed(error);
|
|
273
273
|
if (kind === "none" || !file && !src) {
|
|
274
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
274
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: _nullishCoalesce(fallback, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewNotice, { icon: _lucidereact.FileQuestion, message: unavailableLabel, children: download }))) });
|
|
275
275
|
}
|
|
276
276
|
if (reads) {
|
|
277
277
|
if (!text || text.status === "reading") return pending;
|
|
278
278
|
if (text.status === "failed") return failed(failedLabel);
|
|
279
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
279
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { layout: "scroll", label: `Preview of ${title}`, children: [
|
|
280
280
|
text.truncated && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { variant: "caption", marginBottom: "sm", children: truncatedLabel }),
|
|
281
281
|
kind === "markdown" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKENBU3NVcjs.LazyMarkdown, { components: { a: NewTabLink, ...markdownComponents }, children: text.text }) : (
|
|
282
282
|
// The theme's relaxed leading is a fixed 1.8rem, which spaces a
|
|
@@ -300,13 +300,13 @@ function ShownFile({
|
|
|
300
300
|
const fail = () => setBroken(true);
|
|
301
301
|
const label = `Preview of ${title}`;
|
|
302
302
|
if (kind === "image") {
|
|
303
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
303
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full w-full items-center justify-center p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UUTKR3Vcjs.Image, { src: url, alt: title, fit: "contain", radius: "sm", className: "max-h-full max-w-full", onError: fail }) }) });
|
|
304
304
|
}
|
|
305
305
|
if (kind === "audio") {
|
|
306
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
306
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full max-w-md p-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "audio", { src: url, controls: true, preload: "metadata", "aria-label": label, className: "w-full", onError: fail }) }) });
|
|
307
307
|
}
|
|
308
308
|
if (kind === "video") {
|
|
309
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
309
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full w-full items-center justify-center p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
310
310
|
"video",
|
|
311
311
|
{
|
|
312
312
|
src: url,
|
|
@@ -319,7 +319,7 @@ function ShownFile({
|
|
|
319
319
|
}
|
|
320
320
|
) }) });
|
|
321
321
|
}
|
|
322
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE2UVQXBOcjs.PreviewStage, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "iframe", { src: url, title: label, referrerPolicy: "no-referrer", className: "h-full w-full border-0 bg-background" }) });
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
PreviewLoading,
|
|
9
9
|
PreviewNotice,
|
|
10
10
|
PreviewStage
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-4HWCNRK4.js";
|
|
11
|
+
} from "../chunk-FPOJ2NGG.js";
|
|
12
|
+
import "../chunk-CRZ4INEJ.js";
|
|
14
13
|
import "../chunk-3QT5VYZ3.js";
|
|
15
14
|
import {
|
|
16
15
|
LazyMarkdown
|
|
17
16
|
} from "../chunk-VY5U4VGV.js";
|
|
18
17
|
import "../chunk-INNGGLMZ.js";
|
|
18
|
+
import "../chunk-4HWCNRK4.js";
|
|
19
19
|
import {
|
|
20
20
|
CodeBlock
|
|
21
21
|
} from "../chunk-HTPPNW74.js";
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('../chunk-2BHI5ZWJ.cjs');
|
|
12
|
+
var _chunkAO56ET4Fcjs = require('../chunk-AO56ET4F.cjs');
|
|
14
13
|
require('../chunk-WDXEJDMO.cjs');
|
|
14
|
+
require('../chunk-2BHI5ZWJ.cjs');
|
|
15
15
|
require('../chunk-KWLSBTB2.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
@@ -23,4 +23,4 @@ require('../chunk-KWLSBTB2.cjs');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
exports.ResponsiveDialog =
|
|
26
|
+
exports.ResponsiveDialog = _chunkAO56ET4Fcjs.ResponsiveDialog; exports.ResponsiveDialogBody = _chunkAO56ET4Fcjs.ResponsiveDialogBody; exports.ResponsiveDialogClose = _chunkAO56ET4Fcjs.ResponsiveDialogClose; exports.ResponsiveDialogContent = _chunkAO56ET4Fcjs.ResponsiveDialogContent; exports.ResponsiveDialogDescription = _chunkAO56ET4Fcjs.ResponsiveDialogDescription; exports.ResponsiveDialogFooter = _chunkAO56ET4Fcjs.ResponsiveDialogFooter; exports.ResponsiveDialogHeader = _chunkAO56ET4Fcjs.ResponsiveDialogHeader; exports.ResponsiveDialogTitle = _chunkAO56ET4Fcjs.ResponsiveDialogTitle; exports.ResponsiveDialogTrigger = _chunkAO56ET4Fcjs.ResponsiveDialogTrigger;
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
ResponsiveDialogHeader,
|
|
10
10
|
ResponsiveDialogTitle,
|
|
11
11
|
ResponsiveDialogTrigger
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-4HWCNRK4.js";
|
|
12
|
+
} from "../chunk-CRZ4INEJ.js";
|
|
14
13
|
import "../chunk-3QT5VYZ3.js";
|
|
14
|
+
import "../chunk-4HWCNRK4.js";
|
|
15
15
|
import "../chunk-G6SRSWXB.js";
|
|
16
16
|
export {
|
|
17
17
|
ResponsiveDialog,
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkWDXEJDMOcjs = require('./chunk-WDXEJDMO.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ var _chunk2BHI5ZWJcjs = require('./chunk-2BHI5ZWJ.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunk2BHI5ZWJcjs = require('./chunk-2BHI5ZWJ.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
@@ -1,14 +1,4 @@
|
|
|
1
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
2
|
import {
|
|
13
3
|
Dialog,
|
|
14
4
|
DialogClose,
|
|
@@ -19,6 +9,16 @@ import {
|
|
|
19
9
|
DialogTitle,
|
|
20
10
|
DialogTrigger
|
|
21
11
|
} from "./chunk-3QT5VYZ3.js";
|
|
12
|
+
import {
|
|
13
|
+
Drawer,
|
|
14
|
+
DrawerClose,
|
|
15
|
+
DrawerContent,
|
|
16
|
+
DrawerDescription,
|
|
17
|
+
DrawerFooter,
|
|
18
|
+
DrawerHeader,
|
|
19
|
+
DrawerTitle,
|
|
20
|
+
DrawerTrigger
|
|
21
|
+
} from "./chunk-4HWCNRK4.js";
|
|
22
22
|
import {
|
|
23
23
|
cn
|
|
24
24
|
} from "./chunk-G6SRSWXB.js";
|