@fayz-ai/ui 0.42.0 → 0.43.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-47B6ISJ6.js → chunk-3HGLZIQT.js} +140 -344
- package/dist/chunk-3HGLZIQT.js.map +1 -0
- package/dist/{chunk-W7CIJU5U.js → chunk-4BP33MTZ.js} +4 -4
- package/dist/{chunk-W7CIJU5U.js.map → chunk-4BP33MTZ.js.map} +1 -1
- package/dist/{chunk-UKMRHO5B.js → chunk-L6PNGGHM.js} +713 -244
- package/dist/chunk-L6PNGGHM.js.map +1 -0
- package/dist/{chunk-GG5XY6SF.js → chunk-ZMS7TNJD.js} +149 -196
- package/dist/chunk-ZMS7TNJD.js.map +1 -0
- package/dist/dashboard/index.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/layout/AppShell.d.ts +4 -1
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/index.js +1 -1
- package/dist/primitives/bulk-action-bar.d.ts +3 -1
- package/dist/primitives/bulk-action-bar.d.ts.map +1 -1
- package/dist/primitives/data-table.d.ts +8 -1
- package/dist/primitives/data-table.d.ts.map +1 -1
- package/dist/primitives/dropdown.d.ts +2 -2
- package/dist/primitives/dropdown.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +3 -3
- package/dist/primitives/list-view.d.ts +3 -1
- package/dist/primitives/list-view.d.ts.map +1 -1
- package/dist/primitives/mobile-scrim.d.ts +29 -0
- package/dist/primitives/mobile-scrim.d.ts.map +1 -0
- package/dist/primitives/page-actions.d.ts +5 -14
- package/dist/primitives/page-actions.d.ts.map +1 -1
- package/dist/primitives/use-row-selection.d.ts +2 -0
- package/dist/primitives/use-row-selection.d.ts.map +1 -1
- package/dist/styles.css +55 -0
- package/package.json +2 -2
- package/dist/chunk-47B6ISJ6.js.map +0 -1
- package/dist/chunk-GG5XY6SF.js.map +0 -1
- package/dist/chunk-UKMRHO5B.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { COLUMN_WIDTH, useSaveBarVisible, useCrossModuleBack, useBackHandler, Hint, PageHeaderActions, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, ModalDescription, ModalFooter, SubpageHeader, PageRail, CollapsibleColumn } from './chunk-
|
|
1
|
+
import { Card, Popover, PopoverTrigger, PopoverContent, FilterMenuRow, FilterMenu, DataTable, Checkbox } from './chunk-ZMS7TNJD.js';
|
|
2
|
+
import { COLUMN_WIDTH, useSaveBarVisible, useCrossModuleBack, useBackHandler, Hint, Dropdown, DropdownTrigger, DropdownContent, DropdownSeparator, DropdownItem, useIsWide, PageHeaderActions, PageActionBar, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, ModalDescription, ModalFooter, SubpageHeader, PageRail, CollapsibleColumn } from './chunk-L6PNGGHM.js';
|
|
3
3
|
import { Button, cn } from './chunk-FKYFYGAS.js';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import { Loader2, Sparkles, ChevronDown, ChevronUp, Check, ArrowLeft, MoreHorizontal, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ImageIcon, RefreshCw, Clock, Settings, X, Plus, Download, Calendar, Pencil, CalendarDays, MicOff, Mic, ArrowRight
|
|
4
|
+
import * as React19 from 'react';
|
|
5
|
+
import React19__default, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
6
|
+
import { Loader2, Sparkles, ChevronDown, ChevronUp, Check, ArrowLeft, MoreHorizontal, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ImageIcon, RefreshCw, Clock, Settings, X, Plus, Download, Calendar, Pencil, CalendarDays, MicOff, Mic, ArrowRight } from 'lucide-react';
|
|
7
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -11,14 +11,14 @@ import { Toaster } from 'sonner';
|
|
|
11
11
|
export { toast } from 'sonner';
|
|
12
12
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
13
13
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
14
|
-
import { createPortal } from 'react-dom';
|
|
15
14
|
import { useTranslation, getCountry, unmaskPhone, maskPhone, getCurrentLocale } from '@fayz-ai/core';
|
|
15
|
+
import { createPortal } from 'react-dom';
|
|
16
16
|
|
|
17
17
|
var TONE = {
|
|
18
18
|
solid: "bg-magic text-magic-foreground border border-magic shadow-button-primary hover:bg-magic/90 active:shadow-button-inset",
|
|
19
19
|
soft: "border border-magic/30 bg-magic-soft text-magic-soft-foreground shadow-button hover:bg-magic/10 active:shadow-button-inset"
|
|
20
20
|
};
|
|
21
|
-
var AiActionButton =
|
|
21
|
+
var AiActionButton = React19.forwardRef(
|
|
22
22
|
({ busy, busyLabel, tone = "solid", className, children, disabled, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
23
23
|
Button,
|
|
24
24
|
{
|
|
@@ -50,9 +50,9 @@ function InlineLink({ tone = "solid", className, children, ...rest }) {
|
|
|
50
50
|
const button = rest;
|
|
51
51
|
return /* @__PURE__ */ jsx("button", { type: "button", className: classes, ...button, children });
|
|
52
52
|
}
|
|
53
|
-
var Input =
|
|
53
|
+
var Input = React19.forwardRef(
|
|
54
54
|
({ className, type, error, description, id, ...props }, ref) => {
|
|
55
|
-
const inputId = id ??
|
|
55
|
+
const inputId = id ?? React19.useId();
|
|
56
56
|
const descriptionId = description ? `${inputId}-description` : void 0;
|
|
57
57
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
58
58
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
@@ -130,7 +130,7 @@ function Badge({ className, variant, dot, children, ...props }) {
|
|
|
130
130
|
var Select = SelectPrimitive.Root;
|
|
131
131
|
var SelectGroup = SelectPrimitive.Group;
|
|
132
132
|
var SelectValue = SelectPrimitive.Value;
|
|
133
|
-
var SelectTrigger =
|
|
133
|
+
var SelectTrigger = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
134
134
|
SelectPrimitive.Trigger,
|
|
135
135
|
{
|
|
136
136
|
ref,
|
|
@@ -146,7 +146,7 @@ var SelectTrigger = React20.forwardRef(({ className, children, ...props }, ref)
|
|
|
146
146
|
}
|
|
147
147
|
));
|
|
148
148
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
149
|
-
var SelectScrollUpButton =
|
|
149
|
+
var SelectScrollUpButton = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
150
150
|
SelectPrimitive.ScrollUpButton,
|
|
151
151
|
{
|
|
152
152
|
ref,
|
|
@@ -159,7 +159,7 @@ var SelectScrollUpButton = React20.forwardRef(({ className, ...props }, ref) =>
|
|
|
159
159
|
}
|
|
160
160
|
));
|
|
161
161
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
162
|
-
var SelectScrollDownButton =
|
|
162
|
+
var SelectScrollDownButton = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
163
163
|
SelectPrimitive.ScrollDownButton,
|
|
164
164
|
{
|
|
165
165
|
ref,
|
|
@@ -172,7 +172,7 @@ var SelectScrollDownButton = React20.forwardRef(({ className, ...props }, ref) =
|
|
|
172
172
|
}
|
|
173
173
|
));
|
|
174
174
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
175
|
-
var SelectContent =
|
|
175
|
+
var SelectContent = React19.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
176
176
|
SelectPrimitive.Content,
|
|
177
177
|
{
|
|
178
178
|
ref,
|
|
@@ -200,7 +200,7 @@ var SelectContent = React20.forwardRef(({ className, children, position = "poppe
|
|
|
200
200
|
}
|
|
201
201
|
) }));
|
|
202
202
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
203
|
-
var SelectLabel =
|
|
203
|
+
var SelectLabel = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
204
204
|
SelectPrimitive.Label,
|
|
205
205
|
{
|
|
206
206
|
ref,
|
|
@@ -212,7 +212,7 @@ var SelectLabel = React20.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
212
212
|
}
|
|
213
213
|
));
|
|
214
214
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
215
|
-
var SelectItem =
|
|
215
|
+
var SelectItem = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
216
216
|
SelectPrimitive.Item,
|
|
217
217
|
{
|
|
218
218
|
ref,
|
|
@@ -228,7 +228,7 @@ var SelectItem = React20.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
228
228
|
}
|
|
229
229
|
));
|
|
230
230
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
231
|
-
var SelectSeparator =
|
|
231
|
+
var SelectSeparator = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
232
232
|
SelectPrimitive.Separator,
|
|
233
233
|
{
|
|
234
234
|
ref,
|
|
@@ -266,7 +266,7 @@ function ToastProvider({
|
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
var Tabs = TabsPrimitive.Root;
|
|
269
|
-
var TabsList =
|
|
269
|
+
var TabsList = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
270
270
|
TabsPrimitive.List,
|
|
271
271
|
{
|
|
272
272
|
ref,
|
|
@@ -280,7 +280,7 @@ var TabsList = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
280
280
|
}
|
|
281
281
|
));
|
|
282
282
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
283
|
-
var TabsTrigger =
|
|
283
|
+
var TabsTrigger = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
284
284
|
TabsPrimitive.Trigger,
|
|
285
285
|
{
|
|
286
286
|
ref,
|
|
@@ -292,7 +292,7 @@ var TabsTrigger = React20.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
292
292
|
}
|
|
293
293
|
));
|
|
294
294
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
295
|
-
var TabsContent =
|
|
295
|
+
var TabsContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
296
296
|
TabsPrimitive.Content,
|
|
297
297
|
{
|
|
298
298
|
ref,
|
|
@@ -304,7 +304,7 @@ var TabsContent = React20.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
304
304
|
}
|
|
305
305
|
));
|
|
306
306
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
307
|
-
var Separator2 =
|
|
307
|
+
var Separator2 = React19.forwardRef(
|
|
308
308
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
309
309
|
SeparatorPrimitive.Root,
|
|
310
310
|
{
|
|
@@ -355,7 +355,7 @@ function formatPhone(digits, fallback, countryCode) {
|
|
|
355
355
|
const tail = rest.length === 9 ? rest.slice(5) : rest.slice(4);
|
|
356
356
|
return `+55 (${ddd}) ${head}-${tail}`;
|
|
357
357
|
}
|
|
358
|
-
var PhoneLink =
|
|
358
|
+
var PhoneLink = React19.forwardRef(
|
|
359
359
|
({ phone, message, countryCode, raw, className, children, ...props }, ref) => {
|
|
360
360
|
const { e164, display } = normalizePhone(phone, countryCode);
|
|
361
361
|
const label = children ?? (raw ? phone ?? "" : display);
|
|
@@ -415,215 +415,6 @@ function Breadcrumb({ parent, current, onBack }) {
|
|
|
415
415
|
] })
|
|
416
416
|
] });
|
|
417
417
|
}
|
|
418
|
-
function iconOf(action, className) {
|
|
419
|
-
const Icon2 = action.icon;
|
|
420
|
-
return Icon2 ? /* @__PURE__ */ jsx(Icon2, { className }) : null;
|
|
421
|
-
}
|
|
422
|
-
function PageActionBar({ actions, className }) {
|
|
423
|
-
const wide = useIsWide();
|
|
424
|
-
const visible = actions.filter((a) => !a.hidden);
|
|
425
|
-
if (visible.length === 0) return null;
|
|
426
|
-
if (!wide) {
|
|
427
|
-
const usable = visible.filter((a) => !a.desktopOnly);
|
|
428
|
-
if (usable.length === 0) return null;
|
|
429
|
-
const fab = /* @__PURE__ */ jsx(PageActionFab, { actions: usable });
|
|
430
|
-
const fabHost = typeof document !== "undefined" ? document.querySelector(".shell-enter") ?? document.body : null;
|
|
431
|
-
return fabHost ? createPortal(fab, fabHost) : fab;
|
|
432
|
-
}
|
|
433
|
-
let seenPrimary = false;
|
|
434
|
-
const primary = [];
|
|
435
|
-
const secondary = [];
|
|
436
|
-
const utility = [];
|
|
437
|
-
const danger = [];
|
|
438
|
-
for (const a of visible) {
|
|
439
|
-
const intent = a.intent ?? "secondary";
|
|
440
|
-
if (intent === "primary" && !seenPrimary) {
|
|
441
|
-
seenPrimary = true;
|
|
442
|
-
primary.push(a);
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
if (intent === "danger") {
|
|
446
|
-
danger.push(a);
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
if (intent === "utility") {
|
|
450
|
-
utility.push(a);
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
secondary.push(a);
|
|
454
|
-
}
|
|
455
|
-
const head = primary[0];
|
|
456
|
-
const menu = [...secondary, ...danger];
|
|
457
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex shrink-0 items-center gap-2", className), children: [
|
|
458
|
-
utility.map((a) => (
|
|
459
|
-
// Um botão só de ícone não diz o que faz. `title=` parecia resolver e
|
|
460
|
-
// não resolve: espera ~1s que ninguém controla, sai na pintura do
|
|
461
|
-
// sistema operacional, nunca aparece no toque e vários leitores de tela
|
|
462
|
-
// pulam. Hint é o tooltip do design system, e o texto é ANUNCIADO.
|
|
463
|
-
/* @__PURE__ */ jsx(Hint, { label: a.label, children: /* @__PURE__ */ jsx(
|
|
464
|
-
Button,
|
|
465
|
-
{
|
|
466
|
-
variant: "ghost",
|
|
467
|
-
size: "icon",
|
|
468
|
-
onClick: () => void a.onSelect(),
|
|
469
|
-
disabled: a.disabled,
|
|
470
|
-
"aria-label": a.label,
|
|
471
|
-
"data-testid": a.testId,
|
|
472
|
-
"data-tour": `action.${a.id}`,
|
|
473
|
-
children: iconOf(a, "h-4 w-4")
|
|
474
|
-
}
|
|
475
|
-
) }, a.id)
|
|
476
|
-
)),
|
|
477
|
-
head && menu.length === 0 && /* @__PURE__ */ jsxs(Button, { onClick: () => void head.onSelect(), disabled: head.disabled, "data-testid": head.testId, "data-tour": `action.${head.id}`, children: [
|
|
478
|
-
iconOf(head, "mr-1.5 h-4 w-4"),
|
|
479
|
-
head.label
|
|
480
|
-
] }),
|
|
481
|
-
head && menu.length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
482
|
-
/* @__PURE__ */ jsxs(Button, { className: "rounded-r-none", onClick: () => void head.onSelect(), disabled: head.disabled, "data-testid": head.testId, "data-tour": `action.${head.id}`, children: [
|
|
483
|
-
iconOf(head, "mr-1.5 h-4 w-4"),
|
|
484
|
-
head.label
|
|
485
|
-
] }),
|
|
486
|
-
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
487
|
-
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Hint, { label: `${head.label}\u2026`, children: /* @__PURE__ */ jsx(
|
|
488
|
-
Button,
|
|
489
|
-
{
|
|
490
|
-
className: "-ml-px rounded-l-none px-2",
|
|
491
|
-
"aria-label": `${head.label}\u2026`,
|
|
492
|
-
"data-tour": menu.map((a) => `action.${a.id}`).join(" "),
|
|
493
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
494
|
-
}
|
|
495
|
-
) }) }),
|
|
496
|
-
/* @__PURE__ */ jsx(DropdownContent, { align: "end", className: "w-56", children: /* @__PURE__ */ jsx(ActionItems, { actions: menu }) })
|
|
497
|
-
] })
|
|
498
|
-
] }),
|
|
499
|
-
!head && menu.length > 0 && /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
500
|
-
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Hint, { label: "A\xE7\xF5es", children: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", "aria-label": "A\xE7\xF5es", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }) }),
|
|
501
|
-
/* @__PURE__ */ jsx(DropdownContent, { align: "end", className: "w-56", children: /* @__PURE__ */ jsx(ActionItems, { actions: menu }) })
|
|
502
|
-
] })
|
|
503
|
-
] });
|
|
504
|
-
}
|
|
505
|
-
function ActionItems({ actions, stagger }) {
|
|
506
|
-
const out = [];
|
|
507
|
-
actions.forEach((a, i) => {
|
|
508
|
-
const isDanger = a.intent === "danger";
|
|
509
|
-
const prevSafe = i > 0 && actions[i - 1].intent !== "danger";
|
|
510
|
-
if (isDanger && prevSafe) out.push(/* @__PURE__ */ jsx(DropdownSeparator, {}, `${a.id}-sep`));
|
|
511
|
-
out.push(
|
|
512
|
-
/* @__PURE__ */ jsxs(
|
|
513
|
-
DropdownItem,
|
|
514
|
-
{
|
|
515
|
-
disabled: a.disabled,
|
|
516
|
-
onSelect: () => void a.onSelect(),
|
|
517
|
-
"data-testid": a.testId,
|
|
518
|
-
style: stagger ? { ["--i"]: i } : void 0,
|
|
519
|
-
className: cn("gap-2", stagger && "fz-fab-item", isDanger && "text-destructive focus:text-destructive"),
|
|
520
|
-
children: [
|
|
521
|
-
iconOf(a, "h-4 w-4 shrink-0"),
|
|
522
|
-
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
523
|
-
/* @__PURE__ */ jsx("span", { className: "block truncate", children: a.label }),
|
|
524
|
-
a.description && /* @__PURE__ */ jsx("span", { className: "block truncate text-xs text-muted-foreground", children: a.description })
|
|
525
|
-
] })
|
|
526
|
-
]
|
|
527
|
-
},
|
|
528
|
-
a.id
|
|
529
|
-
)
|
|
530
|
-
);
|
|
531
|
-
});
|
|
532
|
-
return /* @__PURE__ */ jsx(Fragment, { children: out });
|
|
533
|
-
}
|
|
534
|
-
function PageActionFab({ actions }) {
|
|
535
|
-
const byIntent = (i) => actions.filter((a) => (a.intent ?? "secondary") === i);
|
|
536
|
-
const utility = byIntent("utility");
|
|
537
|
-
const main = [...byIntent("primary"), ...byIntent("secondary"), ...byIntent("danger")];
|
|
538
|
-
if (main.length === 0) return /* @__PURE__ */ jsx(FabButton, { actions: utility, tone: "neutral" });
|
|
539
|
-
const isCreate = main.every((a) => a.creates ?? a.icon === Plus);
|
|
540
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
541
|
-
utility.length > 0 && /* @__PURE__ */ jsx(FabButton, { actions: utility, tone: "neutral", mini: true }),
|
|
542
|
-
/* @__PURE__ */ jsx(FabButton, { actions: main, tone: isCreate ? "primary" : "neutral" })
|
|
543
|
-
] });
|
|
544
|
-
}
|
|
545
|
-
function useScrim(open) {
|
|
546
|
-
const [mounted, setMounted] = React20.useState(open);
|
|
547
|
-
const [visible, setVisible] = React20.useState(open);
|
|
548
|
-
React20.useEffect(() => {
|
|
549
|
-
if (open) {
|
|
550
|
-
setMounted(true);
|
|
551
|
-
const frame = requestAnimationFrame(() => setVisible(true));
|
|
552
|
-
return () => cancelAnimationFrame(frame);
|
|
553
|
-
}
|
|
554
|
-
setVisible(false);
|
|
555
|
-
const timer = window.setTimeout(() => setMounted(false), SCRIM_MS);
|
|
556
|
-
return () => window.clearTimeout(timer);
|
|
557
|
-
}, [open]);
|
|
558
|
-
return { mounted, visible };
|
|
559
|
-
}
|
|
560
|
-
var SCRIM_MS = 200;
|
|
561
|
-
function FabButton({ actions, tone, mini }) {
|
|
562
|
-
const [open, setOpen] = React20.useState(false);
|
|
563
|
-
const scrim = useScrim(open);
|
|
564
|
-
if (actions.length === 0) return null;
|
|
565
|
-
const isCreate = tone === "primary";
|
|
566
|
-
const FabIcon = isCreate ? Plus : MoreVertical;
|
|
567
|
-
const style = {
|
|
568
|
-
bottom: mini ? "calc(var(--fz-bottom-bar, 0px) + 4.75rem)" : "calc(var(--fz-bottom-bar, 0px) + 1rem)"
|
|
569
|
-
};
|
|
570
|
-
const shell = cn(
|
|
571
|
-
"fz-tap fixed z-40 flex items-center justify-center rounded-full",
|
|
572
|
-
"transition-transform active:scale-95 md:hidden",
|
|
573
|
-
// Centred on the main circle's column, so the two read as one stack.
|
|
574
|
-
mini ? "right-5 h-12 w-12" : "right-4 h-14 w-14",
|
|
575
|
-
isCreate ? "bg-primary text-primary-foreground shadow-lg shadow-primary/30 ring-4 ring-background" : "bg-card text-foreground shadow-lg ring-1 ring-border"
|
|
576
|
-
);
|
|
577
|
-
if (actions.length === 1) {
|
|
578
|
-
const only = actions[0];
|
|
579
|
-
const Icon2 = only.icon ?? FabIcon;
|
|
580
|
-
return /* @__PURE__ */ jsx(
|
|
581
|
-
"button",
|
|
582
|
-
{
|
|
583
|
-
type: "button",
|
|
584
|
-
style,
|
|
585
|
-
className: shell,
|
|
586
|
-
onClick: () => void only.onSelect(),
|
|
587
|
-
disabled: only.disabled,
|
|
588
|
-
"aria-label": only.label,
|
|
589
|
-
"data-testid": only.testId,
|
|
590
|
-
children: /* @__PURE__ */ jsx(Icon2, { className: mini ? "h-5 w-5" : "h-6 w-6" })
|
|
591
|
-
}
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
595
|
-
scrim.mounted && typeof document !== "undefined" && createPortal(
|
|
596
|
-
/* @__PURE__ */ jsx(
|
|
597
|
-
"div",
|
|
598
|
-
{
|
|
599
|
-
"aria-hidden": true,
|
|
600
|
-
onClick: () => setOpen(false),
|
|
601
|
-
className: cn(
|
|
602
|
-
"fixed inset-0 z-[100] bg-foreground/40 transition-opacity duration-200 md:hidden",
|
|
603
|
-
"motion-reduce:transition-none",
|
|
604
|
-
scrim.visible ? "opacity-100" : "opacity-0"
|
|
605
|
-
)
|
|
606
|
-
}
|
|
607
|
-
),
|
|
608
|
-
document.body
|
|
609
|
-
),
|
|
610
|
-
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
611
|
-
"button",
|
|
612
|
-
{
|
|
613
|
-
type: "button",
|
|
614
|
-
style,
|
|
615
|
-
className: cn(shell, open && "z-[105]", isCreate && "fz-fab-trigger"),
|
|
616
|
-
"aria-label": actionsMenuLabel,
|
|
617
|
-
children: /* @__PURE__ */ jsx(FabIcon, { className: mini ? "h-5 w-5" : "h-6 w-6" })
|
|
618
|
-
}
|
|
619
|
-
) }),
|
|
620
|
-
/* @__PURE__ */ jsx(DropdownContent, { side: "top", align: "end", sideOffset: 12, className: "fz-fab-menu w-60 md:hidden", children: /* @__PURE__ */ jsx(ActionItems, { actions, stagger: true }) })
|
|
621
|
-
] });
|
|
622
|
-
}
|
|
623
|
-
var actionsMenuLabel = "A\xE7\xF5es";
|
|
624
|
-
function setActionsMenuLabel(label) {
|
|
625
|
-
actionsMenuLabel = label;
|
|
626
|
-
}
|
|
627
418
|
var INLINE_LIMIT = 2;
|
|
628
419
|
function RowActions({
|
|
629
420
|
actions,
|
|
@@ -672,7 +463,7 @@ function RowActions({
|
|
|
672
463
|
const Icon2 = a.icon;
|
|
673
464
|
const isDanger = a.intent === "danger";
|
|
674
465
|
const prevSafe = i > 0 && overflow[i - 1].intent !== "danger";
|
|
675
|
-
return /* @__PURE__ */ jsxs(
|
|
466
|
+
return /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
676
467
|
isDanger && prevSafe && /* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
677
468
|
/* @__PURE__ */ jsxs(
|
|
678
469
|
DropdownItem,
|
|
@@ -794,12 +585,14 @@ function BulkActionBar({
|
|
|
794
585
|
total,
|
|
795
586
|
onSelectAll,
|
|
796
587
|
onClear,
|
|
797
|
-
actions = [],
|
|
588
|
+
actions: declared = [],
|
|
798
589
|
variant = "band",
|
|
799
590
|
className
|
|
800
591
|
}) {
|
|
801
592
|
const t = useTranslation();
|
|
593
|
+
const wide = useIsWide();
|
|
802
594
|
if (count === 0) return null;
|
|
595
|
+
const actions = wide ? declared : declared.filter((a) => !a.desktopOnly);
|
|
803
596
|
const inline = actions.filter((a) => !a.overflow);
|
|
804
597
|
const overflow = actions.filter((a) => a.overflow);
|
|
805
598
|
return /* @__PURE__ */ jsxs(
|
|
@@ -923,8 +716,8 @@ var ICON_CLASSES = {
|
|
|
923
716
|
lg: "h-5 w-5"
|
|
924
717
|
};
|
|
925
718
|
function Thumbnail({ src, alt = "", size = "md", icon: Icon2 = ImageIcon, className }) {
|
|
926
|
-
const [failed, setFailed] =
|
|
927
|
-
|
|
719
|
+
const [failed, setFailed] = React19.useState(false);
|
|
720
|
+
React19.useEffect(() => {
|
|
928
721
|
setFailed(false);
|
|
929
722
|
}, [src]);
|
|
930
723
|
const base = cn("shrink-0 overflow-hidden", SIZE_CLASSES[size], className);
|
|
@@ -951,9 +744,9 @@ function Thumbnail({ src, alt = "", size = "md", icon: Icon2 = ImageIcon, classN
|
|
|
951
744
|
}
|
|
952
745
|
Thumbnail.displayName = "Thumbnail";
|
|
953
746
|
function RefreshButton({ onRefresh, fromCache, label, labelCached, className, ...rest }) {
|
|
954
|
-
const [phase, setPhase] =
|
|
955
|
-
const alive =
|
|
956
|
-
|
|
747
|
+
const [phase, setPhase] = React19.useState("idle");
|
|
748
|
+
const alive = React19.useRef(true);
|
|
749
|
+
React19.useEffect(() => () => {
|
|
957
750
|
alive.current = false;
|
|
958
751
|
}, []);
|
|
959
752
|
const title = fromCache ? labelCached ?? label : label;
|
|
@@ -1175,27 +968,27 @@ function useRowSelection({
|
|
|
1175
968
|
getRowId,
|
|
1176
969
|
enabled = true
|
|
1177
970
|
}) {
|
|
1178
|
-
const identify =
|
|
971
|
+
const identify = React19.useCallback(
|
|
1179
972
|
(row) => getRowId ? getRowId(row) : String(row?.id ?? ""),
|
|
1180
973
|
[getRowId]
|
|
1181
974
|
);
|
|
1182
|
-
const visible =
|
|
1183
|
-
const [rawSelection, setRawSelection] =
|
|
1184
|
-
const visibleIds =
|
|
1185
|
-
const selectedIds =
|
|
975
|
+
const visible = React19.useMemo(() => rows ?? [], [rows]);
|
|
976
|
+
const [rawSelection, setRawSelection] = React19.useState([]);
|
|
977
|
+
const visibleIds = React19.useMemo(() => new Set(visible.map(identify)), [visible, identify]);
|
|
978
|
+
const selectedIds = React19.useMemo(
|
|
1186
979
|
() => rawSelection.filter((id) => visibleIds.has(id)),
|
|
1187
980
|
[rawSelection, visibleIds]
|
|
1188
981
|
);
|
|
1189
|
-
const selectedRows =
|
|
982
|
+
const selectedRows = React19.useMemo(() => {
|
|
1190
983
|
const picked = new Set(selectedIds);
|
|
1191
984
|
return visible.filter((row) => picked.has(identify(row)));
|
|
1192
985
|
}, [visible, selectedIds, identify]);
|
|
1193
|
-
const clear =
|
|
1194
|
-
const selectAll =
|
|
986
|
+
const clear = React19.useCallback(() => setRawSelection([]), []);
|
|
987
|
+
const selectAll = React19.useCallback(
|
|
1195
988
|
() => setRawSelection(visible.map(identify)),
|
|
1196
989
|
[visible, identify]
|
|
1197
990
|
);
|
|
1198
|
-
const barActions =
|
|
991
|
+
const barActions = React19.useMemo(
|
|
1199
992
|
() => (actions ?? []).map((action) => ({
|
|
1200
993
|
id: action.id,
|
|
1201
994
|
label: action.label,
|
|
@@ -1203,6 +996,7 @@ function useRowSelection({
|
|
|
1203
996
|
destructive: action.destructive,
|
|
1204
997
|
overflow: action.overflow,
|
|
1205
998
|
disabled: action.disabled,
|
|
999
|
+
desktopOnly: action.desktopOnly,
|
|
1206
1000
|
onSelect: () => action.onSelect(selectedRows)
|
|
1207
1001
|
})),
|
|
1208
1002
|
[actions, selectedRows]
|
|
@@ -1257,7 +1051,7 @@ function ChoiceList({
|
|
|
1257
1051
|
onDone,
|
|
1258
1052
|
className
|
|
1259
1053
|
}) {
|
|
1260
|
-
const [query, setQuery] =
|
|
1054
|
+
const [query, setQuery] = React19.useState("");
|
|
1261
1055
|
const withSearch = choiceSearchable(options.length, searchable);
|
|
1262
1056
|
const q = query.trim().toLowerCase();
|
|
1263
1057
|
const shown = q ? options.filter((o) => o.label.toLowerCase().includes(q)) : options;
|
|
@@ -1323,7 +1117,7 @@ function ChoiceSelect({
|
|
|
1323
1117
|
"aria-label": ariaLabel,
|
|
1324
1118
|
...list
|
|
1325
1119
|
}) {
|
|
1326
|
-
const [open, setOpen] =
|
|
1120
|
+
const [open, setOpen] = React19.useState(false);
|
|
1327
1121
|
const current = options.find((o) => o.value === value);
|
|
1328
1122
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
1329
1123
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
@@ -1347,7 +1141,7 @@ function ChoiceSelect({
|
|
|
1347
1141
|
] });
|
|
1348
1142
|
}
|
|
1349
1143
|
function FilterChip({ allLabel, options, value, onChange, label, icon: Icon2, searchable, searchPlaceholder, manage, className }) {
|
|
1350
|
-
const [open, setOpen] =
|
|
1144
|
+
const [open, setOpen] = React19.useState(false);
|
|
1351
1145
|
const active = value != null && value !== "";
|
|
1352
1146
|
const current = options.find((o) => o.value === value);
|
|
1353
1147
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
@@ -1395,10 +1189,10 @@ function ListFilterBar({
|
|
|
1395
1189
|
className
|
|
1396
1190
|
}) {
|
|
1397
1191
|
const wide = useIsWide();
|
|
1398
|
-
const usable =
|
|
1192
|
+
const usable = React19.useMemo(() => (filters ?? []).filter((f) => f.options.length > 0), [filters]);
|
|
1399
1193
|
const active = usable.filter((f) => f.value != null && f.value !== "");
|
|
1400
1194
|
const total = activeCount ?? active.length;
|
|
1401
|
-
const fields =
|
|
1195
|
+
const fields = React19.useMemo(() => [
|
|
1402
1196
|
...usable.map((f) => ({
|
|
1403
1197
|
id: f.id,
|
|
1404
1198
|
label: f.label,
|
|
@@ -1533,6 +1327,7 @@ function ListView({
|
|
|
1533
1327
|
refreshLabel = "Refresh",
|
|
1534
1328
|
className,
|
|
1535
1329
|
rowClassName,
|
|
1330
|
+
mobileLayout = "cards",
|
|
1536
1331
|
actions
|
|
1537
1332
|
}) {
|
|
1538
1333
|
const [internalSearch, setInternalSearch] = useState(controlledSearch ?? "");
|
|
@@ -1556,7 +1351,7 @@ function ListView({
|
|
|
1556
1351
|
const showSearch = !!onSearchChange;
|
|
1557
1352
|
const showTags = tags && tags.length > 0 && onTagChange;
|
|
1558
1353
|
const selection = useRowSelection({ rows: loading ? [] : data, actions: bulkActions, getRowId });
|
|
1559
|
-
const allFilters =
|
|
1354
|
+
const allFilters = React19.useMemo(() => [
|
|
1560
1355
|
...showTags ? [{
|
|
1561
1356
|
id: "__tag",
|
|
1562
1357
|
label: tagsLabel ?? allTagLabel,
|
|
@@ -1642,7 +1437,7 @@ function ListView({
|
|
|
1642
1437
|
),
|
|
1643
1438
|
filtersTrigger,
|
|
1644
1439
|
onRefresh && /* @__PURE__ */ jsx(Hint, { label: refreshLabel, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": refreshLabel, onClick: onRefresh, className: ICON_BTN, children: /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }) }) }),
|
|
1645
|
-
onExport && /* @__PURE__ */ jsx(Hint, { label: exportLabel, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": exportLabel, onClick: onExport, className: ICON_BTN, children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" }) }) })
|
|
1440
|
+
onExport && /* @__PURE__ */ jsx(Hint, { label: exportLabel, children: /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": exportLabel, onClick: onExport, className: cn(ICON_BTN, "hidden md:inline-flex"), children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" }) }) })
|
|
1646
1441
|
] })
|
|
1647
1442
|
] }) }),
|
|
1648
1443
|
/* @__PURE__ */ jsx(
|
|
@@ -1659,7 +1454,8 @@ function ListView({
|
|
|
1659
1454
|
selectedIds: selection.selectedIds,
|
|
1660
1455
|
onSelectedIdsChange: selection.setSelectedIds,
|
|
1661
1456
|
getRowId,
|
|
1662
|
-
rowClassName
|
|
1457
|
+
rowClassName,
|
|
1458
|
+
mobileLayout
|
|
1663
1459
|
}
|
|
1664
1460
|
),
|
|
1665
1461
|
showPagination && /* @__PURE__ */ jsxs("div", { className: "-mt-px flex min-h-9 flex-col items-center gap-2 rounded-b-card border-t border-border px-3 py-2 sm:grid sm:grid-cols-[1fr_auto_1fr] sm:gap-3", children: [
|
|
@@ -1949,7 +1745,7 @@ function toLocalISODate(d) {
|
|
|
1949
1745
|
}
|
|
1950
1746
|
function MiniCalendar({ selectedDate, onDateSelect, onMonthChange, markers }) {
|
|
1951
1747
|
const locale = getCurrentLocale();
|
|
1952
|
-
const [viewMonth, setViewMonth] =
|
|
1748
|
+
const [viewMonth, setViewMonth] = React19__default.useState(() => new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1));
|
|
1953
1749
|
const monthLabel = viewMonth.toLocaleDateString(toDateLocale2(locale), { month: "long", year: "numeric" });
|
|
1954
1750
|
const dayLabels = DAY_LABELS2[locale] ?? DAY_LABELS2.en;
|
|
1955
1751
|
const weeks = useMemo(() => {
|
|
@@ -2029,7 +1825,7 @@ function FilterSection({
|
|
|
2029
1825
|
count,
|
|
2030
1826
|
children
|
|
2031
1827
|
}) {
|
|
2032
|
-
const [open, setOpen] =
|
|
1828
|
+
const [open, setOpen] = React19__default.useState(defaultOpen);
|
|
2033
1829
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2034
1830
|
/* @__PURE__ */ jsxs(
|
|
2035
1831
|
"button",
|
|
@@ -2105,7 +1901,7 @@ function FilterCheckList({
|
|
|
2105
1901
|
}
|
|
2106
1902
|
return /* @__PURE__ */ jsx("div", { className: className ? `${className} space-y-0.5` : "space-y-0.5", children: rows });
|
|
2107
1903
|
}
|
|
2108
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1904
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React19.useLayoutEffect : React19.useEffect;
|
|
2109
1905
|
function SearchSelect({
|
|
2110
1906
|
value,
|
|
2111
1907
|
displayValue,
|
|
@@ -2140,19 +1936,19 @@ function SearchSelect({
|
|
|
2140
1936
|
}) {
|
|
2141
1937
|
const isRequiredFilter = variant === "required-filter";
|
|
2142
1938
|
const canCreate = !!onCreate && allowCreate !== false;
|
|
2143
|
-
const [open, setOpen] =
|
|
2144
|
-
const [query, setQuery] =
|
|
2145
|
-
const [results, setResults] =
|
|
2146
|
-
const [loading, setLoading] =
|
|
2147
|
-
const [creating, setCreating] =
|
|
2148
|
-
const [selectedLabel, setSelectedLabel] =
|
|
2149
|
-
const containerRef =
|
|
2150
|
-
const inputRef =
|
|
2151
|
-
const timerRef =
|
|
2152
|
-
const [rect, setRect] =
|
|
2153
|
-
const dropdownRef =
|
|
2154
|
-
const requestRef =
|
|
2155
|
-
|
|
1939
|
+
const [open, setOpen] = React19.useState(false);
|
|
1940
|
+
const [query, setQuery] = React19.useState("");
|
|
1941
|
+
const [results, setResults] = React19.useState([]);
|
|
1942
|
+
const [loading, setLoading] = React19.useState(false);
|
|
1943
|
+
const [creating, setCreating] = React19.useState(false);
|
|
1944
|
+
const [selectedLabel, setSelectedLabel] = React19.useState(displayValue ?? "");
|
|
1945
|
+
const containerRef = React19.useRef(null);
|
|
1946
|
+
const inputRef = React19.useRef(null);
|
|
1947
|
+
const timerRef = React19.useRef();
|
|
1948
|
+
const [rect, setRect] = React19.useState(null);
|
|
1949
|
+
const dropdownRef = React19.useRef(null);
|
|
1950
|
+
const requestRef = React19.useRef(0);
|
|
1951
|
+
React19.useEffect(() => {
|
|
2156
1952
|
function handler(e) {
|
|
2157
1953
|
const target = e.target;
|
|
2158
1954
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -2162,10 +1958,10 @@ function SearchSelect({
|
|
|
2162
1958
|
document.addEventListener("mousedown", handler);
|
|
2163
1959
|
return () => document.removeEventListener("mousedown", handler);
|
|
2164
1960
|
}, []);
|
|
2165
|
-
|
|
1961
|
+
React19.useEffect(() => {
|
|
2166
1962
|
if (displayValue !== void 0) setSelectedLabel(displayValue);
|
|
2167
1963
|
}, [displayValue]);
|
|
2168
|
-
|
|
1964
|
+
React19.useEffect(() => {
|
|
2169
1965
|
if (open && loadOnOpen && query.length === 0 && results.length === 0 && !loading) {
|
|
2170
1966
|
const request = ++requestRef.current;
|
|
2171
1967
|
setLoading(true);
|
|
@@ -2233,7 +2029,7 @@ function SearchSelect({
|
|
|
2233
2029
|
setResults([]);
|
|
2234
2030
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
2235
2031
|
}
|
|
2236
|
-
const groups =
|
|
2032
|
+
const groups = React19.useMemo(() => {
|
|
2237
2033
|
const map = /* @__PURE__ */ new Map();
|
|
2238
2034
|
for (const opt of results) {
|
|
2239
2035
|
const group = opt.group ?? "";
|
|
@@ -2429,7 +2225,7 @@ function SearchSelect({
|
|
|
2429
2225
|
]
|
|
2430
2226
|
},
|
|
2431
2227
|
group
|
|
2432
|
-
)) }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 min-h-0 flex-1 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(
|
|
2228
|
+
)) }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 min-h-0 flex-1 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
2433
2229
|
group && /* @__PURE__ */ jsx("div", { className: "sticky top-0 bg-muted/50 px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground", children: group }),
|
|
2434
2230
|
options.map(optionButton)
|
|
2435
2231
|
] }, group)) }),
|
|
@@ -2473,9 +2269,9 @@ function CurrencyInput({
|
|
|
2473
2269
|
className,
|
|
2474
2270
|
disabled
|
|
2475
2271
|
}) {
|
|
2476
|
-
const inputRef =
|
|
2477
|
-
const [focused, setFocused] =
|
|
2478
|
-
const format =
|
|
2272
|
+
const inputRef = React19.useRef(null);
|
|
2273
|
+
const [focused, setFocused] = React19.useState(false);
|
|
2274
|
+
const format = React19.useCallback((v) => {
|
|
2479
2275
|
return new Intl.NumberFormat(locale, {
|
|
2480
2276
|
minimumFractionDigits: 2,
|
|
2481
2277
|
maximumFractionDigits: 2
|
|
@@ -2602,9 +2398,9 @@ function RequiredFilter({
|
|
|
2602
2398
|
className,
|
|
2603
2399
|
contentClassName
|
|
2604
2400
|
}) {
|
|
2605
|
-
const [open, setOpen] =
|
|
2401
|
+
const [open, setOpen] = React19.useState(false);
|
|
2606
2402
|
const missing = !value;
|
|
2607
|
-
const close =
|
|
2403
|
+
const close = React19.useCallback(() => setOpen(false), []);
|
|
2608
2404
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
2609
2405
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2610
2406
|
"button",
|
|
@@ -2650,9 +2446,9 @@ function FilterPanel({
|
|
|
2650
2446
|
className
|
|
2651
2447
|
}) {
|
|
2652
2448
|
const blocked = Boolean(applyDisabledReason);
|
|
2653
|
-
const [aberto, setAberto] =
|
|
2654
|
-
const jaAbriu =
|
|
2655
|
-
|
|
2449
|
+
const [aberto, setAberto] = React19.useState(Boolean(advancedCount));
|
|
2450
|
+
const jaAbriu = React19.useRef(Boolean(advancedCount));
|
|
2451
|
+
React19.useEffect(() => {
|
|
2656
2452
|
if (advancedCount && !jaAbriu.current) {
|
|
2657
2453
|
jaAbriu.current = true;
|
|
2658
2454
|
setAberto(true);
|
|
@@ -2727,23 +2523,23 @@ function FilterPanelField({ label, compact, required, className, children }) {
|
|
|
2727
2523
|
}
|
|
2728
2524
|
FilterPanelField.displayName = "FilterPanelField";
|
|
2729
2525
|
function useFilterDraft(initial) {
|
|
2730
|
-
const inicial =
|
|
2731
|
-
const [draft, setDraft] =
|
|
2732
|
-
const [applied, setApplied] =
|
|
2733
|
-
const dirty =
|
|
2526
|
+
const inicial = React19.useRef(initial);
|
|
2527
|
+
const [draft, setDraft] = React19.useState(initial);
|
|
2528
|
+
const [applied, setApplied] = React19.useState(initial);
|
|
2529
|
+
const dirty = React19.useMemo(
|
|
2734
2530
|
() => JSON.stringify(draft) !== JSON.stringify(applied),
|
|
2735
2531
|
[draft, applied]
|
|
2736
2532
|
);
|
|
2737
|
-
const patch =
|
|
2533
|
+
const patch = React19.useCallback((changes) => {
|
|
2738
2534
|
setDraft((atual) => ({ ...atual, ...changes }));
|
|
2739
2535
|
}, []);
|
|
2740
|
-
const apply =
|
|
2536
|
+
const apply = React19.useCallback(() => {
|
|
2741
2537
|
setDraft((atual) => {
|
|
2742
2538
|
setApplied(atual);
|
|
2743
2539
|
return atual;
|
|
2744
2540
|
});
|
|
2745
2541
|
}, []);
|
|
2746
|
-
const reset =
|
|
2542
|
+
const reset = React19.useCallback((value) => {
|
|
2747
2543
|
const alvo = value ?? inicial.current;
|
|
2748
2544
|
setDraft(alvo);
|
|
2749
2545
|
setApplied(alvo);
|
|
@@ -2779,7 +2575,7 @@ function DateRangeChip({
|
|
|
2779
2575
|
label,
|
|
2780
2576
|
className
|
|
2781
2577
|
}) {
|
|
2782
|
-
const [open, setOpen] =
|
|
2578
|
+
const [open, setOpen] = React19.useState(false);
|
|
2783
2579
|
const active = !!(from || to);
|
|
2784
2580
|
const locale = typeof navigator !== "undefined" ? navigator.language : "en";
|
|
2785
2581
|
const presetLabel = presets.find((p) => p.value === preset)?.label;
|
|
@@ -2884,9 +2680,9 @@ function MultiSelect({
|
|
|
2884
2680
|
variant = "field",
|
|
2885
2681
|
icon: Icon2
|
|
2886
2682
|
}) {
|
|
2887
|
-
const [query, setQuery] =
|
|
2888
|
-
const selected =
|
|
2889
|
-
const filtered =
|
|
2683
|
+
const [query, setQuery] = React19.useState("");
|
|
2684
|
+
const selected = React19.useMemo(() => new Set(value), [value]);
|
|
2685
|
+
const filtered = React19.useMemo(() => {
|
|
2890
2686
|
const q = query.trim().toLowerCase();
|
|
2891
2687
|
if (!q) return options;
|
|
2892
2688
|
return options.filter((o) => o.label.toLowerCase().includes(q));
|
|
@@ -3024,8 +2820,8 @@ function hueFor(name) {
|
|
|
3024
2820
|
return AVATAR_HUES[h % AVATAR_HUES.length];
|
|
3025
2821
|
}
|
|
3026
2822
|
function PersonAvatar({ name, src, size = "sm", className }) {
|
|
3027
|
-
const [failed, setFailed] =
|
|
3028
|
-
|
|
2823
|
+
const [failed, setFailed] = React19.useState(false);
|
|
2824
|
+
React19.useEffect(() => {
|
|
3029
2825
|
setFailed(false);
|
|
3030
2826
|
}, [src]);
|
|
3031
2827
|
const base = cn("shrink-0 overflow-hidden rounded-full", AVATAR_SIZE[size], className);
|
|
@@ -3065,7 +2861,7 @@ function ListShell({
|
|
|
3065
2861
|
footer,
|
|
3066
2862
|
children
|
|
3067
2863
|
}) {
|
|
3068
|
-
const filtered =
|
|
2864
|
+
const filtered = React19.useMemo(() => {
|
|
3069
2865
|
const q = query.trim().toLowerCase();
|
|
3070
2866
|
if (!q) return options;
|
|
3071
2867
|
return options.filter((o) => o.name.toLowerCase().includes(q));
|
|
@@ -3088,7 +2884,7 @@ function ListShell({
|
|
|
3088
2884
|
)
|
|
3089
2885
|
] }),
|
|
3090
2886
|
/* @__PURE__ */ jsxs("div", { className: "max-h-72 overflow-y-auto py-1", children: [
|
|
3091
|
-
filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-3 py-5 text-center text-xs text-muted-foreground", children: emptyLabel }) : filtered.map((o) => /* @__PURE__ */ jsx(
|
|
2887
|
+
filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-3 py-5 text-center text-xs text-muted-foreground", children: emptyLabel }) : filtered.map((o) => /* @__PURE__ */ jsx(React19.Fragment, { children: children(o) }, o.id)),
|
|
3092
2888
|
footer
|
|
3093
2889
|
] })
|
|
3094
2890
|
] });
|
|
@@ -3123,8 +2919,8 @@ function PersonPicker({
|
|
|
3123
2919
|
onClear,
|
|
3124
2920
|
variant = "input"
|
|
3125
2921
|
}) {
|
|
3126
|
-
const [query, setQuery] =
|
|
3127
|
-
const [open, setOpen] =
|
|
2922
|
+
const [query, setQuery] = React19.useState("");
|
|
2923
|
+
const [open, setOpen] = React19.useState(false);
|
|
3128
2924
|
const current = options.find((o) => o.id === value);
|
|
3129
2925
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
3130
2926
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs("button", { type: "button", disabled, className: cn(TRIGGER_CLASSES[variant], className), children: [
|
|
@@ -3202,8 +2998,8 @@ function PersonMultiPicker({
|
|
|
3202
2998
|
max,
|
|
3203
2999
|
variant = "input"
|
|
3204
3000
|
}) {
|
|
3205
|
-
const [query, setQuery] =
|
|
3206
|
-
const selected =
|
|
3001
|
+
const [query, setQuery] = React19.useState("");
|
|
3002
|
+
const selected = React19.useMemo(() => new Set(value), [value]);
|
|
3207
3003
|
const atCeiling = max != null && value.length >= max;
|
|
3208
3004
|
function toggle(id) {
|
|
3209
3005
|
if (selected.has(id)) onChange(value.filter((x) => x !== id));
|
|
@@ -3302,17 +3098,17 @@ function DictateButton({
|
|
|
3302
3098
|
className,
|
|
3303
3099
|
disabled
|
|
3304
3100
|
}) {
|
|
3305
|
-
const [ouvindo, setOuvindo] =
|
|
3306
|
-
const [erro, setErro] =
|
|
3307
|
-
const ref =
|
|
3308
|
-
const [suportado, setSuportado] =
|
|
3309
|
-
|
|
3101
|
+
const [ouvindo, setOuvindo] = React19.useState(false);
|
|
3102
|
+
const [erro, setErro] = React19.useState(null);
|
|
3103
|
+
const ref = React19.useRef(null);
|
|
3104
|
+
const [suportado, setSuportado] = React19.useState(false);
|
|
3105
|
+
React19.useEffect(() => {
|
|
3310
3106
|
setSuportado(recognitionCtor() !== null);
|
|
3311
3107
|
}, []);
|
|
3312
|
-
|
|
3108
|
+
React19.useEffect(() => () => {
|
|
3313
3109
|
ref.current?.stop();
|
|
3314
3110
|
}, []);
|
|
3315
|
-
const alternar =
|
|
3111
|
+
const alternar = React19.useCallback(() => {
|
|
3316
3112
|
if (ouvindo) {
|
|
3317
3113
|
ref.current?.stop();
|
|
3318
3114
|
return;
|
|
@@ -3375,7 +3171,7 @@ function renderInline(text, keyPrefix) {
|
|
|
3375
3171
|
if (part.startsWith("`") && part.endsWith("`") && part.length > 2) {
|
|
3376
3172
|
return /* @__PURE__ */ jsx("code", { className: "rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]", children: part.slice(1, -1) }, key);
|
|
3377
3173
|
}
|
|
3378
|
-
return part === "" ? null : /* @__PURE__ */ jsx(
|
|
3174
|
+
return part === "" ? null : /* @__PURE__ */ jsx(React19.Fragment, { children: part }, key);
|
|
3379
3175
|
});
|
|
3380
3176
|
}
|
|
3381
3177
|
function parseBlocks(source) {
|
|
@@ -3459,7 +3255,7 @@ function renderMarkdown(source) {
|
|
|
3459
3255
|
case "ol":
|
|
3460
3256
|
return /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-1 pl-5", children: block.items.map((item, li) => /* @__PURE__ */ jsx("li", { children: renderInline(item, `${key}-${li}`) }, `${key}-${li}`)) }, key);
|
|
3461
3257
|
case "p":
|
|
3462
|
-
return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(
|
|
3258
|
+
return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
3463
3259
|
li > 0 && /* @__PURE__ */ jsx("br", {}),
|
|
3464
3260
|
renderInline(l, `${key}-${li}`)
|
|
3465
3261
|
] }, `${key}-${li}`)) }, key);
|
|
@@ -3480,7 +3276,7 @@ function MarkdownEditor({
|
|
|
3480
3276
|
renderPreview,
|
|
3481
3277
|
className
|
|
3482
3278
|
}) {
|
|
3483
|
-
const [mode, setMode] =
|
|
3279
|
+
const [mode, setMode] = React19.useState(
|
|
3484
3280
|
defaultMode === "preview" && value.trim() === "" ? "edit" : defaultMode
|
|
3485
3281
|
);
|
|
3486
3282
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
@@ -3765,29 +3561,29 @@ function PickerList({
|
|
|
3765
3561
|
listClassName,
|
|
3766
3562
|
autoFocus = true
|
|
3767
3563
|
}) {
|
|
3768
|
-
const [query, setQuery] =
|
|
3564
|
+
const [query, setQuery] = React19.useState("");
|
|
3769
3565
|
const term = normalize(query.trim());
|
|
3770
|
-
const sections =
|
|
3566
|
+
const sections = React19.useMemo(
|
|
3771
3567
|
() => groups ?? [{ id: "_", options: options ?? [] }],
|
|
3772
3568
|
[groups, options]
|
|
3773
3569
|
);
|
|
3774
|
-
const total =
|
|
3570
|
+
const total = React19.useMemo(
|
|
3775
3571
|
() => sections.reduce((n, g) => n + g.options.length, 0),
|
|
3776
3572
|
[sections]
|
|
3777
3573
|
);
|
|
3778
|
-
const visible =
|
|
3574
|
+
const visible = React19.useMemo(() => {
|
|
3779
3575
|
if (!term) return sections;
|
|
3780
3576
|
const hits = sections.flatMap((g) => g.options.filter((o) => optionMatches(o, term)));
|
|
3781
3577
|
return [{ id: "_results", options: hits }];
|
|
3782
3578
|
}, [sections, term]);
|
|
3783
|
-
const flat =
|
|
3784
|
-
const [active, setActive] =
|
|
3785
|
-
const listRef =
|
|
3786
|
-
|
|
3579
|
+
const flat = React19.useMemo(() => visible.flatMap((g) => g.options), [visible]);
|
|
3580
|
+
const [active, setActive] = React19.useState(0);
|
|
3581
|
+
const listRef = React19.useRef(null);
|
|
3582
|
+
React19.useEffect(() => {
|
|
3787
3583
|
const i = flat.findIndex((o) => o.id === value);
|
|
3788
3584
|
setActive(i >= 0 ? i : 0);
|
|
3789
3585
|
}, [term]);
|
|
3790
|
-
|
|
3586
|
+
React19.useEffect(() => {
|
|
3791
3587
|
listRef.current?.querySelector(`[data-picker-index="${active}"]`)?.scrollIntoView({ block: "nearest" });
|
|
3792
3588
|
}, [active]);
|
|
3793
3589
|
function step(delta) {
|
|
@@ -3849,7 +3645,7 @@ function PickerList({
|
|
|
3849
3645
|
className: cn("min-h-0 flex-1 overflow-y-auto py-1", listClassName),
|
|
3850
3646
|
children: [
|
|
3851
3647
|
flat.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyLabel }),
|
|
3852
|
-
visible.map((group) => /* @__PURE__ */ jsxs(
|
|
3648
|
+
visible.map((group) => /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
3853
3649
|
group.label && group.options.length > 0 && /* @__PURE__ */ jsx("p", { className: "px-3 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: group.label }),
|
|
3854
3650
|
group.options.map((o) => {
|
|
3855
3651
|
index += 1;
|
|
@@ -4070,7 +3866,7 @@ function NestedPane({ title, hint, onBack, children, className }) {
|
|
|
4070
3866
|
children
|
|
4071
3867
|
] });
|
|
4072
3868
|
}
|
|
4073
|
-
var ModalTaskContext =
|
|
3869
|
+
var ModalTaskContext = React19.createContext(null);
|
|
4074
3870
|
function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
4075
3871
|
const popTo = (index) => {
|
|
4076
3872
|
for (let i = stack.length - 1; i > index; i--) stack[i].onBack();
|
|
@@ -4103,7 +3899,7 @@ function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
|
4103
3899
|
children: title
|
|
4104
3900
|
}
|
|
4105
3901
|
),
|
|
4106
|
-
stack.map((c, i) => /* @__PURE__ */ jsxs(
|
|
3902
|
+
stack.map((c, i) => /* @__PURE__ */ jsxs(React19.Fragment, { children: [
|
|
4107
3903
|
/* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/50", "aria-hidden": true }),
|
|
4108
3904
|
i < stack.length - 1 ? /* @__PURE__ */ jsx(
|
|
4109
3905
|
"button",
|
|
@@ -4129,10 +3925,10 @@ function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
|
4129
3925
|
] });
|
|
4130
3926
|
}
|
|
4131
3927
|
function ModalTaskHost({ children, className, header }) {
|
|
4132
|
-
const [stack, setStack] =
|
|
4133
|
-
const [slot, setSlot] =
|
|
4134
|
-
const idRef =
|
|
4135
|
-
const api =
|
|
3928
|
+
const [stack, setStack] = React19.useState([]);
|
|
3929
|
+
const [slot, setSlot] = React19.useState(null);
|
|
3930
|
+
const idRef = React19.useRef(0);
|
|
3931
|
+
const api = React19.useMemo(() => ({
|
|
4136
3932
|
open: (meta) => {
|
|
4137
3933
|
const id = ++idRef.current;
|
|
4138
3934
|
setStack((s) => [...s, { id, meta }]);
|
|
@@ -4141,7 +3937,7 @@ function ModalTaskHost({ children, className, header }) {
|
|
|
4141
3937
|
close: (id) => setStack((s) => s.filter((e) => e.id !== id))
|
|
4142
3938
|
}), []);
|
|
4143
3939
|
const top = stack.length ? stack[stack.length - 1] : null;
|
|
4144
|
-
const value =
|
|
3940
|
+
const value = React19.useMemo(
|
|
4145
3941
|
() => ({ ...api, topId: top?.id ?? null, slot }),
|
|
4146
3942
|
[api, top?.id, slot]
|
|
4147
3943
|
);
|
|
@@ -4152,14 +3948,14 @@ function ModalTaskHost({ children, className, header }) {
|
|
|
4152
3948
|
] });
|
|
4153
3949
|
}
|
|
4154
3950
|
function useInModalTaskHost() {
|
|
4155
|
-
return
|
|
3951
|
+
return React19.useContext(ModalTaskContext) !== null;
|
|
4156
3952
|
}
|
|
4157
3953
|
function ModalTask({ open, title, hint, onClose, width, children }) {
|
|
4158
|
-
const host =
|
|
4159
|
-
const onCloseRef =
|
|
3954
|
+
const host = React19.useContext(ModalTaskContext);
|
|
3955
|
+
const onCloseRef = React19.useRef(onClose);
|
|
4160
3956
|
onCloseRef.current = onClose;
|
|
4161
|
-
const [myId, setMyId] =
|
|
4162
|
-
|
|
3957
|
+
const [myId, setMyId] = React19.useState(null);
|
|
3958
|
+
React19.useEffect(() => {
|
|
4163
3959
|
if (!host || !open) return;
|
|
4164
3960
|
const id = host.open({ title, hint, onBack: () => onCloseRef.current() });
|
|
4165
3961
|
setMyId(id);
|
|
@@ -4225,13 +4021,13 @@ function StockEntryForm({
|
|
|
4225
4021
|
labels: overrides
|
|
4226
4022
|
}) {
|
|
4227
4023
|
const labels = { ...DEFAULT_LABELS, ...overrides };
|
|
4228
|
-
const [quantity, setQuantity] =
|
|
4229
|
-
const [reasonCode, setReasonCode] =
|
|
4230
|
-
const [occurredOn, setOccurredOn] =
|
|
4231
|
-
const [note, setNote] =
|
|
4232
|
-
const [noteOpen, setNoteOpen] =
|
|
4233
|
-
const quantityRef =
|
|
4234
|
-
|
|
4024
|
+
const [quantity, setQuantity] = React19.useState("");
|
|
4025
|
+
const [reasonCode, setReasonCode] = React19.useState("");
|
|
4026
|
+
const [occurredOn, setOccurredOn] = React19.useState(todayISO());
|
|
4027
|
+
const [note, setNote] = React19.useState("");
|
|
4028
|
+
const [noteOpen, setNoteOpen] = React19.useState(false);
|
|
4029
|
+
const quantityRef = React19.useRef(null);
|
|
4030
|
+
React19.useEffect(() => {
|
|
4235
4031
|
if (verb === null) return;
|
|
4236
4032
|
setQuantity("");
|
|
4237
4033
|
setReasonCode("");
|
|
@@ -4470,7 +4266,7 @@ function FilterRail({
|
|
|
4470
4266
|
)
|
|
4471
4267
|
] }),
|
|
4472
4268
|
before,
|
|
4473
|
-
visible.map((section, index) => /* @__PURE__ */ jsxs(
|
|
4269
|
+
visible.map((section, index) => /* @__PURE__ */ jsxs(React19__default.Fragment, { children: [
|
|
4474
4270
|
(index > 0 || !!before || !!actions || !!search) && /* @__PURE__ */ jsx("div", { className: "my-4 h-px bg-border" }),
|
|
4475
4271
|
/* @__PURE__ */ jsx(
|
|
4476
4272
|
FilterSection,
|
|
@@ -4556,6 +4352,6 @@ function AdaptiveFilter({
|
|
|
4556
4352
|
);
|
|
4557
4353
|
}
|
|
4558
4354
|
|
|
4559
|
-
export { AdaptiveFilter, AiActionButton, Badge, Breadcrumb, BulkActionBar, CHOICE_SEARCH_THRESHOLD, ChevronPager, ChoiceList, ChoiceSelect, ComingSoon, CurrencyInput, DatePicker, DateRangeChip, DictateButton, DotBadge, DraftCommitBar, EmBreve, FILTER_RAIL_WIDTH, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterPanel, FilterPanelField, FilterRail, FilterRailColumn, FilterSection, INLINE_FILTER_MAX, INLINE_LINK_TONE, InlineLink, Input, ListFilterBar, ListView, ManageRow, Markdown, MarkdownEditor, MiniCalendar, ModalFlow, ModalFlowEntry, ModalTask, ModalTaskHeader, ModalTaskHost, MultiSelect, NestedPane,
|
|
4560
|
-
//# sourceMappingURL=chunk-
|
|
4561
|
-
//# sourceMappingURL=chunk-
|
|
4355
|
+
export { AdaptiveFilter, AiActionButton, Badge, Breadcrumb, BulkActionBar, CHOICE_SEARCH_THRESHOLD, ChevronPager, ChoiceList, ChoiceSelect, ComingSoon, CurrencyInput, DatePicker, DateRangeChip, DictateButton, DotBadge, DraftCommitBar, EmBreve, FILTER_RAIL_WIDTH, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterPanel, FilterPanelField, FilterRail, FilterRailColumn, FilterSection, INLINE_FILTER_MAX, INLINE_LINK_TONE, InlineLink, Input, ListFilterBar, ListView, ManageRow, Markdown, MarkdownEditor, MiniCalendar, ModalFlow, ModalFlowEntry, ModalTask, ModalTaskHeader, ModalTaskHost, MultiSelect, NestedPane, PersonAvatar, PersonMultiPicker, PersonPicker, PhoneField, PhoneLink, PickerDialog, PickerList, RailWorkspace, RefreshButton, RequiredFilter, RowActions, SearchCombobox, SearchField, SearchSelect, SegmentedControl, 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, WizardSteps, abbreviatePersonName, badgeVariants, comparePersonNames, formatPhone2 as formatPhone, normalizePhone, personInitials, renderMarkdown, setRowActionsLabel, toLocalISODate, useFilterDraft, useInModalTaskHost, useRowSelection };
|
|
4356
|
+
//# sourceMappingURL=chunk-3HGLZIQT.js.map
|
|
4357
|
+
//# sourceMappingURL=chunk-3HGLZIQT.js.map
|