@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.
@@ -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 px-2.5 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]",
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 gap-1.5 [&>:not(textarea)]:shrink-0 [&>:not(textarea)]:h-9", children: [
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: "h-9 w-9",
1701
- children: /* @__PURE__ */ jsx(Paperclip, { "aria-hidden": true, className: "size-4" })
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
- "min-h-9 max-h-60 flex-1 resize-none rounded-2xl px-3.5 py-2 text-base sm:text-sm",
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: "h-9 w-9",
1731
- children: /* @__PURE__ */ jsx(Square, { "aria-hidden": true, className: "size-3.5" })
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: "h-9 w-9",
1743
- children: /* @__PURE__ */ jsx(Send, { "aria-hidden": true, className: "size-4" })
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-QCKJVSJF.mjs.map
2370
- //# sourceMappingURL=chunk-QCKJVSJF.mjs.map
2411
+ //# sourceMappingURL=chunk-XJ7CXHSU.mjs.map
2412
+ //# sourceMappingURL=chunk-XJ7CXHSU.mjs.map