@fayz-ai/ui 0.24.1 → 0.25.0
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/{chunk-G73HZNFI.js → chunk-OQVFOBKU.js} +77 -4
- package/dist/{chunk-G73HZNFI.js.map → chunk-OQVFOBKU.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/primitives/dictate-button.d.ts +18 -0
- package/dist/primitives/dictate-button.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import React15__default, { useState, useRef, useEffect, useMemo, useCallback } f
|
|
|
7
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
10
|
-
import { X, ChevronDown, ChevronUp, Check, ArrowLeft, MoreHorizontal, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ImageIcon, RefreshCw, Clock, Plus, Download, Calendar, Loader2, CalendarDays, SlidersHorizontal } from 'lucide-react';
|
|
10
|
+
import { X, ChevronDown, ChevronUp, Check, ArrowLeft, MoreHorizontal, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ImageIcon, RefreshCw, Clock, Plus, Download, Calendar, Loader2, CalendarDays, MicOff, Mic, SlidersHorizontal } from 'lucide-react';
|
|
11
11
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
12
12
|
import { Toaster } from 'sonner';
|
|
13
13
|
export { toast } from 'sonner';
|
|
@@ -2350,6 +2350,79 @@ function MultiSelect({
|
|
|
2350
2350
|
)
|
|
2351
2351
|
] });
|
|
2352
2352
|
}
|
|
2353
|
+
function recognitionCtor() {
|
|
2354
|
+
if (typeof window === "undefined") return null;
|
|
2355
|
+
const w = window;
|
|
2356
|
+
return w.SpeechRecognition ?? w.webkitSpeechRecognition ?? null;
|
|
2357
|
+
}
|
|
2358
|
+
function DictateButton({
|
|
2359
|
+
onTranscript,
|
|
2360
|
+
lang,
|
|
2361
|
+
startLabel = "Ditar",
|
|
2362
|
+
stopLabel = "Parar de ditar",
|
|
2363
|
+
className,
|
|
2364
|
+
disabled
|
|
2365
|
+
}) {
|
|
2366
|
+
const [ouvindo, setOuvindo] = React15.useState(false);
|
|
2367
|
+
const [erro, setErro] = React15.useState(null);
|
|
2368
|
+
const ref = React15.useRef(null);
|
|
2369
|
+
const [suportado, setSuportado] = React15.useState(false);
|
|
2370
|
+
React15.useEffect(() => {
|
|
2371
|
+
setSuportado(recognitionCtor() !== null);
|
|
2372
|
+
}, []);
|
|
2373
|
+
React15.useEffect(() => () => {
|
|
2374
|
+
ref.current?.stop();
|
|
2375
|
+
}, []);
|
|
2376
|
+
const alternar = React15.useCallback(() => {
|
|
2377
|
+
if (ouvindo) {
|
|
2378
|
+
ref.current?.stop();
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
const Ctor = recognitionCtor();
|
|
2382
|
+
if (!Ctor) return;
|
|
2383
|
+
const rec = new Ctor();
|
|
2384
|
+
const doPagina = typeof document !== "undefined" ? document.documentElement.lang : "";
|
|
2385
|
+
rec.lang = lang ?? (doPagina || "pt-BR");
|
|
2386
|
+
rec.continuous = true;
|
|
2387
|
+
rec.interimResults = true;
|
|
2388
|
+
rec.onresult = (e) => {
|
|
2389
|
+
let texto = "";
|
|
2390
|
+
for (let i = 0; i < e.results.length; i++) texto += e.results[i][0].transcript;
|
|
2391
|
+
onTranscript(texto);
|
|
2392
|
+
};
|
|
2393
|
+
rec.onerror = (e) => {
|
|
2394
|
+
if (e?.error && e.error !== "no-speech" && e.error !== "aborted") setErro(String(e.error));
|
|
2395
|
+
setOuvindo(false);
|
|
2396
|
+
};
|
|
2397
|
+
rec.onend = () => setOuvindo(false);
|
|
2398
|
+
ref.current = rec;
|
|
2399
|
+
setErro(null);
|
|
2400
|
+
try {
|
|
2401
|
+
rec.start();
|
|
2402
|
+
setOuvindo(true);
|
|
2403
|
+
} catch {
|
|
2404
|
+
setOuvindo(false);
|
|
2405
|
+
}
|
|
2406
|
+
}, [ouvindo, lang, onTranscript]);
|
|
2407
|
+
if (!suportado) return null;
|
|
2408
|
+
return /* @__PURE__ */ jsx(
|
|
2409
|
+
"button",
|
|
2410
|
+
{
|
|
2411
|
+
type: "button",
|
|
2412
|
+
onClick: alternar,
|
|
2413
|
+
disabled,
|
|
2414
|
+
"aria-pressed": ouvindo,
|
|
2415
|
+
"aria-label": ouvindo ? stopLabel : startLabel,
|
|
2416
|
+
title: erro ? `${startLabel} \u2014 ${erro}` : ouvindo ? stopLabel : startLabel,
|
|
2417
|
+
className: cn(
|
|
2418
|
+
"fz-tap inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors",
|
|
2419
|
+
ouvindo ? "animate-pulse bg-destructive/10 text-destructive hover:bg-destructive/15" : "text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
2420
|
+
className
|
|
2421
|
+
),
|
|
2422
|
+
children: ouvindo ? /* @__PURE__ */ jsx(MicOff, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(Mic, { className: "h-3.5 w-3.5" })
|
|
2423
|
+
}
|
|
2424
|
+
);
|
|
2425
|
+
}
|
|
2353
2426
|
var INLINE_TOKEN = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g;
|
|
2354
2427
|
function renderInline(text, keyPrefix) {
|
|
2355
2428
|
return text.split(INLINE_TOKEN).map((part, i) => {
|
|
@@ -2894,6 +2967,6 @@ function StockEntryForm({
|
|
|
2894
2967
|
] }) });
|
|
2895
2968
|
}
|
|
2896
2969
|
|
|
2897
|
-
export { Badge, Breadcrumb, BulkActionBar, ChevronPager, CurrencyInput, DatePicker, DateRangeChip, DotBadge, DraftCommitBar, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterSection, Input, ListView, Markdown, MarkdownEditor, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, MultiSelect, PhoneField, PhoneLink, RefreshButton, RowActions, SearchCombobox, SearchField, SearchSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, StatTiles, StockEntryForm, Tabs, TabsContent, TabsList, TabsTrigger, Thumbnail, TimePicker, ToastProvider, WHATSAPP_BRAND_COLOR, WhatsAppIcon, badgeVariants, formatPhone2 as formatPhone, normalizePhone, renderMarkdown, setRowActionsLabel, toLocalISODate, useRowSelection };
|
|
2898
|
-
//# sourceMappingURL=chunk-
|
|
2899
|
-
//# sourceMappingURL=chunk-
|
|
2970
|
+
export { Badge, Breadcrumb, BulkActionBar, ChevronPager, CurrencyInput, DatePicker, DateRangeChip, DictateButton, DotBadge, DraftCommitBar, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterSection, Input, ListView, Markdown, MarkdownEditor, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, MultiSelect, PhoneField, PhoneLink, RefreshButton, RowActions, SearchCombobox, SearchField, SearchSelect, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, StatTiles, StockEntryForm, Tabs, TabsContent, TabsList, TabsTrigger, Thumbnail, TimePicker, ToastProvider, WHATSAPP_BRAND_COLOR, WhatsAppIcon, badgeVariants, formatPhone2 as formatPhone, normalizePhone, renderMarkdown, setRowActionsLabel, toLocalISODate, useRowSelection };
|
|
2971
|
+
//# sourceMappingURL=chunk-OQVFOBKU.js.map
|
|
2972
|
+
//# sourceMappingURL=chunk-OQVFOBKU.js.map
|