@djangocfg/ui-tools 2.1.349 → 2.1.351
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/dist/ChatRoot-2KT32NFJ.cjs +14 -0
- package/dist/{ChatRoot-CZMOJOGD.mjs.map → ChatRoot-2KT32NFJ.cjs.map} +1 -1
- package/dist/ChatRoot-VSIBJLE2.mjs +5 -0
- package/dist/{ChatRoot-VTYANC7M.cjs.map → ChatRoot-VSIBJLE2.mjs.map} +1 -1
- package/dist/{chunk-XYGB26BY.cjs → chunk-2SXDCXLK.cjs} +56 -14
- package/dist/chunk-2SXDCXLK.cjs.map +1 -0
- package/dist/{chunk-QCKJVSJF.mjs → chunk-XJ7CXHSU.mjs} +56 -14
- package/dist/chunk-XJ7CXHSU.mjs.map +1 -0
- package/dist/index.cjs +77 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -18
- package/dist/index.d.ts +45 -18
- package/dist/index.mjs +34 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/tools/Chat/Chat.story.tsx +33 -0
- package/src/tools/Chat/components/AudioToggle.tsx +78 -0
- package/src/tools/Chat/components/ChatRoot.tsx +5 -1
- package/src/tools/Chat/components/Composer.tsx +66 -13
- package/src/tools/Chat/components/index.ts +1 -0
- package/src/tools/Chat/context/ChatProvider.tsx +14 -2
- package/src/tools/Chat/index.ts +2 -0
- package/dist/ChatRoot-CZMOJOGD.mjs +0 -5
- package/dist/ChatRoot-VTYANC7M.cjs +0 -14
- package/dist/chunk-QCKJVSJF.mjs.map +0 -1
- package/dist/chunk-XYGB26BY.cjs.map +0 -1
|
@@ -1243,9 +1243,16 @@ function ChatProvider({
|
|
|
1243
1243
|
() => ({ ...DEFAULT_LABELS, ...config.labels ?? {} }),
|
|
1244
1244
|
[config.labels]
|
|
1245
1245
|
);
|
|
1246
|
+
const hasAudio = useMemo(() => {
|
|
1247
|
+
const sounds = audio?.sounds;
|
|
1248
|
+
if (!sounds) return false;
|
|
1249
|
+
return Object.values(sounds).some(
|
|
1250
|
+
(v) => typeof v === "string" && v.length > 0
|
|
1251
|
+
);
|
|
1252
|
+
}, [audio]);
|
|
1246
1253
|
const value = useMemo(
|
|
1247
|
-
() => ({ ...chat, layout, config, labels, audio: audioApi }),
|
|
1248
|
-
[chat, layout, config, labels, audioApi]
|
|
1254
|
+
() => ({ ...chat, layout, config, labels, audio: audioApi, hasAudio }),
|
|
1255
|
+
[chat, layout, config, labels, audioApi, hasAudio]
|
|
1249
1256
|
);
|
|
1250
1257
|
return /* @__PURE__ */ jsx(Ctx.Provider, { value, children: /* @__PURE__ */ jsx("div", { ref: rootRef, style: { display: "contents" }, children }) });
|
|
1251
1258
|
}
|
|
@@ -1653,6 +1660,35 @@ function RemoveBtn({ onRemove }) {
|
|
|
1653
1660
|
);
|
|
1654
1661
|
}
|
|
1655
1662
|
__name(RemoveBtn, "RemoveBtn");
|
|
1663
|
+
var SIZE_CLASSES = {
|
|
1664
|
+
sm: {
|
|
1665
|
+
slot: "[&>:not(textarea)]:h-8",
|
|
1666
|
+
button: "h-8 w-8",
|
|
1667
|
+
iconButton: "size-3.5",
|
|
1668
|
+
textarea: "min-h-8 max-h-48 px-3 py-1.5",
|
|
1669
|
+
text: "text-sm",
|
|
1670
|
+
padding: "gap-1.5",
|
|
1671
|
+
containerPadding: "px-2 pt-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]"
|
|
1672
|
+
},
|
|
1673
|
+
md: {
|
|
1674
|
+
slot: "[&>:not(textarea)]:h-9",
|
|
1675
|
+
button: "h-9 w-9",
|
|
1676
|
+
iconButton: "size-4",
|
|
1677
|
+
textarea: "min-h-9 max-h-60 px-3.5 py-2",
|
|
1678
|
+
text: "text-base sm:text-sm",
|
|
1679
|
+
padding: "gap-1.5",
|
|
1680
|
+
containerPadding: "px-2.5 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]"
|
|
1681
|
+
},
|
|
1682
|
+
lg: {
|
|
1683
|
+
slot: "[&>:not(textarea)]:h-12",
|
|
1684
|
+
button: "h-12 w-12",
|
|
1685
|
+
iconButton: "size-5",
|
|
1686
|
+
textarea: "min-h-12 max-h-72 px-4 py-3",
|
|
1687
|
+
text: "text-base",
|
|
1688
|
+
padding: "gap-2",
|
|
1689
|
+
containerPadding: "px-3.5 pt-3 pb-[max(0.875rem,env(safe-area-inset-bottom))]"
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1656
1692
|
var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
1657
1693
|
composer,
|
|
1658
1694
|
placeholder = "Type a message...",
|
|
@@ -1664,6 +1700,7 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1664
1700
|
attachmentTray,
|
|
1665
1701
|
className,
|
|
1666
1702
|
textareaClassName,
|
|
1703
|
+
size = "md",
|
|
1667
1704
|
isStreaming: isStreamingProp,
|
|
1668
1705
|
onCancel: onCancelProp
|
|
1669
1706
|
}, ref) {
|
|
@@ -1671,12 +1708,14 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1671
1708
|
const isStreaming = isStreamingProp ?? ctx?.isStreaming ?? false;
|
|
1672
1709
|
const onCancel = onCancelProp ?? ctx?.cancelStream;
|
|
1673
1710
|
const isDisabled = disabled ?? isStreaming;
|
|
1711
|
+
const sz = SIZE_CLASSES[size];
|
|
1674
1712
|
return /* @__PURE__ */ jsxs(
|
|
1675
1713
|
"div",
|
|
1676
1714
|
{
|
|
1677
1715
|
ref,
|
|
1678
1716
|
className: cn(
|
|
1679
|
-
"border-t border-border bg-background/95
|
|
1717
|
+
"border-t border-border bg-background/95",
|
|
1718
|
+
sz.containerPadding,
|
|
1680
1719
|
className
|
|
1681
1720
|
),
|
|
1682
1721
|
children: [
|
|
@@ -1687,7 +1726,7 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1687
1726
|
onRemove: (a) => composer.removeAttachment(a.id)
|
|
1688
1727
|
}
|
|
1689
1728
|
) }) : null,
|
|
1690
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-end
|
|
1729
|
+
/* @__PURE__ */ jsxs("div", { className: cn("flex items-end [&>:not(textarea)]:shrink-0", sz.padding, sz.slot), children: [
|
|
1691
1730
|
showAttachmentButton ? /* @__PURE__ */ jsx(
|
|
1692
1731
|
Button,
|
|
1693
1732
|
{
|
|
@@ -1697,8 +1736,8 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1697
1736
|
onClick: onPickFiles,
|
|
1698
1737
|
"aria-label": "Attach files",
|
|
1699
1738
|
disabled: isDisabled,
|
|
1700
|
-
className:
|
|
1701
|
-
children: /* @__PURE__ */ jsx(Paperclip, { "aria-hidden": true, className:
|
|
1739
|
+
className: sz.button,
|
|
1740
|
+
children: /* @__PURE__ */ jsx(Paperclip, { "aria-hidden": true, className: sz.iconButton })
|
|
1702
1741
|
}
|
|
1703
1742
|
) : null,
|
|
1704
1743
|
toolbarStart,
|
|
@@ -1712,7 +1751,9 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1712
1751
|
"aria-multiline": "true",
|
|
1713
1752
|
disabled: isDisabled,
|
|
1714
1753
|
className: cn(
|
|
1715
|
-
"
|
|
1754
|
+
"flex-1 resize-none rounded-2xl",
|
|
1755
|
+
sz.textarea,
|
|
1756
|
+
sz.text,
|
|
1716
1757
|
textareaClassName
|
|
1717
1758
|
)
|
|
1718
1759
|
}
|
|
@@ -1727,8 +1768,8 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1727
1768
|
onClick: onCancel,
|
|
1728
1769
|
"aria-label": "Stop",
|
|
1729
1770
|
"aria-keyshortcuts": "Escape",
|
|
1730
|
-
className:
|
|
1731
|
-
children: /* @__PURE__ */ jsx(Square, { "aria-hidden": true, className:
|
|
1771
|
+
className: sz.button,
|
|
1772
|
+
children: /* @__PURE__ */ jsx(Square, { "aria-hidden": true, className: sz.iconButton })
|
|
1732
1773
|
}
|
|
1733
1774
|
) : /* @__PURE__ */ jsx(
|
|
1734
1775
|
Button,
|
|
@@ -1739,8 +1780,8 @@ var Composer = forwardRef(/* @__PURE__ */ __name(function Composer2({
|
|
|
1739
1780
|
disabled: !composer.canSubmit,
|
|
1740
1781
|
"aria-label": "Send",
|
|
1741
1782
|
"aria-keyshortcuts": "Enter",
|
|
1742
|
-
className:
|
|
1743
|
-
children: /* @__PURE__ */ jsx(Send, { "aria-hidden": true, className:
|
|
1783
|
+
className: sz.button,
|
|
1784
|
+
children: /* @__PURE__ */ jsx(Send, { "aria-hidden": true, className: sz.iconButton })
|
|
1744
1785
|
}
|
|
1745
1786
|
)
|
|
1746
1787
|
] })
|
|
@@ -2351,7 +2392,8 @@ function ChatRootShell({ className, slots }) {
|
|
|
2351
2392
|
onPickFiles: slots.onPickFiles,
|
|
2352
2393
|
toolbarStart: slots.composerToolbarStart,
|
|
2353
2394
|
toolbarEnd: slots.composerToolbarEnd,
|
|
2354
|
-
attachmentTray: slots.composerAttachmentTray
|
|
2395
|
+
attachmentTray: slots.composerAttachmentTray,
|
|
2396
|
+
size: slots.composerSize
|
|
2355
2397
|
}
|
|
2356
2398
|
),
|
|
2357
2399
|
slots.footer ?? null
|
|
@@ -2366,5 +2408,5 @@ function copy2(text) {
|
|
|
2366
2408
|
__name(copy2, "copy");
|
|
2367
2409
|
|
|
2368
2410
|
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, EmptyState, ErrorBanner, HOTKEYS, JumpToLatest, LIMITS, MessageActions, MessageBubble, MessageList, STORAGE_KEYS, Sources, StreamingIndicator, ToolCalls, createId, createTokenBuffer, deriveInitials, getChatLogger, initialState, reducer, resolvePersona, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatHistory, useChatLayout, useChatScroll };
|
|
2369
|
-
//# sourceMappingURL=chunk-
|
|
2370
|
-
//# sourceMappingURL=chunk-
|
|
2411
|
+
//# sourceMappingURL=chunk-XJ7CXHSU.mjs.map
|
|
2412
|
+
//# sourceMappingURL=chunk-XJ7CXHSU.mjs.map
|