@fayz-ai/ui 0.35.0 → 0.36.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-OBWOHU5E.js → chunk-7W6WRDDF.js} +173 -134
- package/dist/chunk-7W6WRDDF.js.map +1 -0
- package/dist/{chunk-2CRN3BOD.js → chunk-N7JP63VB.js} +5 -5
- package/dist/{chunk-2CRN3BOD.js.map → chunk-N7JP63VB.js.map} +1 -1
- package/dist/{chunk-FNGCA3XR.js → chunk-UCNY76FQ.js} +3 -3
- package/dist/{chunk-FNGCA3XR.js.map → chunk-UCNY76FQ.js.map} +1 -1
- package/dist/{chunk-63BB2CNP.js → chunk-XR3WXB6N.js} +23 -5
- package/dist/chunk-XR3WXB6N.js.map +1 -0
- package/dist/{chunk-ATDIWKBD.js → chunk-ZTS5S6BZ.js} +4 -3
- package/dist/chunk-ZTS5S6BZ.js.map +1 -0
- package/dist/dashboard/index.js +4 -4
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/layout/index.js +2 -2
- package/dist/layout/rail-flyout.d.ts.map +1 -1
- package/dist/primitives/ai-action-button.d.ts +13 -0
- package/dist/primitives/ai-action-button.d.ts.map +1 -0
- package/dist/primitives/date-picker.d.ts.map +1 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +4 -4
- package/dist/primitives/inline-link.d.ts +29 -0
- package/dist/primitives/inline-link.d.ts.map +1 -0
- package/dist/primitives/search-select.d.ts +4 -1
- package/dist/primitives/search-select.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-63BB2CNP.js.map +0 -1
- package/dist/chunk-ATDIWKBD.js.map +0 -1
- package/dist/chunk-OBWOHU5E.js.map +0 -1
|
@@ -1,12 +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, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, ModalDescription, ModalFooter, SubpageHeader, PageRail, CollapsibleColumn } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
1
|
+
import { useIsWide, Dropdown, DropdownTrigger, DropdownContent, DropdownSeparator, DropdownItem, Card, FilterMenuRow, FilterMenu, DataTable, Popover, PopoverTrigger, PopoverContent, Checkbox } from './chunk-UCNY76FQ.js';
|
|
2
|
+
import { COLUMN_WIDTH, useSaveBarVisible, useCrossModuleBack, useBackHandler, Hint, PageHeaderActions, Modal, ModalContent, ModalHeader, ModalTitle, ModalBody, ModalDescription, ModalFooter, SubpageHeader, PageRail, CollapsibleColumn } from './chunk-XR3WXB6N.js';
|
|
3
|
+
import { Button, cn } from './chunk-OKZ6WQB3.js';
|
|
4
|
+
import * as React18 from 'react';
|
|
5
|
+
import React18__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, X, Plus, Download, Calendar, Pencil, CalendarDays, MicOff, Mic, ArrowRight, MoreVertical } from 'lucide-react';
|
|
6
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
import { cva } from 'class-variance-authority';
|
|
8
9
|
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';
|
|
10
10
|
import { Toaster } from 'sonner';
|
|
11
11
|
export { toast } from 'sonner';
|
|
12
12
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
@@ -14,9 +14,45 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
|
14
14
|
import { createPortal } from 'react-dom';
|
|
15
15
|
import { useTranslation, getCountry, unmaskPhone, maskPhone, getCurrentLocale } from '@fayz-ai/core';
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var TONE = {
|
|
18
|
+
solid: "bg-magic text-magic-foreground border border-magic shadow-button-primary hover:bg-magic/90 active:shadow-button-inset",
|
|
19
|
+
soft: "border border-magic/30 bg-magic-soft text-magic-soft-foreground shadow-button hover:bg-magic/10 active:shadow-button-inset"
|
|
20
|
+
};
|
|
21
|
+
var AiActionButton = React18.forwardRef(
|
|
22
|
+
({ busy, busyLabel, tone = "solid", className, children, disabled, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
23
|
+
Button,
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
variant: "ghost",
|
|
27
|
+
disabled: disabled || busy,
|
|
28
|
+
className: cn(TONE[tone], className),
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
busy ? /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 shrink-0 animate-spin", "aria-hidden": true }) : /* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": true }),
|
|
32
|
+
busy ? busyLabel ?? children : children
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
AiActionButton.displayName = "AiActionButton";
|
|
38
|
+
var INLINE_LINK_TONE = {
|
|
39
|
+
solid: "underline underline-offset-2 decoration-from-font",
|
|
40
|
+
dashed: "underline decoration-dashed decoration-from-font underline-offset-4"
|
|
41
|
+
};
|
|
42
|
+
var TONE2 = INLINE_LINK_TONE;
|
|
43
|
+
var BASE = "inline items-baseline text-left font-[inherit] text-primary hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50";
|
|
44
|
+
function InlineLink({ tone = "solid", className, children, ...rest }) {
|
|
45
|
+
const classes = cn(BASE, TONE2[tone], className);
|
|
46
|
+
if ("href" in rest && rest.href !== void 0) {
|
|
47
|
+
const { href, ...anchor } = rest;
|
|
48
|
+
return /* @__PURE__ */ jsx("a", { href, className: classes, ...anchor, children });
|
|
49
|
+
}
|
|
50
|
+
const button = rest;
|
|
51
|
+
return /* @__PURE__ */ jsx("button", { type: "button", className: classes, ...button, children });
|
|
52
|
+
}
|
|
53
|
+
var Input = React18.forwardRef(
|
|
18
54
|
({ className, type, error, description, id, ...props }, ref) => {
|
|
19
|
-
const inputId = id ??
|
|
55
|
+
const inputId = id ?? React18.useId();
|
|
20
56
|
const descriptionId = description ? `${inputId}-description` : void 0;
|
|
21
57
|
const errorId = error ? `${inputId}-error` : void 0;
|
|
22
58
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
@@ -94,7 +130,7 @@ function Badge({ className, variant, dot, children, ...props }) {
|
|
|
94
130
|
var Select = SelectPrimitive.Root;
|
|
95
131
|
var SelectGroup = SelectPrimitive.Group;
|
|
96
132
|
var SelectValue = SelectPrimitive.Value;
|
|
97
|
-
var SelectTrigger =
|
|
133
|
+
var SelectTrigger = React18.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
98
134
|
SelectPrimitive.Trigger,
|
|
99
135
|
{
|
|
100
136
|
ref,
|
|
@@ -110,7 +146,7 @@ var SelectTrigger = React17.forwardRef(({ className, children, ...props }, ref)
|
|
|
110
146
|
}
|
|
111
147
|
));
|
|
112
148
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
113
|
-
var SelectScrollUpButton =
|
|
149
|
+
var SelectScrollUpButton = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
114
150
|
SelectPrimitive.ScrollUpButton,
|
|
115
151
|
{
|
|
116
152
|
ref,
|
|
@@ -123,7 +159,7 @@ var SelectScrollUpButton = React17.forwardRef(({ className, ...props }, ref) =>
|
|
|
123
159
|
}
|
|
124
160
|
));
|
|
125
161
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
126
|
-
var SelectScrollDownButton =
|
|
162
|
+
var SelectScrollDownButton = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
127
163
|
SelectPrimitive.ScrollDownButton,
|
|
128
164
|
{
|
|
129
165
|
ref,
|
|
@@ -136,7 +172,7 @@ var SelectScrollDownButton = React17.forwardRef(({ className, ...props }, ref) =
|
|
|
136
172
|
}
|
|
137
173
|
));
|
|
138
174
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
139
|
-
var SelectContent =
|
|
175
|
+
var SelectContent = React18.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
140
176
|
SelectPrimitive.Content,
|
|
141
177
|
{
|
|
142
178
|
ref,
|
|
@@ -164,7 +200,7 @@ var SelectContent = React17.forwardRef(({ className, children, position = "poppe
|
|
|
164
200
|
}
|
|
165
201
|
) }));
|
|
166
202
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
167
|
-
var SelectLabel =
|
|
203
|
+
var SelectLabel = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
168
204
|
SelectPrimitive.Label,
|
|
169
205
|
{
|
|
170
206
|
ref,
|
|
@@ -176,7 +212,7 @@ var SelectLabel = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
176
212
|
}
|
|
177
213
|
));
|
|
178
214
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
179
|
-
var SelectItem =
|
|
215
|
+
var SelectItem = React18.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
180
216
|
SelectPrimitive.Item,
|
|
181
217
|
{
|
|
182
218
|
ref,
|
|
@@ -192,7 +228,7 @@ var SelectItem = React17.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
192
228
|
}
|
|
193
229
|
));
|
|
194
230
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
195
|
-
var SelectSeparator =
|
|
231
|
+
var SelectSeparator = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
196
232
|
SelectPrimitive.Separator,
|
|
197
233
|
{
|
|
198
234
|
ref,
|
|
@@ -230,7 +266,7 @@ function ToastProvider({
|
|
|
230
266
|
);
|
|
231
267
|
}
|
|
232
268
|
var Tabs = TabsPrimitive.Root;
|
|
233
|
-
var TabsList =
|
|
269
|
+
var TabsList = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
234
270
|
TabsPrimitive.List,
|
|
235
271
|
{
|
|
236
272
|
ref,
|
|
@@ -244,7 +280,7 @@ var TabsList = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
244
280
|
}
|
|
245
281
|
));
|
|
246
282
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
247
|
-
var TabsTrigger =
|
|
283
|
+
var TabsTrigger = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
248
284
|
TabsPrimitive.Trigger,
|
|
249
285
|
{
|
|
250
286
|
ref,
|
|
@@ -256,7 +292,7 @@ var TabsTrigger = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
256
292
|
}
|
|
257
293
|
));
|
|
258
294
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
259
|
-
var TabsContent =
|
|
295
|
+
var TabsContent = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
260
296
|
TabsPrimitive.Content,
|
|
261
297
|
{
|
|
262
298
|
ref,
|
|
@@ -268,7 +304,7 @@ var TabsContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
268
304
|
}
|
|
269
305
|
));
|
|
270
306
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
271
|
-
var Separator2 =
|
|
307
|
+
var Separator2 = React18.forwardRef(
|
|
272
308
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
273
309
|
SeparatorPrimitive.Root,
|
|
274
310
|
{
|
|
@@ -319,7 +355,7 @@ function formatPhone(digits, fallback, countryCode) {
|
|
|
319
355
|
const tail = rest.length === 9 ? rest.slice(5) : rest.slice(4);
|
|
320
356
|
return `+55 (${ddd}) ${head}-${tail}`;
|
|
321
357
|
}
|
|
322
|
-
var PhoneLink =
|
|
358
|
+
var PhoneLink = React18.forwardRef(
|
|
323
359
|
({ phone, message, countryCode, raw, className, children, ...props }, ref) => {
|
|
324
360
|
const { e164, display } = normalizePhone(phone, countryCode);
|
|
325
361
|
const label = children ?? (raw ? phone ?? "" : display);
|
|
@@ -507,9 +543,9 @@ function PageActionFab({ actions }) {
|
|
|
507
543
|
] });
|
|
508
544
|
}
|
|
509
545
|
function useScrim(open) {
|
|
510
|
-
const [mounted, setMounted] =
|
|
511
|
-
const [visible, setVisible] =
|
|
512
|
-
|
|
546
|
+
const [mounted, setMounted] = React18.useState(open);
|
|
547
|
+
const [visible, setVisible] = React18.useState(open);
|
|
548
|
+
React18.useEffect(() => {
|
|
513
549
|
if (open) {
|
|
514
550
|
setMounted(true);
|
|
515
551
|
const frame = requestAnimationFrame(() => setVisible(true));
|
|
@@ -523,7 +559,7 @@ function useScrim(open) {
|
|
|
523
559
|
}
|
|
524
560
|
var SCRIM_MS = 200;
|
|
525
561
|
function FabButton({ actions, tone, mini }) {
|
|
526
|
-
const [open, setOpen] =
|
|
562
|
+
const [open, setOpen] = React18.useState(false);
|
|
527
563
|
const scrim = useScrim(open);
|
|
528
564
|
if (actions.length === 0) return null;
|
|
529
565
|
const isCreate = tone === "primary";
|
|
@@ -636,7 +672,7 @@ function RowActions({
|
|
|
636
672
|
const Icon2 = a.icon;
|
|
637
673
|
const isDanger = a.intent === "danger";
|
|
638
674
|
const prevSafe = i > 0 && overflow[i - 1].intent !== "danger";
|
|
639
|
-
return /* @__PURE__ */ jsxs(
|
|
675
|
+
return /* @__PURE__ */ jsxs(React18.Fragment, { children: [
|
|
640
676
|
isDanger && prevSafe && /* @__PURE__ */ jsx(DropdownSeparator, {}),
|
|
641
677
|
/* @__PURE__ */ jsxs(
|
|
642
678
|
DropdownItem,
|
|
@@ -887,8 +923,8 @@ var ICON_CLASSES = {
|
|
|
887
923
|
lg: "h-5 w-5"
|
|
888
924
|
};
|
|
889
925
|
function Thumbnail({ src, alt = "", size = "md", icon: Icon2 = ImageIcon, className }) {
|
|
890
|
-
const [failed, setFailed] =
|
|
891
|
-
|
|
926
|
+
const [failed, setFailed] = React18.useState(false);
|
|
927
|
+
React18.useEffect(() => {
|
|
892
928
|
setFailed(false);
|
|
893
929
|
}, [src]);
|
|
894
930
|
const base = cn("shrink-0 overflow-hidden", SIZE_CLASSES[size], className);
|
|
@@ -915,9 +951,9 @@ function Thumbnail({ src, alt = "", size = "md", icon: Icon2 = ImageIcon, classN
|
|
|
915
951
|
}
|
|
916
952
|
Thumbnail.displayName = "Thumbnail";
|
|
917
953
|
function RefreshButton({ onRefresh, fromCache, label, labelCached, className, ...rest }) {
|
|
918
|
-
const [phase, setPhase] =
|
|
919
|
-
const alive =
|
|
920
|
-
|
|
954
|
+
const [phase, setPhase] = React18.useState("idle");
|
|
955
|
+
const alive = React18.useRef(true);
|
|
956
|
+
React18.useEffect(() => () => {
|
|
921
957
|
alive.current = false;
|
|
922
958
|
}, []);
|
|
923
959
|
const title = fromCache ? labelCached ?? label : label;
|
|
@@ -1139,27 +1175,27 @@ function useRowSelection({
|
|
|
1139
1175
|
getRowId,
|
|
1140
1176
|
enabled = true
|
|
1141
1177
|
}) {
|
|
1142
|
-
const identify =
|
|
1178
|
+
const identify = React18.useCallback(
|
|
1143
1179
|
(row) => getRowId ? getRowId(row) : String(row?.id ?? ""),
|
|
1144
1180
|
[getRowId]
|
|
1145
1181
|
);
|
|
1146
|
-
const visible =
|
|
1147
|
-
const [rawSelection, setRawSelection] =
|
|
1148
|
-
const visibleIds =
|
|
1149
|
-
const selectedIds =
|
|
1182
|
+
const visible = React18.useMemo(() => rows ?? [], [rows]);
|
|
1183
|
+
const [rawSelection, setRawSelection] = React18.useState([]);
|
|
1184
|
+
const visibleIds = React18.useMemo(() => new Set(visible.map(identify)), [visible, identify]);
|
|
1185
|
+
const selectedIds = React18.useMemo(
|
|
1150
1186
|
() => rawSelection.filter((id) => visibleIds.has(id)),
|
|
1151
1187
|
[rawSelection, visibleIds]
|
|
1152
1188
|
);
|
|
1153
|
-
const selectedRows =
|
|
1189
|
+
const selectedRows = React18.useMemo(() => {
|
|
1154
1190
|
const picked = new Set(selectedIds);
|
|
1155
1191
|
return visible.filter((row) => picked.has(identify(row)));
|
|
1156
1192
|
}, [visible, selectedIds, identify]);
|
|
1157
|
-
const clear =
|
|
1158
|
-
const selectAll =
|
|
1193
|
+
const clear = React18.useCallback(() => setRawSelection([]), []);
|
|
1194
|
+
const selectAll = React18.useCallback(
|
|
1159
1195
|
() => setRawSelection(visible.map(identify)),
|
|
1160
1196
|
[visible, identify]
|
|
1161
1197
|
);
|
|
1162
|
-
const barActions =
|
|
1198
|
+
const barActions = React18.useMemo(
|
|
1163
1199
|
() => (actions ?? []).map((action) => ({
|
|
1164
1200
|
id: action.id,
|
|
1165
1201
|
label: action.label,
|
|
@@ -1231,10 +1267,10 @@ function ListFilterBar({
|
|
|
1231
1267
|
className
|
|
1232
1268
|
}) {
|
|
1233
1269
|
const wide = useIsWide();
|
|
1234
|
-
const usable =
|
|
1270
|
+
const usable = React18.useMemo(() => (filters ?? []).filter((f) => f.options.length > 0), [filters]);
|
|
1235
1271
|
const active = usable.filter((f) => f.value != null && f.value !== "");
|
|
1236
1272
|
const total = activeCount ?? active.length;
|
|
1237
|
-
const fields =
|
|
1273
|
+
const fields = React18.useMemo(() => [
|
|
1238
1274
|
...usable.map((f) => ({
|
|
1239
1275
|
id: f.id,
|
|
1240
1276
|
label: f.label,
|
|
@@ -1388,7 +1424,7 @@ function ListView({
|
|
|
1388
1424
|
const showSearch = !!onSearchChange;
|
|
1389
1425
|
const showTags = tags && tags.length > 0 && onTagChange;
|
|
1390
1426
|
const selection = useRowSelection({ rows: loading ? [] : data, actions: bulkActions, getRowId });
|
|
1391
|
-
const allFilters =
|
|
1427
|
+
const allFilters = React18.useMemo(() => [
|
|
1392
1428
|
...showTags ? [{
|
|
1393
1429
|
id: "__tag",
|
|
1394
1430
|
label: tagsLabel ?? allTagLabel,
|
|
@@ -1612,7 +1648,9 @@ var TRIGGER_VARIANT = {
|
|
|
1612
1648
|
// Mesmas medidas e cores de FilterChip.
|
|
1613
1649
|
chip: "rounded-full border border-transparent bg-muted/70 px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
1614
1650
|
// O tracejado é o que diz que o texto se edita. Sem ele a data lê como rótulo.
|
|
1615
|
-
|
|
1651
|
+
// A tinta vem do InlineLink: o mesmo traço estava escrito aqui, no gatilho de
|
|
1652
|
+
// forma de pagamento e na barra de ferramentas, com três grafias.
|
|
1653
|
+
inline: `text-xs font-medium text-primary hover:opacity-80 ${INLINE_LINK_TONE.dashed}`
|
|
1616
1654
|
};
|
|
1617
1655
|
function DatePicker({ value, onChange, className, variant = "input", format = "long", defaultOpen, onOpenChange }) {
|
|
1618
1656
|
const t = useTranslation();
|
|
@@ -1779,7 +1817,7 @@ function toLocalISODate(d) {
|
|
|
1779
1817
|
}
|
|
1780
1818
|
function MiniCalendar({ selectedDate, onDateSelect, onMonthChange, markers }) {
|
|
1781
1819
|
const locale = getCurrentLocale();
|
|
1782
|
-
const [viewMonth, setViewMonth] =
|
|
1820
|
+
const [viewMonth, setViewMonth] = React18__default.useState(() => new Date(selectedDate.getFullYear(), selectedDate.getMonth(), 1));
|
|
1783
1821
|
const monthLabel = viewMonth.toLocaleDateString(toDateLocale2(locale), { month: "long", year: "numeric" });
|
|
1784
1822
|
const dayLabels = DAY_LABELS2[locale] ?? DAY_LABELS2.en;
|
|
1785
1823
|
const weeks = useMemo(() => {
|
|
@@ -1859,7 +1897,7 @@ function FilterSection({
|
|
|
1859
1897
|
count,
|
|
1860
1898
|
children
|
|
1861
1899
|
}) {
|
|
1862
|
-
const [open, setOpen] =
|
|
1900
|
+
const [open, setOpen] = React18__default.useState(defaultOpen);
|
|
1863
1901
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1864
1902
|
/* @__PURE__ */ jsxs(
|
|
1865
1903
|
"button",
|
|
@@ -1935,7 +1973,7 @@ function FilterCheckList({
|
|
|
1935
1973
|
}
|
|
1936
1974
|
return /* @__PURE__ */ jsx("div", { className: className ? `${className} space-y-0.5` : "space-y-0.5", children: rows });
|
|
1937
1975
|
}
|
|
1938
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1976
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React18.useLayoutEffect : React18.useEffect;
|
|
1939
1977
|
function SearchSelect({
|
|
1940
1978
|
value,
|
|
1941
1979
|
displayValue,
|
|
@@ -1960,6 +1998,7 @@ function SearchSelect({
|
|
|
1960
1998
|
loadOnOpen = true,
|
|
1961
1999
|
variant = "field",
|
|
1962
2000
|
icon: FilterIcon,
|
|
2001
|
+
leading,
|
|
1963
2002
|
emptyValue = "____",
|
|
1964
2003
|
className,
|
|
1965
2004
|
disabled,
|
|
@@ -1967,19 +2006,19 @@ function SearchSelect({
|
|
|
1967
2006
|
}) {
|
|
1968
2007
|
const isRequiredFilter = variant === "required-filter";
|
|
1969
2008
|
const canCreate = !!onCreate && allowCreate !== false;
|
|
1970
|
-
const [open, setOpen] =
|
|
1971
|
-
const [query, setQuery] =
|
|
1972
|
-
const [results, setResults] =
|
|
1973
|
-
const [loading, setLoading] =
|
|
1974
|
-
const [creating, setCreating] =
|
|
1975
|
-
const [selectedLabel, setSelectedLabel] =
|
|
1976
|
-
const containerRef =
|
|
1977
|
-
const inputRef =
|
|
1978
|
-
const timerRef =
|
|
1979
|
-
const [rect, setRect] =
|
|
1980
|
-
const dropdownRef =
|
|
1981
|
-
const requestRef =
|
|
1982
|
-
|
|
2009
|
+
const [open, setOpen] = React18.useState(false);
|
|
2010
|
+
const [query, setQuery] = React18.useState("");
|
|
2011
|
+
const [results, setResults] = React18.useState([]);
|
|
2012
|
+
const [loading, setLoading] = React18.useState(false);
|
|
2013
|
+
const [creating, setCreating] = React18.useState(false);
|
|
2014
|
+
const [selectedLabel, setSelectedLabel] = React18.useState(displayValue ?? "");
|
|
2015
|
+
const containerRef = React18.useRef(null);
|
|
2016
|
+
const inputRef = React18.useRef(null);
|
|
2017
|
+
const timerRef = React18.useRef();
|
|
2018
|
+
const [rect, setRect] = React18.useState(null);
|
|
2019
|
+
const dropdownRef = React18.useRef(null);
|
|
2020
|
+
const requestRef = React18.useRef(0);
|
|
2021
|
+
React18.useEffect(() => {
|
|
1983
2022
|
function handler(e) {
|
|
1984
2023
|
const target = e.target;
|
|
1985
2024
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -1989,10 +2028,10 @@ function SearchSelect({
|
|
|
1989
2028
|
document.addEventListener("mousedown", handler);
|
|
1990
2029
|
return () => document.removeEventListener("mousedown", handler);
|
|
1991
2030
|
}, []);
|
|
1992
|
-
|
|
2031
|
+
React18.useEffect(() => {
|
|
1993
2032
|
if (displayValue !== void 0) setSelectedLabel(displayValue);
|
|
1994
2033
|
}, [displayValue]);
|
|
1995
|
-
|
|
2034
|
+
React18.useEffect(() => {
|
|
1996
2035
|
if (open && loadOnOpen && query.length === 0 && results.length === 0 && !loading) {
|
|
1997
2036
|
const request = ++requestRef.current;
|
|
1998
2037
|
setLoading(true);
|
|
@@ -2060,7 +2099,7 @@ function SearchSelect({
|
|
|
2060
2099
|
setResults([]);
|
|
2061
2100
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
2062
2101
|
}
|
|
2063
|
-
const groups =
|
|
2102
|
+
const groups = React18.useMemo(() => {
|
|
2064
2103
|
const map = /* @__PURE__ */ new Map();
|
|
2065
2104
|
for (const opt of results) {
|
|
2066
2105
|
const group = opt.group ?? "";
|
|
@@ -2151,7 +2190,7 @@ function SearchSelect({
|
|
|
2151
2190
|
disabled && "opacity-50 cursor-not-allowed"
|
|
2152
2191
|
),
|
|
2153
2192
|
children: [
|
|
2154
|
-
/* @__PURE__ */ jsx(Search, { className: "h-3.5 w-3.5 text-muted-foreground ml-3 shrink-0" }),
|
|
2193
|
+
leading && hasValue && !open ? /* @__PURE__ */ jsx("span", { className: "ml-2.5 flex shrink-0 items-center", children: leading }) : /* @__PURE__ */ jsx(Search, { className: "h-3.5 w-3.5 text-muted-foreground ml-3 shrink-0" }),
|
|
2155
2194
|
open ? /* @__PURE__ */ jsx(
|
|
2156
2195
|
"input",
|
|
2157
2196
|
{
|
|
@@ -2254,7 +2293,7 @@ function SearchSelect({
|
|
|
2254
2293
|
]
|
|
2255
2294
|
},
|
|
2256
2295
|
group
|
|
2257
|
-
)) }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(
|
|
2296
|
+
)) }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React18.Fragment, { children: [
|
|
2258
2297
|
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 }),
|
|
2259
2298
|
options.map(optionButton)
|
|
2260
2299
|
] }, group)) }),
|
|
@@ -2297,9 +2336,9 @@ function CurrencyInput({
|
|
|
2297
2336
|
className,
|
|
2298
2337
|
disabled
|
|
2299
2338
|
}) {
|
|
2300
|
-
const inputRef =
|
|
2301
|
-
const [focused, setFocused] =
|
|
2302
|
-
const format =
|
|
2339
|
+
const inputRef = React18.useRef(null);
|
|
2340
|
+
const [focused, setFocused] = React18.useState(false);
|
|
2341
|
+
const format = React18.useCallback((v) => {
|
|
2303
2342
|
return new Intl.NumberFormat(locale, {
|
|
2304
2343
|
minimumFractionDigits: 2,
|
|
2305
2344
|
maximumFractionDigits: 2
|
|
@@ -2426,9 +2465,9 @@ function RequiredFilter({
|
|
|
2426
2465
|
className,
|
|
2427
2466
|
contentClassName
|
|
2428
2467
|
}) {
|
|
2429
|
-
const [open, setOpen] =
|
|
2468
|
+
const [open, setOpen] = React18.useState(false);
|
|
2430
2469
|
const missing = !value;
|
|
2431
|
-
const close =
|
|
2470
|
+
const close = React18.useCallback(() => setOpen(false), []);
|
|
2432
2471
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
2433
2472
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2434
2473
|
"button",
|
|
@@ -2474,9 +2513,9 @@ function FilterPanel({
|
|
|
2474
2513
|
className
|
|
2475
2514
|
}) {
|
|
2476
2515
|
const blocked = Boolean(applyDisabledReason);
|
|
2477
|
-
const [aberto, setAberto] =
|
|
2478
|
-
const jaAbriu =
|
|
2479
|
-
|
|
2516
|
+
const [aberto, setAberto] = React18.useState(Boolean(advancedCount));
|
|
2517
|
+
const jaAbriu = React18.useRef(Boolean(advancedCount));
|
|
2518
|
+
React18.useEffect(() => {
|
|
2480
2519
|
if (advancedCount && !jaAbriu.current) {
|
|
2481
2520
|
jaAbriu.current = true;
|
|
2482
2521
|
setAberto(true);
|
|
@@ -2551,23 +2590,23 @@ function FilterPanelField({ label, compact, required, className, children }) {
|
|
|
2551
2590
|
}
|
|
2552
2591
|
FilterPanelField.displayName = "FilterPanelField";
|
|
2553
2592
|
function useFilterDraft(initial) {
|
|
2554
|
-
const inicial =
|
|
2555
|
-
const [draft, setDraft] =
|
|
2556
|
-
const [applied, setApplied] =
|
|
2557
|
-
const dirty =
|
|
2593
|
+
const inicial = React18.useRef(initial);
|
|
2594
|
+
const [draft, setDraft] = React18.useState(initial);
|
|
2595
|
+
const [applied, setApplied] = React18.useState(initial);
|
|
2596
|
+
const dirty = React18.useMemo(
|
|
2558
2597
|
() => JSON.stringify(draft) !== JSON.stringify(applied),
|
|
2559
2598
|
[draft, applied]
|
|
2560
2599
|
);
|
|
2561
|
-
const patch =
|
|
2600
|
+
const patch = React18.useCallback((changes) => {
|
|
2562
2601
|
setDraft((atual) => ({ ...atual, ...changes }));
|
|
2563
2602
|
}, []);
|
|
2564
|
-
const apply =
|
|
2603
|
+
const apply = React18.useCallback(() => {
|
|
2565
2604
|
setDraft((atual) => {
|
|
2566
2605
|
setApplied(atual);
|
|
2567
2606
|
return atual;
|
|
2568
2607
|
});
|
|
2569
2608
|
}, []);
|
|
2570
|
-
const reset =
|
|
2609
|
+
const reset = React18.useCallback((value) => {
|
|
2571
2610
|
const alvo = value ?? inicial.current;
|
|
2572
2611
|
setDraft(alvo);
|
|
2573
2612
|
setApplied(alvo);
|
|
@@ -2603,7 +2642,7 @@ function DateRangeChip({
|
|
|
2603
2642
|
label,
|
|
2604
2643
|
className
|
|
2605
2644
|
}) {
|
|
2606
|
-
const [open, setOpen] =
|
|
2645
|
+
const [open, setOpen] = React18.useState(false);
|
|
2607
2646
|
const active = !!(from || to);
|
|
2608
2647
|
const locale = typeof navigator !== "undefined" ? navigator.language : "en";
|
|
2609
2648
|
const presetLabel = presets.find((p) => p.value === preset)?.label;
|
|
@@ -2708,9 +2747,9 @@ function MultiSelect({
|
|
|
2708
2747
|
variant = "field",
|
|
2709
2748
|
icon: Icon2
|
|
2710
2749
|
}) {
|
|
2711
|
-
const [query, setQuery] =
|
|
2712
|
-
const selected =
|
|
2713
|
-
const filtered =
|
|
2750
|
+
const [query, setQuery] = React18.useState("");
|
|
2751
|
+
const selected = React18.useMemo(() => new Set(value), [value]);
|
|
2752
|
+
const filtered = React18.useMemo(() => {
|
|
2714
2753
|
const q = query.trim().toLowerCase();
|
|
2715
2754
|
if (!q) return options;
|
|
2716
2755
|
return options.filter((o) => o.label.toLowerCase().includes(q));
|
|
@@ -2848,8 +2887,8 @@ function hueFor(name) {
|
|
|
2848
2887
|
return AVATAR_HUES[h % AVATAR_HUES.length];
|
|
2849
2888
|
}
|
|
2850
2889
|
function PersonAvatar({ name, src, size = "sm", className }) {
|
|
2851
|
-
const [failed, setFailed] =
|
|
2852
|
-
|
|
2890
|
+
const [failed, setFailed] = React18.useState(false);
|
|
2891
|
+
React18.useEffect(() => {
|
|
2853
2892
|
setFailed(false);
|
|
2854
2893
|
}, [src]);
|
|
2855
2894
|
const base = cn("shrink-0 overflow-hidden rounded-full", AVATAR_SIZE[size], className);
|
|
@@ -2889,7 +2928,7 @@ function ListShell({
|
|
|
2889
2928
|
footer,
|
|
2890
2929
|
children
|
|
2891
2930
|
}) {
|
|
2892
|
-
const filtered =
|
|
2931
|
+
const filtered = React18.useMemo(() => {
|
|
2893
2932
|
const q = query.trim().toLowerCase();
|
|
2894
2933
|
if (!q) return options;
|
|
2895
2934
|
return options.filter((o) => o.name.toLowerCase().includes(q));
|
|
@@ -2912,7 +2951,7 @@ function ListShell({
|
|
|
2912
2951
|
)
|
|
2913
2952
|
] }),
|
|
2914
2953
|
/* @__PURE__ */ jsxs("div", { className: "max-h-72 overflow-y-auto py-1", children: [
|
|
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(
|
|
2954
|
+
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(React18.Fragment, { children: children(o) }, o.id)),
|
|
2916
2955
|
footer
|
|
2917
2956
|
] })
|
|
2918
2957
|
] });
|
|
@@ -2947,8 +2986,8 @@ function PersonPicker({
|
|
|
2947
2986
|
onClear,
|
|
2948
2987
|
variant = "input"
|
|
2949
2988
|
}) {
|
|
2950
|
-
const [query, setQuery] =
|
|
2951
|
-
const [open, setOpen] =
|
|
2989
|
+
const [query, setQuery] = React18.useState("");
|
|
2990
|
+
const [open, setOpen] = React18.useState(false);
|
|
2952
2991
|
const current = options.find((o) => o.id === value);
|
|
2953
2992
|
return /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
2954
2993
|
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, disabled, children: /* @__PURE__ */ jsxs("button", { type: "button", disabled, className: cn(TRIGGER_CLASSES[variant], className), children: [
|
|
@@ -3026,8 +3065,8 @@ function PersonMultiPicker({
|
|
|
3026
3065
|
max,
|
|
3027
3066
|
variant = "input"
|
|
3028
3067
|
}) {
|
|
3029
|
-
const [query, setQuery] =
|
|
3030
|
-
const selected =
|
|
3068
|
+
const [query, setQuery] = React18.useState("");
|
|
3069
|
+
const selected = React18.useMemo(() => new Set(value), [value]);
|
|
3031
3070
|
const atCeiling = max != null && value.length >= max;
|
|
3032
3071
|
function toggle(id) {
|
|
3033
3072
|
if (selected.has(id)) onChange(value.filter((x) => x !== id));
|
|
@@ -3126,17 +3165,17 @@ function DictateButton({
|
|
|
3126
3165
|
className,
|
|
3127
3166
|
disabled
|
|
3128
3167
|
}) {
|
|
3129
|
-
const [ouvindo, setOuvindo] =
|
|
3130
|
-
const [erro, setErro] =
|
|
3131
|
-
const ref =
|
|
3132
|
-
const [suportado, setSuportado] =
|
|
3133
|
-
|
|
3168
|
+
const [ouvindo, setOuvindo] = React18.useState(false);
|
|
3169
|
+
const [erro, setErro] = React18.useState(null);
|
|
3170
|
+
const ref = React18.useRef(null);
|
|
3171
|
+
const [suportado, setSuportado] = React18.useState(false);
|
|
3172
|
+
React18.useEffect(() => {
|
|
3134
3173
|
setSuportado(recognitionCtor() !== null);
|
|
3135
3174
|
}, []);
|
|
3136
|
-
|
|
3175
|
+
React18.useEffect(() => () => {
|
|
3137
3176
|
ref.current?.stop();
|
|
3138
3177
|
}, []);
|
|
3139
|
-
const alternar =
|
|
3178
|
+
const alternar = React18.useCallback(() => {
|
|
3140
3179
|
if (ouvindo) {
|
|
3141
3180
|
ref.current?.stop();
|
|
3142
3181
|
return;
|
|
@@ -3199,7 +3238,7 @@ function renderInline(text, keyPrefix) {
|
|
|
3199
3238
|
if (part.startsWith("`") && part.endsWith("`") && part.length > 2) {
|
|
3200
3239
|
return /* @__PURE__ */ jsx("code", { className: "rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]", children: part.slice(1, -1) }, key);
|
|
3201
3240
|
}
|
|
3202
|
-
return part === "" ? null : /* @__PURE__ */ jsx(
|
|
3241
|
+
return part === "" ? null : /* @__PURE__ */ jsx(React18.Fragment, { children: part }, key);
|
|
3203
3242
|
});
|
|
3204
3243
|
}
|
|
3205
3244
|
function parseBlocks(source) {
|
|
@@ -3283,7 +3322,7 @@ function renderMarkdown(source) {
|
|
|
3283
3322
|
case "ol":
|
|
3284
3323
|
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);
|
|
3285
3324
|
case "p":
|
|
3286
|
-
return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(
|
|
3325
|
+
return /* @__PURE__ */ jsx("p", { children: block.lines.map((l, li) => /* @__PURE__ */ jsxs(React18.Fragment, { children: [
|
|
3287
3326
|
li > 0 && /* @__PURE__ */ jsx("br", {}),
|
|
3288
3327
|
renderInline(l, `${key}-${li}`)
|
|
3289
3328
|
] }, `${key}-${li}`)) }, key);
|
|
@@ -3304,7 +3343,7 @@ function MarkdownEditor({
|
|
|
3304
3343
|
renderPreview,
|
|
3305
3344
|
className
|
|
3306
3345
|
}) {
|
|
3307
|
-
const [mode, setMode] =
|
|
3346
|
+
const [mode, setMode] = React18.useState(
|
|
3308
3347
|
defaultMode === "preview" && value.trim() === "" ? "edit" : defaultMode
|
|
3309
3348
|
);
|
|
3310
3349
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
@@ -3589,29 +3628,29 @@ function PickerList({
|
|
|
3589
3628
|
listClassName,
|
|
3590
3629
|
autoFocus = true
|
|
3591
3630
|
}) {
|
|
3592
|
-
const [query, setQuery] =
|
|
3631
|
+
const [query, setQuery] = React18.useState("");
|
|
3593
3632
|
const term = normalize(query.trim());
|
|
3594
|
-
const sections =
|
|
3633
|
+
const sections = React18.useMemo(
|
|
3595
3634
|
() => groups ?? [{ id: "_", options: options ?? [] }],
|
|
3596
3635
|
[groups, options]
|
|
3597
3636
|
);
|
|
3598
|
-
const total =
|
|
3637
|
+
const total = React18.useMemo(
|
|
3599
3638
|
() => sections.reduce((n, g) => n + g.options.length, 0),
|
|
3600
3639
|
[sections]
|
|
3601
3640
|
);
|
|
3602
|
-
const visible =
|
|
3641
|
+
const visible = React18.useMemo(() => {
|
|
3603
3642
|
if (!term) return sections;
|
|
3604
3643
|
const hits = sections.flatMap((g) => g.options.filter((o) => optionMatches(o, term)));
|
|
3605
3644
|
return [{ id: "_results", options: hits }];
|
|
3606
3645
|
}, [sections, term]);
|
|
3607
|
-
const flat =
|
|
3608
|
-
const [active, setActive] =
|
|
3609
|
-
const listRef =
|
|
3610
|
-
|
|
3646
|
+
const flat = React18.useMemo(() => visible.flatMap((g) => g.options), [visible]);
|
|
3647
|
+
const [active, setActive] = React18.useState(0);
|
|
3648
|
+
const listRef = React18.useRef(null);
|
|
3649
|
+
React18.useEffect(() => {
|
|
3611
3650
|
const i = flat.findIndex((o) => o.id === value);
|
|
3612
3651
|
setActive(i >= 0 ? i : 0);
|
|
3613
3652
|
}, [term]);
|
|
3614
|
-
|
|
3653
|
+
React18.useEffect(() => {
|
|
3615
3654
|
listRef.current?.querySelector(`[data-picker-index="${active}"]`)?.scrollIntoView({ block: "nearest" });
|
|
3616
3655
|
}, [active]);
|
|
3617
3656
|
function step(delta) {
|
|
@@ -3673,7 +3712,7 @@ function PickerList({
|
|
|
3673
3712
|
className: cn("min-h-0 flex-1 overflow-y-auto py-1", listClassName),
|
|
3674
3713
|
children: [
|
|
3675
3714
|
flat.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyLabel }),
|
|
3676
|
-
visible.map((group) => /* @__PURE__ */ jsxs(
|
|
3715
|
+
visible.map((group) => /* @__PURE__ */ jsxs(React18.Fragment, { children: [
|
|
3677
3716
|
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 }),
|
|
3678
3717
|
group.options.map((o) => {
|
|
3679
3718
|
index += 1;
|
|
@@ -3894,7 +3933,7 @@ function NestedPane({ title, hint, onBack, children, className }) {
|
|
|
3894
3933
|
children
|
|
3895
3934
|
] });
|
|
3896
3935
|
}
|
|
3897
|
-
var ModalTaskContext =
|
|
3936
|
+
var ModalTaskContext = React18.createContext(null);
|
|
3898
3937
|
function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
3899
3938
|
const popTo = (index) => {
|
|
3900
3939
|
for (let i = stack.length - 1; i > index; i--) stack[i].onBack();
|
|
@@ -3927,7 +3966,7 @@ function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
|
3927
3966
|
children: title
|
|
3928
3967
|
}
|
|
3929
3968
|
),
|
|
3930
|
-
stack.map((c, i) => /* @__PURE__ */ jsxs(
|
|
3969
|
+
stack.map((c, i) => /* @__PURE__ */ jsxs(React18.Fragment, { children: [
|
|
3931
3970
|
/* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground/50", "aria-hidden": true }),
|
|
3932
3971
|
i < stack.length - 1 ? /* @__PURE__ */ jsx(
|
|
3933
3972
|
"button",
|
|
@@ -3953,10 +3992,10 @@ function ModalTaskHeader({ title, hint, stack, onClose }) {
|
|
|
3953
3992
|
] });
|
|
3954
3993
|
}
|
|
3955
3994
|
function ModalTaskHost({ children, className, header }) {
|
|
3956
|
-
const [stack, setStack] =
|
|
3957
|
-
const [slot, setSlot] =
|
|
3958
|
-
const idRef =
|
|
3959
|
-
const api =
|
|
3995
|
+
const [stack, setStack] = React18.useState([]);
|
|
3996
|
+
const [slot, setSlot] = React18.useState(null);
|
|
3997
|
+
const idRef = React18.useRef(0);
|
|
3998
|
+
const api = React18.useMemo(() => ({
|
|
3960
3999
|
open: (meta) => {
|
|
3961
4000
|
const id = ++idRef.current;
|
|
3962
4001
|
setStack((s) => [...s, { id, meta }]);
|
|
@@ -3965,7 +4004,7 @@ function ModalTaskHost({ children, className, header }) {
|
|
|
3965
4004
|
close: (id) => setStack((s) => s.filter((e) => e.id !== id))
|
|
3966
4005
|
}), []);
|
|
3967
4006
|
const top = stack.length ? stack[stack.length - 1] : null;
|
|
3968
|
-
const value =
|
|
4007
|
+
const value = React18.useMemo(
|
|
3969
4008
|
() => ({ ...api, topId: top?.id ?? null, slot }),
|
|
3970
4009
|
[api, top?.id, slot]
|
|
3971
4010
|
);
|
|
@@ -3976,14 +4015,14 @@ function ModalTaskHost({ children, className, header }) {
|
|
|
3976
4015
|
] });
|
|
3977
4016
|
}
|
|
3978
4017
|
function useInModalTaskHost() {
|
|
3979
|
-
return
|
|
4018
|
+
return React18.useContext(ModalTaskContext) !== null;
|
|
3980
4019
|
}
|
|
3981
4020
|
function ModalTask({ open, title, hint, onClose, width, children }) {
|
|
3982
|
-
const host =
|
|
3983
|
-
const onCloseRef =
|
|
4021
|
+
const host = React18.useContext(ModalTaskContext);
|
|
4022
|
+
const onCloseRef = React18.useRef(onClose);
|
|
3984
4023
|
onCloseRef.current = onClose;
|
|
3985
|
-
const [myId, setMyId] =
|
|
3986
|
-
|
|
4024
|
+
const [myId, setMyId] = React18.useState(null);
|
|
4025
|
+
React18.useEffect(() => {
|
|
3987
4026
|
if (!host || !open) return;
|
|
3988
4027
|
const id = host.open({ title, hint, onBack: () => onCloseRef.current() });
|
|
3989
4028
|
setMyId(id);
|
|
@@ -4049,13 +4088,13 @@ function StockEntryForm({
|
|
|
4049
4088
|
labels: overrides
|
|
4050
4089
|
}) {
|
|
4051
4090
|
const labels = { ...DEFAULT_LABELS, ...overrides };
|
|
4052
|
-
const [quantity, setQuantity] =
|
|
4053
|
-
const [reasonCode, setReasonCode] =
|
|
4054
|
-
const [occurredOn, setOccurredOn] =
|
|
4055
|
-
const [note, setNote] =
|
|
4056
|
-
const [noteOpen, setNoteOpen] =
|
|
4057
|
-
const quantityRef =
|
|
4058
|
-
|
|
4091
|
+
const [quantity, setQuantity] = React18.useState("");
|
|
4092
|
+
const [reasonCode, setReasonCode] = React18.useState("");
|
|
4093
|
+
const [occurredOn, setOccurredOn] = React18.useState(todayISO());
|
|
4094
|
+
const [note, setNote] = React18.useState("");
|
|
4095
|
+
const [noteOpen, setNoteOpen] = React18.useState(false);
|
|
4096
|
+
const quantityRef = React18.useRef(null);
|
|
4097
|
+
React18.useEffect(() => {
|
|
4059
4098
|
if (verb === null) return;
|
|
4060
4099
|
setQuantity("");
|
|
4061
4100
|
setReasonCode("");
|
|
@@ -4294,7 +4333,7 @@ function FilterRail({
|
|
|
4294
4333
|
)
|
|
4295
4334
|
] }),
|
|
4296
4335
|
before,
|
|
4297
|
-
visible.map((section, index) => /* @__PURE__ */ jsxs(
|
|
4336
|
+
visible.map((section, index) => /* @__PURE__ */ jsxs(React18__default.Fragment, { children: [
|
|
4298
4337
|
(index > 0 || !!before || !!actions || !!search) && /* @__PURE__ */ jsx("div", { className: "my-4 h-px bg-border" }),
|
|
4299
4338
|
/* @__PURE__ */ jsx(
|
|
4300
4339
|
FilterSection,
|
|
@@ -4380,6 +4419,6 @@ function AdaptiveFilter({
|
|
|
4380
4419
|
);
|
|
4381
4420
|
}
|
|
4382
4421
|
|
|
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-
|
|
4385
|
-
//# sourceMappingURL=chunk-
|
|
4422
|
+
export { AdaptiveFilter, AiActionButton, 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, INLINE_LINK_TONE, InlineLink, 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 };
|
|
4423
|
+
//# sourceMappingURL=chunk-7W6WRDDF.js.map
|
|
4424
|
+
//# sourceMappingURL=chunk-7W6WRDDF.js.map
|