@cnc-ti/layout-basic 8.5.0 → 8.7.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/index.css +756 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +539 -37
- package/dist/index.d.ts +539 -37
- package/dist/index.js +2655 -329
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2617 -338
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (typeof window !== 'undefined') {
|
|
3
|
-
"use client";
|
|
4
|
-
}
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
6
2
|
"use strict";
|
|
7
3
|
var __create = Object.create;
|
|
8
4
|
var __defProp = Object.defineProperty;
|
|
@@ -35,8 +31,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
35
31
|
// src/index.ts
|
|
36
32
|
var src_exports = {};
|
|
37
33
|
__export(src_exports, {
|
|
34
|
+
AlertaItem: () => AlertaItem,
|
|
35
|
+
Alertas: () => Alertas,
|
|
38
36
|
AplicationsHeader: () => AplicationsHeader,
|
|
39
37
|
AppsMenu: () => AppsMenu,
|
|
38
|
+
Avatar: () => Avatar,
|
|
40
39
|
Badge: () => Badge,
|
|
41
40
|
Button: () => Button,
|
|
42
41
|
Card: () => Card,
|
|
@@ -59,6 +58,9 @@ __export(src_exports, {
|
|
|
59
58
|
CommandList: () => CommandList,
|
|
60
59
|
CommandSeparator: () => CommandSeparator,
|
|
61
60
|
CommandShortcut: () => CommandShortcut,
|
|
61
|
+
ConfirmDialog: () => ConfirmDialog,
|
|
62
|
+
DIAS_SEMANA_PT_BR: () => DIAS_SEMANA_PT_BR,
|
|
63
|
+
DateTimeRangeList: () => DateTimeRangeList,
|
|
62
64
|
Dialog: () => Dialog,
|
|
63
65
|
DialogClose: () => DialogClose,
|
|
64
66
|
DialogContent: () => DialogContent,
|
|
@@ -69,6 +71,19 @@ __export(src_exports, {
|
|
|
69
71
|
DialogPortal: () => DialogPortal,
|
|
70
72
|
DialogTitle: () => DialogTitle,
|
|
71
73
|
DialogTrigger: () => DialogTrigger,
|
|
74
|
+
Drawer: () => Drawer,
|
|
75
|
+
DrawerBody: () => DrawerBody,
|
|
76
|
+
DrawerClose: () => DrawerClose,
|
|
77
|
+
DrawerContent: () => DrawerContent,
|
|
78
|
+
DrawerContext: () => DrawerContext,
|
|
79
|
+
DrawerDescription: () => DrawerDescription,
|
|
80
|
+
DrawerFooter: () => DrawerFooter,
|
|
81
|
+
DrawerHeader: () => DrawerHeader,
|
|
82
|
+
DrawerOverlay: () => DrawerOverlay,
|
|
83
|
+
DrawerPortal: () => DrawerPortal,
|
|
84
|
+
DrawerProvider: () => DrawerProvider,
|
|
85
|
+
DrawerTitle: () => DrawerTitle,
|
|
86
|
+
DrawerTrigger: () => DrawerTrigger,
|
|
72
87
|
DropdownMenu: () => DropdownMenu,
|
|
73
88
|
DropdownMenuCheckboxItem: () => DropdownMenuCheckboxItem,
|
|
74
89
|
DropdownMenuContent: () => DropdownMenuContent,
|
|
@@ -84,24 +99,37 @@ __export(src_exports, {
|
|
|
84
99
|
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
85
100
|
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
86
101
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
102
|
+
EmptyState: () => EmptyState,
|
|
103
|
+
ErroAlertas: () => ErroAlertas,
|
|
87
104
|
ErroNotificacoes: () => ErroNotificacoes,
|
|
105
|
+
FileList: () => FileList,
|
|
106
|
+
FileUpload: () => FileUpload,
|
|
88
107
|
Filter: () => Filter,
|
|
108
|
+
FormularioAlerta: () => FormularioAlerta,
|
|
89
109
|
Header: () => Header,
|
|
90
110
|
HeaderContainer: () => HeaderContainer,
|
|
91
111
|
HeaderNotifications: () => HeaderNotifications,
|
|
92
112
|
HeaderProfileHeader: () => HeaderProfileHeader,
|
|
93
113
|
HeaderProfileItem: () => HeaderProfileItem,
|
|
94
114
|
Input: () => Input,
|
|
115
|
+
LabelValue: () => LabelValue,
|
|
116
|
+
MESES_PT_BR: () => MESES_PT_BR,
|
|
117
|
+
MESES_PT_BR_ABREV: () => MESES_PT_BR_ABREV,
|
|
118
|
+
MiniMonthCalendar: () => MiniMonthCalendar,
|
|
95
119
|
Modal: () => Modal,
|
|
96
120
|
ModalEntidade: () => ModalEntidade,
|
|
97
121
|
ModalMudancaEntidade: () => ModalMudancaEntidade,
|
|
122
|
+
MonthYearPicker: () => MonthYearPicker,
|
|
123
|
+
MultiSelect: () => MultiSelect,
|
|
98
124
|
PageHeader: () => PageHeader,
|
|
99
125
|
PageHeaderActionsContainer: () => PageHeaderActionsContainer,
|
|
100
126
|
PageHeaderTitle: () => PageHeaderTitle,
|
|
101
127
|
PageHeaderTitleContent: () => PageHeaderTitleContent,
|
|
128
|
+
PeriodRangeList: () => PeriodRangeList,
|
|
102
129
|
Popover: () => Popover,
|
|
103
130
|
PopoverContent: () => PopoverContent,
|
|
104
131
|
PopoverTrigger: () => PopoverTrigger,
|
|
132
|
+
ResultMetadata: () => ResultMetadata,
|
|
105
133
|
Select: () => Select,
|
|
106
134
|
SelectContent: () => SelectContent,
|
|
107
135
|
SelectGroup: () => SelectGroup,
|
|
@@ -124,10 +152,25 @@ __export(src_exports, {
|
|
|
124
152
|
TabsContent: () => TabsContent,
|
|
125
153
|
TabsList: () => TabsList,
|
|
126
154
|
TabsTrigger: () => TabsTrigger,
|
|
155
|
+
Textarea: () => Textarea,
|
|
127
156
|
Title: () => Title2,
|
|
157
|
+
Tooltip: () => Tooltip,
|
|
128
158
|
URL_PADRAO_NOTIFICACOES: () => URL_PADRAO_NOTIFICACOES,
|
|
129
159
|
availableApps: () => availableApps,
|
|
130
|
-
|
|
160
|
+
buildMonthDays: () => buildMonthDays,
|
|
161
|
+
buscarAlertas: () => buscarAlertas,
|
|
162
|
+
buttonVariants: () => buttonVariants,
|
|
163
|
+
formatDayAriaLabel: () => formatDayAriaLabel,
|
|
164
|
+
formatFileSize: () => formatFileSize,
|
|
165
|
+
formatMonthYear: () => formatMonthYear,
|
|
166
|
+
isSameDay: () => isSameDay,
|
|
167
|
+
isToday: () => isToday,
|
|
168
|
+
normalizarBaseUrl: () => normalizarBaseUrl,
|
|
169
|
+
toDateKey: () => toDateKey,
|
|
170
|
+
toLocalNoon: () => toLocalNoon,
|
|
171
|
+
usarAlertas: () => usarAlertas,
|
|
172
|
+
useDrawer: () => useDrawer,
|
|
173
|
+
validateFiles: () => validateFiles
|
|
131
174
|
});
|
|
132
175
|
module.exports = __toCommonJS(src_exports);
|
|
133
176
|
|
|
@@ -284,6 +327,20 @@ var Bell = createLucideIcon("Bell", [
|
|
|
284
327
|
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
285
328
|
]);
|
|
286
329
|
|
|
330
|
+
// ../../node_modules/lucide-react/dist/esm/icons/calendar-days.js
|
|
331
|
+
var CalendarDays = createLucideIcon("CalendarDays", [
|
|
332
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
333
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
334
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
335
|
+
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
336
|
+
["path", { d: "M8 14h.01", key: "6423bh" }],
|
|
337
|
+
["path", { d: "M12 14h.01", key: "1etili" }],
|
|
338
|
+
["path", { d: "M16 14h.01", key: "1gbofw" }],
|
|
339
|
+
["path", { d: "M8 18h.01", key: "lrp35t" }],
|
|
340
|
+
["path", { d: "M12 18h.01", key: "mhygvu" }],
|
|
341
|
+
["path", { d: "M16 18h.01", key: "kzsmim" }]
|
|
342
|
+
]);
|
|
343
|
+
|
|
287
344
|
// ../../node_modules/lucide-react/dist/esm/icons/check.js
|
|
288
345
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
289
346
|
|
|
@@ -292,6 +349,11 @@ var ChevronDown = createLucideIcon("ChevronDown", [
|
|
|
292
349
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
293
350
|
]);
|
|
294
351
|
|
|
352
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
|
|
353
|
+
var ChevronLeft = createLucideIcon("ChevronLeft", [
|
|
354
|
+
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
355
|
+
]);
|
|
356
|
+
|
|
295
357
|
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
296
358
|
var ChevronRight = createLucideIcon("ChevronRight", [
|
|
297
359
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
@@ -311,6 +373,29 @@ var Circle = createLucideIcon("Circle", [
|
|
|
311
373
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
312
374
|
]);
|
|
313
375
|
|
|
376
|
+
// ../../node_modules/lucide-react/dist/esm/icons/download.js
|
|
377
|
+
var Download = createLucideIcon("Download", [
|
|
378
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
379
|
+
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
380
|
+
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
381
|
+
]);
|
|
382
|
+
|
|
383
|
+
// ../../node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
384
|
+
var ExternalLink = createLucideIcon("ExternalLink", [
|
|
385
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
386
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
387
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
388
|
+
]);
|
|
389
|
+
|
|
390
|
+
// ../../node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
391
|
+
var FileText = createLucideIcon("FileText", [
|
|
392
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
393
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
394
|
+
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
395
|
+
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
396
|
+
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
397
|
+
]);
|
|
398
|
+
|
|
314
399
|
// ../../node_modules/lucide-react/dist/esm/icons/filter-x.js
|
|
315
400
|
var FilterX = createLucideIcon("FilterX", [
|
|
316
401
|
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
@@ -359,6 +444,35 @@ var Mail = createLucideIcon("Mail", [
|
|
|
359
444
|
["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }]
|
|
360
445
|
]);
|
|
361
446
|
|
|
447
|
+
// ../../node_modules/lucide-react/dist/esm/icons/paperclip.js
|
|
448
|
+
var Paperclip = createLucideIcon("Paperclip", [
|
|
449
|
+
[
|
|
450
|
+
"path",
|
|
451
|
+
{
|
|
452
|
+
d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",
|
|
453
|
+
key: "1u3ebp"
|
|
454
|
+
}
|
|
455
|
+
]
|
|
456
|
+
]);
|
|
457
|
+
|
|
458
|
+
// ../../node_modules/lucide-react/dist/esm/icons/pencil.js
|
|
459
|
+
var Pencil = createLucideIcon("Pencil", [
|
|
460
|
+
[
|
|
461
|
+
"path",
|
|
462
|
+
{
|
|
463
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
464
|
+
key: "1a8usu"
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
468
|
+
]);
|
|
469
|
+
|
|
470
|
+
// ../../node_modules/lucide-react/dist/esm/icons/plus.js
|
|
471
|
+
var Plus = createLucideIcon("Plus", [
|
|
472
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
473
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
474
|
+
]);
|
|
475
|
+
|
|
362
476
|
// ../../node_modules/lucide-react/dist/esm/icons/search.js
|
|
363
477
|
var Search = createLucideIcon("Search", [
|
|
364
478
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
@@ -374,6 +488,12 @@ var Trash2 = createLucideIcon("Trash2", [
|
|
|
374
488
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
375
489
|
]);
|
|
376
490
|
|
|
491
|
+
// ../../node_modules/lucide-react/dist/esm/icons/user.js
|
|
492
|
+
var User = createLucideIcon("User", [
|
|
493
|
+
["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
|
|
494
|
+
["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
|
|
495
|
+
]);
|
|
496
|
+
|
|
377
497
|
// ../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
378
498
|
var X = createLucideIcon("X", [
|
|
379
499
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
@@ -3961,15 +4081,53 @@ var Input = React9.forwardRef(
|
|
|
3961
4081
|
);
|
|
3962
4082
|
Input.displayName = "Input";
|
|
3963
4083
|
|
|
3964
|
-
// src/components/atoms/forms/
|
|
4084
|
+
// src/components/atoms/forms/textarea.tsx
|
|
3965
4085
|
var React10 = __toESM(require("react"));
|
|
3966
4086
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3967
|
-
var
|
|
4087
|
+
var Textarea = React10.forwardRef(
|
|
4088
|
+
({ className, id, label, required, ...props }, ref) => {
|
|
4089
|
+
const idGenerate = id ? id : label && `field-${Date.now()}-${Math.random() * 1e5}`;
|
|
4090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "cnc-w-full", children: [
|
|
4091
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4092
|
+
"label",
|
|
4093
|
+
{
|
|
4094
|
+
htmlFor: idGenerate,
|
|
4095
|
+
className: "cnc-block cnc-text-sm cnc-mb-1 cnc-font-medium cnc-text-brand-gray-600",
|
|
4096
|
+
children: [
|
|
4097
|
+
label,
|
|
4098
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-red-500", children: " *" })
|
|
4099
|
+
]
|
|
4100
|
+
}
|
|
4101
|
+
),
|
|
4102
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4103
|
+
"textarea",
|
|
4104
|
+
{
|
|
4105
|
+
id: idGenerate,
|
|
4106
|
+
className: cn(
|
|
4107
|
+
"cnc-flex cnc-min-h-[96px] cnc-w-full cnc-rounded-md cnc-border cnc-border-input cnc-bg-transparent cnc-px-3 cnc-py-2 cnc-text-base cnc-shadow-sm cnc-transition-colors",
|
|
4108
|
+
"placeholder:cnc-text-muted-foreground focus-visible:cnc-outline-none",
|
|
4109
|
+
"focus-visible:cnc-ring-2 focus-visible:cnc-ring-brand-gray-500/50 disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50 md:cnc-text-sm",
|
|
4110
|
+
"not-disabled:hover:cnc-border-brand-gray-500",
|
|
4111
|
+
className
|
|
4112
|
+
),
|
|
4113
|
+
ref,
|
|
4114
|
+
...props
|
|
4115
|
+
}
|
|
4116
|
+
)
|
|
4117
|
+
] });
|
|
4118
|
+
}
|
|
4119
|
+
);
|
|
4120
|
+
Textarea.displayName = "Textarea";
|
|
4121
|
+
|
|
4122
|
+
// src/components/atoms/forms/checkbox.tsx
|
|
4123
|
+
var React11 = __toESM(require("react"));
|
|
4124
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
4125
|
+
var Checkbox = React11.forwardRef(
|
|
3968
4126
|
({ className, id, label, ...props }, ref) => {
|
|
3969
4127
|
console.log();
|
|
3970
4128
|
const idGenerate = id ? id : label && `field-${Date.now()}-${Math.random() * 1e5}`;
|
|
3971
|
-
return /* @__PURE__ */ (0,
|
|
3972
|
-
/* @__PURE__ */ (0,
|
|
4129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "cnc-w-full cnc-flex cnc-flex-row", children: [
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3973
4131
|
"input",
|
|
3974
4132
|
{
|
|
3975
4133
|
type: "checkbox",
|
|
@@ -3979,7 +4137,7 @@ var Checkbox = React10.forwardRef(
|
|
|
3979
4137
|
...props
|
|
3980
4138
|
}
|
|
3981
4139
|
),
|
|
3982
|
-
label && /* @__PURE__ */ (0,
|
|
4140
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3983
4141
|
"label",
|
|
3984
4142
|
{
|
|
3985
4143
|
htmlFor: idGenerate,
|
|
@@ -3993,9 +4151,9 @@ var Checkbox = React10.forwardRef(
|
|
|
3993
4151
|
Checkbox.displayName = "Checkbox";
|
|
3994
4152
|
|
|
3995
4153
|
// src/components/atoms/forms/switch.tsx
|
|
3996
|
-
var
|
|
3997
|
-
var
|
|
3998
|
-
var Switch =
|
|
4154
|
+
var React12 = __toESM(require("react"));
|
|
4155
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
4156
|
+
var Switch = React12.forwardRef(
|
|
3999
4157
|
({
|
|
4000
4158
|
className,
|
|
4001
4159
|
id,
|
|
@@ -4009,12 +4167,12 @@ var Switch = React11.forwardRef(
|
|
|
4009
4167
|
name,
|
|
4010
4168
|
"aria-label": ariaLabel
|
|
4011
4169
|
}, ref) => {
|
|
4012
|
-
const [internalChecked, setInternalChecked] =
|
|
4170
|
+
const [internalChecked, setInternalChecked] = React12.useState(
|
|
4013
4171
|
defaultChecked ?? false
|
|
4014
4172
|
);
|
|
4015
4173
|
const isControlled = checked !== void 0;
|
|
4016
4174
|
const isChecked = isControlled ? checked : internalChecked;
|
|
4017
|
-
const reactId =
|
|
4175
|
+
const reactId = React12.useId();
|
|
4018
4176
|
const fieldId = id || reactId;
|
|
4019
4177
|
const handleToggle = () => {
|
|
4020
4178
|
if (disabled) return;
|
|
@@ -4024,8 +4182,8 @@ var Switch = React11.forwardRef(
|
|
|
4024
4182
|
}
|
|
4025
4183
|
onChange?.(newValue);
|
|
4026
4184
|
};
|
|
4027
|
-
return /* @__PURE__ */ (0,
|
|
4028
|
-
/* @__PURE__ */ (0,
|
|
4185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: cn("cnc-flex cnc-items-center cnc-gap-2", className), children: [
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4029
4187
|
"input",
|
|
4030
4188
|
{
|
|
4031
4189
|
type: "checkbox",
|
|
@@ -4037,7 +4195,7 @@ var Switch = React11.forwardRef(
|
|
|
4037
4195
|
"aria-hidden": "true"
|
|
4038
4196
|
}
|
|
4039
4197
|
),
|
|
4040
|
-
/* @__PURE__ */ (0,
|
|
4198
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4041
4199
|
"button",
|
|
4042
4200
|
{
|
|
4043
4201
|
ref,
|
|
@@ -4055,7 +4213,7 @@ var Switch = React11.forwardRef(
|
|
|
4055
4213
|
"disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50",
|
|
4056
4214
|
isChecked ? "cnc-bg-brand-blue-400 cnc-border-brand-blue-500" : "cnc-bg-brand-gray-20 cnc-border-brand-gray-100"
|
|
4057
4215
|
),
|
|
4058
|
-
children: /* @__PURE__ */ (0,
|
|
4216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4059
4217
|
"span",
|
|
4060
4218
|
{
|
|
4061
4219
|
className: cn(
|
|
@@ -4066,14 +4224,14 @@ var Switch = React11.forwardRef(
|
|
|
4066
4224
|
)
|
|
4067
4225
|
}
|
|
4068
4226
|
),
|
|
4069
|
-
label && /* @__PURE__ */ (0,
|
|
4227
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4070
4228
|
"label",
|
|
4071
4229
|
{
|
|
4072
4230
|
htmlFor: fieldId,
|
|
4073
4231
|
className: "cnc-text-sm cnc-font-medium cnc-text-brand-gray-600 cnc-cursor-pointer",
|
|
4074
4232
|
children: [
|
|
4075
4233
|
label,
|
|
4076
|
-
required && /* @__PURE__ */ (0,
|
|
4234
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "cnc-text-red-500", children: " *" })
|
|
4077
4235
|
]
|
|
4078
4236
|
}
|
|
4079
4237
|
)
|
|
@@ -4083,7 +4241,7 @@ var Switch = React11.forwardRef(
|
|
|
4083
4241
|
Switch.displayName = "Switch";
|
|
4084
4242
|
|
|
4085
4243
|
// src/components/atoms/display/badge.tsx
|
|
4086
|
-
var
|
|
4244
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4087
4245
|
var Badge = ({
|
|
4088
4246
|
variant = "default",
|
|
4089
4247
|
rounded = true,
|
|
@@ -4105,7 +4263,7 @@ var Badge = ({
|
|
|
4105
4263
|
md: "cnc-text-sm cnc-px-3 cnc-py-1",
|
|
4106
4264
|
lg: "cnc-text-base cnc-px-4 cnc-py-2"
|
|
4107
4265
|
};
|
|
4108
|
-
return /* @__PURE__ */ (0,
|
|
4266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
4109
4267
|
"span",
|
|
4110
4268
|
{
|
|
4111
4269
|
className: cn(
|
|
@@ -4120,13 +4278,73 @@ var Badge = ({
|
|
|
4120
4278
|
);
|
|
4121
4279
|
};
|
|
4122
4280
|
|
|
4281
|
+
// src/components/atoms/display/avatar.tsx
|
|
4282
|
+
var React13 = __toESM(require("react"));
|
|
4283
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4284
|
+
var avatarSizeClasses = {
|
|
4285
|
+
sm: "cnc-size-8 cnc-text-[10px]",
|
|
4286
|
+
md: "cnc-size-12 cnc-text-xs",
|
|
4287
|
+
lg: "cnc-size-16 cnc-text-sm",
|
|
4288
|
+
xl: "cnc-size-24 cnc-text-xl"
|
|
4289
|
+
};
|
|
4290
|
+
var avatarSizeIcon = {
|
|
4291
|
+
sm: 16,
|
|
4292
|
+
md: 20,
|
|
4293
|
+
lg: 28,
|
|
4294
|
+
xl: 40
|
|
4295
|
+
};
|
|
4296
|
+
function Avatar({
|
|
4297
|
+
src,
|
|
4298
|
+
alt,
|
|
4299
|
+
fallback,
|
|
4300
|
+
size = "md",
|
|
4301
|
+
isLoading = false,
|
|
4302
|
+
className,
|
|
4303
|
+
...props
|
|
4304
|
+
}) {
|
|
4305
|
+
const [hasError, setHasError] = React13.useState(false);
|
|
4306
|
+
const baseClasses = cn(
|
|
4307
|
+
"cnc-flex cnc-shrink-0 cnc-items-center cnc-justify-center cnc-overflow-hidden cnc-rounded-full cnc-border-2 cnc-border-brand-gray-50 cnc-bg-brand-gray-10 cnc-text-brand-gray-200",
|
|
4308
|
+
avatarSizeClasses[size],
|
|
4309
|
+
className
|
|
4310
|
+
);
|
|
4311
|
+
if (isLoading) {
|
|
4312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4313
|
+
"span",
|
|
4314
|
+
{
|
|
4315
|
+
className: cn(baseClasses, "cnc-animate-pulse cnc-bg-brand-gray-50"),
|
|
4316
|
+
role: "status",
|
|
4317
|
+
"aria-label": "Carregando avatar",
|
|
4318
|
+
...props
|
|
4319
|
+
}
|
|
4320
|
+
);
|
|
4321
|
+
}
|
|
4322
|
+
const showImage = src && !hasError;
|
|
4323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: baseClasses, ...props, children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4324
|
+
"img",
|
|
4325
|
+
{
|
|
4326
|
+
src,
|
|
4327
|
+
alt: alt ?? "Avatar",
|
|
4328
|
+
className: "cnc-h-full cnc-w-full cnc-object-cover",
|
|
4329
|
+
onError: () => setHasError(true)
|
|
4330
|
+
}
|
|
4331
|
+
) : fallback ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "cnc-font-bold", children: fallback }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4332
|
+
User,
|
|
4333
|
+
{
|
|
4334
|
+
className: "cnc-shrink-0",
|
|
4335
|
+
size: avatarSizeIcon[size],
|
|
4336
|
+
"aria-hidden": "true"
|
|
4337
|
+
}
|
|
4338
|
+
) });
|
|
4339
|
+
}
|
|
4340
|
+
|
|
4123
4341
|
// src/components/molecules/card.tsx
|
|
4124
|
-
var
|
|
4342
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4125
4343
|
function Card({
|
|
4126
4344
|
className,
|
|
4127
4345
|
...rest
|
|
4128
4346
|
}) {
|
|
4129
|
-
return /* @__PURE__ */ (0,
|
|
4347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4130
4348
|
"div",
|
|
4131
4349
|
{
|
|
4132
4350
|
className: cn(
|
|
@@ -4141,7 +4359,7 @@ function CardHeader({
|
|
|
4141
4359
|
className,
|
|
4142
4360
|
...rest
|
|
4143
4361
|
}) {
|
|
4144
|
-
return /* @__PURE__ */ (0,
|
|
4362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "cnc-px-6 cnc-pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4145
4363
|
"div",
|
|
4146
4364
|
{
|
|
4147
4365
|
className: cn(
|
|
@@ -4156,13 +4374,13 @@ function CardContent({
|
|
|
4156
4374
|
className,
|
|
4157
4375
|
...rest
|
|
4158
4376
|
}) {
|
|
4159
|
-
return /* @__PURE__ */ (0,
|
|
4377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("cnc-px-6 cnc-py-2", className), ...rest });
|
|
4160
4378
|
}
|
|
4161
4379
|
function CardFooter({
|
|
4162
4380
|
className,
|
|
4163
4381
|
...rest
|
|
4164
4382
|
}) {
|
|
4165
|
-
return /* @__PURE__ */ (0,
|
|
4383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4166
4384
|
"div",
|
|
4167
4385
|
{
|
|
4168
4386
|
className: cn(
|
|
@@ -4177,7 +4395,7 @@ function CardFooterItem({
|
|
|
4177
4395
|
className,
|
|
4178
4396
|
...rest
|
|
4179
4397
|
}) {
|
|
4180
|
-
return /* @__PURE__ */ (0,
|
|
4398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4181
4399
|
"div",
|
|
4182
4400
|
{
|
|
4183
4401
|
className: cn(
|
|
@@ -4191,7 +4409,7 @@ function CardFooterItem({
|
|
|
4191
4409
|
|
|
4192
4410
|
// src/components/molecules/collapsible.tsx
|
|
4193
4411
|
var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"));
|
|
4194
|
-
var
|
|
4412
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4195
4413
|
var Collapsible = CollapsiblePrimitive.Root;
|
|
4196
4414
|
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
4197
4415
|
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
@@ -4199,16 +4417,16 @@ var AnimatedCollapsibleContent = ({
|
|
|
4199
4417
|
className,
|
|
4200
4418
|
...rest
|
|
4201
4419
|
}) => {
|
|
4202
|
-
return /* @__PURE__ */ (0,
|
|
4420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CollapsibleContent2, { className: "cnc-collapsible-content", ...rest });
|
|
4203
4421
|
};
|
|
4204
4422
|
|
|
4205
4423
|
// src/components/molecules/display/page-header.tsx
|
|
4206
|
-
var
|
|
4424
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4207
4425
|
function PageHeader({
|
|
4208
4426
|
children,
|
|
4209
4427
|
className
|
|
4210
4428
|
}) {
|
|
4211
|
-
return /* @__PURE__ */ (0,
|
|
4429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4212
4430
|
"header",
|
|
4213
4431
|
{
|
|
4214
4432
|
className: cn(
|
|
@@ -4223,7 +4441,7 @@ function PageHeaderTitleContent({
|
|
|
4223
4441
|
children,
|
|
4224
4442
|
className
|
|
4225
4443
|
}) {
|
|
4226
|
-
return /* @__PURE__ */ (0,
|
|
4444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4227
4445
|
"div",
|
|
4228
4446
|
{
|
|
4229
4447
|
className: cn(
|
|
@@ -4240,16 +4458,16 @@ function PageHeaderTitle({
|
|
|
4240
4458
|
titleAs = "h1"
|
|
4241
4459
|
}) {
|
|
4242
4460
|
const ComponentTitle = titleAs;
|
|
4243
|
-
return /* @__PURE__ */ (0,
|
|
4244
|
-
/* @__PURE__ */ (0,
|
|
4245
|
-
description && /* @__PURE__ */ (0,
|
|
4461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComponentTitle, { className: "cnc-text-2xl cnc-font-semibold cnc-text-brand-blue-600", children: title }),
|
|
4463
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "cnc-text-sm cnc-text-brand-gray-500", children: description })
|
|
4246
4464
|
] });
|
|
4247
4465
|
}
|
|
4248
4466
|
function PageHeaderActionsContainer({
|
|
4249
4467
|
children,
|
|
4250
4468
|
className
|
|
4251
4469
|
}) {
|
|
4252
|
-
return /* @__PURE__ */ (0,
|
|
4470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4253
4471
|
"div",
|
|
4254
4472
|
{
|
|
4255
4473
|
className: cn(
|
|
@@ -4261,17 +4479,151 @@ function PageHeaderActionsContainer({
|
|
|
4261
4479
|
);
|
|
4262
4480
|
}
|
|
4263
4481
|
function Title2({ title, as: Component = "h1" }) {
|
|
4264
|
-
return /* @__PURE__ */ (0,
|
|
4482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component, { className: "cnc-text-[24px] cnc-text-[#1F2C4D] cnc-font-bold cnc-mt-2 cnc-mb-4 text-center md:cnc-text-[28px] md:cnc-text-left", children: title });
|
|
4483
|
+
}
|
|
4484
|
+
|
|
4485
|
+
// src/components/molecules/display/empty-state.tsx
|
|
4486
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4487
|
+
function EmptyState({
|
|
4488
|
+
icon,
|
|
4489
|
+
title,
|
|
4490
|
+
description,
|
|
4491
|
+
action,
|
|
4492
|
+
minHeight = "cnc-min-h-48",
|
|
4493
|
+
className,
|
|
4494
|
+
...props
|
|
4495
|
+
}) {
|
|
4496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4497
|
+
"div",
|
|
4498
|
+
{
|
|
4499
|
+
className: cn(
|
|
4500
|
+
"cnc-flex cnc-flex-col cnc-items-center cnc-justify-center cnc-rounded-md cnc-border cnc-border-dashed cnc-border-brand-gray-50 cnc-bg-brand-blue-50 cnc-px-4 cnc-py-8 cnc-text-center",
|
|
4501
|
+
minHeight,
|
|
4502
|
+
className
|
|
4503
|
+
),
|
|
4504
|
+
...props,
|
|
4505
|
+
children: [
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "cnc-mb-3 cnc-text-brand-gray-200", children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FolderOpen, { className: "cnc-h-10 cnc-w-10" }) }),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "cnc-text-sm cnc-font-medium cnc-text-brand-blue-600", children: title }),
|
|
4508
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "cnc-mt-1 cnc-max-w-md cnc-text-sm cnc-text-brand-gray-200", children: description }) : null,
|
|
4509
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "cnc-mt-4", children: action }) : null
|
|
4510
|
+
]
|
|
4511
|
+
}
|
|
4512
|
+
);
|
|
4513
|
+
}
|
|
4514
|
+
|
|
4515
|
+
// src/components/molecules/display/result-metadata.tsx
|
|
4516
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4517
|
+
function encontradosSuffix(resourceName, forceWordGender) {
|
|
4518
|
+
if (forceWordGender === "masc") return "o";
|
|
4519
|
+
if (forceWordGender === "fem") return "a";
|
|
4520
|
+
return resourceName.endsWith("a") ? "a" : "o";
|
|
4521
|
+
}
|
|
4522
|
+
function ResultMetadata({
|
|
4523
|
+
resourceName,
|
|
4524
|
+
total,
|
|
4525
|
+
displayed,
|
|
4526
|
+
isLoading = false,
|
|
4527
|
+
forceWordGender,
|
|
4528
|
+
truncationThreshold = 30,
|
|
4529
|
+
className,
|
|
4530
|
+
...props
|
|
4531
|
+
}) {
|
|
4532
|
+
const encontradVogal = encontradosSuffix(resourceName, forceWordGender);
|
|
4533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4534
|
+
"div",
|
|
4535
|
+
{
|
|
4536
|
+
className: cn("cnc-mt-4 cnc-mb-4", className),
|
|
4537
|
+
role: "status",
|
|
4538
|
+
"aria-live": "polite",
|
|
4539
|
+
...props,
|
|
4540
|
+
children: [
|
|
4541
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "cnc-text-base cnc-font-bold cnc-text-brand-blue-100", children: `${resourceName} encontrad${encontradVogal}s | ${isLoading ? "carregando ..." : total?.toLocaleString("pt-BR")}` }),
|
|
4542
|
+
displayed >= truncationThreshold && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
|
|
4543
|
+
"Exibindo os ",
|
|
4544
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "cnc-font-bold", children: displayed }),
|
|
4545
|
+
" primeiros registros. Utilize os filtros para refinar sua busca."
|
|
4546
|
+
] })
|
|
4547
|
+
]
|
|
4548
|
+
}
|
|
4549
|
+
);
|
|
4550
|
+
}
|
|
4551
|
+
|
|
4552
|
+
// src/components/molecules/display/label-value.tsx
|
|
4553
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4554
|
+
function LabelValue({
|
|
4555
|
+
label,
|
|
4556
|
+
value,
|
|
4557
|
+
href,
|
|
4558
|
+
className,
|
|
4559
|
+
valueClassName
|
|
4560
|
+
}) {
|
|
4561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className, children: [
|
|
4562
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "cnc-mb-2 cnc-text-sm cnc-font-bold cnc-leading-4 cnc-text-primary", children: label }),
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4564
|
+
"div",
|
|
4565
|
+
{
|
|
4566
|
+
className: cn(
|
|
4567
|
+
"cnc-flex cnc-flex-row cnc-items-center cnc-justify-start cnc-gap-2 cnc-text-sm cnc-font-medium cnc-text-brand-gray-600",
|
|
4568
|
+
valueClassName
|
|
4569
|
+
),
|
|
4570
|
+
children: [
|
|
4571
|
+
value ?? "-",
|
|
4572
|
+
href && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4573
|
+
"a",
|
|
4574
|
+
{
|
|
4575
|
+
href,
|
|
4576
|
+
target: "_blank",
|
|
4577
|
+
rel: "noopener noreferrer",
|
|
4578
|
+
className: "cnc-inline-flex cnc-items-center cnc-text-brand-blue-500 hover:cnc-opacity-80",
|
|
4579
|
+
"aria-label": `Abrir link externo de ${label}`,
|
|
4580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ExternalLink, { className: "cnc-size-4" })
|
|
4581
|
+
}
|
|
4582
|
+
)
|
|
4583
|
+
]
|
|
4584
|
+
}
|
|
4585
|
+
)
|
|
4586
|
+
] });
|
|
4265
4587
|
}
|
|
4266
4588
|
|
|
4267
4589
|
// src/components/molecules/forms/combobox.tsx
|
|
4268
|
-
var
|
|
4590
|
+
var React16 = __toESM(require("react"));
|
|
4591
|
+
|
|
4592
|
+
// src/components/molecules/forms/combobox-footer.tsx
|
|
4593
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4594
|
+
function ComboboxDropdownFooter({
|
|
4595
|
+
footerAction,
|
|
4596
|
+
renderFooter,
|
|
4597
|
+
close,
|
|
4598
|
+
hidden = false
|
|
4599
|
+
}) {
|
|
4600
|
+
if (hidden) return null;
|
|
4601
|
+
if (renderFooter) {
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-p-2", children: renderFooter({ close }) });
|
|
4603
|
+
}
|
|
4604
|
+
if (!footerAction) return null;
|
|
4605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-p-2", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4606
|
+
Button,
|
|
4607
|
+
{
|
|
4608
|
+
type: "button",
|
|
4609
|
+
variant: footerAction.variant ?? "create",
|
|
4610
|
+
className: "cnc-w-full",
|
|
4611
|
+
disabled: footerAction.disabled,
|
|
4612
|
+
onClick: (event) => {
|
|
4613
|
+
event.preventDefault();
|
|
4614
|
+
event.stopPropagation();
|
|
4615
|
+
footerAction.onClick(event);
|
|
4616
|
+
},
|
|
4617
|
+
children: footerAction.label
|
|
4618
|
+
}
|
|
4619
|
+
) });
|
|
4620
|
+
}
|
|
4269
4621
|
|
|
4270
4622
|
// src/components/molecules/overlay/command.tsx
|
|
4271
|
-
var
|
|
4623
|
+
var React14 = __toESM(require("react"));
|
|
4272
4624
|
var import_cmdk = require("cmdk");
|
|
4273
|
-
var
|
|
4274
|
-
var Command =
|
|
4625
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4626
|
+
var Command = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4275
4627
|
import_cmdk.Command,
|
|
4276
4628
|
{
|
|
4277
4629
|
ref,
|
|
@@ -4284,16 +4636,16 @@ var Command = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4284
4636
|
));
|
|
4285
4637
|
Command.displayName = import_cmdk.Command.displayName;
|
|
4286
4638
|
var CommandDialog = ({ children, ...props }) => {
|
|
4287
|
-
return /* @__PURE__ */ (0,
|
|
4639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Dialog, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogContent, { className: "cnc-overflow-hidden cnc-p-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Command, { className: "cnc-[&_cmdk-group-heading]:cnc-px-2 cnc-[&_cmdk-group-heading]:cnc-font-medium cnc-[&_cmdk-group-heading]:cnc-text-muted-foreground cnc-[&_cmdk-group]:not([hidden])~[cmdk-group]:cnc-pt-0 cnc-[&_cmdk-group]:cnc-px-2 cnc-[&_cmdk-input-wrapper]_svg:cnc-h-5 cnc-[&_cmdk-input-wrapper]_svg:cnc-w-5 cnc-[&_cmdk-input]:cnc-h-12 cnc-[&_cmdk-item]:cnc-px-2 cnc-[&_cmdk-item]:cnc-py-3 cnc-[&_cmdk-item]_svg:cnc-h-5 cnc-[&_cmdk-item]_svg:cnc-w-5", children }) }) });
|
|
4288
4640
|
};
|
|
4289
|
-
var CommandInput =
|
|
4641
|
+
var CommandInput = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4290
4642
|
"div",
|
|
4291
4643
|
{
|
|
4292
4644
|
className: "cnc-flex cnc-items-center cnc-border-b cnc-px-3",
|
|
4293
4645
|
"cmdk-input-wrapper": "",
|
|
4294
4646
|
children: [
|
|
4295
|
-
/* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Search, { className: "cnc-mr-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" }),
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4297
4649
|
import_cmdk.Command.Input,
|
|
4298
4650
|
{
|
|
4299
4651
|
ref,
|
|
@@ -4308,7 +4660,7 @@ var CommandInput = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4308
4660
|
}
|
|
4309
4661
|
));
|
|
4310
4662
|
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
4311
|
-
var CommandList =
|
|
4663
|
+
var CommandList = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4312
4664
|
import_cmdk.Command.List,
|
|
4313
4665
|
{
|
|
4314
4666
|
ref,
|
|
@@ -4320,7 +4672,7 @@ var CommandList = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4320
4672
|
}
|
|
4321
4673
|
));
|
|
4322
4674
|
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
4323
|
-
var CommandEmpty =
|
|
4675
|
+
var CommandEmpty = React14.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4324
4676
|
import_cmdk.Command.Empty,
|
|
4325
4677
|
{
|
|
4326
4678
|
ref,
|
|
@@ -4329,7 +4681,7 @@ var CommandEmpty = React12.forwardRef((props, ref) => /* @__PURE__ */ (0, import
|
|
|
4329
4681
|
}
|
|
4330
4682
|
));
|
|
4331
4683
|
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
4332
|
-
var CommandGroup =
|
|
4684
|
+
var CommandGroup = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4333
4685
|
import_cmdk.Command.Group,
|
|
4334
4686
|
{
|
|
4335
4687
|
ref,
|
|
@@ -4341,7 +4693,7 @@ var CommandGroup = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4341
4693
|
}
|
|
4342
4694
|
));
|
|
4343
4695
|
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
4344
|
-
var CommandSeparator =
|
|
4696
|
+
var CommandSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4345
4697
|
import_cmdk.Command.Separator,
|
|
4346
4698
|
{
|
|
4347
4699
|
ref,
|
|
@@ -4350,7 +4702,7 @@ var CommandSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4350
4702
|
}
|
|
4351
4703
|
));
|
|
4352
4704
|
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
4353
|
-
var CommandItem =
|
|
4705
|
+
var CommandItem = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4354
4706
|
import_cmdk.Command.Item,
|
|
4355
4707
|
{
|
|
4356
4708
|
ref,
|
|
@@ -4366,7 +4718,7 @@ var CommandShortcut = ({
|
|
|
4366
4718
|
className,
|
|
4367
4719
|
...props
|
|
4368
4720
|
}) => {
|
|
4369
|
-
return /* @__PURE__ */ (0,
|
|
4721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4370
4722
|
"span",
|
|
4371
4723
|
{
|
|
4372
4724
|
className: cn(
|
|
@@ -4380,12 +4732,12 @@ var CommandShortcut = ({
|
|
|
4380
4732
|
CommandShortcut.displayName = "CommandShortcut";
|
|
4381
4733
|
|
|
4382
4734
|
// src/components/molecules/overlay/popover.tsx
|
|
4383
|
-
var
|
|
4735
|
+
var React15 = __toESM(require("react"));
|
|
4384
4736
|
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"));
|
|
4385
|
-
var
|
|
4737
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4386
4738
|
var Popover2 = PopoverPrimitive2.Root;
|
|
4387
4739
|
var PopoverTrigger2 = PopoverPrimitive2.Trigger;
|
|
4388
|
-
var PopoverContent2 =
|
|
4740
|
+
var PopoverContent2 = React15.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4389
4741
|
PopoverPrimitive2.Content,
|
|
4390
4742
|
{
|
|
4391
4743
|
ref,
|
|
@@ -4401,7 +4753,7 @@ var PopoverContent2 = React13.forwardRef(({ className, align = "center", sideOff
|
|
|
4401
4753
|
PopoverContent2.displayName = PopoverPrimitive2.Content.displayName;
|
|
4402
4754
|
|
|
4403
4755
|
// src/components/molecules/forms/combobox.tsx
|
|
4404
|
-
var
|
|
4756
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4405
4757
|
function Combobox({
|
|
4406
4758
|
options,
|
|
4407
4759
|
placeholder = "",
|
|
@@ -4412,128 +4764,363 @@ function Combobox({
|
|
|
4412
4764
|
modal = false,
|
|
4413
4765
|
popoverClassName,
|
|
4414
4766
|
buttonClassName,
|
|
4415
|
-
disabled = false
|
|
4767
|
+
disabled = false,
|
|
4768
|
+
footerAction,
|
|
4769
|
+
renderFooter
|
|
4416
4770
|
}) {
|
|
4417
|
-
const [open, setOpen] =
|
|
4418
|
-
return /* @__PURE__ */ (0,
|
|
4419
|
-
/* @__PURE__ */ (0,
|
|
4771
|
+
const [open, setOpen] = React16.useState(false);
|
|
4772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Popover2, { open, onOpenChange: setOpen, modal, children: [
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4420
4774
|
Button,
|
|
4421
4775
|
{
|
|
4422
4776
|
variant: "outline",
|
|
4423
4777
|
role: "combobox",
|
|
4424
4778
|
"aria-expanded": open,
|
|
4425
|
-
className: cn(
|
|
4779
|
+
className: cn(
|
|
4780
|
+
"cnc-w-full cnc-justify-between cnc-truncate ",
|
|
4781
|
+
buttonClassName
|
|
4782
|
+
),
|
|
4426
4783
|
disabled,
|
|
4427
4784
|
children: [
|
|
4428
|
-
/* @__PURE__ */ (0,
|
|
4429
|
-
/* @__PURE__ */ (0,
|
|
4785
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: value ? options?.find((framework) => framework.value === value)?.label : placeholder }),
|
|
4786
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronsUpDown, { className: "cnc-ml-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" })
|
|
4430
4787
|
]
|
|
4431
4788
|
}
|
|
4432
4789
|
) }),
|
|
4433
|
-
/* @__PURE__ */ (0,
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4434
4791
|
PopoverContent2,
|
|
4435
4792
|
{
|
|
4436
4793
|
align: "start",
|
|
4437
|
-
className: cn(
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
),
|
|
4446
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CommandList, { children: [
|
|
4447
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4448
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CommandGroup, { children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4449
|
-
CommandItem,
|
|
4794
|
+
className: cn(
|
|
4795
|
+
"cnc-w-[--radix-popover-trigger-width] cnc-p-0",
|
|
4796
|
+
popoverClassName
|
|
4797
|
+
),
|
|
4798
|
+
children: [
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Command, { children: [
|
|
4800
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4801
|
+
CommandInput,
|
|
4450
4802
|
{
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4803
|
+
placeholder: command?.placeholder,
|
|
4804
|
+
onInput: (e) => onInput && onInput(e.target?.value)
|
|
4805
|
+
}
|
|
4806
|
+
),
|
|
4807
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(CommandList, { children: [
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4809
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CommandGroup, { children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4810
|
+
CommandItem,
|
|
4811
|
+
{
|
|
4812
|
+
value: option.value,
|
|
4813
|
+
onSelect: (currentValue) => {
|
|
4814
|
+
if (onChange)
|
|
4815
|
+
onChange(currentValue === value ? "" : currentValue);
|
|
4816
|
+
setOpen(false);
|
|
4817
|
+
},
|
|
4818
|
+
keywords: [option.value, option.label],
|
|
4819
|
+
disabled: option.disabled,
|
|
4820
|
+
children: [
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4822
|
+
Check,
|
|
4823
|
+
{
|
|
4824
|
+
className: cn(
|
|
4825
|
+
"cnc-mr-2 cnc-h-4 cnc-w-4",
|
|
4826
|
+
value === option.value ? "cnc-opacity-100" : "cnc-opacity-0"
|
|
4827
|
+
)
|
|
4828
|
+
}
|
|
4829
|
+
),
|
|
4830
|
+
option.label
|
|
4831
|
+
]
|
|
4456
4832
|
},
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
},
|
|
4472
|
-
option.value
|
|
4473
|
-
)) })
|
|
4474
|
-
] })
|
|
4475
|
-
] })
|
|
4833
|
+
option.value
|
|
4834
|
+
)) })
|
|
4835
|
+
] })
|
|
4836
|
+
] }),
|
|
4837
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4838
|
+
ComboboxDropdownFooter,
|
|
4839
|
+
{
|
|
4840
|
+
footerAction,
|
|
4841
|
+
renderFooter,
|
|
4842
|
+
close: () => setOpen(false),
|
|
4843
|
+
hidden: disabled
|
|
4844
|
+
}
|
|
4845
|
+
)
|
|
4846
|
+
]
|
|
4476
4847
|
}
|
|
4477
4848
|
)
|
|
4478
4849
|
] });
|
|
4479
4850
|
}
|
|
4480
4851
|
|
|
4481
|
-
// src/components/
|
|
4482
|
-
var
|
|
4483
|
-
var
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
}
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
if (field.type === "switch") return true;
|
|
4505
|
-
if (value === "" || value === null || value === void 0) {
|
|
4506
|
-
return field.errorMessage || "Campo obrigat\xF3rio";
|
|
4507
|
-
}
|
|
4508
|
-
return true;
|
|
4852
|
+
// src/components/molecules/forms/multi-select.tsx
|
|
4853
|
+
var React17 = __toESM(require("react"));
|
|
4854
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4855
|
+
function MultiSelect({
|
|
4856
|
+
options,
|
|
4857
|
+
value = [],
|
|
4858
|
+
onChange,
|
|
4859
|
+
placeholder = "Selecione...",
|
|
4860
|
+
disabled = false,
|
|
4861
|
+
modal = false,
|
|
4862
|
+
className,
|
|
4863
|
+
buttonClassName,
|
|
4864
|
+
popoverClassName,
|
|
4865
|
+
command,
|
|
4866
|
+
selectedCountText = (count) => `${count} selecionados`,
|
|
4867
|
+
footerAction,
|
|
4868
|
+
renderFooter
|
|
4869
|
+
}) {
|
|
4870
|
+
const [open, setOpen] = React17.useState(false);
|
|
4871
|
+
const buttonText = (() => {
|
|
4872
|
+
if (value.length === 0) return placeholder;
|
|
4873
|
+
if (value.length === 1) {
|
|
4874
|
+
return options?.find((option) => option.value === value[0])?.label ?? selectedCountText(1);
|
|
4509
4875
|
}
|
|
4876
|
+
return selectedCountText(value.length);
|
|
4877
|
+
})();
|
|
4878
|
+
const toggleOption = (optionValue) => {
|
|
4879
|
+
if (!onChange) return;
|
|
4880
|
+
onChange(
|
|
4881
|
+
value.includes(optionValue) ? value.filter((item) => item !== optionValue) : [...value, optionValue]
|
|
4882
|
+
);
|
|
4510
4883
|
};
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Popover2, { open, onOpenChange: setOpen, modal, children: [
|
|
4885
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4886
|
+
Button,
|
|
4887
|
+
{
|
|
4888
|
+
type: "button",
|
|
4889
|
+
variant: "outline",
|
|
4890
|
+
role: "combobox",
|
|
4891
|
+
"aria-expanded": open,
|
|
4892
|
+
disabled,
|
|
4893
|
+
className: cn(
|
|
4894
|
+
"cnc-w-full cnc-justify-between cnc-truncate",
|
|
4895
|
+
buttonClassName,
|
|
4896
|
+
className
|
|
4897
|
+
),
|
|
4898
|
+
children: [
|
|
4899
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "cnc-truncate", children: buttonText }),
|
|
4900
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronsUpDown, { className: "cnc-ml-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" })
|
|
4901
|
+
]
|
|
4902
|
+
}
|
|
4903
|
+
) }),
|
|
4904
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4905
|
+
PopoverContent2,
|
|
4906
|
+
{
|
|
4907
|
+
align: "start",
|
|
4908
|
+
className: cn(
|
|
4909
|
+
"cnc-w-[--radix-popover-trigger-width] cnc-p-0",
|
|
4910
|
+
popoverClassName
|
|
4911
|
+
),
|
|
4912
|
+
children: [
|
|
4913
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Command, { children: [
|
|
4914
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CommandInput, { placeholder: command?.placeholder }),
|
|
4915
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(CommandList, { children: [
|
|
4916
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4917
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CommandGroup, { children: options?.map((option) => {
|
|
4918
|
+
const isSelected = value.includes(option.value);
|
|
4919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4920
|
+
CommandItem,
|
|
4921
|
+
{
|
|
4922
|
+
value: option.value,
|
|
4923
|
+
onSelect: () => toggleOption(option.value),
|
|
4924
|
+
keywords: [option.value, option.label],
|
|
4925
|
+
disabled: option.disabled,
|
|
4926
|
+
children: [
|
|
4927
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4928
|
+
Check,
|
|
4929
|
+
{
|
|
4930
|
+
className: cn(
|
|
4931
|
+
"cnc-mr-2 cnc-h-4 cnc-w-4",
|
|
4932
|
+
isSelected ? "cnc-opacity-100" : "cnc-opacity-0"
|
|
4933
|
+
)
|
|
4934
|
+
}
|
|
4935
|
+
),
|
|
4936
|
+
option.label
|
|
4937
|
+
]
|
|
4938
|
+
},
|
|
4939
|
+
option.value
|
|
4940
|
+
);
|
|
4941
|
+
}) })
|
|
4942
|
+
] })
|
|
4943
|
+
] }),
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4945
|
+
ComboboxDropdownFooter,
|
|
4946
|
+
{
|
|
4947
|
+
footerAction,
|
|
4948
|
+
renderFooter,
|
|
4949
|
+
close: () => setOpen(false),
|
|
4950
|
+
hidden: disabled
|
|
4951
|
+
}
|
|
4952
|
+
)
|
|
4953
|
+
]
|
|
4954
|
+
}
|
|
4955
|
+
)
|
|
4956
|
+
] });
|
|
4957
|
+
}
|
|
4958
|
+
|
|
4959
|
+
// src/components/molecules/overlay/confirm-dialog.tsx
|
|
4960
|
+
var React18 = __toESM(require("react"));
|
|
4961
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4962
|
+
function ConfirmDialog({
|
|
4963
|
+
open,
|
|
4964
|
+
onOpenChange,
|
|
4965
|
+
title,
|
|
4966
|
+
description,
|
|
4967
|
+
confirmLabel = "Confirmar",
|
|
4968
|
+
cancelLabel = "Cancelar",
|
|
4969
|
+
loadingLabel = "Aguarde...",
|
|
4970
|
+
onConfirm,
|
|
4971
|
+
icon,
|
|
4972
|
+
showIconBackground = true,
|
|
4973
|
+
footerAlign = "center",
|
|
4974
|
+
confirmVariant = "danger",
|
|
4975
|
+
children,
|
|
4976
|
+
isLoading,
|
|
4977
|
+
className
|
|
4978
|
+
}) {
|
|
4979
|
+
const [localLoading, setLocalLoading] = React18.useState(false);
|
|
4980
|
+
const isBusy = isLoading ?? localLoading;
|
|
4981
|
+
const handleConfirm = async () => {
|
|
4982
|
+
if (isLoading !== void 0) {
|
|
4983
|
+
await onConfirm?.();
|
|
4984
|
+
return;
|
|
4985
|
+
}
|
|
4986
|
+
setLocalLoading(true);
|
|
4987
|
+
try {
|
|
4988
|
+
await onConfirm?.();
|
|
4989
|
+
} finally {
|
|
4990
|
+
setLocalLoading(false);
|
|
4991
|
+
}
|
|
4992
|
+
};
|
|
4993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DialogContent, { className: cn("cnc-max-w-md cnc-text-center", className), children: [
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DialogHeader, { children: [
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4996
|
+
"div",
|
|
4997
|
+
{
|
|
4998
|
+
className: cn(
|
|
4999
|
+
"cnc-mx-auto cnc-mb-2 cnc-flex cnc-items-center cnc-justify-center",
|
|
5000
|
+
showIconBackground && "cnc-size-16 cnc-rounded-full cnc-bg-red-100",
|
|
5001
|
+
showIconBackground && confirmVariant === "confirm" && "cnc-bg-brand-green-100/20"
|
|
5002
|
+
),
|
|
5003
|
+
children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Trash2, { className: cn("cnc-size-8 cnc-text-red-600", confirmVariant === "confirm" && "cnc-text-brand-green-300") })
|
|
5004
|
+
}
|
|
5005
|
+
),
|
|
5006
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DialogTitle, { className: "cnc-text-center", children: title }),
|
|
5007
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DialogDescription, { className: "cnc-text-center", children: description })
|
|
5008
|
+
] }),
|
|
5009
|
+
children,
|
|
5010
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5011
|
+
DialogFooter,
|
|
5012
|
+
{
|
|
5013
|
+
className: cn(
|
|
5014
|
+
"cnc-flex cnc-gap-2",
|
|
5015
|
+
footerAlign === "end" ? "cnc-justify-end sm:cnc-justify-end" : "cnc-justify-center sm:cnc-justify-center"
|
|
5016
|
+
),
|
|
5017
|
+
children: [
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5019
|
+
Button,
|
|
5020
|
+
{
|
|
5021
|
+
type: "button",
|
|
5022
|
+
variant: "outline",
|
|
5023
|
+
onClick: () => onOpenChange(false),
|
|
5024
|
+
disabled: isBusy,
|
|
5025
|
+
children: cancelLabel
|
|
5026
|
+
}
|
|
5027
|
+
),
|
|
5028
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5029
|
+
Button,
|
|
5030
|
+
{
|
|
5031
|
+
type: "button",
|
|
5032
|
+
variant: confirmVariant,
|
|
5033
|
+
isLoading: isBusy,
|
|
5034
|
+
onClick: handleConfirm,
|
|
5035
|
+
children: isBusy ? loadingLabel : confirmLabel
|
|
5036
|
+
}
|
|
5037
|
+
)
|
|
5038
|
+
]
|
|
5039
|
+
}
|
|
5040
|
+
)
|
|
5041
|
+
] }) });
|
|
5042
|
+
}
|
|
5043
|
+
|
|
5044
|
+
// src/components/molecules/overlay/tooltip.tsx
|
|
5045
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5046
|
+
function Tooltip({
|
|
5047
|
+
text,
|
|
5048
|
+
children,
|
|
5049
|
+
className,
|
|
5050
|
+
contentClassName
|
|
5051
|
+
}) {
|
|
5052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: cn("cnc-relative cnc-inline-flex cnc-group", className), children: [
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5054
|
+
"div",
|
|
5055
|
+
{
|
|
5056
|
+
role: "tooltip",
|
|
5057
|
+
className: cn(
|
|
5058
|
+
"cnc-pointer-events-none cnc-absolute cnc-bottom-full cnc-left-1/2 cnc-z-50 cnc-mb-2 cnc-w-max cnc-max-w-xs cnc--translate-x-1/2 cnc-rounded cnc-bg-black cnc-px-2 cnc-py-1 cnc-text-xs cnc-text-white cnc-opacity-0 cnc-shadow-md cnc-transition-opacity cnc-duration-200 group-hover:cnc-opacity-100 group-focus-within:cnc-opacity-100",
|
|
5059
|
+
contentClassName
|
|
5060
|
+
),
|
|
5061
|
+
children: text
|
|
5062
|
+
}
|
|
5063
|
+
),
|
|
5064
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "cnc-cursor-pointer", children })
|
|
5065
|
+
] });
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5068
|
+
// src/components/organisms/filter/index.tsx
|
|
5069
|
+
var React19 = __toESM(require("react"));
|
|
5070
|
+
var import_react_hook_form = require("react-hook-form");
|
|
5071
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5072
|
+
var INPUT_BASE_CLASSES = [
|
|
5073
|
+
"cnc-flex cnc-h-10 cnc-w-full cnc-rounded-md cnc-border cnc-bg-transparent cnc-px-3 cnc-py-1 cnc-text-base cnc-shadow-sm cnc-transition-colors",
|
|
5074
|
+
"placeholder:cnc-text-muted-foreground focus-visible:cnc-outline-none",
|
|
5075
|
+
"focus-visible:cnc-ring-2 focus-visible:cnc-ring-brand-gray-500/50 md:cnc-text-sm",
|
|
5076
|
+
"not-disabled:hover:cnc-border-brand-gray-500",
|
|
5077
|
+
"disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50"
|
|
5078
|
+
].join(" ");
|
|
5079
|
+
function buildDefaultValues(fields) {
|
|
5080
|
+
const defaults = {};
|
|
5081
|
+
for (const field of fields) {
|
|
5082
|
+
defaults[field.name] = field.defaultValue ?? (field.type === "switch" ? false : "");
|
|
5083
|
+
}
|
|
5084
|
+
return defaults;
|
|
5085
|
+
}
|
|
5086
|
+
function buildValidationRules(field) {
|
|
5087
|
+
if (!field.required) return void 0;
|
|
5088
|
+
return {
|
|
5089
|
+
required: field.errorMessage || "Campo obrigat\xF3rio",
|
|
5090
|
+
validate: (value) => {
|
|
5091
|
+
if (field.type === "switch") return true;
|
|
5092
|
+
if (value === "" || value === null || value === void 0) {
|
|
5093
|
+
return field.errorMessage || "Campo obrigat\xF3rio";
|
|
5094
|
+
}
|
|
5095
|
+
return true;
|
|
5096
|
+
}
|
|
5097
|
+
};
|
|
5098
|
+
}
|
|
5099
|
+
var FilterFieldItem = React19.memo(function FilterFieldItem2({
|
|
5100
|
+
field,
|
|
5101
|
+
register,
|
|
5102
|
+
control,
|
|
5103
|
+
error
|
|
5104
|
+
}) {
|
|
5105
|
+
const fieldId = field.id || `filter-field-${field.name}`;
|
|
5106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5107
|
+
"div",
|
|
5108
|
+
{
|
|
4522
5109
|
className: "cnc-filter-field cnc-px-2 cnc-mb-3",
|
|
4523
5110
|
style: { "--cnc-filter-field-w": field.width || "25%" },
|
|
4524
5111
|
children: [
|
|
4525
|
-
field.label && /* @__PURE__ */ (0,
|
|
5112
|
+
field.label && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4526
5113
|
"label",
|
|
4527
5114
|
{
|
|
4528
5115
|
htmlFor: fieldId,
|
|
4529
5116
|
className: "cnc-block cnc-text-sm cnc-mb-1 cnc-font-medium cnc-text-brand-gray-600",
|
|
4530
5117
|
children: [
|
|
4531
5118
|
field.label,
|
|
4532
|
-
field.required && /* @__PURE__ */ (0,
|
|
5119
|
+
field.required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "cnc-text-red-500", children: " *" })
|
|
4533
5120
|
]
|
|
4534
5121
|
}
|
|
4535
5122
|
),
|
|
4536
|
-
(field.type === "text" || field.type === "date") && /* @__PURE__ */ (0,
|
|
5123
|
+
(field.type === "text" || field.type === "date") && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4537
5124
|
"input",
|
|
4538
5125
|
{
|
|
4539
5126
|
id: fieldId,
|
|
@@ -4547,13 +5134,13 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4547
5134
|
)
|
|
4548
5135
|
}
|
|
4549
5136
|
),
|
|
4550
|
-
field.type === "combobox" && /* @__PURE__ */ (0,
|
|
5137
|
+
field.type === "combobox" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4551
5138
|
import_react_hook_form.Controller,
|
|
4552
5139
|
{
|
|
4553
5140
|
name: field.name,
|
|
4554
5141
|
control,
|
|
4555
5142
|
rules: buildValidationRules(field),
|
|
4556
|
-
render: ({ field: rhfField }) => /* @__PURE__ */ (0,
|
|
5143
|
+
render: ({ field: rhfField }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4557
5144
|
Combobox,
|
|
4558
5145
|
{
|
|
4559
5146
|
value: rhfField.value || "",
|
|
@@ -4567,13 +5154,13 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4567
5154
|
)
|
|
4568
5155
|
}
|
|
4569
5156
|
),
|
|
4570
|
-
field.type === "switch" && /* @__PURE__ */ (0,
|
|
5157
|
+
field.type === "switch" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4571
5158
|
import_react_hook_form.Controller,
|
|
4572
5159
|
{
|
|
4573
5160
|
name: field.name,
|
|
4574
5161
|
control,
|
|
4575
5162
|
rules: buildValidationRules(field),
|
|
4576
|
-
render: ({ field: rhfField }) => /* @__PURE__ */ (0,
|
|
5163
|
+
render: ({ field: rhfField }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4577
5164
|
Switch,
|
|
4578
5165
|
{
|
|
4579
5166
|
checked: !!rhfField.value,
|
|
@@ -4584,14 +5171,14 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4584
5171
|
)
|
|
4585
5172
|
}
|
|
4586
5173
|
),
|
|
4587
|
-
error && /* @__PURE__ */ (0,
|
|
5174
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "cnc-block cnc-text-xs cnc-text-red-500 cnc-mt-1", children: error.message })
|
|
4588
5175
|
]
|
|
4589
5176
|
}
|
|
4590
5177
|
);
|
|
4591
5178
|
});
|
|
4592
5179
|
function CleanButton({ control, onClean }) {
|
|
4593
5180
|
const values = (0, import_react_hook_form.useWatch)({ control });
|
|
4594
|
-
const hasActiveFilters =
|
|
5181
|
+
const hasActiveFilters = React19.useMemo(() => {
|
|
4595
5182
|
const keys = Object.keys(values);
|
|
4596
5183
|
return keys.some((key) => {
|
|
4597
5184
|
const val = values[key];
|
|
@@ -4600,7 +5187,7 @@ function CleanButton({ control, onClean }) {
|
|
|
4600
5187
|
return val !== null && val !== void 0 && val !== "";
|
|
4601
5188
|
});
|
|
4602
5189
|
}, [values]);
|
|
4603
|
-
return /* @__PURE__ */ (0,
|
|
5190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4604
5191
|
Button,
|
|
4605
5192
|
{
|
|
4606
5193
|
type: "button",
|
|
@@ -4609,13 +5196,13 @@ function CleanButton({ control, onClean }) {
|
|
|
4609
5196
|
disabled: !hasActiveFilters,
|
|
4610
5197
|
className: "cnc-shrink-0 cnc-gap-2",
|
|
4611
5198
|
children: [
|
|
4612
|
-
/* @__PURE__ */ (0,
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FilterX, { className: "cnc-h-4 cnc-w-4" }),
|
|
4613
5200
|
"Limpar"
|
|
4614
5201
|
]
|
|
4615
5202
|
}
|
|
4616
5203
|
);
|
|
4617
5204
|
}
|
|
4618
|
-
var Filter =
|
|
5205
|
+
var Filter = React19.forwardRef(
|
|
4619
5206
|
function Filter2({
|
|
4620
5207
|
fields,
|
|
4621
5208
|
collapsibleFields,
|
|
@@ -4625,12 +5212,12 @@ var Filter = React15.forwardRef(
|
|
|
4625
5212
|
isLoading = false,
|
|
4626
5213
|
className
|
|
4627
5214
|
}, ref) {
|
|
4628
|
-
const [isCollapsibleOpen, setIsCollapsibleOpen] =
|
|
4629
|
-
const allFields =
|
|
5215
|
+
const [isCollapsibleOpen, setIsCollapsibleOpen] = React19.useState(false);
|
|
5216
|
+
const allFields = React19.useMemo(
|
|
4630
5217
|
() => [...fields, ...collapsibleFields || []],
|
|
4631
5218
|
[fields, collapsibleFields]
|
|
4632
5219
|
);
|
|
4633
|
-
const defaultValues =
|
|
5220
|
+
const defaultValues = React19.useMemo(
|
|
4634
5221
|
() => buildDefaultValues(allFields),
|
|
4635
5222
|
[allFields]
|
|
4636
5223
|
);
|
|
@@ -4641,7 +5228,7 @@ var Filter = React15.forwardRef(
|
|
|
4641
5228
|
reset,
|
|
4642
5229
|
formState: { errors }
|
|
4643
5230
|
} = (0, import_react_hook_form.useForm)({ defaultValues });
|
|
4644
|
-
|
|
5231
|
+
React19.useEffect(() => {
|
|
4645
5232
|
if (collapsibleFields?.some((f) => errors[f.name])) {
|
|
4646
5233
|
setIsCollapsibleOpen(true);
|
|
4647
5234
|
}
|
|
@@ -4649,7 +5236,7 @@ var Filter = React15.forwardRef(
|
|
|
4649
5236
|
const onSubmit = (data) => {
|
|
4650
5237
|
onSearch(data);
|
|
4651
5238
|
};
|
|
4652
|
-
const handleClean =
|
|
5239
|
+
const handleClean = React19.useCallback(() => {
|
|
4653
5240
|
const emptyValues = {};
|
|
4654
5241
|
for (const field of allFields) {
|
|
4655
5242
|
emptyValues[field.name] = field.type === "switch" ? false : "";
|
|
@@ -4657,12 +5244,12 @@ var Filter = React15.forwardRef(
|
|
|
4657
5244
|
reset(emptyValues);
|
|
4658
5245
|
onClean?.();
|
|
4659
5246
|
}, [allFields, reset, onClean]);
|
|
4660
|
-
return /* @__PURE__ */ (0,
|
|
5247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4661
5248
|
Collapsible,
|
|
4662
5249
|
{
|
|
4663
5250
|
open: isCollapsibleOpen,
|
|
4664
5251
|
onOpenChange: setIsCollapsibleOpen,
|
|
4665
|
-
children: /* @__PURE__ */ (0,
|
|
5252
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4666
5253
|
"form",
|
|
4667
5254
|
{
|
|
4668
5255
|
ref,
|
|
@@ -4673,8 +5260,8 @@ var Filter = React15.forwardRef(
|
|
|
4673
5260
|
),
|
|
4674
5261
|
style: { backgroundColor: "#F8FAFC" },
|
|
4675
5262
|
children: [
|
|
4676
|
-
/* @__PURE__ */ (0,
|
|
4677
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "cnc-flex cnc-flex-wrap cnc-items-end", children: [
|
|
5264
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4678
5265
|
FilterFieldItem,
|
|
4679
5266
|
{
|
|
4680
5267
|
field,
|
|
@@ -4684,18 +5271,18 @@ var Filter = React15.forwardRef(
|
|
|
4684
5271
|
},
|
|
4685
5272
|
field.name
|
|
4686
5273
|
)),
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4688
|
-
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ (0,
|
|
5274
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "cnc-filter-actions cnc-flex cnc-items-center cnc-gap-2 cnc-px-2 cnc-mb-3 cnc-ml-auto cnc-h-10", children: [
|
|
5275
|
+
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4689
5276
|
Button,
|
|
4690
5277
|
{
|
|
4691
5278
|
type: "button",
|
|
4692
5279
|
variant: "outline",
|
|
4693
5280
|
size: "icon",
|
|
4694
5281
|
className: "cnc-shrink-0",
|
|
4695
|
-
children: /* @__PURE__ */ (0,
|
|
5282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ListFilter, { className: "cnc-h-4 cnc-w-4" })
|
|
4696
5283
|
}
|
|
4697
5284
|
) }),
|
|
4698
|
-
/* @__PURE__ */ (0,
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
4699
5286
|
Button,
|
|
4700
5287
|
{
|
|
4701
5288
|
type: "submit",
|
|
@@ -4703,15 +5290,15 @@ var Filter = React15.forwardRef(
|
|
|
4703
5290
|
isLoading,
|
|
4704
5291
|
className: "cnc-shrink-0 cnc-gap-2",
|
|
4705
5292
|
children: [
|
|
4706
|
-
/* @__PURE__ */ (0,
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Search, { className: "cnc-h-4 cnc-w-4" }),
|
|
4707
5294
|
"Pesquisar"
|
|
4708
5295
|
]
|
|
4709
5296
|
}
|
|
4710
5297
|
),
|
|
4711
|
-
!hideCleanFilterButton && /* @__PURE__ */ (0,
|
|
5298
|
+
!hideCleanFilterButton && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CleanButton, { control, onClean: handleClean })
|
|
4712
5299
|
] })
|
|
4713
5300
|
] }),
|
|
4714
|
-
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ (0,
|
|
5301
|
+
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AnimatedCollapsibleContent, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "cnc-flex cnc-flex-wrap cnc-items-end cnc-pt-2", children: collapsibleFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4715
5302
|
FilterFieldItem,
|
|
4716
5303
|
{
|
|
4717
5304
|
field,
|
|
@@ -4729,74 +5316,947 @@ var Filter = React15.forwardRef(
|
|
|
4729
5316
|
}
|
|
4730
5317
|
);
|
|
4731
5318
|
|
|
4732
|
-
// src/components/organisms/card-list/index.tsx
|
|
4733
|
-
var
|
|
4734
|
-
var
|
|
4735
|
-
function CardList({
|
|
4736
|
-
items,
|
|
4737
|
-
renderCard,
|
|
4738
|
-
emptyMessage = "Nenhum item",
|
|
4739
|
-
minItemWidth = "260px",
|
|
4740
|
-
className,
|
|
4741
|
-
gap = "cnc-gap-4",
|
|
4742
|
-
getKey,
|
|
4743
|
-
isLoading = false,
|
|
4744
|
-
skeletonCount = 6
|
|
5319
|
+
// src/components/organisms/card-list/index.tsx
|
|
5320
|
+
var React20 = __toESM(require("react"));
|
|
5321
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5322
|
+
function CardList({
|
|
5323
|
+
items,
|
|
5324
|
+
renderCard,
|
|
5325
|
+
emptyMessage = "Nenhum item",
|
|
5326
|
+
minItemWidth = "260px",
|
|
5327
|
+
className,
|
|
5328
|
+
gap = "cnc-gap-4",
|
|
5329
|
+
getKey,
|
|
5330
|
+
isLoading = false,
|
|
5331
|
+
skeletonCount = 6
|
|
5332
|
+
}) {
|
|
5333
|
+
const gridStyle = {
|
|
5334
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(min(100%, ${minItemWidth}), 1fr))`
|
|
5335
|
+
};
|
|
5336
|
+
if (isLoading) {
|
|
5337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5338
|
+
"div",
|
|
5339
|
+
{
|
|
5340
|
+
className: cn("cnc-grid cnc-w-full", gap, className),
|
|
5341
|
+
style: gridStyle,
|
|
5342
|
+
"aria-busy": "true",
|
|
5343
|
+
children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5344
|
+
"div",
|
|
5345
|
+
{
|
|
5346
|
+
className: "cnc-animate-pulse cnc-rounded-md cnc-border-2 cnc-border-brand-gray-50 cnc-bg-white cnc-shadow cnc-p-6",
|
|
5347
|
+
children: [
|
|
5348
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "cnc-h-4 cnc-w-1/2 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-4" }),
|
|
5349
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "cnc-h-3 cnc-w-3/4 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-2" }),
|
|
5350
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "cnc-h-3 cnc-w-2/3 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-6" }),
|
|
5351
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "cnc-h-8 cnc-w-full cnc-bg-brand-gray-100 cnc-rounded" })
|
|
5352
|
+
]
|
|
5353
|
+
},
|
|
5354
|
+
i
|
|
5355
|
+
))
|
|
5356
|
+
}
|
|
5357
|
+
);
|
|
5358
|
+
}
|
|
5359
|
+
if (!items || items.length === 0) {
|
|
5360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
5361
|
+
"div",
|
|
5362
|
+
{
|
|
5363
|
+
className: cn(
|
|
5364
|
+
"cnc-w-full cnc-flex cnc-flex-col cnc-items-center cnc-justify-center cnc-rounded-md cnc-py-16 cnc-px-4",
|
|
5365
|
+
className
|
|
5366
|
+
),
|
|
5367
|
+
style: { backgroundColor: "#F8FAFC", color: "#64748B" },
|
|
5368
|
+
children: [
|
|
5369
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FolderOpen, { className: "cnc-h-8 cnc-w-8 cnc-mb-2" }),
|
|
5370
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
5371
|
+
]
|
|
5372
|
+
}
|
|
5373
|
+
);
|
|
5374
|
+
}
|
|
5375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5376
|
+
"div",
|
|
5377
|
+
{
|
|
5378
|
+
className: cn("cnc-grid cnc-w-full", gap, className),
|
|
5379
|
+
style: gridStyle,
|
|
5380
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(React20.Fragment, { children: renderCard(item, index) }, getKey ? getKey(item, index) : index))
|
|
5381
|
+
}
|
|
5382
|
+
);
|
|
5383
|
+
}
|
|
5384
|
+
|
|
5385
|
+
// src/components/organisms/drawer/drawer.tsx
|
|
5386
|
+
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"));
|
|
5387
|
+
var React21 = __toESM(require("react"));
|
|
5388
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5389
|
+
var Drawer = DialogPrimitive2.Root;
|
|
5390
|
+
var DrawerTrigger = DialogPrimitive2.Trigger;
|
|
5391
|
+
var DrawerPortal = DialogPrimitive2.Portal;
|
|
5392
|
+
var DrawerClose = DialogPrimitive2.Close;
|
|
5393
|
+
var DrawerOverlay = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5394
|
+
DialogPrimitive2.Overlay,
|
|
5395
|
+
{
|
|
5396
|
+
ref,
|
|
5397
|
+
className: cn(
|
|
5398
|
+
"cnc-fixed cnc-inset-0 cnc-z-50 cnc-bg-black/80 data-[state=open]:cnc-animate-in data-[state=closed]:cnc-animate-out data-[state=closed]:cnc-fade-out-0 data-[state=open]:cnc-fade-in-0",
|
|
5399
|
+
className
|
|
5400
|
+
),
|
|
5401
|
+
...props
|
|
5402
|
+
}
|
|
5403
|
+
));
|
|
5404
|
+
DrawerOverlay.displayName = DialogPrimitive2.Overlay.displayName;
|
|
5405
|
+
var drawerSizeToWidth = {
|
|
5406
|
+
sm: "24rem",
|
|
5407
|
+
md: "32rem",
|
|
5408
|
+
lg: "40rem",
|
|
5409
|
+
xl: "48rem",
|
|
5410
|
+
full: "100vw"
|
|
5411
|
+
};
|
|
5412
|
+
var DrawerContent = React21.forwardRef(
|
|
5413
|
+
({
|
|
5414
|
+
className,
|
|
5415
|
+
children,
|
|
5416
|
+
side = "right",
|
|
5417
|
+
size = "md",
|
|
5418
|
+
width,
|
|
5419
|
+
closeButton = true,
|
|
5420
|
+
style,
|
|
5421
|
+
...props
|
|
5422
|
+
}, ref) => {
|
|
5423
|
+
const resolvedWidth = width ?? drawerSizeToWidth[size];
|
|
5424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(DrawerPortal, { children: [
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DrawerOverlay, {}),
|
|
5426
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5427
|
+
DialogPrimitive2.Content,
|
|
5428
|
+
{
|
|
5429
|
+
ref,
|
|
5430
|
+
style: { "--drawer-width": resolvedWidth, ...style },
|
|
5431
|
+
className: cn(
|
|
5432
|
+
"cnc-fixed cnc-inset-y-0 cnc-z-50 cnc-flex cnc-w-full cnc-flex-col cnc-bg-background cnc-shadow-lg cnc-duration-200 data-[state=open]:cnc-animate-in data-[state=closed]:cnc-animate-out data-[state=closed]:cnc-fade-out-0 data-[state=open]:cnc-fade-in-0",
|
|
5433
|
+
"sm:cnc-w-[--drawer-width] sm:cnc-max-w-full",
|
|
5434
|
+
side === "right" && "cnc-right-0 cnc-border-l data-[state=closed]:cnc-slide-out-to-right-full data-[state=open]:cnc-slide-in-from-right-full",
|
|
5435
|
+
side === "left" && "cnc-left-0 cnc-border-r data-[state=closed]:cnc-slide-out-to-left-full data-[state=open]:cnc-slide-in-from-left-full",
|
|
5436
|
+
className
|
|
5437
|
+
),
|
|
5438
|
+
...props,
|
|
5439
|
+
children: [
|
|
5440
|
+
children,
|
|
5441
|
+
closeButton && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(DialogPrimitive2.Close, { className: "cnc-absolute cnc-right-4 cnc-top-4 cnc-rounded-sm cnc-opacity-70 cnc-ring-offset-background cnc-transition-opacity hover:cnc-opacity-100 focus:cnc-outline-none focus:cnc-ring-2 focus:cnc-ring-ring focus:cnc-ring-offset-2 disabled:cnc-pointer-events-none data-[state=open]:cnc-bg-accent data-[state=open]:cnc-text-muted-foreground", children: [
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(X, { className: "cnc-h-4 cnc-w-4" }),
|
|
5443
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "cnc-sr-only", children: "Fechar" })
|
|
5444
|
+
] })
|
|
5445
|
+
]
|
|
5446
|
+
}
|
|
5447
|
+
)
|
|
5448
|
+
] });
|
|
5449
|
+
}
|
|
5450
|
+
);
|
|
5451
|
+
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
5452
|
+
var DrawerHeader = ({
|
|
5453
|
+
className,
|
|
5454
|
+
...props
|
|
5455
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5456
|
+
"div",
|
|
5457
|
+
{
|
|
5458
|
+
className: cn(
|
|
5459
|
+
"cnc-flex cnc-flex-col cnc-space-y-1.5 cnc-border-b cnc-p-6",
|
|
5460
|
+
className
|
|
5461
|
+
),
|
|
5462
|
+
...props
|
|
5463
|
+
}
|
|
5464
|
+
);
|
|
5465
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
5466
|
+
var DrawerBody = ({
|
|
5467
|
+
className,
|
|
5468
|
+
...props
|
|
5469
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cn("cnc-flex-1 cnc-overflow-y-auto cnc-p-6", className), ...props });
|
|
5470
|
+
DrawerBody.displayName = "DrawerBody";
|
|
5471
|
+
var DrawerFooter = ({
|
|
5472
|
+
className,
|
|
5473
|
+
...props
|
|
5474
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cn("cnc-border-t cnc-p-6", className), ...props });
|
|
5475
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
5476
|
+
var DrawerTitle = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5477
|
+
DialogPrimitive2.Title,
|
|
5478
|
+
{
|
|
5479
|
+
ref,
|
|
5480
|
+
className: cn(
|
|
5481
|
+
"cnc-text-lg cnc-font-semibold cnc-leading-none cnc-tracking-tight",
|
|
5482
|
+
className
|
|
5483
|
+
),
|
|
5484
|
+
...props
|
|
5485
|
+
}
|
|
5486
|
+
));
|
|
5487
|
+
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
5488
|
+
var DrawerDescription = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5489
|
+
DialogPrimitive2.Description,
|
|
5490
|
+
{
|
|
5491
|
+
ref,
|
|
5492
|
+
className: cn("cnc-text-sm cnc-text-muted-foreground", className),
|
|
5493
|
+
...props
|
|
5494
|
+
}
|
|
5495
|
+
));
|
|
5496
|
+
DrawerDescription.displayName = DialogPrimitive2.Description.displayName;
|
|
5497
|
+
|
|
5498
|
+
// src/components/organisms/drawer/drawer-context.tsx
|
|
5499
|
+
var React22 = __toESM(require("react"));
|
|
5500
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5501
|
+
var DrawerContext = React22.createContext(
|
|
5502
|
+
void 0
|
|
5503
|
+
);
|
|
5504
|
+
function DrawerProvider({ children }) {
|
|
5505
|
+
const [activeDrawer, setActiveDrawer] = React22.useState(null);
|
|
5506
|
+
const openDrawer = React22.useCallback((drawerId) => {
|
|
5507
|
+
setActiveDrawer(drawerId);
|
|
5508
|
+
}, []);
|
|
5509
|
+
const closeDrawer = React22.useCallback(() => {
|
|
5510
|
+
setActiveDrawer(null);
|
|
5511
|
+
}, []);
|
|
5512
|
+
const isOpen = React22.useCallback(
|
|
5513
|
+
(drawerId) => activeDrawer === drawerId,
|
|
5514
|
+
[activeDrawer]
|
|
5515
|
+
);
|
|
5516
|
+
const value = React22.useMemo(
|
|
5517
|
+
() => ({ activeDrawer, openDrawer, closeDrawer, isOpen }),
|
|
5518
|
+
[activeDrawer, openDrawer, closeDrawer, isOpen]
|
|
5519
|
+
);
|
|
5520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DrawerContext.Provider, { value, children });
|
|
5521
|
+
}
|
|
5522
|
+
|
|
5523
|
+
// src/components/organisms/drawer/use-drawer.ts
|
|
5524
|
+
var React23 = __toESM(require("react"));
|
|
5525
|
+
function useDrawer() {
|
|
5526
|
+
const context = React23.useContext(DrawerContext);
|
|
5527
|
+
if (!context) {
|
|
5528
|
+
throw new Error("useDrawer deve ser usado dentro de um DrawerProvider");
|
|
5529
|
+
}
|
|
5530
|
+
return context;
|
|
5531
|
+
}
|
|
5532
|
+
|
|
5533
|
+
// src/components/organisms/upload/file-upload.tsx
|
|
5534
|
+
var React24 = __toESM(require("react"));
|
|
5535
|
+
|
|
5536
|
+
// src/components/organisms/upload/utils.ts
|
|
5537
|
+
function formatSizeLimit(bytes) {
|
|
5538
|
+
if (bytes < 1024 * 1024) {
|
|
5539
|
+
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
5540
|
+
}
|
|
5541
|
+
return `${(bytes / (1024 * 1024)).toLocaleString("pt-BR", {
|
|
5542
|
+
maximumFractionDigits: 1,
|
|
5543
|
+
minimumFractionDigits: 0
|
|
5544
|
+
})} MB`;
|
|
5545
|
+
}
|
|
5546
|
+
function formatFileSize(bytes) {
|
|
5547
|
+
if (bytes < 1024 * 1024) {
|
|
5548
|
+
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
5549
|
+
}
|
|
5550
|
+
return `${(bytes / (1024 * 1024)).toLocaleString("pt-BR", {
|
|
5551
|
+
maximumFractionDigits: 1,
|
|
5552
|
+
minimumFractionDigits: 0
|
|
5553
|
+
})} MB`;
|
|
5554
|
+
}
|
|
5555
|
+
function isDuplicateFile(file, files) {
|
|
5556
|
+
return files.some(
|
|
5557
|
+
(currentFile) => currentFile.name === file.name && currentFile.size === file.size
|
|
5558
|
+
);
|
|
5559
|
+
}
|
|
5560
|
+
function validateFiles({
|
|
5561
|
+
currentFiles = [],
|
|
5562
|
+
incomingFiles,
|
|
5563
|
+
allowedTypes,
|
|
5564
|
+
maxSize,
|
|
5565
|
+
multiple = true
|
|
5566
|
+
}) {
|
|
5567
|
+
const acceptedFiles = [];
|
|
5568
|
+
const rejectedFiles = [];
|
|
5569
|
+
const baseFiles = multiple ? currentFiles : [];
|
|
5570
|
+
for (const file of incomingFiles) {
|
|
5571
|
+
if (allowedTypes?.length && !allowedTypes.includes(file.type)) {
|
|
5572
|
+
rejectedFiles.push({
|
|
5573
|
+
file,
|
|
5574
|
+
reason: "type",
|
|
5575
|
+
message: `Tipo n\xE3o permitido: ${file.name}`
|
|
5576
|
+
});
|
|
5577
|
+
continue;
|
|
5578
|
+
}
|
|
5579
|
+
if (maxSize !== void 0 && file.size > maxSize) {
|
|
5580
|
+
rejectedFiles.push({
|
|
5581
|
+
file,
|
|
5582
|
+
reason: "size",
|
|
5583
|
+
message: `Arquivo maior que ${formatSizeLimit(maxSize)}: ${file.name}`
|
|
5584
|
+
});
|
|
5585
|
+
continue;
|
|
5586
|
+
}
|
|
5587
|
+
if (isDuplicateFile(file, [...baseFiles, ...acceptedFiles])) {
|
|
5588
|
+
rejectedFiles.push({
|
|
5589
|
+
file,
|
|
5590
|
+
reason: "duplicate",
|
|
5591
|
+
message: `Arquivo j\xE1 adicionado: ${file.name}`
|
|
5592
|
+
});
|
|
5593
|
+
continue;
|
|
5594
|
+
}
|
|
5595
|
+
if (!multiple) {
|
|
5596
|
+
acceptedFiles.splice(0, acceptedFiles.length, file);
|
|
5597
|
+
continue;
|
|
5598
|
+
}
|
|
5599
|
+
acceptedFiles.push(file);
|
|
5600
|
+
}
|
|
5601
|
+
return { acceptedFiles, rejectedFiles };
|
|
5602
|
+
}
|
|
5603
|
+
|
|
5604
|
+
// src/components/organisms/upload/file-list.tsx
|
|
5605
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5606
|
+
function FileList({
|
|
5607
|
+
items,
|
|
5608
|
+
onRemove,
|
|
5609
|
+
onDownload,
|
|
5610
|
+
disabled = false,
|
|
5611
|
+
variant = "bordered",
|
|
5612
|
+
emptyState,
|
|
5613
|
+
removeLabel = "Remover",
|
|
5614
|
+
className,
|
|
5615
|
+
...props
|
|
5616
|
+
}) {
|
|
5617
|
+
if (items.length === 0) {
|
|
5618
|
+
return emptyState ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: emptyState }) : null;
|
|
5619
|
+
}
|
|
5620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5621
|
+
"ul",
|
|
5622
|
+
{
|
|
5623
|
+
className: cn(
|
|
5624
|
+
"cnc-divide-y",
|
|
5625
|
+
variant === "bordered" ? "cnc-rounded-md cnc-border cnc-border-slate-200 cnc-bg-white cnc-divide-slate-200" : "cnc-bg-transparent cnc-divide-slate-100",
|
|
5626
|
+
className
|
|
5627
|
+
),
|
|
5628
|
+
...props,
|
|
5629
|
+
children: items.map((item, index) => {
|
|
5630
|
+
const canRemove = !!onRemove;
|
|
5631
|
+
const canDownload = !!onDownload;
|
|
5632
|
+
const isDisabled = disabled || item.disabled;
|
|
5633
|
+
const isPending = item.status === "pending";
|
|
5634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5635
|
+
"li",
|
|
5636
|
+
{
|
|
5637
|
+
className: cn(
|
|
5638
|
+
"cnc-flex cnc-flex-col cnc-gap-2",
|
|
5639
|
+
variant === "bordered" ? "cnc-px-4 cnc-py-3 sm:cnc-flex-row sm:cnc-items-center sm:cnc-justify-between" : "cnc-px-0 cnc-py-4 first:cnc-pt-0 last:cnc-pb-0 sm:cnc-flex-row sm:cnc-items-center sm:cnc-justify-between"
|
|
5640
|
+
),
|
|
5641
|
+
children: [
|
|
5642
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-items-start cnc-gap-2", children: [
|
|
5643
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FileText, { className: "cnc-mt-0.5 cnc-size-4 cnc-shrink-0 cnc-text-slate-500" }),
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "cnc-min-w-0", children: [
|
|
5645
|
+
canDownload ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5646
|
+
"button",
|
|
5647
|
+
{
|
|
5648
|
+
type: "button",
|
|
5649
|
+
onClick: () => onDownload(item, index),
|
|
5650
|
+
disabled: isDisabled,
|
|
5651
|
+
className: "cnc-inline-flex cnc-items-center cnc-gap-1 cnc-text-left cnc-text-sm cnc-font-medium cnc-text-[#002f87] hover:cnc-underline disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50",
|
|
5652
|
+
children: [
|
|
5653
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "cnc-min-w-0 cnc-truncate", children: item.name }),
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Download, { className: "cnc-size-3.5 cnc-shrink-0" })
|
|
5655
|
+
]
|
|
5656
|
+
}
|
|
5657
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "cnc-text-sm cnc-font-medium cnc-text-slate-800", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "cnc-break-all", children: item.name }) }),
|
|
5658
|
+
(item.meta || item.size !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "cnc-mt-0.5 cnc-flex cnc-flex-wrap cnc-gap-x-2 cnc-gap-y-1 cnc-text-xs cnc-text-slate-500", children: [
|
|
5659
|
+
item.meta,
|
|
5660
|
+
item.meta && item.size !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "\xB7" }) : null,
|
|
5661
|
+
item.size !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: formatFileSize(item.size) }) : null
|
|
5662
|
+
] }),
|
|
5663
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "cnc-mt-1 cnc-line-clamp-2 cnc-text-xs cnc-text-slate-600", children: item.description }) : null
|
|
5664
|
+
] })
|
|
5665
|
+
] }),
|
|
5666
|
+
canRemove ? isPending ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5667
|
+
"button",
|
|
5668
|
+
{
|
|
5669
|
+
type: "button",
|
|
5670
|
+
onClick: () => onRemove(item, index),
|
|
5671
|
+
disabled: isDisabled,
|
|
5672
|
+
className: "cnc-inline-flex cnc-shrink-0 cnc-items-center cnc-justify-center cnc-rounded-md cnc-p-1.5 cnc-text-slate-500 cnc-transition hover:cnc-bg-slate-100 hover:cnc-text-slate-800 disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50",
|
|
5673
|
+
"aria-label": `Remover ${item.name}`,
|
|
5674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(X, { className: "cnc-size-4" })
|
|
5675
|
+
}
|
|
5676
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5677
|
+
"button",
|
|
5678
|
+
{
|
|
5679
|
+
type: "button",
|
|
5680
|
+
onClick: () => onRemove(item, index),
|
|
5681
|
+
disabled: isDisabled,
|
|
5682
|
+
className: "cnc-inline-flex cnc-h-9 cnc-w-full cnc-shrink-0 cnc-items-center cnc-justify-center cnc-gap-2 cnc-rounded-md cnc-border cnc-border-red-200 cnc-px-3 cnc-text-sm cnc-font-semibold cnc-text-red-700 cnc-transition hover:cnc-bg-red-50 disabled:cnc-cursor-not-allowed disabled:cnc-opacity-60 sm:cnc-w-auto",
|
|
5683
|
+
"aria-label": `Remover ${item.name}`,
|
|
5684
|
+
children: [
|
|
5685
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Trash2, { className: "cnc-size-4" }),
|
|
5686
|
+
removeLabel
|
|
5687
|
+
]
|
|
5688
|
+
}
|
|
5689
|
+
) : null
|
|
5690
|
+
]
|
|
5691
|
+
},
|
|
5692
|
+
item.id
|
|
5693
|
+
);
|
|
5694
|
+
})
|
|
5695
|
+
}
|
|
5696
|
+
);
|
|
5697
|
+
}
|
|
5698
|
+
|
|
5699
|
+
// src/components/organisms/upload/file-upload.tsx
|
|
5700
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5701
|
+
function fileToListItem(file, index) {
|
|
5702
|
+
return {
|
|
5703
|
+
id: `${file.name}-${file.size}-${file.lastModified}-${index}`,
|
|
5704
|
+
name: file.name,
|
|
5705
|
+
size: file.size,
|
|
5706
|
+
status: "pending"
|
|
5707
|
+
};
|
|
5708
|
+
}
|
|
5709
|
+
var FileUpload = React24.forwardRef(
|
|
5710
|
+
({
|
|
5711
|
+
value = [],
|
|
5712
|
+
onChange,
|
|
5713
|
+
multiple = true,
|
|
5714
|
+
accept,
|
|
5715
|
+
allowedTypes,
|
|
5716
|
+
maxSize,
|
|
5717
|
+
disabled = false,
|
|
5718
|
+
isLoading = false,
|
|
5719
|
+
buttonLabel = "Adicionar arquivos",
|
|
5720
|
+
hint,
|
|
5721
|
+
icon,
|
|
5722
|
+
onReject,
|
|
5723
|
+
showList = true,
|
|
5724
|
+
listTitle = (count) => `Arquivos selecionados (${count})`,
|
|
5725
|
+
className,
|
|
5726
|
+
buttonClassName,
|
|
5727
|
+
listClassName,
|
|
5728
|
+
...props
|
|
5729
|
+
}, ref) => {
|
|
5730
|
+
const fileInputRef = React24.useRef(null);
|
|
5731
|
+
const hintId = React24.useId();
|
|
5732
|
+
React24.useImperativeHandle(ref, () => fileInputRef.current, []);
|
|
5733
|
+
const isBusy = disabled || isLoading;
|
|
5734
|
+
const items = value.map(fileToListItem);
|
|
5735
|
+
const clearInput = () => {
|
|
5736
|
+
if (fileInputRef.current) {
|
|
5737
|
+
fileInputRef.current.value = "";
|
|
5738
|
+
}
|
|
5739
|
+
};
|
|
5740
|
+
const handleFileSelection = (event) => {
|
|
5741
|
+
const selectedFiles = Array.from(event.target.files ?? []);
|
|
5742
|
+
if (!selectedFiles.length) {
|
|
5743
|
+
clearInput();
|
|
5744
|
+
return;
|
|
5745
|
+
}
|
|
5746
|
+
const { acceptedFiles, rejectedFiles } = validateFiles({
|
|
5747
|
+
currentFiles: value,
|
|
5748
|
+
incomingFiles: selectedFiles,
|
|
5749
|
+
allowedTypes,
|
|
5750
|
+
maxSize,
|
|
5751
|
+
multiple
|
|
5752
|
+
});
|
|
5753
|
+
if (acceptedFiles.length > 0) {
|
|
5754
|
+
onChange?.(multiple ? [...value, ...acceptedFiles] : acceptedFiles.slice(0, 1));
|
|
5755
|
+
}
|
|
5756
|
+
if (rejectedFiles.length > 0) {
|
|
5757
|
+
onReject?.(rejectedFiles);
|
|
5758
|
+
}
|
|
5759
|
+
clearInput();
|
|
5760
|
+
};
|
|
5761
|
+
const handleRemove = (_item, index) => {
|
|
5762
|
+
onChange?.(value.filter((_, currentIndex) => currentIndex !== index));
|
|
5763
|
+
};
|
|
5764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cn("cnc-flex cnc-min-w-0 cnc-flex-col cnc-gap-3", className), ...props, children: [
|
|
5765
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5766
|
+
"input",
|
|
5767
|
+
{
|
|
5768
|
+
ref: fileInputRef,
|
|
5769
|
+
type: "file",
|
|
5770
|
+
multiple,
|
|
5771
|
+
accept,
|
|
5772
|
+
className: "cnc-sr-only",
|
|
5773
|
+
tabIndex: -1,
|
|
5774
|
+
disabled: isBusy,
|
|
5775
|
+
"aria-describedby": hint ? hintId : void 0,
|
|
5776
|
+
onChange: handleFileSelection
|
|
5777
|
+
}
|
|
5778
|
+
),
|
|
5779
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "cnc-flex cnc-flex-col cnc-gap-2 sm:cnc-flex-row sm:cnc-flex-wrap sm:cnc-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5780
|
+
Button,
|
|
5781
|
+
{
|
|
5782
|
+
type: "button",
|
|
5783
|
+
variant: "outline",
|
|
5784
|
+
disabled: isBusy,
|
|
5785
|
+
className: buttonClassName,
|
|
5786
|
+
onClick: () => fileInputRef.current?.click(),
|
|
5787
|
+
children: [
|
|
5788
|
+
icon ?? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Paperclip, { className: "cnc-mr-2 cnc-size-4" }),
|
|
5789
|
+
buttonLabel
|
|
5790
|
+
]
|
|
5791
|
+
}
|
|
5792
|
+
) }),
|
|
5793
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { id: hintId, className: "cnc-text-sm cnc-text-slate-600", children: hint }) : null,
|
|
5794
|
+
showList && items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "cnc-flex cnc-flex-col cnc-gap-2", children: [
|
|
5795
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { role: "status", className: "cnc-text-sm cnc-font-medium cnc-text-slate-700", children: listTitle(items.length) }),
|
|
5796
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5797
|
+
FileList,
|
|
5798
|
+
{
|
|
5799
|
+
items,
|
|
5800
|
+
onRemove: handleRemove,
|
|
5801
|
+
disabled: isBusy,
|
|
5802
|
+
className: listClassName
|
|
5803
|
+
}
|
|
5804
|
+
)
|
|
5805
|
+
] }) : null
|
|
5806
|
+
] });
|
|
5807
|
+
}
|
|
5808
|
+
);
|
|
5809
|
+
FileUpload.displayName = "FileUpload";
|
|
5810
|
+
|
|
5811
|
+
// src/components/organisms/calendar/calendar-utils.ts
|
|
5812
|
+
var MESES_PT_BR = [
|
|
5813
|
+
"Janeiro",
|
|
5814
|
+
"Fevereiro",
|
|
5815
|
+
"Mar\xE7o",
|
|
5816
|
+
"Abril",
|
|
5817
|
+
"Maio",
|
|
5818
|
+
"Junho",
|
|
5819
|
+
"Julho",
|
|
5820
|
+
"Agosto",
|
|
5821
|
+
"Setembro",
|
|
5822
|
+
"Outubro",
|
|
5823
|
+
"Novembro",
|
|
5824
|
+
"Dezembro"
|
|
5825
|
+
];
|
|
5826
|
+
var MESES_PT_BR_ABREV = [
|
|
5827
|
+
"JAN",
|
|
5828
|
+
"FEV",
|
|
5829
|
+
"MAR",
|
|
5830
|
+
"ABR",
|
|
5831
|
+
"MAI",
|
|
5832
|
+
"JUN",
|
|
5833
|
+
"JUL",
|
|
5834
|
+
"AGO",
|
|
5835
|
+
"SET",
|
|
5836
|
+
"OUT",
|
|
5837
|
+
"NOV",
|
|
5838
|
+
"DEZ"
|
|
5839
|
+
];
|
|
5840
|
+
var DIAS_SEMANA_PT_BR = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "S\xC1B"];
|
|
5841
|
+
function toDateKey(date) {
|
|
5842
|
+
const ano = date.getFullYear();
|
|
5843
|
+
const mes = String(date.getMonth() + 1).padStart(2, "0");
|
|
5844
|
+
const dia = String(date.getDate()).padStart(2, "0");
|
|
5845
|
+
return `${ano}-${mes}-${dia}`;
|
|
5846
|
+
}
|
|
5847
|
+
function toLocalNoon(date) {
|
|
5848
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 12, 0, 0, 0);
|
|
5849
|
+
}
|
|
5850
|
+
function isSameDay(a, b) {
|
|
5851
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
5852
|
+
}
|
|
5853
|
+
function isToday(date) {
|
|
5854
|
+
return isSameDay(date, /* @__PURE__ */ new Date());
|
|
5855
|
+
}
|
|
5856
|
+
function buildMonthDays(month, selectedDate, hasItems) {
|
|
5857
|
+
const year = month.getFullYear();
|
|
5858
|
+
const monthIndex = month.getMonth();
|
|
5859
|
+
const totalDays = new Date(year, monthIndex + 1, 0).getDate();
|
|
5860
|
+
const startOffset = new Date(year, monthIndex, 1).getDay();
|
|
5861
|
+
const cells = [];
|
|
5862
|
+
for (let i = 0; i < startOffset; i++) {
|
|
5863
|
+
cells.push(null);
|
|
5864
|
+
}
|
|
5865
|
+
for (let day = 1; day <= totalDays; day++) {
|
|
5866
|
+
const date = new Date(year, monthIndex, day, 12, 0, 0, 0);
|
|
5867
|
+
cells.push({
|
|
5868
|
+
date,
|
|
5869
|
+
number: day,
|
|
5870
|
+
dateKey: toDateKey(date),
|
|
5871
|
+
isToday: isToday(date),
|
|
5872
|
+
isSelected: selectedDate ? isSameDay(date, selectedDate) : false,
|
|
5873
|
+
hasItems: hasItems?.(date) ?? false
|
|
5874
|
+
});
|
|
5875
|
+
}
|
|
5876
|
+
return cells;
|
|
5877
|
+
}
|
|
5878
|
+
function formatMonthYear(date) {
|
|
5879
|
+
return `${MESES_PT_BR[date.getMonth()]} ${date.getFullYear()}`;
|
|
5880
|
+
}
|
|
5881
|
+
function formatDayAriaLabel(date) {
|
|
5882
|
+
return date.toLocaleDateString("pt-BR", {
|
|
5883
|
+
weekday: "long",
|
|
5884
|
+
day: "numeric",
|
|
5885
|
+
month: "long",
|
|
5886
|
+
year: "numeric"
|
|
5887
|
+
});
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5890
|
+
// src/components/organisms/calendar/mini-month-calendar.tsx
|
|
5891
|
+
var React25 = __toESM(require("react"));
|
|
5892
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
5893
|
+
function MiniMonthCalendar({
|
|
5894
|
+
month: monthProp,
|
|
5895
|
+
onMonthChange,
|
|
5896
|
+
selectedDate,
|
|
5897
|
+
onSelectDate,
|
|
5898
|
+
hasItems,
|
|
5899
|
+
renderDay,
|
|
5900
|
+
weekDays = DIAS_SEMANA_PT_BR,
|
|
5901
|
+
monthLabel = formatMonthYear,
|
|
5902
|
+
previousLabel = "M\xEAs anterior",
|
|
5903
|
+
nextLabel = "Pr\xF3ximo m\xEAs",
|
|
5904
|
+
className
|
|
4745
5905
|
}) {
|
|
4746
|
-
const
|
|
4747
|
-
|
|
5906
|
+
const month = React25.useMemo(() => toLocalNoon(monthProp ?? /* @__PURE__ */ new Date()), [monthProp]);
|
|
5907
|
+
const cells = React25.useMemo(
|
|
5908
|
+
() => buildMonthDays(month, selectedDate, hasItems),
|
|
5909
|
+
[month, selectedDate, hasItems]
|
|
5910
|
+
);
|
|
5911
|
+
const goToMonth = (offset) => {
|
|
5912
|
+
onMonthChange?.(
|
|
5913
|
+
new Date(month.getFullYear(), month.getMonth() + offset, 1, 12, 0, 0, 0)
|
|
5914
|
+
);
|
|
4748
5915
|
};
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
"
|
|
5916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: cn("cnc-w-full", className), children: [
|
|
5917
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "cnc-mb-4 cnc-flex cnc-items-center cnc-justify-between cnc-px-1", children: [
|
|
5918
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5919
|
+
"button",
|
|
5920
|
+
{
|
|
5921
|
+
type: "button",
|
|
5922
|
+
onClick: () => goToMonth(-1),
|
|
5923
|
+
"aria-label": previousLabel,
|
|
5924
|
+
className: "cnc-rounded cnc-p-1 cnc-text-brand-gray-200 cnc-transition-colors hover:cnc-bg-brand-blue-50 hover:cnc-text-brand-blue-600",
|
|
5925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronLeft, { className: "cnc-size-4" })
|
|
5926
|
+
}
|
|
5927
|
+
),
|
|
5928
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "cnc-text-sm cnc-font-bold cnc-text-primary", children: monthLabel(month) }),
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5930
|
+
"button",
|
|
5931
|
+
{
|
|
5932
|
+
type: "button",
|
|
5933
|
+
onClick: () => goToMonth(1),
|
|
5934
|
+
"aria-label": nextLabel,
|
|
5935
|
+
className: "cnc-rounded cnc-p-1 cnc-text-brand-gray-200 cnc-transition-colors hover:cnc-bg-brand-blue-50 hover:cnc-text-brand-blue-600",
|
|
5936
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronRight, { className: "cnc-size-4" })
|
|
5937
|
+
}
|
|
5938
|
+
)
|
|
5939
|
+
] }),
|
|
5940
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "cnc-grid cnc-grid-cols-7 cnc-gap-y-3 cnc-text-center cnc-text-xs", children: [
|
|
5941
|
+
weekDays.map((dayName) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5942
|
+
"span",
|
|
5943
|
+
{
|
|
5944
|
+
className: "cnc-text-[11px] cnc-font-medium cnc-text-brand-gray-200",
|
|
5945
|
+
children: dayName
|
|
5946
|
+
},
|
|
5947
|
+
dayName
|
|
5948
|
+
)),
|
|
5949
|
+
cells.map((cell, index) => {
|
|
5950
|
+
if (!cell) {
|
|
5951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", {}, `vazio-${index}`);
|
|
5952
|
+
}
|
|
5953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
5954
|
+
"button",
|
|
4758
5955
|
{
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
5956
|
+
type: "button",
|
|
5957
|
+
onClick: () => onSelectDate?.(cell.date),
|
|
5958
|
+
"aria-label": formatDayAriaLabel(cell.date),
|
|
5959
|
+
"aria-pressed": cell.isSelected,
|
|
5960
|
+
className: cn(
|
|
5961
|
+
"cnc-group cnc-relative cnc-flex cnc-h-8 cnc-flex-col cnc-items-center cnc-justify-center cnc-rounded-full cnc-transition-colors",
|
|
5962
|
+
cell.isSelected ? "cnc-bg-primary cnc-text-white" : "cnc-text-brand-gray-600 hover:cnc-bg-brand-blue-50 hover:cnc-text-primary",
|
|
5963
|
+
cell.isToday && !cell.isSelected && "cnc-underline cnc-decoration-primary cnc-decoration-2 cnc-underline-offset-4"
|
|
5964
|
+
),
|
|
5965
|
+
children: renderDay ? renderDay(cell) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
5966
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "cnc-text-xs cnc-font-semibold", children: cell.number }),
|
|
5967
|
+
cell.hasItems && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "cnc-absolute cnc-bottom-1 cnc-size-1 cnc-rounded-full cnc-bg-primary group-aria-pressed:cnc-bg-white" })
|
|
5968
|
+
] })
|
|
4766
5969
|
},
|
|
4767
|
-
|
|
4768
|
-
)
|
|
4769
|
-
}
|
|
4770
|
-
)
|
|
4771
|
-
}
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
5970
|
+
cell.dateKey
|
|
5971
|
+
);
|
|
5972
|
+
})
|
|
5973
|
+
] })
|
|
5974
|
+
] });
|
|
5975
|
+
}
|
|
5976
|
+
|
|
5977
|
+
// src/components/organisms/calendar/month-year-picker.tsx
|
|
5978
|
+
var React26 = __toESM(require("react"));
|
|
5979
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
5980
|
+
function MonthYearPicker({
|
|
5981
|
+
value,
|
|
5982
|
+
onChange,
|
|
5983
|
+
disabled = false,
|
|
5984
|
+
triggerLabel = formatMonthYear,
|
|
5985
|
+
previousYearLabel = "Ano anterior",
|
|
5986
|
+
nextYearLabel = "Pr\xF3ximo ano",
|
|
5987
|
+
className,
|
|
5988
|
+
triggerClassName,
|
|
5989
|
+
contentClassName
|
|
5990
|
+
}) {
|
|
5991
|
+
const [open, setOpen] = React26.useState(false);
|
|
5992
|
+
const [viewYear, setViewYear] = React26.useState(() => value.getFullYear());
|
|
5993
|
+
React26.useEffect(() => {
|
|
5994
|
+
if (open) setViewYear(value.getFullYear());
|
|
5995
|
+
}, [open, value]);
|
|
5996
|
+
const isSelectedMonth = (monthIndex) => value.getFullYear() === viewYear && value.getMonth() === monthIndex;
|
|
5997
|
+
const handleMonthSelect = (monthIndex) => {
|
|
5998
|
+
const lastDay = new Date(viewYear, monthIndex + 1, 0).getDate();
|
|
5999
|
+
const day = Math.min(value.getDate(), lastDay);
|
|
6000
|
+
onChange(new Date(viewYear, monthIndex, day));
|
|
6001
|
+
setOpen(false);
|
|
6002
|
+
};
|
|
6003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Popover2, { open, onOpenChange: setOpen, children: [
|
|
6004
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6005
|
+
Button,
|
|
4775
6006
|
{
|
|
6007
|
+
type: "button",
|
|
6008
|
+
variant: "outline",
|
|
6009
|
+
disabled,
|
|
6010
|
+
"aria-expanded": open,
|
|
4776
6011
|
className: cn(
|
|
4777
|
-
"cnc-
|
|
4778
|
-
|
|
6012
|
+
"cnc-justify-between cnc-gap-2 cnc-font-bold",
|
|
6013
|
+
triggerClassName
|
|
4779
6014
|
),
|
|
4780
|
-
style: { backgroundColor: "#F8FAFC", color: "#64748B" },
|
|
4781
6015
|
children: [
|
|
4782
|
-
/* @__PURE__ */ (0,
|
|
4783
|
-
/* @__PURE__ */ (0,
|
|
6016
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "cnc-text-sm", children: triggerLabel(value) }),
|
|
6017
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6018
|
+
ChevronDown,
|
|
6019
|
+
{
|
|
6020
|
+
className: cn(
|
|
6021
|
+
"cnc-size-4 cnc-transition-transform",
|
|
6022
|
+
open && "cnc-rotate-180"
|
|
6023
|
+
)
|
|
6024
|
+
}
|
|
6025
|
+
)
|
|
4784
6026
|
]
|
|
4785
6027
|
}
|
|
4786
|
-
)
|
|
6028
|
+
) }),
|
|
6029
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6030
|
+
PopoverContent2,
|
|
6031
|
+
{
|
|
6032
|
+
align: "start",
|
|
6033
|
+
className: cn("cnc-w-72 cnc-p-4", className, contentClassName),
|
|
6034
|
+
children: [
|
|
6035
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "cnc-mb-4 cnc-flex cnc-items-center cnc-justify-between", children: [
|
|
6036
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6037
|
+
"button",
|
|
6038
|
+
{
|
|
6039
|
+
type: "button",
|
|
6040
|
+
onClick: () => setViewYear((prev) => prev - 1),
|
|
6041
|
+
"aria-label": previousYearLabel,
|
|
6042
|
+
className: "cnc-rounded-full cnc-p-1 cnc-text-brand-gray-200 cnc-transition-colors hover:cnc-bg-brand-blue-50 hover:cnc-text-brand-blue-600",
|
|
6043
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronLeft, { className: "cnc-size-5" })
|
|
6044
|
+
}
|
|
6045
|
+
),
|
|
6046
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "cnc-text-base cnc-font-bold cnc-text-primary", children: viewYear }),
|
|
6047
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6048
|
+
"button",
|
|
6049
|
+
{
|
|
6050
|
+
type: "button",
|
|
6051
|
+
onClick: () => setViewYear((prev) => prev + 1),
|
|
6052
|
+
"aria-label": nextYearLabel,
|
|
6053
|
+
className: "cnc-rounded-full cnc-p-1 cnc-text-brand-gray-200 cnc-transition-colors hover:cnc-bg-brand-blue-50 hover:cnc-text-brand-blue-600",
|
|
6054
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ChevronRight, { className: "cnc-size-5" })
|
|
6055
|
+
}
|
|
6056
|
+
)
|
|
6057
|
+
] }),
|
|
6058
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "cnc-grid cnc-grid-cols-3 cnc-gap-x-2 cnc-gap-y-1", children: MESES_PT_BR_ABREV.map((month, monthIndex) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6059
|
+
"button",
|
|
6060
|
+
{
|
|
6061
|
+
type: "button",
|
|
6062
|
+
onClick: () => handleMonthSelect(monthIndex),
|
|
6063
|
+
"aria-pressed": isSelectedMonth(monthIndex),
|
|
6064
|
+
className: cn(
|
|
6065
|
+
"cnc-rounded-lg cnc-py-2 cnc-text-[10px] cnc-font-bold cnc-uppercase cnc-transition-colors",
|
|
6066
|
+
isSelectedMonth(monthIndex) ? "cnc-bg-primary-800 cnc-text-white cnc-shadow-md" : "cnc-text-brand-gray-200 hover:cnc-bg-brand-blue-50 hover:cnc-text-primary"
|
|
6067
|
+
),
|
|
6068
|
+
children: month
|
|
6069
|
+
},
|
|
6070
|
+
month
|
|
6071
|
+
)) })
|
|
6072
|
+
]
|
|
6073
|
+
}
|
|
6074
|
+
)
|
|
6075
|
+
] });
|
|
6076
|
+
}
|
|
6077
|
+
|
|
6078
|
+
// src/components/organisms/period-range-list/index.tsx
|
|
6079
|
+
var React27 = __toESM(require("react"));
|
|
6080
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6081
|
+
var DEFAULT_LABELS = {
|
|
6082
|
+
start: "In\xEDcio",
|
|
6083
|
+
end: "Fim",
|
|
6084
|
+
add: "Adicionar",
|
|
6085
|
+
empty: "Nenhum per\xEDodo adicionado.",
|
|
6086
|
+
startColumn: "In\xEDcio",
|
|
6087
|
+
endColumn: "Fim",
|
|
6088
|
+
actionsColumn: "A\xE7\xF5es"
|
|
6089
|
+
};
|
|
6090
|
+
function createPeriodId() {
|
|
6091
|
+
return `period-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
6092
|
+
}
|
|
6093
|
+
function normalizePeriods(periods) {
|
|
6094
|
+
return periods.map((period) => ({
|
|
6095
|
+
...period,
|
|
6096
|
+
id: period.id ?? createPeriodId()
|
|
6097
|
+
}));
|
|
6098
|
+
}
|
|
6099
|
+
function formatForDisplay(value, inputType) {
|
|
6100
|
+
if (!value) return "";
|
|
6101
|
+
if (inputType === "date") {
|
|
6102
|
+
const [year2, month2, day2] = value.split("-");
|
|
6103
|
+
if (year2 && month2 && day2) return `${day2}/${month2}/${year2}`;
|
|
6104
|
+
return value;
|
|
4787
6105
|
}
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
6106
|
+
const normalized = value.slice(0, 16);
|
|
6107
|
+
const [datePart, timePart] = normalized.split("T");
|
|
6108
|
+
if (!datePart) return value;
|
|
6109
|
+
const [year, month, day] = datePart.split("-");
|
|
6110
|
+
const dateText = year && month && day ? `${day}/${month}/${year}` : datePart;
|
|
6111
|
+
return timePart ? `${dateText} ${timePart}` : dateText;
|
|
6112
|
+
}
|
|
6113
|
+
function splitDisplay(value, inputType) {
|
|
6114
|
+
const formatted = formatForDisplay(value, inputType);
|
|
6115
|
+
if (inputType === "date") {
|
|
6116
|
+
return { date: formatted, time: "" };
|
|
6117
|
+
}
|
|
6118
|
+
const parts = formatted.split(" ");
|
|
6119
|
+
if (parts.length <= 1) {
|
|
6120
|
+
return { date: formatted, time: "" };
|
|
6121
|
+
}
|
|
6122
|
+
const time = parts.pop() ?? "";
|
|
6123
|
+
return { date: parts.join(" "), time };
|
|
6124
|
+
}
|
|
6125
|
+
function PeriodRangeList({
|
|
6126
|
+
value = [],
|
|
6127
|
+
onChange,
|
|
6128
|
+
inputType = "datetime-local",
|
|
6129
|
+
labels: labelsProp,
|
|
6130
|
+
readOnly = false,
|
|
6131
|
+
disabled = false,
|
|
6132
|
+
required = false,
|
|
6133
|
+
error,
|
|
6134
|
+
validate,
|
|
6135
|
+
className
|
|
6136
|
+
}) {
|
|
6137
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
6138
|
+
const endAfterStart = validate?.endAfterStart ?? true;
|
|
6139
|
+
const noDuplicates = validate?.noDuplicates ?? true;
|
|
6140
|
+
const [startDraft, setStartDraft] = React27.useState("");
|
|
6141
|
+
const [endDraft, setEndDraft] = React27.useState("");
|
|
6142
|
+
const periods = React27.useMemo(() => normalizePeriods(value), [value]);
|
|
6143
|
+
const isInvalidRange = Boolean(startDraft && endDraft) && endAfterStart && startDraft >= endDraft;
|
|
6144
|
+
const isDuplicate = Boolean(startDraft && endDraft) && noDuplicates && periods.some(
|
|
6145
|
+
(period) => period.start === startDraft && period.end === endDraft
|
|
4795
6146
|
);
|
|
6147
|
+
const canAdd = Boolean(startDraft && endDraft) && !isInvalidRange && !isDuplicate;
|
|
6148
|
+
const addTitle = isDuplicate ? "Este per\xEDodo j\xE1 foi adicionado" : isInvalidRange ? "A data final deve ser posterior \xE0 data inicial" : void 0;
|
|
6149
|
+
function emitChange(next) {
|
|
6150
|
+
onChange?.(normalizePeriods(next));
|
|
6151
|
+
}
|
|
6152
|
+
function handleAdd() {
|
|
6153
|
+
if (!canAdd || disabled || readOnly) return;
|
|
6154
|
+
emitChange([
|
|
6155
|
+
...periods,
|
|
6156
|
+
{
|
|
6157
|
+
id: createPeriodId(),
|
|
6158
|
+
start: startDraft,
|
|
6159
|
+
end: endDraft
|
|
6160
|
+
}
|
|
6161
|
+
]);
|
|
6162
|
+
setStartDraft("");
|
|
6163
|
+
setEndDraft("");
|
|
6164
|
+
}
|
|
6165
|
+
function handleRemove(id) {
|
|
6166
|
+
if (disabled || readOnly) return;
|
|
6167
|
+
emitChange(periods.filter((period) => period.id !== id));
|
|
6168
|
+
}
|
|
6169
|
+
const showRequiredOnInputs = required && periods.length === 0;
|
|
6170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: cn("cnc-w-full cnc-space-y-4", className), children: [
|
|
6171
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "cnc-grid cnc-grid-cols-1 md:cnc-grid-cols-12 cnc-gap-4 cnc-items-end", children: [
|
|
6172
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "md:cnc-col-span-5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6173
|
+
Input,
|
|
6174
|
+
{
|
|
6175
|
+
type: inputType,
|
|
6176
|
+
label: labels.start,
|
|
6177
|
+
required: showRequiredOnInputs,
|
|
6178
|
+
value: startDraft,
|
|
6179
|
+
disabled,
|
|
6180
|
+
onChange: (event) => setStartDraft(event.target.value)
|
|
6181
|
+
}
|
|
6182
|
+
) }),
|
|
6183
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "md:cnc-col-span-5", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6184
|
+
Input,
|
|
6185
|
+
{
|
|
6186
|
+
type: inputType,
|
|
6187
|
+
label: labels.end,
|
|
6188
|
+
required: showRequiredOnInputs,
|
|
6189
|
+
value: endDraft,
|
|
6190
|
+
min: startDraft || void 0,
|
|
6191
|
+
disabled,
|
|
6192
|
+
onChange: (event) => setEndDraft(event.target.value)
|
|
6193
|
+
}
|
|
6194
|
+
) }),
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "md:cnc-col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
6196
|
+
Button,
|
|
6197
|
+
{
|
|
6198
|
+
type: "button",
|
|
6199
|
+
variant: "outline",
|
|
6200
|
+
className: "cnc-w-full cnc-gap-2",
|
|
6201
|
+
disabled: !canAdd || disabled,
|
|
6202
|
+
title: addTitle,
|
|
6203
|
+
onClick: handleAdd,
|
|
6204
|
+
children: [
|
|
6205
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Plus, { className: "cnc-h-4 cnc-w-4" }),
|
|
6206
|
+
labels.add
|
|
6207
|
+
]
|
|
6208
|
+
}
|
|
6209
|
+
) })
|
|
6210
|
+
] }),
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "cnc-overflow-hidden cnc-rounded-lg cnc-border cnc-border-brand-gray-50 cnc-shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("table", { className: "cnc-min-w-full cnc-divide-y cnc-divide-brand-gray-50", children: [
|
|
6212
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("thead", { className: "cnc-bg-brand-gray-10", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("tr", { children: [
|
|
6213
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("th", { className: "cnc-px-6 cnc-py-3 cnc-text-left cnc-text-xs cnc-font-semibold cnc-uppercase cnc-tracking-wider cnc-text-brand-gray-600", children: labels.startColumn }),
|
|
6214
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("th", { className: "cnc-px-6 cnc-py-3 cnc-text-left cnc-text-xs cnc-font-semibold cnc-uppercase cnc-tracking-wider cnc-text-brand-gray-600", children: labels.endColumn }),
|
|
6215
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("th", { className: "cnc-px-6 cnc-py-3 cnc-text-right cnc-text-xs cnc-font-semibold cnc-uppercase cnc-tracking-wider cnc-text-brand-gray-600", children: labels.actionsColumn })
|
|
6216
|
+
] }) }),
|
|
6217
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("tbody", { className: "cnc-divide-y cnc-divide-brand-gray-50 cnc-bg-white cnc-text-sm", children: [
|
|
6218
|
+
periods.map((period) => {
|
|
6219
|
+
const startDisplay = splitDisplay(period.start, inputType);
|
|
6220
|
+
const endDisplay = splitDisplay(period.end, inputType);
|
|
6221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("tr", { className: "hover:cnc-bg-brand-gray-10/50", children: [
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("td", { className: "cnc-px-6 cnc-py-4 cnc-text-brand-gray-600", children: [
|
|
6223
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "cnc-font-medium cnc-text-brand-gray-600", children: startDisplay.date }),
|
|
6224
|
+
startDisplay.time ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "cnc-ml-2 cnc-text-brand-gray-200", children: startDisplay.time }) : null
|
|
6225
|
+
] }),
|
|
6226
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("td", { className: "cnc-px-6 cnc-py-4 cnc-text-brand-gray-600", children: [
|
|
6227
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "cnc-font-medium cnc-text-brand-gray-600", children: endDisplay.date }),
|
|
6228
|
+
endDisplay.time ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "cnc-ml-2 cnc-text-brand-gray-200", children: endDisplay.time }) : null
|
|
6229
|
+
] }),
|
|
6230
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("td", { className: "cnc-px-6 cnc-py-4 cnc-text-right", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6231
|
+
"button",
|
|
6232
|
+
{
|
|
6233
|
+
type: "button",
|
|
6234
|
+
className: "cnc-text-brand-gray-200 hover:cnc-text-brand-red-500 cnc-transition-colors disabled:cnc-opacity-50",
|
|
6235
|
+
disabled,
|
|
6236
|
+
"aria-label": "Remover per\xEDodo",
|
|
6237
|
+
onClick: () => handleRemove(period.id),
|
|
6238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Trash2, { className: "cnc-h-5 cnc-w-5" })
|
|
6239
|
+
}
|
|
6240
|
+
) })
|
|
6241
|
+
] }, period.id);
|
|
6242
|
+
}),
|
|
6243
|
+
periods.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
6244
|
+
"td",
|
|
6245
|
+
{
|
|
6246
|
+
colSpan: readOnly ? 2 : 3,
|
|
6247
|
+
className: "cnc-px-6 cnc-py-8 cnc-text-center cnc-text-brand-gray-200 cnc-italic",
|
|
6248
|
+
children: labels.empty
|
|
6249
|
+
}
|
|
6250
|
+
) })
|
|
6251
|
+
] })
|
|
6252
|
+
] }) }),
|
|
6253
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "cnc-text-xs cnc-font-medium cnc-text-brand-red-500", children: error }) : null
|
|
6254
|
+
] });
|
|
4796
6255
|
}
|
|
6256
|
+
var DateTimeRangeList = PeriodRangeList;
|
|
4797
6257
|
|
|
4798
6258
|
// src/components/organisms/header-notifications/index.tsx
|
|
4799
|
-
var
|
|
6259
|
+
var React29 = __toESM(require("react"));
|
|
4800
6260
|
|
|
4801
6261
|
// src/components/organisms/header-notifications/cliente.ts
|
|
4802
6262
|
var URL_PADRAO_NOTIFICACOES = "https://dev-apinotificacoes-b5feekb4bdfyb7c2.eastus2-01.azurewebsites.net/v1";
|
|
@@ -4991,7 +6451,7 @@ function mapearParaItem(notificacao, getHref, agora) {
|
|
|
4991
6451
|
}
|
|
4992
6452
|
|
|
4993
6453
|
// src/components/organisms/header-notifications/modal-lembretes.tsx
|
|
4994
|
-
var
|
|
6454
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4995
6455
|
function ModalLembretes({
|
|
4996
6456
|
lembretes,
|
|
4997
6457
|
aberto,
|
|
@@ -5001,46 +6461,46 @@ function ModalLembretes({
|
|
|
5001
6461
|
}) {
|
|
5002
6462
|
const visivel = aberto && lembretes.length > 0;
|
|
5003
6463
|
const tituloExibido = titulo ?? (lembretes.length === 1 ? "Voc\xEA tem um lembrete" : "Voc\xEA tem lembretes");
|
|
5004
|
-
return /* @__PURE__ */ (0,
|
|
6464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5005
6465
|
Dialog,
|
|
5006
6466
|
{
|
|
5007
6467
|
open: visivel,
|
|
5008
6468
|
onOpenChange: (proximoEstado) => {
|
|
5009
6469
|
if (!proximoEstado) onDispensar();
|
|
5010
6470
|
},
|
|
5011
|
-
children: /* @__PURE__ */ (0,
|
|
6471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
5012
6472
|
DialogContent,
|
|
5013
6473
|
{
|
|
5014
6474
|
className: "cnc-max-w-[440px] cnc-rounded-lg cnc-bg-white cnc-p-0",
|
|
5015
6475
|
onOpenAutoFocus: (evento) => evento.preventDefault(),
|
|
5016
6476
|
children: [
|
|
5017
|
-
/* @__PURE__ */ (0,
|
|
5018
|
-
/* @__PURE__ */ (0,
|
|
6477
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "cnc-flex cnc-items-center cnc-gap-3 cnc-border-b cnc-border-brand-gray-50 cnc-px-5 cnc-py-4", children: [
|
|
6478
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "cnc-flex cnc-h-9 cnc-w-9 cnc-shrink-0 cnc-items-center cnc-justify-center cnc-rounded-full cnc-bg-brand-blue-60", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5019
6479
|
BellRing,
|
|
5020
6480
|
{
|
|
5021
6481
|
className: "cnc-h-[18px] cnc-w-[18px] cnc-text-brand-blue-400",
|
|
5022
6482
|
"aria-hidden": "true"
|
|
5023
6483
|
}
|
|
5024
6484
|
) }),
|
|
5025
|
-
/* @__PURE__ */ (0,
|
|
6485
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DialogTitle, { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: tituloExibido })
|
|
5026
6486
|
] }),
|
|
5027
|
-
/* @__PURE__ */ (0,
|
|
6487
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("ul", { className: "cnc-m-0 cnc-max-h-[320px] cnc-list-none cnc-overflow-y-auto cnc-p-0", children: lembretes.map((lembrete) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
5028
6488
|
"li",
|
|
5029
6489
|
{
|
|
5030
6490
|
className: "cnc-flex cnc-flex-col cnc-gap-1 cnc-border-b cnc-border-brand-gray-50 cnc-px-5 cnc-py-4 last:cnc-border-b-0",
|
|
5031
6491
|
children: [
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5033
|
-
/* @__PURE__ */ (0,
|
|
5034
|
-
/* @__PURE__ */ (0,
|
|
6492
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-3", children: [
|
|
6493
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "cnc-text-sm cnc-font-bold cnc-text-brand-blue-900", children: lembrete.titulo }),
|
|
6494
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: formatarDataRelativa(lembrete.dataLembrete) })
|
|
5035
6495
|
] }),
|
|
5036
|
-
lembrete.mensagem && /* @__PURE__ */ (0,
|
|
6496
|
+
lembrete.mensagem && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "cnc-text-xs cnc-leading-relaxed cnc-text-brand-gray-600", children: lembrete.mensagem })
|
|
5037
6497
|
]
|
|
5038
6498
|
},
|
|
5039
6499
|
lembrete.id
|
|
5040
6500
|
)) }),
|
|
5041
|
-
/* @__PURE__ */ (0,
|
|
5042
|
-
/* @__PURE__ */ (0,
|
|
5043
|
-
/* @__PURE__ */ (0,
|
|
6501
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "cnc-flex cnc-flex-col cnc-gap-2 cnc-border-t cnc-border-brand-gray-50 cnc-px-5 cnc-py-4", children: [
|
|
6502
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button, { variant: "confirm", className: "cnc-w-full", onClick: onDispensar, children: rotuloDispensar }),
|
|
6503
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "cnc-m-0 cnc-text-center cnc-text-[11px] cnc-text-brand-gray-600", children: lembretes.length === 1 ? "Ao fechar, este lembrete \xE9 marcado como lido." : `Ao fechar, os ${lembretes.length} lembretes s\xE3o marcados como lidos.` })
|
|
5044
6504
|
] })
|
|
5045
6505
|
]
|
|
5046
6506
|
}
|
|
@@ -5050,7 +6510,7 @@ function ModalLembretes({
|
|
|
5050
6510
|
}
|
|
5051
6511
|
|
|
5052
6512
|
// src/components/organisms/header-notifications/usar-notificacoes.ts
|
|
5053
|
-
var
|
|
6513
|
+
var React28 = __toESM(require("react"));
|
|
5054
6514
|
function foiAbortado(erro) {
|
|
5055
6515
|
return erro?.name === "AbortError";
|
|
5056
6516
|
}
|
|
@@ -5063,20 +6523,20 @@ function usarNotificacoes({
|
|
|
5063
6523
|
habilitado = true,
|
|
5064
6524
|
onErro
|
|
5065
6525
|
}) {
|
|
5066
|
-
const [notificacoes, setNotificacoes] =
|
|
5067
|
-
const [carregando, setCarregando] =
|
|
5068
|
-
const notificacoesRef =
|
|
5069
|
-
const controladorRef =
|
|
5070
|
-
const jaCarregouRef =
|
|
5071
|
-
const onErroRef =
|
|
5072
|
-
|
|
6526
|
+
const [notificacoes, setNotificacoes] = React28.useState([]);
|
|
6527
|
+
const [carregando, setCarregando] = React28.useState(habilitado);
|
|
6528
|
+
const notificacoesRef = React28.useRef(notificacoes);
|
|
6529
|
+
const controladorRef = React28.useRef(null);
|
|
6530
|
+
const jaCarregouRef = React28.useRef(false);
|
|
6531
|
+
const onErroRef = React28.useRef(onErro);
|
|
6532
|
+
React28.useEffect(() => {
|
|
5073
6533
|
notificacoesRef.current = notificacoes;
|
|
5074
6534
|
}, [notificacoes]);
|
|
5075
|
-
|
|
6535
|
+
React28.useEffect(() => {
|
|
5076
6536
|
onErroRef.current = onErro;
|
|
5077
6537
|
}, [onErro]);
|
|
5078
6538
|
const chaveFiltros = JSON.stringify(filtros ?? {});
|
|
5079
|
-
const atualizar =
|
|
6539
|
+
const atualizar = React28.useCallback(() => {
|
|
5080
6540
|
if (!habilitado) return;
|
|
5081
6541
|
controladorRef.current?.abort();
|
|
5082
6542
|
const controlador = new AbortController();
|
|
@@ -5103,7 +6563,7 @@ function usarNotificacoes({
|
|
|
5103
6563
|
}
|
|
5104
6564
|
})();
|
|
5105
6565
|
}, [baseUrl, email, sistema, chaveFiltros, habilitado]);
|
|
5106
|
-
|
|
6566
|
+
React28.useEffect(() => {
|
|
5107
6567
|
if (!habilitado) {
|
|
5108
6568
|
setCarregando(false);
|
|
5109
6569
|
return;
|
|
@@ -5112,7 +6572,7 @@ function usarNotificacoes({
|
|
|
5112
6572
|
atualizar();
|
|
5113
6573
|
return () => controladorRef.current?.abort();
|
|
5114
6574
|
}, [atualizar, habilitado]);
|
|
5115
|
-
|
|
6575
|
+
React28.useEffect(() => {
|
|
5116
6576
|
if (!habilitado || !intervaloAtualizacao) return;
|
|
5117
6577
|
const temporizador = window.setInterval(() => {
|
|
5118
6578
|
if (typeof document !== "undefined" && document.hidden) return;
|
|
@@ -5120,7 +6580,7 @@ function usarNotificacoes({
|
|
|
5120
6580
|
}, intervaloAtualizacao);
|
|
5121
6581
|
return () => window.clearInterval(temporizador);
|
|
5122
6582
|
}, [atualizar, habilitado, intervaloAtualizacao]);
|
|
5123
|
-
const aplicarLeitura =
|
|
6583
|
+
const aplicarLeitura = React28.useCallback((ids) => {
|
|
5124
6584
|
const alvos = new Set(ids.map(String));
|
|
5125
6585
|
setNotificacoes(
|
|
5126
6586
|
(atuais) => atuais.map(
|
|
@@ -5128,7 +6588,7 @@ function usarNotificacoes({
|
|
|
5128
6588
|
)
|
|
5129
6589
|
);
|
|
5130
6590
|
}, []);
|
|
5131
|
-
const reverterLeitura =
|
|
6591
|
+
const reverterLeitura = React28.useCallback((anteriores) => {
|
|
5132
6592
|
const original = new Map(
|
|
5133
6593
|
anteriores.map((notificacao) => [String(notificacao.id), notificacao])
|
|
5134
6594
|
);
|
|
@@ -5143,7 +6603,7 @@ function usarNotificacoes({
|
|
|
5143
6603
|
})
|
|
5144
6604
|
);
|
|
5145
6605
|
}, []);
|
|
5146
|
-
const marcarUmaComoLida =
|
|
6606
|
+
const marcarUmaComoLida = React28.useCallback(
|
|
5147
6607
|
(id) => {
|
|
5148
6608
|
const alvo = notificacoesRef.current.find(
|
|
5149
6609
|
(notificacao) => String(notificacao.id) === String(id)
|
|
@@ -5157,7 +6617,7 @@ function usarNotificacoes({
|
|
|
5157
6617
|
},
|
|
5158
6618
|
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
5159
6619
|
);
|
|
5160
|
-
const marcarComoLidas =
|
|
6620
|
+
const marcarComoLidas = React28.useCallback(
|
|
5161
6621
|
(ids) => {
|
|
5162
6622
|
const alvos = new Set(ids.map(String));
|
|
5163
6623
|
const naoLidas = notificacoesRef.current.filter(
|
|
@@ -5175,10 +6635,10 @@ function usarNotificacoes({
|
|
|
5175
6635
|
},
|
|
5176
6636
|
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
5177
6637
|
);
|
|
5178
|
-
const marcarTodasComoLidas =
|
|
6638
|
+
const marcarTodasComoLidas = React28.useCallback(() => {
|
|
5179
6639
|
marcarComoLidas(notificacoesRef.current.map((notificacao) => notificacao.id));
|
|
5180
6640
|
}, [marcarComoLidas]);
|
|
5181
|
-
const marcarUmaComoNaoLida =
|
|
6641
|
+
const marcarUmaComoNaoLida = React28.useCallback(
|
|
5182
6642
|
(id) => {
|
|
5183
6643
|
const alvo = notificacoesRef.current.find(
|
|
5184
6644
|
(notificacao) => String(notificacao.id) === String(id)
|
|
@@ -5196,7 +6656,7 @@ function usarNotificacoes({
|
|
|
5196
6656
|
},
|
|
5197
6657
|
[baseUrl, reverterLeitura]
|
|
5198
6658
|
);
|
|
5199
|
-
const excluir =
|
|
6659
|
+
const excluir = React28.useCallback(
|
|
5200
6660
|
(id) => {
|
|
5201
6661
|
const alvo = notificacoesRef.current.find(
|
|
5202
6662
|
(notificacao) => String(notificacao.id) === String(id)
|
|
@@ -5225,7 +6685,7 @@ function usarNotificacoes({
|
|
|
5225
6685
|
}
|
|
5226
6686
|
|
|
5227
6687
|
// src/components/organisms/header-notifications/index.tsx
|
|
5228
|
-
var
|
|
6688
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5229
6689
|
function HeaderNotifications(props) {
|
|
5230
6690
|
const {
|
|
5231
6691
|
items = [],
|
|
@@ -5257,11 +6717,11 @@ function HeaderNotifications(props) {
|
|
|
5257
6717
|
tituloLembretes,
|
|
5258
6718
|
rotuloDispensarLembretes
|
|
5259
6719
|
} = props;
|
|
5260
|
-
const [aberto, setAberto] =
|
|
5261
|
-
const [lembretesEmAlerta, setLembretesEmAlerta] =
|
|
6720
|
+
const [aberto, setAberto] = React29.useState(false);
|
|
6721
|
+
const [lembretesEmAlerta, setLembretesEmAlerta] = React29.useState(
|
|
5262
6722
|
[]
|
|
5263
6723
|
);
|
|
5264
|
-
const avaliouLembretesRef =
|
|
6724
|
+
const avaliouLembretesRef = React29.useRef(false);
|
|
5265
6725
|
const conectado = Boolean(email && sistema);
|
|
5266
6726
|
const remoto = usarNotificacoes({
|
|
5267
6727
|
email: email ?? "",
|
|
@@ -5272,17 +6732,17 @@ function HeaderNotifications(props) {
|
|
|
5272
6732
|
habilitado: conectado,
|
|
5273
6733
|
onErro
|
|
5274
6734
|
});
|
|
5275
|
-
const elegiveis =
|
|
6735
|
+
const elegiveis = React29.useMemo(
|
|
5276
6736
|
() => conectado ? selecionarVisiveis(remoto.notificacoes) : [],
|
|
5277
6737
|
[conectado, remoto.notificacoes]
|
|
5278
6738
|
);
|
|
5279
|
-
const itensRemotos =
|
|
6739
|
+
const itensRemotos = React29.useMemo(
|
|
5280
6740
|
() => elegiveis.slice(0, limite).map((notificacao) => mapearParaItem(notificacao, getHref)),
|
|
5281
6741
|
[elegiveis, limite, getHref]
|
|
5282
6742
|
);
|
|
5283
6743
|
const itens = conectado ? itensRemotos : items;
|
|
5284
6744
|
const carregandoLista = conectado ? remoto.carregando : isLoading;
|
|
5285
|
-
|
|
6745
|
+
React29.useEffect(() => {
|
|
5286
6746
|
if (!conectado || !alertarLembretes) return;
|
|
5287
6747
|
if (remoto.carregando || avaliouLembretesRef.current) return;
|
|
5288
6748
|
avaliouLembretesRef.current = true;
|
|
@@ -5332,28 +6792,28 @@ function HeaderNotifications(props) {
|
|
|
5332
6792
|
const anelDeFoco = "focus-visible:cnc-ring-2 focus-visible:cnc-ring-inset focus-visible:cnc-ring-brand-gray-500/50";
|
|
5333
6793
|
const renderarConteudo = () => {
|
|
5334
6794
|
if (carregandoLista) {
|
|
5335
|
-
return /* @__PURE__ */ (0,
|
|
6795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { "aria-busy": "true", children: Array.from({ length: skeletonCount }).map((_, indice) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5336
6796
|
"div",
|
|
5337
6797
|
{
|
|
5338
6798
|
className: "cnc-flex cnc-border-b cnc-border-l-[3px] cnc-border-brand-gray-50 cnc-border-l-transparent cnc-py-3 cnc-pl-3 cnc-pr-4 last:cnc-border-b-0",
|
|
5339
|
-
children: /* @__PURE__ */ (0,
|
|
5340
|
-
/* @__PURE__ */ (0,
|
|
5341
|
-
/* @__PURE__ */ (0,
|
|
6799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "cnc-flex cnc-w-full cnc-flex-col cnc-gap-2", children: [
|
|
6800
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "cnc-h-3 cnc-w-1/2 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" }),
|
|
6801
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "cnc-h-3 cnc-w-3/4 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" })
|
|
5342
6802
|
] })
|
|
5343
6803
|
},
|
|
5344
6804
|
indice
|
|
5345
6805
|
)) });
|
|
5346
6806
|
}
|
|
5347
6807
|
if (itens.length === 0) {
|
|
5348
|
-
return /* @__PURE__ */ (0,
|
|
5349
|
-
/* @__PURE__ */ (0,
|
|
5350
|
-
/* @__PURE__ */ (0,
|
|
6808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "cnc-flex cnc-flex-col cnc-items-center cnc-justify-center cnc-px-4 cnc-py-12 cnc-text-brand-gray-200", children: [
|
|
6809
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BellOff, { className: "cnc-mb-2 cnc-h-7 cnc-w-7", "aria-hidden": "true" }),
|
|
6810
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
5351
6811
|
] });
|
|
5352
6812
|
}
|
|
5353
|
-
return /* @__PURE__ */ (0,
|
|
5354
|
-
const conteudo = /* @__PURE__ */ (0,
|
|
5355
|
-
/* @__PURE__ */ (0,
|
|
5356
|
-
/* @__PURE__ */ (0,
|
|
6813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("ul", { className: "cnc-m-0 cnc-list-none cnc-p-0", children: itens.map((item) => {
|
|
6814
|
+
const conteudo = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-flex-col cnc-gap-0.5", children: [
|
|
6815
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-2", children: [
|
|
6816
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5357
6817
|
"span",
|
|
5358
6818
|
{
|
|
5359
6819
|
className: cn(
|
|
@@ -5363,10 +6823,10 @@ function HeaderNotifications(props) {
|
|
|
5363
6823
|
children: item.title
|
|
5364
6824
|
}
|
|
5365
6825
|
),
|
|
5366
|
-
item.date && /* @__PURE__ */ (0,
|
|
6826
|
+
item.date && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: item.date })
|
|
5367
6827
|
] }),
|
|
5368
|
-
item.message && /* @__PURE__ */ (0,
|
|
5369
|
-
!item.read && /* @__PURE__ */ (0,
|
|
6828
|
+
item.message && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "cnc-line-clamp-2 cnc-text-xs cnc-text-brand-gray-600", children: item.message }),
|
|
6829
|
+
!item.read && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "cnc-sr-only", children: "N\xE3o lida" })
|
|
5370
6830
|
] });
|
|
5371
6831
|
const classesLinha = cn(
|
|
5372
6832
|
"cnc-flex cnc-w-full cnc-items-start cnc-border-l-[3px] cnc-transition cnc-duration-200",
|
|
@@ -5381,7 +6841,7 @@ function HeaderNotifications(props) {
|
|
|
5381
6841
|
"cnc-flex cnc-h-7 cnc-w-7 cnc-shrink-0 cnc-cursor-pointer cnc-items-center cnc-justify-center cnc-rounded cnc-border-0 cnc-bg-transparent cnc-p-0 cnc-text-brand-gray-200 cnc-outline-none cnc-transition cnc-duration-200 hover:cnc-bg-white",
|
|
5382
6842
|
anelDeFoco
|
|
5383
6843
|
);
|
|
5384
|
-
const renderarAlvo = () => alvoClicavel ? /* @__PURE__ */ (0,
|
|
6844
|
+
const renderarAlvo = () => alvoClicavel ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5385
6845
|
"button",
|
|
5386
6846
|
{
|
|
5387
6847
|
type: "button",
|
|
@@ -5389,16 +6849,16 @@ function HeaderNotifications(props) {
|
|
|
5389
6849
|
className: classesAlvo,
|
|
5390
6850
|
children: conteudo
|
|
5391
6851
|
}
|
|
5392
|
-
) : /* @__PURE__ */ (0,
|
|
6852
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: classesAlvo, children: conteudo });
|
|
5393
6853
|
const rotuloLeitura = item.read ? "Marcar como n\xE3o lida" : "Marcar como lida";
|
|
5394
|
-
return /* @__PURE__ */ (0,
|
|
6854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5395
6855
|
"li",
|
|
5396
6856
|
{
|
|
5397
6857
|
className: "cnc-border-b cnc-border-brand-gray-50 last:cnc-border-b-0",
|
|
5398
|
-
children: /* @__PURE__ */ (0,
|
|
6858
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: classesLinha, children: [
|
|
5399
6859
|
renderarAlvo(),
|
|
5400
|
-
(podeAlternarLeitura || podeExcluir) && /* @__PURE__ */ (0,
|
|
5401
|
-
podeAlternarLeitura && /* @__PURE__ */ (0,
|
|
6860
|
+
(podeAlternarLeitura || podeExcluir) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "cnc-flex cnc-shrink-0 cnc-items-center cnc-gap-1 cnc-py-3 cnc-pr-2", children: [
|
|
6861
|
+
podeAlternarLeitura && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5402
6862
|
"button",
|
|
5403
6863
|
{
|
|
5404
6864
|
type: "button",
|
|
@@ -5409,7 +6869,7 @@ function HeaderNotifications(props) {
|
|
|
5409
6869
|
classesAcao,
|
|
5410
6870
|
"hover:cnc-text-brand-blue-400"
|
|
5411
6871
|
),
|
|
5412
|
-
children: item.read ? /* @__PURE__ */ (0,
|
|
6872
|
+
children: item.read ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Mail, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5413
6873
|
MailOpen,
|
|
5414
6874
|
{
|
|
5415
6875
|
className: "cnc-h-4 cnc-w-4",
|
|
@@ -5418,7 +6878,7 @@ function HeaderNotifications(props) {
|
|
|
5418
6878
|
)
|
|
5419
6879
|
}
|
|
5420
6880
|
),
|
|
5421
|
-
podeExcluir && /* @__PURE__ */ (0,
|
|
6881
|
+
podeExcluir && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5422
6882
|
"button",
|
|
5423
6883
|
{
|
|
5424
6884
|
type: "button",
|
|
@@ -5426,7 +6886,7 @@ function HeaderNotifications(props) {
|
|
|
5426
6886
|
title: "Excluir notifica\xE7\xE3o",
|
|
5427
6887
|
onClick: () => excluirItem(item),
|
|
5428
6888
|
className: cn(classesAcao, "hover:cnc-text-brand-red-600"),
|
|
5429
|
-
children: /* @__PURE__ */ (0,
|
|
6889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Trash2, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" })
|
|
5430
6890
|
}
|
|
5431
6891
|
)
|
|
5432
6892
|
] })
|
|
@@ -5437,8 +6897,8 @@ function HeaderNotifications(props) {
|
|
|
5437
6897
|
}) });
|
|
5438
6898
|
};
|
|
5439
6899
|
const temRodapePadrao = podeMarcarTodas && naoLidas > 0;
|
|
5440
|
-
return /* @__PURE__ */ (0,
|
|
5441
|
-
alertarLembretes && /* @__PURE__ */ (0,
|
|
6900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
6901
|
+
alertarLembretes && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5442
6902
|
ModalLembretes,
|
|
5443
6903
|
{
|
|
5444
6904
|
lembretes: lembretesEmAlerta,
|
|
@@ -5448,8 +6908,8 @@ function HeaderNotifications(props) {
|
|
|
5448
6908
|
rotuloDispensar: rotuloDispensarLembretes
|
|
5449
6909
|
}
|
|
5450
6910
|
),
|
|
5451
|
-
/* @__PURE__ */ (0,
|
|
5452
|
-
/* @__PURE__ */ (0,
|
|
6911
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Popover, { open: aberto, onOpenChange: alterarAbertura, children: [
|
|
6912
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
5453
6913
|
"button",
|
|
5454
6914
|
{
|
|
5455
6915
|
type: "button",
|
|
@@ -5460,63 +6920,813 @@ function HeaderNotifications(props) {
|
|
|
5460
6920
|
className
|
|
5461
6921
|
),
|
|
5462
6922
|
children: [
|
|
5463
|
-
/* @__PURE__ */ (0,
|
|
6923
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5464
6924
|
Bell,
|
|
5465
6925
|
{
|
|
5466
|
-
className: "cnc-h-5 cnc-w-5 cnc-text-brand-blue-900 cnc-header-item",
|
|
5467
|
-
"aria-hidden": "true"
|
|
6926
|
+
className: "cnc-h-5 cnc-w-5 cnc-text-brand-blue-900 cnc-header-item",
|
|
6927
|
+
"aria-hidden": "true"
|
|
6928
|
+
}
|
|
6929
|
+
),
|
|
6930
|
+
naoLidas > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6931
|
+
"span",
|
|
6932
|
+
{
|
|
6933
|
+
"aria-hidden": "true",
|
|
6934
|
+
className: "cnc-absolute -cnc-right-0.5 -cnc-top-0.5 cnc-flex cnc-h-[18px] cnc-min-w-[18px] cnc-items-center cnc-justify-center cnc-rounded-full cnc-border-2 cnc-border-white cnc-bg-brand-red-500 cnc-px-1 cnc-text-[10px] cnc-font-bold cnc-leading-none cnc-text-white",
|
|
6935
|
+
children: rotuloContagem
|
|
6936
|
+
}
|
|
6937
|
+
)
|
|
6938
|
+
]
|
|
6939
|
+
}
|
|
6940
|
+
) }),
|
|
6941
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
6942
|
+
PopoverContent,
|
|
6943
|
+
{
|
|
6944
|
+
align,
|
|
6945
|
+
sideOffset: 20,
|
|
6946
|
+
"aria-label": title,
|
|
6947
|
+
style: { width: "min(380px, calc(100vw - 2rem))", padding: 0 },
|
|
6948
|
+
className: cn(
|
|
6949
|
+
"cnc-overflow-hidden cnc-rounded-lg cnc-border cnc-border-brand-gray-50 cnc-bg-white cnc-shadow-custom",
|
|
6950
|
+
contentClassName
|
|
6951
|
+
),
|
|
6952
|
+
children: [
|
|
6953
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "cnc-flex cnc-items-center cnc-justify-between cnc-gap-2 cnc-border-b cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: [
|
|
6954
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h2", { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: title }),
|
|
6955
|
+
naoLidas > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "cnc-rounded-md cnc-bg-brand-blue-60 cnc-px-2 cnc-py-1 cnc-text-xs cnc-font-semibold cnc-text-brand-blue-400", children: naoLidas === 1 ? "1 nova" : `${naoLidas} novas` })
|
|
6956
|
+
] }),
|
|
6957
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "cnc-max-h-[360px] cnc-overflow-y-auto", children: renderarConteudo() }),
|
|
6958
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: footer }) : temRodapePadrao && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "cnc-flex cnc-justify-end cnc-border-t cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
6959
|
+
"button",
|
|
6960
|
+
{
|
|
6961
|
+
type: "button",
|
|
6962
|
+
onClick: marcarTodas,
|
|
6963
|
+
className: cn(
|
|
6964
|
+
"cnc-cursor-pointer cnc-rounded cnc-bg-transparent cnc-p-0 cnc-text-xs cnc-font-semibold cnc-text-brand-blue-100 cnc-outline-none hover:cnc-underline",
|
|
6965
|
+
anelDeFoco
|
|
6966
|
+
),
|
|
6967
|
+
children: "Marcar todas como lidas"
|
|
6968
|
+
}
|
|
6969
|
+
) })
|
|
6970
|
+
]
|
|
6971
|
+
}
|
|
6972
|
+
)
|
|
6973
|
+
] })
|
|
6974
|
+
] });
|
|
6975
|
+
}
|
|
6976
|
+
|
|
6977
|
+
// src/alertas/alertas.tsx
|
|
6978
|
+
var React32 = __toESM(require("react"));
|
|
6979
|
+
|
|
6980
|
+
// src/alertas/formulario-alerta.tsx
|
|
6981
|
+
var React30 = __toESM(require("react"));
|
|
6982
|
+
|
|
6983
|
+
// src/alertas/date-utils.ts
|
|
6984
|
+
function obterHojeDataHoraIsoLocal() {
|
|
6985
|
+
const hoje = /* @__PURE__ */ new Date();
|
|
6986
|
+
const ano = hoje.getFullYear();
|
|
6987
|
+
const mes = String(hoje.getMonth() + 1).padStart(2, "0");
|
|
6988
|
+
const dia = String(hoje.getDate()).padStart(2, "0");
|
|
6989
|
+
const horas = String(hoje.getHours()).padStart(2, "0");
|
|
6990
|
+
const minutos = String(hoje.getMinutes()).padStart(2, "0");
|
|
6991
|
+
return `${ano}-${mes}-${dia}T${horas}:${minutos}`;
|
|
6992
|
+
}
|
|
6993
|
+
function datetimeLocalParaIsoComOffset(valorInput) {
|
|
6994
|
+
if (!valorInput) return valorInput;
|
|
6995
|
+
const data = new Date(valorInput);
|
|
6996
|
+
if (isNaN(data.getTime())) return valorInput;
|
|
6997
|
+
const offsetMinutos = data.getTimezoneOffset();
|
|
6998
|
+
const sinal = offsetMinutos <= 0 ? "+" : "-";
|
|
6999
|
+
const absOffset = Math.abs(offsetMinutos);
|
|
7000
|
+
const offsetHoras = String(Math.floor(absOffset / 60)).padStart(2, "0");
|
|
7001
|
+
const offsetMins = String(absOffset % 60).padStart(2, "0");
|
|
7002
|
+
const ano = data.getFullYear();
|
|
7003
|
+
const mes = String(data.getMonth() + 1).padStart(2, "0");
|
|
7004
|
+
const dia = String(data.getDate()).padStart(2, "0");
|
|
7005
|
+
const horas = String(data.getHours()).padStart(2, "0");
|
|
7006
|
+
const minutos = String(data.getMinutes()).padStart(2, "0");
|
|
7007
|
+
return `${ano}-${mes}-${dia}T${horas}:${minutos}:00${sinal}${offsetHoras}:${offsetMins}`;
|
|
7008
|
+
}
|
|
7009
|
+
function formatarDataParaExibicao(iso) {
|
|
7010
|
+
if (!iso) return "";
|
|
7011
|
+
const dataObj = new Date(iso);
|
|
7012
|
+
if (isNaN(dataObj.getTime())) return "";
|
|
7013
|
+
const dia = String(dataObj.getDate()).padStart(2, "0");
|
|
7014
|
+
const mes = String(dataObj.getMonth() + 1).padStart(2, "0");
|
|
7015
|
+
const ano = dataObj.getFullYear();
|
|
7016
|
+
const horas = String(dataObj.getHours()).padStart(2, "0");
|
|
7017
|
+
const minutos = String(dataObj.getMinutes()).padStart(2, "0");
|
|
7018
|
+
return `${dia}/${mes}/${ano} \xE0s ${horas}:${minutos}`;
|
|
7019
|
+
}
|
|
7020
|
+
|
|
7021
|
+
// src/alertas/formulario-alerta.tsx
|
|
7022
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7023
|
+
var FORM_VAZIO = {
|
|
7024
|
+
titulo: "",
|
|
7025
|
+
dataReferencia: "",
|
|
7026
|
+
lembrarNoDia: true,
|
|
7027
|
+
diasAntes: "",
|
|
7028
|
+
alertasDiasAntes: [],
|
|
7029
|
+
novoAlertaDiasAntes: "",
|
|
7030
|
+
mensagem: "",
|
|
7031
|
+
enviarEmail: false
|
|
7032
|
+
};
|
|
7033
|
+
function normalizarAlertasDiasAntes(values) {
|
|
7034
|
+
const alertas = [...values.alertasDiasAntes];
|
|
7035
|
+
if (values.novoAlertaDiasAntes.trim()) {
|
|
7036
|
+
alertas.push(values.novoAlertaDiasAntes.trim());
|
|
7037
|
+
}
|
|
7038
|
+
return Array.from(new Set(alertas.map(Number))).sort((a, b) => a - b);
|
|
7039
|
+
}
|
|
7040
|
+
function construirPayload(values) {
|
|
7041
|
+
const alertasNumericos = normalizarAlertasDiasAntes(values);
|
|
7042
|
+
const diasAntes = alertasNumericos.length ? Math.max(...alertasNumericos) : values.diasAntes.trim() ? Number(values.diasAntes) : 0;
|
|
7043
|
+
return {
|
|
7044
|
+
titulo: values.titulo.trim(),
|
|
7045
|
+
dataReferencia: datetimeLocalParaIsoComOffset(values.dataReferencia),
|
|
7046
|
+
lembrarNoDia: values.lembrarNoDia,
|
|
7047
|
+
diasAntes,
|
|
7048
|
+
alertasDiasAntes: alertasNumericos,
|
|
7049
|
+
mensagem: values.mensagem.trim() || void 0,
|
|
7050
|
+
enviarEmail: values.enviarEmail
|
|
7051
|
+
};
|
|
7052
|
+
}
|
|
7053
|
+
function preencherFormDoAlerta(alerta) {
|
|
7054
|
+
const alertasDiasAntes = alerta.alertasDiasAntes && alerta.alertasDiasAntes.length > 0 ? alerta.alertasDiasAntes.map(String) : alerta.diasAntes > 0 ? [String(alerta.diasAntes)] : [];
|
|
7055
|
+
const dataObj = new Date(alerta.dataReferencia);
|
|
7056
|
+
const formatada = isNaN(dataObj.getTime()) ? "" : (() => {
|
|
7057
|
+
const ano = dataObj.getFullYear();
|
|
7058
|
+
const mes = String(dataObj.getMonth() + 1).padStart(2, "0");
|
|
7059
|
+
const dia = String(dataObj.getDate()).padStart(2, "0");
|
|
7060
|
+
const horas = String(dataObj.getHours()).padStart(2, "0");
|
|
7061
|
+
const minutos = String(dataObj.getMinutes()).padStart(2, "0");
|
|
7062
|
+
return `${ano}-${mes}-${dia}T${horas}:${minutos}`;
|
|
7063
|
+
})();
|
|
7064
|
+
return {
|
|
7065
|
+
titulo: alerta.titulo,
|
|
7066
|
+
dataReferencia: formatada,
|
|
7067
|
+
lembrarNoDia: alerta.lembrarNoDia ?? alerta.diasAntes === 0,
|
|
7068
|
+
diasAntes: alerta.diasAntes ? String(alerta.diasAntes) : "",
|
|
7069
|
+
alertasDiasAntes,
|
|
7070
|
+
novoAlertaDiasAntes: "",
|
|
7071
|
+
mensagem: alerta.mensagem ?? "",
|
|
7072
|
+
enviarEmail: alerta.enviarEmail ?? false
|
|
7073
|
+
};
|
|
7074
|
+
}
|
|
7075
|
+
function validarForm(values) {
|
|
7076
|
+
if (!values.titulo.trim()) return "Informe o titulo do alerta";
|
|
7077
|
+
if (!values.dataReferencia) return "Informe a data do alerta";
|
|
7078
|
+
if (new Date(values.dataReferencia) < /* @__PURE__ */ new Date()) {
|
|
7079
|
+
return "Informe uma data e hora igual ou posterior ao momento atual";
|
|
7080
|
+
}
|
|
7081
|
+
if (values.diasAntes.trim() && values.diasAntes !== "0") {
|
|
7082
|
+
const diasAntes = Number(values.diasAntes);
|
|
7083
|
+
if (!Number.isInteger(diasAntes) || diasAntes < 0) {
|
|
7084
|
+
return "Informe uma quantidade de dias maior ou igual a zero";
|
|
7085
|
+
}
|
|
7086
|
+
}
|
|
7087
|
+
if (values.novoAlertaDiasAntes.trim()) {
|
|
7088
|
+
const novoAlerta = Number(values.novoAlertaDiasAntes);
|
|
7089
|
+
if (!Number.isInteger(novoAlerta) || novoAlerta <= 0) {
|
|
7090
|
+
return "Informe uma quantidade de dias maior que zero";
|
|
7091
|
+
}
|
|
7092
|
+
}
|
|
7093
|
+
return "";
|
|
7094
|
+
}
|
|
7095
|
+
function OpcaoAlerta({ checked, label, onChange }) {
|
|
7096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { className: "alerta-opcao", children: [
|
|
7097
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7098
|
+
"input",
|
|
7099
|
+
{
|
|
7100
|
+
type: "checkbox",
|
|
7101
|
+
checked,
|
|
7102
|
+
onChange: (e) => onChange(e.target.checked),
|
|
7103
|
+
className: "alerta-checkbox"
|
|
7104
|
+
}
|
|
7105
|
+
),
|
|
7106
|
+
label
|
|
7107
|
+
] });
|
|
7108
|
+
}
|
|
7109
|
+
function FormularioAlerta({
|
|
7110
|
+
alertaEmEdicao,
|
|
7111
|
+
isSaving = false,
|
|
7112
|
+
onSalvar,
|
|
7113
|
+
onCancelar
|
|
7114
|
+
}) {
|
|
7115
|
+
const [values, setValues] = React30.useState(
|
|
7116
|
+
() => alertaEmEdicao ? preencherFormDoAlerta(alertaEmEdicao) : FORM_VAZIO
|
|
7117
|
+
);
|
|
7118
|
+
const [erro, setErro] = React30.useState("");
|
|
7119
|
+
const [hojeDataHoraIso, setHojeDataHoraIso] = React30.useState("");
|
|
7120
|
+
React30.useEffect(() => {
|
|
7121
|
+
setHojeDataHoraIso(obterHojeDataHoraIsoLocal());
|
|
7122
|
+
}, []);
|
|
7123
|
+
React30.useEffect(() => {
|
|
7124
|
+
setValues(alertaEmEdicao ? preencherFormDoAlerta(alertaEmEdicao) : FORM_VAZIO);
|
|
7125
|
+
setErro("");
|
|
7126
|
+
}, [alertaEmEdicao]);
|
|
7127
|
+
const setField = (campo, valor) => {
|
|
7128
|
+
setErro("");
|
|
7129
|
+
setValues((prev) => ({ ...prev, [campo]: valor }));
|
|
7130
|
+
};
|
|
7131
|
+
const toggleLembrarNoDia = (checked) => {
|
|
7132
|
+
setErro("");
|
|
7133
|
+
setValues((prev) => ({ ...prev, lembrarNoDia: checked }));
|
|
7134
|
+
};
|
|
7135
|
+
const toggleAlertaDiasAntes = (dias, checked) => {
|
|
7136
|
+
setErro("");
|
|
7137
|
+
setValues((prev) => {
|
|
7138
|
+
const valor = String(dias);
|
|
7139
|
+
const alertas = new Set(prev.alertasDiasAntes);
|
|
7140
|
+
if (checked) alertas.add(valor);
|
|
7141
|
+
else alertas.delete(valor);
|
|
7142
|
+
const alertasDiasAntes = Array.from(alertas).sort(
|
|
7143
|
+
(a, b) => Number(a) - Number(b)
|
|
7144
|
+
);
|
|
7145
|
+
return {
|
|
7146
|
+
...prev,
|
|
7147
|
+
alertasDiasAntes,
|
|
7148
|
+
diasAntes: alertasDiasAntes.length > 0 ? String(Math.max(...alertasDiasAntes.map(Number))) : ""
|
|
7149
|
+
};
|
|
7150
|
+
});
|
|
7151
|
+
};
|
|
7152
|
+
const adicionarAlertaDiasAntes = () => {
|
|
7153
|
+
const valor = values.novoAlertaDiasAntes.trim();
|
|
7154
|
+
const dias = Number(valor);
|
|
7155
|
+
if (!Number.isInteger(dias) || dias <= 0) {
|
|
7156
|
+
setErro("Informe uma quantidade de dias maior que zero");
|
|
7157
|
+
return;
|
|
7158
|
+
}
|
|
7159
|
+
setErro("");
|
|
7160
|
+
setValues((prev) => {
|
|
7161
|
+
const alertas = new Set(prev.alertasDiasAntes);
|
|
7162
|
+
alertas.add(String(dias));
|
|
7163
|
+
const alertasDiasAntes = Array.from(alertas).sort(
|
|
7164
|
+
(a, b) => Number(a) - Number(b)
|
|
7165
|
+
);
|
|
7166
|
+
return {
|
|
7167
|
+
...prev,
|
|
7168
|
+
diasAntes: String(Math.max(...alertasDiasAntes.map(Number))),
|
|
7169
|
+
novoAlertaDiasAntes: "",
|
|
7170
|
+
alertasDiasAntes
|
|
7171
|
+
};
|
|
7172
|
+
});
|
|
7173
|
+
};
|
|
7174
|
+
const removerAlertaDiasAntes = (valor) => {
|
|
7175
|
+
setValues((prev) => {
|
|
7176
|
+
const alertasDiasAntes = prev.alertasDiasAntes.filter((item) => item !== valor);
|
|
7177
|
+
return {
|
|
7178
|
+
...prev,
|
|
7179
|
+
alertasDiasAntes,
|
|
7180
|
+
diasAntes: alertasDiasAntes.length > 0 ? String(Math.max(...alertasDiasAntes.map(Number))) : ""
|
|
7181
|
+
};
|
|
7182
|
+
});
|
|
7183
|
+
};
|
|
7184
|
+
const handleSalvar = () => {
|
|
7185
|
+
const mensagemErro = validarForm(values);
|
|
7186
|
+
if (mensagemErro) {
|
|
7187
|
+
setErro(mensagemErro);
|
|
7188
|
+
return;
|
|
7189
|
+
}
|
|
7190
|
+
onSalvar(construirPayload(values));
|
|
7191
|
+
};
|
|
7192
|
+
const alertasPersonalizados = values.alertasDiasAntes.filter(
|
|
7193
|
+
(d) => !["2", "7", "15", "30"].includes(d)
|
|
7194
|
+
);
|
|
7195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("section", { className: "alerta-form-section", children: [
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "alerta-form-header", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h2", { className: "alerta-form-titulo", children: alertaEmEdicao ? "Editar alerta" : "Novo alerta" }) }),
|
|
7197
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-form-grid", children: [
|
|
7198
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-campo", children: [
|
|
7199
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { htmlFor: "alerta-titulo", className: "alerta-label", children: [
|
|
7200
|
+
"Titulo ",
|
|
7201
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "alerta-obrigatorio", children: "*" })
|
|
7202
|
+
] }),
|
|
7203
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7204
|
+
"input",
|
|
7205
|
+
{
|
|
7206
|
+
id: "alerta-titulo",
|
|
7207
|
+
type: "text",
|
|
7208
|
+
value: values.titulo,
|
|
7209
|
+
onChange: (e) => setField("titulo", e.target.value),
|
|
7210
|
+
placeholder: "Informe o titulo do alerta",
|
|
7211
|
+
className: "alerta-input"
|
|
7212
|
+
}
|
|
7213
|
+
)
|
|
7214
|
+
] }),
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-campo alerta-campo--data", children: [
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("label", { htmlFor: "alerta-data", className: "alerta-label", children: [
|
|
7217
|
+
"Data e Hora ",
|
|
7218
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "alerta-obrigatorio", children: "*" })
|
|
7219
|
+
] }),
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7221
|
+
"input",
|
|
7222
|
+
{
|
|
7223
|
+
id: "alerta-data",
|
|
7224
|
+
type: "datetime-local",
|
|
7225
|
+
min: hojeDataHoraIso,
|
|
7226
|
+
value: values.dataReferencia,
|
|
7227
|
+
onChange: (e) => setField("dataReferencia", e.target.value),
|
|
7228
|
+
className: "alerta-input alerta-input--sm"
|
|
7229
|
+
}
|
|
7230
|
+
)
|
|
7231
|
+
] }),
|
|
7232
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-campo", children: [
|
|
7233
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "alerta-label", children: "Notifica\xE7\xF5es" }),
|
|
7234
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-notif-container", children: [
|
|
7235
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-notif-col", children: [
|
|
7236
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7237
|
+
OpcaoAlerta,
|
|
7238
|
+
{
|
|
7239
|
+
checked: values.lembrarNoDia,
|
|
7240
|
+
label: "Alertar no dia",
|
|
7241
|
+
onChange: toggleLembrarNoDia
|
|
7242
|
+
}
|
|
7243
|
+
),
|
|
7244
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7245
|
+
OpcaoAlerta,
|
|
7246
|
+
{
|
|
7247
|
+
checked: values.alertasDiasAntes.includes("2"),
|
|
7248
|
+
label: "2 dias antes",
|
|
7249
|
+
onChange: (c) => toggleAlertaDiasAntes(2, c)
|
|
5468
7250
|
}
|
|
5469
7251
|
),
|
|
5470
|
-
|
|
5471
|
-
|
|
7252
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7253
|
+
OpcaoAlerta,
|
|
5472
7254
|
{
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
7255
|
+
checked: values.alertasDiasAntes.includes("7"),
|
|
7256
|
+
label: "1 semana antes",
|
|
7257
|
+
onChange: (c) => toggleAlertaDiasAntes(7, c)
|
|
5476
7258
|
}
|
|
5477
7259
|
)
|
|
5478
|
-
]
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
7260
|
+
] }),
|
|
7261
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-notif-col", children: [
|
|
7262
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7263
|
+
OpcaoAlerta,
|
|
7264
|
+
{
|
|
7265
|
+
checked: values.alertasDiasAntes.includes("15"),
|
|
7266
|
+
label: "15 dias antes",
|
|
7267
|
+
onChange: (c) => toggleAlertaDiasAntes(15, c)
|
|
7268
|
+
}
|
|
7269
|
+
),
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7271
|
+
OpcaoAlerta,
|
|
7272
|
+
{
|
|
7273
|
+
checked: values.alertasDiasAntes.includes("30"),
|
|
7274
|
+
label: "1 m\xEAs antes",
|
|
7275
|
+
onChange: (c) => toggleAlertaDiasAntes(30, c)
|
|
7276
|
+
}
|
|
7277
|
+
),
|
|
7278
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-notif-personalizado", children: [
|
|
7279
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7280
|
+
"input",
|
|
7281
|
+
{
|
|
7282
|
+
id: "alerta-dias",
|
|
7283
|
+
type: "number",
|
|
7284
|
+
min: 1,
|
|
7285
|
+
step: 1,
|
|
7286
|
+
value: values.novoAlertaDiasAntes,
|
|
7287
|
+
onChange: (e) => setField("novoAlertaDiasAntes", e.target.value),
|
|
7288
|
+
onKeyDown: (e) => {
|
|
7289
|
+
if (e.key === "Enter") {
|
|
7290
|
+
e.preventDefault();
|
|
7291
|
+
adicionarAlertaDiasAntes();
|
|
7292
|
+
}
|
|
7293
|
+
},
|
|
7294
|
+
placeholder: "Dias",
|
|
7295
|
+
className: "alerta-input alerta-input--dias"
|
|
7296
|
+
}
|
|
7297
|
+
),
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7299
|
+
"button",
|
|
7300
|
+
{
|
|
7301
|
+
type: "button",
|
|
7302
|
+
onClick: adicionarAlertaDiasAntes,
|
|
7303
|
+
className: "alerta-btn alerta-btn--outline",
|
|
7304
|
+
children: [
|
|
7305
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Plus, { size: 16 }),
|
|
7306
|
+
"Adicionar"
|
|
7307
|
+
]
|
|
7308
|
+
}
|
|
7309
|
+
)
|
|
7310
|
+
] })
|
|
7311
|
+
] }),
|
|
7312
|
+
alertasPersonalizados.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "alerta-tags", children: alertasPersonalizados.map((dias) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "alerta-tag", children: [
|
|
7313
|
+
dias,
|
|
7314
|
+
" dia",
|
|
7315
|
+
Number(dias) > 1 ? "s" : "",
|
|
7316
|
+
" antes",
|
|
7317
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5499
7318
|
"button",
|
|
5500
7319
|
{
|
|
5501
7320
|
type: "button",
|
|
5502
|
-
onClick:
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
),
|
|
5507
|
-
children: "Marcar todas como lidas"
|
|
7321
|
+
onClick: () => removerAlertaDiasAntes(dias),
|
|
7322
|
+
"aria-label": `Remover alerta de ${dias} dias antes`,
|
|
7323
|
+
className: "alerta-tag-remover",
|
|
7324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(X, { size: 14 })
|
|
5508
7325
|
}
|
|
5509
|
-
)
|
|
5510
|
-
]
|
|
7326
|
+
)
|
|
7327
|
+
] }, dias)) })
|
|
7328
|
+
] })
|
|
7329
|
+
] }),
|
|
7330
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-campo", children: [
|
|
7331
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { htmlFor: "alerta-mensagem", className: "alerta-label", children: "Mensagem" }),
|
|
7332
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7333
|
+
"textarea",
|
|
7334
|
+
{
|
|
7335
|
+
id: "alerta-mensagem",
|
|
7336
|
+
value: values.mensagem,
|
|
7337
|
+
onChange: (e) => setField("mensagem", e.target.value),
|
|
7338
|
+
placeholder: "Informe a mensagem do alerta",
|
|
7339
|
+
rows: 3,
|
|
7340
|
+
className: "alerta-textarea"
|
|
7341
|
+
}
|
|
7342
|
+
)
|
|
7343
|
+
] }),
|
|
7344
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "alerta-campo", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7345
|
+
OpcaoAlerta,
|
|
7346
|
+
{
|
|
7347
|
+
checked: values.enviarEmail,
|
|
7348
|
+
label: "Enviar tamb\xE9m por e-mail",
|
|
7349
|
+
onChange: (checked) => setField("enviarEmail", checked)
|
|
5511
7350
|
}
|
|
5512
|
-
)
|
|
7351
|
+
) }),
|
|
7352
|
+
erro && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "alerta-erro", children: erro }),
|
|
7353
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "alerta-form-acoes", children: [
|
|
7354
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7355
|
+
"button",
|
|
7356
|
+
{
|
|
7357
|
+
type: "button",
|
|
7358
|
+
onClick: onCancelar,
|
|
7359
|
+
className: "alerta-btn alerta-btn--secundario",
|
|
7360
|
+
children: "Cancelar"
|
|
7361
|
+
}
|
|
7362
|
+
),
|
|
7363
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7364
|
+
"button",
|
|
7365
|
+
{
|
|
7366
|
+
type: "button",
|
|
7367
|
+
onClick: handleSalvar,
|
|
7368
|
+
disabled: isSaving,
|
|
7369
|
+
className: "alerta-btn alerta-btn--primario",
|
|
7370
|
+
children: [
|
|
7371
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Plus, { size: 16 }),
|
|
7372
|
+
isSaving ? "Salvando..." : alertaEmEdicao ? "Atualizar alerta" : "Adicionar alerta"
|
|
7373
|
+
]
|
|
7374
|
+
}
|
|
7375
|
+
)
|
|
7376
|
+
] })
|
|
7377
|
+
] })
|
|
7378
|
+
] });
|
|
7379
|
+
}
|
|
7380
|
+
|
|
7381
|
+
// src/alertas/alerta-item.tsx
|
|
7382
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7383
|
+
function AlertaItem({
|
|
7384
|
+
alerta,
|
|
7385
|
+
disabled = false,
|
|
7386
|
+
selecionado = false,
|
|
7387
|
+
onEditar,
|
|
7388
|
+
onConcluir,
|
|
7389
|
+
onExcluir
|
|
7390
|
+
}) {
|
|
7391
|
+
const concluido = alerta.status === "CONCLUIDO";
|
|
7392
|
+
const cancelado = alerta.status === "CANCELADO";
|
|
7393
|
+
const podeAlterar = !concluido && !cancelado;
|
|
7394
|
+
const statusLabel = concluido ? "Concluido" : cancelado ? "Cancelado" : "Pendente";
|
|
7395
|
+
const descricaoAlertas = [
|
|
7396
|
+
alerta.lembrarNoDia ?? alerta.diasAntes === 0 ? "no dia" : null,
|
|
7397
|
+
...alerta.alertasDiasAntes && alerta.alertasDiasAntes.length > 0 ? alerta.alertasDiasAntes.map(
|
|
7398
|
+
(dias) => `${dias} dia${dias > 1 ? "s" : ""} antes`
|
|
7399
|
+
) : alerta.diasAntes > 0 ? [`${alerta.diasAntes} dia${alerta.diasAntes > 1 ? "s" : ""} antes`] : []
|
|
7400
|
+
].filter(Boolean).join(", ");
|
|
7401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7402
|
+
"article",
|
|
7403
|
+
{
|
|
7404
|
+
className: [
|
|
7405
|
+
"alerta-item",
|
|
7406
|
+
selecionado ? "alerta-item--selecionado" : "",
|
|
7407
|
+
concluido ? "alerta-item--concluido" : "",
|
|
7408
|
+
cancelado ? "alerta-item--cancelado" : ""
|
|
7409
|
+
].filter(Boolean).join(" "),
|
|
7410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "alerta-item-corpo", children: [
|
|
7411
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "alerta-item-info", children: [
|
|
7412
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "alerta-item-topo", children: [
|
|
7413
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h3", { className: "alerta-item-titulo", children: alerta.titulo }),
|
|
7414
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: `alerta-status alerta-status--${statusLabel.toLowerCase()}`, children: statusLabel })
|
|
7415
|
+
] }),
|
|
7416
|
+
alerta.mensagem && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "alerta-item-mensagem", children: alerta.mensagem }),
|
|
7417
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "alerta-item-meta", children: [
|
|
7418
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "alerta-item-meta-linha", children: [
|
|
7419
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CalendarDays, { size: 14 }),
|
|
7420
|
+
"Data ",
|
|
7421
|
+
formatarDataParaExibicao(alerta.dataReferencia)
|
|
7422
|
+
] }),
|
|
7423
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "alerta-item-meta-linha", children: [
|
|
7424
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Bell, { size: 14 }),
|
|
7425
|
+
"Notifica\xE7\xF5es: ",
|
|
7426
|
+
descricaoAlertas || "\u2014"
|
|
7427
|
+
] }),
|
|
7428
|
+
alerta.enviarEmail && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "alerta-item-meta-linha alerta-item-email-ativo", children: [
|
|
7429
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "alerta-dot" }),
|
|
7430
|
+
"Notifica\xE7\xE3o por e-mail ativa"
|
|
7431
|
+
] }),
|
|
7432
|
+
cancelado && alerta.motivoCancelamento && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "alerta-item-meta-linha", children: [
|
|
7433
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(X, { size: 14 }),
|
|
7434
|
+
"Cancelado automaticamente: ",
|
|
7435
|
+
alerta.motivoCancelamento
|
|
7436
|
+
] })
|
|
7437
|
+
] })
|
|
7438
|
+
] }),
|
|
7439
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "alerta-item-acoes", children: [
|
|
7440
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7441
|
+
"button",
|
|
7442
|
+
{
|
|
7443
|
+
type: "button",
|
|
7444
|
+
onClick: onEditar,
|
|
7445
|
+
disabled: disabled || !podeAlterar,
|
|
7446
|
+
title: "Editar alerta",
|
|
7447
|
+
className: "alerta-btn-icone",
|
|
7448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Pencil, { size: 16 })
|
|
7449
|
+
}
|
|
7450
|
+
),
|
|
7451
|
+
podeAlterar && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7452
|
+
"button",
|
|
7453
|
+
{
|
|
7454
|
+
type: "button",
|
|
7455
|
+
onClick: onConcluir,
|
|
7456
|
+
disabled,
|
|
7457
|
+
title: "Concluir alerta",
|
|
7458
|
+
className: "alerta-btn-icone alerta-btn-icone--sucesso",
|
|
7459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Check, { size: 16 })
|
|
7460
|
+
}
|
|
7461
|
+
),
|
|
7462
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7463
|
+
"button",
|
|
7464
|
+
{
|
|
7465
|
+
type: "button",
|
|
7466
|
+
onClick: onExcluir,
|
|
7467
|
+
disabled,
|
|
7468
|
+
title: "Excluir alerta",
|
|
7469
|
+
className: "alerta-btn-icone alerta-btn-icone--perigo",
|
|
7470
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Trash2, { size: 16 })
|
|
7471
|
+
}
|
|
7472
|
+
)
|
|
7473
|
+
] })
|
|
7474
|
+
] })
|
|
7475
|
+
}
|
|
7476
|
+
);
|
|
7477
|
+
}
|
|
7478
|
+
|
|
7479
|
+
// src/alertas/usar-alertas.ts
|
|
7480
|
+
var React31 = __toESM(require("react"));
|
|
7481
|
+
|
|
7482
|
+
// src/alertas/cliente.ts
|
|
7483
|
+
var ErroAlertas = class _ErroAlertas extends Error {
|
|
7484
|
+
status;
|
|
7485
|
+
constructor(mensagem, status) {
|
|
7486
|
+
super(mensagem);
|
|
7487
|
+
this.name = "ErroAlertas";
|
|
7488
|
+
this.status = status;
|
|
7489
|
+
Object.setPrototypeOf(this, _ErroAlertas.prototype);
|
|
7490
|
+
}
|
|
7491
|
+
};
|
|
7492
|
+
async function buscarAlertas({
|
|
7493
|
+
baseUrl,
|
|
7494
|
+
sistema,
|
|
7495
|
+
email,
|
|
7496
|
+
fetchFn = fetch,
|
|
7497
|
+
signal,
|
|
7498
|
+
eventoId
|
|
7499
|
+
}) {
|
|
7500
|
+
const params = new URLSearchParams({ sistema, email });
|
|
7501
|
+
if (eventoId !== void 0) params.set("eventoId", String(eventoId));
|
|
7502
|
+
const url = `${normalizarBaseUrl(baseUrl)}/notificacoes?${params.toString()}`;
|
|
7503
|
+
const resposta = await fetchFn(url, {
|
|
7504
|
+
method: "GET",
|
|
7505
|
+
headers: { Accept: "application/json" },
|
|
7506
|
+
signal
|
|
7507
|
+
});
|
|
7508
|
+
if (!resposta.ok) {
|
|
7509
|
+
throw new ErroAlertas(`Falha ao buscar alertas`, resposta.status);
|
|
7510
|
+
}
|
|
7511
|
+
return await resposta.json();
|
|
7512
|
+
}
|
|
7513
|
+
|
|
7514
|
+
// src/alertas/usar-alertas.ts
|
|
7515
|
+
function foiAbortado2(erro) {
|
|
7516
|
+
return erro?.name === "AbortError";
|
|
7517
|
+
}
|
|
7518
|
+
function usarAlertas({
|
|
7519
|
+
baseUrl,
|
|
7520
|
+
sistema,
|
|
7521
|
+
email,
|
|
7522
|
+
fetchFn,
|
|
7523
|
+
eventoId,
|
|
7524
|
+
habilitado = true,
|
|
7525
|
+
onErro
|
|
7526
|
+
}) {
|
|
7527
|
+
const [alertas, setAlertas] = React31.useState([]);
|
|
7528
|
+
const [carregando, setCarregando] = React31.useState(habilitado);
|
|
7529
|
+
const controladorRef = React31.useRef(null);
|
|
7530
|
+
const jaCarregouRef = React31.useRef(false);
|
|
7531
|
+
const onErroRef = React31.useRef(onErro);
|
|
7532
|
+
const fetchFnRef = React31.useRef(fetchFn);
|
|
7533
|
+
React31.useEffect(() => {
|
|
7534
|
+
onErroRef.current = onErro;
|
|
7535
|
+
}, [onErro]);
|
|
7536
|
+
React31.useEffect(() => {
|
|
7537
|
+
fetchFnRef.current = fetchFn;
|
|
7538
|
+
}, [fetchFn]);
|
|
7539
|
+
const pronto = baseUrl !== void 0 && sistema !== void 0 && email !== void 0;
|
|
7540
|
+
const atualizar = React31.useCallback(() => {
|
|
7541
|
+
if (!habilitado || !pronto) return;
|
|
7542
|
+
controladorRef.current?.abort();
|
|
7543
|
+
const controlador = new AbortController();
|
|
7544
|
+
controladorRef.current = controlador;
|
|
7545
|
+
void (async () => {
|
|
7546
|
+
try {
|
|
7547
|
+
const lista = await buscarAlertas({
|
|
7548
|
+
baseUrl,
|
|
7549
|
+
sistema,
|
|
7550
|
+
email,
|
|
7551
|
+
fetchFn: fetchFnRef.current,
|
|
7552
|
+
eventoId,
|
|
7553
|
+
signal: controlador.signal
|
|
7554
|
+
});
|
|
7555
|
+
if (controlador.signal.aborted) return;
|
|
7556
|
+
setAlertas(lista);
|
|
7557
|
+
} catch (erro) {
|
|
7558
|
+
if (controlador.signal.aborted || foiAbortado2(erro)) return;
|
|
7559
|
+
onErroRef.current?.(erro);
|
|
7560
|
+
} finally {
|
|
7561
|
+
if (!controlador.signal.aborted) {
|
|
7562
|
+
jaCarregouRef.current = true;
|
|
7563
|
+
setCarregando(false);
|
|
7564
|
+
}
|
|
7565
|
+
}
|
|
7566
|
+
})();
|
|
7567
|
+
}, [baseUrl, sistema, email, eventoId, habilitado, pronto]);
|
|
7568
|
+
React31.useEffect(() => {
|
|
7569
|
+
if (!habilitado || !pronto) {
|
|
7570
|
+
setCarregando(false);
|
|
7571
|
+
return;
|
|
7572
|
+
}
|
|
7573
|
+
if (!jaCarregouRef.current) setCarregando(true);
|
|
7574
|
+
atualizar();
|
|
7575
|
+
return () => controladorRef.current?.abort();
|
|
7576
|
+
}, [atualizar, habilitado, pronto]);
|
|
7577
|
+
return {
|
|
7578
|
+
alertas,
|
|
7579
|
+
carregando,
|
|
7580
|
+
atualizar
|
|
7581
|
+
};
|
|
7582
|
+
}
|
|
7583
|
+
|
|
7584
|
+
// src/alertas/alertas.tsx
|
|
7585
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7586
|
+
function Alertas({
|
|
7587
|
+
alertas: alertasProps = [],
|
|
7588
|
+
isLoading = false,
|
|
7589
|
+
isSaving = false,
|
|
7590
|
+
isRemovendo = false,
|
|
7591
|
+
podeCriar = true,
|
|
7592
|
+
onCriar,
|
|
7593
|
+
onAtualizar,
|
|
7594
|
+
onConcluir,
|
|
7595
|
+
onExcluir,
|
|
7596
|
+
baseUrl = URL_PADRAO_NOTIFICACOES,
|
|
7597
|
+
sistema,
|
|
7598
|
+
email,
|
|
7599
|
+
fetchFn,
|
|
7600
|
+
eventoId,
|
|
7601
|
+
onErro
|
|
7602
|
+
}) {
|
|
7603
|
+
const [formAberto, setFormAberto] = React32.useState(false);
|
|
7604
|
+
const [alertaEmEdicao, setAlertaEmEdicao] = React32.useState(null);
|
|
7605
|
+
const [salvandoLocal, setSalvandoLocal] = React32.useState(false);
|
|
7606
|
+
const [removendoLocal, setRemovendoLocal] = React32.useState(false);
|
|
7607
|
+
const conectado = Boolean(sistema && email);
|
|
7608
|
+
const remoto = usarAlertas({
|
|
7609
|
+
baseUrl,
|
|
7610
|
+
sistema,
|
|
7611
|
+
email,
|
|
7612
|
+
fetchFn,
|
|
7613
|
+
eventoId,
|
|
7614
|
+
habilitado: conectado,
|
|
7615
|
+
onErro
|
|
7616
|
+
});
|
|
7617
|
+
const alertas = conectado ? remoto.alertas : alertasProps;
|
|
7618
|
+
const carregando = conectado ? remoto.carregando : isLoading;
|
|
7619
|
+
const salvando = salvandoLocal || isSaving;
|
|
7620
|
+
const removendo = removendoLocal || isRemovendo;
|
|
7621
|
+
const resetForm = () => {
|
|
7622
|
+
setFormAberto(false);
|
|
7623
|
+
setAlertaEmEdicao(null);
|
|
7624
|
+
};
|
|
7625
|
+
const abrirNovoAlerta = () => {
|
|
7626
|
+
setAlertaEmEdicao(null);
|
|
7627
|
+
setFormAberto(true);
|
|
7628
|
+
};
|
|
7629
|
+
const abrirEdicao = (alerta) => {
|
|
7630
|
+
setAlertaEmEdicao(alerta);
|
|
7631
|
+
setFormAberto(true);
|
|
7632
|
+
};
|
|
7633
|
+
const handleSalvar = async (payload) => {
|
|
7634
|
+
setSalvandoLocal(true);
|
|
7635
|
+
try {
|
|
7636
|
+
if (alertaEmEdicao) {
|
|
7637
|
+
await onAtualizar?.(alertaEmEdicao.id, payload);
|
|
7638
|
+
} else {
|
|
7639
|
+
await onCriar?.(payload);
|
|
7640
|
+
}
|
|
7641
|
+
if (conectado) remoto.atualizar();
|
|
7642
|
+
resetForm();
|
|
7643
|
+
} catch (err) {
|
|
7644
|
+
console.error("Erro ao salvar alerta:", err);
|
|
7645
|
+
onErro?.(err);
|
|
7646
|
+
} finally {
|
|
7647
|
+
setSalvandoLocal(false);
|
|
7648
|
+
}
|
|
7649
|
+
};
|
|
7650
|
+
const handleConcluir = async (alertaId) => {
|
|
7651
|
+
setRemovendoLocal(true);
|
|
7652
|
+
try {
|
|
7653
|
+
await onConcluir?.(alertaId);
|
|
7654
|
+
if (conectado) remoto.atualizar();
|
|
7655
|
+
} catch (err) {
|
|
7656
|
+
console.error("Erro ao concluir alerta:", err);
|
|
7657
|
+
onErro?.(err);
|
|
7658
|
+
} finally {
|
|
7659
|
+
setRemovendoLocal(false);
|
|
7660
|
+
}
|
|
7661
|
+
};
|
|
7662
|
+
const handleExcluir = (alerta) => {
|
|
7663
|
+
if (!window.confirm(`Tem certeza que deseja excluir o alerta "${alerta.titulo}"?`)) return;
|
|
7664
|
+
void (async () => {
|
|
7665
|
+
setRemovendoLocal(true);
|
|
7666
|
+
try {
|
|
7667
|
+
await onExcluir?.(alerta);
|
|
7668
|
+
if (conectado) remoto.atualizar();
|
|
7669
|
+
} catch (err) {
|
|
7670
|
+
console.error("Erro ao excluir alerta:", err);
|
|
7671
|
+
onErro?.(err);
|
|
7672
|
+
} finally {
|
|
7673
|
+
setRemovendoLocal(false);
|
|
7674
|
+
}
|
|
7675
|
+
})();
|
|
7676
|
+
};
|
|
7677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "alertas-container", children: [
|
|
7678
|
+
!formAberto && podeCriar && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "alertas-nova-acao", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
7679
|
+
"button",
|
|
7680
|
+
{
|
|
7681
|
+
type: "button",
|
|
7682
|
+
onClick: abrirNovoAlerta,
|
|
7683
|
+
className: "alerta-btn alerta-btn--primario",
|
|
7684
|
+
children: [
|
|
7685
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Plus, { size: 16 }),
|
|
7686
|
+
"Novo alerta"
|
|
7687
|
+
]
|
|
7688
|
+
}
|
|
7689
|
+
) }),
|
|
7690
|
+
formAberto && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7691
|
+
FormularioAlerta,
|
|
7692
|
+
{
|
|
7693
|
+
alertaEmEdicao,
|
|
7694
|
+
isSaving: salvando,
|
|
7695
|
+
onSalvar: handleSalvar,
|
|
7696
|
+
onCancelar: resetForm
|
|
7697
|
+
}
|
|
7698
|
+
),
|
|
7699
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("section", { className: "alertas-lista-section", children: [
|
|
7700
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "alertas-lista-header", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h2", { className: "alertas-lista-titulo", children: [
|
|
7701
|
+
"Alertas cadastrados (",
|
|
7702
|
+
alertas.length,
|
|
7703
|
+
")"
|
|
7704
|
+
] }) }),
|
|
7705
|
+
carregando ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "alertas-estado", children: "Carregando alertas..." }) : alertas.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "alertas-vazio", children: [
|
|
7706
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Bell, { size: 32, className: "alertas-vazio-icone" }),
|
|
7707
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "alertas-vazio-texto", children: "Nenhum alerta cadastrado." })
|
|
7708
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "alertas-lista", children: alertas.map((alerta) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
7709
|
+
AlertaItem,
|
|
7710
|
+
{
|
|
7711
|
+
alerta,
|
|
7712
|
+
disabled: removendo,
|
|
7713
|
+
selecionado: alertaEmEdicao?.id === alerta.id,
|
|
7714
|
+
onEditar: () => abrirEdicao(alerta),
|
|
7715
|
+
onConcluir: () => handleConcluir(alerta.id),
|
|
7716
|
+
onExcluir: () => handleExcluir(alerta)
|
|
7717
|
+
},
|
|
7718
|
+
alerta.id
|
|
7719
|
+
)) })
|
|
5513
7720
|
] })
|
|
5514
7721
|
] });
|
|
5515
7722
|
}
|
|
5516
7723
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5517
7724
|
0 && (module.exports = {
|
|
7725
|
+
AlertaItem,
|
|
7726
|
+
Alertas,
|
|
5518
7727
|
AplicationsHeader,
|
|
5519
7728
|
AppsMenu,
|
|
7729
|
+
Avatar,
|
|
5520
7730
|
Badge,
|
|
5521
7731
|
Button,
|
|
5522
7732
|
Card,
|
|
@@ -5539,6 +7749,9 @@ function HeaderNotifications(props) {
|
|
|
5539
7749
|
CommandList,
|
|
5540
7750
|
CommandSeparator,
|
|
5541
7751
|
CommandShortcut,
|
|
7752
|
+
ConfirmDialog,
|
|
7753
|
+
DIAS_SEMANA_PT_BR,
|
|
7754
|
+
DateTimeRangeList,
|
|
5542
7755
|
Dialog,
|
|
5543
7756
|
DialogClose,
|
|
5544
7757
|
DialogContent,
|
|
@@ -5549,6 +7762,19 @@ function HeaderNotifications(props) {
|
|
|
5549
7762
|
DialogPortal,
|
|
5550
7763
|
DialogTitle,
|
|
5551
7764
|
DialogTrigger,
|
|
7765
|
+
Drawer,
|
|
7766
|
+
DrawerBody,
|
|
7767
|
+
DrawerClose,
|
|
7768
|
+
DrawerContent,
|
|
7769
|
+
DrawerContext,
|
|
7770
|
+
DrawerDescription,
|
|
7771
|
+
DrawerFooter,
|
|
7772
|
+
DrawerHeader,
|
|
7773
|
+
DrawerOverlay,
|
|
7774
|
+
DrawerPortal,
|
|
7775
|
+
DrawerProvider,
|
|
7776
|
+
DrawerTitle,
|
|
7777
|
+
DrawerTrigger,
|
|
5552
7778
|
DropdownMenu,
|
|
5553
7779
|
DropdownMenuCheckboxItem,
|
|
5554
7780
|
DropdownMenuContent,
|
|
@@ -5564,24 +7790,37 @@ function HeaderNotifications(props) {
|
|
|
5564
7790
|
DropdownMenuSubContent,
|
|
5565
7791
|
DropdownMenuSubTrigger,
|
|
5566
7792
|
DropdownMenuTrigger,
|
|
7793
|
+
EmptyState,
|
|
7794
|
+
ErroAlertas,
|
|
5567
7795
|
ErroNotificacoes,
|
|
7796
|
+
FileList,
|
|
7797
|
+
FileUpload,
|
|
5568
7798
|
Filter,
|
|
7799
|
+
FormularioAlerta,
|
|
5569
7800
|
Header,
|
|
5570
7801
|
HeaderContainer,
|
|
5571
7802
|
HeaderNotifications,
|
|
5572
7803
|
HeaderProfileHeader,
|
|
5573
7804
|
HeaderProfileItem,
|
|
5574
7805
|
Input,
|
|
7806
|
+
LabelValue,
|
|
7807
|
+
MESES_PT_BR,
|
|
7808
|
+
MESES_PT_BR_ABREV,
|
|
7809
|
+
MiniMonthCalendar,
|
|
5575
7810
|
Modal,
|
|
5576
7811
|
ModalEntidade,
|
|
5577
7812
|
ModalMudancaEntidade,
|
|
7813
|
+
MonthYearPicker,
|
|
7814
|
+
MultiSelect,
|
|
5578
7815
|
PageHeader,
|
|
5579
7816
|
PageHeaderActionsContainer,
|
|
5580
7817
|
PageHeaderTitle,
|
|
5581
7818
|
PageHeaderTitleContent,
|
|
7819
|
+
PeriodRangeList,
|
|
5582
7820
|
Popover,
|
|
5583
7821
|
PopoverContent,
|
|
5584
7822
|
PopoverTrigger,
|
|
7823
|
+
ResultMetadata,
|
|
5585
7824
|
Select,
|
|
5586
7825
|
SelectContent,
|
|
5587
7826
|
SelectGroup,
|
|
@@ -5604,10 +7843,25 @@ function HeaderNotifications(props) {
|
|
|
5604
7843
|
TabsContent,
|
|
5605
7844
|
TabsList,
|
|
5606
7845
|
TabsTrigger,
|
|
7846
|
+
Textarea,
|
|
5607
7847
|
Title,
|
|
7848
|
+
Tooltip,
|
|
5608
7849
|
URL_PADRAO_NOTIFICACOES,
|
|
5609
7850
|
availableApps,
|
|
5610
|
-
|
|
7851
|
+
buildMonthDays,
|
|
7852
|
+
buscarAlertas,
|
|
7853
|
+
buttonVariants,
|
|
7854
|
+
formatDayAriaLabel,
|
|
7855
|
+
formatFileSize,
|
|
7856
|
+
formatMonthYear,
|
|
7857
|
+
isSameDay,
|
|
7858
|
+
isToday,
|
|
7859
|
+
normalizarBaseUrl,
|
|
7860
|
+
toDateKey,
|
|
7861
|
+
toLocalNoon,
|
|
7862
|
+
usarAlertas,
|
|
7863
|
+
useDrawer,
|
|
7864
|
+
validateFiles
|
|
5611
7865
|
});
|
|
5612
7866
|
/*! Bundled license information:
|
|
5613
7867
|
|
|
@@ -5667,6 +7921,14 @@ lucide-react/dist/esm/icons/bell.js:
|
|
|
5667
7921
|
* See the LICENSE file in the root directory of this source tree.
|
|
5668
7922
|
*)
|
|
5669
7923
|
|
|
7924
|
+
lucide-react/dist/esm/icons/calendar-days.js:
|
|
7925
|
+
(**
|
|
7926
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7927
|
+
*
|
|
7928
|
+
* This source code is licensed under the ISC license.
|
|
7929
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7930
|
+
*)
|
|
7931
|
+
|
|
5670
7932
|
lucide-react/dist/esm/icons/check.js:
|
|
5671
7933
|
(**
|
|
5672
7934
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5683,6 +7945,14 @@ lucide-react/dist/esm/icons/chevron-down.js:
|
|
|
5683
7945
|
* See the LICENSE file in the root directory of this source tree.
|
|
5684
7946
|
*)
|
|
5685
7947
|
|
|
7948
|
+
lucide-react/dist/esm/icons/chevron-left.js:
|
|
7949
|
+
(**
|
|
7950
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7951
|
+
*
|
|
7952
|
+
* This source code is licensed under the ISC license.
|
|
7953
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7954
|
+
*)
|
|
7955
|
+
|
|
5686
7956
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
5687
7957
|
(**
|
|
5688
7958
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5715,6 +7985,30 @@ lucide-react/dist/esm/icons/circle.js:
|
|
|
5715
7985
|
* See the LICENSE file in the root directory of this source tree.
|
|
5716
7986
|
*)
|
|
5717
7987
|
|
|
7988
|
+
lucide-react/dist/esm/icons/download.js:
|
|
7989
|
+
(**
|
|
7990
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7991
|
+
*
|
|
7992
|
+
* This source code is licensed under the ISC license.
|
|
7993
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7994
|
+
*)
|
|
7995
|
+
|
|
7996
|
+
lucide-react/dist/esm/icons/external-link.js:
|
|
7997
|
+
(**
|
|
7998
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7999
|
+
*
|
|
8000
|
+
* This source code is licensed under the ISC license.
|
|
8001
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8002
|
+
*)
|
|
8003
|
+
|
|
8004
|
+
lucide-react/dist/esm/icons/file-text.js:
|
|
8005
|
+
(**
|
|
8006
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8007
|
+
*
|
|
8008
|
+
* This source code is licensed under the ISC license.
|
|
8009
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8010
|
+
*)
|
|
8011
|
+
|
|
5718
8012
|
lucide-react/dist/esm/icons/filter-x.js:
|
|
5719
8013
|
(**
|
|
5720
8014
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5763,6 +8057,30 @@ lucide-react/dist/esm/icons/mail.js:
|
|
|
5763
8057
|
* See the LICENSE file in the root directory of this source tree.
|
|
5764
8058
|
*)
|
|
5765
8059
|
|
|
8060
|
+
lucide-react/dist/esm/icons/paperclip.js:
|
|
8061
|
+
(**
|
|
8062
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8063
|
+
*
|
|
8064
|
+
* This source code is licensed under the ISC license.
|
|
8065
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8066
|
+
*)
|
|
8067
|
+
|
|
8068
|
+
lucide-react/dist/esm/icons/pencil.js:
|
|
8069
|
+
(**
|
|
8070
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8071
|
+
*
|
|
8072
|
+
* This source code is licensed under the ISC license.
|
|
8073
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8074
|
+
*)
|
|
8075
|
+
|
|
8076
|
+
lucide-react/dist/esm/icons/plus.js:
|
|
8077
|
+
(**
|
|
8078
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8079
|
+
*
|
|
8080
|
+
* This source code is licensed under the ISC license.
|
|
8081
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8082
|
+
*)
|
|
8083
|
+
|
|
5766
8084
|
lucide-react/dist/esm/icons/search.js:
|
|
5767
8085
|
(**
|
|
5768
8086
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5779,6 +8097,14 @@ lucide-react/dist/esm/icons/trash-2.js:
|
|
|
5779
8097
|
* See the LICENSE file in the root directory of this source tree.
|
|
5780
8098
|
*)
|
|
5781
8099
|
|
|
8100
|
+
lucide-react/dist/esm/icons/user.js:
|
|
8101
|
+
(**
|
|
8102
|
+
* @license lucide-react v0.453.0 - ISC
|
|
8103
|
+
*
|
|
8104
|
+
* This source code is licensed under the ISC license.
|
|
8105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8106
|
+
*)
|
|
8107
|
+
|
|
5782
8108
|
lucide-react/dist/esm/icons/x.js:
|
|
5783
8109
|
(**
|
|
5784
8110
|
* @license lucide-react v0.453.0 - ISC
|