@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.
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var chunk2SXDCXLK_cjs = require('./chunk-2SXDCXLK.cjs');
4
+ require('./chunk-B5AWZOHJ.cjs');
5
+ require('./chunk-OLISEQHS.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "ChatRoot", {
10
+ enumerable: true,
11
+ get: function () { return chunk2SXDCXLK_cjs.ChatRoot; }
12
+ });
13
+ //# sourceMappingURL=ChatRoot-2KT32NFJ.cjs.map
14
+ //# sourceMappingURL=ChatRoot-2KT32NFJ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-CZMOJOGD.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-2KT32NFJ.cjs"}
@@ -0,0 +1,5 @@
1
+ export { ChatRoot } from './chunk-XJ7CXHSU.mjs';
2
+ import './chunk-2ZLKZ5VR.mjs';
3
+ import './chunk-N2XQF2OL.mjs';
4
+ //# sourceMappingURL=ChatRoot-VSIBJLE2.mjs.map
5
+ //# sourceMappingURL=ChatRoot-VSIBJLE2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-VTYANC7M.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ChatRoot-VSIBJLE2.mjs"}
@@ -1245,9 +1245,16 @@ function ChatProvider({
1245
1245
  () => ({ ...DEFAULT_LABELS, ...config.labels ?? {} }),
1246
1246
  [config.labels]
1247
1247
  );
1248
+ const hasAudio = react.useMemo(() => {
1249
+ const sounds = audio?.sounds;
1250
+ if (!sounds) return false;
1251
+ return Object.values(sounds).some(
1252
+ (v) => typeof v === "string" && v.length > 0
1253
+ );
1254
+ }, [audio]);
1248
1255
  const value = react.useMemo(
1249
- () => ({ ...chat, layout, config, labels, audio: audioApi }),
1250
- [chat, layout, config, labels, audioApi]
1256
+ () => ({ ...chat, layout, config, labels, audio: audioApi, hasAudio }),
1257
+ [chat, layout, config, labels, audioApi, hasAudio]
1251
1258
  );
1252
1259
  return /* @__PURE__ */ jsxRuntime.jsx(Ctx.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: rootRef, style: { display: "contents" }, children }) });
1253
1260
  }
@@ -1655,6 +1662,35 @@ function RemoveBtn({ onRemove }) {
1655
1662
  );
1656
1663
  }
1657
1664
  chunkOLISEQHS_cjs.__name(RemoveBtn, "RemoveBtn");
1665
+ var SIZE_CLASSES = {
1666
+ sm: {
1667
+ slot: "[&>:not(textarea)]:h-8",
1668
+ button: "h-8 w-8",
1669
+ iconButton: "size-3.5",
1670
+ textarea: "min-h-8 max-h-48 px-3 py-1.5",
1671
+ text: "text-sm",
1672
+ padding: "gap-1.5",
1673
+ containerPadding: "px-2 pt-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]"
1674
+ },
1675
+ md: {
1676
+ slot: "[&>:not(textarea)]:h-9",
1677
+ button: "h-9 w-9",
1678
+ iconButton: "size-4",
1679
+ textarea: "min-h-9 max-h-60 px-3.5 py-2",
1680
+ text: "text-base sm:text-sm",
1681
+ padding: "gap-1.5",
1682
+ containerPadding: "px-2.5 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]"
1683
+ },
1684
+ lg: {
1685
+ slot: "[&>:not(textarea)]:h-12",
1686
+ button: "h-12 w-12",
1687
+ iconButton: "size-5",
1688
+ textarea: "min-h-12 max-h-72 px-4 py-3",
1689
+ text: "text-base",
1690
+ padding: "gap-2",
1691
+ containerPadding: "px-3.5 pt-3 pb-[max(0.875rem,env(safe-area-inset-bottom))]"
1692
+ }
1693
+ };
1658
1694
  var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function Composer2({
1659
1695
  composer,
1660
1696
  placeholder = "Type a message...",
@@ -1666,6 +1702,7 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1666
1702
  attachmentTray,
1667
1703
  className,
1668
1704
  textareaClassName,
1705
+ size = "md",
1669
1706
  isStreaming: isStreamingProp,
1670
1707
  onCancel: onCancelProp
1671
1708
  }, ref) {
@@ -1673,12 +1710,14 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1673
1710
  const isStreaming = isStreamingProp ?? ctx?.isStreaming ?? false;
1674
1711
  const onCancel = onCancelProp ?? ctx?.cancelStream;
1675
1712
  const isDisabled = disabled ?? isStreaming;
1713
+ const sz = SIZE_CLASSES[size];
1676
1714
  return /* @__PURE__ */ jsxRuntime.jsxs(
1677
1715
  "div",
1678
1716
  {
1679
1717
  ref,
1680
1718
  className: lib.cn(
1681
- "border-t border-border bg-background/95 px-2.5 pt-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]",
1719
+ "border-t border-border bg-background/95",
1720
+ sz.containerPadding,
1682
1721
  className
1683
1722
  ),
1684
1723
  children: [
@@ -1689,7 +1728,7 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1689
1728
  onRemove: (a) => composer.removeAttachment(a.id)
1690
1729
  }
1691
1730
  ) }) : null,
1692
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-1.5 [&>:not(textarea)]:shrink-0 [&>:not(textarea)]:h-9", children: [
1731
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: lib.cn("flex items-end [&>:not(textarea)]:shrink-0", sz.padding, sz.slot), children: [
1693
1732
  showAttachmentButton ? /* @__PURE__ */ jsxRuntime.jsx(
1694
1733
  components.Button,
1695
1734
  {
@@ -1699,8 +1738,8 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1699
1738
  onClick: onPickFiles,
1700
1739
  "aria-label": "Attach files",
1701
1740
  disabled: isDisabled,
1702
- className: "h-9 w-9",
1703
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Paperclip, { "aria-hidden": true, className: "size-4" })
1741
+ className: sz.button,
1742
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Paperclip, { "aria-hidden": true, className: sz.iconButton })
1704
1743
  }
1705
1744
  ) : null,
1706
1745
  toolbarStart,
@@ -1714,7 +1753,9 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1714
1753
  "aria-multiline": "true",
1715
1754
  disabled: isDisabled,
1716
1755
  className: lib.cn(
1717
- "min-h-9 max-h-60 flex-1 resize-none rounded-2xl px-3.5 py-2 text-base sm:text-sm",
1756
+ "flex-1 resize-none rounded-2xl",
1757
+ sz.textarea,
1758
+ sz.text,
1718
1759
  textareaClassName
1719
1760
  )
1720
1761
  }
@@ -1729,8 +1770,8 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1729
1770
  onClick: onCancel,
1730
1771
  "aria-label": "Stop",
1731
1772
  "aria-keyshortcuts": "Escape",
1732
- className: "h-9 w-9",
1733
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Square, { "aria-hidden": true, className: "size-3.5" })
1773
+ className: sz.button,
1774
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Square, { "aria-hidden": true, className: sz.iconButton })
1734
1775
  }
1735
1776
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1736
1777
  components.Button,
@@ -1741,8 +1782,8 @@ var Composer = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(functio
1741
1782
  disabled: !composer.canSubmit,
1742
1783
  "aria-label": "Send",
1743
1784
  "aria-keyshortcuts": "Enter",
1744
- className: "h-9 w-9",
1745
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { "aria-hidden": true, className: "size-4" })
1785
+ className: sz.button,
1786
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { "aria-hidden": true, className: sz.iconButton })
1746
1787
  }
1747
1788
  )
1748
1789
  ] })
@@ -2353,7 +2394,8 @@ function ChatRootShell({ className, slots }) {
2353
2394
  onPickFiles: slots.onPickFiles,
2354
2395
  toolbarStart: slots.composerToolbarStart,
2355
2396
  toolbarEnd: slots.composerToolbarEnd,
2356
- attachmentTray: slots.composerAttachmentTray
2397
+ attachmentTray: slots.composerAttachmentTray,
2398
+ size: slots.composerSize
2357
2399
  }
2358
2400
  ),
2359
2401
  slots.footer ?? null
@@ -2406,5 +2448,5 @@ exports.useChatContextOptional = useChatContextOptional;
2406
2448
  exports.useChatHistory = useChatHistory;
2407
2449
  exports.useChatLayout = useChatLayout;
2408
2450
  exports.useChatScroll = useChatScroll;
2409
- //# sourceMappingURL=chunk-XYGB26BY.cjs.map
2410
- //# sourceMappingURL=chunk-XYGB26BY.cjs.map
2451
+ //# sourceMappingURL=chunk-2SXDCXLK.cjs.map
2452
+ //# sourceMappingURL=chunk-2SXDCXLK.cjs.map