@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.mjs
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (typeof window !== 'undefined') {
|
|
3
|
-
"use client";
|
|
4
|
-
}
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
6
2
|
|
|
7
3
|
// src/components/Button/index.tsx
|
|
8
4
|
import { Slot } from "@radix-ui/react-slot";
|
|
@@ -157,6 +153,20 @@ var Bell = createLucideIcon("Bell", [
|
|
|
157
153
|
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
158
154
|
]);
|
|
159
155
|
|
|
156
|
+
// ../../node_modules/lucide-react/dist/esm/icons/calendar-days.js
|
|
157
|
+
var CalendarDays = createLucideIcon("CalendarDays", [
|
|
158
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
159
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
160
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
161
|
+
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
162
|
+
["path", { d: "M8 14h.01", key: "6423bh" }],
|
|
163
|
+
["path", { d: "M12 14h.01", key: "1etili" }],
|
|
164
|
+
["path", { d: "M16 14h.01", key: "1gbofw" }],
|
|
165
|
+
["path", { d: "M8 18h.01", key: "lrp35t" }],
|
|
166
|
+
["path", { d: "M12 18h.01", key: "mhygvu" }],
|
|
167
|
+
["path", { d: "M16 18h.01", key: "kzsmim" }]
|
|
168
|
+
]);
|
|
169
|
+
|
|
160
170
|
// ../../node_modules/lucide-react/dist/esm/icons/check.js
|
|
161
171
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
162
172
|
|
|
@@ -165,6 +175,11 @@ var ChevronDown = createLucideIcon("ChevronDown", [
|
|
|
165
175
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
166
176
|
]);
|
|
167
177
|
|
|
178
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
|
|
179
|
+
var ChevronLeft = createLucideIcon("ChevronLeft", [
|
|
180
|
+
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
181
|
+
]);
|
|
182
|
+
|
|
168
183
|
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
169
184
|
var ChevronRight = createLucideIcon("ChevronRight", [
|
|
170
185
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
@@ -184,6 +199,29 @@ var Circle = createLucideIcon("Circle", [
|
|
|
184
199
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
185
200
|
]);
|
|
186
201
|
|
|
202
|
+
// ../../node_modules/lucide-react/dist/esm/icons/download.js
|
|
203
|
+
var Download = createLucideIcon("Download", [
|
|
204
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
205
|
+
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
206
|
+
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
207
|
+
]);
|
|
208
|
+
|
|
209
|
+
// ../../node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
210
|
+
var ExternalLink = createLucideIcon("ExternalLink", [
|
|
211
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
212
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
213
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
214
|
+
]);
|
|
215
|
+
|
|
216
|
+
// ../../node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
217
|
+
var FileText = createLucideIcon("FileText", [
|
|
218
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
219
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
220
|
+
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
221
|
+
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
222
|
+
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
223
|
+
]);
|
|
224
|
+
|
|
187
225
|
// ../../node_modules/lucide-react/dist/esm/icons/filter-x.js
|
|
188
226
|
var FilterX = createLucideIcon("FilterX", [
|
|
189
227
|
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
@@ -232,6 +270,35 @@ var Mail = createLucideIcon("Mail", [
|
|
|
232
270
|
["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }]
|
|
233
271
|
]);
|
|
234
272
|
|
|
273
|
+
// ../../node_modules/lucide-react/dist/esm/icons/paperclip.js
|
|
274
|
+
var Paperclip = createLucideIcon("Paperclip", [
|
|
275
|
+
[
|
|
276
|
+
"path",
|
|
277
|
+
{
|
|
278
|
+
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",
|
|
279
|
+
key: "1u3ebp"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
]);
|
|
283
|
+
|
|
284
|
+
// ../../node_modules/lucide-react/dist/esm/icons/pencil.js
|
|
285
|
+
var Pencil = createLucideIcon("Pencil", [
|
|
286
|
+
[
|
|
287
|
+
"path",
|
|
288
|
+
{
|
|
289
|
+
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",
|
|
290
|
+
key: "1a8usu"
|
|
291
|
+
}
|
|
292
|
+
],
|
|
293
|
+
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
294
|
+
]);
|
|
295
|
+
|
|
296
|
+
// ../../node_modules/lucide-react/dist/esm/icons/plus.js
|
|
297
|
+
var Plus = createLucideIcon("Plus", [
|
|
298
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
299
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
300
|
+
]);
|
|
301
|
+
|
|
235
302
|
// ../../node_modules/lucide-react/dist/esm/icons/search.js
|
|
236
303
|
var Search = createLucideIcon("Search", [
|
|
237
304
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
@@ -247,6 +314,12 @@ var Trash2 = createLucideIcon("Trash2", [
|
|
|
247
314
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
248
315
|
]);
|
|
249
316
|
|
|
317
|
+
// ../../node_modules/lucide-react/dist/esm/icons/user.js
|
|
318
|
+
var User = createLucideIcon("User", [
|
|
319
|
+
["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
|
|
320
|
+
["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
|
|
321
|
+
]);
|
|
322
|
+
|
|
250
323
|
// ../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
251
324
|
var X = createLucideIcon("X", [
|
|
252
325
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
@@ -3837,15 +3910,53 @@ var Input = React9.forwardRef(
|
|
|
3837
3910
|
);
|
|
3838
3911
|
Input.displayName = "Input";
|
|
3839
3912
|
|
|
3840
|
-
// src/components/atoms/forms/
|
|
3913
|
+
// src/components/atoms/forms/textarea.tsx
|
|
3841
3914
|
import * as React10 from "react";
|
|
3842
3915
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3843
|
-
var
|
|
3916
|
+
var Textarea = React10.forwardRef(
|
|
3917
|
+
({ className, id, label, required, ...props }, ref) => {
|
|
3918
|
+
const idGenerate = id ? id : label && `field-${Date.now()}-${Math.random() * 1e5}`;
|
|
3919
|
+
return /* @__PURE__ */ jsxs12("div", { className: "cnc-w-full", children: [
|
|
3920
|
+
label && /* @__PURE__ */ jsxs12(
|
|
3921
|
+
"label",
|
|
3922
|
+
{
|
|
3923
|
+
htmlFor: idGenerate,
|
|
3924
|
+
className: "cnc-block cnc-text-sm cnc-mb-1 cnc-font-medium cnc-text-brand-gray-600",
|
|
3925
|
+
children: [
|
|
3926
|
+
label,
|
|
3927
|
+
required && /* @__PURE__ */ jsx14("span", { className: "text-red-500", children: " *" })
|
|
3928
|
+
]
|
|
3929
|
+
}
|
|
3930
|
+
),
|
|
3931
|
+
/* @__PURE__ */ jsx14(
|
|
3932
|
+
"textarea",
|
|
3933
|
+
{
|
|
3934
|
+
id: idGenerate,
|
|
3935
|
+
className: cn(
|
|
3936
|
+
"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",
|
|
3937
|
+
"placeholder:cnc-text-muted-foreground focus-visible:cnc-outline-none",
|
|
3938
|
+
"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",
|
|
3939
|
+
"not-disabled:hover:cnc-border-brand-gray-500",
|
|
3940
|
+
className
|
|
3941
|
+
),
|
|
3942
|
+
ref,
|
|
3943
|
+
...props
|
|
3944
|
+
}
|
|
3945
|
+
)
|
|
3946
|
+
] });
|
|
3947
|
+
}
|
|
3948
|
+
);
|
|
3949
|
+
Textarea.displayName = "Textarea";
|
|
3950
|
+
|
|
3951
|
+
// src/components/atoms/forms/checkbox.tsx
|
|
3952
|
+
import * as React11 from "react";
|
|
3953
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3954
|
+
var Checkbox = React11.forwardRef(
|
|
3844
3955
|
({ className, id, label, ...props }, ref) => {
|
|
3845
3956
|
console.log();
|
|
3846
3957
|
const idGenerate = id ? id : label && `field-${Date.now()}-${Math.random() * 1e5}`;
|
|
3847
|
-
return /* @__PURE__ */
|
|
3848
|
-
/* @__PURE__ */
|
|
3958
|
+
return /* @__PURE__ */ jsxs13("div", { className: "cnc-w-full cnc-flex cnc-flex-row", children: [
|
|
3959
|
+
/* @__PURE__ */ jsx15(
|
|
3849
3960
|
"input",
|
|
3850
3961
|
{
|
|
3851
3962
|
type: "checkbox",
|
|
@@ -3855,7 +3966,7 @@ var Checkbox = React10.forwardRef(
|
|
|
3855
3966
|
...props
|
|
3856
3967
|
}
|
|
3857
3968
|
),
|
|
3858
|
-
label && /* @__PURE__ */
|
|
3969
|
+
label && /* @__PURE__ */ jsx15(
|
|
3859
3970
|
"label",
|
|
3860
3971
|
{
|
|
3861
3972
|
htmlFor: idGenerate,
|
|
@@ -3869,9 +3980,9 @@ var Checkbox = React10.forwardRef(
|
|
|
3869
3980
|
Checkbox.displayName = "Checkbox";
|
|
3870
3981
|
|
|
3871
3982
|
// src/components/atoms/forms/switch.tsx
|
|
3872
|
-
import * as
|
|
3873
|
-
import { jsx as
|
|
3874
|
-
var Switch =
|
|
3983
|
+
import * as React12 from "react";
|
|
3984
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3985
|
+
var Switch = React12.forwardRef(
|
|
3875
3986
|
({
|
|
3876
3987
|
className,
|
|
3877
3988
|
id,
|
|
@@ -3885,12 +3996,12 @@ var Switch = React11.forwardRef(
|
|
|
3885
3996
|
name,
|
|
3886
3997
|
"aria-label": ariaLabel
|
|
3887
3998
|
}, ref) => {
|
|
3888
|
-
const [internalChecked, setInternalChecked] =
|
|
3999
|
+
const [internalChecked, setInternalChecked] = React12.useState(
|
|
3889
4000
|
defaultChecked ?? false
|
|
3890
4001
|
);
|
|
3891
4002
|
const isControlled = checked !== void 0;
|
|
3892
4003
|
const isChecked = isControlled ? checked : internalChecked;
|
|
3893
|
-
const reactId =
|
|
4004
|
+
const reactId = React12.useId();
|
|
3894
4005
|
const fieldId = id || reactId;
|
|
3895
4006
|
const handleToggle = () => {
|
|
3896
4007
|
if (disabled) return;
|
|
@@ -3900,8 +4011,8 @@ var Switch = React11.forwardRef(
|
|
|
3900
4011
|
}
|
|
3901
4012
|
onChange?.(newValue);
|
|
3902
4013
|
};
|
|
3903
|
-
return /* @__PURE__ */
|
|
3904
|
-
/* @__PURE__ */
|
|
4014
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn("cnc-flex cnc-items-center cnc-gap-2", className), children: [
|
|
4015
|
+
/* @__PURE__ */ jsx16(
|
|
3905
4016
|
"input",
|
|
3906
4017
|
{
|
|
3907
4018
|
type: "checkbox",
|
|
@@ -3913,7 +4024,7 @@ var Switch = React11.forwardRef(
|
|
|
3913
4024
|
"aria-hidden": "true"
|
|
3914
4025
|
}
|
|
3915
4026
|
),
|
|
3916
|
-
/* @__PURE__ */
|
|
4027
|
+
/* @__PURE__ */ jsx16(
|
|
3917
4028
|
"button",
|
|
3918
4029
|
{
|
|
3919
4030
|
ref,
|
|
@@ -3931,7 +4042,7 @@ var Switch = React11.forwardRef(
|
|
|
3931
4042
|
"disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50",
|
|
3932
4043
|
isChecked ? "cnc-bg-brand-blue-400 cnc-border-brand-blue-500" : "cnc-bg-brand-gray-20 cnc-border-brand-gray-100"
|
|
3933
4044
|
),
|
|
3934
|
-
children: /* @__PURE__ */
|
|
4045
|
+
children: /* @__PURE__ */ jsx16(
|
|
3935
4046
|
"span",
|
|
3936
4047
|
{
|
|
3937
4048
|
className: cn(
|
|
@@ -3942,14 +4053,14 @@ var Switch = React11.forwardRef(
|
|
|
3942
4053
|
)
|
|
3943
4054
|
}
|
|
3944
4055
|
),
|
|
3945
|
-
label && /* @__PURE__ */
|
|
4056
|
+
label && /* @__PURE__ */ jsxs14(
|
|
3946
4057
|
"label",
|
|
3947
4058
|
{
|
|
3948
4059
|
htmlFor: fieldId,
|
|
3949
4060
|
className: "cnc-text-sm cnc-font-medium cnc-text-brand-gray-600 cnc-cursor-pointer",
|
|
3950
4061
|
children: [
|
|
3951
4062
|
label,
|
|
3952
|
-
required && /* @__PURE__ */
|
|
4063
|
+
required && /* @__PURE__ */ jsx16("span", { className: "cnc-text-red-500", children: " *" })
|
|
3953
4064
|
]
|
|
3954
4065
|
}
|
|
3955
4066
|
)
|
|
@@ -3959,7 +4070,7 @@ var Switch = React11.forwardRef(
|
|
|
3959
4070
|
Switch.displayName = "Switch";
|
|
3960
4071
|
|
|
3961
4072
|
// src/components/atoms/display/badge.tsx
|
|
3962
|
-
import { jsx as
|
|
4073
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3963
4074
|
var Badge = ({
|
|
3964
4075
|
variant = "default",
|
|
3965
4076
|
rounded = true,
|
|
@@ -3981,7 +4092,7 @@ var Badge = ({
|
|
|
3981
4092
|
md: "cnc-text-sm cnc-px-3 cnc-py-1",
|
|
3982
4093
|
lg: "cnc-text-base cnc-px-4 cnc-py-2"
|
|
3983
4094
|
};
|
|
3984
|
-
return /* @__PURE__ */
|
|
4095
|
+
return /* @__PURE__ */ jsx17(
|
|
3985
4096
|
"span",
|
|
3986
4097
|
{
|
|
3987
4098
|
className: cn(
|
|
@@ -3996,13 +4107,73 @@ var Badge = ({
|
|
|
3996
4107
|
);
|
|
3997
4108
|
};
|
|
3998
4109
|
|
|
4110
|
+
// src/components/atoms/display/avatar.tsx
|
|
4111
|
+
import * as React13 from "react";
|
|
4112
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
4113
|
+
var avatarSizeClasses = {
|
|
4114
|
+
sm: "cnc-size-8 cnc-text-[10px]",
|
|
4115
|
+
md: "cnc-size-12 cnc-text-xs",
|
|
4116
|
+
lg: "cnc-size-16 cnc-text-sm",
|
|
4117
|
+
xl: "cnc-size-24 cnc-text-xl"
|
|
4118
|
+
};
|
|
4119
|
+
var avatarSizeIcon = {
|
|
4120
|
+
sm: 16,
|
|
4121
|
+
md: 20,
|
|
4122
|
+
lg: 28,
|
|
4123
|
+
xl: 40
|
|
4124
|
+
};
|
|
4125
|
+
function Avatar({
|
|
4126
|
+
src,
|
|
4127
|
+
alt,
|
|
4128
|
+
fallback,
|
|
4129
|
+
size = "md",
|
|
4130
|
+
isLoading = false,
|
|
4131
|
+
className,
|
|
4132
|
+
...props
|
|
4133
|
+
}) {
|
|
4134
|
+
const [hasError, setHasError] = React13.useState(false);
|
|
4135
|
+
const baseClasses = cn(
|
|
4136
|
+
"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",
|
|
4137
|
+
avatarSizeClasses[size],
|
|
4138
|
+
className
|
|
4139
|
+
);
|
|
4140
|
+
if (isLoading) {
|
|
4141
|
+
return /* @__PURE__ */ jsx18(
|
|
4142
|
+
"span",
|
|
4143
|
+
{
|
|
4144
|
+
className: cn(baseClasses, "cnc-animate-pulse cnc-bg-brand-gray-50"),
|
|
4145
|
+
role: "status",
|
|
4146
|
+
"aria-label": "Carregando avatar",
|
|
4147
|
+
...props
|
|
4148
|
+
}
|
|
4149
|
+
);
|
|
4150
|
+
}
|
|
4151
|
+
const showImage = src && !hasError;
|
|
4152
|
+
return /* @__PURE__ */ jsx18("span", { className: baseClasses, ...props, children: showImage ? /* @__PURE__ */ jsx18(
|
|
4153
|
+
"img",
|
|
4154
|
+
{
|
|
4155
|
+
src,
|
|
4156
|
+
alt: alt ?? "Avatar",
|
|
4157
|
+
className: "cnc-h-full cnc-w-full cnc-object-cover",
|
|
4158
|
+
onError: () => setHasError(true)
|
|
4159
|
+
}
|
|
4160
|
+
) : fallback ? /* @__PURE__ */ jsx18("span", { className: "cnc-font-bold", children: fallback }) : /* @__PURE__ */ jsx18(
|
|
4161
|
+
User,
|
|
4162
|
+
{
|
|
4163
|
+
className: "cnc-shrink-0",
|
|
4164
|
+
size: avatarSizeIcon[size],
|
|
4165
|
+
"aria-hidden": "true"
|
|
4166
|
+
}
|
|
4167
|
+
) });
|
|
4168
|
+
}
|
|
4169
|
+
|
|
3999
4170
|
// src/components/molecules/card.tsx
|
|
4000
|
-
import { jsx as
|
|
4171
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
4001
4172
|
function Card({
|
|
4002
4173
|
className,
|
|
4003
4174
|
...rest
|
|
4004
4175
|
}) {
|
|
4005
|
-
return /* @__PURE__ */
|
|
4176
|
+
return /* @__PURE__ */ jsx19(
|
|
4006
4177
|
"div",
|
|
4007
4178
|
{
|
|
4008
4179
|
className: cn(
|
|
@@ -4017,7 +4188,7 @@ function CardHeader({
|
|
|
4017
4188
|
className,
|
|
4018
4189
|
...rest
|
|
4019
4190
|
}) {
|
|
4020
|
-
return /* @__PURE__ */
|
|
4191
|
+
return /* @__PURE__ */ jsx19("div", { className: "cnc-px-6 cnc-pt-6", children: /* @__PURE__ */ jsx19(
|
|
4021
4192
|
"div",
|
|
4022
4193
|
{
|
|
4023
4194
|
className: cn(
|
|
@@ -4032,13 +4203,13 @@ function CardContent({
|
|
|
4032
4203
|
className,
|
|
4033
4204
|
...rest
|
|
4034
4205
|
}) {
|
|
4035
|
-
return /* @__PURE__ */
|
|
4206
|
+
return /* @__PURE__ */ jsx19("div", { className: cn("cnc-px-6 cnc-py-2", className), ...rest });
|
|
4036
4207
|
}
|
|
4037
4208
|
function CardFooter({
|
|
4038
4209
|
className,
|
|
4039
4210
|
...rest
|
|
4040
4211
|
}) {
|
|
4041
|
-
return /* @__PURE__ */
|
|
4212
|
+
return /* @__PURE__ */ jsx19(
|
|
4042
4213
|
"div",
|
|
4043
4214
|
{
|
|
4044
4215
|
className: cn(
|
|
@@ -4053,7 +4224,7 @@ function CardFooterItem({
|
|
|
4053
4224
|
className,
|
|
4054
4225
|
...rest
|
|
4055
4226
|
}) {
|
|
4056
|
-
return /* @__PURE__ */
|
|
4227
|
+
return /* @__PURE__ */ jsx19(
|
|
4057
4228
|
"div",
|
|
4058
4229
|
{
|
|
4059
4230
|
className: cn(
|
|
@@ -4067,7 +4238,7 @@ function CardFooterItem({
|
|
|
4067
4238
|
|
|
4068
4239
|
// src/components/molecules/collapsible.tsx
|
|
4069
4240
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4070
|
-
import { jsx as
|
|
4241
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4071
4242
|
var Collapsible = CollapsiblePrimitive.Root;
|
|
4072
4243
|
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
4073
4244
|
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
@@ -4075,16 +4246,16 @@ var AnimatedCollapsibleContent = ({
|
|
|
4075
4246
|
className,
|
|
4076
4247
|
...rest
|
|
4077
4248
|
}) => {
|
|
4078
|
-
return /* @__PURE__ */
|
|
4249
|
+
return /* @__PURE__ */ jsx20(CollapsibleContent2, { className: "cnc-collapsible-content", ...rest });
|
|
4079
4250
|
};
|
|
4080
4251
|
|
|
4081
4252
|
// src/components/molecules/display/page-header.tsx
|
|
4082
|
-
import { jsx as
|
|
4253
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4083
4254
|
function PageHeader({
|
|
4084
4255
|
children,
|
|
4085
4256
|
className
|
|
4086
4257
|
}) {
|
|
4087
|
-
return /* @__PURE__ */
|
|
4258
|
+
return /* @__PURE__ */ jsx21(
|
|
4088
4259
|
"header",
|
|
4089
4260
|
{
|
|
4090
4261
|
className: cn(
|
|
@@ -4099,7 +4270,7 @@ function PageHeaderTitleContent({
|
|
|
4099
4270
|
children,
|
|
4100
4271
|
className
|
|
4101
4272
|
}) {
|
|
4102
|
-
return /* @__PURE__ */
|
|
4273
|
+
return /* @__PURE__ */ jsx21(
|
|
4103
4274
|
"div",
|
|
4104
4275
|
{
|
|
4105
4276
|
className: cn(
|
|
@@ -4116,16 +4287,16 @@ function PageHeaderTitle({
|
|
|
4116
4287
|
titleAs = "h1"
|
|
4117
4288
|
}) {
|
|
4118
4289
|
const ComponentTitle = titleAs;
|
|
4119
|
-
return /* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
4121
|
-
description && /* @__PURE__ */
|
|
4290
|
+
return /* @__PURE__ */ jsxs15("div", { children: [
|
|
4291
|
+
/* @__PURE__ */ jsx21(ComponentTitle, { className: "cnc-text-2xl cnc-font-semibold cnc-text-brand-blue-600", children: title }),
|
|
4292
|
+
description && /* @__PURE__ */ jsx21("p", { className: "cnc-text-sm cnc-text-brand-gray-500", children: description })
|
|
4122
4293
|
] });
|
|
4123
4294
|
}
|
|
4124
4295
|
function PageHeaderActionsContainer({
|
|
4125
4296
|
children,
|
|
4126
4297
|
className
|
|
4127
4298
|
}) {
|
|
4128
|
-
return /* @__PURE__ */
|
|
4299
|
+
return /* @__PURE__ */ jsx21(
|
|
4129
4300
|
"div",
|
|
4130
4301
|
{
|
|
4131
4302
|
className: cn(
|
|
@@ -4137,17 +4308,151 @@ function PageHeaderActionsContainer({
|
|
|
4137
4308
|
);
|
|
4138
4309
|
}
|
|
4139
4310
|
function Title2({ title, as: Component = "h1" }) {
|
|
4140
|
-
return /* @__PURE__ */
|
|
4311
|
+
return /* @__PURE__ */ jsx21(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 });
|
|
4312
|
+
}
|
|
4313
|
+
|
|
4314
|
+
// src/components/molecules/display/empty-state.tsx
|
|
4315
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4316
|
+
function EmptyState({
|
|
4317
|
+
icon,
|
|
4318
|
+
title,
|
|
4319
|
+
description,
|
|
4320
|
+
action,
|
|
4321
|
+
minHeight = "cnc-min-h-48",
|
|
4322
|
+
className,
|
|
4323
|
+
...props
|
|
4324
|
+
}) {
|
|
4325
|
+
return /* @__PURE__ */ jsxs16(
|
|
4326
|
+
"div",
|
|
4327
|
+
{
|
|
4328
|
+
className: cn(
|
|
4329
|
+
"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",
|
|
4330
|
+
minHeight,
|
|
4331
|
+
className
|
|
4332
|
+
),
|
|
4333
|
+
...props,
|
|
4334
|
+
children: [
|
|
4335
|
+
/* @__PURE__ */ jsx22("div", { className: "cnc-mb-3 cnc-text-brand-gray-200", children: icon ?? /* @__PURE__ */ jsx22(FolderOpen, { className: "cnc-h-10 cnc-w-10" }) }),
|
|
4336
|
+
/* @__PURE__ */ jsx22("p", { className: "cnc-text-sm cnc-font-medium cnc-text-brand-blue-600", children: title }),
|
|
4337
|
+
description ? /* @__PURE__ */ jsx22("p", { className: "cnc-mt-1 cnc-max-w-md cnc-text-sm cnc-text-brand-gray-200", children: description }) : null,
|
|
4338
|
+
action ? /* @__PURE__ */ jsx22("div", { className: "cnc-mt-4", children: action }) : null
|
|
4339
|
+
]
|
|
4340
|
+
}
|
|
4341
|
+
);
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
// src/components/molecules/display/result-metadata.tsx
|
|
4345
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4346
|
+
function encontradosSuffix(resourceName, forceWordGender) {
|
|
4347
|
+
if (forceWordGender === "masc") return "o";
|
|
4348
|
+
if (forceWordGender === "fem") return "a";
|
|
4349
|
+
return resourceName.endsWith("a") ? "a" : "o";
|
|
4350
|
+
}
|
|
4351
|
+
function ResultMetadata({
|
|
4352
|
+
resourceName,
|
|
4353
|
+
total,
|
|
4354
|
+
displayed,
|
|
4355
|
+
isLoading = false,
|
|
4356
|
+
forceWordGender,
|
|
4357
|
+
truncationThreshold = 30,
|
|
4358
|
+
className,
|
|
4359
|
+
...props
|
|
4360
|
+
}) {
|
|
4361
|
+
const encontradVogal = encontradosSuffix(resourceName, forceWordGender);
|
|
4362
|
+
return /* @__PURE__ */ jsxs17(
|
|
4363
|
+
"div",
|
|
4364
|
+
{
|
|
4365
|
+
className: cn("cnc-mt-4 cnc-mb-4", className),
|
|
4366
|
+
role: "status",
|
|
4367
|
+
"aria-live": "polite",
|
|
4368
|
+
...props,
|
|
4369
|
+
children: [
|
|
4370
|
+
/* @__PURE__ */ jsx23("div", { className: "cnc-text-base cnc-font-bold cnc-text-brand-blue-100", children: `${resourceName} encontrad${encontradVogal}s | ${isLoading ? "carregando ..." : total?.toLocaleString("pt-BR")}` }),
|
|
4371
|
+
displayed >= truncationThreshold && /* @__PURE__ */ jsxs17("div", { children: [
|
|
4372
|
+
"Exibindo os ",
|
|
4373
|
+
/* @__PURE__ */ jsx23("span", { className: "cnc-font-bold", children: displayed }),
|
|
4374
|
+
" primeiros registros. Utilize os filtros para refinar sua busca."
|
|
4375
|
+
] })
|
|
4376
|
+
]
|
|
4377
|
+
}
|
|
4378
|
+
);
|
|
4379
|
+
}
|
|
4380
|
+
|
|
4381
|
+
// src/components/molecules/display/label-value.tsx
|
|
4382
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4383
|
+
function LabelValue({
|
|
4384
|
+
label,
|
|
4385
|
+
value,
|
|
4386
|
+
href,
|
|
4387
|
+
className,
|
|
4388
|
+
valueClassName
|
|
4389
|
+
}) {
|
|
4390
|
+
return /* @__PURE__ */ jsxs18("div", { className, children: [
|
|
4391
|
+
/* @__PURE__ */ jsx24("div", { className: "cnc-mb-2 cnc-text-sm cnc-font-bold cnc-leading-4 cnc-text-primary", children: label }),
|
|
4392
|
+
/* @__PURE__ */ jsxs18(
|
|
4393
|
+
"div",
|
|
4394
|
+
{
|
|
4395
|
+
className: cn(
|
|
4396
|
+
"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",
|
|
4397
|
+
valueClassName
|
|
4398
|
+
),
|
|
4399
|
+
children: [
|
|
4400
|
+
value ?? "-",
|
|
4401
|
+
href && /* @__PURE__ */ jsx24(
|
|
4402
|
+
"a",
|
|
4403
|
+
{
|
|
4404
|
+
href,
|
|
4405
|
+
target: "_blank",
|
|
4406
|
+
rel: "noopener noreferrer",
|
|
4407
|
+
className: "cnc-inline-flex cnc-items-center cnc-text-brand-blue-500 hover:cnc-opacity-80",
|
|
4408
|
+
"aria-label": `Abrir link externo de ${label}`,
|
|
4409
|
+
children: /* @__PURE__ */ jsx24(ExternalLink, { className: "cnc-size-4" })
|
|
4410
|
+
}
|
|
4411
|
+
)
|
|
4412
|
+
]
|
|
4413
|
+
}
|
|
4414
|
+
)
|
|
4415
|
+
] });
|
|
4141
4416
|
}
|
|
4142
4417
|
|
|
4143
4418
|
// src/components/molecules/forms/combobox.tsx
|
|
4144
|
-
import * as
|
|
4419
|
+
import * as React16 from "react";
|
|
4420
|
+
|
|
4421
|
+
// src/components/molecules/forms/combobox-footer.tsx
|
|
4422
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4423
|
+
function ComboboxDropdownFooter({
|
|
4424
|
+
footerAction,
|
|
4425
|
+
renderFooter,
|
|
4426
|
+
close,
|
|
4427
|
+
hidden = false
|
|
4428
|
+
}) {
|
|
4429
|
+
if (hidden) return null;
|
|
4430
|
+
if (renderFooter) {
|
|
4431
|
+
return /* @__PURE__ */ jsx25("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-p-2", children: renderFooter({ close }) });
|
|
4432
|
+
}
|
|
4433
|
+
if (!footerAction) return null;
|
|
4434
|
+
return /* @__PURE__ */ jsx25("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-p-2", children: /* @__PURE__ */ jsx25(
|
|
4435
|
+
Button,
|
|
4436
|
+
{
|
|
4437
|
+
type: "button",
|
|
4438
|
+
variant: footerAction.variant ?? "create",
|
|
4439
|
+
className: "cnc-w-full",
|
|
4440
|
+
disabled: footerAction.disabled,
|
|
4441
|
+
onClick: (event) => {
|
|
4442
|
+
event.preventDefault();
|
|
4443
|
+
event.stopPropagation();
|
|
4444
|
+
footerAction.onClick(event);
|
|
4445
|
+
},
|
|
4446
|
+
children: footerAction.label
|
|
4447
|
+
}
|
|
4448
|
+
) });
|
|
4449
|
+
}
|
|
4145
4450
|
|
|
4146
4451
|
// src/components/molecules/overlay/command.tsx
|
|
4147
|
-
import * as
|
|
4452
|
+
import * as React14 from "react";
|
|
4148
4453
|
import { Command as CommandPrimitive } from "cmdk";
|
|
4149
|
-
import { jsx as
|
|
4150
|
-
var Command =
|
|
4454
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4455
|
+
var Command = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4151
4456
|
CommandPrimitive,
|
|
4152
4457
|
{
|
|
4153
4458
|
ref,
|
|
@@ -4160,16 +4465,16 @@ var Command = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4160
4465
|
));
|
|
4161
4466
|
Command.displayName = CommandPrimitive.displayName;
|
|
4162
4467
|
var CommandDialog = ({ children, ...props }) => {
|
|
4163
|
-
return /* @__PURE__ */
|
|
4468
|
+
return /* @__PURE__ */ jsx26(Dialog, { ...props, children: /* @__PURE__ */ jsx26(DialogContent, { className: "cnc-overflow-hidden cnc-p-0", children: /* @__PURE__ */ jsx26(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 }) }) });
|
|
4164
4469
|
};
|
|
4165
|
-
var CommandInput =
|
|
4470
|
+
var CommandInput = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs19(
|
|
4166
4471
|
"div",
|
|
4167
4472
|
{
|
|
4168
4473
|
className: "cnc-flex cnc-items-center cnc-border-b cnc-px-3",
|
|
4169
4474
|
"cmdk-input-wrapper": "",
|
|
4170
4475
|
children: [
|
|
4171
|
-
/* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4476
|
+
/* @__PURE__ */ jsx26(Search, { className: "cnc-mr-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" }),
|
|
4477
|
+
/* @__PURE__ */ jsx26(
|
|
4173
4478
|
CommandPrimitive.Input,
|
|
4174
4479
|
{
|
|
4175
4480
|
ref,
|
|
@@ -4184,7 +4489,7 @@ var CommandInput = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4184
4489
|
}
|
|
4185
4490
|
));
|
|
4186
4491
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
4187
|
-
var CommandList =
|
|
4492
|
+
var CommandList = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4188
4493
|
CommandPrimitive.List,
|
|
4189
4494
|
{
|
|
4190
4495
|
ref,
|
|
@@ -4196,7 +4501,7 @@ var CommandList = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4196
4501
|
}
|
|
4197
4502
|
));
|
|
4198
4503
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
4199
|
-
var CommandEmpty =
|
|
4504
|
+
var CommandEmpty = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx26(
|
|
4200
4505
|
CommandPrimitive.Empty,
|
|
4201
4506
|
{
|
|
4202
4507
|
ref,
|
|
@@ -4205,7 +4510,7 @@ var CommandEmpty = React12.forwardRef((props, ref) => /* @__PURE__ */ jsx20(
|
|
|
4205
4510
|
}
|
|
4206
4511
|
));
|
|
4207
4512
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
4208
|
-
var CommandGroup =
|
|
4513
|
+
var CommandGroup = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4209
4514
|
CommandPrimitive.Group,
|
|
4210
4515
|
{
|
|
4211
4516
|
ref,
|
|
@@ -4217,7 +4522,7 @@ var CommandGroup = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4217
4522
|
}
|
|
4218
4523
|
));
|
|
4219
4524
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
4220
|
-
var CommandSeparator =
|
|
4525
|
+
var CommandSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4221
4526
|
CommandPrimitive.Separator,
|
|
4222
4527
|
{
|
|
4223
4528
|
ref,
|
|
@@ -4226,7 +4531,7 @@ var CommandSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4226
4531
|
}
|
|
4227
4532
|
));
|
|
4228
4533
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
4229
|
-
var CommandItem =
|
|
4534
|
+
var CommandItem = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4230
4535
|
CommandPrimitive.Item,
|
|
4231
4536
|
{
|
|
4232
4537
|
ref,
|
|
@@ -4242,7 +4547,7 @@ var CommandShortcut = ({
|
|
|
4242
4547
|
className,
|
|
4243
4548
|
...props
|
|
4244
4549
|
}) => {
|
|
4245
|
-
return /* @__PURE__ */
|
|
4550
|
+
return /* @__PURE__ */ jsx26(
|
|
4246
4551
|
"span",
|
|
4247
4552
|
{
|
|
4248
4553
|
className: cn(
|
|
@@ -4256,12 +4561,12 @@ var CommandShortcut = ({
|
|
|
4256
4561
|
CommandShortcut.displayName = "CommandShortcut";
|
|
4257
4562
|
|
|
4258
4563
|
// src/components/molecules/overlay/popover.tsx
|
|
4259
|
-
import * as
|
|
4564
|
+
import * as React15 from "react";
|
|
4260
4565
|
import * as PopoverPrimitive2 from "@radix-ui/react-popover";
|
|
4261
|
-
import { jsx as
|
|
4566
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4262
4567
|
var Popover2 = PopoverPrimitive2.Root;
|
|
4263
4568
|
var PopoverTrigger2 = PopoverPrimitive2.Trigger;
|
|
4264
|
-
var PopoverContent2 =
|
|
4569
|
+
var PopoverContent2 = React15.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx27(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsx27(
|
|
4265
4570
|
PopoverPrimitive2.Content,
|
|
4266
4571
|
{
|
|
4267
4572
|
ref,
|
|
@@ -4277,7 +4582,7 @@ var PopoverContent2 = React13.forwardRef(({ className, align = "center", sideOff
|
|
|
4277
4582
|
PopoverContent2.displayName = PopoverPrimitive2.Content.displayName;
|
|
4278
4583
|
|
|
4279
4584
|
// src/components/molecules/forms/combobox.tsx
|
|
4280
|
-
import { jsx as
|
|
4585
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4281
4586
|
function Combobox({
|
|
4282
4587
|
options,
|
|
4283
4588
|
placeholder = "",
|
|
@@ -4288,132 +4593,367 @@ function Combobox({
|
|
|
4288
4593
|
modal = false,
|
|
4289
4594
|
popoverClassName,
|
|
4290
4595
|
buttonClassName,
|
|
4291
|
-
disabled = false
|
|
4596
|
+
disabled = false,
|
|
4597
|
+
footerAction,
|
|
4598
|
+
renderFooter
|
|
4292
4599
|
}) {
|
|
4293
|
-
const [open, setOpen] =
|
|
4294
|
-
return /* @__PURE__ */
|
|
4295
|
-
/* @__PURE__ */
|
|
4600
|
+
const [open, setOpen] = React16.useState(false);
|
|
4601
|
+
return /* @__PURE__ */ jsxs20(Popover2, { open, onOpenChange: setOpen, modal, children: [
|
|
4602
|
+
/* @__PURE__ */ jsx28(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs20(
|
|
4296
4603
|
Button,
|
|
4297
4604
|
{
|
|
4298
4605
|
variant: "outline",
|
|
4299
4606
|
role: "combobox",
|
|
4300
4607
|
"aria-expanded": open,
|
|
4301
|
-
className: cn(
|
|
4608
|
+
className: cn(
|
|
4609
|
+
"cnc-w-full cnc-justify-between cnc-truncate ",
|
|
4610
|
+
buttonClassName
|
|
4611
|
+
),
|
|
4302
4612
|
disabled,
|
|
4303
4613
|
children: [
|
|
4304
|
-
/* @__PURE__ */
|
|
4305
|
-
/* @__PURE__ */
|
|
4614
|
+
/* @__PURE__ */ jsx28("div", { children: value ? options?.find((framework) => framework.value === value)?.label : placeholder }),
|
|
4615
|
+
/* @__PURE__ */ jsx28(ChevronsUpDown, { className: "cnc-ml-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" })
|
|
4306
4616
|
]
|
|
4307
4617
|
}
|
|
4308
4618
|
) }),
|
|
4309
|
-
/* @__PURE__ */
|
|
4619
|
+
/* @__PURE__ */ jsxs20(
|
|
4310
4620
|
PopoverContent2,
|
|
4311
4621
|
{
|
|
4312
4622
|
align: "start",
|
|
4313
|
-
className: cn(
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
),
|
|
4322
|
-
/* @__PURE__ */ jsxs16(CommandList, { children: [
|
|
4323
|
-
/* @__PURE__ */ jsx22(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4324
|
-
/* @__PURE__ */ jsx22(CommandGroup, { children: options?.map((option) => /* @__PURE__ */ jsxs16(
|
|
4325
|
-
CommandItem,
|
|
4623
|
+
className: cn(
|
|
4624
|
+
"cnc-w-[--radix-popover-trigger-width] cnc-p-0",
|
|
4625
|
+
popoverClassName
|
|
4626
|
+
),
|
|
4627
|
+
children: [
|
|
4628
|
+
/* @__PURE__ */ jsxs20(Command, { children: [
|
|
4629
|
+
/* @__PURE__ */ jsx28(
|
|
4630
|
+
CommandInput,
|
|
4326
4631
|
{
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4632
|
+
placeholder: command?.placeholder,
|
|
4633
|
+
onInput: (e) => onInput && onInput(e.target?.value)
|
|
4634
|
+
}
|
|
4635
|
+
),
|
|
4636
|
+
/* @__PURE__ */ jsxs20(CommandList, { children: [
|
|
4637
|
+
/* @__PURE__ */ jsx28(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4638
|
+
/* @__PURE__ */ jsx28(CommandGroup, { children: options?.map((option) => /* @__PURE__ */ jsxs20(
|
|
4639
|
+
CommandItem,
|
|
4640
|
+
{
|
|
4641
|
+
value: option.value,
|
|
4642
|
+
onSelect: (currentValue) => {
|
|
4643
|
+
if (onChange)
|
|
4644
|
+
onChange(currentValue === value ? "" : currentValue);
|
|
4645
|
+
setOpen(false);
|
|
4646
|
+
},
|
|
4647
|
+
keywords: [option.value, option.label],
|
|
4648
|
+
disabled: option.disabled,
|
|
4649
|
+
children: [
|
|
4650
|
+
/* @__PURE__ */ jsx28(
|
|
4651
|
+
Check,
|
|
4652
|
+
{
|
|
4653
|
+
className: cn(
|
|
4654
|
+
"cnc-mr-2 cnc-h-4 cnc-w-4",
|
|
4655
|
+
value === option.value ? "cnc-opacity-100" : "cnc-opacity-0"
|
|
4656
|
+
)
|
|
4657
|
+
}
|
|
4658
|
+
),
|
|
4659
|
+
option.label
|
|
4660
|
+
]
|
|
4332
4661
|
},
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
},
|
|
4348
|
-
option.value
|
|
4349
|
-
)) })
|
|
4350
|
-
] })
|
|
4351
|
-
] })
|
|
4662
|
+
option.value
|
|
4663
|
+
)) })
|
|
4664
|
+
] })
|
|
4665
|
+
] }),
|
|
4666
|
+
/* @__PURE__ */ jsx28(
|
|
4667
|
+
ComboboxDropdownFooter,
|
|
4668
|
+
{
|
|
4669
|
+
footerAction,
|
|
4670
|
+
renderFooter,
|
|
4671
|
+
close: () => setOpen(false),
|
|
4672
|
+
hidden: disabled
|
|
4673
|
+
}
|
|
4674
|
+
)
|
|
4675
|
+
]
|
|
4352
4676
|
}
|
|
4353
4677
|
)
|
|
4354
4678
|
] });
|
|
4355
4679
|
}
|
|
4356
4680
|
|
|
4357
|
-
// src/components/
|
|
4358
|
-
import * as
|
|
4359
|
-
import {
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
if (!field.required) return void 0;
|
|
4381
|
-
return {
|
|
4382
|
-
required: field.errorMessage || "Campo obrigat\xF3rio",
|
|
4383
|
-
validate: (value) => {
|
|
4384
|
-
if (field.type === "switch") return true;
|
|
4385
|
-
if (value === "" || value === null || value === void 0) {
|
|
4386
|
-
return field.errorMessage || "Campo obrigat\xF3rio";
|
|
4387
|
-
}
|
|
4388
|
-
return true;
|
|
4681
|
+
// src/components/molecules/forms/multi-select.tsx
|
|
4682
|
+
import * as React17 from "react";
|
|
4683
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4684
|
+
function MultiSelect({
|
|
4685
|
+
options,
|
|
4686
|
+
value = [],
|
|
4687
|
+
onChange,
|
|
4688
|
+
placeholder = "Selecione...",
|
|
4689
|
+
disabled = false,
|
|
4690
|
+
modal = false,
|
|
4691
|
+
className,
|
|
4692
|
+
buttonClassName,
|
|
4693
|
+
popoverClassName,
|
|
4694
|
+
command,
|
|
4695
|
+
selectedCountText = (count) => `${count} selecionados`,
|
|
4696
|
+
footerAction,
|
|
4697
|
+
renderFooter
|
|
4698
|
+
}) {
|
|
4699
|
+
const [open, setOpen] = React17.useState(false);
|
|
4700
|
+
const buttonText = (() => {
|
|
4701
|
+
if (value.length === 0) return placeholder;
|
|
4702
|
+
if (value.length === 1) {
|
|
4703
|
+
return options?.find((option) => option.value === value[0])?.label ?? selectedCountText(1);
|
|
4389
4704
|
}
|
|
4705
|
+
return selectedCountText(value.length);
|
|
4706
|
+
})();
|
|
4707
|
+
const toggleOption = (optionValue) => {
|
|
4708
|
+
if (!onChange) return;
|
|
4709
|
+
onChange(
|
|
4710
|
+
value.includes(optionValue) ? value.filter((item) => item !== optionValue) : [...value, optionValue]
|
|
4711
|
+
);
|
|
4390
4712
|
};
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
"
|
|
4407
|
-
{
|
|
4408
|
-
|
|
4713
|
+
return /* @__PURE__ */ jsxs21(Popover2, { open, onOpenChange: setOpen, modal, children: [
|
|
4714
|
+
/* @__PURE__ */ jsx29(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs21(
|
|
4715
|
+
Button,
|
|
4716
|
+
{
|
|
4717
|
+
type: "button",
|
|
4718
|
+
variant: "outline",
|
|
4719
|
+
role: "combobox",
|
|
4720
|
+
"aria-expanded": open,
|
|
4721
|
+
disabled,
|
|
4722
|
+
className: cn(
|
|
4723
|
+
"cnc-w-full cnc-justify-between cnc-truncate",
|
|
4724
|
+
buttonClassName,
|
|
4725
|
+
className
|
|
4726
|
+
),
|
|
4727
|
+
children: [
|
|
4728
|
+
/* @__PURE__ */ jsx29("span", { className: "cnc-truncate", children: buttonText }),
|
|
4729
|
+
/* @__PURE__ */ jsx29(ChevronsUpDown, { className: "cnc-ml-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" })
|
|
4730
|
+
]
|
|
4731
|
+
}
|
|
4732
|
+
) }),
|
|
4733
|
+
/* @__PURE__ */ jsxs21(
|
|
4734
|
+
PopoverContent2,
|
|
4735
|
+
{
|
|
4736
|
+
align: "start",
|
|
4737
|
+
className: cn(
|
|
4738
|
+
"cnc-w-[--radix-popover-trigger-width] cnc-p-0",
|
|
4739
|
+
popoverClassName
|
|
4740
|
+
),
|
|
4741
|
+
children: [
|
|
4742
|
+
/* @__PURE__ */ jsxs21(Command, { children: [
|
|
4743
|
+
/* @__PURE__ */ jsx29(CommandInput, { placeholder: command?.placeholder }),
|
|
4744
|
+
/* @__PURE__ */ jsxs21(CommandList, { children: [
|
|
4745
|
+
/* @__PURE__ */ jsx29(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4746
|
+
/* @__PURE__ */ jsx29(CommandGroup, { children: options?.map((option) => {
|
|
4747
|
+
const isSelected = value.includes(option.value);
|
|
4748
|
+
return /* @__PURE__ */ jsxs21(
|
|
4749
|
+
CommandItem,
|
|
4750
|
+
{
|
|
4751
|
+
value: option.value,
|
|
4752
|
+
onSelect: () => toggleOption(option.value),
|
|
4753
|
+
keywords: [option.value, option.label],
|
|
4754
|
+
disabled: option.disabled,
|
|
4755
|
+
children: [
|
|
4756
|
+
/* @__PURE__ */ jsx29(
|
|
4757
|
+
Check,
|
|
4758
|
+
{
|
|
4759
|
+
className: cn(
|
|
4760
|
+
"cnc-mr-2 cnc-h-4 cnc-w-4",
|
|
4761
|
+
isSelected ? "cnc-opacity-100" : "cnc-opacity-0"
|
|
4762
|
+
)
|
|
4763
|
+
}
|
|
4764
|
+
),
|
|
4765
|
+
option.label
|
|
4766
|
+
]
|
|
4767
|
+
},
|
|
4768
|
+
option.value
|
|
4769
|
+
);
|
|
4770
|
+
}) })
|
|
4771
|
+
] })
|
|
4772
|
+
] }),
|
|
4773
|
+
/* @__PURE__ */ jsx29(
|
|
4774
|
+
ComboboxDropdownFooter,
|
|
4775
|
+
{
|
|
4776
|
+
footerAction,
|
|
4777
|
+
renderFooter,
|
|
4778
|
+
close: () => setOpen(false),
|
|
4779
|
+
hidden: disabled
|
|
4780
|
+
}
|
|
4781
|
+
)
|
|
4782
|
+
]
|
|
4783
|
+
}
|
|
4784
|
+
)
|
|
4785
|
+
] });
|
|
4786
|
+
}
|
|
4787
|
+
|
|
4788
|
+
// src/components/molecules/overlay/confirm-dialog.tsx
|
|
4789
|
+
import * as React18 from "react";
|
|
4790
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4791
|
+
function ConfirmDialog({
|
|
4792
|
+
open,
|
|
4793
|
+
onOpenChange,
|
|
4794
|
+
title,
|
|
4795
|
+
description,
|
|
4796
|
+
confirmLabel = "Confirmar",
|
|
4797
|
+
cancelLabel = "Cancelar",
|
|
4798
|
+
loadingLabel = "Aguarde...",
|
|
4799
|
+
onConfirm,
|
|
4800
|
+
icon,
|
|
4801
|
+
showIconBackground = true,
|
|
4802
|
+
footerAlign = "center",
|
|
4803
|
+
confirmVariant = "danger",
|
|
4804
|
+
children,
|
|
4805
|
+
isLoading,
|
|
4806
|
+
className
|
|
4807
|
+
}) {
|
|
4808
|
+
const [localLoading, setLocalLoading] = React18.useState(false);
|
|
4809
|
+
const isBusy = isLoading ?? localLoading;
|
|
4810
|
+
const handleConfirm = async () => {
|
|
4811
|
+
if (isLoading !== void 0) {
|
|
4812
|
+
await onConfirm?.();
|
|
4813
|
+
return;
|
|
4814
|
+
}
|
|
4815
|
+
setLocalLoading(true);
|
|
4816
|
+
try {
|
|
4817
|
+
await onConfirm?.();
|
|
4818
|
+
} finally {
|
|
4819
|
+
setLocalLoading(false);
|
|
4820
|
+
}
|
|
4821
|
+
};
|
|
4822
|
+
return /* @__PURE__ */ jsx30(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs22(DialogContent, { className: cn("cnc-max-w-md cnc-text-center", className), children: [
|
|
4823
|
+
/* @__PURE__ */ jsxs22(DialogHeader, { children: [
|
|
4824
|
+
/* @__PURE__ */ jsx30(
|
|
4825
|
+
"div",
|
|
4826
|
+
{
|
|
4827
|
+
className: cn(
|
|
4828
|
+
"cnc-mx-auto cnc-mb-2 cnc-flex cnc-items-center cnc-justify-center",
|
|
4829
|
+
showIconBackground && "cnc-size-16 cnc-rounded-full cnc-bg-red-100",
|
|
4830
|
+
showIconBackground && confirmVariant === "confirm" && "cnc-bg-brand-green-100/20"
|
|
4831
|
+
),
|
|
4832
|
+
children: icon ?? /* @__PURE__ */ jsx30(Trash2, { className: cn("cnc-size-8 cnc-text-red-600", confirmVariant === "confirm" && "cnc-text-brand-green-300") })
|
|
4833
|
+
}
|
|
4834
|
+
),
|
|
4835
|
+
/* @__PURE__ */ jsx30(DialogTitle, { className: "cnc-text-center", children: title }),
|
|
4836
|
+
description && /* @__PURE__ */ jsx30(DialogDescription, { className: "cnc-text-center", children: description })
|
|
4837
|
+
] }),
|
|
4838
|
+
children,
|
|
4839
|
+
/* @__PURE__ */ jsxs22(
|
|
4840
|
+
DialogFooter,
|
|
4841
|
+
{
|
|
4842
|
+
className: cn(
|
|
4843
|
+
"cnc-flex cnc-gap-2",
|
|
4844
|
+
footerAlign === "end" ? "cnc-justify-end sm:cnc-justify-end" : "cnc-justify-center sm:cnc-justify-center"
|
|
4845
|
+
),
|
|
4846
|
+
children: [
|
|
4847
|
+
/* @__PURE__ */ jsx30(
|
|
4848
|
+
Button,
|
|
4849
|
+
{
|
|
4850
|
+
type: "button",
|
|
4851
|
+
variant: "outline",
|
|
4852
|
+
onClick: () => onOpenChange(false),
|
|
4853
|
+
disabled: isBusy,
|
|
4854
|
+
children: cancelLabel
|
|
4855
|
+
}
|
|
4856
|
+
),
|
|
4857
|
+
/* @__PURE__ */ jsx30(
|
|
4858
|
+
Button,
|
|
4859
|
+
{
|
|
4860
|
+
type: "button",
|
|
4861
|
+
variant: confirmVariant,
|
|
4862
|
+
isLoading: isBusy,
|
|
4863
|
+
onClick: handleConfirm,
|
|
4864
|
+
children: isBusy ? loadingLabel : confirmLabel
|
|
4865
|
+
}
|
|
4866
|
+
)
|
|
4867
|
+
]
|
|
4868
|
+
}
|
|
4869
|
+
)
|
|
4870
|
+
] }) });
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
// src/components/molecules/overlay/tooltip.tsx
|
|
4874
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4875
|
+
function Tooltip({
|
|
4876
|
+
text,
|
|
4877
|
+
children,
|
|
4878
|
+
className,
|
|
4879
|
+
contentClassName
|
|
4880
|
+
}) {
|
|
4881
|
+
return /* @__PURE__ */ jsxs23("div", { className: cn("cnc-relative cnc-inline-flex cnc-group", className), children: [
|
|
4882
|
+
/* @__PURE__ */ jsx31(
|
|
4883
|
+
"div",
|
|
4884
|
+
{
|
|
4885
|
+
role: "tooltip",
|
|
4886
|
+
className: cn(
|
|
4887
|
+
"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",
|
|
4888
|
+
contentClassName
|
|
4889
|
+
),
|
|
4890
|
+
children: text
|
|
4891
|
+
}
|
|
4892
|
+
),
|
|
4893
|
+
/* @__PURE__ */ jsx31("span", { className: "cnc-cursor-pointer", children })
|
|
4894
|
+
] });
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
// src/components/organisms/filter/index.tsx
|
|
4898
|
+
import * as React19 from "react";
|
|
4899
|
+
import {
|
|
4900
|
+
Controller,
|
|
4901
|
+
useForm,
|
|
4902
|
+
useWatch
|
|
4903
|
+
} from "react-hook-form";
|
|
4904
|
+
import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4905
|
+
var INPUT_BASE_CLASSES = [
|
|
4906
|
+
"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",
|
|
4907
|
+
"placeholder:cnc-text-muted-foreground focus-visible:cnc-outline-none",
|
|
4908
|
+
"focus-visible:cnc-ring-2 focus-visible:cnc-ring-brand-gray-500/50 md:cnc-text-sm",
|
|
4909
|
+
"not-disabled:hover:cnc-border-brand-gray-500",
|
|
4910
|
+
"disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50"
|
|
4911
|
+
].join(" ");
|
|
4912
|
+
function buildDefaultValues(fields) {
|
|
4913
|
+
const defaults = {};
|
|
4914
|
+
for (const field of fields) {
|
|
4915
|
+
defaults[field.name] = field.defaultValue ?? (field.type === "switch" ? false : "");
|
|
4916
|
+
}
|
|
4917
|
+
return defaults;
|
|
4918
|
+
}
|
|
4919
|
+
function buildValidationRules(field) {
|
|
4920
|
+
if (!field.required) return void 0;
|
|
4921
|
+
return {
|
|
4922
|
+
required: field.errorMessage || "Campo obrigat\xF3rio",
|
|
4923
|
+
validate: (value) => {
|
|
4924
|
+
if (field.type === "switch") return true;
|
|
4925
|
+
if (value === "" || value === null || value === void 0) {
|
|
4926
|
+
return field.errorMessage || "Campo obrigat\xF3rio";
|
|
4927
|
+
}
|
|
4928
|
+
return true;
|
|
4929
|
+
}
|
|
4930
|
+
};
|
|
4931
|
+
}
|
|
4932
|
+
var FilterFieldItem = React19.memo(function FilterFieldItem2({
|
|
4933
|
+
field,
|
|
4934
|
+
register,
|
|
4935
|
+
control,
|
|
4936
|
+
error
|
|
4937
|
+
}) {
|
|
4938
|
+
const fieldId = field.id || `filter-field-${field.name}`;
|
|
4939
|
+
return /* @__PURE__ */ jsxs24(
|
|
4940
|
+
"div",
|
|
4941
|
+
{
|
|
4942
|
+
className: "cnc-filter-field cnc-px-2 cnc-mb-3",
|
|
4943
|
+
style: { "--cnc-filter-field-w": field.width || "25%" },
|
|
4944
|
+
children: [
|
|
4945
|
+
field.label && /* @__PURE__ */ jsxs24(
|
|
4946
|
+
"label",
|
|
4947
|
+
{
|
|
4948
|
+
htmlFor: fieldId,
|
|
4409
4949
|
className: "cnc-block cnc-text-sm cnc-mb-1 cnc-font-medium cnc-text-brand-gray-600",
|
|
4410
4950
|
children: [
|
|
4411
4951
|
field.label,
|
|
4412
|
-
field.required && /* @__PURE__ */
|
|
4952
|
+
field.required && /* @__PURE__ */ jsx32("span", { className: "cnc-text-red-500", children: " *" })
|
|
4413
4953
|
]
|
|
4414
4954
|
}
|
|
4415
4955
|
),
|
|
4416
|
-
(field.type === "text" || field.type === "date") && /* @__PURE__ */
|
|
4956
|
+
(field.type === "text" || field.type === "date") && /* @__PURE__ */ jsx32(
|
|
4417
4957
|
"input",
|
|
4418
4958
|
{
|
|
4419
4959
|
id: fieldId,
|
|
@@ -4427,13 +4967,13 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4427
4967
|
)
|
|
4428
4968
|
}
|
|
4429
4969
|
),
|
|
4430
|
-
field.type === "combobox" && /* @__PURE__ */
|
|
4970
|
+
field.type === "combobox" && /* @__PURE__ */ jsx32(
|
|
4431
4971
|
Controller,
|
|
4432
4972
|
{
|
|
4433
4973
|
name: field.name,
|
|
4434
4974
|
control,
|
|
4435
4975
|
rules: buildValidationRules(field),
|
|
4436
|
-
render: ({ field: rhfField }) => /* @__PURE__ */
|
|
4976
|
+
render: ({ field: rhfField }) => /* @__PURE__ */ jsx32(
|
|
4437
4977
|
Combobox,
|
|
4438
4978
|
{
|
|
4439
4979
|
value: rhfField.value || "",
|
|
@@ -4447,13 +4987,13 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4447
4987
|
)
|
|
4448
4988
|
}
|
|
4449
4989
|
),
|
|
4450
|
-
field.type === "switch" && /* @__PURE__ */
|
|
4990
|
+
field.type === "switch" && /* @__PURE__ */ jsx32(
|
|
4451
4991
|
Controller,
|
|
4452
4992
|
{
|
|
4453
4993
|
name: field.name,
|
|
4454
4994
|
control,
|
|
4455
4995
|
rules: buildValidationRules(field),
|
|
4456
|
-
render: ({ field: rhfField }) => /* @__PURE__ */
|
|
4996
|
+
render: ({ field: rhfField }) => /* @__PURE__ */ jsx32(
|
|
4457
4997
|
Switch,
|
|
4458
4998
|
{
|
|
4459
4999
|
checked: !!rhfField.value,
|
|
@@ -4464,14 +5004,14 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4464
5004
|
)
|
|
4465
5005
|
}
|
|
4466
5006
|
),
|
|
4467
|
-
error && /* @__PURE__ */
|
|
5007
|
+
error && /* @__PURE__ */ jsx32("span", { className: "cnc-block cnc-text-xs cnc-text-red-500 cnc-mt-1", children: error.message })
|
|
4468
5008
|
]
|
|
4469
5009
|
}
|
|
4470
5010
|
);
|
|
4471
5011
|
});
|
|
4472
5012
|
function CleanButton({ control, onClean }) {
|
|
4473
5013
|
const values = useWatch({ control });
|
|
4474
|
-
const hasActiveFilters =
|
|
5014
|
+
const hasActiveFilters = React19.useMemo(() => {
|
|
4475
5015
|
const keys = Object.keys(values);
|
|
4476
5016
|
return keys.some((key) => {
|
|
4477
5017
|
const val = values[key];
|
|
@@ -4480,7 +5020,7 @@ function CleanButton({ control, onClean }) {
|
|
|
4480
5020
|
return val !== null && val !== void 0 && val !== "";
|
|
4481
5021
|
});
|
|
4482
5022
|
}, [values]);
|
|
4483
|
-
return /* @__PURE__ */
|
|
5023
|
+
return /* @__PURE__ */ jsxs24(
|
|
4484
5024
|
Button,
|
|
4485
5025
|
{
|
|
4486
5026
|
type: "button",
|
|
@@ -4489,13 +5029,13 @@ function CleanButton({ control, onClean }) {
|
|
|
4489
5029
|
disabled: !hasActiveFilters,
|
|
4490
5030
|
className: "cnc-shrink-0 cnc-gap-2",
|
|
4491
5031
|
children: [
|
|
4492
|
-
/* @__PURE__ */
|
|
5032
|
+
/* @__PURE__ */ jsx32(FilterX, { className: "cnc-h-4 cnc-w-4" }),
|
|
4493
5033
|
"Limpar"
|
|
4494
5034
|
]
|
|
4495
5035
|
}
|
|
4496
5036
|
);
|
|
4497
5037
|
}
|
|
4498
|
-
var Filter =
|
|
5038
|
+
var Filter = React19.forwardRef(
|
|
4499
5039
|
function Filter2({
|
|
4500
5040
|
fields,
|
|
4501
5041
|
collapsibleFields,
|
|
@@ -4505,12 +5045,12 @@ var Filter = React15.forwardRef(
|
|
|
4505
5045
|
isLoading = false,
|
|
4506
5046
|
className
|
|
4507
5047
|
}, ref) {
|
|
4508
|
-
const [isCollapsibleOpen, setIsCollapsibleOpen] =
|
|
4509
|
-
const allFields =
|
|
5048
|
+
const [isCollapsibleOpen, setIsCollapsibleOpen] = React19.useState(false);
|
|
5049
|
+
const allFields = React19.useMemo(
|
|
4510
5050
|
() => [...fields, ...collapsibleFields || []],
|
|
4511
5051
|
[fields, collapsibleFields]
|
|
4512
5052
|
);
|
|
4513
|
-
const defaultValues =
|
|
5053
|
+
const defaultValues = React19.useMemo(
|
|
4514
5054
|
() => buildDefaultValues(allFields),
|
|
4515
5055
|
[allFields]
|
|
4516
5056
|
);
|
|
@@ -4521,7 +5061,7 @@ var Filter = React15.forwardRef(
|
|
|
4521
5061
|
reset,
|
|
4522
5062
|
formState: { errors }
|
|
4523
5063
|
} = useForm({ defaultValues });
|
|
4524
|
-
|
|
5064
|
+
React19.useEffect(() => {
|
|
4525
5065
|
if (collapsibleFields?.some((f) => errors[f.name])) {
|
|
4526
5066
|
setIsCollapsibleOpen(true);
|
|
4527
5067
|
}
|
|
@@ -4529,7 +5069,7 @@ var Filter = React15.forwardRef(
|
|
|
4529
5069
|
const onSubmit = (data) => {
|
|
4530
5070
|
onSearch(data);
|
|
4531
5071
|
};
|
|
4532
|
-
const handleClean =
|
|
5072
|
+
const handleClean = React19.useCallback(() => {
|
|
4533
5073
|
const emptyValues = {};
|
|
4534
5074
|
for (const field of allFields) {
|
|
4535
5075
|
emptyValues[field.name] = field.type === "switch" ? false : "";
|
|
@@ -4537,12 +5077,12 @@ var Filter = React15.forwardRef(
|
|
|
4537
5077
|
reset(emptyValues);
|
|
4538
5078
|
onClean?.();
|
|
4539
5079
|
}, [allFields, reset, onClean]);
|
|
4540
|
-
return /* @__PURE__ */
|
|
5080
|
+
return /* @__PURE__ */ jsx32(
|
|
4541
5081
|
Collapsible,
|
|
4542
5082
|
{
|
|
4543
5083
|
open: isCollapsibleOpen,
|
|
4544
5084
|
onOpenChange: setIsCollapsibleOpen,
|
|
4545
|
-
children: /* @__PURE__ */
|
|
5085
|
+
children: /* @__PURE__ */ jsxs24(
|
|
4546
5086
|
"form",
|
|
4547
5087
|
{
|
|
4548
5088
|
ref,
|
|
@@ -4553,8 +5093,8 @@ var Filter = React15.forwardRef(
|
|
|
4553
5093
|
),
|
|
4554
5094
|
style: { backgroundColor: "#F8FAFC" },
|
|
4555
5095
|
children: [
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
fields.map((field) => /* @__PURE__ */
|
|
5096
|
+
/* @__PURE__ */ jsxs24("div", { className: "cnc-flex cnc-flex-wrap cnc-items-end", children: [
|
|
5097
|
+
fields.map((field) => /* @__PURE__ */ jsx32(
|
|
4558
5098
|
FilterFieldItem,
|
|
4559
5099
|
{
|
|
4560
5100
|
field,
|
|
@@ -4564,18 +5104,18 @@ var Filter = React15.forwardRef(
|
|
|
4564
5104
|
},
|
|
4565
5105
|
field.name
|
|
4566
5106
|
)),
|
|
4567
|
-
/* @__PURE__ */
|
|
4568
|
-
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */
|
|
5107
|
+
/* @__PURE__ */ jsxs24("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: [
|
|
5108
|
+
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ jsx32(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx32(
|
|
4569
5109
|
Button,
|
|
4570
5110
|
{
|
|
4571
5111
|
type: "button",
|
|
4572
5112
|
variant: "outline",
|
|
4573
5113
|
size: "icon",
|
|
4574
5114
|
className: "cnc-shrink-0",
|
|
4575
|
-
children: /* @__PURE__ */
|
|
5115
|
+
children: /* @__PURE__ */ jsx32(ListFilter, { className: "cnc-h-4 cnc-w-4" })
|
|
4576
5116
|
}
|
|
4577
5117
|
) }),
|
|
4578
|
-
/* @__PURE__ */
|
|
5118
|
+
/* @__PURE__ */ jsxs24(
|
|
4579
5119
|
Button,
|
|
4580
5120
|
{
|
|
4581
5121
|
type: "submit",
|
|
@@ -4583,15 +5123,15 @@ var Filter = React15.forwardRef(
|
|
|
4583
5123
|
isLoading,
|
|
4584
5124
|
className: "cnc-shrink-0 cnc-gap-2",
|
|
4585
5125
|
children: [
|
|
4586
|
-
/* @__PURE__ */
|
|
5126
|
+
/* @__PURE__ */ jsx32(Search, { className: "cnc-h-4 cnc-w-4" }),
|
|
4587
5127
|
"Pesquisar"
|
|
4588
5128
|
]
|
|
4589
5129
|
}
|
|
4590
5130
|
),
|
|
4591
|
-
!hideCleanFilterButton && /* @__PURE__ */
|
|
5131
|
+
!hideCleanFilterButton && /* @__PURE__ */ jsx32(CleanButton, { control, onClean: handleClean })
|
|
4592
5132
|
] })
|
|
4593
5133
|
] }),
|
|
4594
|
-
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */
|
|
5134
|
+
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ jsx32(AnimatedCollapsibleContent, { children: /* @__PURE__ */ jsx32("div", { className: "cnc-flex cnc-flex-wrap cnc-items-end cnc-pt-2", children: collapsibleFields.map((field) => /* @__PURE__ */ jsx32(
|
|
4595
5135
|
FilterFieldItem,
|
|
4596
5136
|
{
|
|
4597
5137
|
field,
|
|
@@ -4609,74 +5149,947 @@ var Filter = React15.forwardRef(
|
|
|
4609
5149
|
}
|
|
4610
5150
|
);
|
|
4611
5151
|
|
|
4612
|
-
// src/components/organisms/card-list/index.tsx
|
|
4613
|
-
import * as
|
|
4614
|
-
import { jsx as
|
|
4615
|
-
function CardList({
|
|
4616
|
-
items,
|
|
4617
|
-
renderCard,
|
|
4618
|
-
emptyMessage = "Nenhum item",
|
|
4619
|
-
minItemWidth = "260px",
|
|
4620
|
-
className,
|
|
4621
|
-
gap = "cnc-gap-4",
|
|
4622
|
-
getKey,
|
|
4623
|
-
isLoading = false,
|
|
4624
|
-
skeletonCount = 6
|
|
5152
|
+
// src/components/organisms/card-list/index.tsx
|
|
5153
|
+
import * as React20 from "react";
|
|
5154
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
5155
|
+
function CardList({
|
|
5156
|
+
items,
|
|
5157
|
+
renderCard,
|
|
5158
|
+
emptyMessage = "Nenhum item",
|
|
5159
|
+
minItemWidth = "260px",
|
|
5160
|
+
className,
|
|
5161
|
+
gap = "cnc-gap-4",
|
|
5162
|
+
getKey,
|
|
5163
|
+
isLoading = false,
|
|
5164
|
+
skeletonCount = 6
|
|
5165
|
+
}) {
|
|
5166
|
+
const gridStyle = {
|
|
5167
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(min(100%, ${minItemWidth}), 1fr))`
|
|
5168
|
+
};
|
|
5169
|
+
if (isLoading) {
|
|
5170
|
+
return /* @__PURE__ */ jsx33(
|
|
5171
|
+
"div",
|
|
5172
|
+
{
|
|
5173
|
+
className: cn("cnc-grid cnc-w-full", gap, className),
|
|
5174
|
+
style: gridStyle,
|
|
5175
|
+
"aria-busy": "true",
|
|
5176
|
+
children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsxs25(
|
|
5177
|
+
"div",
|
|
5178
|
+
{
|
|
5179
|
+
className: "cnc-animate-pulse cnc-rounded-md cnc-border-2 cnc-border-brand-gray-50 cnc-bg-white cnc-shadow cnc-p-6",
|
|
5180
|
+
children: [
|
|
5181
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-4 cnc-w-1/2 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-4" }),
|
|
5182
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-3 cnc-w-3/4 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-2" }),
|
|
5183
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-3 cnc-w-2/3 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-6" }),
|
|
5184
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-8 cnc-w-full cnc-bg-brand-gray-100 cnc-rounded" })
|
|
5185
|
+
]
|
|
5186
|
+
},
|
|
5187
|
+
i
|
|
5188
|
+
))
|
|
5189
|
+
}
|
|
5190
|
+
);
|
|
5191
|
+
}
|
|
5192
|
+
if (!items || items.length === 0) {
|
|
5193
|
+
return /* @__PURE__ */ jsxs25(
|
|
5194
|
+
"div",
|
|
5195
|
+
{
|
|
5196
|
+
className: cn(
|
|
5197
|
+
"cnc-w-full cnc-flex cnc-flex-col cnc-items-center cnc-justify-center cnc-rounded-md cnc-py-16 cnc-px-4",
|
|
5198
|
+
className
|
|
5199
|
+
),
|
|
5200
|
+
style: { backgroundColor: "#F8FAFC", color: "#64748B" },
|
|
5201
|
+
children: [
|
|
5202
|
+
/* @__PURE__ */ jsx33(FolderOpen, { className: "cnc-h-8 cnc-w-8 cnc-mb-2" }),
|
|
5203
|
+
/* @__PURE__ */ jsx33("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
5204
|
+
]
|
|
5205
|
+
}
|
|
5206
|
+
);
|
|
5207
|
+
}
|
|
5208
|
+
return /* @__PURE__ */ jsx33(
|
|
5209
|
+
"div",
|
|
5210
|
+
{
|
|
5211
|
+
className: cn("cnc-grid cnc-w-full", gap, className),
|
|
5212
|
+
style: gridStyle,
|
|
5213
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx33(React20.Fragment, { children: renderCard(item, index) }, getKey ? getKey(item, index) : index))
|
|
5214
|
+
}
|
|
5215
|
+
);
|
|
5216
|
+
}
|
|
5217
|
+
|
|
5218
|
+
// src/components/organisms/drawer/drawer.tsx
|
|
5219
|
+
import * as DialogPrimitive2 from "@radix-ui/react-dialog";
|
|
5220
|
+
import * as React21 from "react";
|
|
5221
|
+
import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5222
|
+
var Drawer = DialogPrimitive2.Root;
|
|
5223
|
+
var DrawerTrigger = DialogPrimitive2.Trigger;
|
|
5224
|
+
var DrawerPortal = DialogPrimitive2.Portal;
|
|
5225
|
+
var DrawerClose = DialogPrimitive2.Close;
|
|
5226
|
+
var DrawerOverlay = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5227
|
+
DialogPrimitive2.Overlay,
|
|
5228
|
+
{
|
|
5229
|
+
ref,
|
|
5230
|
+
className: cn(
|
|
5231
|
+
"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",
|
|
5232
|
+
className
|
|
5233
|
+
),
|
|
5234
|
+
...props
|
|
5235
|
+
}
|
|
5236
|
+
));
|
|
5237
|
+
DrawerOverlay.displayName = DialogPrimitive2.Overlay.displayName;
|
|
5238
|
+
var drawerSizeToWidth = {
|
|
5239
|
+
sm: "24rem",
|
|
5240
|
+
md: "32rem",
|
|
5241
|
+
lg: "40rem",
|
|
5242
|
+
xl: "48rem",
|
|
5243
|
+
full: "100vw"
|
|
5244
|
+
};
|
|
5245
|
+
var DrawerContent = React21.forwardRef(
|
|
5246
|
+
({
|
|
5247
|
+
className,
|
|
5248
|
+
children,
|
|
5249
|
+
side = "right",
|
|
5250
|
+
size = "md",
|
|
5251
|
+
width,
|
|
5252
|
+
closeButton = true,
|
|
5253
|
+
style,
|
|
5254
|
+
...props
|
|
5255
|
+
}, ref) => {
|
|
5256
|
+
const resolvedWidth = width ?? drawerSizeToWidth[size];
|
|
5257
|
+
return /* @__PURE__ */ jsxs26(DrawerPortal, { children: [
|
|
5258
|
+
/* @__PURE__ */ jsx34(DrawerOverlay, {}),
|
|
5259
|
+
/* @__PURE__ */ jsxs26(
|
|
5260
|
+
DialogPrimitive2.Content,
|
|
5261
|
+
{
|
|
5262
|
+
ref,
|
|
5263
|
+
style: { "--drawer-width": resolvedWidth, ...style },
|
|
5264
|
+
className: cn(
|
|
5265
|
+
"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",
|
|
5266
|
+
"sm:cnc-w-[--drawer-width] sm:cnc-max-w-full",
|
|
5267
|
+
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",
|
|
5268
|
+
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",
|
|
5269
|
+
className
|
|
5270
|
+
),
|
|
5271
|
+
...props,
|
|
5272
|
+
children: [
|
|
5273
|
+
children,
|
|
5274
|
+
closeButton && /* @__PURE__ */ jsxs26(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: [
|
|
5275
|
+
/* @__PURE__ */ jsx34(X, { className: "cnc-h-4 cnc-w-4" }),
|
|
5276
|
+
/* @__PURE__ */ jsx34("span", { className: "cnc-sr-only", children: "Fechar" })
|
|
5277
|
+
] })
|
|
5278
|
+
]
|
|
5279
|
+
}
|
|
5280
|
+
)
|
|
5281
|
+
] });
|
|
5282
|
+
}
|
|
5283
|
+
);
|
|
5284
|
+
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
5285
|
+
var DrawerHeader = ({
|
|
5286
|
+
className,
|
|
5287
|
+
...props
|
|
5288
|
+
}) => /* @__PURE__ */ jsx34(
|
|
5289
|
+
"div",
|
|
5290
|
+
{
|
|
5291
|
+
className: cn(
|
|
5292
|
+
"cnc-flex cnc-flex-col cnc-space-y-1.5 cnc-border-b cnc-p-6",
|
|
5293
|
+
className
|
|
5294
|
+
),
|
|
5295
|
+
...props
|
|
5296
|
+
}
|
|
5297
|
+
);
|
|
5298
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
5299
|
+
var DrawerBody = ({
|
|
5300
|
+
className,
|
|
5301
|
+
...props
|
|
5302
|
+
}) => /* @__PURE__ */ jsx34("div", { className: cn("cnc-flex-1 cnc-overflow-y-auto cnc-p-6", className), ...props });
|
|
5303
|
+
DrawerBody.displayName = "DrawerBody";
|
|
5304
|
+
var DrawerFooter = ({
|
|
5305
|
+
className,
|
|
5306
|
+
...props
|
|
5307
|
+
}) => /* @__PURE__ */ jsx34("div", { className: cn("cnc-border-t cnc-p-6", className), ...props });
|
|
5308
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
5309
|
+
var DrawerTitle = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5310
|
+
DialogPrimitive2.Title,
|
|
5311
|
+
{
|
|
5312
|
+
ref,
|
|
5313
|
+
className: cn(
|
|
5314
|
+
"cnc-text-lg cnc-font-semibold cnc-leading-none cnc-tracking-tight",
|
|
5315
|
+
className
|
|
5316
|
+
),
|
|
5317
|
+
...props
|
|
5318
|
+
}
|
|
5319
|
+
));
|
|
5320
|
+
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
5321
|
+
var DrawerDescription = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5322
|
+
DialogPrimitive2.Description,
|
|
5323
|
+
{
|
|
5324
|
+
ref,
|
|
5325
|
+
className: cn("cnc-text-sm cnc-text-muted-foreground", className),
|
|
5326
|
+
...props
|
|
5327
|
+
}
|
|
5328
|
+
));
|
|
5329
|
+
DrawerDescription.displayName = DialogPrimitive2.Description.displayName;
|
|
5330
|
+
|
|
5331
|
+
// src/components/organisms/drawer/drawer-context.tsx
|
|
5332
|
+
import * as React22 from "react";
|
|
5333
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5334
|
+
var DrawerContext = React22.createContext(
|
|
5335
|
+
void 0
|
|
5336
|
+
);
|
|
5337
|
+
function DrawerProvider({ children }) {
|
|
5338
|
+
const [activeDrawer, setActiveDrawer] = React22.useState(null);
|
|
5339
|
+
const openDrawer = React22.useCallback((drawerId) => {
|
|
5340
|
+
setActiveDrawer(drawerId);
|
|
5341
|
+
}, []);
|
|
5342
|
+
const closeDrawer = React22.useCallback(() => {
|
|
5343
|
+
setActiveDrawer(null);
|
|
5344
|
+
}, []);
|
|
5345
|
+
const isOpen = React22.useCallback(
|
|
5346
|
+
(drawerId) => activeDrawer === drawerId,
|
|
5347
|
+
[activeDrawer]
|
|
5348
|
+
);
|
|
5349
|
+
const value = React22.useMemo(
|
|
5350
|
+
() => ({ activeDrawer, openDrawer, closeDrawer, isOpen }),
|
|
5351
|
+
[activeDrawer, openDrawer, closeDrawer, isOpen]
|
|
5352
|
+
);
|
|
5353
|
+
return /* @__PURE__ */ jsx35(DrawerContext.Provider, { value, children });
|
|
5354
|
+
}
|
|
5355
|
+
|
|
5356
|
+
// src/components/organisms/drawer/use-drawer.ts
|
|
5357
|
+
import * as React23 from "react";
|
|
5358
|
+
function useDrawer() {
|
|
5359
|
+
const context = React23.useContext(DrawerContext);
|
|
5360
|
+
if (!context) {
|
|
5361
|
+
throw new Error("useDrawer deve ser usado dentro de um DrawerProvider");
|
|
5362
|
+
}
|
|
5363
|
+
return context;
|
|
5364
|
+
}
|
|
5365
|
+
|
|
5366
|
+
// src/components/organisms/upload/file-upload.tsx
|
|
5367
|
+
import * as React24 from "react";
|
|
5368
|
+
|
|
5369
|
+
// src/components/organisms/upload/utils.ts
|
|
5370
|
+
function formatSizeLimit(bytes) {
|
|
5371
|
+
if (bytes < 1024 * 1024) {
|
|
5372
|
+
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
5373
|
+
}
|
|
5374
|
+
return `${(bytes / (1024 * 1024)).toLocaleString("pt-BR", {
|
|
5375
|
+
maximumFractionDigits: 1,
|
|
5376
|
+
minimumFractionDigits: 0
|
|
5377
|
+
})} MB`;
|
|
5378
|
+
}
|
|
5379
|
+
function formatFileSize(bytes) {
|
|
5380
|
+
if (bytes < 1024 * 1024) {
|
|
5381
|
+
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
5382
|
+
}
|
|
5383
|
+
return `${(bytes / (1024 * 1024)).toLocaleString("pt-BR", {
|
|
5384
|
+
maximumFractionDigits: 1,
|
|
5385
|
+
minimumFractionDigits: 0
|
|
5386
|
+
})} MB`;
|
|
5387
|
+
}
|
|
5388
|
+
function isDuplicateFile(file, files) {
|
|
5389
|
+
return files.some(
|
|
5390
|
+
(currentFile) => currentFile.name === file.name && currentFile.size === file.size
|
|
5391
|
+
);
|
|
5392
|
+
}
|
|
5393
|
+
function validateFiles({
|
|
5394
|
+
currentFiles = [],
|
|
5395
|
+
incomingFiles,
|
|
5396
|
+
allowedTypes,
|
|
5397
|
+
maxSize,
|
|
5398
|
+
multiple = true
|
|
5399
|
+
}) {
|
|
5400
|
+
const acceptedFiles = [];
|
|
5401
|
+
const rejectedFiles = [];
|
|
5402
|
+
const baseFiles = multiple ? currentFiles : [];
|
|
5403
|
+
for (const file of incomingFiles) {
|
|
5404
|
+
if (allowedTypes?.length && !allowedTypes.includes(file.type)) {
|
|
5405
|
+
rejectedFiles.push({
|
|
5406
|
+
file,
|
|
5407
|
+
reason: "type",
|
|
5408
|
+
message: `Tipo n\xE3o permitido: ${file.name}`
|
|
5409
|
+
});
|
|
5410
|
+
continue;
|
|
5411
|
+
}
|
|
5412
|
+
if (maxSize !== void 0 && file.size > maxSize) {
|
|
5413
|
+
rejectedFiles.push({
|
|
5414
|
+
file,
|
|
5415
|
+
reason: "size",
|
|
5416
|
+
message: `Arquivo maior que ${formatSizeLimit(maxSize)}: ${file.name}`
|
|
5417
|
+
});
|
|
5418
|
+
continue;
|
|
5419
|
+
}
|
|
5420
|
+
if (isDuplicateFile(file, [...baseFiles, ...acceptedFiles])) {
|
|
5421
|
+
rejectedFiles.push({
|
|
5422
|
+
file,
|
|
5423
|
+
reason: "duplicate",
|
|
5424
|
+
message: `Arquivo j\xE1 adicionado: ${file.name}`
|
|
5425
|
+
});
|
|
5426
|
+
continue;
|
|
5427
|
+
}
|
|
5428
|
+
if (!multiple) {
|
|
5429
|
+
acceptedFiles.splice(0, acceptedFiles.length, file);
|
|
5430
|
+
continue;
|
|
5431
|
+
}
|
|
5432
|
+
acceptedFiles.push(file);
|
|
5433
|
+
}
|
|
5434
|
+
return { acceptedFiles, rejectedFiles };
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5437
|
+
// src/components/organisms/upload/file-list.tsx
|
|
5438
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5439
|
+
function FileList({
|
|
5440
|
+
items,
|
|
5441
|
+
onRemove,
|
|
5442
|
+
onDownload,
|
|
5443
|
+
disabled = false,
|
|
5444
|
+
variant = "bordered",
|
|
5445
|
+
emptyState,
|
|
5446
|
+
removeLabel = "Remover",
|
|
5447
|
+
className,
|
|
5448
|
+
...props
|
|
5449
|
+
}) {
|
|
5450
|
+
if (items.length === 0) {
|
|
5451
|
+
return emptyState ? /* @__PURE__ */ jsx36(Fragment6, { children: emptyState }) : null;
|
|
5452
|
+
}
|
|
5453
|
+
return /* @__PURE__ */ jsx36(
|
|
5454
|
+
"ul",
|
|
5455
|
+
{
|
|
5456
|
+
className: cn(
|
|
5457
|
+
"cnc-divide-y",
|
|
5458
|
+
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",
|
|
5459
|
+
className
|
|
5460
|
+
),
|
|
5461
|
+
...props,
|
|
5462
|
+
children: items.map((item, index) => {
|
|
5463
|
+
const canRemove = !!onRemove;
|
|
5464
|
+
const canDownload = !!onDownload;
|
|
5465
|
+
const isDisabled = disabled || item.disabled;
|
|
5466
|
+
const isPending = item.status === "pending";
|
|
5467
|
+
return /* @__PURE__ */ jsxs27(
|
|
5468
|
+
"li",
|
|
5469
|
+
{
|
|
5470
|
+
className: cn(
|
|
5471
|
+
"cnc-flex cnc-flex-col cnc-gap-2",
|
|
5472
|
+
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"
|
|
5473
|
+
),
|
|
5474
|
+
children: [
|
|
5475
|
+
/* @__PURE__ */ jsxs27("div", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-items-start cnc-gap-2", children: [
|
|
5476
|
+
/* @__PURE__ */ jsx36(FileText, { className: "cnc-mt-0.5 cnc-size-4 cnc-shrink-0 cnc-text-slate-500" }),
|
|
5477
|
+
/* @__PURE__ */ jsxs27("div", { className: "cnc-min-w-0", children: [
|
|
5478
|
+
canDownload ? /* @__PURE__ */ jsxs27(
|
|
5479
|
+
"button",
|
|
5480
|
+
{
|
|
5481
|
+
type: "button",
|
|
5482
|
+
onClick: () => onDownload(item, index),
|
|
5483
|
+
disabled: isDisabled,
|
|
5484
|
+
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",
|
|
5485
|
+
children: [
|
|
5486
|
+
/* @__PURE__ */ jsx36("span", { className: "cnc-min-w-0 cnc-truncate", children: item.name }),
|
|
5487
|
+
/* @__PURE__ */ jsx36(Download, { className: "cnc-size-3.5 cnc-shrink-0" })
|
|
5488
|
+
]
|
|
5489
|
+
}
|
|
5490
|
+
) : /* @__PURE__ */ jsx36("p", { className: "cnc-text-sm cnc-font-medium cnc-text-slate-800", children: /* @__PURE__ */ jsx36("span", { className: "cnc-break-all", children: item.name }) }),
|
|
5491
|
+
(item.meta || item.size !== void 0) && /* @__PURE__ */ jsxs27("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: [
|
|
5492
|
+
item.meta,
|
|
5493
|
+
item.meta && item.size !== void 0 ? /* @__PURE__ */ jsx36("span", { children: "\xB7" }) : null,
|
|
5494
|
+
item.size !== void 0 ? /* @__PURE__ */ jsx36("span", { children: formatFileSize(item.size) }) : null
|
|
5495
|
+
] }),
|
|
5496
|
+
item.description ? /* @__PURE__ */ jsx36("p", { className: "cnc-mt-1 cnc-line-clamp-2 cnc-text-xs cnc-text-slate-600", children: item.description }) : null
|
|
5497
|
+
] })
|
|
5498
|
+
] }),
|
|
5499
|
+
canRemove ? isPending ? /* @__PURE__ */ jsx36(
|
|
5500
|
+
"button",
|
|
5501
|
+
{
|
|
5502
|
+
type: "button",
|
|
5503
|
+
onClick: () => onRemove(item, index),
|
|
5504
|
+
disabled: isDisabled,
|
|
5505
|
+
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",
|
|
5506
|
+
"aria-label": `Remover ${item.name}`,
|
|
5507
|
+
children: /* @__PURE__ */ jsx36(X, { className: "cnc-size-4" })
|
|
5508
|
+
}
|
|
5509
|
+
) : /* @__PURE__ */ jsxs27(
|
|
5510
|
+
"button",
|
|
5511
|
+
{
|
|
5512
|
+
type: "button",
|
|
5513
|
+
onClick: () => onRemove(item, index),
|
|
5514
|
+
disabled: isDisabled,
|
|
5515
|
+
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",
|
|
5516
|
+
"aria-label": `Remover ${item.name}`,
|
|
5517
|
+
children: [
|
|
5518
|
+
/* @__PURE__ */ jsx36(Trash2, { className: "cnc-size-4" }),
|
|
5519
|
+
removeLabel
|
|
5520
|
+
]
|
|
5521
|
+
}
|
|
5522
|
+
) : null
|
|
5523
|
+
]
|
|
5524
|
+
},
|
|
5525
|
+
item.id
|
|
5526
|
+
);
|
|
5527
|
+
})
|
|
5528
|
+
}
|
|
5529
|
+
);
|
|
5530
|
+
}
|
|
5531
|
+
|
|
5532
|
+
// src/components/organisms/upload/file-upload.tsx
|
|
5533
|
+
import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5534
|
+
function fileToListItem(file, index) {
|
|
5535
|
+
return {
|
|
5536
|
+
id: `${file.name}-${file.size}-${file.lastModified}-${index}`,
|
|
5537
|
+
name: file.name,
|
|
5538
|
+
size: file.size,
|
|
5539
|
+
status: "pending"
|
|
5540
|
+
};
|
|
5541
|
+
}
|
|
5542
|
+
var FileUpload = React24.forwardRef(
|
|
5543
|
+
({
|
|
5544
|
+
value = [],
|
|
5545
|
+
onChange,
|
|
5546
|
+
multiple = true,
|
|
5547
|
+
accept,
|
|
5548
|
+
allowedTypes,
|
|
5549
|
+
maxSize,
|
|
5550
|
+
disabled = false,
|
|
5551
|
+
isLoading = false,
|
|
5552
|
+
buttonLabel = "Adicionar arquivos",
|
|
5553
|
+
hint,
|
|
5554
|
+
icon,
|
|
5555
|
+
onReject,
|
|
5556
|
+
showList = true,
|
|
5557
|
+
listTitle = (count) => `Arquivos selecionados (${count})`,
|
|
5558
|
+
className,
|
|
5559
|
+
buttonClassName,
|
|
5560
|
+
listClassName,
|
|
5561
|
+
...props
|
|
5562
|
+
}, ref) => {
|
|
5563
|
+
const fileInputRef = React24.useRef(null);
|
|
5564
|
+
const hintId = React24.useId();
|
|
5565
|
+
React24.useImperativeHandle(ref, () => fileInputRef.current, []);
|
|
5566
|
+
const isBusy = disabled || isLoading;
|
|
5567
|
+
const items = value.map(fileToListItem);
|
|
5568
|
+
const clearInput = () => {
|
|
5569
|
+
if (fileInputRef.current) {
|
|
5570
|
+
fileInputRef.current.value = "";
|
|
5571
|
+
}
|
|
5572
|
+
};
|
|
5573
|
+
const handleFileSelection = (event) => {
|
|
5574
|
+
const selectedFiles = Array.from(event.target.files ?? []);
|
|
5575
|
+
if (!selectedFiles.length) {
|
|
5576
|
+
clearInput();
|
|
5577
|
+
return;
|
|
5578
|
+
}
|
|
5579
|
+
const { acceptedFiles, rejectedFiles } = validateFiles({
|
|
5580
|
+
currentFiles: value,
|
|
5581
|
+
incomingFiles: selectedFiles,
|
|
5582
|
+
allowedTypes,
|
|
5583
|
+
maxSize,
|
|
5584
|
+
multiple
|
|
5585
|
+
});
|
|
5586
|
+
if (acceptedFiles.length > 0) {
|
|
5587
|
+
onChange?.(multiple ? [...value, ...acceptedFiles] : acceptedFiles.slice(0, 1));
|
|
5588
|
+
}
|
|
5589
|
+
if (rejectedFiles.length > 0) {
|
|
5590
|
+
onReject?.(rejectedFiles);
|
|
5591
|
+
}
|
|
5592
|
+
clearInput();
|
|
5593
|
+
};
|
|
5594
|
+
const handleRemove = (_item, index) => {
|
|
5595
|
+
onChange?.(value.filter((_, currentIndex) => currentIndex !== index));
|
|
5596
|
+
};
|
|
5597
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn("cnc-flex cnc-min-w-0 cnc-flex-col cnc-gap-3", className), ...props, children: [
|
|
5598
|
+
/* @__PURE__ */ jsx37(
|
|
5599
|
+
"input",
|
|
5600
|
+
{
|
|
5601
|
+
ref: fileInputRef,
|
|
5602
|
+
type: "file",
|
|
5603
|
+
multiple,
|
|
5604
|
+
accept,
|
|
5605
|
+
className: "cnc-sr-only",
|
|
5606
|
+
tabIndex: -1,
|
|
5607
|
+
disabled: isBusy,
|
|
5608
|
+
"aria-describedby": hint ? hintId : void 0,
|
|
5609
|
+
onChange: handleFileSelection
|
|
5610
|
+
}
|
|
5611
|
+
),
|
|
5612
|
+
/* @__PURE__ */ jsx37("div", { className: "cnc-flex cnc-flex-col cnc-gap-2 sm:cnc-flex-row sm:cnc-flex-wrap sm:cnc-items-center", children: /* @__PURE__ */ jsxs28(
|
|
5613
|
+
Button,
|
|
5614
|
+
{
|
|
5615
|
+
type: "button",
|
|
5616
|
+
variant: "outline",
|
|
5617
|
+
disabled: isBusy,
|
|
5618
|
+
className: buttonClassName,
|
|
5619
|
+
onClick: () => fileInputRef.current?.click(),
|
|
5620
|
+
children: [
|
|
5621
|
+
icon ?? /* @__PURE__ */ jsx37(Paperclip, { className: "cnc-mr-2 cnc-size-4" }),
|
|
5622
|
+
buttonLabel
|
|
5623
|
+
]
|
|
5624
|
+
}
|
|
5625
|
+
) }),
|
|
5626
|
+
hint ? /* @__PURE__ */ jsx37("p", { id: hintId, className: "cnc-text-sm cnc-text-slate-600", children: hint }) : null,
|
|
5627
|
+
showList && items.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "cnc-flex cnc-flex-col cnc-gap-2", children: [
|
|
5628
|
+
/* @__PURE__ */ jsx37("p", { role: "status", className: "cnc-text-sm cnc-font-medium cnc-text-slate-700", children: listTitle(items.length) }),
|
|
5629
|
+
/* @__PURE__ */ jsx37(
|
|
5630
|
+
FileList,
|
|
5631
|
+
{
|
|
5632
|
+
items,
|
|
5633
|
+
onRemove: handleRemove,
|
|
5634
|
+
disabled: isBusy,
|
|
5635
|
+
className: listClassName
|
|
5636
|
+
}
|
|
5637
|
+
)
|
|
5638
|
+
] }) : null
|
|
5639
|
+
] });
|
|
5640
|
+
}
|
|
5641
|
+
);
|
|
5642
|
+
FileUpload.displayName = "FileUpload";
|
|
5643
|
+
|
|
5644
|
+
// src/components/organisms/calendar/calendar-utils.ts
|
|
5645
|
+
var MESES_PT_BR = [
|
|
5646
|
+
"Janeiro",
|
|
5647
|
+
"Fevereiro",
|
|
5648
|
+
"Mar\xE7o",
|
|
5649
|
+
"Abril",
|
|
5650
|
+
"Maio",
|
|
5651
|
+
"Junho",
|
|
5652
|
+
"Julho",
|
|
5653
|
+
"Agosto",
|
|
5654
|
+
"Setembro",
|
|
5655
|
+
"Outubro",
|
|
5656
|
+
"Novembro",
|
|
5657
|
+
"Dezembro"
|
|
5658
|
+
];
|
|
5659
|
+
var MESES_PT_BR_ABREV = [
|
|
5660
|
+
"JAN",
|
|
5661
|
+
"FEV",
|
|
5662
|
+
"MAR",
|
|
5663
|
+
"ABR",
|
|
5664
|
+
"MAI",
|
|
5665
|
+
"JUN",
|
|
5666
|
+
"JUL",
|
|
5667
|
+
"AGO",
|
|
5668
|
+
"SET",
|
|
5669
|
+
"OUT",
|
|
5670
|
+
"NOV",
|
|
5671
|
+
"DEZ"
|
|
5672
|
+
];
|
|
5673
|
+
var DIAS_SEMANA_PT_BR = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "S\xC1B"];
|
|
5674
|
+
function toDateKey(date) {
|
|
5675
|
+
const ano = date.getFullYear();
|
|
5676
|
+
const mes = String(date.getMonth() + 1).padStart(2, "0");
|
|
5677
|
+
const dia = String(date.getDate()).padStart(2, "0");
|
|
5678
|
+
return `${ano}-${mes}-${dia}`;
|
|
5679
|
+
}
|
|
5680
|
+
function toLocalNoon(date) {
|
|
5681
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 12, 0, 0, 0);
|
|
5682
|
+
}
|
|
5683
|
+
function isSameDay(a, b) {
|
|
5684
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
5685
|
+
}
|
|
5686
|
+
function isToday(date) {
|
|
5687
|
+
return isSameDay(date, /* @__PURE__ */ new Date());
|
|
5688
|
+
}
|
|
5689
|
+
function buildMonthDays(month, selectedDate, hasItems) {
|
|
5690
|
+
const year = month.getFullYear();
|
|
5691
|
+
const monthIndex = month.getMonth();
|
|
5692
|
+
const totalDays = new Date(year, monthIndex + 1, 0).getDate();
|
|
5693
|
+
const startOffset = new Date(year, monthIndex, 1).getDay();
|
|
5694
|
+
const cells = [];
|
|
5695
|
+
for (let i = 0; i < startOffset; i++) {
|
|
5696
|
+
cells.push(null);
|
|
5697
|
+
}
|
|
5698
|
+
for (let day = 1; day <= totalDays; day++) {
|
|
5699
|
+
const date = new Date(year, monthIndex, day, 12, 0, 0, 0);
|
|
5700
|
+
cells.push({
|
|
5701
|
+
date,
|
|
5702
|
+
number: day,
|
|
5703
|
+
dateKey: toDateKey(date),
|
|
5704
|
+
isToday: isToday(date),
|
|
5705
|
+
isSelected: selectedDate ? isSameDay(date, selectedDate) : false,
|
|
5706
|
+
hasItems: hasItems?.(date) ?? false
|
|
5707
|
+
});
|
|
5708
|
+
}
|
|
5709
|
+
return cells;
|
|
5710
|
+
}
|
|
5711
|
+
function formatMonthYear(date) {
|
|
5712
|
+
return `${MESES_PT_BR[date.getMonth()]} ${date.getFullYear()}`;
|
|
5713
|
+
}
|
|
5714
|
+
function formatDayAriaLabel(date) {
|
|
5715
|
+
return date.toLocaleDateString("pt-BR", {
|
|
5716
|
+
weekday: "long",
|
|
5717
|
+
day: "numeric",
|
|
5718
|
+
month: "long",
|
|
5719
|
+
year: "numeric"
|
|
5720
|
+
});
|
|
5721
|
+
}
|
|
5722
|
+
|
|
5723
|
+
// src/components/organisms/calendar/mini-month-calendar.tsx
|
|
5724
|
+
import * as React25 from "react";
|
|
5725
|
+
import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5726
|
+
function MiniMonthCalendar({
|
|
5727
|
+
month: monthProp,
|
|
5728
|
+
onMonthChange,
|
|
5729
|
+
selectedDate,
|
|
5730
|
+
onSelectDate,
|
|
5731
|
+
hasItems,
|
|
5732
|
+
renderDay,
|
|
5733
|
+
weekDays = DIAS_SEMANA_PT_BR,
|
|
5734
|
+
monthLabel = formatMonthYear,
|
|
5735
|
+
previousLabel = "M\xEAs anterior",
|
|
5736
|
+
nextLabel = "Pr\xF3ximo m\xEAs",
|
|
5737
|
+
className
|
|
4625
5738
|
}) {
|
|
4626
|
-
const
|
|
4627
|
-
|
|
5739
|
+
const month = React25.useMemo(() => toLocalNoon(monthProp ?? /* @__PURE__ */ new Date()), [monthProp]);
|
|
5740
|
+
const cells = React25.useMemo(
|
|
5741
|
+
() => buildMonthDays(month, selectedDate, hasItems),
|
|
5742
|
+
[month, selectedDate, hasItems]
|
|
5743
|
+
);
|
|
5744
|
+
const goToMonth = (offset) => {
|
|
5745
|
+
onMonthChange?.(
|
|
5746
|
+
new Date(month.getFullYear(), month.getMonth() + offset, 1, 12, 0, 0, 0)
|
|
5747
|
+
);
|
|
4628
5748
|
};
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
"
|
|
5749
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("cnc-w-full", className), children: [
|
|
5750
|
+
/* @__PURE__ */ jsxs29("div", { className: "cnc-mb-4 cnc-flex cnc-items-center cnc-justify-between cnc-px-1", children: [
|
|
5751
|
+
/* @__PURE__ */ jsx38(
|
|
5752
|
+
"button",
|
|
5753
|
+
{
|
|
5754
|
+
type: "button",
|
|
5755
|
+
onClick: () => goToMonth(-1),
|
|
5756
|
+
"aria-label": previousLabel,
|
|
5757
|
+
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",
|
|
5758
|
+
children: /* @__PURE__ */ jsx38(ChevronLeft, { className: "cnc-size-4" })
|
|
5759
|
+
}
|
|
5760
|
+
),
|
|
5761
|
+
/* @__PURE__ */ jsx38("span", { className: "cnc-text-sm cnc-font-bold cnc-text-primary", children: monthLabel(month) }),
|
|
5762
|
+
/* @__PURE__ */ jsx38(
|
|
5763
|
+
"button",
|
|
5764
|
+
{
|
|
5765
|
+
type: "button",
|
|
5766
|
+
onClick: () => goToMonth(1),
|
|
5767
|
+
"aria-label": nextLabel,
|
|
5768
|
+
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",
|
|
5769
|
+
children: /* @__PURE__ */ jsx38(ChevronRight, { className: "cnc-size-4" })
|
|
5770
|
+
}
|
|
5771
|
+
)
|
|
5772
|
+
] }),
|
|
5773
|
+
/* @__PURE__ */ jsxs29("div", { className: "cnc-grid cnc-grid-cols-7 cnc-gap-y-3 cnc-text-center cnc-text-xs", children: [
|
|
5774
|
+
weekDays.map((dayName) => /* @__PURE__ */ jsx38(
|
|
5775
|
+
"span",
|
|
5776
|
+
{
|
|
5777
|
+
className: "cnc-text-[11px] cnc-font-medium cnc-text-brand-gray-200",
|
|
5778
|
+
children: dayName
|
|
5779
|
+
},
|
|
5780
|
+
dayName
|
|
5781
|
+
)),
|
|
5782
|
+
cells.map((cell, index) => {
|
|
5783
|
+
if (!cell) {
|
|
5784
|
+
return /* @__PURE__ */ jsx38("span", {}, `vazio-${index}`);
|
|
5785
|
+
}
|
|
5786
|
+
return /* @__PURE__ */ jsx38(
|
|
5787
|
+
"button",
|
|
4638
5788
|
{
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
5789
|
+
type: "button",
|
|
5790
|
+
onClick: () => onSelectDate?.(cell.date),
|
|
5791
|
+
"aria-label": formatDayAriaLabel(cell.date),
|
|
5792
|
+
"aria-pressed": cell.isSelected,
|
|
5793
|
+
className: cn(
|
|
5794
|
+
"cnc-group cnc-relative cnc-flex cnc-h-8 cnc-flex-col cnc-items-center cnc-justify-center cnc-rounded-full cnc-transition-colors",
|
|
5795
|
+
cell.isSelected ? "cnc-bg-primary cnc-text-white" : "cnc-text-brand-gray-600 hover:cnc-bg-brand-blue-50 hover:cnc-text-primary",
|
|
5796
|
+
cell.isToday && !cell.isSelected && "cnc-underline cnc-decoration-primary cnc-decoration-2 cnc-underline-offset-4"
|
|
5797
|
+
),
|
|
5798
|
+
children: renderDay ? renderDay(cell) : /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
5799
|
+
/* @__PURE__ */ jsx38("span", { className: "cnc-text-xs cnc-font-semibold", children: cell.number }),
|
|
5800
|
+
cell.hasItems && /* @__PURE__ */ jsx38("span", { className: "cnc-absolute cnc-bottom-1 cnc-size-1 cnc-rounded-full cnc-bg-primary group-aria-pressed:cnc-bg-white" })
|
|
5801
|
+
] })
|
|
4646
5802
|
},
|
|
4647
|
-
|
|
4648
|
-
)
|
|
4649
|
-
}
|
|
4650
|
-
)
|
|
4651
|
-
}
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
5803
|
+
cell.dateKey
|
|
5804
|
+
);
|
|
5805
|
+
})
|
|
5806
|
+
] })
|
|
5807
|
+
] });
|
|
5808
|
+
}
|
|
5809
|
+
|
|
5810
|
+
// src/components/organisms/calendar/month-year-picker.tsx
|
|
5811
|
+
import * as React26 from "react";
|
|
5812
|
+
import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5813
|
+
function MonthYearPicker({
|
|
5814
|
+
value,
|
|
5815
|
+
onChange,
|
|
5816
|
+
disabled = false,
|
|
5817
|
+
triggerLabel = formatMonthYear,
|
|
5818
|
+
previousYearLabel = "Ano anterior",
|
|
5819
|
+
nextYearLabel = "Pr\xF3ximo ano",
|
|
5820
|
+
className,
|
|
5821
|
+
triggerClassName,
|
|
5822
|
+
contentClassName
|
|
5823
|
+
}) {
|
|
5824
|
+
const [open, setOpen] = React26.useState(false);
|
|
5825
|
+
const [viewYear, setViewYear] = React26.useState(() => value.getFullYear());
|
|
5826
|
+
React26.useEffect(() => {
|
|
5827
|
+
if (open) setViewYear(value.getFullYear());
|
|
5828
|
+
}, [open, value]);
|
|
5829
|
+
const isSelectedMonth = (monthIndex) => value.getFullYear() === viewYear && value.getMonth() === monthIndex;
|
|
5830
|
+
const handleMonthSelect = (monthIndex) => {
|
|
5831
|
+
const lastDay = new Date(viewYear, monthIndex + 1, 0).getDate();
|
|
5832
|
+
const day = Math.min(value.getDate(), lastDay);
|
|
5833
|
+
onChange(new Date(viewYear, monthIndex, day));
|
|
5834
|
+
setOpen(false);
|
|
5835
|
+
};
|
|
5836
|
+
return /* @__PURE__ */ jsxs30(Popover2, { open, onOpenChange: setOpen, children: [
|
|
5837
|
+
/* @__PURE__ */ jsx39(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs30(
|
|
5838
|
+
Button,
|
|
4655
5839
|
{
|
|
5840
|
+
type: "button",
|
|
5841
|
+
variant: "outline",
|
|
5842
|
+
disabled,
|
|
5843
|
+
"aria-expanded": open,
|
|
4656
5844
|
className: cn(
|
|
4657
|
-
"cnc-
|
|
4658
|
-
|
|
5845
|
+
"cnc-justify-between cnc-gap-2 cnc-font-bold",
|
|
5846
|
+
triggerClassName
|
|
4659
5847
|
),
|
|
4660
|
-
style: { backgroundColor: "#F8FAFC", color: "#64748B" },
|
|
4661
5848
|
children: [
|
|
4662
|
-
/* @__PURE__ */
|
|
4663
|
-
/* @__PURE__ */
|
|
5849
|
+
/* @__PURE__ */ jsx39("span", { className: "cnc-text-sm", children: triggerLabel(value) }),
|
|
5850
|
+
/* @__PURE__ */ jsx39(
|
|
5851
|
+
ChevronDown,
|
|
5852
|
+
{
|
|
5853
|
+
className: cn(
|
|
5854
|
+
"cnc-size-4 cnc-transition-transform",
|
|
5855
|
+
open && "cnc-rotate-180"
|
|
5856
|
+
)
|
|
5857
|
+
}
|
|
5858
|
+
)
|
|
4664
5859
|
]
|
|
4665
5860
|
}
|
|
4666
|
-
)
|
|
5861
|
+
) }),
|
|
5862
|
+
/* @__PURE__ */ jsxs30(
|
|
5863
|
+
PopoverContent2,
|
|
5864
|
+
{
|
|
5865
|
+
align: "start",
|
|
5866
|
+
className: cn("cnc-w-72 cnc-p-4", className, contentClassName),
|
|
5867
|
+
children: [
|
|
5868
|
+
/* @__PURE__ */ jsxs30("div", { className: "cnc-mb-4 cnc-flex cnc-items-center cnc-justify-between", children: [
|
|
5869
|
+
/* @__PURE__ */ jsx39(
|
|
5870
|
+
"button",
|
|
5871
|
+
{
|
|
5872
|
+
type: "button",
|
|
5873
|
+
onClick: () => setViewYear((prev) => prev - 1),
|
|
5874
|
+
"aria-label": previousYearLabel,
|
|
5875
|
+
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",
|
|
5876
|
+
children: /* @__PURE__ */ jsx39(ChevronLeft, { className: "cnc-size-5" })
|
|
5877
|
+
}
|
|
5878
|
+
),
|
|
5879
|
+
/* @__PURE__ */ jsx39("span", { className: "cnc-text-base cnc-font-bold cnc-text-primary", children: viewYear }),
|
|
5880
|
+
/* @__PURE__ */ jsx39(
|
|
5881
|
+
"button",
|
|
5882
|
+
{
|
|
5883
|
+
type: "button",
|
|
5884
|
+
onClick: () => setViewYear((prev) => prev + 1),
|
|
5885
|
+
"aria-label": nextYearLabel,
|
|
5886
|
+
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",
|
|
5887
|
+
children: /* @__PURE__ */ jsx39(ChevronRight, { className: "cnc-size-5" })
|
|
5888
|
+
}
|
|
5889
|
+
)
|
|
5890
|
+
] }),
|
|
5891
|
+
/* @__PURE__ */ jsx39("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__ */ jsx39(
|
|
5892
|
+
"button",
|
|
5893
|
+
{
|
|
5894
|
+
type: "button",
|
|
5895
|
+
onClick: () => handleMonthSelect(monthIndex),
|
|
5896
|
+
"aria-pressed": isSelectedMonth(monthIndex),
|
|
5897
|
+
className: cn(
|
|
5898
|
+
"cnc-rounded-lg cnc-py-2 cnc-text-[10px] cnc-font-bold cnc-uppercase cnc-transition-colors",
|
|
5899
|
+
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"
|
|
5900
|
+
),
|
|
5901
|
+
children: month
|
|
5902
|
+
},
|
|
5903
|
+
month
|
|
5904
|
+
)) })
|
|
5905
|
+
]
|
|
5906
|
+
}
|
|
5907
|
+
)
|
|
5908
|
+
] });
|
|
5909
|
+
}
|
|
5910
|
+
|
|
5911
|
+
// src/components/organisms/period-range-list/index.tsx
|
|
5912
|
+
import * as React27 from "react";
|
|
5913
|
+
import { jsx as jsx40, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5914
|
+
var DEFAULT_LABELS = {
|
|
5915
|
+
start: "In\xEDcio",
|
|
5916
|
+
end: "Fim",
|
|
5917
|
+
add: "Adicionar",
|
|
5918
|
+
empty: "Nenhum per\xEDodo adicionado.",
|
|
5919
|
+
startColumn: "In\xEDcio",
|
|
5920
|
+
endColumn: "Fim",
|
|
5921
|
+
actionsColumn: "A\xE7\xF5es"
|
|
5922
|
+
};
|
|
5923
|
+
function createPeriodId() {
|
|
5924
|
+
return `period-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
5925
|
+
}
|
|
5926
|
+
function normalizePeriods(periods) {
|
|
5927
|
+
return periods.map((period) => ({
|
|
5928
|
+
...period,
|
|
5929
|
+
id: period.id ?? createPeriodId()
|
|
5930
|
+
}));
|
|
5931
|
+
}
|
|
5932
|
+
function formatForDisplay(value, inputType) {
|
|
5933
|
+
if (!value) return "";
|
|
5934
|
+
if (inputType === "date") {
|
|
5935
|
+
const [year2, month2, day2] = value.split("-");
|
|
5936
|
+
if (year2 && month2 && day2) return `${day2}/${month2}/${year2}`;
|
|
5937
|
+
return value;
|
|
4667
5938
|
}
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
5939
|
+
const normalized = value.slice(0, 16);
|
|
5940
|
+
const [datePart, timePart] = normalized.split("T");
|
|
5941
|
+
if (!datePart) return value;
|
|
5942
|
+
const [year, month, day] = datePart.split("-");
|
|
5943
|
+
const dateText = year && month && day ? `${day}/${month}/${year}` : datePart;
|
|
5944
|
+
return timePart ? `${dateText} ${timePart}` : dateText;
|
|
5945
|
+
}
|
|
5946
|
+
function splitDisplay(value, inputType) {
|
|
5947
|
+
const formatted = formatForDisplay(value, inputType);
|
|
5948
|
+
if (inputType === "date") {
|
|
5949
|
+
return { date: formatted, time: "" };
|
|
5950
|
+
}
|
|
5951
|
+
const parts = formatted.split(" ");
|
|
5952
|
+
if (parts.length <= 1) {
|
|
5953
|
+
return { date: formatted, time: "" };
|
|
5954
|
+
}
|
|
5955
|
+
const time = parts.pop() ?? "";
|
|
5956
|
+
return { date: parts.join(" "), time };
|
|
5957
|
+
}
|
|
5958
|
+
function PeriodRangeList({
|
|
5959
|
+
value = [],
|
|
5960
|
+
onChange,
|
|
5961
|
+
inputType = "datetime-local",
|
|
5962
|
+
labels: labelsProp,
|
|
5963
|
+
readOnly = false,
|
|
5964
|
+
disabled = false,
|
|
5965
|
+
required = false,
|
|
5966
|
+
error,
|
|
5967
|
+
validate,
|
|
5968
|
+
className
|
|
5969
|
+
}) {
|
|
5970
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
5971
|
+
const endAfterStart = validate?.endAfterStart ?? true;
|
|
5972
|
+
const noDuplicates = validate?.noDuplicates ?? true;
|
|
5973
|
+
const [startDraft, setStartDraft] = React27.useState("");
|
|
5974
|
+
const [endDraft, setEndDraft] = React27.useState("");
|
|
5975
|
+
const periods = React27.useMemo(() => normalizePeriods(value), [value]);
|
|
5976
|
+
const isInvalidRange = Boolean(startDraft && endDraft) && endAfterStart && startDraft >= endDraft;
|
|
5977
|
+
const isDuplicate = Boolean(startDraft && endDraft) && noDuplicates && periods.some(
|
|
5978
|
+
(period) => period.start === startDraft && period.end === endDraft
|
|
4675
5979
|
);
|
|
5980
|
+
const canAdd = Boolean(startDraft && endDraft) && !isInvalidRange && !isDuplicate;
|
|
5981
|
+
const addTitle = isDuplicate ? "Este per\xEDodo j\xE1 foi adicionado" : isInvalidRange ? "A data final deve ser posterior \xE0 data inicial" : void 0;
|
|
5982
|
+
function emitChange(next) {
|
|
5983
|
+
onChange?.(normalizePeriods(next));
|
|
5984
|
+
}
|
|
5985
|
+
function handleAdd() {
|
|
5986
|
+
if (!canAdd || disabled || readOnly) return;
|
|
5987
|
+
emitChange([
|
|
5988
|
+
...periods,
|
|
5989
|
+
{
|
|
5990
|
+
id: createPeriodId(),
|
|
5991
|
+
start: startDraft,
|
|
5992
|
+
end: endDraft
|
|
5993
|
+
}
|
|
5994
|
+
]);
|
|
5995
|
+
setStartDraft("");
|
|
5996
|
+
setEndDraft("");
|
|
5997
|
+
}
|
|
5998
|
+
function handleRemove(id) {
|
|
5999
|
+
if (disabled || readOnly) return;
|
|
6000
|
+
emitChange(periods.filter((period) => period.id !== id));
|
|
6001
|
+
}
|
|
6002
|
+
const showRequiredOnInputs = required && periods.length === 0;
|
|
6003
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn("cnc-w-full cnc-space-y-4", className), children: [
|
|
6004
|
+
!readOnly && /* @__PURE__ */ jsxs31("div", { className: "cnc-grid cnc-grid-cols-1 md:cnc-grid-cols-12 cnc-gap-4 cnc-items-end", children: [
|
|
6005
|
+
/* @__PURE__ */ jsx40("div", { className: "md:cnc-col-span-5", children: /* @__PURE__ */ jsx40(
|
|
6006
|
+
Input,
|
|
6007
|
+
{
|
|
6008
|
+
type: inputType,
|
|
6009
|
+
label: labels.start,
|
|
6010
|
+
required: showRequiredOnInputs,
|
|
6011
|
+
value: startDraft,
|
|
6012
|
+
disabled,
|
|
6013
|
+
onChange: (event) => setStartDraft(event.target.value)
|
|
6014
|
+
}
|
|
6015
|
+
) }),
|
|
6016
|
+
/* @__PURE__ */ jsx40("div", { className: "md:cnc-col-span-5", children: /* @__PURE__ */ jsx40(
|
|
6017
|
+
Input,
|
|
6018
|
+
{
|
|
6019
|
+
type: inputType,
|
|
6020
|
+
label: labels.end,
|
|
6021
|
+
required: showRequiredOnInputs,
|
|
6022
|
+
value: endDraft,
|
|
6023
|
+
min: startDraft || void 0,
|
|
6024
|
+
disabled,
|
|
6025
|
+
onChange: (event) => setEndDraft(event.target.value)
|
|
6026
|
+
}
|
|
6027
|
+
) }),
|
|
6028
|
+
/* @__PURE__ */ jsx40("div", { className: "md:cnc-col-span-2", children: /* @__PURE__ */ jsxs31(
|
|
6029
|
+
Button,
|
|
6030
|
+
{
|
|
6031
|
+
type: "button",
|
|
6032
|
+
variant: "outline",
|
|
6033
|
+
className: "cnc-w-full cnc-gap-2",
|
|
6034
|
+
disabled: !canAdd || disabled,
|
|
6035
|
+
title: addTitle,
|
|
6036
|
+
onClick: handleAdd,
|
|
6037
|
+
children: [
|
|
6038
|
+
/* @__PURE__ */ jsx40(Plus, { className: "cnc-h-4 cnc-w-4" }),
|
|
6039
|
+
labels.add
|
|
6040
|
+
]
|
|
6041
|
+
}
|
|
6042
|
+
) })
|
|
6043
|
+
] }),
|
|
6044
|
+
/* @__PURE__ */ jsx40("div", { className: "cnc-overflow-hidden cnc-rounded-lg cnc-border cnc-border-brand-gray-50 cnc-shadow-sm", children: /* @__PURE__ */ jsxs31("table", { className: "cnc-min-w-full cnc-divide-y cnc-divide-brand-gray-50", children: [
|
|
6045
|
+
/* @__PURE__ */ jsx40("thead", { className: "cnc-bg-brand-gray-10", children: /* @__PURE__ */ jsxs31("tr", { children: [
|
|
6046
|
+
/* @__PURE__ */ jsx40("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 }),
|
|
6047
|
+
/* @__PURE__ */ jsx40("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 }),
|
|
6048
|
+
!readOnly && /* @__PURE__ */ jsx40("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 })
|
|
6049
|
+
] }) }),
|
|
6050
|
+
/* @__PURE__ */ jsxs31("tbody", { className: "cnc-divide-y cnc-divide-brand-gray-50 cnc-bg-white cnc-text-sm", children: [
|
|
6051
|
+
periods.map((period) => {
|
|
6052
|
+
const startDisplay = splitDisplay(period.start, inputType);
|
|
6053
|
+
const endDisplay = splitDisplay(period.end, inputType);
|
|
6054
|
+
return /* @__PURE__ */ jsxs31("tr", { className: "hover:cnc-bg-brand-gray-10/50", children: [
|
|
6055
|
+
/* @__PURE__ */ jsxs31("td", { className: "cnc-px-6 cnc-py-4 cnc-text-brand-gray-600", children: [
|
|
6056
|
+
/* @__PURE__ */ jsx40("span", { className: "cnc-font-medium cnc-text-brand-gray-600", children: startDisplay.date }),
|
|
6057
|
+
startDisplay.time ? /* @__PURE__ */ jsx40("span", { className: "cnc-ml-2 cnc-text-brand-gray-200", children: startDisplay.time }) : null
|
|
6058
|
+
] }),
|
|
6059
|
+
/* @__PURE__ */ jsxs31("td", { className: "cnc-px-6 cnc-py-4 cnc-text-brand-gray-600", children: [
|
|
6060
|
+
/* @__PURE__ */ jsx40("span", { className: "cnc-font-medium cnc-text-brand-gray-600", children: endDisplay.date }),
|
|
6061
|
+
endDisplay.time ? /* @__PURE__ */ jsx40("span", { className: "cnc-ml-2 cnc-text-brand-gray-200", children: endDisplay.time }) : null
|
|
6062
|
+
] }),
|
|
6063
|
+
!readOnly && /* @__PURE__ */ jsx40("td", { className: "cnc-px-6 cnc-py-4 cnc-text-right", children: /* @__PURE__ */ jsx40(
|
|
6064
|
+
"button",
|
|
6065
|
+
{
|
|
6066
|
+
type: "button",
|
|
6067
|
+
className: "cnc-text-brand-gray-200 hover:cnc-text-brand-red-500 cnc-transition-colors disabled:cnc-opacity-50",
|
|
6068
|
+
disabled,
|
|
6069
|
+
"aria-label": "Remover per\xEDodo",
|
|
6070
|
+
onClick: () => handleRemove(period.id),
|
|
6071
|
+
children: /* @__PURE__ */ jsx40(Trash2, { className: "cnc-h-5 cnc-w-5" })
|
|
6072
|
+
}
|
|
6073
|
+
) })
|
|
6074
|
+
] }, period.id);
|
|
6075
|
+
}),
|
|
6076
|
+
periods.length === 0 && /* @__PURE__ */ jsx40("tr", { children: /* @__PURE__ */ jsx40(
|
|
6077
|
+
"td",
|
|
6078
|
+
{
|
|
6079
|
+
colSpan: readOnly ? 2 : 3,
|
|
6080
|
+
className: "cnc-px-6 cnc-py-8 cnc-text-center cnc-text-brand-gray-200 cnc-italic",
|
|
6081
|
+
children: labels.empty
|
|
6082
|
+
}
|
|
6083
|
+
) })
|
|
6084
|
+
] })
|
|
6085
|
+
] }) }),
|
|
6086
|
+
error ? /* @__PURE__ */ jsx40("p", { className: "cnc-text-xs cnc-font-medium cnc-text-brand-red-500", children: error }) : null
|
|
6087
|
+
] });
|
|
4676
6088
|
}
|
|
6089
|
+
var DateTimeRangeList = PeriodRangeList;
|
|
4677
6090
|
|
|
4678
6091
|
// src/components/organisms/header-notifications/index.tsx
|
|
4679
|
-
import * as
|
|
6092
|
+
import * as React29 from "react";
|
|
4680
6093
|
|
|
4681
6094
|
// src/components/organisms/header-notifications/cliente.ts
|
|
4682
6095
|
var URL_PADRAO_NOTIFICACOES = "https://dev-apinotificacoes-b5feekb4bdfyb7c2.eastus2-01.azurewebsites.net/v1";
|
|
@@ -4871,7 +6284,7 @@ function mapearParaItem(notificacao, getHref, agora) {
|
|
|
4871
6284
|
}
|
|
4872
6285
|
|
|
4873
6286
|
// src/components/organisms/header-notifications/modal-lembretes.tsx
|
|
4874
|
-
import { jsx as
|
|
6287
|
+
import { jsx as jsx41, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4875
6288
|
function ModalLembretes({
|
|
4876
6289
|
lembretes,
|
|
4877
6290
|
aberto,
|
|
@@ -4881,46 +6294,46 @@ function ModalLembretes({
|
|
|
4881
6294
|
}) {
|
|
4882
6295
|
const visivel = aberto && lembretes.length > 0;
|
|
4883
6296
|
const tituloExibido = titulo ?? (lembretes.length === 1 ? "Voc\xEA tem um lembrete" : "Voc\xEA tem lembretes");
|
|
4884
|
-
return /* @__PURE__ */
|
|
6297
|
+
return /* @__PURE__ */ jsx41(
|
|
4885
6298
|
Dialog,
|
|
4886
6299
|
{
|
|
4887
6300
|
open: visivel,
|
|
4888
6301
|
onOpenChange: (proximoEstado) => {
|
|
4889
6302
|
if (!proximoEstado) onDispensar();
|
|
4890
6303
|
},
|
|
4891
|
-
children: /* @__PURE__ */
|
|
6304
|
+
children: /* @__PURE__ */ jsxs32(
|
|
4892
6305
|
DialogContent,
|
|
4893
6306
|
{
|
|
4894
6307
|
className: "cnc-max-w-[440px] cnc-rounded-lg cnc-bg-white cnc-p-0",
|
|
4895
6308
|
onOpenAutoFocus: (evento) => evento.preventDefault(),
|
|
4896
6309
|
children: [
|
|
4897
|
-
/* @__PURE__ */
|
|
4898
|
-
/* @__PURE__ */
|
|
6310
|
+
/* @__PURE__ */ jsxs32("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: [
|
|
6311
|
+
/* @__PURE__ */ jsx41("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__ */ jsx41(
|
|
4899
6312
|
BellRing,
|
|
4900
6313
|
{
|
|
4901
6314
|
className: "cnc-h-[18px] cnc-w-[18px] cnc-text-brand-blue-400",
|
|
4902
6315
|
"aria-hidden": "true"
|
|
4903
6316
|
}
|
|
4904
6317
|
) }),
|
|
4905
|
-
/* @__PURE__ */
|
|
6318
|
+
/* @__PURE__ */ jsx41(DialogTitle, { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: tituloExibido })
|
|
4906
6319
|
] }),
|
|
4907
|
-
/* @__PURE__ */
|
|
6320
|
+
/* @__PURE__ */ jsx41("ul", { className: "cnc-m-0 cnc-max-h-[320px] cnc-list-none cnc-overflow-y-auto cnc-p-0", children: lembretes.map((lembrete) => /* @__PURE__ */ jsxs32(
|
|
4908
6321
|
"li",
|
|
4909
6322
|
{
|
|
4910
6323
|
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",
|
|
4911
6324
|
children: [
|
|
4912
|
-
/* @__PURE__ */
|
|
4913
|
-
/* @__PURE__ */
|
|
4914
|
-
/* @__PURE__ */
|
|
6325
|
+
/* @__PURE__ */ jsxs32("div", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-3", children: [
|
|
6326
|
+
/* @__PURE__ */ jsx41("span", { className: "cnc-text-sm cnc-font-bold cnc-text-brand-blue-900", children: lembrete.titulo }),
|
|
6327
|
+
/* @__PURE__ */ jsx41("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: formatarDataRelativa(lembrete.dataLembrete) })
|
|
4915
6328
|
] }),
|
|
4916
|
-
lembrete.mensagem && /* @__PURE__ */
|
|
6329
|
+
lembrete.mensagem && /* @__PURE__ */ jsx41("span", { className: "cnc-text-xs cnc-leading-relaxed cnc-text-brand-gray-600", children: lembrete.mensagem })
|
|
4917
6330
|
]
|
|
4918
6331
|
},
|
|
4919
6332
|
lembrete.id
|
|
4920
6333
|
)) }),
|
|
4921
|
-
/* @__PURE__ */
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
6334
|
+
/* @__PURE__ */ jsxs32("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: [
|
|
6335
|
+
/* @__PURE__ */ jsx41(Button, { variant: "confirm", className: "cnc-w-full", onClick: onDispensar, children: rotuloDispensar }),
|
|
6336
|
+
/* @__PURE__ */ jsx41("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.` })
|
|
4924
6337
|
] })
|
|
4925
6338
|
]
|
|
4926
6339
|
}
|
|
@@ -4930,7 +6343,7 @@ function ModalLembretes({
|
|
|
4930
6343
|
}
|
|
4931
6344
|
|
|
4932
6345
|
// src/components/organisms/header-notifications/usar-notificacoes.ts
|
|
4933
|
-
import * as
|
|
6346
|
+
import * as React28 from "react";
|
|
4934
6347
|
function foiAbortado(erro) {
|
|
4935
6348
|
return erro?.name === "AbortError";
|
|
4936
6349
|
}
|
|
@@ -4943,20 +6356,20 @@ function usarNotificacoes({
|
|
|
4943
6356
|
habilitado = true,
|
|
4944
6357
|
onErro
|
|
4945
6358
|
}) {
|
|
4946
|
-
const [notificacoes, setNotificacoes] =
|
|
4947
|
-
const [carregando, setCarregando] =
|
|
4948
|
-
const notificacoesRef =
|
|
4949
|
-
const controladorRef =
|
|
4950
|
-
const jaCarregouRef =
|
|
4951
|
-
const onErroRef =
|
|
4952
|
-
|
|
6359
|
+
const [notificacoes, setNotificacoes] = React28.useState([]);
|
|
6360
|
+
const [carregando, setCarregando] = React28.useState(habilitado);
|
|
6361
|
+
const notificacoesRef = React28.useRef(notificacoes);
|
|
6362
|
+
const controladorRef = React28.useRef(null);
|
|
6363
|
+
const jaCarregouRef = React28.useRef(false);
|
|
6364
|
+
const onErroRef = React28.useRef(onErro);
|
|
6365
|
+
React28.useEffect(() => {
|
|
4953
6366
|
notificacoesRef.current = notificacoes;
|
|
4954
6367
|
}, [notificacoes]);
|
|
4955
|
-
|
|
6368
|
+
React28.useEffect(() => {
|
|
4956
6369
|
onErroRef.current = onErro;
|
|
4957
6370
|
}, [onErro]);
|
|
4958
6371
|
const chaveFiltros = JSON.stringify(filtros ?? {});
|
|
4959
|
-
const atualizar =
|
|
6372
|
+
const atualizar = React28.useCallback(() => {
|
|
4960
6373
|
if (!habilitado) return;
|
|
4961
6374
|
controladorRef.current?.abort();
|
|
4962
6375
|
const controlador = new AbortController();
|
|
@@ -4983,7 +6396,7 @@ function usarNotificacoes({
|
|
|
4983
6396
|
}
|
|
4984
6397
|
})();
|
|
4985
6398
|
}, [baseUrl, email, sistema, chaveFiltros, habilitado]);
|
|
4986
|
-
|
|
6399
|
+
React28.useEffect(() => {
|
|
4987
6400
|
if (!habilitado) {
|
|
4988
6401
|
setCarregando(false);
|
|
4989
6402
|
return;
|
|
@@ -4992,7 +6405,7 @@ function usarNotificacoes({
|
|
|
4992
6405
|
atualizar();
|
|
4993
6406
|
return () => controladorRef.current?.abort();
|
|
4994
6407
|
}, [atualizar, habilitado]);
|
|
4995
|
-
|
|
6408
|
+
React28.useEffect(() => {
|
|
4996
6409
|
if (!habilitado || !intervaloAtualizacao) return;
|
|
4997
6410
|
const temporizador = window.setInterval(() => {
|
|
4998
6411
|
if (typeof document !== "undefined" && document.hidden) return;
|
|
@@ -5000,7 +6413,7 @@ function usarNotificacoes({
|
|
|
5000
6413
|
}, intervaloAtualizacao);
|
|
5001
6414
|
return () => window.clearInterval(temporizador);
|
|
5002
6415
|
}, [atualizar, habilitado, intervaloAtualizacao]);
|
|
5003
|
-
const aplicarLeitura =
|
|
6416
|
+
const aplicarLeitura = React28.useCallback((ids) => {
|
|
5004
6417
|
const alvos = new Set(ids.map(String));
|
|
5005
6418
|
setNotificacoes(
|
|
5006
6419
|
(atuais) => atuais.map(
|
|
@@ -5008,7 +6421,7 @@ function usarNotificacoes({
|
|
|
5008
6421
|
)
|
|
5009
6422
|
);
|
|
5010
6423
|
}, []);
|
|
5011
|
-
const reverterLeitura =
|
|
6424
|
+
const reverterLeitura = React28.useCallback((anteriores) => {
|
|
5012
6425
|
const original = new Map(
|
|
5013
6426
|
anteriores.map((notificacao) => [String(notificacao.id), notificacao])
|
|
5014
6427
|
);
|
|
@@ -5023,7 +6436,7 @@ function usarNotificacoes({
|
|
|
5023
6436
|
})
|
|
5024
6437
|
);
|
|
5025
6438
|
}, []);
|
|
5026
|
-
const marcarUmaComoLida =
|
|
6439
|
+
const marcarUmaComoLida = React28.useCallback(
|
|
5027
6440
|
(id) => {
|
|
5028
6441
|
const alvo = notificacoesRef.current.find(
|
|
5029
6442
|
(notificacao) => String(notificacao.id) === String(id)
|
|
@@ -5037,7 +6450,7 @@ function usarNotificacoes({
|
|
|
5037
6450
|
},
|
|
5038
6451
|
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
5039
6452
|
);
|
|
5040
|
-
const marcarComoLidas =
|
|
6453
|
+
const marcarComoLidas = React28.useCallback(
|
|
5041
6454
|
(ids) => {
|
|
5042
6455
|
const alvos = new Set(ids.map(String));
|
|
5043
6456
|
const naoLidas = notificacoesRef.current.filter(
|
|
@@ -5055,10 +6468,10 @@ function usarNotificacoes({
|
|
|
5055
6468
|
},
|
|
5056
6469
|
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
5057
6470
|
);
|
|
5058
|
-
const marcarTodasComoLidas =
|
|
6471
|
+
const marcarTodasComoLidas = React28.useCallback(() => {
|
|
5059
6472
|
marcarComoLidas(notificacoesRef.current.map((notificacao) => notificacao.id));
|
|
5060
6473
|
}, [marcarComoLidas]);
|
|
5061
|
-
const marcarUmaComoNaoLida =
|
|
6474
|
+
const marcarUmaComoNaoLida = React28.useCallback(
|
|
5062
6475
|
(id) => {
|
|
5063
6476
|
const alvo = notificacoesRef.current.find(
|
|
5064
6477
|
(notificacao) => String(notificacao.id) === String(id)
|
|
@@ -5076,7 +6489,7 @@ function usarNotificacoes({
|
|
|
5076
6489
|
},
|
|
5077
6490
|
[baseUrl, reverterLeitura]
|
|
5078
6491
|
);
|
|
5079
|
-
const excluir =
|
|
6492
|
+
const excluir = React28.useCallback(
|
|
5080
6493
|
(id) => {
|
|
5081
6494
|
const alvo = notificacoesRef.current.find(
|
|
5082
6495
|
(notificacao) => String(notificacao.id) === String(id)
|
|
@@ -5105,7 +6518,7 @@ function usarNotificacoes({
|
|
|
5105
6518
|
}
|
|
5106
6519
|
|
|
5107
6520
|
// src/components/organisms/header-notifications/index.tsx
|
|
5108
|
-
import { Fragment as
|
|
6521
|
+
import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5109
6522
|
function HeaderNotifications(props) {
|
|
5110
6523
|
const {
|
|
5111
6524
|
items = [],
|
|
@@ -5137,11 +6550,11 @@ function HeaderNotifications(props) {
|
|
|
5137
6550
|
tituloLembretes,
|
|
5138
6551
|
rotuloDispensarLembretes
|
|
5139
6552
|
} = props;
|
|
5140
|
-
const [aberto, setAberto] =
|
|
5141
|
-
const [lembretesEmAlerta, setLembretesEmAlerta] =
|
|
6553
|
+
const [aberto, setAberto] = React29.useState(false);
|
|
6554
|
+
const [lembretesEmAlerta, setLembretesEmAlerta] = React29.useState(
|
|
5142
6555
|
[]
|
|
5143
6556
|
);
|
|
5144
|
-
const avaliouLembretesRef =
|
|
6557
|
+
const avaliouLembretesRef = React29.useRef(false);
|
|
5145
6558
|
const conectado = Boolean(email && sistema);
|
|
5146
6559
|
const remoto = usarNotificacoes({
|
|
5147
6560
|
email: email ?? "",
|
|
@@ -5152,17 +6565,17 @@ function HeaderNotifications(props) {
|
|
|
5152
6565
|
habilitado: conectado,
|
|
5153
6566
|
onErro
|
|
5154
6567
|
});
|
|
5155
|
-
const elegiveis =
|
|
6568
|
+
const elegiveis = React29.useMemo(
|
|
5156
6569
|
() => conectado ? selecionarVisiveis(remoto.notificacoes) : [],
|
|
5157
6570
|
[conectado, remoto.notificacoes]
|
|
5158
6571
|
);
|
|
5159
|
-
const itensRemotos =
|
|
6572
|
+
const itensRemotos = React29.useMemo(
|
|
5160
6573
|
() => elegiveis.slice(0, limite).map((notificacao) => mapearParaItem(notificacao, getHref)),
|
|
5161
6574
|
[elegiveis, limite, getHref]
|
|
5162
6575
|
);
|
|
5163
6576
|
const itens = conectado ? itensRemotos : items;
|
|
5164
6577
|
const carregandoLista = conectado ? remoto.carregando : isLoading;
|
|
5165
|
-
|
|
6578
|
+
React29.useEffect(() => {
|
|
5166
6579
|
if (!conectado || !alertarLembretes) return;
|
|
5167
6580
|
if (remoto.carregando || avaliouLembretesRef.current) return;
|
|
5168
6581
|
avaliouLembretesRef.current = true;
|
|
@@ -5212,28 +6625,28 @@ function HeaderNotifications(props) {
|
|
|
5212
6625
|
const anelDeFoco = "focus-visible:cnc-ring-2 focus-visible:cnc-ring-inset focus-visible:cnc-ring-brand-gray-500/50";
|
|
5213
6626
|
const renderarConteudo = () => {
|
|
5214
6627
|
if (carregandoLista) {
|
|
5215
|
-
return /* @__PURE__ */
|
|
6628
|
+
return /* @__PURE__ */ jsx42("div", { "aria-busy": "true", children: Array.from({ length: skeletonCount }).map((_, indice) => /* @__PURE__ */ jsx42(
|
|
5216
6629
|
"div",
|
|
5217
6630
|
{
|
|
5218
6631
|
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",
|
|
5219
|
-
children: /* @__PURE__ */
|
|
5220
|
-
/* @__PURE__ */
|
|
5221
|
-
/* @__PURE__ */
|
|
6632
|
+
children: /* @__PURE__ */ jsxs33("div", { className: "cnc-flex cnc-w-full cnc-flex-col cnc-gap-2", children: [
|
|
6633
|
+
/* @__PURE__ */ jsx42("div", { className: "cnc-h-3 cnc-w-1/2 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" }),
|
|
6634
|
+
/* @__PURE__ */ jsx42("div", { className: "cnc-h-3 cnc-w-3/4 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" })
|
|
5222
6635
|
] })
|
|
5223
6636
|
},
|
|
5224
6637
|
indice
|
|
5225
6638
|
)) });
|
|
5226
6639
|
}
|
|
5227
6640
|
if (itens.length === 0) {
|
|
5228
|
-
return /* @__PURE__ */
|
|
5229
|
-
/* @__PURE__ */
|
|
5230
|
-
/* @__PURE__ */
|
|
6641
|
+
return /* @__PURE__ */ jsxs33("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: [
|
|
6642
|
+
/* @__PURE__ */ jsx42(BellOff, { className: "cnc-mb-2 cnc-h-7 cnc-w-7", "aria-hidden": "true" }),
|
|
6643
|
+
/* @__PURE__ */ jsx42("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
5231
6644
|
] });
|
|
5232
6645
|
}
|
|
5233
|
-
return /* @__PURE__ */
|
|
5234
|
-
const conteudo = /* @__PURE__ */
|
|
5235
|
-
/* @__PURE__ */
|
|
5236
|
-
/* @__PURE__ */
|
|
6646
|
+
return /* @__PURE__ */ jsx42("ul", { className: "cnc-m-0 cnc-list-none cnc-p-0", children: itens.map((item) => {
|
|
6647
|
+
const conteudo = /* @__PURE__ */ jsxs33("span", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-flex-col cnc-gap-0.5", children: [
|
|
6648
|
+
/* @__PURE__ */ jsxs33("span", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-2", children: [
|
|
6649
|
+
/* @__PURE__ */ jsx42(
|
|
5237
6650
|
"span",
|
|
5238
6651
|
{
|
|
5239
6652
|
className: cn(
|
|
@@ -5243,10 +6656,10 @@ function HeaderNotifications(props) {
|
|
|
5243
6656
|
children: item.title
|
|
5244
6657
|
}
|
|
5245
6658
|
),
|
|
5246
|
-
item.date && /* @__PURE__ */
|
|
6659
|
+
item.date && /* @__PURE__ */ jsx42("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: item.date })
|
|
5247
6660
|
] }),
|
|
5248
|
-
item.message && /* @__PURE__ */
|
|
5249
|
-
!item.read && /* @__PURE__ */
|
|
6661
|
+
item.message && /* @__PURE__ */ jsx42("span", { className: "cnc-line-clamp-2 cnc-text-xs cnc-text-brand-gray-600", children: item.message }),
|
|
6662
|
+
!item.read && /* @__PURE__ */ jsx42("span", { className: "cnc-sr-only", children: "N\xE3o lida" })
|
|
5250
6663
|
] });
|
|
5251
6664
|
const classesLinha = cn(
|
|
5252
6665
|
"cnc-flex cnc-w-full cnc-items-start cnc-border-l-[3px] cnc-transition cnc-duration-200",
|
|
@@ -5261,7 +6674,7 @@ function HeaderNotifications(props) {
|
|
|
5261
6674
|
"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",
|
|
5262
6675
|
anelDeFoco
|
|
5263
6676
|
);
|
|
5264
|
-
const renderarAlvo = () => alvoClicavel ? /* @__PURE__ */
|
|
6677
|
+
const renderarAlvo = () => alvoClicavel ? /* @__PURE__ */ jsx42(
|
|
5265
6678
|
"button",
|
|
5266
6679
|
{
|
|
5267
6680
|
type: "button",
|
|
@@ -5269,16 +6682,16 @@ function HeaderNotifications(props) {
|
|
|
5269
6682
|
className: classesAlvo,
|
|
5270
6683
|
children: conteudo
|
|
5271
6684
|
}
|
|
5272
|
-
) : /* @__PURE__ */
|
|
6685
|
+
) : /* @__PURE__ */ jsx42("div", { className: classesAlvo, children: conteudo });
|
|
5273
6686
|
const rotuloLeitura = item.read ? "Marcar como n\xE3o lida" : "Marcar como lida";
|
|
5274
|
-
return /* @__PURE__ */
|
|
6687
|
+
return /* @__PURE__ */ jsx42(
|
|
5275
6688
|
"li",
|
|
5276
6689
|
{
|
|
5277
6690
|
className: "cnc-border-b cnc-border-brand-gray-50 last:cnc-border-b-0",
|
|
5278
|
-
children: /* @__PURE__ */
|
|
6691
|
+
children: /* @__PURE__ */ jsxs33("div", { className: classesLinha, children: [
|
|
5279
6692
|
renderarAlvo(),
|
|
5280
|
-
(podeAlternarLeitura || podeExcluir) && /* @__PURE__ */
|
|
5281
|
-
podeAlternarLeitura && /* @__PURE__ */
|
|
6693
|
+
(podeAlternarLeitura || podeExcluir) && /* @__PURE__ */ jsxs33("div", { className: "cnc-flex cnc-shrink-0 cnc-items-center cnc-gap-1 cnc-py-3 cnc-pr-2", children: [
|
|
6694
|
+
podeAlternarLeitura && /* @__PURE__ */ jsx42(
|
|
5282
6695
|
"button",
|
|
5283
6696
|
{
|
|
5284
6697
|
type: "button",
|
|
@@ -5289,7 +6702,7 @@ function HeaderNotifications(props) {
|
|
|
5289
6702
|
classesAcao,
|
|
5290
6703
|
"hover:cnc-text-brand-blue-400"
|
|
5291
6704
|
),
|
|
5292
|
-
children: item.read ? /* @__PURE__ */
|
|
6705
|
+
children: item.read ? /* @__PURE__ */ jsx42(Mail, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx42(
|
|
5293
6706
|
MailOpen,
|
|
5294
6707
|
{
|
|
5295
6708
|
className: "cnc-h-4 cnc-w-4",
|
|
@@ -5298,7 +6711,7 @@ function HeaderNotifications(props) {
|
|
|
5298
6711
|
)
|
|
5299
6712
|
}
|
|
5300
6713
|
),
|
|
5301
|
-
podeExcluir && /* @__PURE__ */
|
|
6714
|
+
podeExcluir && /* @__PURE__ */ jsx42(
|
|
5302
6715
|
"button",
|
|
5303
6716
|
{
|
|
5304
6717
|
type: "button",
|
|
@@ -5306,7 +6719,7 @@ function HeaderNotifications(props) {
|
|
|
5306
6719
|
title: "Excluir notifica\xE7\xE3o",
|
|
5307
6720
|
onClick: () => excluirItem(item),
|
|
5308
6721
|
className: cn(classesAcao, "hover:cnc-text-brand-red-600"),
|
|
5309
|
-
children: /* @__PURE__ */
|
|
6722
|
+
children: /* @__PURE__ */ jsx42(Trash2, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" })
|
|
5310
6723
|
}
|
|
5311
6724
|
)
|
|
5312
6725
|
] })
|
|
@@ -5317,8 +6730,8 @@ function HeaderNotifications(props) {
|
|
|
5317
6730
|
}) });
|
|
5318
6731
|
};
|
|
5319
6732
|
const temRodapePadrao = podeMarcarTodas && naoLidas > 0;
|
|
5320
|
-
return /* @__PURE__ */
|
|
5321
|
-
alertarLembretes && /* @__PURE__ */
|
|
6733
|
+
return /* @__PURE__ */ jsxs33(Fragment8, { children: [
|
|
6734
|
+
alertarLembretes && /* @__PURE__ */ jsx42(
|
|
5322
6735
|
ModalLembretes,
|
|
5323
6736
|
{
|
|
5324
6737
|
lembretes: lembretesEmAlerta,
|
|
@@ -5328,8 +6741,8 @@ function HeaderNotifications(props) {
|
|
|
5328
6741
|
rotuloDispensar: rotuloDispensarLembretes
|
|
5329
6742
|
}
|
|
5330
6743
|
),
|
|
5331
|
-
/* @__PURE__ */
|
|
5332
|
-
/* @__PURE__ */
|
|
6744
|
+
/* @__PURE__ */ jsxs33(Popover, { open: aberto, onOpenChange: alterarAbertura, children: [
|
|
6745
|
+
/* @__PURE__ */ jsx42(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs33(
|
|
5333
6746
|
"button",
|
|
5334
6747
|
{
|
|
5335
6748
|
type: "button",
|
|
@@ -5340,62 +6753,812 @@ function HeaderNotifications(props) {
|
|
|
5340
6753
|
className
|
|
5341
6754
|
),
|
|
5342
6755
|
children: [
|
|
5343
|
-
/* @__PURE__ */
|
|
6756
|
+
/* @__PURE__ */ jsx42(
|
|
5344
6757
|
Bell,
|
|
5345
6758
|
{
|
|
5346
|
-
className: "cnc-h-5 cnc-w-5 cnc-text-brand-blue-900 cnc-header-item",
|
|
5347
|
-
"aria-hidden": "true"
|
|
6759
|
+
className: "cnc-h-5 cnc-w-5 cnc-text-brand-blue-900 cnc-header-item",
|
|
6760
|
+
"aria-hidden": "true"
|
|
6761
|
+
}
|
|
6762
|
+
),
|
|
6763
|
+
naoLidas > 0 && /* @__PURE__ */ jsx42(
|
|
6764
|
+
"span",
|
|
6765
|
+
{
|
|
6766
|
+
"aria-hidden": "true",
|
|
6767
|
+
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",
|
|
6768
|
+
children: rotuloContagem
|
|
6769
|
+
}
|
|
6770
|
+
)
|
|
6771
|
+
]
|
|
6772
|
+
}
|
|
6773
|
+
) }),
|
|
6774
|
+
/* @__PURE__ */ jsxs33(
|
|
6775
|
+
PopoverContent,
|
|
6776
|
+
{
|
|
6777
|
+
align,
|
|
6778
|
+
sideOffset: 20,
|
|
6779
|
+
"aria-label": title,
|
|
6780
|
+
style: { width: "min(380px, calc(100vw - 2rem))", padding: 0 },
|
|
6781
|
+
className: cn(
|
|
6782
|
+
"cnc-overflow-hidden cnc-rounded-lg cnc-border cnc-border-brand-gray-50 cnc-bg-white cnc-shadow-custom",
|
|
6783
|
+
contentClassName
|
|
6784
|
+
),
|
|
6785
|
+
children: [
|
|
6786
|
+
/* @__PURE__ */ jsxs33("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: [
|
|
6787
|
+
/* @__PURE__ */ jsx42("h2", { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: title }),
|
|
6788
|
+
naoLidas > 0 && /* @__PURE__ */ jsx42("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` })
|
|
6789
|
+
] }),
|
|
6790
|
+
/* @__PURE__ */ jsx42("div", { className: "cnc-max-h-[360px] cnc-overflow-y-auto", children: renderarConteudo() }),
|
|
6791
|
+
footer ? /* @__PURE__ */ jsx42("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: footer }) : temRodapePadrao && /* @__PURE__ */ jsx42("div", { className: "cnc-flex cnc-justify-end cnc-border-t cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: /* @__PURE__ */ jsx42(
|
|
6792
|
+
"button",
|
|
6793
|
+
{
|
|
6794
|
+
type: "button",
|
|
6795
|
+
onClick: marcarTodas,
|
|
6796
|
+
className: cn(
|
|
6797
|
+
"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",
|
|
6798
|
+
anelDeFoco
|
|
6799
|
+
),
|
|
6800
|
+
children: "Marcar todas como lidas"
|
|
6801
|
+
}
|
|
6802
|
+
) })
|
|
6803
|
+
]
|
|
6804
|
+
}
|
|
6805
|
+
)
|
|
6806
|
+
] })
|
|
6807
|
+
] });
|
|
6808
|
+
}
|
|
6809
|
+
|
|
6810
|
+
// src/alertas/alertas.tsx
|
|
6811
|
+
import * as React32 from "react";
|
|
6812
|
+
|
|
6813
|
+
// src/alertas/formulario-alerta.tsx
|
|
6814
|
+
import * as React30 from "react";
|
|
6815
|
+
|
|
6816
|
+
// src/alertas/date-utils.ts
|
|
6817
|
+
function obterHojeDataHoraIsoLocal() {
|
|
6818
|
+
const hoje = /* @__PURE__ */ new Date();
|
|
6819
|
+
const ano = hoje.getFullYear();
|
|
6820
|
+
const mes = String(hoje.getMonth() + 1).padStart(2, "0");
|
|
6821
|
+
const dia = String(hoje.getDate()).padStart(2, "0");
|
|
6822
|
+
const horas = String(hoje.getHours()).padStart(2, "0");
|
|
6823
|
+
const minutos = String(hoje.getMinutes()).padStart(2, "0");
|
|
6824
|
+
return `${ano}-${mes}-${dia}T${horas}:${minutos}`;
|
|
6825
|
+
}
|
|
6826
|
+
function datetimeLocalParaIsoComOffset(valorInput) {
|
|
6827
|
+
if (!valorInput) return valorInput;
|
|
6828
|
+
const data = new Date(valorInput);
|
|
6829
|
+
if (isNaN(data.getTime())) return valorInput;
|
|
6830
|
+
const offsetMinutos = data.getTimezoneOffset();
|
|
6831
|
+
const sinal = offsetMinutos <= 0 ? "+" : "-";
|
|
6832
|
+
const absOffset = Math.abs(offsetMinutos);
|
|
6833
|
+
const offsetHoras = String(Math.floor(absOffset / 60)).padStart(2, "0");
|
|
6834
|
+
const offsetMins = String(absOffset % 60).padStart(2, "0");
|
|
6835
|
+
const ano = data.getFullYear();
|
|
6836
|
+
const mes = String(data.getMonth() + 1).padStart(2, "0");
|
|
6837
|
+
const dia = String(data.getDate()).padStart(2, "0");
|
|
6838
|
+
const horas = String(data.getHours()).padStart(2, "0");
|
|
6839
|
+
const minutos = String(data.getMinutes()).padStart(2, "0");
|
|
6840
|
+
return `${ano}-${mes}-${dia}T${horas}:${minutos}:00${sinal}${offsetHoras}:${offsetMins}`;
|
|
6841
|
+
}
|
|
6842
|
+
function formatarDataParaExibicao(iso) {
|
|
6843
|
+
if (!iso) return "";
|
|
6844
|
+
const dataObj = new Date(iso);
|
|
6845
|
+
if (isNaN(dataObj.getTime())) return "";
|
|
6846
|
+
const dia = String(dataObj.getDate()).padStart(2, "0");
|
|
6847
|
+
const mes = String(dataObj.getMonth() + 1).padStart(2, "0");
|
|
6848
|
+
const ano = dataObj.getFullYear();
|
|
6849
|
+
const horas = String(dataObj.getHours()).padStart(2, "0");
|
|
6850
|
+
const minutos = String(dataObj.getMinutes()).padStart(2, "0");
|
|
6851
|
+
return `${dia}/${mes}/${ano} \xE0s ${horas}:${minutos}`;
|
|
6852
|
+
}
|
|
6853
|
+
|
|
6854
|
+
// src/alertas/formulario-alerta.tsx
|
|
6855
|
+
import { jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6856
|
+
var FORM_VAZIO = {
|
|
6857
|
+
titulo: "",
|
|
6858
|
+
dataReferencia: "",
|
|
6859
|
+
lembrarNoDia: true,
|
|
6860
|
+
diasAntes: "",
|
|
6861
|
+
alertasDiasAntes: [],
|
|
6862
|
+
novoAlertaDiasAntes: "",
|
|
6863
|
+
mensagem: "",
|
|
6864
|
+
enviarEmail: false
|
|
6865
|
+
};
|
|
6866
|
+
function normalizarAlertasDiasAntes(values) {
|
|
6867
|
+
const alertas = [...values.alertasDiasAntes];
|
|
6868
|
+
if (values.novoAlertaDiasAntes.trim()) {
|
|
6869
|
+
alertas.push(values.novoAlertaDiasAntes.trim());
|
|
6870
|
+
}
|
|
6871
|
+
return Array.from(new Set(alertas.map(Number))).sort((a, b) => a - b);
|
|
6872
|
+
}
|
|
6873
|
+
function construirPayload(values) {
|
|
6874
|
+
const alertasNumericos = normalizarAlertasDiasAntes(values);
|
|
6875
|
+
const diasAntes = alertasNumericos.length ? Math.max(...alertasNumericos) : values.diasAntes.trim() ? Number(values.diasAntes) : 0;
|
|
6876
|
+
return {
|
|
6877
|
+
titulo: values.titulo.trim(),
|
|
6878
|
+
dataReferencia: datetimeLocalParaIsoComOffset(values.dataReferencia),
|
|
6879
|
+
lembrarNoDia: values.lembrarNoDia,
|
|
6880
|
+
diasAntes,
|
|
6881
|
+
alertasDiasAntes: alertasNumericos,
|
|
6882
|
+
mensagem: values.mensagem.trim() || void 0,
|
|
6883
|
+
enviarEmail: values.enviarEmail
|
|
6884
|
+
};
|
|
6885
|
+
}
|
|
6886
|
+
function preencherFormDoAlerta(alerta) {
|
|
6887
|
+
const alertasDiasAntes = alerta.alertasDiasAntes && alerta.alertasDiasAntes.length > 0 ? alerta.alertasDiasAntes.map(String) : alerta.diasAntes > 0 ? [String(alerta.diasAntes)] : [];
|
|
6888
|
+
const dataObj = new Date(alerta.dataReferencia);
|
|
6889
|
+
const formatada = isNaN(dataObj.getTime()) ? "" : (() => {
|
|
6890
|
+
const ano = dataObj.getFullYear();
|
|
6891
|
+
const mes = String(dataObj.getMonth() + 1).padStart(2, "0");
|
|
6892
|
+
const dia = String(dataObj.getDate()).padStart(2, "0");
|
|
6893
|
+
const horas = String(dataObj.getHours()).padStart(2, "0");
|
|
6894
|
+
const minutos = String(dataObj.getMinutes()).padStart(2, "0");
|
|
6895
|
+
return `${ano}-${mes}-${dia}T${horas}:${minutos}`;
|
|
6896
|
+
})();
|
|
6897
|
+
return {
|
|
6898
|
+
titulo: alerta.titulo,
|
|
6899
|
+
dataReferencia: formatada,
|
|
6900
|
+
lembrarNoDia: alerta.lembrarNoDia ?? alerta.diasAntes === 0,
|
|
6901
|
+
diasAntes: alerta.diasAntes ? String(alerta.diasAntes) : "",
|
|
6902
|
+
alertasDiasAntes,
|
|
6903
|
+
novoAlertaDiasAntes: "",
|
|
6904
|
+
mensagem: alerta.mensagem ?? "",
|
|
6905
|
+
enviarEmail: alerta.enviarEmail ?? false
|
|
6906
|
+
};
|
|
6907
|
+
}
|
|
6908
|
+
function validarForm(values) {
|
|
6909
|
+
if (!values.titulo.trim()) return "Informe o titulo do alerta";
|
|
6910
|
+
if (!values.dataReferencia) return "Informe a data do alerta";
|
|
6911
|
+
if (new Date(values.dataReferencia) < /* @__PURE__ */ new Date()) {
|
|
6912
|
+
return "Informe uma data e hora igual ou posterior ao momento atual";
|
|
6913
|
+
}
|
|
6914
|
+
if (values.diasAntes.trim() && values.diasAntes !== "0") {
|
|
6915
|
+
const diasAntes = Number(values.diasAntes);
|
|
6916
|
+
if (!Number.isInteger(diasAntes) || diasAntes < 0) {
|
|
6917
|
+
return "Informe uma quantidade de dias maior ou igual a zero";
|
|
6918
|
+
}
|
|
6919
|
+
}
|
|
6920
|
+
if (values.novoAlertaDiasAntes.trim()) {
|
|
6921
|
+
const novoAlerta = Number(values.novoAlertaDiasAntes);
|
|
6922
|
+
if (!Number.isInteger(novoAlerta) || novoAlerta <= 0) {
|
|
6923
|
+
return "Informe uma quantidade de dias maior que zero";
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
return "";
|
|
6927
|
+
}
|
|
6928
|
+
function OpcaoAlerta({ checked, label, onChange }) {
|
|
6929
|
+
return /* @__PURE__ */ jsxs34("label", { className: "alerta-opcao", children: [
|
|
6930
|
+
/* @__PURE__ */ jsx43(
|
|
6931
|
+
"input",
|
|
6932
|
+
{
|
|
6933
|
+
type: "checkbox",
|
|
6934
|
+
checked,
|
|
6935
|
+
onChange: (e) => onChange(e.target.checked),
|
|
6936
|
+
className: "alerta-checkbox"
|
|
6937
|
+
}
|
|
6938
|
+
),
|
|
6939
|
+
label
|
|
6940
|
+
] });
|
|
6941
|
+
}
|
|
6942
|
+
function FormularioAlerta({
|
|
6943
|
+
alertaEmEdicao,
|
|
6944
|
+
isSaving = false,
|
|
6945
|
+
onSalvar,
|
|
6946
|
+
onCancelar
|
|
6947
|
+
}) {
|
|
6948
|
+
const [values, setValues] = React30.useState(
|
|
6949
|
+
() => alertaEmEdicao ? preencherFormDoAlerta(alertaEmEdicao) : FORM_VAZIO
|
|
6950
|
+
);
|
|
6951
|
+
const [erro, setErro] = React30.useState("");
|
|
6952
|
+
const [hojeDataHoraIso, setHojeDataHoraIso] = React30.useState("");
|
|
6953
|
+
React30.useEffect(() => {
|
|
6954
|
+
setHojeDataHoraIso(obterHojeDataHoraIsoLocal());
|
|
6955
|
+
}, []);
|
|
6956
|
+
React30.useEffect(() => {
|
|
6957
|
+
setValues(alertaEmEdicao ? preencherFormDoAlerta(alertaEmEdicao) : FORM_VAZIO);
|
|
6958
|
+
setErro("");
|
|
6959
|
+
}, [alertaEmEdicao]);
|
|
6960
|
+
const setField = (campo, valor) => {
|
|
6961
|
+
setErro("");
|
|
6962
|
+
setValues((prev) => ({ ...prev, [campo]: valor }));
|
|
6963
|
+
};
|
|
6964
|
+
const toggleLembrarNoDia = (checked) => {
|
|
6965
|
+
setErro("");
|
|
6966
|
+
setValues((prev) => ({ ...prev, lembrarNoDia: checked }));
|
|
6967
|
+
};
|
|
6968
|
+
const toggleAlertaDiasAntes = (dias, checked) => {
|
|
6969
|
+
setErro("");
|
|
6970
|
+
setValues((prev) => {
|
|
6971
|
+
const valor = String(dias);
|
|
6972
|
+
const alertas = new Set(prev.alertasDiasAntes);
|
|
6973
|
+
if (checked) alertas.add(valor);
|
|
6974
|
+
else alertas.delete(valor);
|
|
6975
|
+
const alertasDiasAntes = Array.from(alertas).sort(
|
|
6976
|
+
(a, b) => Number(a) - Number(b)
|
|
6977
|
+
);
|
|
6978
|
+
return {
|
|
6979
|
+
...prev,
|
|
6980
|
+
alertasDiasAntes,
|
|
6981
|
+
diasAntes: alertasDiasAntes.length > 0 ? String(Math.max(...alertasDiasAntes.map(Number))) : ""
|
|
6982
|
+
};
|
|
6983
|
+
});
|
|
6984
|
+
};
|
|
6985
|
+
const adicionarAlertaDiasAntes = () => {
|
|
6986
|
+
const valor = values.novoAlertaDiasAntes.trim();
|
|
6987
|
+
const dias = Number(valor);
|
|
6988
|
+
if (!Number.isInteger(dias) || dias <= 0) {
|
|
6989
|
+
setErro("Informe uma quantidade de dias maior que zero");
|
|
6990
|
+
return;
|
|
6991
|
+
}
|
|
6992
|
+
setErro("");
|
|
6993
|
+
setValues((prev) => {
|
|
6994
|
+
const alertas = new Set(prev.alertasDiasAntes);
|
|
6995
|
+
alertas.add(String(dias));
|
|
6996
|
+
const alertasDiasAntes = Array.from(alertas).sort(
|
|
6997
|
+
(a, b) => Number(a) - Number(b)
|
|
6998
|
+
);
|
|
6999
|
+
return {
|
|
7000
|
+
...prev,
|
|
7001
|
+
diasAntes: String(Math.max(...alertasDiasAntes.map(Number))),
|
|
7002
|
+
novoAlertaDiasAntes: "",
|
|
7003
|
+
alertasDiasAntes
|
|
7004
|
+
};
|
|
7005
|
+
});
|
|
7006
|
+
};
|
|
7007
|
+
const removerAlertaDiasAntes = (valor) => {
|
|
7008
|
+
setValues((prev) => {
|
|
7009
|
+
const alertasDiasAntes = prev.alertasDiasAntes.filter((item) => item !== valor);
|
|
7010
|
+
return {
|
|
7011
|
+
...prev,
|
|
7012
|
+
alertasDiasAntes,
|
|
7013
|
+
diasAntes: alertasDiasAntes.length > 0 ? String(Math.max(...alertasDiasAntes.map(Number))) : ""
|
|
7014
|
+
};
|
|
7015
|
+
});
|
|
7016
|
+
};
|
|
7017
|
+
const handleSalvar = () => {
|
|
7018
|
+
const mensagemErro = validarForm(values);
|
|
7019
|
+
if (mensagemErro) {
|
|
7020
|
+
setErro(mensagemErro);
|
|
7021
|
+
return;
|
|
7022
|
+
}
|
|
7023
|
+
onSalvar(construirPayload(values));
|
|
7024
|
+
};
|
|
7025
|
+
const alertasPersonalizados = values.alertasDiasAntes.filter(
|
|
7026
|
+
(d) => !["2", "7", "15", "30"].includes(d)
|
|
7027
|
+
);
|
|
7028
|
+
return /* @__PURE__ */ jsxs34("section", { className: "alerta-form-section", children: [
|
|
7029
|
+
/* @__PURE__ */ jsx43("div", { className: "alerta-form-header", children: /* @__PURE__ */ jsx43("h2", { className: "alerta-form-titulo", children: alertaEmEdicao ? "Editar alerta" : "Novo alerta" }) }),
|
|
7030
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-form-grid", children: [
|
|
7031
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-campo", children: [
|
|
7032
|
+
/* @__PURE__ */ jsxs34("label", { htmlFor: "alerta-titulo", className: "alerta-label", children: [
|
|
7033
|
+
"Titulo ",
|
|
7034
|
+
/* @__PURE__ */ jsx43("span", { className: "alerta-obrigatorio", children: "*" })
|
|
7035
|
+
] }),
|
|
7036
|
+
/* @__PURE__ */ jsx43(
|
|
7037
|
+
"input",
|
|
7038
|
+
{
|
|
7039
|
+
id: "alerta-titulo",
|
|
7040
|
+
type: "text",
|
|
7041
|
+
value: values.titulo,
|
|
7042
|
+
onChange: (e) => setField("titulo", e.target.value),
|
|
7043
|
+
placeholder: "Informe o titulo do alerta",
|
|
7044
|
+
className: "alerta-input"
|
|
7045
|
+
}
|
|
7046
|
+
)
|
|
7047
|
+
] }),
|
|
7048
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-campo alerta-campo--data", children: [
|
|
7049
|
+
/* @__PURE__ */ jsxs34("label", { htmlFor: "alerta-data", className: "alerta-label", children: [
|
|
7050
|
+
"Data e Hora ",
|
|
7051
|
+
/* @__PURE__ */ jsx43("span", { className: "alerta-obrigatorio", children: "*" })
|
|
7052
|
+
] }),
|
|
7053
|
+
/* @__PURE__ */ jsx43(
|
|
7054
|
+
"input",
|
|
7055
|
+
{
|
|
7056
|
+
id: "alerta-data",
|
|
7057
|
+
type: "datetime-local",
|
|
7058
|
+
min: hojeDataHoraIso,
|
|
7059
|
+
value: values.dataReferencia,
|
|
7060
|
+
onChange: (e) => setField("dataReferencia", e.target.value),
|
|
7061
|
+
className: "alerta-input alerta-input--sm"
|
|
7062
|
+
}
|
|
7063
|
+
)
|
|
7064
|
+
] }),
|
|
7065
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-campo", children: [
|
|
7066
|
+
/* @__PURE__ */ jsx43("span", { className: "alerta-label", children: "Notifica\xE7\xF5es" }),
|
|
7067
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-notif-container", children: [
|
|
7068
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-notif-col", children: [
|
|
7069
|
+
/* @__PURE__ */ jsx43(
|
|
7070
|
+
OpcaoAlerta,
|
|
7071
|
+
{
|
|
7072
|
+
checked: values.lembrarNoDia,
|
|
7073
|
+
label: "Alertar no dia",
|
|
7074
|
+
onChange: toggleLembrarNoDia
|
|
7075
|
+
}
|
|
7076
|
+
),
|
|
7077
|
+
/* @__PURE__ */ jsx43(
|
|
7078
|
+
OpcaoAlerta,
|
|
7079
|
+
{
|
|
7080
|
+
checked: values.alertasDiasAntes.includes("2"),
|
|
7081
|
+
label: "2 dias antes",
|
|
7082
|
+
onChange: (c) => toggleAlertaDiasAntes(2, c)
|
|
5348
7083
|
}
|
|
5349
7084
|
),
|
|
5350
|
-
|
|
5351
|
-
|
|
7085
|
+
/* @__PURE__ */ jsx43(
|
|
7086
|
+
OpcaoAlerta,
|
|
5352
7087
|
{
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
7088
|
+
checked: values.alertasDiasAntes.includes("7"),
|
|
7089
|
+
label: "1 semana antes",
|
|
7090
|
+
onChange: (c) => toggleAlertaDiasAntes(7, c)
|
|
5356
7091
|
}
|
|
5357
7092
|
)
|
|
5358
|
-
]
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
7093
|
+
] }),
|
|
7094
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-notif-col", children: [
|
|
7095
|
+
/* @__PURE__ */ jsx43(
|
|
7096
|
+
OpcaoAlerta,
|
|
7097
|
+
{
|
|
7098
|
+
checked: values.alertasDiasAntes.includes("15"),
|
|
7099
|
+
label: "15 dias antes",
|
|
7100
|
+
onChange: (c) => toggleAlertaDiasAntes(15, c)
|
|
7101
|
+
}
|
|
7102
|
+
),
|
|
7103
|
+
/* @__PURE__ */ jsx43(
|
|
7104
|
+
OpcaoAlerta,
|
|
7105
|
+
{
|
|
7106
|
+
checked: values.alertasDiasAntes.includes("30"),
|
|
7107
|
+
label: "1 m\xEAs antes",
|
|
7108
|
+
onChange: (c) => toggleAlertaDiasAntes(30, c)
|
|
7109
|
+
}
|
|
7110
|
+
),
|
|
7111
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-notif-personalizado", children: [
|
|
7112
|
+
/* @__PURE__ */ jsx43(
|
|
7113
|
+
"input",
|
|
7114
|
+
{
|
|
7115
|
+
id: "alerta-dias",
|
|
7116
|
+
type: "number",
|
|
7117
|
+
min: 1,
|
|
7118
|
+
step: 1,
|
|
7119
|
+
value: values.novoAlertaDiasAntes,
|
|
7120
|
+
onChange: (e) => setField("novoAlertaDiasAntes", e.target.value),
|
|
7121
|
+
onKeyDown: (e) => {
|
|
7122
|
+
if (e.key === "Enter") {
|
|
7123
|
+
e.preventDefault();
|
|
7124
|
+
adicionarAlertaDiasAntes();
|
|
7125
|
+
}
|
|
7126
|
+
},
|
|
7127
|
+
placeholder: "Dias",
|
|
7128
|
+
className: "alerta-input alerta-input--dias"
|
|
7129
|
+
}
|
|
7130
|
+
),
|
|
7131
|
+
/* @__PURE__ */ jsxs34(
|
|
7132
|
+
"button",
|
|
7133
|
+
{
|
|
7134
|
+
type: "button",
|
|
7135
|
+
onClick: adicionarAlertaDiasAntes,
|
|
7136
|
+
className: "alerta-btn alerta-btn--outline",
|
|
7137
|
+
children: [
|
|
7138
|
+
/* @__PURE__ */ jsx43(Plus, { size: 16 }),
|
|
7139
|
+
"Adicionar"
|
|
7140
|
+
]
|
|
7141
|
+
}
|
|
7142
|
+
)
|
|
7143
|
+
] })
|
|
7144
|
+
] }),
|
|
7145
|
+
alertasPersonalizados.length > 0 && /* @__PURE__ */ jsx43("div", { className: "alerta-tags", children: alertasPersonalizados.map((dias) => /* @__PURE__ */ jsxs34("span", { className: "alerta-tag", children: [
|
|
7146
|
+
dias,
|
|
7147
|
+
" dia",
|
|
7148
|
+
Number(dias) > 1 ? "s" : "",
|
|
7149
|
+
" antes",
|
|
7150
|
+
/* @__PURE__ */ jsx43(
|
|
5379
7151
|
"button",
|
|
5380
7152
|
{
|
|
5381
7153
|
type: "button",
|
|
5382
|
-
onClick:
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
),
|
|
5387
|
-
children: "Marcar todas como lidas"
|
|
7154
|
+
onClick: () => removerAlertaDiasAntes(dias),
|
|
7155
|
+
"aria-label": `Remover alerta de ${dias} dias antes`,
|
|
7156
|
+
className: "alerta-tag-remover",
|
|
7157
|
+
children: /* @__PURE__ */ jsx43(X, { size: 14 })
|
|
5388
7158
|
}
|
|
5389
|
-
)
|
|
5390
|
-
]
|
|
7159
|
+
)
|
|
7160
|
+
] }, dias)) })
|
|
7161
|
+
] })
|
|
7162
|
+
] }),
|
|
7163
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-campo", children: [
|
|
7164
|
+
/* @__PURE__ */ jsx43("label", { htmlFor: "alerta-mensagem", className: "alerta-label", children: "Mensagem" }),
|
|
7165
|
+
/* @__PURE__ */ jsx43(
|
|
7166
|
+
"textarea",
|
|
7167
|
+
{
|
|
7168
|
+
id: "alerta-mensagem",
|
|
7169
|
+
value: values.mensagem,
|
|
7170
|
+
onChange: (e) => setField("mensagem", e.target.value),
|
|
7171
|
+
placeholder: "Informe a mensagem do alerta",
|
|
7172
|
+
rows: 3,
|
|
7173
|
+
className: "alerta-textarea"
|
|
7174
|
+
}
|
|
7175
|
+
)
|
|
7176
|
+
] }),
|
|
7177
|
+
/* @__PURE__ */ jsx43("div", { className: "alerta-campo", children: /* @__PURE__ */ jsx43(
|
|
7178
|
+
OpcaoAlerta,
|
|
7179
|
+
{
|
|
7180
|
+
checked: values.enviarEmail,
|
|
7181
|
+
label: "Enviar tamb\xE9m por e-mail",
|
|
7182
|
+
onChange: (checked) => setField("enviarEmail", checked)
|
|
5391
7183
|
}
|
|
5392
|
-
)
|
|
7184
|
+
) }),
|
|
7185
|
+
erro && /* @__PURE__ */ jsx43("div", { className: "alerta-erro", children: erro }),
|
|
7186
|
+
/* @__PURE__ */ jsxs34("div", { className: "alerta-form-acoes", children: [
|
|
7187
|
+
/* @__PURE__ */ jsx43(
|
|
7188
|
+
"button",
|
|
7189
|
+
{
|
|
7190
|
+
type: "button",
|
|
7191
|
+
onClick: onCancelar,
|
|
7192
|
+
className: "alerta-btn alerta-btn--secundario",
|
|
7193
|
+
children: "Cancelar"
|
|
7194
|
+
}
|
|
7195
|
+
),
|
|
7196
|
+
/* @__PURE__ */ jsxs34(
|
|
7197
|
+
"button",
|
|
7198
|
+
{
|
|
7199
|
+
type: "button",
|
|
7200
|
+
onClick: handleSalvar,
|
|
7201
|
+
disabled: isSaving,
|
|
7202
|
+
className: "alerta-btn alerta-btn--primario",
|
|
7203
|
+
children: [
|
|
7204
|
+
/* @__PURE__ */ jsx43(Plus, { size: 16 }),
|
|
7205
|
+
isSaving ? "Salvando..." : alertaEmEdicao ? "Atualizar alerta" : "Adicionar alerta"
|
|
7206
|
+
]
|
|
7207
|
+
}
|
|
7208
|
+
)
|
|
7209
|
+
] })
|
|
7210
|
+
] })
|
|
7211
|
+
] });
|
|
7212
|
+
}
|
|
7213
|
+
|
|
7214
|
+
// src/alertas/alerta-item.tsx
|
|
7215
|
+
import { jsx as jsx44, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7216
|
+
function AlertaItem({
|
|
7217
|
+
alerta,
|
|
7218
|
+
disabled = false,
|
|
7219
|
+
selecionado = false,
|
|
7220
|
+
onEditar,
|
|
7221
|
+
onConcluir,
|
|
7222
|
+
onExcluir
|
|
7223
|
+
}) {
|
|
7224
|
+
const concluido = alerta.status === "CONCLUIDO";
|
|
7225
|
+
const cancelado = alerta.status === "CANCELADO";
|
|
7226
|
+
const podeAlterar = !concluido && !cancelado;
|
|
7227
|
+
const statusLabel = concluido ? "Concluido" : cancelado ? "Cancelado" : "Pendente";
|
|
7228
|
+
const descricaoAlertas = [
|
|
7229
|
+
alerta.lembrarNoDia ?? alerta.diasAntes === 0 ? "no dia" : null,
|
|
7230
|
+
...alerta.alertasDiasAntes && alerta.alertasDiasAntes.length > 0 ? alerta.alertasDiasAntes.map(
|
|
7231
|
+
(dias) => `${dias} dia${dias > 1 ? "s" : ""} antes`
|
|
7232
|
+
) : alerta.diasAntes > 0 ? [`${alerta.diasAntes} dia${alerta.diasAntes > 1 ? "s" : ""} antes`] : []
|
|
7233
|
+
].filter(Boolean).join(", ");
|
|
7234
|
+
return /* @__PURE__ */ jsx44(
|
|
7235
|
+
"article",
|
|
7236
|
+
{
|
|
7237
|
+
className: [
|
|
7238
|
+
"alerta-item",
|
|
7239
|
+
selecionado ? "alerta-item--selecionado" : "",
|
|
7240
|
+
concluido ? "alerta-item--concluido" : "",
|
|
7241
|
+
cancelado ? "alerta-item--cancelado" : ""
|
|
7242
|
+
].filter(Boolean).join(" "),
|
|
7243
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "alerta-item-corpo", children: [
|
|
7244
|
+
/* @__PURE__ */ jsxs35("div", { className: "alerta-item-info", children: [
|
|
7245
|
+
/* @__PURE__ */ jsxs35("div", { className: "alerta-item-topo", children: [
|
|
7246
|
+
/* @__PURE__ */ jsx44("h3", { className: "alerta-item-titulo", children: alerta.titulo }),
|
|
7247
|
+
/* @__PURE__ */ jsx44("span", { className: `alerta-status alerta-status--${statusLabel.toLowerCase()}`, children: statusLabel })
|
|
7248
|
+
] }),
|
|
7249
|
+
alerta.mensagem && /* @__PURE__ */ jsx44("p", { className: "alerta-item-mensagem", children: alerta.mensagem }),
|
|
7250
|
+
/* @__PURE__ */ jsxs35("div", { className: "alerta-item-meta", children: [
|
|
7251
|
+
/* @__PURE__ */ jsxs35("span", { className: "alerta-item-meta-linha", children: [
|
|
7252
|
+
/* @__PURE__ */ jsx44(CalendarDays, { size: 14 }),
|
|
7253
|
+
"Data ",
|
|
7254
|
+
formatarDataParaExibicao(alerta.dataReferencia)
|
|
7255
|
+
] }),
|
|
7256
|
+
/* @__PURE__ */ jsxs35("span", { className: "alerta-item-meta-linha", children: [
|
|
7257
|
+
/* @__PURE__ */ jsx44(Bell, { size: 14 }),
|
|
7258
|
+
"Notifica\xE7\xF5es: ",
|
|
7259
|
+
descricaoAlertas || "\u2014"
|
|
7260
|
+
] }),
|
|
7261
|
+
alerta.enviarEmail && /* @__PURE__ */ jsxs35("span", { className: "alerta-item-meta-linha alerta-item-email-ativo", children: [
|
|
7262
|
+
/* @__PURE__ */ jsx44("span", { className: "alerta-dot" }),
|
|
7263
|
+
"Notifica\xE7\xE3o por e-mail ativa"
|
|
7264
|
+
] }),
|
|
7265
|
+
cancelado && alerta.motivoCancelamento && /* @__PURE__ */ jsxs35("span", { className: "alerta-item-meta-linha", children: [
|
|
7266
|
+
/* @__PURE__ */ jsx44(X, { size: 14 }),
|
|
7267
|
+
"Cancelado automaticamente: ",
|
|
7268
|
+
alerta.motivoCancelamento
|
|
7269
|
+
] })
|
|
7270
|
+
] })
|
|
7271
|
+
] }),
|
|
7272
|
+
/* @__PURE__ */ jsxs35("div", { className: "alerta-item-acoes", children: [
|
|
7273
|
+
/* @__PURE__ */ jsx44(
|
|
7274
|
+
"button",
|
|
7275
|
+
{
|
|
7276
|
+
type: "button",
|
|
7277
|
+
onClick: onEditar,
|
|
7278
|
+
disabled: disabled || !podeAlterar,
|
|
7279
|
+
title: "Editar alerta",
|
|
7280
|
+
className: "alerta-btn-icone",
|
|
7281
|
+
children: /* @__PURE__ */ jsx44(Pencil, { size: 16 })
|
|
7282
|
+
}
|
|
7283
|
+
),
|
|
7284
|
+
podeAlterar && /* @__PURE__ */ jsx44(
|
|
7285
|
+
"button",
|
|
7286
|
+
{
|
|
7287
|
+
type: "button",
|
|
7288
|
+
onClick: onConcluir,
|
|
7289
|
+
disabled,
|
|
7290
|
+
title: "Concluir alerta",
|
|
7291
|
+
className: "alerta-btn-icone alerta-btn-icone--sucesso",
|
|
7292
|
+
children: /* @__PURE__ */ jsx44(Check, { size: 16 })
|
|
7293
|
+
}
|
|
7294
|
+
),
|
|
7295
|
+
/* @__PURE__ */ jsx44(
|
|
7296
|
+
"button",
|
|
7297
|
+
{
|
|
7298
|
+
type: "button",
|
|
7299
|
+
onClick: onExcluir,
|
|
7300
|
+
disabled,
|
|
7301
|
+
title: "Excluir alerta",
|
|
7302
|
+
className: "alerta-btn-icone alerta-btn-icone--perigo",
|
|
7303
|
+
children: /* @__PURE__ */ jsx44(Trash2, { size: 16 })
|
|
7304
|
+
}
|
|
7305
|
+
)
|
|
7306
|
+
] })
|
|
7307
|
+
] })
|
|
7308
|
+
}
|
|
7309
|
+
);
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7312
|
+
// src/alertas/usar-alertas.ts
|
|
7313
|
+
import * as React31 from "react";
|
|
7314
|
+
|
|
7315
|
+
// src/alertas/cliente.ts
|
|
7316
|
+
var ErroAlertas = class _ErroAlertas extends Error {
|
|
7317
|
+
status;
|
|
7318
|
+
constructor(mensagem, status) {
|
|
7319
|
+
super(mensagem);
|
|
7320
|
+
this.name = "ErroAlertas";
|
|
7321
|
+
this.status = status;
|
|
7322
|
+
Object.setPrototypeOf(this, _ErroAlertas.prototype);
|
|
7323
|
+
}
|
|
7324
|
+
};
|
|
7325
|
+
async function buscarAlertas({
|
|
7326
|
+
baseUrl,
|
|
7327
|
+
sistema,
|
|
7328
|
+
email,
|
|
7329
|
+
fetchFn = fetch,
|
|
7330
|
+
signal,
|
|
7331
|
+
eventoId
|
|
7332
|
+
}) {
|
|
7333
|
+
const params = new URLSearchParams({ sistema, email });
|
|
7334
|
+
if (eventoId !== void 0) params.set("eventoId", String(eventoId));
|
|
7335
|
+
const url = `${normalizarBaseUrl(baseUrl)}/notificacoes?${params.toString()}`;
|
|
7336
|
+
const resposta = await fetchFn(url, {
|
|
7337
|
+
method: "GET",
|
|
7338
|
+
headers: { Accept: "application/json" },
|
|
7339
|
+
signal
|
|
7340
|
+
});
|
|
7341
|
+
if (!resposta.ok) {
|
|
7342
|
+
throw new ErroAlertas(`Falha ao buscar alertas`, resposta.status);
|
|
7343
|
+
}
|
|
7344
|
+
return await resposta.json();
|
|
7345
|
+
}
|
|
7346
|
+
|
|
7347
|
+
// src/alertas/usar-alertas.ts
|
|
7348
|
+
function foiAbortado2(erro) {
|
|
7349
|
+
return erro?.name === "AbortError";
|
|
7350
|
+
}
|
|
7351
|
+
function usarAlertas({
|
|
7352
|
+
baseUrl,
|
|
7353
|
+
sistema,
|
|
7354
|
+
email,
|
|
7355
|
+
fetchFn,
|
|
7356
|
+
eventoId,
|
|
7357
|
+
habilitado = true,
|
|
7358
|
+
onErro
|
|
7359
|
+
}) {
|
|
7360
|
+
const [alertas, setAlertas] = React31.useState([]);
|
|
7361
|
+
const [carregando, setCarregando] = React31.useState(habilitado);
|
|
7362
|
+
const controladorRef = React31.useRef(null);
|
|
7363
|
+
const jaCarregouRef = React31.useRef(false);
|
|
7364
|
+
const onErroRef = React31.useRef(onErro);
|
|
7365
|
+
const fetchFnRef = React31.useRef(fetchFn);
|
|
7366
|
+
React31.useEffect(() => {
|
|
7367
|
+
onErroRef.current = onErro;
|
|
7368
|
+
}, [onErro]);
|
|
7369
|
+
React31.useEffect(() => {
|
|
7370
|
+
fetchFnRef.current = fetchFn;
|
|
7371
|
+
}, [fetchFn]);
|
|
7372
|
+
const pronto = baseUrl !== void 0 && sistema !== void 0 && email !== void 0;
|
|
7373
|
+
const atualizar = React31.useCallback(() => {
|
|
7374
|
+
if (!habilitado || !pronto) return;
|
|
7375
|
+
controladorRef.current?.abort();
|
|
7376
|
+
const controlador = new AbortController();
|
|
7377
|
+
controladorRef.current = controlador;
|
|
7378
|
+
void (async () => {
|
|
7379
|
+
try {
|
|
7380
|
+
const lista = await buscarAlertas({
|
|
7381
|
+
baseUrl,
|
|
7382
|
+
sistema,
|
|
7383
|
+
email,
|
|
7384
|
+
fetchFn: fetchFnRef.current,
|
|
7385
|
+
eventoId,
|
|
7386
|
+
signal: controlador.signal
|
|
7387
|
+
});
|
|
7388
|
+
if (controlador.signal.aborted) return;
|
|
7389
|
+
setAlertas(lista);
|
|
7390
|
+
} catch (erro) {
|
|
7391
|
+
if (controlador.signal.aborted || foiAbortado2(erro)) return;
|
|
7392
|
+
onErroRef.current?.(erro);
|
|
7393
|
+
} finally {
|
|
7394
|
+
if (!controlador.signal.aborted) {
|
|
7395
|
+
jaCarregouRef.current = true;
|
|
7396
|
+
setCarregando(false);
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
})();
|
|
7400
|
+
}, [baseUrl, sistema, email, eventoId, habilitado, pronto]);
|
|
7401
|
+
React31.useEffect(() => {
|
|
7402
|
+
if (!habilitado || !pronto) {
|
|
7403
|
+
setCarregando(false);
|
|
7404
|
+
return;
|
|
7405
|
+
}
|
|
7406
|
+
if (!jaCarregouRef.current) setCarregando(true);
|
|
7407
|
+
atualizar();
|
|
7408
|
+
return () => controladorRef.current?.abort();
|
|
7409
|
+
}, [atualizar, habilitado, pronto]);
|
|
7410
|
+
return {
|
|
7411
|
+
alertas,
|
|
7412
|
+
carregando,
|
|
7413
|
+
atualizar
|
|
7414
|
+
};
|
|
7415
|
+
}
|
|
7416
|
+
|
|
7417
|
+
// src/alertas/alertas.tsx
|
|
7418
|
+
import { jsx as jsx45, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7419
|
+
function Alertas({
|
|
7420
|
+
alertas: alertasProps = [],
|
|
7421
|
+
isLoading = false,
|
|
7422
|
+
isSaving = false,
|
|
7423
|
+
isRemovendo = false,
|
|
7424
|
+
podeCriar = true,
|
|
7425
|
+
onCriar,
|
|
7426
|
+
onAtualizar,
|
|
7427
|
+
onConcluir,
|
|
7428
|
+
onExcluir,
|
|
7429
|
+
baseUrl = URL_PADRAO_NOTIFICACOES,
|
|
7430
|
+
sistema,
|
|
7431
|
+
email,
|
|
7432
|
+
fetchFn,
|
|
7433
|
+
eventoId,
|
|
7434
|
+
onErro
|
|
7435
|
+
}) {
|
|
7436
|
+
const [formAberto, setFormAberto] = React32.useState(false);
|
|
7437
|
+
const [alertaEmEdicao, setAlertaEmEdicao] = React32.useState(null);
|
|
7438
|
+
const [salvandoLocal, setSalvandoLocal] = React32.useState(false);
|
|
7439
|
+
const [removendoLocal, setRemovendoLocal] = React32.useState(false);
|
|
7440
|
+
const conectado = Boolean(sistema && email);
|
|
7441
|
+
const remoto = usarAlertas({
|
|
7442
|
+
baseUrl,
|
|
7443
|
+
sistema,
|
|
7444
|
+
email,
|
|
7445
|
+
fetchFn,
|
|
7446
|
+
eventoId,
|
|
7447
|
+
habilitado: conectado,
|
|
7448
|
+
onErro
|
|
7449
|
+
});
|
|
7450
|
+
const alertas = conectado ? remoto.alertas : alertasProps;
|
|
7451
|
+
const carregando = conectado ? remoto.carregando : isLoading;
|
|
7452
|
+
const salvando = salvandoLocal || isSaving;
|
|
7453
|
+
const removendo = removendoLocal || isRemovendo;
|
|
7454
|
+
const resetForm = () => {
|
|
7455
|
+
setFormAberto(false);
|
|
7456
|
+
setAlertaEmEdicao(null);
|
|
7457
|
+
};
|
|
7458
|
+
const abrirNovoAlerta = () => {
|
|
7459
|
+
setAlertaEmEdicao(null);
|
|
7460
|
+
setFormAberto(true);
|
|
7461
|
+
};
|
|
7462
|
+
const abrirEdicao = (alerta) => {
|
|
7463
|
+
setAlertaEmEdicao(alerta);
|
|
7464
|
+
setFormAberto(true);
|
|
7465
|
+
};
|
|
7466
|
+
const handleSalvar = async (payload) => {
|
|
7467
|
+
setSalvandoLocal(true);
|
|
7468
|
+
try {
|
|
7469
|
+
if (alertaEmEdicao) {
|
|
7470
|
+
await onAtualizar?.(alertaEmEdicao.id, payload);
|
|
7471
|
+
} else {
|
|
7472
|
+
await onCriar?.(payload);
|
|
7473
|
+
}
|
|
7474
|
+
if (conectado) remoto.atualizar();
|
|
7475
|
+
resetForm();
|
|
7476
|
+
} catch (err) {
|
|
7477
|
+
console.error("Erro ao salvar alerta:", err);
|
|
7478
|
+
onErro?.(err);
|
|
7479
|
+
} finally {
|
|
7480
|
+
setSalvandoLocal(false);
|
|
7481
|
+
}
|
|
7482
|
+
};
|
|
7483
|
+
const handleConcluir = async (alertaId) => {
|
|
7484
|
+
setRemovendoLocal(true);
|
|
7485
|
+
try {
|
|
7486
|
+
await onConcluir?.(alertaId);
|
|
7487
|
+
if (conectado) remoto.atualizar();
|
|
7488
|
+
} catch (err) {
|
|
7489
|
+
console.error("Erro ao concluir alerta:", err);
|
|
7490
|
+
onErro?.(err);
|
|
7491
|
+
} finally {
|
|
7492
|
+
setRemovendoLocal(false);
|
|
7493
|
+
}
|
|
7494
|
+
};
|
|
7495
|
+
const handleExcluir = (alerta) => {
|
|
7496
|
+
if (!window.confirm(`Tem certeza que deseja excluir o alerta "${alerta.titulo}"?`)) return;
|
|
7497
|
+
void (async () => {
|
|
7498
|
+
setRemovendoLocal(true);
|
|
7499
|
+
try {
|
|
7500
|
+
await onExcluir?.(alerta);
|
|
7501
|
+
if (conectado) remoto.atualizar();
|
|
7502
|
+
} catch (err) {
|
|
7503
|
+
console.error("Erro ao excluir alerta:", err);
|
|
7504
|
+
onErro?.(err);
|
|
7505
|
+
} finally {
|
|
7506
|
+
setRemovendoLocal(false);
|
|
7507
|
+
}
|
|
7508
|
+
})();
|
|
7509
|
+
};
|
|
7510
|
+
return /* @__PURE__ */ jsxs36("div", { className: "alertas-container", children: [
|
|
7511
|
+
!formAberto && podeCriar && /* @__PURE__ */ jsx45("div", { className: "alertas-nova-acao", children: /* @__PURE__ */ jsxs36(
|
|
7512
|
+
"button",
|
|
7513
|
+
{
|
|
7514
|
+
type: "button",
|
|
7515
|
+
onClick: abrirNovoAlerta,
|
|
7516
|
+
className: "alerta-btn alerta-btn--primario",
|
|
7517
|
+
children: [
|
|
7518
|
+
/* @__PURE__ */ jsx45(Plus, { size: 16 }),
|
|
7519
|
+
"Novo alerta"
|
|
7520
|
+
]
|
|
7521
|
+
}
|
|
7522
|
+
) }),
|
|
7523
|
+
formAberto && /* @__PURE__ */ jsx45(
|
|
7524
|
+
FormularioAlerta,
|
|
7525
|
+
{
|
|
7526
|
+
alertaEmEdicao,
|
|
7527
|
+
isSaving: salvando,
|
|
7528
|
+
onSalvar: handleSalvar,
|
|
7529
|
+
onCancelar: resetForm
|
|
7530
|
+
}
|
|
7531
|
+
),
|
|
7532
|
+
/* @__PURE__ */ jsxs36("section", { className: "alertas-lista-section", children: [
|
|
7533
|
+
/* @__PURE__ */ jsx45("div", { className: "alertas-lista-header", children: /* @__PURE__ */ jsxs36("h2", { className: "alertas-lista-titulo", children: [
|
|
7534
|
+
"Alertas cadastrados (",
|
|
7535
|
+
alertas.length,
|
|
7536
|
+
")"
|
|
7537
|
+
] }) }),
|
|
7538
|
+
carregando ? /* @__PURE__ */ jsx45("div", { className: "alertas-estado", children: "Carregando alertas..." }) : alertas.length === 0 ? /* @__PURE__ */ jsxs36("div", { className: "alertas-vazio", children: [
|
|
7539
|
+
/* @__PURE__ */ jsx45(Bell, { size: 32, className: "alertas-vazio-icone" }),
|
|
7540
|
+
/* @__PURE__ */ jsx45("p", { className: "alertas-vazio-texto", children: "Nenhum alerta cadastrado." })
|
|
7541
|
+
] }) : /* @__PURE__ */ jsx45("div", { className: "alertas-lista", children: alertas.map((alerta) => /* @__PURE__ */ jsx45(
|
|
7542
|
+
AlertaItem,
|
|
7543
|
+
{
|
|
7544
|
+
alerta,
|
|
7545
|
+
disabled: removendo,
|
|
7546
|
+
selecionado: alertaEmEdicao?.id === alerta.id,
|
|
7547
|
+
onEditar: () => abrirEdicao(alerta),
|
|
7548
|
+
onConcluir: () => handleConcluir(alerta.id),
|
|
7549
|
+
onExcluir: () => handleExcluir(alerta)
|
|
7550
|
+
},
|
|
7551
|
+
alerta.id
|
|
7552
|
+
)) })
|
|
5393
7553
|
] })
|
|
5394
7554
|
] });
|
|
5395
7555
|
}
|
|
5396
7556
|
export {
|
|
7557
|
+
AlertaItem,
|
|
7558
|
+
Alertas,
|
|
5397
7559
|
AplicationsHeader,
|
|
5398
7560
|
AppsMenu,
|
|
7561
|
+
Avatar,
|
|
5399
7562
|
Badge,
|
|
5400
7563
|
Button,
|
|
5401
7564
|
Card,
|
|
@@ -5418,6 +7581,9 @@ export {
|
|
|
5418
7581
|
CommandList,
|
|
5419
7582
|
CommandSeparator,
|
|
5420
7583
|
CommandShortcut,
|
|
7584
|
+
ConfirmDialog,
|
|
7585
|
+
DIAS_SEMANA_PT_BR,
|
|
7586
|
+
DateTimeRangeList,
|
|
5421
7587
|
Dialog,
|
|
5422
7588
|
DialogClose,
|
|
5423
7589
|
DialogContent,
|
|
@@ -5428,6 +7594,19 @@ export {
|
|
|
5428
7594
|
DialogPortal,
|
|
5429
7595
|
DialogTitle,
|
|
5430
7596
|
DialogTrigger,
|
|
7597
|
+
Drawer,
|
|
7598
|
+
DrawerBody,
|
|
7599
|
+
DrawerClose,
|
|
7600
|
+
DrawerContent,
|
|
7601
|
+
DrawerContext,
|
|
7602
|
+
DrawerDescription,
|
|
7603
|
+
DrawerFooter,
|
|
7604
|
+
DrawerHeader,
|
|
7605
|
+
DrawerOverlay,
|
|
7606
|
+
DrawerPortal,
|
|
7607
|
+
DrawerProvider,
|
|
7608
|
+
DrawerTitle,
|
|
7609
|
+
DrawerTrigger,
|
|
5431
7610
|
DropdownMenu,
|
|
5432
7611
|
DropdownMenuCheckboxItem,
|
|
5433
7612
|
DropdownMenuContent,
|
|
@@ -5443,24 +7622,37 @@ export {
|
|
|
5443
7622
|
DropdownMenuSubContent,
|
|
5444
7623
|
DropdownMenuSubTrigger,
|
|
5445
7624
|
DropdownMenuTrigger,
|
|
7625
|
+
EmptyState,
|
|
7626
|
+
ErroAlertas,
|
|
5446
7627
|
ErroNotificacoes,
|
|
7628
|
+
FileList,
|
|
7629
|
+
FileUpload,
|
|
5447
7630
|
Filter,
|
|
7631
|
+
FormularioAlerta,
|
|
5448
7632
|
Header,
|
|
5449
7633
|
HeaderContainer,
|
|
5450
7634
|
HeaderNotifications,
|
|
5451
7635
|
HeaderProfileHeader,
|
|
5452
7636
|
HeaderProfileItem,
|
|
5453
7637
|
Input,
|
|
7638
|
+
LabelValue,
|
|
7639
|
+
MESES_PT_BR,
|
|
7640
|
+
MESES_PT_BR_ABREV,
|
|
7641
|
+
MiniMonthCalendar,
|
|
5454
7642
|
Modal,
|
|
5455
7643
|
ModalEntidade,
|
|
5456
7644
|
ModalMudancaEntidade,
|
|
7645
|
+
MonthYearPicker,
|
|
7646
|
+
MultiSelect,
|
|
5457
7647
|
PageHeader,
|
|
5458
7648
|
PageHeaderActionsContainer,
|
|
5459
7649
|
PageHeaderTitle,
|
|
5460
7650
|
PageHeaderTitleContent,
|
|
7651
|
+
PeriodRangeList,
|
|
5461
7652
|
Popover,
|
|
5462
7653
|
PopoverContent,
|
|
5463
7654
|
PopoverTrigger,
|
|
7655
|
+
ResultMetadata,
|
|
5464
7656
|
Select,
|
|
5465
7657
|
SelectContent,
|
|
5466
7658
|
SelectGroup,
|
|
@@ -5483,10 +7675,25 @@ export {
|
|
|
5483
7675
|
TabsContent,
|
|
5484
7676
|
TabsList,
|
|
5485
7677
|
TabsTrigger,
|
|
7678
|
+
Textarea,
|
|
5486
7679
|
Title2 as Title,
|
|
7680
|
+
Tooltip,
|
|
5487
7681
|
URL_PADRAO_NOTIFICACOES,
|
|
5488
7682
|
availableApps,
|
|
5489
|
-
|
|
7683
|
+
buildMonthDays,
|
|
7684
|
+
buscarAlertas,
|
|
7685
|
+
buttonVariants,
|
|
7686
|
+
formatDayAriaLabel,
|
|
7687
|
+
formatFileSize,
|
|
7688
|
+
formatMonthYear,
|
|
7689
|
+
isSameDay,
|
|
7690
|
+
isToday,
|
|
7691
|
+
normalizarBaseUrl,
|
|
7692
|
+
toDateKey,
|
|
7693
|
+
toLocalNoon,
|
|
7694
|
+
usarAlertas,
|
|
7695
|
+
useDrawer,
|
|
7696
|
+
validateFiles
|
|
5490
7697
|
};
|
|
5491
7698
|
/*! Bundled license information:
|
|
5492
7699
|
|
|
@@ -5546,6 +7753,14 @@ lucide-react/dist/esm/icons/bell.js:
|
|
|
5546
7753
|
* See the LICENSE file in the root directory of this source tree.
|
|
5547
7754
|
*)
|
|
5548
7755
|
|
|
7756
|
+
lucide-react/dist/esm/icons/calendar-days.js:
|
|
7757
|
+
(**
|
|
7758
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7759
|
+
*
|
|
7760
|
+
* This source code is licensed under the ISC license.
|
|
7761
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7762
|
+
*)
|
|
7763
|
+
|
|
5549
7764
|
lucide-react/dist/esm/icons/check.js:
|
|
5550
7765
|
(**
|
|
5551
7766
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5562,6 +7777,14 @@ lucide-react/dist/esm/icons/chevron-down.js:
|
|
|
5562
7777
|
* See the LICENSE file in the root directory of this source tree.
|
|
5563
7778
|
*)
|
|
5564
7779
|
|
|
7780
|
+
lucide-react/dist/esm/icons/chevron-left.js:
|
|
7781
|
+
(**
|
|
7782
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7783
|
+
*
|
|
7784
|
+
* This source code is licensed under the ISC license.
|
|
7785
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7786
|
+
*)
|
|
7787
|
+
|
|
5565
7788
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
5566
7789
|
(**
|
|
5567
7790
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5594,6 +7817,30 @@ lucide-react/dist/esm/icons/circle.js:
|
|
|
5594
7817
|
* See the LICENSE file in the root directory of this source tree.
|
|
5595
7818
|
*)
|
|
5596
7819
|
|
|
7820
|
+
lucide-react/dist/esm/icons/download.js:
|
|
7821
|
+
(**
|
|
7822
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7823
|
+
*
|
|
7824
|
+
* This source code is licensed under the ISC license.
|
|
7825
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7826
|
+
*)
|
|
7827
|
+
|
|
7828
|
+
lucide-react/dist/esm/icons/external-link.js:
|
|
7829
|
+
(**
|
|
7830
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7831
|
+
*
|
|
7832
|
+
* This source code is licensed under the ISC license.
|
|
7833
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7834
|
+
*)
|
|
7835
|
+
|
|
7836
|
+
lucide-react/dist/esm/icons/file-text.js:
|
|
7837
|
+
(**
|
|
7838
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7839
|
+
*
|
|
7840
|
+
* This source code is licensed under the ISC license.
|
|
7841
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7842
|
+
*)
|
|
7843
|
+
|
|
5597
7844
|
lucide-react/dist/esm/icons/filter-x.js:
|
|
5598
7845
|
(**
|
|
5599
7846
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5642,6 +7889,30 @@ lucide-react/dist/esm/icons/mail.js:
|
|
|
5642
7889
|
* See the LICENSE file in the root directory of this source tree.
|
|
5643
7890
|
*)
|
|
5644
7891
|
|
|
7892
|
+
lucide-react/dist/esm/icons/paperclip.js:
|
|
7893
|
+
(**
|
|
7894
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7895
|
+
*
|
|
7896
|
+
* This source code is licensed under the ISC license.
|
|
7897
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7898
|
+
*)
|
|
7899
|
+
|
|
7900
|
+
lucide-react/dist/esm/icons/pencil.js:
|
|
7901
|
+
(**
|
|
7902
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7903
|
+
*
|
|
7904
|
+
* This source code is licensed under the ISC license.
|
|
7905
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7906
|
+
*)
|
|
7907
|
+
|
|
7908
|
+
lucide-react/dist/esm/icons/plus.js:
|
|
7909
|
+
(**
|
|
7910
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7911
|
+
*
|
|
7912
|
+
* This source code is licensed under the ISC license.
|
|
7913
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7914
|
+
*)
|
|
7915
|
+
|
|
5645
7916
|
lucide-react/dist/esm/icons/search.js:
|
|
5646
7917
|
(**
|
|
5647
7918
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -5658,6 +7929,14 @@ lucide-react/dist/esm/icons/trash-2.js:
|
|
|
5658
7929
|
* See the LICENSE file in the root directory of this source tree.
|
|
5659
7930
|
*)
|
|
5660
7931
|
|
|
7932
|
+
lucide-react/dist/esm/icons/user.js:
|
|
7933
|
+
(**
|
|
7934
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7935
|
+
*
|
|
7936
|
+
* This source code is licensed under the ISC license.
|
|
7937
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7938
|
+
*)
|
|
7939
|
+
|
|
5661
7940
|
lucide-react/dist/esm/icons/x.js:
|
|
5662
7941
|
(**
|
|
5663
7942
|
* @license lucide-react v0.453.0 - ISC
|