@mieweb/ui 0.6.1-dev.123 → 0.6.1-dev.125

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/index.d.cts CHANGED
@@ -1051,6 +1051,10 @@ interface MessageComposerProps {
1051
1051
  onTypingStart?: () => void;
1052
1052
  /** Called when the user stops typing */
1053
1053
  onTypingStop?: () => void;
1054
+ /** Controlled value for the textarea */
1055
+ value?: string;
1056
+ /** Callback when value changes (for controlled mode) */
1057
+ onValueChange?: (value: string) => void;
1054
1058
  /** Placeholder text */
1055
1059
  placeholder?: string;
1056
1060
  /** Maximum message length */
@@ -1085,6 +1089,8 @@ interface MessageComposerProps {
1085
1089
  onCancelReply?: () => void;
1086
1090
  /** Visual variant - 'default' shows border-t, 'minimal' has no border */
1087
1091
  variant?: 'default' | 'minimal';
1092
+ /** Content to render inside the input wrapper (e.g. a mic button) */
1093
+ inputTrailing?: React$1.ReactNode;
1088
1094
  /** Additional class name */
1089
1095
  className?: string;
1090
1096
  }
@@ -1139,6 +1145,12 @@ interface AIChatProps extends VariantProps<typeof chatVariants>, AIChatCallbacks
1139
1145
  height?: string | number;
1140
1146
  /** Props to pass to the MessageComposer */
1141
1147
  composerProps?: Partial<MessageComposerProps>;
1148
+ /** Enable talk-to-text microphone button inside the input */
1149
+ talkToText?: boolean;
1150
+ /** Callback when recording starts */
1151
+ onRecordingStart?: () => void;
1152
+ /** Callback when recording completes (receives audio blob and duration) */
1153
+ onRecordingComplete?: (blob: Blob, duration: number) => void;
1142
1154
  /** Callback when close button is clicked (shows close button when provided) */
1143
1155
  onClose?: () => void;
1144
1156
  /**
@@ -1153,7 +1165,7 @@ interface AIChatProps extends VariantProps<typeof chatVariants>, AIChatCallbacks
1153
1165
  * A complete AI chat interface with message history, input, and tool call support.
1154
1166
  * Reuses MessageComposer from the Messaging components for consistent UX.
1155
1167
  */
1156
- declare function AIChat({ session, messages: messagesProp, isGenerating: isGeneratingProp, userName, title, suggestions, showHeader, showTimestamps, inputPlaceholder, variant, size, height, composerProps, className, onSendMessage, onToolCall: _onToolCall, onResourceClick, onSuggestedAction, onCancel, onClear, onClose, renderTextContent, }: AIChatProps): react_jsx_runtime.JSX.Element;
1168
+ declare function AIChat({ session, messages: messagesProp, isGenerating: isGeneratingProp, userName, title, suggestions, showHeader, showTimestamps, inputPlaceholder, variant, size, height, composerProps, talkToText, onRecordingStart, onRecordingComplete, className, onSendMessage, onToolCall: _onToolCall, onResourceClick, onSuggestedAction, onCancel, onClear, onClose, renderTextContent, }: AIChatProps): react_jsx_runtime.JSX.Element;
1157
1169
 
1158
1170
  interface AIChatTriggerProps {
1159
1171
  /** Whether the chat is open */
package/dist/index.d.ts CHANGED
@@ -1051,6 +1051,10 @@ interface MessageComposerProps {
1051
1051
  onTypingStart?: () => void;
1052
1052
  /** Called when the user stops typing */
1053
1053
  onTypingStop?: () => void;
1054
+ /** Controlled value for the textarea */
1055
+ value?: string;
1056
+ /** Callback when value changes (for controlled mode) */
1057
+ onValueChange?: (value: string) => void;
1054
1058
  /** Placeholder text */
1055
1059
  placeholder?: string;
1056
1060
  /** Maximum message length */
@@ -1085,6 +1089,8 @@ interface MessageComposerProps {
1085
1089
  onCancelReply?: () => void;
1086
1090
  /** Visual variant - 'default' shows border-t, 'minimal' has no border */
1087
1091
  variant?: 'default' | 'minimal';
1092
+ /** Content to render inside the input wrapper (e.g. a mic button) */
1093
+ inputTrailing?: React$1.ReactNode;
1088
1094
  /** Additional class name */
1089
1095
  className?: string;
1090
1096
  }
@@ -1139,6 +1145,12 @@ interface AIChatProps extends VariantProps<typeof chatVariants>, AIChatCallbacks
1139
1145
  height?: string | number;
1140
1146
  /** Props to pass to the MessageComposer */
1141
1147
  composerProps?: Partial<MessageComposerProps>;
1148
+ /** Enable talk-to-text microphone button inside the input */
1149
+ talkToText?: boolean;
1150
+ /** Callback when recording starts */
1151
+ onRecordingStart?: () => void;
1152
+ /** Callback when recording completes (receives audio blob and duration) */
1153
+ onRecordingComplete?: (blob: Blob, duration: number) => void;
1142
1154
  /** Callback when close button is clicked (shows close button when provided) */
1143
1155
  onClose?: () => void;
1144
1156
  /**
@@ -1153,7 +1165,7 @@ interface AIChatProps extends VariantProps<typeof chatVariants>, AIChatCallbacks
1153
1165
  * A complete AI chat interface with message history, input, and tool call support.
1154
1166
  * Reuses MessageComposer from the Messaging components for consistent UX.
1155
1167
  */
1156
- declare function AIChat({ session, messages: messagesProp, isGenerating: isGeneratingProp, userName, title, suggestions, showHeader, showTimestamps, inputPlaceholder, variant, size, height, composerProps, className, onSendMessage, onToolCall: _onToolCall, onResourceClick, onSuggestedAction, onCancel, onClear, onClose, renderTextContent, }: AIChatProps): react_jsx_runtime.JSX.Element;
1168
+ declare function AIChat({ session, messages: messagesProp, isGenerating: isGeneratingProp, userName, title, suggestions, showHeader, showTimestamps, inputPlaceholder, variant, size, height, composerProps, talkToText, onRecordingStart, onRecordingComplete, className, onSendMessage, onToolCall: _onToolCall, onResourceClick, onSuggestedAction, onCancel, onClear, onClose, renderTextContent, }: AIChatProps): react_jsx_runtime.JSX.Element;
1157
1169
 
1158
1170
  interface AIChatTriggerProps {
1159
1171
  /** Whether the chat is open */
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ export { VisuallyHidden } from './chunk-H2CIKJQI.js';
25
25
  export { QuickAction, QuickActionGroup, QuickActionIcons, quickActionIconVariants, quickActionVariants } from './chunk-3CJBUAJ4.js';
26
26
  import { RadioGroup, Radio } from './chunk-EZKRAW2X.js';
27
27
  export { Radio, RadioGroup, radioVariants } from './chunk-EZKRAW2X.js';
28
+ import { RecordButton } from './chunk-QVJBUWJQ.js';
28
29
  export { RecordButton, formatDuration, recordButtonVariants } from './chunk-QVJBUWJQ.js';
29
30
  export { DateButton, DatePicker, RadioOption, SchedulePicker, TimeButton, TimePicker, dateButtonVariants, radioOptionVariants, timeButtonVariants } from './chunk-4DMZAVB2.js';
30
31
  import { Select } from './chunk-R25H4N4Z.js';
@@ -3130,6 +3131,8 @@ var MessageComposer = React48.forwardRef(
3130
3131
  onSend,
3131
3132
  onTypingStart,
3132
3133
  onTypingStop,
3134
+ value: controlledValue,
3135
+ onValueChange,
3133
3136
  placeholder = "Type a message...",
3134
3137
  maxLength = 1600,
3135
3138
  showCharacterCount = false,
@@ -3145,10 +3148,24 @@ var MessageComposer = React48.forwardRef(
3145
3148
  replyTo = null,
3146
3149
  onCancelReply,
3147
3150
  variant = "default",
3151
+ inputTrailing,
3148
3152
  className
3149
3153
  }, ref) => {
3150
3154
  const textareaRef = React48.useRef(null);
3151
- const [content, setContent] = React48.useState("");
3155
+ const [internalContent, setInternalContent] = React48.useState("");
3156
+ const isControlled = controlledValue !== void 0;
3157
+ const content = isControlled ? controlledValue : internalContent;
3158
+ const setContent = React48.useCallback(
3159
+ (val) => {
3160
+ if (isControlled) {
3161
+ const newVal = typeof val === "function" ? val(controlledValue) : val;
3162
+ onValueChange?.(newVal);
3163
+ } else {
3164
+ setInternalContent(val);
3165
+ }
3166
+ },
3167
+ [isControlled, controlledValue, onValueChange]
3168
+ );
3152
3169
  const [attachments, setAttachments] = React48.useState(
3153
3170
  []
3154
3171
  );
@@ -3390,7 +3407,8 @@ var MessageComposer = React48.forwardRef(
3390
3407
  disabled: disabled || isSending,
3391
3408
  rows: 1,
3392
3409
  className: cn(
3393
- "w-full resize-none rounded-2xl px-4 py-2.5",
3410
+ "w-full resize-none rounded-2xl py-2.5",
3411
+ inputTrailing ? "pr-10 pl-4" : "px-4",
3394
3412
  "bg-neutral-100 dark:bg-neutral-800",
3395
3413
  "text-neutral-900 dark:text-neutral-100",
3396
3414
  "placeholder:text-neutral-400 dark:placeholder:text-neutral-500",
@@ -3403,6 +3421,14 @@ var MessageComposer = React48.forwardRef(
3403
3421
  "aria-describedby": showCharacterCount ? "char-count" : void 0
3404
3422
  }
3405
3423
  ),
3424
+ inputTrailing && /* @__PURE__ */ jsx(
3425
+ "div",
3426
+ {
3427
+ "data-slot": "composer-input-trailing",
3428
+ className: "pointer-events-none absolute top-0 right-1 flex h-[44px] items-center [&>*]:pointer-events-auto",
3429
+ children: inputTrailing
3430
+ }
3431
+ ),
3406
3432
  showCharacterCount && /* @__PURE__ */ jsx(
3407
3433
  "div",
3408
3434
  {
@@ -4678,6 +4704,9 @@ function AIChat({
4678
4704
  size,
4679
4705
  height,
4680
4706
  composerProps,
4707
+ talkToText = false,
4708
+ onRecordingStart,
4709
+ onRecordingComplete,
4681
4710
  className,
4682
4711
  onSendMessage,
4683
4712
  onToolCall: _onToolCall,
@@ -4832,6 +4861,18 @@ function AIChat({
4832
4861
  showCameraButton: false,
4833
4862
  showCharacterCount: false,
4834
4863
  variant: "minimal",
4864
+ inputTrailing: talkToText ? /* @__PURE__ */ jsx(
4865
+ RecordButton,
4866
+ {
4867
+ variant: "ghost",
4868
+ size: "sm",
4869
+ showPulse: false,
4870
+ showWaveform: true,
4871
+ disabled: isGenerating,
4872
+ onRecordingStart,
4873
+ onRecordingComplete
4874
+ }
4875
+ ) : void 0,
4835
4876
  ...composerProps
4836
4877
  }
4837
4878
  )