indas-ui 0.1.12 → 0.1.13

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.
@@ -14,7 +14,7 @@ const utils_1 = require("../../lib/utils.js");
14
14
  const LanguageContext_1 = require("../../contexts/LanguageContext.js");
15
15
  /** What the paperclip offers when the host does not say: images, PDFs and documents. */
16
16
  exports.DEFAULT_CHAT_ACCEPT = 'image/*,application/pdf,.doc,.docx,.txt';
17
- function MultimodalInput({ onSubmit, onStop, isLoading = false, placeholder = 'Send a message...', allowFileUpload = true, accept = exports.DEFAULT_CHAT_ACCEPT, multiple = true, attachLabel = 'Attach file', attachIcon, compact = false, disabled = false, disabledReason }) {
17
+ function MultimodalInput({ onSubmit, onStop, isLoading = false, placeholder = 'Send a message...', allowFileUpload = true, accept = exports.DEFAULT_CHAT_ACCEPT, multiple = true, attachLabel = 'Attach file', attachIcon, speechLang = 'en-IN', compact = false, disabled = false, disabledReason }) {
18
18
  // Optional: the composer is exported for host apps that have no LanguageProvider, and falls
19
19
  // back to the English source text rather than throwing.
20
20
  const { t } = (0, LanguageContext_1.useOptionalLanguage)();
@@ -43,7 +43,7 @@ function MultimodalInput({ onSubmit, onStop, isLoading = false, placeholder = 'S
43
43
  const recognition = new SpeechRecognition();
44
44
  recognition.continuous = false;
45
45
  recognition.interimResults = false;
46
- recognition.lang = 'en-IN';
46
+ recognition.lang = speechLang;
47
47
  recognition.onresult = (event) => {
48
48
  const transcript = event.results[0]?.[0]?.transcript;
49
49
  if (transcript) {
@@ -69,7 +69,7 @@ function MultimodalInput({ onSubmit, onStop, isLoading = false, placeholder = 'S
69
69
  setIsListening(false);
70
70
  recognitionRef.current = null;
71
71
  }
72
- }, [isListening]);
72
+ }, [isListening, speechLang]);
73
73
  // Cleanup on unmount
74
74
  (0, react_1.useEffect)(() => {
75
75
  return () => { recognitionRef.current?.abort(); };
@@ -25,9 +25,11 @@ interface MultimodalInputProps {
25
25
  * picker (a menu, a scan) may pass a plus. Sized by the host, e.g. `<Plus className="w-4 h-4" />`.
26
26
  */
27
27
  attachIcon?: ReactNode;
28
+ /** The language the mic listens in, as a BCP 47 tag: 'en-IN' (default), 'hi-IN' for Hindi. */
29
+ speechLang?: string;
28
30
  compact?: boolean;
29
31
  disabled?: boolean;
30
32
  disabledReason?: string;
31
33
  }
32
- export declare function MultimodalInput({ onSubmit, onStop, isLoading, placeholder, allowFileUpload, accept, multiple, attachLabel, attachIcon, compact, disabled, disabledReason }: MultimodalInputProps): import("react").JSX.Element;
34
+ export declare function MultimodalInput({ onSubmit, onStop, isLoading, placeholder, allowFileUpload, accept, multiple, attachLabel, attachIcon, speechLang, compact, disabled, disabledReason }: MultimodalInputProps): import("react").JSX.Element;
33
35
  export {};
@@ -10,7 +10,7 @@ import { cn } from '../../lib/utils.js';
10
10
  import { useOptionalLanguage } from '../../contexts/LanguageContext.js';
11
11
  /** What the paperclip offers when the host does not say: images, PDFs and documents. */
12
12
  export const DEFAULT_CHAT_ACCEPT = 'image/*,application/pdf,.doc,.docx,.txt';
13
- export function MultimodalInput({ onSubmit, onStop, isLoading = false, placeholder = 'Send a message...', allowFileUpload = true, accept = DEFAULT_CHAT_ACCEPT, multiple = true, attachLabel = 'Attach file', attachIcon, compact = false, disabled = false, disabledReason }) {
13
+ export function MultimodalInput({ onSubmit, onStop, isLoading = false, placeholder = 'Send a message...', allowFileUpload = true, accept = DEFAULT_CHAT_ACCEPT, multiple = true, attachLabel = 'Attach file', attachIcon, speechLang = 'en-IN', compact = false, disabled = false, disabledReason }) {
14
14
  // Optional: the composer is exported for host apps that have no LanguageProvider, and falls
15
15
  // back to the English source text rather than throwing.
16
16
  const { t } = useOptionalLanguage();
@@ -39,7 +39,7 @@ export function MultimodalInput({ onSubmit, onStop, isLoading = false, placehold
39
39
  const recognition = new SpeechRecognition();
40
40
  recognition.continuous = false;
41
41
  recognition.interimResults = false;
42
- recognition.lang = 'en-IN';
42
+ recognition.lang = speechLang;
43
43
  recognition.onresult = (event) => {
44
44
  const transcript = event.results[0]?.[0]?.transcript;
45
45
  if (transcript) {
@@ -65,7 +65,7 @@ export function MultimodalInput({ onSubmit, onStop, isLoading = false, placehold
65
65
  setIsListening(false);
66
66
  recognitionRef.current = null;
67
67
  }
68
- }, [isListening]);
68
+ }, [isListening, speechLang]);
69
69
  // Cleanup on unmount
70
70
  useEffect(() => {
71
71
  return () => { recognitionRef.current?.abort(); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indas-ui",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Indas UI — React component library for business apps: Tailwind design tokens, Radix primitives, Lucide icons, DataGrid, dashboards and charts.",
5
5
  "license": "MIT",
6
6
  "author": "Indas Analytics Pvt Ltd",