@mieweb/ui 0.9.0-dev.4 → 0.9.0-dev.6

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.
Files changed (50) hide show
  1. package/dist/{chunk-DG6LIEUJ.js → chunk-22CYDCXA.js} +13 -1183
  2. package/dist/chunk-22CYDCXA.js.map +1 -0
  3. package/dist/chunk-3SD7PDCV.js +1878 -0
  4. package/dist/chunk-3SD7PDCV.js.map +1 -0
  5. package/dist/{chunk-USZ3VEPE.js → chunk-NORSXAXL.js} +853 -779
  6. package/dist/chunk-NORSXAXL.js.map +1 -0
  7. package/dist/{chunk-Z3RYJWSV.cjs → chunk-PY7XAG4D.cjs} +3 -4
  8. package/dist/chunk-PY7XAG4D.cjs.map +1 -0
  9. package/dist/chunk-T6PTKWM6.cjs +1912 -0
  10. package/dist/chunk-T6PTKWM6.cjs.map +1 -0
  11. package/dist/{chunk-DH7I5HMK.cjs → chunk-WIAQQNFU.cjs} +12 -1184
  12. package/dist/chunk-WIAQQNFU.cjs.map +1 -0
  13. package/dist/{chunk-XEZCHQHB.js → chunk-X5YM3KXY.js} +3 -4
  14. package/dist/chunk-X5YM3KXY.js.map +1 -0
  15. package/dist/{chunk-3MHG4HYB.cjs → chunk-XCNDZNY7.cjs} +855 -780
  16. package/dist/chunk-XCNDZNY7.cjs.map +1 -0
  17. package/dist/components/SuperChat/index.cjs +8 -8
  18. package/dist/components/SuperChat/index.d.cts +4 -4
  19. package/dist/components/SuperChat/index.d.ts +4 -4
  20. package/dist/components/SuperChat/index.js +2 -2
  21. package/dist/components/SuperChat/plugins/index.cjs +10 -3
  22. package/dist/components/SuperChat/plugins/index.cjs.map +1 -1
  23. package/dist/components/SuperChat/plugins/index.d.cts +3 -3
  24. package/dist/components/SuperChat/plugins/index.d.ts +3 -3
  25. package/dist/components/SuperChat/plugins/index.js +9 -2
  26. package/dist/components/SuperChat/plugins/index.js.map +1 -1
  27. package/dist/index.cjs +171 -114
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +471 -410
  30. package/dist/index.d.ts +471 -410
  31. package/dist/index.js +95 -41
  32. package/dist/index.js.map +1 -1
  33. package/dist/styles.css +1 -1
  34. package/dist/tailwind-preset.cjs +4 -4
  35. package/dist/tailwind-preset.js +1 -1
  36. package/dist/{types-DZDroUW8.d.cts → types-B97JNRNQ.d.cts} +1 -1
  37. package/dist/{types-B2RLmdVd.d.cts → types-CnPEwzlp.d.cts} +6 -2
  38. package/dist/{types-B2RLmdVd.d.ts → types-CnPEwzlp.d.ts} +6 -2
  39. package/dist/{types-9vK_YdEb.d.ts → types-gZXrfLj6.d.ts} +1 -1
  40. package/package.json +1 -1
  41. package/dist/chunk-3MHG4HYB.cjs.map +0 -1
  42. package/dist/chunk-5VXRKOPR.cjs +0 -735
  43. package/dist/chunk-5VXRKOPR.cjs.map +0 -1
  44. package/dist/chunk-DG6LIEUJ.js.map +0 -1
  45. package/dist/chunk-DH7I5HMK.cjs.map +0 -1
  46. package/dist/chunk-IF3X2WZP.js +0 -705
  47. package/dist/chunk-IF3X2WZP.js.map +0 -1
  48. package/dist/chunk-USZ3VEPE.js.map +0 -1
  49. package/dist/chunk-XEZCHQHB.js.map +0 -1
  50. package/dist/chunk-Z3RYJWSV.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -25,11 +25,12 @@ export { SourceTip } from './chunk-PHK4XBO5.js';
25
25
  export { Sparkline } from './chunk-CG4ZKJLE.js';
26
26
  import { Spinner, SpinnerWithLabel } from './chunk-UA7E7PDS.js';
27
27
  export { FullPageSpinner, Spinner, SpinnerWithLabel, spinnerVariants } from './chunk-UA7E7PDS.js';
28
- import { SparklesIcon, RefreshIcon, CloseIcon, AIMessageDisplay, ComposerModelSelector } from './chunk-DG6LIEUJ.js';
29
- export { AILogoIcon, AIMessageDisplay, AITypingIndicator, ChatBubble, ChatComposer, ChevronIcon, CloseIcon, CollapsiblePill, ComposerModelSelector, MCPToolCallDisplay, MessageAvatar, RefreshIcon, ResourceLink, SendIcon, SparklesIcon, SpinnerIcon, ToolStatusIcon, getToolIcon } from './chunk-DG6LIEUJ.js';
30
- import { MessageComposer, EmptyState } from './chunk-USZ3VEPE.js';
31
- export { AttachmentPreview, CharacterCounter, ConversationHeader, ConversationListItem, ConversationListSkeleton, DateSeparator, EmptyState, LightboxModal, LoadMoreButton, MessageBubble, MessageComposer, MessageList, MessageStatusIcon, MessageThread, MessagingSplitView, ReadReceiptIndicator, SendButton, SkeletonMessage, TypingIndicator, bubbleVariants, formatDateLabel, formatFileSize, formatLastSeen, getConversationSubtitle, getConversationTitle, groupMessagesByDate, headerVariants, isSameSenderGroup, sendButtonVariants, useMessageScroll, useMessages, useReadReceipts, useTypingIndicator } from './chunk-USZ3VEPE.js';
32
- export { AttachmentPicker, AttachmentPreviewItem, CameraButton, DragDropZone, generateAttachmentId, getFileType, validateFile } from './chunk-IF3X2WZP.js';
28
+ import { SparklesIcon, RefreshIcon, CloseIcon, AIMessageDisplay } from './chunk-22CYDCXA.js';
29
+ export { AILogoIcon, AIMessageDisplay, AITypingIndicator, ChatBubble, ChevronIcon, CloseIcon, CollapsiblePill, MCPToolCallDisplay, MessageAvatar, RefreshIcon, ResourceLink, SendIcon, SparklesIcon, SpinnerIcon, ToolStatusIcon, getToolIcon } from './chunk-22CYDCXA.js';
30
+ import { useTypingEmulation, EmptyState } from './chunk-NORSXAXL.js';
31
+ export { AttachmentPreview, CharacterCounter, ConversationHeader, ConversationListItem, ConversationListSkeleton, DateSeparator, EmptyState, LightboxModal, LoadMoreButton, MessageBubble, MessageComposer, MessageList, MessageStatusIcon, MessageThread, MessagingSplitView, ReadReceiptIndicator, SendButton, SkeletonMessage, TypingIndicator, bubbleVariants, formatDateLabel, formatFileSize, formatLastSeen, getConversationSubtitle, getConversationTitle, groupMessagesByDate, headerVariants, isSameSenderGroup, sendButtonVariants, useMessageScroll, useMessages, useReadReceipts, useTypingEmulation, useTypingIndicator } from './chunk-NORSXAXL.js';
32
+ import { ChatComposer, DEFAULT_MAX_FILE_SIZE, DEFAULT_ACCEPTED_FILE_TYPES } from './chunk-3SD7PDCV.js';
33
+ export { AttachmentPicker, AttachmentPreviewItem, CameraButton, ChatComposer, ComposerModelSelector, DragDropZone, generateAttachmentId, getFileType, validateFile } from './chunk-3SD7PDCV.js';
33
34
  import { RecordButton } from './chunk-VNWJTCBQ.js';
34
35
  export { RecordButton, formatDuration, recordButtonVariants } from './chunk-VNWJTCBQ.js';
35
36
  export { RichTextEditor, convertAngleBracketsToMustache, processDictation } from './chunk-QKFJDQEK.js';
@@ -80,7 +81,7 @@ export { CollabStatus, defaultCollabStatusLabels, useYjsCollabStatus } from './c
80
81
  import './chunk-7XUN3OQT.js';
81
82
  export { isHtmlEmpty, stripHtmlTags } from './chunk-ERLPVXOV.js';
82
83
  export { formatPhoneNumber, isPhoneNumberEmpty, isValidPhoneNumber, unformatPhoneNumber } from './chunk-ZVPJ2MH6.js';
83
- export { miewebUIPreset, miewebUISafelist } from './chunk-XEZCHQHB.js';
84
+ export { miewebUIPreset, miewebUISafelist } from './chunk-X5YM3KXY.js';
84
85
  export { Accordion } from './chunk-KRU6IGV7.js';
85
86
  import { Alert, AlertTitle, AlertDescription } from './chunk-3JWAABYI.js';
86
87
  export { Alert, AlertDescription, AlertTitle, alertVariants } from './chunk-3JWAABYI.js';
@@ -1463,6 +1464,7 @@ var chatVariants = cva("flex flex-col", {
1463
1464
  size: "full"
1464
1465
  }
1465
1466
  });
1467
+ var normalizeLegacySlot = (node) => node || void 0;
1466
1468
  function AIChat({
1467
1469
  session,
1468
1470
  messages: messagesProp,
@@ -1501,11 +1503,64 @@ function AIChat({
1501
1503
  const container = messagesContainerRef.current;
1502
1504
  if (container) container.scrollTop = container.scrollHeight;
1503
1505
  }, [messages]);
1504
- const handleSend = async (message) => {
1505
- if (message.content.trim() && onSendMessage) {
1506
- onSendMessage(message.content.trim());
1506
+ const {
1507
+ showAttachmentPicker,
1508
+ inputTrailing,
1509
+ onTypingStart,
1510
+ onTypingStop,
1511
+ value: hostValue,
1512
+ onValueChange: hostOnValueChange,
1513
+ onSend: hostOnSend,
1514
+ micSlot: hostMicSlot,
1515
+ ...composerRest
1516
+ } = composerProps ?? {};
1517
+ delete composerRest.showCameraButton;
1518
+ delete composerRest.variant;
1519
+ const hasInputTrailing = !!composerProps && "inputTrailing" in composerProps;
1520
+ const legacyAttachments = !!composerProps && "showAttachmentPicker" in composerProps ? showAttachmentPicker ?? true : false;
1521
+ const [draft, setDraft] = React13.useState("");
1522
+ const draftEpochRef = React13.useRef(0);
1523
+ const composerValue = hostValue ?? draft;
1524
+ const isHostControlled = hostValue !== void 0;
1525
+ const handleComposerValueChange = React13.useCallback(
1526
+ (value) => {
1527
+ draftEpochRef.current += 1;
1528
+ setDraft(value);
1529
+ if (isHostControlled) hostOnValueChange?.(value);
1530
+ },
1531
+ [isHostControlled, hostOnValueChange]
1532
+ );
1533
+ const { stopTyping } = useTypingEmulation({
1534
+ value: composerValue,
1535
+ onTypingStart,
1536
+ onTypingStop
1537
+ });
1538
+ const sendWithRestore = async (message, send) => {
1539
+ stopTyping();
1540
+ const epoch = draftEpochRef.current;
1541
+ try {
1542
+ await Promise.resolve(send(message));
1543
+ } catch (error) {
1544
+ if (draftEpochRef.current === epoch) {
1545
+ setDraft(message.content);
1546
+ if (isHostControlled) hostOnValueChange?.(message.content);
1547
+ }
1548
+ throw error;
1507
1549
  }
1508
1550
  };
1551
+ const handleSend = async (message) => {
1552
+ if (!onSendMessage) return;
1553
+ const content = message.content.trim();
1554
+ const attachments = message.attachments?.length ? message.attachments : void 0;
1555
+ if (!content && !attachments) return;
1556
+ await sendWithRestore(
1557
+ message,
1558
+ () => (
1559
+ // Keep the exact legacy call shape for text-only sends.
1560
+ attachments ? onSendMessage(content, attachments) : onSendMessage(content)
1561
+ )
1562
+ );
1563
+ };
1509
1564
  const handleSuggestionSelect = (action) => {
1510
1565
  if (onSuggestedAction) {
1511
1566
  onSuggestedAction(action);
@@ -1624,18 +1679,14 @@ function AIChat({
1624
1679
  onSelect: handleSuggestionSelect
1625
1680
  }
1626
1681
  ) }),
1627
- /* @__PURE__ */ jsx(
1628
- MessageComposer,
1682
+ /* @__PURE__ */ jsx("div", { "data-slot": "ai-chat-composer", className: "p-3", children: /* @__PURE__ */ jsx(
1683
+ ChatComposer,
1629
1684
  {
1630
- onSend: handleSend,
1685
+ onSend: hostOnSend ? (message) => sendWithRestore(message, hostOnSend) : handleSend,
1631
1686
  placeholder: inputPlaceholder,
1632
1687
  disabled: isGenerating,
1633
1688
  isSending: isGenerating,
1634
- showAttachmentPicker: false,
1635
- showCameraButton: false,
1636
- showCharacterCount: false,
1637
- variant: "minimal",
1638
- inputTrailing: talkToText ? /* @__PURE__ */ jsx(
1689
+ micSlot: hostMicSlot !== void 0 ? hostMicSlot : hasInputTrailing ? normalizeLegacySlot(inputTrailing) : talkToText ? /* @__PURE__ */ jsx(
1639
1690
  RecordButton,
1640
1691
  {
1641
1692
  variant: "ghost",
@@ -1647,9 +1698,16 @@ function AIChat({
1647
1698
  onRecordingComplete
1648
1699
  }
1649
1700
  ) : void 0,
1650
- ...composerProps
1701
+ ...composerRest,
1702
+ allowAttachments: composerRest.allowAttachments ?? legacyAttachments,
1703
+ maxLength: composerRest.maxLength ?? 1600,
1704
+ inputLabel: composerRest.inputLabel ?? "Message",
1705
+ acceptedFileTypes: composerRest.acceptedFileTypes ?? (legacyAttachments ? DEFAULT_ACCEPTED_FILE_TYPES : void 0),
1706
+ maxFileSize: composerRest.maxFileSize ?? (legacyAttachments ? DEFAULT_MAX_FILE_SIZE : void 0),
1707
+ value: composerValue,
1708
+ onValueChange: handleComposerValueChange
1651
1709
  }
1652
- )
1710
+ ) })
1653
1711
  ]
1654
1712
  }
1655
1713
  )
@@ -2115,20 +2173,17 @@ function OzwellChat({
2115
2173
  });
2116
2174
  setMessagesMenuOpen(false);
2117
2175
  };
2118
- const modelSelector = showModelSelector && models ? /* @__PURE__ */ jsx(
2119
- ComposerModelSelector,
2120
- {
2121
- models: models.options,
2122
- value: models.value,
2123
- onChange: models.onChange,
2124
- ...models.providerFilter !== void 0 ? {
2125
- providerFilter: models.providerFilter,
2126
- onProviderFilterChange: models.onProviderFilterChange
2127
- } : { onProviderFilterChange: models.onProviderFilterChange },
2128
- boundaryRef: shellRef,
2129
- className: "border-border bg-card text-foreground max-w-[min(142px,38vw)] shadow-sm"
2130
- }
2131
- ) : void 0;
2176
+ const modelSelectorProps = showModelSelector && models ? {
2177
+ models: models.options,
2178
+ value: models.value,
2179
+ onChange: models.onChange,
2180
+ ...models.providerFilter !== void 0 ? {
2181
+ providerFilter: models.providerFilter,
2182
+ onProviderFilterChange: models.onProviderFilterChange
2183
+ } : { onProviderFilterChange: models.onProviderFilterChange },
2184
+ boundaryRef: shellRef,
2185
+ className: "max-w-[min(160px,44vw)]"
2186
+ } : void 0;
2132
2187
  const startQueuedMessageEdit = () => {
2133
2188
  setQueuedMessageDraft(queuedMessage ?? "");
2134
2189
  setIsEditingQueuedMessage(true);
@@ -2342,7 +2397,6 @@ function OzwellChat({
2342
2397
  {
2343
2398
  messages: chatMessages,
2344
2399
  isGenerating,
2345
- className: showModelSelector ? '[&_[data-slot="composer-input"]]:pe-[min(160px,44vw)]' : void 0,
2346
2400
  showHeader: false,
2347
2401
  height: "100%",
2348
2402
  variant: "embedded",
@@ -2352,9 +2406,9 @@ function OzwellChat({
2352
2406
  renderTextContent: renderMessageTextContent,
2353
2407
  renderMessageFooter: renderQueuedMessageFooter,
2354
2408
  composerProps: {
2355
- inputTrailing: modelSelector,
2356
2409
  disabled: false,
2357
- isSending: false
2410
+ isSending: false,
2411
+ ...modelSelectorProps ? { showModelSelector: true, modelSelectorProps } : {}
2358
2412
  }
2359
2413
  }
2360
2414
  ),
@@ -5741,9 +5795,9 @@ function HandsFreeChat({
5741
5795
  // Controlled input (value/onValueChange) comes from the hook — it fills the box with the live
5742
5796
  // caption while dictating, else the typed text. We only add the mic button here.
5743
5797
  ...oz.chatProps.composerProps,
5744
- // The composer's OWN mic button, driven by our shared stream (controlled mode disables its
5798
+ // The composer's OWN mic slot, driven by our shared stream (controlled mode disables its
5745
5799
  // internal recorder). So the built-in mic and "hey ozwell" both do the same thing — one mic.
5746
- inputTrailing: /* @__PURE__ */ jsx(
5800
+ micSlot: /* @__PURE__ */ jsx(
5747
5801
  "span",
5748
5802
  {
5749
5803
  onClickCapture: () => {
@@ -18204,7 +18258,7 @@ function WebcamModal({
18204
18258
  WebcamModal.displayName = "WebcamModal";
18205
18259
 
18206
18260
  // src/components/DocumentScanner/types.ts
18207
- var DEFAULT_ACCEPTED_FILE_TYPES = [
18261
+ var DEFAULT_ACCEPTED_FILE_TYPES2 = [
18208
18262
  "image/jpeg",
18209
18263
  "image/jpg",
18210
18264
  "image/png",
@@ -18240,7 +18294,7 @@ function createPreviewUrl(file) {
18240
18294
  return URL.createObjectURL(file);
18241
18295
  }
18242
18296
  function useFileUpload({
18243
- acceptedFileTypes = [...DEFAULT_ACCEPTED_FILE_TYPES],
18297
+ acceptedFileTypes = [...DEFAULT_ACCEPTED_FILE_TYPES2],
18244
18298
  maxFileSizeMb = DEFAULT_MAX_FILE_SIZE_MB,
18245
18299
  multiple = false,
18246
18300
  onValidationError
@@ -18323,7 +18377,7 @@ function DocumentScanner({
18323
18377
  onScan,
18324
18378
  onResult,
18325
18379
  multiple = false,
18326
- acceptedFileTypes = [...DEFAULT_ACCEPTED_FILE_TYPES],
18380
+ acceptedFileTypes = [...DEFAULT_ACCEPTED_FILE_TYPES2],
18327
18381
  maxFileSizeMb = DEFAULT_MAX_FILE_SIZE_MB,
18328
18382
  disabled = false,
18329
18383
  enableWebcam = true,