@fayz-ai/ui 0.33.1 → 0.35.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-Q2B5RPH5.js → chunk-2CRN3BOD.js} +4 -4
- package/dist/{chunk-Q2B5RPH5.js.map → chunk-2CRN3BOD.js.map} +1 -1
- package/dist/{chunk-33A7SN2N.js → chunk-63BB2CNP.js} +342 -232
- package/dist/chunk-63BB2CNP.js.map +1 -0
- package/dist/{chunk-UNEEY5XG.js → chunk-FNGCA3XR.js} +3 -3
- package/dist/{chunk-UNEEY5XG.js.map → chunk-FNGCA3XR.js.map} +1 -1
- package/dist/{chunk-6GWXDVCO.js → chunk-OBWOHU5E.js} +137 -224
- package/dist/chunk-OBWOHU5E.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.map +1 -1
- package/dist/layout/SaveBar.d.ts.map +1 -1
- package/dist/layout/index.js +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/modal.d.ts +2 -0
- package/dist/primitives/modal.d.ts.map +1 -1
- package/dist/primitives/page-actions.d.ts.map +1 -1
- package/dist/primitives/person-picker.d.ts +1 -1
- package/dist/primitives/person-picker.d.ts.map +1 -1
- package/dist/styles.css +26 -0
- package/package.json +2 -2
- package/dist/chunk-33A7SN2N.js.map +0 -1
- package/dist/chunk-6GWXDVCO.js.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { useIsWide, Dropdown, DropdownTrigger, DropdownContent, DropdownSeparator, DropdownItem, Card, FilterMenuRow, FilterMenu, DataTable, Popover, PopoverTrigger, PopoverContent, Checkbox } from './chunk-
|
|
2
|
-
import { COLUMN_WIDTH, useSaveBarVisible, useCrossModuleBack, useBackHandler, Hint, PageHeaderActions, SubpageHeader, PageRail, CollapsibleColumn } from './chunk-
|
|
1
|
+
import { useIsWide, Dropdown, DropdownTrigger, DropdownContent, DropdownSeparator, DropdownItem, Card, FilterMenuRow, FilterMenu, DataTable, Popover, PopoverTrigger, PopoverContent, Checkbox } from './chunk-FNGCA3XR.js';
|
|
2
|
+
import { COLUMN_WIDTH, useSaveBarVisible, useCrossModuleBack, useBackHandler, Hint, PageHeaderActions, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, ModalDescription, ModalFooter, SubpageHeader, PageRail, CollapsibleColumn } from './chunk-63BB2CNP.js';
|
|
3
3
|
import { cn, Button } from './chunk-OKZ6WQB3.js';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
4
|
+
import * as React17 from 'react';
|
|
5
|
+
import React17__default, { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
9
|
-
import { X, ChevronDown, ChevronUp, Check, ArrowLeft, MoreHorizontal, Plus, MoreVertical, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ImageIcon, RefreshCw, Clock, Download, Calendar, Loader2, Pencil, CalendarDays, MicOff, Mic, ArrowRight } from 'lucide-react';
|
|
10
8
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
9
|
+
import { ChevronDown, ChevronUp, Check, ArrowLeft, MoreHorizontal, Search, ChevronsLeft, ChevronLeft, ChevronRight, ChevronsRight, ImageIcon, RefreshCw, Clock, X, Plus, Download, Calendar, Loader2, Pencil, CalendarDays, MicOff, Mic, ArrowRight, MoreVertical } from 'lucide-react';
|
|
11
10
|
import { Toaster } from 'sonner';
|
|
12
11
|
export { toast } from 'sonner';
|
|
13
12
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
@@ -15,9 +14,9 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
|
15
14
|
import { createPortal } from 'react-dom';
|
|
16
15
|
import { useTranslation, getCountry, unmaskPhone, maskPhone, getCurrentLocale } from '@fayz-ai/core';
|
|
17
16
|
|
|
18
|
-
var Input =
|
|
17
|
+
var Input = React17.forwardRef(
|
|
19
18
|
({ className, type, error, description, id, ...props }, ref) => {
|
|
20
|
-
const inputId = id ??
|
|
19
|
+
const inputId = id ?? React17.useId();
|
|
21
20
|
const descriptionId = description ? `${inputId}-description` : void 0;
|
|
22
21
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
23
22
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
@@ -92,100 +91,10 @@ function Badge({ className, variant, dot, children, ...props }) {
|
|
|
92
91
|
children
|
|
93
92
|
] });
|
|
94
93
|
}
|
|
95
|
-
var SIZE_MAP = {
|
|
96
|
-
sm: "sm:max-w-sm",
|
|
97
|
-
md: "sm:max-w-md",
|
|
98
|
-
lg: "sm:max-w-lg",
|
|
99
|
-
xl: "sm:max-w-xl",
|
|
100
|
-
"2xl": "sm:max-w-2xl",
|
|
101
|
-
"3xl": "sm:max-w-3xl",
|
|
102
|
-
// Duas colunas de trabalho lado a lado (ficha + linha do tempo) não cabem em
|
|
103
|
-
// 3xl: a coluna da direita fica com 20rem e o texto de cada anotação quebra
|
|
104
|
-
// a cada quatro palavras.
|
|
105
|
-
"4xl": "sm:max-w-4xl",
|
|
106
|
-
"5xl": "sm:max-w-5xl",
|
|
107
|
-
full: "sm:max-w-[calc(100vw-4rem)]"
|
|
108
|
-
};
|
|
109
|
-
var Modal = DialogPrimitive.Root;
|
|
110
|
-
var ModalTrigger = DialogPrimitive.Trigger;
|
|
111
|
-
var ModalClose = DialogPrimitive.Close;
|
|
112
|
-
var ModalPortal = DialogPrimitive.Portal;
|
|
113
|
-
var ModalOverlay = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
114
|
-
DialogPrimitive.Overlay,
|
|
115
|
-
{
|
|
116
|
-
ref,
|
|
117
|
-
className: cn(
|
|
118
|
-
"fayz-modal-overlay saas-mdl-ov fixed inset-0 z-[100]",
|
|
119
|
-
"flex items-center justify-center p-0 sm:p-6",
|
|
120
|
-
className
|
|
121
|
-
),
|
|
122
|
-
...props
|
|
123
|
-
}
|
|
124
|
-
));
|
|
125
|
-
ModalOverlay.displayName = "ModalOverlay";
|
|
126
|
-
var ModalContent = React18.forwardRef(({ className, children, size = "lg", hideClose, noPadding, onPointerDownOutside, onInteractOutside, onCloseAutoFocus, ...props }, ref) => /* @__PURE__ */ jsx(ModalPortal, { children: /* @__PURE__ */ jsx(ModalOverlay, { children: /* @__PURE__ */ jsxs(
|
|
127
|
-
DialogPrimitive.Content,
|
|
128
|
-
{
|
|
129
|
-
ref,
|
|
130
|
-
onCloseAutoFocus: (e) => {
|
|
131
|
-
e.preventDefault();
|
|
132
|
-
onCloseAutoFocus?.(e);
|
|
133
|
-
},
|
|
134
|
-
onPointerDownOutside: (e) => {
|
|
135
|
-
const target = e.target;
|
|
136
|
-
if (target.closest("[data-modal-passthrough]") || target.closest("[data-radix-popper-content-wrapper]")) {
|
|
137
|
-
e.preventDefault();
|
|
138
|
-
}
|
|
139
|
-
onPointerDownOutside?.(e);
|
|
140
|
-
},
|
|
141
|
-
onInteractOutside: (e) => {
|
|
142
|
-
const target = e.target;
|
|
143
|
-
if (target.closest("[data-modal-passthrough]") || target.closest("[data-radix-popper-content-wrapper]")) {
|
|
144
|
-
e.preventDefault();
|
|
145
|
-
}
|
|
146
|
-
onInteractOutside?.(e);
|
|
147
|
-
},
|
|
148
|
-
className: cn(
|
|
149
|
-
// fz-container: a form inside a dialog measures the DIALOG. Without
|
|
150
|
-
// it a two-column field grid in an `sm` modal read the window's width
|
|
151
|
-
// and kept both columns in 380px.
|
|
152
|
-
"fayz-glass-surface fayz-modal-content saas-mdl-ct fz-container relative z-[100] flex flex-col w-full outline-none",
|
|
153
|
-
// Mobile fullscreen
|
|
154
|
-
"h-full rounded-none border-0",
|
|
155
|
-
// Desktop centered card
|
|
156
|
-
"sm:h-auto sm:max-h-[85vh] sm:rounded-2xl sm:border",
|
|
157
|
-
SIZE_MAP[size],
|
|
158
|
-
noPadding ? "" : "p-6 gap-4",
|
|
159
|
-
className
|
|
160
|
-
),
|
|
161
|
-
...props,
|
|
162
|
-
children: [
|
|
163
|
-
children,
|
|
164
|
-
!hideClose && /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 z-10 flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring", children: [
|
|
165
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
166
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
167
|
-
] })
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
) }) }));
|
|
171
|
-
ModalContent.displayName = "ModalContent";
|
|
172
|
-
function ModalHeader({ className, ...props }) {
|
|
173
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left shrink-0", className), ...props });
|
|
174
|
-
}
|
|
175
|
-
function ModalBody({ className, ...props }) {
|
|
176
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-1 flex-col overflow-y-auto min-h-0", className), ...props });
|
|
177
|
-
}
|
|
178
|
-
function ModalFooter({ className, ...props }) {
|
|
179
|
-
return /* @__PURE__ */ jsx("div", { className: cn("mt-auto flex flex-col-reverse gap-2 pb-[env(safe-area-inset-bottom)] sm:mt-0 sm:flex-row sm:justify-end sm:gap-0 sm:space-x-2 sm:pb-0 shrink-0", className), ...props });
|
|
180
|
-
}
|
|
181
|
-
var ModalTitle = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, { ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props }));
|
|
182
|
-
ModalTitle.displayName = "ModalTitle";
|
|
183
|
-
var ModalDescription = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
184
|
-
ModalDescription.displayName = "ModalDescription";
|
|
185
94
|
var Select = SelectPrimitive.Root;
|
|
186
95
|
var SelectGroup = SelectPrimitive.Group;
|
|
187
96
|
var SelectValue = SelectPrimitive.Value;
|
|
188
|
-
var SelectTrigger =
|
|
97
|
+
var SelectTrigger = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
189
98
|
SelectPrimitive.Trigger,
|
|
190
99
|
{
|
|
191
100
|
ref,
|
|
@@ -201,7 +110,7 @@ var SelectTrigger = React18.forwardRef(({ className, children, ...props }, ref)
|
|
|
201
110
|
}
|
|
202
111
|
));
|
|
203
112
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
204
|
-
var SelectScrollUpButton =
|
|
113
|
+
var SelectScrollUpButton = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
205
114
|
SelectPrimitive.ScrollUpButton,
|
|
206
115
|
{
|
|
207
116
|
ref,
|
|
@@ -214,7 +123,7 @@ var SelectScrollUpButton = React18.forwardRef(({ className, ...props }, ref) =>
|
|
|
214
123
|
}
|
|
215
124
|
));
|
|
216
125
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
217
|
-
var SelectScrollDownButton =
|
|
126
|
+
var SelectScrollDownButton = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
218
127
|
SelectPrimitive.ScrollDownButton,
|
|
219
128
|
{
|
|
220
129
|
ref,
|
|
@@ -227,7 +136,7 @@ var SelectScrollDownButton = React18.forwardRef(({ className, ...props }, ref) =
|
|
|
227
136
|
}
|
|
228
137
|
));
|
|
229
138
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
230
|
-
var SelectContent =
|
|
139
|
+
var SelectContent = React17.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
231
140
|
SelectPrimitive.Content,
|
|
232
141
|
{
|
|
233
142
|
ref,
|
|
@@ -255,7 +164,7 @@ var SelectContent = React18.forwardRef(({ className, children, position = "poppe
|
|
|
255
164
|
}
|
|
256
165
|
) }));
|
|
257
166
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
258
|
-
var SelectLabel =
|
|
167
|
+
var SelectLabel = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
259
168
|
SelectPrimitive.Label,
|
|
260
169
|
{
|
|
261
170
|
ref,
|
|
@@ -267,7 +176,7 @@ var SelectLabel = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
267
176
|
}
|
|
268
177
|
));
|
|
269
178
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
270
|
-
var SelectItem =
|
|
179
|
+
var SelectItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
271
180
|
SelectPrimitive.Item,
|
|
272
181
|
{
|
|
273
182
|
ref,
|
|
@@ -283,7 +192,7 @@ var SelectItem = React18.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
283
192
|
}
|
|
284
193
|
));
|
|
285
194
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
286
|
-
var SelectSeparator =
|
|
195
|
+
var SelectSeparator = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
287
196
|
SelectPrimitive.Separator,
|
|
288
197
|
{
|
|
289
198
|
ref,
|
|
@@ -321,7 +230,7 @@ function ToastProvider({
|
|
|
321
230
|
);
|
|
322
231
|
}
|
|
323
232
|
var Tabs = TabsPrimitive.Root;
|
|
324
|
-
var TabsList =
|
|
233
|
+
var TabsList = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
325
234
|
TabsPrimitive.List,
|
|
326
235
|
{
|
|
327
236
|
ref,
|
|
@@ -335,7 +244,7 @@ var TabsList = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
335
244
|
}
|
|
336
245
|
));
|
|
337
246
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
338
|
-
var TabsTrigger =
|
|
247
|
+
var TabsTrigger = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
339
248
|
TabsPrimitive.Trigger,
|
|
340
249
|
{
|
|
341
250
|
ref,
|
|
@@ -347,7 +256,7 @@ var TabsTrigger = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
347
256
|
}
|
|
348
257
|
));
|
|
349
258
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
350
|
-
var TabsContent =
|
|
259
|
+
var TabsContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
351
260
|
TabsPrimitive.Content,
|
|
352
261
|
{
|
|
353
262
|
ref,
|
|
@@ -359,7 +268,7 @@ var TabsContent = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
359
268
|
}
|
|
360
269
|
));
|
|
361
270
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
362
|
-
var Separator2 =
|
|
271
|
+
var Separator2 = React17.forwardRef(
|
|
363
272
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
364
273
|
SeparatorPrimitive.Root,
|
|
365
274
|
{
|
|
@@ -410,7 +319,7 @@ function formatPhone(digits, fallback, countryCode) {
|
|
|
410
319
|
const tail = rest.length === 9 ? rest.slice(5) : rest.slice(4);
|
|
411
320
|
return `+55 (${ddd}) ${head}-${tail}`;
|
|
412
321
|
}
|
|
413
|
-
var PhoneLink =
|
|
322
|
+
var PhoneLink = React17.forwardRef(
|
|
414
323
|
({ phone, message, countryCode, raw, className, children, ...props }, ref) => {
|
|
415
324
|
const { e164, display } = normalizePhone(phone, countryCode);
|
|
416
325
|
const label = children ?? (raw ? phone ?? "" : display);
|
|
@@ -480,7 +389,10 @@ function PageActionBar({ actions, className }) {
|
|
|
480
389
|
if (visible.length === 0) return null;
|
|
481
390
|
if (!wide) {
|
|
482
391
|
const usable = visible.filter((a) => !a.desktopOnly);
|
|
483
|
-
|
|
392
|
+
if (usable.length === 0) return null;
|
|
393
|
+
const fab = /* @__PURE__ */ jsx(PageActionFab, { actions: usable });
|
|
394
|
+
const fabHost = typeof document !== "undefined" ? document.querySelector(".shell-enter") ?? document.body : null;
|
|
395
|
+
return fabHost ? createPortal(fab, fabHost) : fab;
|
|
484
396
|
}
|
|
485
397
|
let seenPrimary = false;
|
|
486
398
|
const primary = [];
|
|
@@ -595,9 +507,9 @@ function PageActionFab({ actions }) {
|
|
|
595
507
|
] });
|
|
596
508
|
}
|
|
597
509
|
function useScrim(open) {
|
|
598
|
-
const [mounted, setMounted] =
|
|
599
|
-
const [visible, setVisible] =
|
|
600
|
-
|
|
510
|
+
const [mounted, setMounted] = React17.useState(open);
|
|
511
|
+
const [visible, setVisible] = React17.useState(open);
|
|
512
|
+
React17.useEffect(() => {
|
|
601
513
|
if (open) {
|
|
602
514
|
setMounted(true);
|
|
603
515
|
const frame = requestAnimationFrame(() => setVisible(true));
|
|
@@ -611,7 +523,7 @@ function useScrim(open) {
|
|
|
611
523
|
}
|
|
612
524
|
var SCRIM_MS = 200;
|
|
613
525
|
function FabButton({ actions, tone, mini }) {
|
|
614
|
-
const [open, setOpen] =
|
|
526
|
+
const [open, setOpen] = React17.useState(false);
|
|
615
527
|
const scrim = useScrim(open);
|
|
616
528
|
if (actions.length === 0) return null;
|
|
617
529
|
const isCreate = tone === "primary";
|
|
@@ -724,7 +636,7 @@ function RowActions({
|
|
|
724
636
|
const Icon2 = a.icon;
|
|
725
637
|
const isDanger = a.intent === "danger";
|
|
726
638
|
const prevSafe = i > 0 && overflow[i - 1].intent !== "danger";
|
|
727
|
-
return /* @__PURE__ */ jsxs(
|
|
639
|
+
return /* @__PURE__ */ jsxs(React17.Fragment, { children: [
|
|
728
640
|
isDanger && prevSafe && /* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
729
641
|
/* @__PURE__ */ jsxs(
|
|
730
642
|
DropdownItem,
|
|
@@ -975,8 +887,8 @@ var ICON_CLASSES = {
|
|
|
975
887
|
lg: "h-5 w-5"
|
|
976
888
|
};
|
|
977
889
|
function Thumbnail({ src, alt = "", size = "md", icon: Icon2 = ImageIcon, className }) {
|
|
978
|
-
const [failed, setFailed] =
|
|
979
|
-
|
|
890
|
+
const [failed, setFailed] = React17.useState(false);
|
|
891
|
+
React17.useEffect(() => {
|
|
980
892
|
setFailed(false);
|
|
981
893
|
}, [src]);
|
|
982
894
|
const base = cn("shrink-0 overflow-hidden", SIZE_CLASSES[size], className);
|
|
@@ -1003,9 +915,9 @@ function Thumbnail({ src, alt = "", size = "md", icon: Icon2 = ImageIcon, classN
|
|
|
1003
915
|
}
|
|
1004
916
|
Thumbnail.displayName = "Thumbnail";
|
|
1005
917
|
function RefreshButton({ onRefresh, fromCache, label, labelCached, className, ...rest }) {
|
|
1006
|
-
const [phase, setPhase] =
|
|
1007
|
-
const alive =
|
|
1008
|
-
|
|
918
|
+
const [phase, setPhase] = React17.useState("idle");
|
|
919
|
+
const alive = React17.useRef(true);
|
|
920
|
+
React17.useEffect(() => () => {
|
|
1009
921
|
alive.current = false;
|
|
1010
922
|
}, []);
|
|
1011
923
|
const title = fromCache ? labelCached ?? label : label;
|
|
@@ -1227,27 +1139,27 @@ function useRowSelection({
|
|
|
1227
1139
|
getRowId,
|
|
1228
1140
|
enabled = true
|
|
1229
1141
|
}) {
|
|
1230
|
-
const identify =
|
|
1142
|
+
const identify = React17.useCallback(
|
|
1231
1143
|
(row) => getRowId ? getRowId(row) : String(row?.id ?? ""),
|
|
1232
1144
|
[getRowId]
|
|
1233
1145
|
);
|
|
1234
|
-
const visible =
|
|
1235
|
-
const [rawSelection, setRawSelection] =
|
|
1236
|
-
const visibleIds =
|
|
1237
|
-
const selectedIds =
|
|
1146
|
+
const visible = React17.useMemo(() => rows ?? [], [rows]);
|
|
1147
|
+
const [rawSelection, setRawSelection] = React17.useState([]);
|
|
1148
|
+
const visibleIds = React17.useMemo(() => new Set(visible.map(identify)), [visible, identify]);
|
|
1149
|
+
const selectedIds = React17.useMemo(
|
|
1238
1150
|
() => rawSelection.filter((id) => visibleIds.has(id)),
|
|
1239
1151
|
[rawSelection, visibleIds]
|
|
1240
1152
|
);
|
|
1241
|
-
const selectedRows =
|
|
1153
|
+
const selectedRows = React17.useMemo(() => {
|
|
1242
1154
|
const picked = new Set(selectedIds);
|
|
1243
1155
|
return visible.filter((row) => picked.has(identify(row)));
|
|
1244
1156
|
}, [visible, selectedIds, identify]);
|
|
1245
|
-
const clear =
|
|
1246
|
-
const selectAll =
|
|
1157
|
+
const clear = React17.useCallback(() => setRawSelection([]), []);
|
|
1158
|
+
const selectAll = React17.useCallback(
|
|
1247
1159
|
() => setRawSelection(visible.map(identify)),
|
|
1248
1160
|
[visible, identify]
|
|
1249
1161
|
);
|
|
1250
|
-
const barActions =
|
|
1162
|
+
const barActions = React17.useMemo(
|
|
1251
1163
|
() => (actions ?? []).map((action) => ({
|
|
1252
1164
|
id: action.id,
|
|
1253
1165
|
label: action.label,
|
|
@@ -1319,10 +1231,10 @@ function ListFilterBar({
|
|
|
1319
1231
|
className
|
|
1320
1232
|
}) {
|
|
1321
1233
|
const wide = useIsWide();
|
|
1322
|
-
const usable =
|
|
1234
|
+
const usable = React17.useMemo(() => (filters ?? []).filter((f) => f.options.length > 0), [filters]);
|
|
1323
1235
|
const active = usable.filter((f) => f.value != null && f.value !== "");
|
|
1324
1236
|
const total = activeCount ?? active.length;
|
|
1325
|
-
const fields =
|
|
1237
|
+
const fields = React17.useMemo(() => [
|
|
1326
1238
|
...usable.map((f) => ({
|
|
1327
1239
|
id: f.id,
|
|
1328
1240
|
label: f.label,
|
|
@@ -1476,7 +1388,7 @@ function ListView({
|
|
|
1476
1388
|
const showSearch = !!onSearchChange;
|
|
1477
1389
|
const showTags = tags && tags.length > 0 && onTagChange;
|
|
1478
1390
|
const selection = useRowSelection({ rows: loading ? [] : data, actions: bulkActions, getRowId });
|
|
1479
|
-
const allFilters =
|
|
1391
|
+
const allFilters = React17.useMemo(() => [
|
|
1480
1392
|
...showTags ? [{
|
|
1481
1393
|
id: "__tag",
|
|
1482
1394
|
label: tagsLabel ?? allTagLabel,
|
|
@@ -1867,7 +1779,7 @@ function toLocalISODate(d) {
|
|
|
1867
1779
|
}
|
|
1868
1780
|
function MiniCalendar({ selectedDate, onDateSelect, onMonthChange, markers }) {
|
|
1869
1781
|
const locale = getCurrentLocale();
|
|
1870
|
-
const [viewMonth, setViewMonth] =
|
|
1782
|
+
const [viewMonth, setViewMonth] = React17__default.useState(() => new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1));
|
|
1871
1783
|
const monthLabel = viewMonth.toLocaleDateString(toDateLocale2(locale), { month: "long", year: "numeric" });
|
|
1872
1784
|
const dayLabels = DAY_LABELS2[locale] ?? DAY_LABELS2.en;
|
|
1873
1785
|
const weeks = useMemo(() => {
|
|
@@ -1947,7 +1859,7 @@ function FilterSection({
|
|
|
1947
1859
|
count,
|
|
1948
1860
|
children
|
|
1949
1861
|
}) {
|
|
1950
|
-
const [open, setOpen] =
|
|
1862
|
+
const [open, setOpen] = React17__default.useState(defaultOpen);
|
|
1951
1863
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1952
1864
|
/* @__PURE__ */ jsxs(
|
|
1953
1865
|
"button",
|
|
@@ -2023,7 +1935,7 @@ function FilterCheckList({
|
|
|
2023
1935
|
}
|
|
2024
1936
|
return /* @__PURE__ */ jsx("div", { className: className ? `${className} space-y-0.5` : "space-y-0.5", children: rows });
|
|
2025
1937
|
}
|
|
2026
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1938
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React17.useLayoutEffect : React17.useEffect;
|
|
2027
1939
|
function SearchSelect({
|
|
2028
1940
|
value,
|
|
2029
1941
|
displayValue,
|
|
@@ -2055,19 +1967,19 @@ function SearchSelect({
|
|
|
2055
1967
|
}) {
|
|
2056
1968
|
const isRequiredFilter = variant === "required-filter";
|
|
2057
1969
|
const canCreate = !!onCreate && allowCreate !== false;
|
|
2058
|
-
const [open, setOpen] =
|
|
2059
|
-
const [query, setQuery] =
|
|
2060
|
-
const [results, setResults] =
|
|
2061
|
-
const [loading, setLoading] =
|
|
2062
|
-
const [creating, setCreating] =
|
|
2063
|
-
const [selectedLabel, setSelectedLabel] =
|
|
2064
|
-
const containerRef =
|
|
2065
|
-
const inputRef =
|
|
2066
|
-
const timerRef =
|
|
2067
|
-
const [rect, setRect] =
|
|
2068
|
-
const dropdownRef =
|
|
2069
|
-
const requestRef =
|
|
2070
|
-
|
|
1970
|
+
const [open, setOpen] = React17.useState(false);
|
|
1971
|
+
const [query, setQuery] = React17.useState("");
|
|
1972
|
+
const [results, setResults] = React17.useState([]);
|
|
1973
|
+
const [loading, setLoading] = React17.useState(false);
|
|
1974
|
+
const [creating, setCreating] = React17.useState(false);
|
|
1975
|
+
const [selectedLabel, setSelectedLabel] = React17.useState(displayValue ?? "");
|
|
1976
|
+
const containerRef = React17.useRef(null);
|
|
1977
|
+
const inputRef = React17.useRef(null);
|
|
1978
|
+
const timerRef = React17.useRef();
|
|
1979
|
+
const [rect, setRect] = React17.useState(null);
|
|
1980
|
+
const dropdownRef = React17.useRef(null);
|
|
1981
|
+
const requestRef = React17.useRef(0);
|
|
1982
|
+
React17.useEffect(() => {
|
|
2071
1983
|
function handler(e) {
|
|
2072
1984
|
const target = e.target;
|
|
2073
1985
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -2077,10 +1989,10 @@ function SearchSelect({
|
|
|
2077
1989
|
document.addEventListener("mousedown", handler);
|
|
2078
1990
|
return () => document.removeEventListener("mousedown", handler);
|
|
2079
1991
|
}, []);
|
|
2080
|
-
|
|
1992
|
+
React17.useEffect(() => {
|
|
2081
1993
|
if (displayValue !== void 0) setSelectedLabel(displayValue);
|
|
2082
1994
|
}, [displayValue]);
|
|
2083
|
-
|
|
1995
|
+
React17.useEffect(() => {
|
|
2084
1996
|
if (open && loadOnOpen && query.length === 0 && results.length === 0 && !loading) {
|
|
2085
1997
|
const request = ++requestRef.current;
|
|
2086
1998
|
setLoading(true);
|
|
@@ -2148,7 +2060,7 @@ function SearchSelect({
|
|
|
2148
2060
|
setResults([]);
|
|
2149
2061
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
2150
2062
|
}
|
|
2151
|
-
const groups =
|
|
2063
|
+
const groups = React17.useMemo(() => {
|
|
2152
2064
|
const map = /* @__PURE__ */ new Map();
|
|
2153
2065
|
for (const opt of results) {
|
|
2154
2066
|
const group = opt.group ?? "";
|
|
@@ -2342,7 +2254,7 @@ function SearchSelect({
|
|
|
2342
2254
|
]
|
|
2343
2255
|
},
|
|
2344
2256
|
group
|
|
2345
|
-
)) }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(
|
|
2257
|
+
)) }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React17.Fragment, { children: [
|
|
2346
2258
|
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 }),
|
|
2347
2259
|
options.map(optionButton)
|
|
2348
2260
|
] }, group)) }),
|
|
@@ -2385,9 +2297,9 @@ function CurrencyInput({
|
|
|
2385
2297
|
className,
|
|
2386
2298
|
disabled
|
|
2387
2299
|
}) {
|
|
2388
|
-
const inputRef =
|
|
2389
|
-
const [focused, setFocused] =
|
|
2390
|
-
const format =
|
|
2300
|
+
const inputRef = React17.useRef(null);
|
|
2301
|
+
const [focused, setFocused] = React17.useState(false);
|
|
2302
|
+
const format = React17.useCallback((v) => {
|
|
2391
2303
|
return new Intl.NumberFormat(locale, {
|
|
2392
2304
|
minimumFractionDigits: 2,
|
|
2393
2305
|
maximumFractionDigits: 2
|
|
@@ -2514,9 +2426,9 @@ function RequiredFilter({
|
|
|
2514
2426
|
className,
|
|
2515
2427
|
contentClassName
|
|
2516
2428
|
}) {
|
|
2517
|
-
const [open, setOpen] =
|
|
2429
|
+
const [open, setOpen] = React17.useState(false);
|
|
2518
2430
|
const missing = !value;
|
|
2519
|
-
const close =
|
|
2431
|
+
const close = React17.useCallback(() => setOpen(false), []);
|
|
2520
2432
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
2521
2433
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2522
2434
|
"button",
|
|
@@ -2562,9 +2474,9 @@ function FilterPanel({
|
|
|
2562
2474
|
className
|
|
2563
2475
|
}) {
|
|
2564
2476
|
const blocked = Boolean(applyDisabledReason);
|
|
2565
|
-
const [aberto, setAberto] =
|
|
2566
|
-
const jaAbriu =
|
|
2567
|
-
|
|
2477
|
+
const [aberto, setAberto] = React17.useState(Boolean(advancedCount));
|
|
2478
|
+
const jaAbriu = React17.useRef(Boolean(advancedCount));
|
|
2479
|
+
React17.useEffect(() => {
|
|
2568
2480
|
if (advancedCount && !jaAbriu.current) {
|
|
2569
2481
|
jaAbriu.current = true;
|
|
2570
2482
|
setAberto(true);
|
|
@@ -2639,23 +2551,23 @@ function FilterPanelField({ label, compact, required, className, children }) {
|
|
|
2639
2551
|
}
|
|
2640
2552
|
FilterPanelField.displayName = "FilterPanelField";
|
|
2641
2553
|
function useFilterDraft(initial) {
|
|
2642
|
-
const inicial =
|
|
2643
|
-
const [draft, setDraft] =
|
|
2644
|
-
const [applied, setApplied] =
|
|
2645
|
-
const dirty =
|
|
2554
|
+
const inicial = React17.useRef(initial);
|
|
2555
|
+
const [draft, setDraft] = React17.useState(initial);
|
|
2556
|
+
const [applied, setApplied] = React17.useState(initial);
|
|
2557
|
+
const dirty = React17.useMemo(
|
|
2646
2558
|
() => JSON.stringify(draft) !== JSON.stringify(applied),
|
|
2647
2559
|
[draft, applied]
|
|
2648
2560
|
);
|
|
2649
|
-
const patch =
|
|
2561
|
+
const patch = React17.useCallback((changes) => {
|
|
2650
2562
|
setDraft((atual) => ({ ...atual, ...changes }));
|
|
2651
2563
|
}, []);
|
|
2652
|
-
const apply =
|
|
2564
|
+
const apply = React17.useCallback(() => {
|
|
2653
2565
|
setDraft((atual) => {
|
|
2654
2566
|
setApplied(atual);
|
|
2655
2567
|
return atual;
|
|
2656
2568
|
});
|
|
2657
2569
|
}, []);
|
|
2658
|
-
const reset =
|
|
2570
|
+
const reset = React17.useCallback((value) => {
|
|
2659
2571
|
const alvo = value ?? inicial.current;
|
|
2660
2572
|
setDraft(alvo);
|
|
2661
2573
|
setApplied(alvo);
|
|
@@ -2691,7 +2603,7 @@ function DateRangeChip({
|
|
|
2691
2603
|
label,
|
|
2692
2604
|
className
|
|
2693
2605
|
}) {
|
|
2694
|
-
const [open, setOpen] =
|
|
2606
|
+
const [open, setOpen] = React17.useState(false);
|
|
2695
2607
|
const active = !!(from || to);
|
|
2696
2608
|
const locale = typeof navigator !== "undefined" ? navigator.language : "en";
|
|
2697
2609
|
const presetLabel = presets.find((p) => p.value === preset)?.label;
|
|
@@ -2796,9 +2708,9 @@ function MultiSelect({
|
|
|
2796
2708
|
variant = "field",
|
|
2797
2709
|
icon: Icon2
|
|
2798
2710
|
}) {
|
|
2799
|
-
const [query, setQuery] =
|
|
2800
|
-
const selected =
|
|
2801
|
-
const filtered =
|
|
2711
|
+
const [query, setQuery] = React17.useState("");
|
|
2712
|
+
const selected = React17.useMemo(() => new Set(value), [value]);
|
|
2713
|
+
const filtered = React17.useMemo(() => {
|
|
2802
2714
|
const q = query.trim().toLowerCase();
|
|
2803
2715
|
if (!q) return options;
|
|
2804
2716
|
return options.filter((o) => o.label.toLowerCase().includes(q));
|
|
@@ -2917,7 +2829,8 @@ function MultiSelect({
|
|
|
2917
2829
|
var AVATAR_SIZE = {
|
|
2918
2830
|
xs: "h-5 w-5 text-[9px]",
|
|
2919
2831
|
sm: "h-6 w-6 text-[10px]",
|
|
2920
|
-
md: "h-8 w-8 text-xs"
|
|
2832
|
+
md: "h-8 w-8 text-xs",
|
|
2833
|
+
lg: "h-10 w-10 text-sm"
|
|
2921
2834
|
};
|
|
2922
2835
|
function personInitials(name) {
|
|
2923
2836
|
const parts = name.trim().split(/\s+/).map((w) => w.replace(/[^\p{L}\p{N}]/gu, "")).filter(Boolean);
|
|
@@ -2935,8 +2848,8 @@ function hueFor(name) {
|
|
|
2935
2848
|
return AVATAR_HUES[h % AVATAR_HUES.length];
|
|
2936
2849
|
}
|
|
2937
2850
|
function PersonAvatar({ name, src, size = "sm", className }) {
|
|
2938
|
-
const [failed, setFailed] =
|
|
2939
|
-
|
|
2851
|
+
const [failed, setFailed] = React17.useState(false);
|
|
2852
|
+
React17.useEffect(() => {
|
|
2940
2853
|
setFailed(false);
|
|
2941
2854
|
}, [src]);
|
|
2942
2855
|
const base = cn("shrink-0 overflow-hidden rounded-full", AVATAR_SIZE[size], className);
|
|
@@ -2976,7 +2889,7 @@ function ListShell({
|
|
|
2976
2889
|
footer,
|
|
2977
2890
|
children
|
|
2978
2891
|
}) {
|
|
2979
|
-
const filtered =
|
|
2892
|
+
const filtered = React17.useMemo(() => {
|
|
2980
2893
|
const q = query.trim().toLowerCase();
|
|
2981
2894
|
if (!q) return options;
|
|
2982
2895
|
return options.filter((o) => o.name.toLowerCase().includes(q));
|
|
@@ -2999,7 +2912,7 @@ function ListShell({
|
|
|
2999
2912
|
)
|
|
3000
2913
|
] }),
|
|
3001
2914
|
/* @__PURE__ */ jsxs("div", { className: "max-h-72 overflow-y-auto py-1", children: [
|
|
3002
|
-
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(
|
|
2915
|
+
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(React17.Fragment, { children: children(o) }, o.id)),
|
|
3003
2916
|
footer
|
|
3004
2917
|
] })
|
|
3005
2918
|
] });
|
|
@@ -3034,8 +2947,8 @@ function PersonPicker({
|
|
|
3034
2947
|
onClear,
|
|
3035
2948
|
variant = "input"
|
|
3036
2949
|
}) {
|
|
3037
|
-
const [query, setQuery] =
|
|
3038
|
-
const [open, setOpen] =
|
|
2950
|
+
const [query, setQuery] = React17.useState("");
|
|
2951
|
+
const [open, setOpen] = React17.useState(false);
|
|
3039
2952
|
const current = options.find((o) => o.id === value);
|
|
3040
2953
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
3041
2954
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs("button", { type: "button", disabled, className: cn(TRIGGER_CLASSES[variant], className), children: [
|
|
@@ -3113,8 +3026,8 @@ function PersonMultiPicker({
|
|
|
3113
3026
|
max,
|
|
3114
3027
|
variant = "input"
|
|
3115
3028
|
}) {
|
|
3116
|
-
const [query, setQuery] =
|
|
3117
|
-
const selected =
|
|
3029
|
+
const [query, setQuery] = React17.useState("");
|
|
3030
|
+
const selected = React17.useMemo(() => new Set(value), [value]);
|
|
3118
3031
|
const atCeiling = max != null && value.length >= max;
|
|
3119
3032
|
function toggle(id) {
|
|
3120
3033
|
if (selected.has(id)) onChange(value.filter((x) => x !== id));
|
|
@@ -3213,17 +3126,17 @@ function DictateButton({
|
|
|
3213
3126
|
className,
|
|
3214
3127
|
disabled
|
|
3215
3128
|
}) {
|
|
3216
|
-
const [ouvindo, setOuvindo] =
|
|
3217
|
-
const [erro, setErro] =
|
|
3218
|
-
const ref =
|
|
3219
|
-
const [suportado, setSuportado] =
|
|
3220
|
-
|
|
3129
|
+
const [ouvindo, setOuvindo] = React17.useState(false);
|
|
3130
|
+
const [erro, setErro] = React17.useState(null);
|
|
3131
|
+
const ref = React17.useRef(null);
|
|
3132
|
+
const [suportado, setSuportado] = React17.useState(false);
|
|
3133
|
+
React17.useEffect(() => {
|
|
3221
3134
|
setSuportado(recognitionCtor() !== null);
|
|
3222
3135
|
}, []);
|
|
3223
|
-
|
|
3136
|
+
React17.useEffect(() => () => {
|
|
3224
3137
|
ref.current?.stop();
|
|
3225
3138
|
}, []);
|
|
3226
|
-
const alternar =
|
|
3139
|
+
const alternar = React17.useCallback(() => {
|
|
3227
3140
|
if (ouvindo) {
|
|
3228
3141
|
ref.current?.stop();
|
|
3229
3142
|
return;
|
|
@@ -3286,7 +3199,7 @@ function renderInline(text, keyPrefix) {
|
|
|
3286
3199
|
if (part.startsWith("`") && part.endsWith("`") && part.length > 2) {
|
|
3287
3200
|
return /* @__PURE__ */ jsx("code", { className: "rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]", children: part.slice(1, -1) }, key);
|
|
3288
3201
|
}
|
|
3289
|
-
return part === "" ? null : /* @__PURE__ */ jsx(
|
|
3202
|
+
return part === "" ? null : /* @__PURE__ */ jsx(React17.Fragment, { children: part }, key);
|
|
3290
3203
|
});
|
|
3291
3204
|
}
|
|
3292
3205
|
function parseBlocks(source) {
|
|
@@ -3370,7 +3283,7 @@ function renderMarkdown(source) {
|
|
|
3370
3283
|
case "ol":
|
|
3371
3284
|
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);
|
|
3372
3285
|
case "p":
|
|
3373
|
-
return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(
|
|
3286
|
+
return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(React17.Fragment, { children: [
|
|
3374
3287
|
li > 0 && /* @__PURE__ */ jsx("br", {}),
|
|
3375
3288
|
renderInline(l, `${key}-${li}`)
|
|
3376
3289
|
] }, `${key}-${li}`)) }, key);
|
|
@@ -3391,7 +3304,7 @@ function MarkdownEditor({
|
|
|
3391
3304
|
renderPreview,
|
|
3392
3305
|
className
|
|
3393
3306
|
}) {
|
|
3394
|
-
const [mode, setMode] =
|
|
3307
|
+
const [mode, setMode] = React17.useState(
|
|
3395
3308
|
defaultMode === "preview" && value.trim() === "" ? "edit" : defaultMode
|
|
3396
3309
|
);
|
|
3397
3310
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
@@ -3676,29 +3589,29 @@ function PickerList({
|
|
|
3676
3589
|
listClassName,
|
|
3677
3590
|
autoFocus = true
|
|
3678
3591
|
}) {
|
|
3679
|
-
const [query, setQuery] =
|
|
3592
|
+
const [query, setQuery] = React17.useState("");
|
|
3680
3593
|
const term = normalize(query.trim());
|
|
3681
|
-
const sections =
|
|
3594
|
+
const sections = React17.useMemo(
|
|
3682
3595
|
() => groups ?? [{ id: "_", options: options ?? [] }],
|
|
3683
3596
|
[groups, options]
|
|
3684
3597
|
);
|
|
3685
|
-
const total =
|
|
3598
|
+
const total = React17.useMemo(
|
|
3686
3599
|
() => sections.reduce((n, g) => n + g.options.length, 0),
|
|
3687
3600
|
[sections]
|
|
3688
3601
|
);
|
|
3689
|
-
const visible =
|
|
3602
|
+
const visible = React17.useMemo(() => {
|
|
3690
3603
|
if (!term) return sections;
|
|
3691
3604
|
const hits = sections.flatMap((g) => g.options.filter((o) => optionMatches(o, term)));
|
|
3692
3605
|
return [{ id: "_results", options: hits }];
|
|
3693
3606
|
}, [sections, term]);
|
|
3694
|
-
const flat =
|
|
3695
|
-
const [active, setActive] =
|
|
3696
|
-
const listRef =
|
|
3697
|
-
|
|
3607
|
+
const flat = React17.useMemo(() => visible.flatMap((g) => g.options), [visible]);
|
|
3608
|
+
const [active, setActive] = React17.useState(0);
|
|
3609
|
+
const listRef = React17.useRef(null);
|
|
3610
|
+
React17.useEffect(() => {
|
|
3698
3611
|
const i = flat.findIndex((o) => o.id === value);
|
|
3699
3612
|
setActive(i >= 0 ? i : 0);
|
|
3700
3613
|
}, [term]);
|
|
3701
|
-
|
|
3614
|
+
React17.useEffect(() => {
|
|
3702
3615
|
listRef.current?.querySelector(`[data-picker-index="${active}"]`)?.scrollIntoView({ block: "nearest" });
|
|
3703
3616
|
}, [active]);
|
|
3704
3617
|
function step(delta) {
|
|
@@ -3760,7 +3673,7 @@ function PickerList({
|
|
|
3760
3673
|
className: cn("min-h-0 flex-1 overflow-y-auto py-1", listClassName),
|
|
3761
3674
|
children: [
|
|
3762
3675
|
flat.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyLabel }),
|
|
3763
|
-
visible.map((group) => /* @__PURE__ */ jsxs(
|
|
3676
|
+
visible.map((group) => /* @__PURE__ */ jsxs(React17.Fragment, { children: [
|
|
3764
3677
|
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 }),
|
|
3765
3678
|
group.options.map((o) => {
|
|
3766
3679
|
index += 1;
|
|
@@ -3981,7 +3894,7 @@ function NestedPane({ title, hint, onBack, children, className }) {
|
|
|
3981
3894
|
children
|
|
3982
3895
|
] });
|
|
3983
3896
|
}
|
|
3984
|
-
var ModalTaskContext =
|
|
3897
|
+
var ModalTaskContext = React17.createContext(null);
|
|
3985
3898
|
function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
3986
3899
|
const popTo = (index) => {
|
|
3987
3900
|
for (let i = stack.length - 1; i > index; i--) stack[i].onBack();
|
|
@@ -4014,7 +3927,7 @@ function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
|
4014
3927
|
children: title
|
|
4015
3928
|
}
|
|
4016
3929
|
),
|
|
4017
|
-
stack.map((c, i) => /* @__PURE__ */ jsxs(
|
|
3930
|
+
stack.map((c, i) => /* @__PURE__ */ jsxs(React17.Fragment, { children: [
|
|
4018
3931
|
/* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/50", "aria-hidden": true }),
|
|
4019
3932
|
i < stack.length - 1 ? /* @__PURE__ */ jsx(
|
|
4020
3933
|
"button",
|
|
@@ -4040,10 +3953,10 @@ function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
|
4040
3953
|
] });
|
|
4041
3954
|
}
|
|
4042
3955
|
function ModalTaskHost({ children, className, header }) {
|
|
4043
|
-
const [stack, setStack] =
|
|
4044
|
-
const [slot, setSlot] =
|
|
4045
|
-
const idRef =
|
|
4046
|
-
const api =
|
|
3956
|
+
const [stack, setStack] = React17.useState([]);
|
|
3957
|
+
const [slot, setSlot] = React17.useState(null);
|
|
3958
|
+
const idRef = React17.useRef(0);
|
|
3959
|
+
const api = React17.useMemo(() => ({
|
|
4047
3960
|
open: (meta) => {
|
|
4048
3961
|
const id = ++idRef.current;
|
|
4049
3962
|
setStack((s) => [...s, { id, meta }]);
|
|
@@ -4052,7 +3965,7 @@ function ModalTaskHost({ children, className, header }) {
|
|
|
4052
3965
|
close: (id) => setStack((s) => s.filter((e) => e.id !== id))
|
|
4053
3966
|
}), []);
|
|
4054
3967
|
const top = stack.length ? stack[stack.length - 1] : null;
|
|
4055
|
-
const value =
|
|
3968
|
+
const value = React17.useMemo(
|
|
4056
3969
|
() => ({ ...api, topId: top?.id ?? null, slot }),
|
|
4057
3970
|
[api, top?.id, slot]
|
|
4058
3971
|
);
|
|
@@ -4063,14 +3976,14 @@ function ModalTaskHost({ children, className, header }) {
|
|
|
4063
3976
|
] });
|
|
4064
3977
|
}
|
|
4065
3978
|
function useInModalTaskHost() {
|
|
4066
|
-
return
|
|
3979
|
+
return React17.useContext(ModalTaskContext) !== null;
|
|
4067
3980
|
}
|
|
4068
3981
|
function ModalTask({ open, title, hint, onClose, width, children }) {
|
|
4069
|
-
const host =
|
|
4070
|
-
const onCloseRef =
|
|
3982
|
+
const host = React17.useContext(ModalTaskContext);
|
|
3983
|
+
const onCloseRef = React17.useRef(onClose);
|
|
4071
3984
|
onCloseRef.current = onClose;
|
|
4072
|
-
const [myId, setMyId] =
|
|
4073
|
-
|
|
3985
|
+
const [myId, setMyId] = React17.useState(null);
|
|
3986
|
+
React17.useEffect(() => {
|
|
4074
3987
|
if (!host || !open) return;
|
|
4075
3988
|
const id = host.open({ title, hint, onBack: () => onCloseRef.current() });
|
|
4076
3989
|
setMyId(id);
|
|
@@ -4136,13 +4049,13 @@ function StockEntryForm({
|
|
|
4136
4049
|
labels: overrides
|
|
4137
4050
|
}) {
|
|
4138
4051
|
const labels = { ...DEFAULT_LABELS, ...overrides };
|
|
4139
|
-
const [quantity, setQuantity] =
|
|
4140
|
-
const [reasonCode, setReasonCode] =
|
|
4141
|
-
const [occurredOn, setOccurredOn] =
|
|
4142
|
-
const [note, setNote] =
|
|
4143
|
-
const [noteOpen, setNoteOpen] =
|
|
4144
|
-
const quantityRef =
|
|
4145
|
-
|
|
4052
|
+
const [quantity, setQuantity] = React17.useState("");
|
|
4053
|
+
const [reasonCode, setReasonCode] = React17.useState("");
|
|
4054
|
+
const [occurredOn, setOccurredOn] = React17.useState(todayISO());
|
|
4055
|
+
const [note, setNote] = React17.useState("");
|
|
4056
|
+
const [noteOpen, setNoteOpen] = React17.useState(false);
|
|
4057
|
+
const quantityRef = React17.useRef(null);
|
|
4058
|
+
React17.useEffect(() => {
|
|
4146
4059
|
if (verb === null) return;
|
|
4147
4060
|
setQuantity("");
|
|
4148
4061
|
setReasonCode("");
|
|
@@ -4381,7 +4294,7 @@ function FilterRail({
|
|
|
4381
4294
|
)
|
|
4382
4295
|
] }),
|
|
4383
4296
|
before,
|
|
4384
|
-
visible.map((section, index) => /* @__PURE__ */ jsxs(
|
|
4297
|
+
visible.map((section, index) => /* @__PURE__ */ jsxs(React17__default.Fragment, { children: [
|
|
4385
4298
|
(index > 0 || !!before || !!actions || !!search) && /* @__PURE__ */ jsx("div", { className: "my-4 h-px bg-border" }),
|
|
4386
4299
|
/* @__PURE__ */ jsx(
|
|
4387
4300
|
FilterSection,
|
|
@@ -4467,6 +4380,6 @@ function AdaptiveFilter({
|
|
|
4467
4380
|
);
|
|
4468
4381
|
}
|
|
4469
4382
|
|
|
4470
|
-
export { AdaptiveFilter, Badge, Breadcrumb, BulkActionBar, ChevronPager, ComingSoon, CurrencyInput, DatePicker, DateRangeChip, DictateButton, DotBadge, DraftCommitBar, EmBreve, FILTER_RAIL_WIDTH, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterPanel, FilterPanelField, FilterRail, FilterRailColumn, FilterSection, INLINE_FILTER_MAX, Input, ListFilterBar, ListView, Markdown, MarkdownEditor, MiniCalendar,
|
|
4471
|
-
//# sourceMappingURL=chunk-
|
|
4472
|
-
//# sourceMappingURL=chunk-
|
|
4383
|
+
export { AdaptiveFilter, Badge, Breadcrumb, BulkActionBar, ChevronPager, ComingSoon, CurrencyInput, DatePicker, DateRangeChip, DictateButton, DotBadge, DraftCommitBar, EmBreve, FILTER_RAIL_WIDTH, FilterCheckBox, FilterCheckList, FilterCheckRow, FilterChip, FilterPanel, FilterPanelField, FilterRail, FilterRailColumn, FilterSection, INLINE_FILTER_MAX, Input, ListFilterBar, ListView, Markdown, MarkdownEditor, MiniCalendar, ModalFlow, ModalFlowEntry, ModalTask, ModalTaskHeader, ModalTaskHost, MultiSelect, NestedPane, PageActionBar, 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, setActionsMenuLabel, setRowActionsLabel, toLocalISODate, useFilterDraft, useInModalTaskHost, useRowSelection };
|
|
4384
|
+
//# sourceMappingURL=chunk-OBWOHU5E.js.map
|
|
4385
|
+
//# sourceMappingURL=chunk-OBWOHU5E.js.map
|