@cnc-ti/layout-basic 8.4.0 → 8.6.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/README.md +59 -0
- package/dist/index.css +480 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +609 -37
- package/dist/index.d.ts +609 -37
- package/dist/index.js +2672 -323
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2629 -323
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -3
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";
|
|
@@ -135,6 +131,28 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
135
131
|
return Component;
|
|
136
132
|
};
|
|
137
133
|
|
|
134
|
+
// ../../node_modules/lucide-react/dist/esm/icons/bell-off.js
|
|
135
|
+
var BellOff = createLucideIcon("BellOff", [
|
|
136
|
+
["path", { d: "M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5", key: "o7mx20" }],
|
|
137
|
+
["path", { d: "M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7", key: "16f1lm" }],
|
|
138
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }],
|
|
139
|
+
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
// ../../node_modules/lucide-react/dist/esm/icons/bell-ring.js
|
|
143
|
+
var BellRing = createLucideIcon("BellRing", [
|
|
144
|
+
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
145
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }],
|
|
146
|
+
["path", { d: "M4 2C2.8 3.7 2 5.7 2 8", key: "tap9e0" }],
|
|
147
|
+
["path", { d: "M22 8c0-2.3-.8-4.3-2-6", key: "5bb3ad" }]
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
// ../../node_modules/lucide-react/dist/esm/icons/bell.js
|
|
151
|
+
var Bell = createLucideIcon("Bell", [
|
|
152
|
+
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
153
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
154
|
+
]);
|
|
155
|
+
|
|
138
156
|
// ../../node_modules/lucide-react/dist/esm/icons/check.js
|
|
139
157
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
140
158
|
|
|
@@ -143,6 +161,11 @@ var ChevronDown = createLucideIcon("ChevronDown", [
|
|
|
143
161
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
144
162
|
]);
|
|
145
163
|
|
|
164
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
|
|
165
|
+
var ChevronLeft = createLucideIcon("ChevronLeft", [
|
|
166
|
+
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
167
|
+
]);
|
|
168
|
+
|
|
146
169
|
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
147
170
|
var ChevronRight = createLucideIcon("ChevronRight", [
|
|
148
171
|
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
|
@@ -162,6 +185,29 @@ var Circle = createLucideIcon("Circle", [
|
|
|
162
185
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
|
|
163
186
|
]);
|
|
164
187
|
|
|
188
|
+
// ../../node_modules/lucide-react/dist/esm/icons/download.js
|
|
189
|
+
var Download = createLucideIcon("Download", [
|
|
190
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
191
|
+
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
192
|
+
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
193
|
+
]);
|
|
194
|
+
|
|
195
|
+
// ../../node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
196
|
+
var ExternalLink = createLucideIcon("ExternalLink", [
|
|
197
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
198
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
199
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
200
|
+
]);
|
|
201
|
+
|
|
202
|
+
// ../../node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
203
|
+
var FileText = createLucideIcon("FileText", [
|
|
204
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
205
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
206
|
+
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
207
|
+
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
208
|
+
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
209
|
+
]);
|
|
210
|
+
|
|
165
211
|
// ../../node_modules/lucide-react/dist/esm/icons/filter-x.js
|
|
166
212
|
var FilterX = createLucideIcon("FilterX", [
|
|
167
213
|
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
@@ -192,12 +238,62 @@ var LoaderCircle = createLucideIcon("LoaderCircle", [
|
|
|
192
238
|
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
193
239
|
]);
|
|
194
240
|
|
|
241
|
+
// ../../node_modules/lucide-react/dist/esm/icons/mail-open.js
|
|
242
|
+
var MailOpen = createLucideIcon("MailOpen", [
|
|
243
|
+
[
|
|
244
|
+
"path",
|
|
245
|
+
{
|
|
246
|
+
d: "M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",
|
|
247
|
+
key: "1jhwl8"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
["path", { d: "m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10", key: "1qfld7" }]
|
|
251
|
+
]);
|
|
252
|
+
|
|
253
|
+
// ../../node_modules/lucide-react/dist/esm/icons/mail.js
|
|
254
|
+
var Mail = createLucideIcon("Mail", [
|
|
255
|
+
["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }],
|
|
256
|
+
["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }]
|
|
257
|
+
]);
|
|
258
|
+
|
|
259
|
+
// ../../node_modules/lucide-react/dist/esm/icons/paperclip.js
|
|
260
|
+
var Paperclip = createLucideIcon("Paperclip", [
|
|
261
|
+
[
|
|
262
|
+
"path",
|
|
263
|
+
{
|
|
264
|
+
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",
|
|
265
|
+
key: "1u3ebp"
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
]);
|
|
269
|
+
|
|
270
|
+
// ../../node_modules/lucide-react/dist/esm/icons/plus.js
|
|
271
|
+
var Plus = createLucideIcon("Plus", [
|
|
272
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
273
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
274
|
+
]);
|
|
275
|
+
|
|
195
276
|
// ../../node_modules/lucide-react/dist/esm/icons/search.js
|
|
196
277
|
var Search = createLucideIcon("Search", [
|
|
197
278
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
198
279
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
199
280
|
]);
|
|
200
281
|
|
|
282
|
+
// ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
|
|
283
|
+
var Trash2 = createLucideIcon("Trash2", [
|
|
284
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
285
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
286
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
287
|
+
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
288
|
+
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
289
|
+
]);
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/lucide-react/dist/esm/icons/user.js
|
|
292
|
+
var User = createLucideIcon("User", [
|
|
293
|
+
["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
|
|
294
|
+
["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
|
|
295
|
+
]);
|
|
296
|
+
|
|
201
297
|
// ../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
202
298
|
var X = createLucideIcon("X", [
|
|
203
299
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
@@ -2927,6 +3023,7 @@ var HeaderContainer = ({
|
|
|
2927
3023
|
container = false,
|
|
2928
3024
|
logo,
|
|
2929
3025
|
logoLink,
|
|
3026
|
+
notifications,
|
|
2930
3027
|
children,
|
|
2931
3028
|
...props
|
|
2932
3029
|
}) => {
|
|
@@ -2976,7 +3073,10 @@ var HeaderContainer = ({
|
|
|
2976
3073
|
)
|
|
2977
3074
|
}
|
|
2978
3075
|
) : !hasSidebar && renderLogo() }),
|
|
2979
|
-
/* @__PURE__ */
|
|
3076
|
+
/* @__PURE__ */ jsxs3("div", { className: "cnc-flex", children: [
|
|
3077
|
+
notifications && /* @__PURE__ */ jsx3("div", { className: "cnc-flex cnc-items-center cnc-pr-3", children: notifications }),
|
|
3078
|
+
children
|
|
3079
|
+
] })
|
|
2980
3080
|
]
|
|
2981
3081
|
}
|
|
2982
3082
|
);
|
|
@@ -3784,15 +3884,53 @@ var Input = React9.forwardRef(
|
|
|
3784
3884
|
);
|
|
3785
3885
|
Input.displayName = "Input";
|
|
3786
3886
|
|
|
3787
|
-
// src/components/atoms/forms/
|
|
3887
|
+
// src/components/atoms/forms/textarea.tsx
|
|
3788
3888
|
import * as React10 from "react";
|
|
3789
3889
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3790
|
-
var
|
|
3890
|
+
var Textarea = React10.forwardRef(
|
|
3891
|
+
({ className, id, label, required, ...props }, ref) => {
|
|
3892
|
+
const idGenerate = id ? id : label && `field-${Date.now()}-${Math.random() * 1e5}`;
|
|
3893
|
+
return /* @__PURE__ */ jsxs12("div", { className: "cnc-w-full", children: [
|
|
3894
|
+
label && /* @__PURE__ */ jsxs12(
|
|
3895
|
+
"label",
|
|
3896
|
+
{
|
|
3897
|
+
htmlFor: idGenerate,
|
|
3898
|
+
className: "cnc-block cnc-text-sm cnc-mb-1 cnc-font-medium cnc-text-brand-gray-600",
|
|
3899
|
+
children: [
|
|
3900
|
+
label,
|
|
3901
|
+
required && /* @__PURE__ */ jsx14("span", { className: "text-red-500", children: " *" })
|
|
3902
|
+
]
|
|
3903
|
+
}
|
|
3904
|
+
),
|
|
3905
|
+
/* @__PURE__ */ jsx14(
|
|
3906
|
+
"textarea",
|
|
3907
|
+
{
|
|
3908
|
+
id: idGenerate,
|
|
3909
|
+
className: cn(
|
|
3910
|
+
"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",
|
|
3911
|
+
"placeholder:cnc-text-muted-foreground focus-visible:cnc-outline-none",
|
|
3912
|
+
"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",
|
|
3913
|
+
"not-disabled:hover:cnc-border-brand-gray-500",
|
|
3914
|
+
className
|
|
3915
|
+
),
|
|
3916
|
+
ref,
|
|
3917
|
+
...props
|
|
3918
|
+
}
|
|
3919
|
+
)
|
|
3920
|
+
] });
|
|
3921
|
+
}
|
|
3922
|
+
);
|
|
3923
|
+
Textarea.displayName = "Textarea";
|
|
3924
|
+
|
|
3925
|
+
// src/components/atoms/forms/checkbox.tsx
|
|
3926
|
+
import * as React11 from "react";
|
|
3927
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3928
|
+
var Checkbox = React11.forwardRef(
|
|
3791
3929
|
({ className, id, label, ...props }, ref) => {
|
|
3792
3930
|
console.log();
|
|
3793
3931
|
const idGenerate = id ? id : label && `field-${Date.now()}-${Math.random() * 1e5}`;
|
|
3794
|
-
return /* @__PURE__ */
|
|
3795
|
-
/* @__PURE__ */
|
|
3932
|
+
return /* @__PURE__ */ jsxs13("div", { className: "cnc-w-full cnc-flex cnc-flex-row", children: [
|
|
3933
|
+
/* @__PURE__ */ jsx15(
|
|
3796
3934
|
"input",
|
|
3797
3935
|
{
|
|
3798
3936
|
type: "checkbox",
|
|
@@ -3802,7 +3940,7 @@ var Checkbox = React10.forwardRef(
|
|
|
3802
3940
|
...props
|
|
3803
3941
|
}
|
|
3804
3942
|
),
|
|
3805
|
-
label && /* @__PURE__ */
|
|
3943
|
+
label && /* @__PURE__ */ jsx15(
|
|
3806
3944
|
"label",
|
|
3807
3945
|
{
|
|
3808
3946
|
htmlFor: idGenerate,
|
|
@@ -3816,9 +3954,9 @@ var Checkbox = React10.forwardRef(
|
|
|
3816
3954
|
Checkbox.displayName = "Checkbox";
|
|
3817
3955
|
|
|
3818
3956
|
// src/components/atoms/forms/switch.tsx
|
|
3819
|
-
import * as
|
|
3820
|
-
import { jsx as
|
|
3821
|
-
var Switch =
|
|
3957
|
+
import * as React12 from "react";
|
|
3958
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3959
|
+
var Switch = React12.forwardRef(
|
|
3822
3960
|
({
|
|
3823
3961
|
className,
|
|
3824
3962
|
id,
|
|
@@ -3832,12 +3970,12 @@ var Switch = React11.forwardRef(
|
|
|
3832
3970
|
name,
|
|
3833
3971
|
"aria-label": ariaLabel
|
|
3834
3972
|
}, ref) => {
|
|
3835
|
-
const [internalChecked, setInternalChecked] =
|
|
3973
|
+
const [internalChecked, setInternalChecked] = React12.useState(
|
|
3836
3974
|
defaultChecked ?? false
|
|
3837
3975
|
);
|
|
3838
3976
|
const isControlled = checked !== void 0;
|
|
3839
3977
|
const isChecked = isControlled ? checked : internalChecked;
|
|
3840
|
-
const reactId =
|
|
3978
|
+
const reactId = React12.useId();
|
|
3841
3979
|
const fieldId = id || reactId;
|
|
3842
3980
|
const handleToggle = () => {
|
|
3843
3981
|
if (disabled) return;
|
|
@@ -3847,8 +3985,8 @@ var Switch = React11.forwardRef(
|
|
|
3847
3985
|
}
|
|
3848
3986
|
onChange?.(newValue);
|
|
3849
3987
|
};
|
|
3850
|
-
return /* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn("cnc-flex cnc-items-center cnc-gap-2", className), children: [
|
|
3989
|
+
/* @__PURE__ */ jsx16(
|
|
3852
3990
|
"input",
|
|
3853
3991
|
{
|
|
3854
3992
|
type: "checkbox",
|
|
@@ -3860,7 +3998,7 @@ var Switch = React11.forwardRef(
|
|
|
3860
3998
|
"aria-hidden": "true"
|
|
3861
3999
|
}
|
|
3862
4000
|
),
|
|
3863
|
-
/* @__PURE__ */
|
|
4001
|
+
/* @__PURE__ */ jsx16(
|
|
3864
4002
|
"button",
|
|
3865
4003
|
{
|
|
3866
4004
|
ref,
|
|
@@ -3878,7 +4016,7 @@ var Switch = React11.forwardRef(
|
|
|
3878
4016
|
"disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50",
|
|
3879
4017
|
isChecked ? "cnc-bg-brand-blue-400 cnc-border-brand-blue-500" : "cnc-bg-brand-gray-20 cnc-border-brand-gray-100"
|
|
3880
4018
|
),
|
|
3881
|
-
children: /* @__PURE__ */
|
|
4019
|
+
children: /* @__PURE__ */ jsx16(
|
|
3882
4020
|
"span",
|
|
3883
4021
|
{
|
|
3884
4022
|
className: cn(
|
|
@@ -3889,14 +4027,14 @@ var Switch = React11.forwardRef(
|
|
|
3889
4027
|
)
|
|
3890
4028
|
}
|
|
3891
4029
|
),
|
|
3892
|
-
label && /* @__PURE__ */
|
|
4030
|
+
label && /* @__PURE__ */ jsxs14(
|
|
3893
4031
|
"label",
|
|
3894
4032
|
{
|
|
3895
4033
|
htmlFor: fieldId,
|
|
3896
4034
|
className: "cnc-text-sm cnc-font-medium cnc-text-brand-gray-600 cnc-cursor-pointer",
|
|
3897
4035
|
children: [
|
|
3898
4036
|
label,
|
|
3899
|
-
required && /* @__PURE__ */
|
|
4037
|
+
required && /* @__PURE__ */ jsx16("span", { className: "cnc-text-red-500", children: " *" })
|
|
3900
4038
|
]
|
|
3901
4039
|
}
|
|
3902
4040
|
)
|
|
@@ -3906,7 +4044,7 @@ var Switch = React11.forwardRef(
|
|
|
3906
4044
|
Switch.displayName = "Switch";
|
|
3907
4045
|
|
|
3908
4046
|
// src/components/atoms/display/badge.tsx
|
|
3909
|
-
import { jsx as
|
|
4047
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
3910
4048
|
var Badge = ({
|
|
3911
4049
|
variant = "default",
|
|
3912
4050
|
rounded = true,
|
|
@@ -3928,7 +4066,7 @@ var Badge = ({
|
|
|
3928
4066
|
md: "cnc-text-sm cnc-px-3 cnc-py-1",
|
|
3929
4067
|
lg: "cnc-text-base cnc-px-4 cnc-py-2"
|
|
3930
4068
|
};
|
|
3931
|
-
return /* @__PURE__ */
|
|
4069
|
+
return /* @__PURE__ */ jsx17(
|
|
3932
4070
|
"span",
|
|
3933
4071
|
{
|
|
3934
4072
|
className: cn(
|
|
@@ -3943,13 +4081,73 @@ var Badge = ({
|
|
|
3943
4081
|
);
|
|
3944
4082
|
};
|
|
3945
4083
|
|
|
4084
|
+
// src/components/atoms/display/avatar.tsx
|
|
4085
|
+
import * as React13 from "react";
|
|
4086
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
4087
|
+
var avatarSizeClasses = {
|
|
4088
|
+
sm: "cnc-size-8 cnc-text-[10px]",
|
|
4089
|
+
md: "cnc-size-12 cnc-text-xs",
|
|
4090
|
+
lg: "cnc-size-16 cnc-text-sm",
|
|
4091
|
+
xl: "cnc-size-24 cnc-text-xl"
|
|
4092
|
+
};
|
|
4093
|
+
var avatarSizeIcon = {
|
|
4094
|
+
sm: 16,
|
|
4095
|
+
md: 20,
|
|
4096
|
+
lg: 28,
|
|
4097
|
+
xl: 40
|
|
4098
|
+
};
|
|
4099
|
+
function Avatar({
|
|
4100
|
+
src,
|
|
4101
|
+
alt,
|
|
4102
|
+
fallback,
|
|
4103
|
+
size = "md",
|
|
4104
|
+
isLoading = false,
|
|
4105
|
+
className,
|
|
4106
|
+
...props
|
|
4107
|
+
}) {
|
|
4108
|
+
const [hasError, setHasError] = React13.useState(false);
|
|
4109
|
+
const baseClasses = cn(
|
|
4110
|
+
"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",
|
|
4111
|
+
avatarSizeClasses[size],
|
|
4112
|
+
className
|
|
4113
|
+
);
|
|
4114
|
+
if (isLoading) {
|
|
4115
|
+
return /* @__PURE__ */ jsx18(
|
|
4116
|
+
"span",
|
|
4117
|
+
{
|
|
4118
|
+
className: cn(baseClasses, "cnc-animate-pulse cnc-bg-brand-gray-50"),
|
|
4119
|
+
role: "status",
|
|
4120
|
+
"aria-label": "Carregando avatar",
|
|
4121
|
+
...props
|
|
4122
|
+
}
|
|
4123
|
+
);
|
|
4124
|
+
}
|
|
4125
|
+
const showImage = src && !hasError;
|
|
4126
|
+
return /* @__PURE__ */ jsx18("span", { className: baseClasses, ...props, children: showImage ? /* @__PURE__ */ jsx18(
|
|
4127
|
+
"img",
|
|
4128
|
+
{
|
|
4129
|
+
src,
|
|
4130
|
+
alt: alt ?? "Avatar",
|
|
4131
|
+
className: "cnc-h-full cnc-w-full cnc-object-cover",
|
|
4132
|
+
onError: () => setHasError(true)
|
|
4133
|
+
}
|
|
4134
|
+
) : fallback ? /* @__PURE__ */ jsx18("span", { className: "cnc-font-bold", children: fallback }) : /* @__PURE__ */ jsx18(
|
|
4135
|
+
User,
|
|
4136
|
+
{
|
|
4137
|
+
className: "cnc-shrink-0",
|
|
4138
|
+
size: avatarSizeIcon[size],
|
|
4139
|
+
"aria-hidden": "true"
|
|
4140
|
+
}
|
|
4141
|
+
) });
|
|
4142
|
+
}
|
|
4143
|
+
|
|
3946
4144
|
// src/components/molecules/card.tsx
|
|
3947
|
-
import { jsx as
|
|
4145
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3948
4146
|
function Card({
|
|
3949
4147
|
className,
|
|
3950
4148
|
...rest
|
|
3951
4149
|
}) {
|
|
3952
|
-
return /* @__PURE__ */
|
|
4150
|
+
return /* @__PURE__ */ jsx19(
|
|
3953
4151
|
"div",
|
|
3954
4152
|
{
|
|
3955
4153
|
className: cn(
|
|
@@ -3964,7 +4162,7 @@ function CardHeader({
|
|
|
3964
4162
|
className,
|
|
3965
4163
|
...rest
|
|
3966
4164
|
}) {
|
|
3967
|
-
return /* @__PURE__ */
|
|
4165
|
+
return /* @__PURE__ */ jsx19("div", { className: "cnc-px-6 cnc-pt-6", children: /* @__PURE__ */ jsx19(
|
|
3968
4166
|
"div",
|
|
3969
4167
|
{
|
|
3970
4168
|
className: cn(
|
|
@@ -3979,13 +4177,13 @@ function CardContent({
|
|
|
3979
4177
|
className,
|
|
3980
4178
|
...rest
|
|
3981
4179
|
}) {
|
|
3982
|
-
return /* @__PURE__ */
|
|
4180
|
+
return /* @__PURE__ */ jsx19("div", { className: cn("cnc-px-6 cnc-py-2", className), ...rest });
|
|
3983
4181
|
}
|
|
3984
4182
|
function CardFooter({
|
|
3985
4183
|
className,
|
|
3986
4184
|
...rest
|
|
3987
4185
|
}) {
|
|
3988
|
-
return /* @__PURE__ */
|
|
4186
|
+
return /* @__PURE__ */ jsx19(
|
|
3989
4187
|
"div",
|
|
3990
4188
|
{
|
|
3991
4189
|
className: cn(
|
|
@@ -4000,7 +4198,7 @@ function CardFooterItem({
|
|
|
4000
4198
|
className,
|
|
4001
4199
|
...rest
|
|
4002
4200
|
}) {
|
|
4003
|
-
return /* @__PURE__ */
|
|
4201
|
+
return /* @__PURE__ */ jsx19(
|
|
4004
4202
|
"div",
|
|
4005
4203
|
{
|
|
4006
4204
|
className: cn(
|
|
@@ -4014,7 +4212,7 @@ function CardFooterItem({
|
|
|
4014
4212
|
|
|
4015
4213
|
// src/components/molecules/collapsible.tsx
|
|
4016
4214
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
4017
|
-
import { jsx as
|
|
4215
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4018
4216
|
var Collapsible = CollapsiblePrimitive.Root;
|
|
4019
4217
|
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
4020
4218
|
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
@@ -4022,16 +4220,16 @@ var AnimatedCollapsibleContent = ({
|
|
|
4022
4220
|
className,
|
|
4023
4221
|
...rest
|
|
4024
4222
|
}) => {
|
|
4025
|
-
return /* @__PURE__ */
|
|
4223
|
+
return /* @__PURE__ */ jsx20(CollapsibleContent2, { className: "cnc-collapsible-content", ...rest });
|
|
4026
4224
|
};
|
|
4027
4225
|
|
|
4028
4226
|
// src/components/molecules/display/page-header.tsx
|
|
4029
|
-
import { jsx as
|
|
4227
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4030
4228
|
function PageHeader({
|
|
4031
4229
|
children,
|
|
4032
4230
|
className
|
|
4033
4231
|
}) {
|
|
4034
|
-
return /* @__PURE__ */
|
|
4232
|
+
return /* @__PURE__ */ jsx21(
|
|
4035
4233
|
"header",
|
|
4036
4234
|
{
|
|
4037
4235
|
className: cn(
|
|
@@ -4046,7 +4244,7 @@ function PageHeaderTitleContent({
|
|
|
4046
4244
|
children,
|
|
4047
4245
|
className
|
|
4048
4246
|
}) {
|
|
4049
|
-
return /* @__PURE__ */
|
|
4247
|
+
return /* @__PURE__ */ jsx21(
|
|
4050
4248
|
"div",
|
|
4051
4249
|
{
|
|
4052
4250
|
className: cn(
|
|
@@ -4063,16 +4261,16 @@ function PageHeaderTitle({
|
|
|
4063
4261
|
titleAs = "h1"
|
|
4064
4262
|
}) {
|
|
4065
4263
|
const ComponentTitle = titleAs;
|
|
4066
|
-
return /* @__PURE__ */
|
|
4067
|
-
/* @__PURE__ */
|
|
4068
|
-
description && /* @__PURE__ */
|
|
4264
|
+
return /* @__PURE__ */ jsxs15("div", { children: [
|
|
4265
|
+
/* @__PURE__ */ jsx21(ComponentTitle, { className: "cnc-text-2xl cnc-font-semibold cnc-text-brand-blue-600", children: title }),
|
|
4266
|
+
description && /* @__PURE__ */ jsx21("p", { className: "cnc-text-sm cnc-text-brand-gray-500", children: description })
|
|
4069
4267
|
] });
|
|
4070
4268
|
}
|
|
4071
4269
|
function PageHeaderActionsContainer({
|
|
4072
4270
|
children,
|
|
4073
4271
|
className
|
|
4074
4272
|
}) {
|
|
4075
|
-
return /* @__PURE__ */
|
|
4273
|
+
return /* @__PURE__ */ jsx21(
|
|
4076
4274
|
"div",
|
|
4077
4275
|
{
|
|
4078
4276
|
className: cn(
|
|
@@ -4084,17 +4282,151 @@ function PageHeaderActionsContainer({
|
|
|
4084
4282
|
);
|
|
4085
4283
|
}
|
|
4086
4284
|
function Title2({ title, as: Component = "h1" }) {
|
|
4087
|
-
return /* @__PURE__ */
|
|
4285
|
+
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 });
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
// src/components/molecules/display/empty-state.tsx
|
|
4289
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4290
|
+
function EmptyState({
|
|
4291
|
+
icon,
|
|
4292
|
+
title,
|
|
4293
|
+
description,
|
|
4294
|
+
action,
|
|
4295
|
+
minHeight = "cnc-min-h-48",
|
|
4296
|
+
className,
|
|
4297
|
+
...props
|
|
4298
|
+
}) {
|
|
4299
|
+
return /* @__PURE__ */ jsxs16(
|
|
4300
|
+
"div",
|
|
4301
|
+
{
|
|
4302
|
+
className: cn(
|
|
4303
|
+
"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",
|
|
4304
|
+
minHeight,
|
|
4305
|
+
className
|
|
4306
|
+
),
|
|
4307
|
+
...props,
|
|
4308
|
+
children: [
|
|
4309
|
+
/* @__PURE__ */ jsx22("div", { className: "cnc-mb-3 cnc-text-brand-gray-200", children: icon ?? /* @__PURE__ */ jsx22(FolderOpen, { className: "cnc-h-10 cnc-w-10" }) }),
|
|
4310
|
+
/* @__PURE__ */ jsx22("p", { className: "cnc-text-sm cnc-font-medium cnc-text-brand-blue-600", children: title }),
|
|
4311
|
+
description ? /* @__PURE__ */ jsx22("p", { className: "cnc-mt-1 cnc-max-w-md cnc-text-sm cnc-text-brand-gray-200", children: description }) : null,
|
|
4312
|
+
action ? /* @__PURE__ */ jsx22("div", { className: "cnc-mt-4", children: action }) : null
|
|
4313
|
+
]
|
|
4314
|
+
}
|
|
4315
|
+
);
|
|
4316
|
+
}
|
|
4317
|
+
|
|
4318
|
+
// src/components/molecules/display/result-metadata.tsx
|
|
4319
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4320
|
+
function encontradosSuffix(resourceName, forceWordGender) {
|
|
4321
|
+
if (forceWordGender === "masc") return "o";
|
|
4322
|
+
if (forceWordGender === "fem") return "a";
|
|
4323
|
+
return resourceName.endsWith("a") ? "a" : "o";
|
|
4324
|
+
}
|
|
4325
|
+
function ResultMetadata({
|
|
4326
|
+
resourceName,
|
|
4327
|
+
total,
|
|
4328
|
+
displayed,
|
|
4329
|
+
isLoading = false,
|
|
4330
|
+
forceWordGender,
|
|
4331
|
+
truncationThreshold = 30,
|
|
4332
|
+
className,
|
|
4333
|
+
...props
|
|
4334
|
+
}) {
|
|
4335
|
+
const encontradVogal = encontradosSuffix(resourceName, forceWordGender);
|
|
4336
|
+
return /* @__PURE__ */ jsxs17(
|
|
4337
|
+
"div",
|
|
4338
|
+
{
|
|
4339
|
+
className: cn("cnc-mt-4 cnc-mb-4", className),
|
|
4340
|
+
role: "status",
|
|
4341
|
+
"aria-live": "polite",
|
|
4342
|
+
...props,
|
|
4343
|
+
children: [
|
|
4344
|
+
/* @__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")}` }),
|
|
4345
|
+
displayed >= truncationThreshold && /* @__PURE__ */ jsxs17("div", { children: [
|
|
4346
|
+
"Exibindo os ",
|
|
4347
|
+
/* @__PURE__ */ jsx23("span", { className: "cnc-font-bold", children: displayed }),
|
|
4348
|
+
" primeiros registros. Utilize os filtros para refinar sua busca."
|
|
4349
|
+
] })
|
|
4350
|
+
]
|
|
4351
|
+
}
|
|
4352
|
+
);
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4355
|
+
// src/components/molecules/display/label-value.tsx
|
|
4356
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4357
|
+
function LabelValue({
|
|
4358
|
+
label,
|
|
4359
|
+
value,
|
|
4360
|
+
href,
|
|
4361
|
+
className,
|
|
4362
|
+
valueClassName
|
|
4363
|
+
}) {
|
|
4364
|
+
return /* @__PURE__ */ jsxs18("div", { className, children: [
|
|
4365
|
+
/* @__PURE__ */ jsx24("div", { className: "cnc-mb-2 cnc-text-sm cnc-font-bold cnc-leading-4 cnc-text-primary", children: label }),
|
|
4366
|
+
/* @__PURE__ */ jsxs18(
|
|
4367
|
+
"div",
|
|
4368
|
+
{
|
|
4369
|
+
className: cn(
|
|
4370
|
+
"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",
|
|
4371
|
+
valueClassName
|
|
4372
|
+
),
|
|
4373
|
+
children: [
|
|
4374
|
+
value ?? "-",
|
|
4375
|
+
href && /* @__PURE__ */ jsx24(
|
|
4376
|
+
"a",
|
|
4377
|
+
{
|
|
4378
|
+
href,
|
|
4379
|
+
target: "_blank",
|
|
4380
|
+
rel: "noopener noreferrer",
|
|
4381
|
+
className: "cnc-inline-flex cnc-items-center cnc-text-brand-blue-500 hover:cnc-opacity-80",
|
|
4382
|
+
"aria-label": `Abrir link externo de ${label}`,
|
|
4383
|
+
children: /* @__PURE__ */ jsx24(ExternalLink, { className: "cnc-size-4" })
|
|
4384
|
+
}
|
|
4385
|
+
)
|
|
4386
|
+
]
|
|
4387
|
+
}
|
|
4388
|
+
)
|
|
4389
|
+
] });
|
|
4088
4390
|
}
|
|
4089
4391
|
|
|
4090
4392
|
// src/components/molecules/forms/combobox.tsx
|
|
4091
|
-
import * as
|
|
4393
|
+
import * as React16 from "react";
|
|
4394
|
+
|
|
4395
|
+
// src/components/molecules/forms/combobox-footer.tsx
|
|
4396
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4397
|
+
function ComboboxDropdownFooter({
|
|
4398
|
+
footerAction,
|
|
4399
|
+
renderFooter,
|
|
4400
|
+
close,
|
|
4401
|
+
hidden = false
|
|
4402
|
+
}) {
|
|
4403
|
+
if (hidden) return null;
|
|
4404
|
+
if (renderFooter) {
|
|
4405
|
+
return /* @__PURE__ */ jsx25("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-p-2", children: renderFooter({ close }) });
|
|
4406
|
+
}
|
|
4407
|
+
if (!footerAction) return null;
|
|
4408
|
+
return /* @__PURE__ */ jsx25("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-p-2", children: /* @__PURE__ */ jsx25(
|
|
4409
|
+
Button,
|
|
4410
|
+
{
|
|
4411
|
+
type: "button",
|
|
4412
|
+
variant: footerAction.variant ?? "create",
|
|
4413
|
+
className: "cnc-w-full",
|
|
4414
|
+
disabled: footerAction.disabled,
|
|
4415
|
+
onClick: (event) => {
|
|
4416
|
+
event.preventDefault();
|
|
4417
|
+
event.stopPropagation();
|
|
4418
|
+
footerAction.onClick(event);
|
|
4419
|
+
},
|
|
4420
|
+
children: footerAction.label
|
|
4421
|
+
}
|
|
4422
|
+
) });
|
|
4423
|
+
}
|
|
4092
4424
|
|
|
4093
4425
|
// src/components/molecules/overlay/command.tsx
|
|
4094
|
-
import * as
|
|
4426
|
+
import * as React14 from "react";
|
|
4095
4427
|
import { Command as CommandPrimitive } from "cmdk";
|
|
4096
|
-
import { jsx as
|
|
4097
|
-
var Command =
|
|
4428
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4429
|
+
var Command = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4098
4430
|
CommandPrimitive,
|
|
4099
4431
|
{
|
|
4100
4432
|
ref,
|
|
@@ -4107,16 +4439,16 @@ var Command = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
4107
4439
|
));
|
|
4108
4440
|
Command.displayName = CommandPrimitive.displayName;
|
|
4109
4441
|
var CommandDialog = ({ children, ...props }) => {
|
|
4110
|
-
return /* @__PURE__ */
|
|
4442
|
+
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 }) }) });
|
|
4111
4443
|
};
|
|
4112
|
-
var CommandInput =
|
|
4444
|
+
var CommandInput = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs19(
|
|
4113
4445
|
"div",
|
|
4114
4446
|
{
|
|
4115
4447
|
className: "cnc-flex cnc-items-center cnc-border-b cnc-px-3",
|
|
4116
4448
|
"cmdk-input-wrapper": "",
|
|
4117
4449
|
children: [
|
|
4118
|
-
/* @__PURE__ */
|
|
4119
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsx26(Search, { className: "cnc-mr-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" }),
|
|
4451
|
+
/* @__PURE__ */ jsx26(
|
|
4120
4452
|
CommandPrimitive.Input,
|
|
4121
4453
|
{
|
|
4122
4454
|
ref,
|
|
@@ -4131,7 +4463,7 @@ var CommandInput = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4131
4463
|
}
|
|
4132
4464
|
));
|
|
4133
4465
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
4134
|
-
var CommandList =
|
|
4466
|
+
var CommandList = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4135
4467
|
CommandPrimitive.List,
|
|
4136
4468
|
{
|
|
4137
4469
|
ref,
|
|
@@ -4143,7 +4475,7 @@ var CommandList = React12.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4143
4475
|
}
|
|
4144
4476
|
));
|
|
4145
4477
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
4146
|
-
var CommandEmpty =
|
|
4478
|
+
var CommandEmpty = React14.forwardRef((props, ref) => /* @__PURE__ */ jsx26(
|
|
4147
4479
|
CommandPrimitive.Empty,
|
|
4148
4480
|
{
|
|
4149
4481
|
ref,
|
|
@@ -4152,7 +4484,7 @@ var CommandEmpty = React12.forwardRef((props, ref) => /* @__PURE__ */ jsx20(
|
|
|
4152
4484
|
}
|
|
4153
4485
|
));
|
|
4154
4486
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
4155
|
-
var CommandGroup =
|
|
4487
|
+
var CommandGroup = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4156
4488
|
CommandPrimitive.Group,
|
|
4157
4489
|
{
|
|
4158
4490
|
ref,
|
|
@@ -4164,7 +4496,7 @@ var CommandGroup = React12.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4164
4496
|
}
|
|
4165
4497
|
));
|
|
4166
4498
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
4167
|
-
var CommandSeparator =
|
|
4499
|
+
var CommandSeparator = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4168
4500
|
CommandPrimitive.Separator,
|
|
4169
4501
|
{
|
|
4170
4502
|
ref,
|
|
@@ -4173,7 +4505,7 @@ var CommandSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4173
4505
|
}
|
|
4174
4506
|
));
|
|
4175
4507
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
4176
|
-
var CommandItem =
|
|
4508
|
+
var CommandItem = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4177
4509
|
CommandPrimitive.Item,
|
|
4178
4510
|
{
|
|
4179
4511
|
ref,
|
|
@@ -4189,7 +4521,7 @@ var CommandShortcut = ({
|
|
|
4189
4521
|
className,
|
|
4190
4522
|
...props
|
|
4191
4523
|
}) => {
|
|
4192
|
-
return /* @__PURE__ */
|
|
4524
|
+
return /* @__PURE__ */ jsx26(
|
|
4193
4525
|
"span",
|
|
4194
4526
|
{
|
|
4195
4527
|
className: cn(
|
|
@@ -4203,12 +4535,12 @@ var CommandShortcut = ({
|
|
|
4203
4535
|
CommandShortcut.displayName = "CommandShortcut";
|
|
4204
4536
|
|
|
4205
4537
|
// src/components/molecules/overlay/popover.tsx
|
|
4206
|
-
import * as
|
|
4538
|
+
import * as React15 from "react";
|
|
4207
4539
|
import * as PopoverPrimitive2 from "@radix-ui/react-popover";
|
|
4208
|
-
import { jsx as
|
|
4540
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4209
4541
|
var Popover2 = PopoverPrimitive2.Root;
|
|
4210
4542
|
var PopoverTrigger2 = PopoverPrimitive2.Trigger;
|
|
4211
|
-
var PopoverContent2 =
|
|
4543
|
+
var PopoverContent2 = React15.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx27(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsx27(
|
|
4212
4544
|
PopoverPrimitive2.Content,
|
|
4213
4545
|
{
|
|
4214
4546
|
ref,
|
|
@@ -4224,7 +4556,7 @@ var PopoverContent2 = React13.forwardRef(({ className, align = "center", sideOff
|
|
|
4224
4556
|
PopoverContent2.displayName = PopoverPrimitive2.Content.displayName;
|
|
4225
4557
|
|
|
4226
4558
|
// src/components/molecules/forms/combobox.tsx
|
|
4227
|
-
import { jsx as
|
|
4559
|
+
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4228
4560
|
function Combobox({
|
|
4229
4561
|
options,
|
|
4230
4562
|
placeholder = "",
|
|
@@ -4235,132 +4567,367 @@ function Combobox({
|
|
|
4235
4567
|
modal = false,
|
|
4236
4568
|
popoverClassName,
|
|
4237
4569
|
buttonClassName,
|
|
4238
|
-
disabled = false
|
|
4570
|
+
disabled = false,
|
|
4571
|
+
footerAction,
|
|
4572
|
+
renderFooter
|
|
4239
4573
|
}) {
|
|
4240
|
-
const [open, setOpen] =
|
|
4241
|
-
return /* @__PURE__ */
|
|
4242
|
-
/* @__PURE__ */
|
|
4574
|
+
const [open, setOpen] = React16.useState(false);
|
|
4575
|
+
return /* @__PURE__ */ jsxs20(Popover2, { open, onOpenChange: setOpen, modal, children: [
|
|
4576
|
+
/* @__PURE__ */ jsx28(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs20(
|
|
4243
4577
|
Button,
|
|
4244
4578
|
{
|
|
4245
4579
|
variant: "outline",
|
|
4246
4580
|
role: "combobox",
|
|
4247
4581
|
"aria-expanded": open,
|
|
4248
|
-
className: cn(
|
|
4582
|
+
className: cn(
|
|
4583
|
+
"cnc-w-full cnc-justify-between cnc-truncate ",
|
|
4584
|
+
buttonClassName
|
|
4585
|
+
),
|
|
4249
4586
|
disabled,
|
|
4250
4587
|
children: [
|
|
4251
|
-
/* @__PURE__ */
|
|
4252
|
-
/* @__PURE__ */
|
|
4588
|
+
/* @__PURE__ */ jsx28("div", { children: value ? options?.find((framework) => framework.value === value)?.label : placeholder }),
|
|
4589
|
+
/* @__PURE__ */ jsx28(ChevronsUpDown, { className: "cnc-ml-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" })
|
|
4253
4590
|
]
|
|
4254
4591
|
}
|
|
4255
4592
|
) }),
|
|
4256
|
-
/* @__PURE__ */
|
|
4593
|
+
/* @__PURE__ */ jsxs20(
|
|
4257
4594
|
PopoverContent2,
|
|
4258
4595
|
{
|
|
4259
4596
|
align: "start",
|
|
4260
|
-
className: cn(
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
),
|
|
4269
|
-
/* @__PURE__ */ jsxs16(CommandList, { children: [
|
|
4270
|
-
/* @__PURE__ */ jsx22(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4271
|
-
/* @__PURE__ */ jsx22(CommandGroup, { children: options?.map((option) => /* @__PURE__ */ jsxs16(
|
|
4272
|
-
CommandItem,
|
|
4597
|
+
className: cn(
|
|
4598
|
+
"cnc-w-[--radix-popover-trigger-width] cnc-p-0",
|
|
4599
|
+
popoverClassName
|
|
4600
|
+
),
|
|
4601
|
+
children: [
|
|
4602
|
+
/* @__PURE__ */ jsxs20(Command, { children: [
|
|
4603
|
+
/* @__PURE__ */ jsx28(
|
|
4604
|
+
CommandInput,
|
|
4273
4605
|
{
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4606
|
+
placeholder: command?.placeholder,
|
|
4607
|
+
onInput: (e) => onInput && onInput(e.target?.value)
|
|
4608
|
+
}
|
|
4609
|
+
),
|
|
4610
|
+
/* @__PURE__ */ jsxs20(CommandList, { children: [
|
|
4611
|
+
/* @__PURE__ */ jsx28(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4612
|
+
/* @__PURE__ */ jsx28(CommandGroup, { children: options?.map((option) => /* @__PURE__ */ jsxs20(
|
|
4613
|
+
CommandItem,
|
|
4614
|
+
{
|
|
4615
|
+
value: option.value,
|
|
4616
|
+
onSelect: (currentValue) => {
|
|
4617
|
+
if (onChange)
|
|
4618
|
+
onChange(currentValue === value ? "" : currentValue);
|
|
4619
|
+
setOpen(false);
|
|
4620
|
+
},
|
|
4621
|
+
keywords: [option.value, option.label],
|
|
4622
|
+
disabled: option.disabled,
|
|
4623
|
+
children: [
|
|
4624
|
+
/* @__PURE__ */ jsx28(
|
|
4625
|
+
Check,
|
|
4626
|
+
{
|
|
4627
|
+
className: cn(
|
|
4628
|
+
"cnc-mr-2 cnc-h-4 cnc-w-4",
|
|
4629
|
+
value === option.value ? "cnc-opacity-100" : "cnc-opacity-0"
|
|
4630
|
+
)
|
|
4631
|
+
}
|
|
4632
|
+
),
|
|
4633
|
+
option.label
|
|
4634
|
+
]
|
|
4279
4635
|
},
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
},
|
|
4295
|
-
option.value
|
|
4296
|
-
)) })
|
|
4297
|
-
] })
|
|
4298
|
-
] })
|
|
4636
|
+
option.value
|
|
4637
|
+
)) })
|
|
4638
|
+
] })
|
|
4639
|
+
] }),
|
|
4640
|
+
/* @__PURE__ */ jsx28(
|
|
4641
|
+
ComboboxDropdownFooter,
|
|
4642
|
+
{
|
|
4643
|
+
footerAction,
|
|
4644
|
+
renderFooter,
|
|
4645
|
+
close: () => setOpen(false),
|
|
4646
|
+
hidden: disabled
|
|
4647
|
+
}
|
|
4648
|
+
)
|
|
4649
|
+
]
|
|
4299
4650
|
}
|
|
4300
4651
|
)
|
|
4301
4652
|
] });
|
|
4302
4653
|
}
|
|
4303
4654
|
|
|
4304
|
-
// src/components/
|
|
4305
|
-
import * as
|
|
4306
|
-
import {
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
if (!field.required) return void 0;
|
|
4328
|
-
return {
|
|
4329
|
-
required: field.errorMessage || "Campo obrigat\xF3rio",
|
|
4330
|
-
validate: (value) => {
|
|
4331
|
-
if (field.type === "switch") return true;
|
|
4332
|
-
if (value === "" || value === null || value === void 0) {
|
|
4333
|
-
return field.errorMessage || "Campo obrigat\xF3rio";
|
|
4334
|
-
}
|
|
4335
|
-
return true;
|
|
4655
|
+
// src/components/molecules/forms/multi-select.tsx
|
|
4656
|
+
import * as React17 from "react";
|
|
4657
|
+
import { jsx as jsx29, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4658
|
+
function MultiSelect({
|
|
4659
|
+
options,
|
|
4660
|
+
value = [],
|
|
4661
|
+
onChange,
|
|
4662
|
+
placeholder = "Selecione...",
|
|
4663
|
+
disabled = false,
|
|
4664
|
+
modal = false,
|
|
4665
|
+
className,
|
|
4666
|
+
buttonClassName,
|
|
4667
|
+
popoverClassName,
|
|
4668
|
+
command,
|
|
4669
|
+
selectedCountText = (count) => `${count} selecionados`,
|
|
4670
|
+
footerAction,
|
|
4671
|
+
renderFooter
|
|
4672
|
+
}) {
|
|
4673
|
+
const [open, setOpen] = React17.useState(false);
|
|
4674
|
+
const buttonText = (() => {
|
|
4675
|
+
if (value.length === 0) return placeholder;
|
|
4676
|
+
if (value.length === 1) {
|
|
4677
|
+
return options?.find((option) => option.value === value[0])?.label ?? selectedCountText(1);
|
|
4336
4678
|
}
|
|
4679
|
+
return selectedCountText(value.length);
|
|
4680
|
+
})();
|
|
4681
|
+
const toggleOption = (optionValue) => {
|
|
4682
|
+
if (!onChange) return;
|
|
4683
|
+
onChange(
|
|
4684
|
+
value.includes(optionValue) ? value.filter((item) => item !== optionValue) : [...value, optionValue]
|
|
4685
|
+
);
|
|
4337
4686
|
};
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4687
|
+
return /* @__PURE__ */ jsxs21(Popover2, { open, onOpenChange: setOpen, modal, children: [
|
|
4688
|
+
/* @__PURE__ */ jsx29(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs21(
|
|
4689
|
+
Button,
|
|
4690
|
+
{
|
|
4691
|
+
type: "button",
|
|
4692
|
+
variant: "outline",
|
|
4693
|
+
role: "combobox",
|
|
4694
|
+
"aria-expanded": open,
|
|
4695
|
+
disabled,
|
|
4696
|
+
className: cn(
|
|
4697
|
+
"cnc-w-full cnc-justify-between cnc-truncate",
|
|
4698
|
+
buttonClassName,
|
|
4699
|
+
className
|
|
4700
|
+
),
|
|
4701
|
+
children: [
|
|
4702
|
+
/* @__PURE__ */ jsx29("span", { className: "cnc-truncate", children: buttonText }),
|
|
4703
|
+
/* @__PURE__ */ jsx29(ChevronsUpDown, { className: "cnc-ml-2 cnc-h-4 cnc-w-4 cnc-shrink-0 cnc-opacity-50" })
|
|
4704
|
+
]
|
|
4705
|
+
}
|
|
4706
|
+
) }),
|
|
4707
|
+
/* @__PURE__ */ jsxs21(
|
|
4708
|
+
PopoverContent2,
|
|
4709
|
+
{
|
|
4710
|
+
align: "start",
|
|
4711
|
+
className: cn(
|
|
4712
|
+
"cnc-w-[--radix-popover-trigger-width] cnc-p-0",
|
|
4713
|
+
popoverClassName
|
|
4714
|
+
),
|
|
4715
|
+
children: [
|
|
4716
|
+
/* @__PURE__ */ jsxs21(Command, { children: [
|
|
4717
|
+
/* @__PURE__ */ jsx29(CommandInput, { placeholder: command?.placeholder }),
|
|
4718
|
+
/* @__PURE__ */ jsxs21(CommandList, { children: [
|
|
4719
|
+
/* @__PURE__ */ jsx29(CommandEmpty, { children: command?.emptyMessage ?? "Nenhum item encontrado" }),
|
|
4720
|
+
/* @__PURE__ */ jsx29(CommandGroup, { children: options?.map((option) => {
|
|
4721
|
+
const isSelected = value.includes(option.value);
|
|
4722
|
+
return /* @__PURE__ */ jsxs21(
|
|
4723
|
+
CommandItem,
|
|
4724
|
+
{
|
|
4725
|
+
value: option.value,
|
|
4726
|
+
onSelect: () => toggleOption(option.value),
|
|
4727
|
+
keywords: [option.value, option.label],
|
|
4728
|
+
disabled: option.disabled,
|
|
4729
|
+
children: [
|
|
4730
|
+
/* @__PURE__ */ jsx29(
|
|
4731
|
+
Check,
|
|
4732
|
+
{
|
|
4733
|
+
className: cn(
|
|
4734
|
+
"cnc-mr-2 cnc-h-4 cnc-w-4",
|
|
4735
|
+
isSelected ? "cnc-opacity-100" : "cnc-opacity-0"
|
|
4736
|
+
)
|
|
4737
|
+
}
|
|
4738
|
+
),
|
|
4739
|
+
option.label
|
|
4740
|
+
]
|
|
4741
|
+
},
|
|
4742
|
+
option.value
|
|
4743
|
+
);
|
|
4744
|
+
}) })
|
|
4745
|
+
] })
|
|
4746
|
+
] }),
|
|
4747
|
+
/* @__PURE__ */ jsx29(
|
|
4748
|
+
ComboboxDropdownFooter,
|
|
4749
|
+
{
|
|
4750
|
+
footerAction,
|
|
4751
|
+
renderFooter,
|
|
4752
|
+
close: () => setOpen(false),
|
|
4753
|
+
hidden: disabled
|
|
4754
|
+
}
|
|
4755
|
+
)
|
|
4756
|
+
]
|
|
4757
|
+
}
|
|
4758
|
+
)
|
|
4759
|
+
] });
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4762
|
+
// src/components/molecules/overlay/confirm-dialog.tsx
|
|
4763
|
+
import * as React18 from "react";
|
|
4764
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4765
|
+
function ConfirmDialog({
|
|
4766
|
+
open,
|
|
4767
|
+
onOpenChange,
|
|
4768
|
+
title,
|
|
4769
|
+
description,
|
|
4770
|
+
confirmLabel = "Confirmar",
|
|
4771
|
+
cancelLabel = "Cancelar",
|
|
4772
|
+
loadingLabel = "Aguarde...",
|
|
4773
|
+
onConfirm,
|
|
4774
|
+
icon,
|
|
4775
|
+
showIconBackground = true,
|
|
4776
|
+
footerAlign = "center",
|
|
4777
|
+
confirmVariant = "danger",
|
|
4778
|
+
children,
|
|
4779
|
+
isLoading,
|
|
4780
|
+
className
|
|
4781
|
+
}) {
|
|
4782
|
+
const [localLoading, setLocalLoading] = React18.useState(false);
|
|
4783
|
+
const isBusy = isLoading ?? localLoading;
|
|
4784
|
+
const handleConfirm = async () => {
|
|
4785
|
+
if (isLoading !== void 0) {
|
|
4786
|
+
await onConfirm?.();
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
setLocalLoading(true);
|
|
4790
|
+
try {
|
|
4791
|
+
await onConfirm?.();
|
|
4792
|
+
} finally {
|
|
4793
|
+
setLocalLoading(false);
|
|
4794
|
+
}
|
|
4795
|
+
};
|
|
4796
|
+
return /* @__PURE__ */ jsx30(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs22(DialogContent, { className: cn("cnc-max-w-md cnc-text-center", className), children: [
|
|
4797
|
+
/* @__PURE__ */ jsxs22(DialogHeader, { children: [
|
|
4798
|
+
/* @__PURE__ */ jsx30(
|
|
4799
|
+
"div",
|
|
4800
|
+
{
|
|
4801
|
+
className: cn(
|
|
4802
|
+
"cnc-mx-auto cnc-mb-2 cnc-flex cnc-items-center cnc-justify-center",
|
|
4803
|
+
showIconBackground && "cnc-size-16 cnc-rounded-full cnc-bg-red-100",
|
|
4804
|
+
showIconBackground && confirmVariant === "confirm" && "cnc-bg-brand-green-100/20"
|
|
4805
|
+
),
|
|
4806
|
+
children: icon ?? /* @__PURE__ */ jsx30(Trash2, { className: cn("cnc-size-8 cnc-text-red-600", confirmVariant === "confirm" && "cnc-text-brand-green-300") })
|
|
4807
|
+
}
|
|
4808
|
+
),
|
|
4809
|
+
/* @__PURE__ */ jsx30(DialogTitle, { className: "cnc-text-center", children: title }),
|
|
4810
|
+
description && /* @__PURE__ */ jsx30(DialogDescription, { className: "cnc-text-center", children: description })
|
|
4811
|
+
] }),
|
|
4812
|
+
children,
|
|
4813
|
+
/* @__PURE__ */ jsxs22(
|
|
4814
|
+
DialogFooter,
|
|
4815
|
+
{
|
|
4816
|
+
className: cn(
|
|
4817
|
+
"cnc-flex cnc-gap-2",
|
|
4818
|
+
footerAlign === "end" ? "cnc-justify-end sm:cnc-justify-end" : "cnc-justify-center sm:cnc-justify-center"
|
|
4819
|
+
),
|
|
4820
|
+
children: [
|
|
4821
|
+
/* @__PURE__ */ jsx30(
|
|
4822
|
+
Button,
|
|
4823
|
+
{
|
|
4824
|
+
type: "button",
|
|
4825
|
+
variant: "outline",
|
|
4826
|
+
onClick: () => onOpenChange(false),
|
|
4827
|
+
disabled: isBusy,
|
|
4828
|
+
children: cancelLabel
|
|
4829
|
+
}
|
|
4830
|
+
),
|
|
4831
|
+
/* @__PURE__ */ jsx30(
|
|
4832
|
+
Button,
|
|
4833
|
+
{
|
|
4834
|
+
type: "button",
|
|
4835
|
+
variant: confirmVariant,
|
|
4836
|
+
isLoading: isBusy,
|
|
4837
|
+
onClick: handleConfirm,
|
|
4838
|
+
children: isBusy ? loadingLabel : confirmLabel
|
|
4839
|
+
}
|
|
4840
|
+
)
|
|
4841
|
+
]
|
|
4842
|
+
}
|
|
4843
|
+
)
|
|
4844
|
+
] }) });
|
|
4845
|
+
}
|
|
4846
|
+
|
|
4847
|
+
// src/components/molecules/overlay/tooltip.tsx
|
|
4848
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4849
|
+
function Tooltip({
|
|
4850
|
+
text,
|
|
4851
|
+
children,
|
|
4852
|
+
className,
|
|
4853
|
+
contentClassName
|
|
4854
|
+
}) {
|
|
4855
|
+
return /* @__PURE__ */ jsxs23("div", { className: cn("cnc-relative cnc-inline-flex cnc-group", className), children: [
|
|
4856
|
+
/* @__PURE__ */ jsx31(
|
|
4857
|
+
"div",
|
|
4858
|
+
{
|
|
4859
|
+
role: "tooltip",
|
|
4860
|
+
className: cn(
|
|
4861
|
+
"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",
|
|
4862
|
+
contentClassName
|
|
4863
|
+
),
|
|
4864
|
+
children: text
|
|
4865
|
+
}
|
|
4866
|
+
),
|
|
4867
|
+
/* @__PURE__ */ jsx31("span", { className: "cnc-cursor-pointer", children })
|
|
4868
|
+
] });
|
|
4869
|
+
}
|
|
4870
|
+
|
|
4871
|
+
// src/components/organisms/filter/index.tsx
|
|
4872
|
+
import * as React19 from "react";
|
|
4873
|
+
import {
|
|
4874
|
+
Controller,
|
|
4875
|
+
useForm,
|
|
4876
|
+
useWatch
|
|
4877
|
+
} from "react-hook-form";
|
|
4878
|
+
import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4879
|
+
var INPUT_BASE_CLASSES = [
|
|
4880
|
+
"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",
|
|
4881
|
+
"placeholder:cnc-text-muted-foreground focus-visible:cnc-outline-none",
|
|
4882
|
+
"focus-visible:cnc-ring-2 focus-visible:cnc-ring-brand-gray-500/50 md:cnc-text-sm",
|
|
4883
|
+
"not-disabled:hover:cnc-border-brand-gray-500",
|
|
4884
|
+
"disabled:cnc-cursor-not-allowed disabled:cnc-opacity-50"
|
|
4885
|
+
].join(" ");
|
|
4886
|
+
function buildDefaultValues(fields) {
|
|
4887
|
+
const defaults = {};
|
|
4888
|
+
for (const field of fields) {
|
|
4889
|
+
defaults[field.name] = field.defaultValue ?? (field.type === "switch" ? false : "");
|
|
4890
|
+
}
|
|
4891
|
+
return defaults;
|
|
4892
|
+
}
|
|
4893
|
+
function buildValidationRules(field) {
|
|
4894
|
+
if (!field.required) return void 0;
|
|
4895
|
+
return {
|
|
4896
|
+
required: field.errorMessage || "Campo obrigat\xF3rio",
|
|
4897
|
+
validate: (value) => {
|
|
4898
|
+
if (field.type === "switch") return true;
|
|
4899
|
+
if (value === "" || value === null || value === void 0) {
|
|
4900
|
+
return field.errorMessage || "Campo obrigat\xF3rio";
|
|
4901
|
+
}
|
|
4902
|
+
return true;
|
|
4903
|
+
}
|
|
4904
|
+
};
|
|
4905
|
+
}
|
|
4906
|
+
var FilterFieldItem = React19.memo(function FilterFieldItem2({
|
|
4907
|
+
field,
|
|
4908
|
+
register,
|
|
4909
|
+
control,
|
|
4910
|
+
error
|
|
4911
|
+
}) {
|
|
4912
|
+
const fieldId = field.id || `filter-field-${field.name}`;
|
|
4913
|
+
return /* @__PURE__ */ jsxs24(
|
|
4347
4914
|
"div",
|
|
4348
4915
|
{
|
|
4349
4916
|
className: "cnc-filter-field cnc-px-2 cnc-mb-3",
|
|
4350
4917
|
style: { "--cnc-filter-field-w": field.width || "25%" },
|
|
4351
4918
|
children: [
|
|
4352
|
-
field.label && /* @__PURE__ */
|
|
4919
|
+
field.label && /* @__PURE__ */ jsxs24(
|
|
4353
4920
|
"label",
|
|
4354
4921
|
{
|
|
4355
4922
|
htmlFor: fieldId,
|
|
4356
4923
|
className: "cnc-block cnc-text-sm cnc-mb-1 cnc-font-medium cnc-text-brand-gray-600",
|
|
4357
4924
|
children: [
|
|
4358
4925
|
field.label,
|
|
4359
|
-
field.required && /* @__PURE__ */
|
|
4926
|
+
field.required && /* @__PURE__ */ jsx32("span", { className: "cnc-text-red-500", children: " *" })
|
|
4360
4927
|
]
|
|
4361
4928
|
}
|
|
4362
4929
|
),
|
|
4363
|
-
(field.type === "text" || field.type === "date") && /* @__PURE__ */
|
|
4930
|
+
(field.type === "text" || field.type === "date") && /* @__PURE__ */ jsx32(
|
|
4364
4931
|
"input",
|
|
4365
4932
|
{
|
|
4366
4933
|
id: fieldId,
|
|
@@ -4374,13 +4941,13 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4374
4941
|
)
|
|
4375
4942
|
}
|
|
4376
4943
|
),
|
|
4377
|
-
field.type === "combobox" && /* @__PURE__ */
|
|
4944
|
+
field.type === "combobox" && /* @__PURE__ */ jsx32(
|
|
4378
4945
|
Controller,
|
|
4379
4946
|
{
|
|
4380
4947
|
name: field.name,
|
|
4381
4948
|
control,
|
|
4382
4949
|
rules: buildValidationRules(field),
|
|
4383
|
-
render: ({ field: rhfField }) => /* @__PURE__ */
|
|
4950
|
+
render: ({ field: rhfField }) => /* @__PURE__ */ jsx32(
|
|
4384
4951
|
Combobox,
|
|
4385
4952
|
{
|
|
4386
4953
|
value: rhfField.value || "",
|
|
@@ -4394,13 +4961,13 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4394
4961
|
)
|
|
4395
4962
|
}
|
|
4396
4963
|
),
|
|
4397
|
-
field.type === "switch" && /* @__PURE__ */
|
|
4964
|
+
field.type === "switch" && /* @__PURE__ */ jsx32(
|
|
4398
4965
|
Controller,
|
|
4399
4966
|
{
|
|
4400
4967
|
name: field.name,
|
|
4401
4968
|
control,
|
|
4402
4969
|
rules: buildValidationRules(field),
|
|
4403
|
-
render: ({ field: rhfField }) => /* @__PURE__ */
|
|
4970
|
+
render: ({ field: rhfField }) => /* @__PURE__ */ jsx32(
|
|
4404
4971
|
Switch,
|
|
4405
4972
|
{
|
|
4406
4973
|
checked: !!rhfField.value,
|
|
@@ -4411,14 +4978,14 @@ var FilterFieldItem = React15.memo(function FilterFieldItem2({
|
|
|
4411
4978
|
)
|
|
4412
4979
|
}
|
|
4413
4980
|
),
|
|
4414
|
-
error && /* @__PURE__ */
|
|
4981
|
+
error && /* @__PURE__ */ jsx32("span", { className: "cnc-block cnc-text-xs cnc-text-red-500 cnc-mt-1", children: error.message })
|
|
4415
4982
|
]
|
|
4416
4983
|
}
|
|
4417
4984
|
);
|
|
4418
4985
|
});
|
|
4419
4986
|
function CleanButton({ control, onClean }) {
|
|
4420
4987
|
const values = useWatch({ control });
|
|
4421
|
-
const hasActiveFilters =
|
|
4988
|
+
const hasActiveFilters = React19.useMemo(() => {
|
|
4422
4989
|
const keys = Object.keys(values);
|
|
4423
4990
|
return keys.some((key) => {
|
|
4424
4991
|
const val = values[key];
|
|
@@ -4427,7 +4994,7 @@ function CleanButton({ control, onClean }) {
|
|
|
4427
4994
|
return val !== null && val !== void 0 && val !== "";
|
|
4428
4995
|
});
|
|
4429
4996
|
}, [values]);
|
|
4430
|
-
return /* @__PURE__ */
|
|
4997
|
+
return /* @__PURE__ */ jsxs24(
|
|
4431
4998
|
Button,
|
|
4432
4999
|
{
|
|
4433
5000
|
type: "button",
|
|
@@ -4436,13 +5003,13 @@ function CleanButton({ control, onClean }) {
|
|
|
4436
5003
|
disabled: !hasActiveFilters,
|
|
4437
5004
|
className: "cnc-shrink-0 cnc-gap-2",
|
|
4438
5005
|
children: [
|
|
4439
|
-
/* @__PURE__ */
|
|
5006
|
+
/* @__PURE__ */ jsx32(FilterX, { className: "cnc-h-4 cnc-w-4" }),
|
|
4440
5007
|
"Limpar"
|
|
4441
5008
|
]
|
|
4442
5009
|
}
|
|
4443
5010
|
);
|
|
4444
5011
|
}
|
|
4445
|
-
var Filter =
|
|
5012
|
+
var Filter = React19.forwardRef(
|
|
4446
5013
|
function Filter2({
|
|
4447
5014
|
fields,
|
|
4448
5015
|
collapsibleFields,
|
|
@@ -4452,12 +5019,12 @@ var Filter = React15.forwardRef(
|
|
|
4452
5019
|
isLoading = false,
|
|
4453
5020
|
className
|
|
4454
5021
|
}, ref) {
|
|
4455
|
-
const [isCollapsibleOpen, setIsCollapsibleOpen] =
|
|
4456
|
-
const allFields =
|
|
5022
|
+
const [isCollapsibleOpen, setIsCollapsibleOpen] = React19.useState(false);
|
|
5023
|
+
const allFields = React19.useMemo(
|
|
4457
5024
|
() => [...fields, ...collapsibleFields || []],
|
|
4458
5025
|
[fields, collapsibleFields]
|
|
4459
5026
|
);
|
|
4460
|
-
const defaultValues =
|
|
5027
|
+
const defaultValues = React19.useMemo(
|
|
4461
5028
|
() => buildDefaultValues(allFields),
|
|
4462
5029
|
[allFields]
|
|
4463
5030
|
);
|
|
@@ -4468,7 +5035,7 @@ var Filter = React15.forwardRef(
|
|
|
4468
5035
|
reset,
|
|
4469
5036
|
formState: { errors }
|
|
4470
5037
|
} = useForm({ defaultValues });
|
|
4471
|
-
|
|
5038
|
+
React19.useEffect(() => {
|
|
4472
5039
|
if (collapsibleFields?.some((f) => errors[f.name])) {
|
|
4473
5040
|
setIsCollapsibleOpen(true);
|
|
4474
5041
|
}
|
|
@@ -4476,7 +5043,7 @@ var Filter = React15.forwardRef(
|
|
|
4476
5043
|
const onSubmit = (data) => {
|
|
4477
5044
|
onSearch(data);
|
|
4478
5045
|
};
|
|
4479
|
-
const handleClean =
|
|
5046
|
+
const handleClean = React19.useCallback(() => {
|
|
4480
5047
|
const emptyValues = {};
|
|
4481
5048
|
for (const field of allFields) {
|
|
4482
5049
|
emptyValues[field.name] = field.type === "switch" ? false : "";
|
|
@@ -4484,12 +5051,12 @@ var Filter = React15.forwardRef(
|
|
|
4484
5051
|
reset(emptyValues);
|
|
4485
5052
|
onClean?.();
|
|
4486
5053
|
}, [allFields, reset, onClean]);
|
|
4487
|
-
return /* @__PURE__ */
|
|
5054
|
+
return /* @__PURE__ */ jsx32(
|
|
4488
5055
|
Collapsible,
|
|
4489
5056
|
{
|
|
4490
5057
|
open: isCollapsibleOpen,
|
|
4491
5058
|
onOpenChange: setIsCollapsibleOpen,
|
|
4492
|
-
children: /* @__PURE__ */
|
|
5059
|
+
children: /* @__PURE__ */ jsxs24(
|
|
4493
5060
|
"form",
|
|
4494
5061
|
{
|
|
4495
5062
|
ref,
|
|
@@ -4500,8 +5067,8 @@ var Filter = React15.forwardRef(
|
|
|
4500
5067
|
),
|
|
4501
5068
|
style: { backgroundColor: "#F8FAFC" },
|
|
4502
5069
|
children: [
|
|
4503
|
-
/* @__PURE__ */
|
|
4504
|
-
fields.map((field) => /* @__PURE__ */
|
|
5070
|
+
/* @__PURE__ */ jsxs24("div", { className: "cnc-flex cnc-flex-wrap cnc-items-end", children: [
|
|
5071
|
+
fields.map((field) => /* @__PURE__ */ jsx32(
|
|
4505
5072
|
FilterFieldItem,
|
|
4506
5073
|
{
|
|
4507
5074
|
field,
|
|
@@ -4511,18 +5078,18 @@ var Filter = React15.forwardRef(
|
|
|
4511
5078
|
},
|
|
4512
5079
|
field.name
|
|
4513
5080
|
)),
|
|
4514
|
-
/* @__PURE__ */
|
|
4515
|
-
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */
|
|
5081
|
+
/* @__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: [
|
|
5082
|
+
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */ jsx32(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsx32(
|
|
4516
5083
|
Button,
|
|
4517
5084
|
{
|
|
4518
5085
|
type: "button",
|
|
4519
5086
|
variant: "outline",
|
|
4520
5087
|
size: "icon",
|
|
4521
5088
|
className: "cnc-shrink-0",
|
|
4522
|
-
children: /* @__PURE__ */
|
|
5089
|
+
children: /* @__PURE__ */ jsx32(ListFilter, { className: "cnc-h-4 cnc-w-4" })
|
|
4523
5090
|
}
|
|
4524
5091
|
) }),
|
|
4525
|
-
/* @__PURE__ */
|
|
5092
|
+
/* @__PURE__ */ jsxs24(
|
|
4526
5093
|
Button,
|
|
4527
5094
|
{
|
|
4528
5095
|
type: "submit",
|
|
@@ -4530,15 +5097,15 @@ var Filter = React15.forwardRef(
|
|
|
4530
5097
|
isLoading,
|
|
4531
5098
|
className: "cnc-shrink-0 cnc-gap-2",
|
|
4532
5099
|
children: [
|
|
4533
|
-
/* @__PURE__ */
|
|
5100
|
+
/* @__PURE__ */ jsx32(Search, { className: "cnc-h-4 cnc-w-4" }),
|
|
4534
5101
|
"Pesquisar"
|
|
4535
5102
|
]
|
|
4536
5103
|
}
|
|
4537
5104
|
),
|
|
4538
|
-
!hideCleanFilterButton && /* @__PURE__ */
|
|
5105
|
+
!hideCleanFilterButton && /* @__PURE__ */ jsx32(CleanButton, { control, onClean: handleClean })
|
|
4539
5106
|
] })
|
|
4540
5107
|
] }),
|
|
4541
|
-
collapsibleFields && collapsibleFields.length > 0 && /* @__PURE__ */
|
|
5108
|
+
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(
|
|
4542
5109
|
FilterFieldItem,
|
|
4543
5110
|
{
|
|
4544
5111
|
field,
|
|
@@ -4557,8 +5124,8 @@ var Filter = React15.forwardRef(
|
|
|
4557
5124
|
);
|
|
4558
5125
|
|
|
4559
5126
|
// src/components/organisms/card-list/index.tsx
|
|
4560
|
-
import * as
|
|
4561
|
-
import { jsx as
|
|
5127
|
+
import * as React20 from "react";
|
|
5128
|
+
import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4562
5129
|
function CardList({
|
|
4563
5130
|
items,
|
|
4564
5131
|
renderCard,
|
|
@@ -4574,21 +5141,21 @@ function CardList({
|
|
|
4574
5141
|
gridTemplateColumns: `repeat(auto-fill, minmax(min(100%, ${minItemWidth}), 1fr))`
|
|
4575
5142
|
};
|
|
4576
5143
|
if (isLoading) {
|
|
4577
|
-
return /* @__PURE__ */
|
|
5144
|
+
return /* @__PURE__ */ jsx33(
|
|
4578
5145
|
"div",
|
|
4579
5146
|
{
|
|
4580
5147
|
className: cn("cnc-grid cnc-w-full", gap, className),
|
|
4581
5148
|
style: gridStyle,
|
|
4582
5149
|
"aria-busy": "true",
|
|
4583
|
-
children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */
|
|
5150
|
+
children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsxs25(
|
|
4584
5151
|
"div",
|
|
4585
5152
|
{
|
|
4586
5153
|
className: "cnc-animate-pulse cnc-rounded-md cnc-border-2 cnc-border-brand-gray-50 cnc-bg-white cnc-shadow cnc-p-6",
|
|
4587
5154
|
children: [
|
|
4588
|
-
/* @__PURE__ */
|
|
4589
|
-
/* @__PURE__ */
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
/* @__PURE__ */
|
|
5155
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-4 cnc-w-1/2 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-4" }),
|
|
5156
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-3 cnc-w-3/4 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-2" }),
|
|
5157
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-3 cnc-w-2/3 cnc-bg-brand-gray-100 cnc-rounded cnc-mb-6" }),
|
|
5158
|
+
/* @__PURE__ */ jsx33("div", { className: "cnc-h-8 cnc-w-full cnc-bg-brand-gray-100 cnc-rounded" })
|
|
4592
5159
|
]
|
|
4593
5160
|
},
|
|
4594
5161
|
i
|
|
@@ -4597,7 +5164,7 @@ function CardList({
|
|
|
4597
5164
|
);
|
|
4598
5165
|
}
|
|
4599
5166
|
if (!items || items.length === 0) {
|
|
4600
|
-
return /* @__PURE__ */
|
|
5167
|
+
return /* @__PURE__ */ jsxs25(
|
|
4601
5168
|
"div",
|
|
4602
5169
|
{
|
|
4603
5170
|
className: cn(
|
|
@@ -4606,160 +5173,1827 @@ function CardList({
|
|
|
4606
5173
|
),
|
|
4607
5174
|
style: { backgroundColor: "#F8FAFC", color: "#64748B" },
|
|
4608
5175
|
children: [
|
|
4609
|
-
/* @__PURE__ */
|
|
4610
|
-
/* @__PURE__ */
|
|
5176
|
+
/* @__PURE__ */ jsx33(FolderOpen, { className: "cnc-h-8 cnc-w-8 cnc-mb-2" }),
|
|
5177
|
+
/* @__PURE__ */ jsx33("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
4611
5178
|
]
|
|
4612
5179
|
}
|
|
4613
5180
|
);
|
|
4614
5181
|
}
|
|
4615
|
-
return /* @__PURE__ */
|
|
5182
|
+
return /* @__PURE__ */ jsx33(
|
|
4616
5183
|
"div",
|
|
4617
5184
|
{
|
|
4618
5185
|
className: cn("cnc-grid cnc-w-full", gap, className),
|
|
4619
5186
|
style: gridStyle,
|
|
4620
|
-
children: items.map((item, index) => /* @__PURE__ */
|
|
5187
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx33(React20.Fragment, { children: renderCard(item, index) }, getKey ? getKey(item, index) : index))
|
|
4621
5188
|
}
|
|
4622
5189
|
);
|
|
4623
5190
|
}
|
|
4624
|
-
export {
|
|
4625
|
-
AplicationsHeader,
|
|
4626
|
-
AppsMenu,
|
|
4627
|
-
Badge,
|
|
4628
|
-
Button,
|
|
4629
|
-
Card,
|
|
4630
|
-
CardContent,
|
|
4631
|
-
CardFooter,
|
|
4632
|
-
CardFooterItem,
|
|
4633
|
-
CardHeader,
|
|
4634
|
-
CardList,
|
|
4635
|
-
Checkbox,
|
|
4636
|
-
Collapsible,
|
|
4637
|
-
AnimatedCollapsibleContent as CollapsibleContent,
|
|
4638
|
-
CollapsibleTrigger2 as CollapsibleTrigger,
|
|
4639
|
-
Combobox,
|
|
4640
|
-
Command,
|
|
4641
|
-
CommandDialog,
|
|
4642
|
-
CommandEmpty,
|
|
4643
|
-
CommandGroup,
|
|
4644
|
-
CommandInput,
|
|
4645
|
-
CommandItem,
|
|
4646
|
-
CommandList,
|
|
4647
|
-
CommandSeparator,
|
|
4648
|
-
CommandShortcut,
|
|
4649
|
-
Dialog,
|
|
4650
|
-
DialogClose,
|
|
4651
|
-
DialogContent,
|
|
4652
|
-
DialogDescription,
|
|
4653
|
-
DialogFooter,
|
|
4654
|
-
DialogHeader,
|
|
4655
|
-
DialogOverlay,
|
|
4656
|
-
DialogPortal,
|
|
4657
|
-
DialogTitle,
|
|
4658
|
-
DialogTrigger,
|
|
4659
|
-
DropdownMenu,
|
|
4660
|
-
DropdownMenuCheckboxItem,
|
|
4661
|
-
DropdownMenuContent,
|
|
4662
|
-
DropdownMenuGroup,
|
|
4663
|
-
DropdownMenuItem,
|
|
4664
|
-
DropdownMenuLabel,
|
|
4665
|
-
DropdownMenuPortal,
|
|
4666
|
-
DropdownMenuRadioGroup,
|
|
4667
|
-
DropdownMenuRadioItem,
|
|
4668
|
-
DropdownMenuSeparator,
|
|
4669
|
-
DropdownMenuShortcut,
|
|
4670
|
-
DropdownMenuSub,
|
|
4671
|
-
DropdownMenuSubContent,
|
|
4672
|
-
DropdownMenuSubTrigger,
|
|
4673
|
-
DropdownMenuTrigger,
|
|
4674
|
-
Filter,
|
|
4675
|
-
Header,
|
|
4676
|
-
HeaderContainer,
|
|
4677
|
-
HeaderProfileHeader,
|
|
4678
|
-
HeaderProfileItem,
|
|
4679
|
-
Input,
|
|
4680
|
-
Modal,
|
|
4681
|
-
ModalEntidade,
|
|
4682
|
-
ModalMudancaEntidade,
|
|
4683
|
-
PageHeader,
|
|
4684
|
-
PageHeaderActionsContainer,
|
|
4685
|
-
PageHeaderTitle,
|
|
4686
|
-
PageHeaderTitleContent,
|
|
4687
|
-
Popover,
|
|
4688
|
-
PopoverContent,
|
|
4689
|
-
PopoverTrigger,
|
|
4690
|
-
Select,
|
|
4691
|
-
SelectContent,
|
|
4692
|
-
SelectGroup,
|
|
4693
|
-
SelectItem,
|
|
4694
|
-
SelectLabel,
|
|
4695
|
-
SelectPortal,
|
|
4696
|
-
SelectScrollDownButton,
|
|
4697
|
-
SelectScrollUpButton,
|
|
4698
|
-
SelectSeparator,
|
|
4699
|
-
SelectTrigger,
|
|
4700
|
-
SelectValue,
|
|
4701
|
-
SelectViewport,
|
|
4702
|
-
Sidebar,
|
|
4703
|
-
SidebarContainer,
|
|
4704
|
-
SidebarImageBrand,
|
|
4705
|
-
SidebarNavCollapse,
|
|
4706
|
-
SidebarNavLink,
|
|
4707
|
-
Switch,
|
|
4708
|
-
Tabs,
|
|
4709
|
-
TabsContent,
|
|
4710
|
-
TabsList,
|
|
4711
|
-
TabsTrigger,
|
|
4712
|
-
Title2 as Title,
|
|
4713
|
-
availableApps,
|
|
4714
|
-
buttonVariants
|
|
4715
|
-
};
|
|
4716
|
-
/*! Bundled license information:
|
|
4717
|
-
|
|
4718
|
-
lucide-react/dist/esm/shared/src/utils.js:
|
|
4719
|
-
(**
|
|
4720
|
-
* @license lucide-react v0.453.0 - ISC
|
|
4721
|
-
*
|
|
4722
|
-
* This source code is licensed under the ISC license.
|
|
4723
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
4724
|
-
*)
|
|
4725
|
-
|
|
4726
|
-
lucide-react/dist/esm/defaultAttributes.js:
|
|
4727
|
-
(**
|
|
4728
|
-
* @license lucide-react v0.453.0 - ISC
|
|
4729
|
-
*
|
|
4730
|
-
* This source code is licensed under the ISC license.
|
|
4731
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
4732
|
-
*)
|
|
4733
|
-
|
|
4734
|
-
lucide-react/dist/esm/Icon.js:
|
|
4735
|
-
(**
|
|
4736
|
-
* @license lucide-react v0.453.0 - ISC
|
|
4737
|
-
*
|
|
4738
|
-
* This source code is licensed under the ISC license.
|
|
4739
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
4740
|
-
*)
|
|
4741
|
-
|
|
4742
|
-
lucide-react/dist/esm/createLucideIcon.js:
|
|
4743
|
-
(**
|
|
4744
|
-
* @license lucide-react v0.453.0 - ISC
|
|
4745
|
-
*
|
|
4746
|
-
* This source code is licensed under the ISC license.
|
|
4747
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
4748
|
-
*)
|
|
4749
|
-
|
|
4750
|
-
lucide-react/dist/esm/icons/check.js:
|
|
4751
|
-
(**
|
|
4752
|
-
* @license lucide-react v0.453.0 - ISC
|
|
4753
|
-
*
|
|
4754
|
-
* This source code is licensed under the ISC license.
|
|
4755
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
4756
|
-
*)
|
|
4757
5191
|
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
5192
|
+
// src/components/organisms/drawer/drawer.tsx
|
|
5193
|
+
import * as DialogPrimitive2 from "@radix-ui/react-dialog";
|
|
5194
|
+
import * as React21 from "react";
|
|
5195
|
+
import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5196
|
+
var Drawer = DialogPrimitive2.Root;
|
|
5197
|
+
var DrawerTrigger = DialogPrimitive2.Trigger;
|
|
5198
|
+
var DrawerPortal = DialogPrimitive2.Portal;
|
|
5199
|
+
var DrawerClose = DialogPrimitive2.Close;
|
|
5200
|
+
var DrawerOverlay = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5201
|
+
DialogPrimitive2.Overlay,
|
|
5202
|
+
{
|
|
5203
|
+
ref,
|
|
5204
|
+
className: cn(
|
|
5205
|
+
"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",
|
|
5206
|
+
className
|
|
5207
|
+
),
|
|
5208
|
+
...props
|
|
5209
|
+
}
|
|
5210
|
+
));
|
|
5211
|
+
DrawerOverlay.displayName = DialogPrimitive2.Overlay.displayName;
|
|
5212
|
+
var drawerSizeToWidth = {
|
|
5213
|
+
sm: "24rem",
|
|
5214
|
+
md: "32rem",
|
|
5215
|
+
lg: "40rem",
|
|
5216
|
+
xl: "48rem",
|
|
5217
|
+
full: "100vw"
|
|
5218
|
+
};
|
|
5219
|
+
var DrawerContent = React21.forwardRef(
|
|
5220
|
+
({
|
|
5221
|
+
className,
|
|
5222
|
+
children,
|
|
5223
|
+
side = "right",
|
|
5224
|
+
size = "md",
|
|
5225
|
+
width,
|
|
5226
|
+
closeButton = true,
|
|
5227
|
+
style,
|
|
5228
|
+
...props
|
|
5229
|
+
}, ref) => {
|
|
5230
|
+
const resolvedWidth = width ?? drawerSizeToWidth[size];
|
|
5231
|
+
return /* @__PURE__ */ jsxs26(DrawerPortal, { children: [
|
|
5232
|
+
/* @__PURE__ */ jsx34(DrawerOverlay, {}),
|
|
5233
|
+
/* @__PURE__ */ jsxs26(
|
|
5234
|
+
DialogPrimitive2.Content,
|
|
5235
|
+
{
|
|
5236
|
+
ref,
|
|
5237
|
+
style: { "--drawer-width": resolvedWidth, ...style },
|
|
5238
|
+
className: cn(
|
|
5239
|
+
"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",
|
|
5240
|
+
"sm:cnc-w-[--drawer-width] sm:cnc-max-w-full",
|
|
5241
|
+
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",
|
|
5242
|
+
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",
|
|
5243
|
+
className
|
|
5244
|
+
),
|
|
5245
|
+
...props,
|
|
5246
|
+
children: [
|
|
5247
|
+
children,
|
|
5248
|
+
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: [
|
|
5249
|
+
/* @__PURE__ */ jsx34(X, { className: "cnc-h-4 cnc-w-4" }),
|
|
5250
|
+
/* @__PURE__ */ jsx34("span", { className: "cnc-sr-only", children: "Fechar" })
|
|
5251
|
+
] })
|
|
5252
|
+
]
|
|
5253
|
+
}
|
|
5254
|
+
)
|
|
5255
|
+
] });
|
|
5256
|
+
}
|
|
5257
|
+
);
|
|
5258
|
+
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
5259
|
+
var DrawerHeader = ({
|
|
5260
|
+
className,
|
|
5261
|
+
...props
|
|
5262
|
+
}) => /* @__PURE__ */ jsx34(
|
|
5263
|
+
"div",
|
|
5264
|
+
{
|
|
5265
|
+
className: cn(
|
|
5266
|
+
"cnc-flex cnc-flex-col cnc-space-y-1.5 cnc-border-b cnc-p-6",
|
|
5267
|
+
className
|
|
5268
|
+
),
|
|
5269
|
+
...props
|
|
5270
|
+
}
|
|
5271
|
+
);
|
|
5272
|
+
DrawerHeader.displayName = "DrawerHeader";
|
|
5273
|
+
var DrawerBody = ({
|
|
5274
|
+
className,
|
|
5275
|
+
...props
|
|
5276
|
+
}) => /* @__PURE__ */ jsx34("div", { className: cn("cnc-flex-1 cnc-overflow-y-auto cnc-p-6", className), ...props });
|
|
5277
|
+
DrawerBody.displayName = "DrawerBody";
|
|
5278
|
+
var DrawerFooter = ({
|
|
5279
|
+
className,
|
|
5280
|
+
...props
|
|
5281
|
+
}) => /* @__PURE__ */ jsx34("div", { className: cn("cnc-border-t cnc-p-6", className), ...props });
|
|
5282
|
+
DrawerFooter.displayName = "DrawerFooter";
|
|
5283
|
+
var DrawerTitle = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5284
|
+
DialogPrimitive2.Title,
|
|
5285
|
+
{
|
|
5286
|
+
ref,
|
|
5287
|
+
className: cn(
|
|
5288
|
+
"cnc-text-lg cnc-font-semibold cnc-leading-none cnc-tracking-tight",
|
|
5289
|
+
className
|
|
5290
|
+
),
|
|
5291
|
+
...props
|
|
5292
|
+
}
|
|
5293
|
+
));
|
|
5294
|
+
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
5295
|
+
var DrawerDescription = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
5296
|
+
DialogPrimitive2.Description,
|
|
5297
|
+
{
|
|
5298
|
+
ref,
|
|
5299
|
+
className: cn("cnc-text-sm cnc-text-muted-foreground", className),
|
|
5300
|
+
...props
|
|
5301
|
+
}
|
|
5302
|
+
));
|
|
5303
|
+
DrawerDescription.displayName = DialogPrimitive2.Description.displayName;
|
|
5304
|
+
|
|
5305
|
+
// src/components/organisms/drawer/drawer-context.tsx
|
|
5306
|
+
import * as React22 from "react";
|
|
5307
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
5308
|
+
var DrawerContext = React22.createContext(
|
|
5309
|
+
void 0
|
|
5310
|
+
);
|
|
5311
|
+
function DrawerProvider({ children }) {
|
|
5312
|
+
const [activeDrawer, setActiveDrawer] = React22.useState(null);
|
|
5313
|
+
const openDrawer = React22.useCallback((drawerId) => {
|
|
5314
|
+
setActiveDrawer(drawerId);
|
|
5315
|
+
}, []);
|
|
5316
|
+
const closeDrawer = React22.useCallback(() => {
|
|
5317
|
+
setActiveDrawer(null);
|
|
5318
|
+
}, []);
|
|
5319
|
+
const isOpen = React22.useCallback(
|
|
5320
|
+
(drawerId) => activeDrawer === drawerId,
|
|
5321
|
+
[activeDrawer]
|
|
5322
|
+
);
|
|
5323
|
+
const value = React22.useMemo(
|
|
5324
|
+
() => ({ activeDrawer, openDrawer, closeDrawer, isOpen }),
|
|
5325
|
+
[activeDrawer, openDrawer, closeDrawer, isOpen]
|
|
5326
|
+
);
|
|
5327
|
+
return /* @__PURE__ */ jsx35(DrawerContext.Provider, { value, children });
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5330
|
+
// src/components/organisms/drawer/use-drawer.ts
|
|
5331
|
+
import * as React23 from "react";
|
|
5332
|
+
function useDrawer() {
|
|
5333
|
+
const context = React23.useContext(DrawerContext);
|
|
5334
|
+
if (!context) {
|
|
5335
|
+
throw new Error("useDrawer deve ser usado dentro de um DrawerProvider");
|
|
5336
|
+
}
|
|
5337
|
+
return context;
|
|
5338
|
+
}
|
|
5339
|
+
|
|
5340
|
+
// src/components/organisms/upload/file-upload.tsx
|
|
5341
|
+
import * as React24 from "react";
|
|
5342
|
+
|
|
5343
|
+
// src/components/organisms/upload/utils.ts
|
|
5344
|
+
function formatSizeLimit(bytes) {
|
|
5345
|
+
if (bytes < 1024 * 1024) {
|
|
5346
|
+
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
5347
|
+
}
|
|
5348
|
+
return `${(bytes / (1024 * 1024)).toLocaleString("pt-BR", {
|
|
5349
|
+
maximumFractionDigits: 1,
|
|
5350
|
+
minimumFractionDigits: 0
|
|
5351
|
+
})} MB`;
|
|
5352
|
+
}
|
|
5353
|
+
function formatFileSize(bytes) {
|
|
5354
|
+
if (bytes < 1024 * 1024) {
|
|
5355
|
+
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
5356
|
+
}
|
|
5357
|
+
return `${(bytes / (1024 * 1024)).toLocaleString("pt-BR", {
|
|
5358
|
+
maximumFractionDigits: 1,
|
|
5359
|
+
minimumFractionDigits: 0
|
|
5360
|
+
})} MB`;
|
|
5361
|
+
}
|
|
5362
|
+
function isDuplicateFile(file, files) {
|
|
5363
|
+
return files.some(
|
|
5364
|
+
(currentFile) => currentFile.name === file.name && currentFile.size === file.size
|
|
5365
|
+
);
|
|
5366
|
+
}
|
|
5367
|
+
function validateFiles({
|
|
5368
|
+
currentFiles = [],
|
|
5369
|
+
incomingFiles,
|
|
5370
|
+
allowedTypes,
|
|
5371
|
+
maxSize,
|
|
5372
|
+
multiple = true
|
|
5373
|
+
}) {
|
|
5374
|
+
const acceptedFiles = [];
|
|
5375
|
+
const rejectedFiles = [];
|
|
5376
|
+
const baseFiles = multiple ? currentFiles : [];
|
|
5377
|
+
for (const file of incomingFiles) {
|
|
5378
|
+
if (allowedTypes?.length && !allowedTypes.includes(file.type)) {
|
|
5379
|
+
rejectedFiles.push({
|
|
5380
|
+
file,
|
|
5381
|
+
reason: "type",
|
|
5382
|
+
message: `Tipo n\xE3o permitido: ${file.name}`
|
|
5383
|
+
});
|
|
5384
|
+
continue;
|
|
5385
|
+
}
|
|
5386
|
+
if (maxSize !== void 0 && file.size > maxSize) {
|
|
5387
|
+
rejectedFiles.push({
|
|
5388
|
+
file,
|
|
5389
|
+
reason: "size",
|
|
5390
|
+
message: `Arquivo maior que ${formatSizeLimit(maxSize)}: ${file.name}`
|
|
5391
|
+
});
|
|
5392
|
+
continue;
|
|
5393
|
+
}
|
|
5394
|
+
if (isDuplicateFile(file, [...baseFiles, ...acceptedFiles])) {
|
|
5395
|
+
rejectedFiles.push({
|
|
5396
|
+
file,
|
|
5397
|
+
reason: "duplicate",
|
|
5398
|
+
message: `Arquivo j\xE1 adicionado: ${file.name}`
|
|
5399
|
+
});
|
|
5400
|
+
continue;
|
|
5401
|
+
}
|
|
5402
|
+
if (!multiple) {
|
|
5403
|
+
acceptedFiles.splice(0, acceptedFiles.length, file);
|
|
5404
|
+
continue;
|
|
5405
|
+
}
|
|
5406
|
+
acceptedFiles.push(file);
|
|
5407
|
+
}
|
|
5408
|
+
return { acceptedFiles, rejectedFiles };
|
|
5409
|
+
}
|
|
5410
|
+
|
|
5411
|
+
// src/components/organisms/upload/file-list.tsx
|
|
5412
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5413
|
+
function FileList({
|
|
5414
|
+
items,
|
|
5415
|
+
onRemove,
|
|
5416
|
+
onDownload,
|
|
5417
|
+
disabled = false,
|
|
5418
|
+
variant = "bordered",
|
|
5419
|
+
emptyState,
|
|
5420
|
+
removeLabel = "Remover",
|
|
5421
|
+
className,
|
|
5422
|
+
...props
|
|
5423
|
+
}) {
|
|
5424
|
+
if (items.length === 0) {
|
|
5425
|
+
return emptyState ? /* @__PURE__ */ jsx36(Fragment6, { children: emptyState }) : null;
|
|
5426
|
+
}
|
|
5427
|
+
return /* @__PURE__ */ jsx36(
|
|
5428
|
+
"ul",
|
|
5429
|
+
{
|
|
5430
|
+
className: cn(
|
|
5431
|
+
"cnc-divide-y",
|
|
5432
|
+
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",
|
|
5433
|
+
className
|
|
5434
|
+
),
|
|
5435
|
+
...props,
|
|
5436
|
+
children: items.map((item, index) => {
|
|
5437
|
+
const canRemove = !!onRemove;
|
|
5438
|
+
const canDownload = !!onDownload;
|
|
5439
|
+
const isDisabled = disabled || item.disabled;
|
|
5440
|
+
const isPending = item.status === "pending";
|
|
5441
|
+
return /* @__PURE__ */ jsxs27(
|
|
5442
|
+
"li",
|
|
5443
|
+
{
|
|
5444
|
+
className: cn(
|
|
5445
|
+
"cnc-flex cnc-flex-col cnc-gap-2",
|
|
5446
|
+
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"
|
|
5447
|
+
),
|
|
5448
|
+
children: [
|
|
5449
|
+
/* @__PURE__ */ jsxs27("div", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-items-start cnc-gap-2", children: [
|
|
5450
|
+
/* @__PURE__ */ jsx36(FileText, { className: "cnc-mt-0.5 cnc-size-4 cnc-shrink-0 cnc-text-slate-500" }),
|
|
5451
|
+
/* @__PURE__ */ jsxs27("div", { className: "cnc-min-w-0", children: [
|
|
5452
|
+
canDownload ? /* @__PURE__ */ jsxs27(
|
|
5453
|
+
"button",
|
|
5454
|
+
{
|
|
5455
|
+
type: "button",
|
|
5456
|
+
onClick: () => onDownload(item, index),
|
|
5457
|
+
disabled: isDisabled,
|
|
5458
|
+
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",
|
|
5459
|
+
children: [
|
|
5460
|
+
/* @__PURE__ */ jsx36("span", { className: "cnc-min-w-0 cnc-truncate", children: item.name }),
|
|
5461
|
+
/* @__PURE__ */ jsx36(Download, { className: "cnc-size-3.5 cnc-shrink-0" })
|
|
5462
|
+
]
|
|
5463
|
+
}
|
|
5464
|
+
) : /* @__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 }) }),
|
|
5465
|
+
(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: [
|
|
5466
|
+
item.meta,
|
|
5467
|
+
item.meta && item.size !== void 0 ? /* @__PURE__ */ jsx36("span", { children: "\xB7" }) : null,
|
|
5468
|
+
item.size !== void 0 ? /* @__PURE__ */ jsx36("span", { children: formatFileSize(item.size) }) : null
|
|
5469
|
+
] }),
|
|
5470
|
+
item.description ? /* @__PURE__ */ jsx36("p", { className: "cnc-mt-1 cnc-line-clamp-2 cnc-text-xs cnc-text-slate-600", children: item.description }) : null
|
|
5471
|
+
] })
|
|
5472
|
+
] }),
|
|
5473
|
+
canRemove ? isPending ? /* @__PURE__ */ jsx36(
|
|
5474
|
+
"button",
|
|
5475
|
+
{
|
|
5476
|
+
type: "button",
|
|
5477
|
+
onClick: () => onRemove(item, index),
|
|
5478
|
+
disabled: isDisabled,
|
|
5479
|
+
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",
|
|
5480
|
+
"aria-label": `Remover ${item.name}`,
|
|
5481
|
+
children: /* @__PURE__ */ jsx36(X, { className: "cnc-size-4" })
|
|
5482
|
+
}
|
|
5483
|
+
) : /* @__PURE__ */ jsxs27(
|
|
5484
|
+
"button",
|
|
5485
|
+
{
|
|
5486
|
+
type: "button",
|
|
5487
|
+
onClick: () => onRemove(item, index),
|
|
5488
|
+
disabled: isDisabled,
|
|
5489
|
+
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",
|
|
5490
|
+
"aria-label": `Remover ${item.name}`,
|
|
5491
|
+
children: [
|
|
5492
|
+
/* @__PURE__ */ jsx36(Trash2, { className: "cnc-size-4" }),
|
|
5493
|
+
removeLabel
|
|
5494
|
+
]
|
|
5495
|
+
}
|
|
5496
|
+
) : null
|
|
5497
|
+
]
|
|
5498
|
+
},
|
|
5499
|
+
item.id
|
|
5500
|
+
);
|
|
5501
|
+
})
|
|
5502
|
+
}
|
|
5503
|
+
);
|
|
5504
|
+
}
|
|
5505
|
+
|
|
5506
|
+
// src/components/organisms/upload/file-upload.tsx
|
|
5507
|
+
import { jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5508
|
+
function fileToListItem(file, index) {
|
|
5509
|
+
return {
|
|
5510
|
+
id: `${file.name}-${file.size}-${file.lastModified}-${index}`,
|
|
5511
|
+
name: file.name,
|
|
5512
|
+
size: file.size,
|
|
5513
|
+
status: "pending"
|
|
5514
|
+
};
|
|
5515
|
+
}
|
|
5516
|
+
var FileUpload = React24.forwardRef(
|
|
5517
|
+
({
|
|
5518
|
+
value = [],
|
|
5519
|
+
onChange,
|
|
5520
|
+
multiple = true,
|
|
5521
|
+
accept,
|
|
5522
|
+
allowedTypes,
|
|
5523
|
+
maxSize,
|
|
5524
|
+
disabled = false,
|
|
5525
|
+
isLoading = false,
|
|
5526
|
+
buttonLabel = "Adicionar arquivos",
|
|
5527
|
+
hint,
|
|
5528
|
+
icon,
|
|
5529
|
+
onReject,
|
|
5530
|
+
showList = true,
|
|
5531
|
+
listTitle = (count) => `Arquivos selecionados (${count})`,
|
|
5532
|
+
className,
|
|
5533
|
+
buttonClassName,
|
|
5534
|
+
listClassName,
|
|
5535
|
+
...props
|
|
5536
|
+
}, ref) => {
|
|
5537
|
+
const fileInputRef = React24.useRef(null);
|
|
5538
|
+
const hintId = React24.useId();
|
|
5539
|
+
React24.useImperativeHandle(ref, () => fileInputRef.current, []);
|
|
5540
|
+
const isBusy = disabled || isLoading;
|
|
5541
|
+
const items = value.map(fileToListItem);
|
|
5542
|
+
const clearInput = () => {
|
|
5543
|
+
if (fileInputRef.current) {
|
|
5544
|
+
fileInputRef.current.value = "";
|
|
5545
|
+
}
|
|
5546
|
+
};
|
|
5547
|
+
const handleFileSelection = (event) => {
|
|
5548
|
+
const selectedFiles = Array.from(event.target.files ?? []);
|
|
5549
|
+
if (!selectedFiles.length) {
|
|
5550
|
+
clearInput();
|
|
5551
|
+
return;
|
|
5552
|
+
}
|
|
5553
|
+
const { acceptedFiles, rejectedFiles } = validateFiles({
|
|
5554
|
+
currentFiles: value,
|
|
5555
|
+
incomingFiles: selectedFiles,
|
|
5556
|
+
allowedTypes,
|
|
5557
|
+
maxSize,
|
|
5558
|
+
multiple
|
|
5559
|
+
});
|
|
5560
|
+
if (acceptedFiles.length > 0) {
|
|
5561
|
+
onChange?.(multiple ? [...value, ...acceptedFiles] : acceptedFiles.slice(0, 1));
|
|
5562
|
+
}
|
|
5563
|
+
if (rejectedFiles.length > 0) {
|
|
5564
|
+
onReject?.(rejectedFiles);
|
|
5565
|
+
}
|
|
5566
|
+
clearInput();
|
|
5567
|
+
};
|
|
5568
|
+
const handleRemove = (_item, index) => {
|
|
5569
|
+
onChange?.(value.filter((_, currentIndex) => currentIndex !== index));
|
|
5570
|
+
};
|
|
5571
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn("cnc-flex cnc-min-w-0 cnc-flex-col cnc-gap-3", className), ...props, children: [
|
|
5572
|
+
/* @__PURE__ */ jsx37(
|
|
5573
|
+
"input",
|
|
5574
|
+
{
|
|
5575
|
+
ref: fileInputRef,
|
|
5576
|
+
type: "file",
|
|
5577
|
+
multiple,
|
|
5578
|
+
accept,
|
|
5579
|
+
className: "cnc-sr-only",
|
|
5580
|
+
tabIndex: -1,
|
|
5581
|
+
disabled: isBusy,
|
|
5582
|
+
"aria-describedby": hint ? hintId : void 0,
|
|
5583
|
+
onChange: handleFileSelection
|
|
5584
|
+
}
|
|
5585
|
+
),
|
|
5586
|
+
/* @__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(
|
|
5587
|
+
Button,
|
|
5588
|
+
{
|
|
5589
|
+
type: "button",
|
|
5590
|
+
variant: "outline",
|
|
5591
|
+
disabled: isBusy,
|
|
5592
|
+
className: buttonClassName,
|
|
5593
|
+
onClick: () => fileInputRef.current?.click(),
|
|
5594
|
+
children: [
|
|
5595
|
+
icon ?? /* @__PURE__ */ jsx37(Paperclip, { className: "cnc-mr-2 cnc-size-4" }),
|
|
5596
|
+
buttonLabel
|
|
5597
|
+
]
|
|
5598
|
+
}
|
|
5599
|
+
) }),
|
|
5600
|
+
hint ? /* @__PURE__ */ jsx37("p", { id: hintId, className: "cnc-text-sm cnc-text-slate-600", children: hint }) : null,
|
|
5601
|
+
showList && items.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "cnc-flex cnc-flex-col cnc-gap-2", children: [
|
|
5602
|
+
/* @__PURE__ */ jsx37("p", { role: "status", className: "cnc-text-sm cnc-font-medium cnc-text-slate-700", children: listTitle(items.length) }),
|
|
5603
|
+
/* @__PURE__ */ jsx37(
|
|
5604
|
+
FileList,
|
|
5605
|
+
{
|
|
5606
|
+
items,
|
|
5607
|
+
onRemove: handleRemove,
|
|
5608
|
+
disabled: isBusy,
|
|
5609
|
+
className: listClassName
|
|
5610
|
+
}
|
|
5611
|
+
)
|
|
5612
|
+
] }) : null
|
|
5613
|
+
] });
|
|
5614
|
+
}
|
|
5615
|
+
);
|
|
5616
|
+
FileUpload.displayName = "FileUpload";
|
|
5617
|
+
|
|
5618
|
+
// src/components/organisms/calendar/calendar-utils.ts
|
|
5619
|
+
var MESES_PT_BR = [
|
|
5620
|
+
"Janeiro",
|
|
5621
|
+
"Fevereiro",
|
|
5622
|
+
"Mar\xE7o",
|
|
5623
|
+
"Abril",
|
|
5624
|
+
"Maio",
|
|
5625
|
+
"Junho",
|
|
5626
|
+
"Julho",
|
|
5627
|
+
"Agosto",
|
|
5628
|
+
"Setembro",
|
|
5629
|
+
"Outubro",
|
|
5630
|
+
"Novembro",
|
|
5631
|
+
"Dezembro"
|
|
5632
|
+
];
|
|
5633
|
+
var MESES_PT_BR_ABREV = [
|
|
5634
|
+
"JAN",
|
|
5635
|
+
"FEV",
|
|
5636
|
+
"MAR",
|
|
5637
|
+
"ABR",
|
|
5638
|
+
"MAI",
|
|
5639
|
+
"JUN",
|
|
5640
|
+
"JUL",
|
|
5641
|
+
"AGO",
|
|
5642
|
+
"SET",
|
|
5643
|
+
"OUT",
|
|
5644
|
+
"NOV",
|
|
5645
|
+
"DEZ"
|
|
5646
|
+
];
|
|
5647
|
+
var DIAS_SEMANA_PT_BR = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "S\xC1B"];
|
|
5648
|
+
function toDateKey(date) {
|
|
5649
|
+
const ano = date.getFullYear();
|
|
5650
|
+
const mes = String(date.getMonth() + 1).padStart(2, "0");
|
|
5651
|
+
const dia = String(date.getDate()).padStart(2, "0");
|
|
5652
|
+
return `${ano}-${mes}-${dia}`;
|
|
5653
|
+
}
|
|
5654
|
+
function toLocalNoon(date) {
|
|
5655
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), 12, 0, 0, 0);
|
|
5656
|
+
}
|
|
5657
|
+
function isSameDay(a, b) {
|
|
5658
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
5659
|
+
}
|
|
5660
|
+
function isToday(date) {
|
|
5661
|
+
return isSameDay(date, /* @__PURE__ */ new Date());
|
|
5662
|
+
}
|
|
5663
|
+
function buildMonthDays(month, selectedDate, hasItems) {
|
|
5664
|
+
const year = month.getFullYear();
|
|
5665
|
+
const monthIndex = month.getMonth();
|
|
5666
|
+
const totalDays = new Date(year, monthIndex + 1, 0).getDate();
|
|
5667
|
+
const startOffset = new Date(year, monthIndex, 1).getDay();
|
|
5668
|
+
const cells = [];
|
|
5669
|
+
for (let i = 0; i < startOffset; i++) {
|
|
5670
|
+
cells.push(null);
|
|
5671
|
+
}
|
|
5672
|
+
for (let day = 1; day <= totalDays; day++) {
|
|
5673
|
+
const date = new Date(year, monthIndex, day, 12, 0, 0, 0);
|
|
5674
|
+
cells.push({
|
|
5675
|
+
date,
|
|
5676
|
+
number: day,
|
|
5677
|
+
dateKey: toDateKey(date),
|
|
5678
|
+
isToday: isToday(date),
|
|
5679
|
+
isSelected: selectedDate ? isSameDay(date, selectedDate) : false,
|
|
5680
|
+
hasItems: hasItems?.(date) ?? false
|
|
5681
|
+
});
|
|
5682
|
+
}
|
|
5683
|
+
return cells;
|
|
5684
|
+
}
|
|
5685
|
+
function formatMonthYear(date) {
|
|
5686
|
+
return `${MESES_PT_BR[date.getMonth()]} ${date.getFullYear()}`;
|
|
5687
|
+
}
|
|
5688
|
+
function formatDayAriaLabel(date) {
|
|
5689
|
+
return date.toLocaleDateString("pt-BR", {
|
|
5690
|
+
weekday: "long",
|
|
5691
|
+
day: "numeric",
|
|
5692
|
+
month: "long",
|
|
5693
|
+
year: "numeric"
|
|
5694
|
+
});
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
// src/components/organisms/calendar/mini-month-calendar.tsx
|
|
5698
|
+
import * as React25 from "react";
|
|
5699
|
+
import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5700
|
+
function MiniMonthCalendar({
|
|
5701
|
+
month: monthProp,
|
|
5702
|
+
onMonthChange,
|
|
5703
|
+
selectedDate,
|
|
5704
|
+
onSelectDate,
|
|
5705
|
+
hasItems,
|
|
5706
|
+
renderDay,
|
|
5707
|
+
weekDays = DIAS_SEMANA_PT_BR,
|
|
5708
|
+
monthLabel = formatMonthYear,
|
|
5709
|
+
previousLabel = "M\xEAs anterior",
|
|
5710
|
+
nextLabel = "Pr\xF3ximo m\xEAs",
|
|
5711
|
+
className
|
|
5712
|
+
}) {
|
|
5713
|
+
const month = React25.useMemo(() => toLocalNoon(monthProp ?? /* @__PURE__ */ new Date()), [monthProp]);
|
|
5714
|
+
const cells = React25.useMemo(
|
|
5715
|
+
() => buildMonthDays(month, selectedDate, hasItems),
|
|
5716
|
+
[month, selectedDate, hasItems]
|
|
5717
|
+
);
|
|
5718
|
+
const goToMonth = (offset) => {
|
|
5719
|
+
onMonthChange?.(
|
|
5720
|
+
new Date(month.getFullYear(), month.getMonth() + offset, 1, 12, 0, 0, 0)
|
|
5721
|
+
);
|
|
5722
|
+
};
|
|
5723
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("cnc-w-full", className), children: [
|
|
5724
|
+
/* @__PURE__ */ jsxs29("div", { className: "cnc-mb-4 cnc-flex cnc-items-center cnc-justify-between cnc-px-1", children: [
|
|
5725
|
+
/* @__PURE__ */ jsx38(
|
|
5726
|
+
"button",
|
|
5727
|
+
{
|
|
5728
|
+
type: "button",
|
|
5729
|
+
onClick: () => goToMonth(-1),
|
|
5730
|
+
"aria-label": previousLabel,
|
|
5731
|
+
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",
|
|
5732
|
+
children: /* @__PURE__ */ jsx38(ChevronLeft, { className: "cnc-size-4" })
|
|
5733
|
+
}
|
|
5734
|
+
),
|
|
5735
|
+
/* @__PURE__ */ jsx38("span", { className: "cnc-text-sm cnc-font-bold cnc-text-primary", children: monthLabel(month) }),
|
|
5736
|
+
/* @__PURE__ */ jsx38(
|
|
5737
|
+
"button",
|
|
5738
|
+
{
|
|
5739
|
+
type: "button",
|
|
5740
|
+
onClick: () => goToMonth(1),
|
|
5741
|
+
"aria-label": nextLabel,
|
|
5742
|
+
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",
|
|
5743
|
+
children: /* @__PURE__ */ jsx38(ChevronRight, { className: "cnc-size-4" })
|
|
5744
|
+
}
|
|
5745
|
+
)
|
|
5746
|
+
] }),
|
|
5747
|
+
/* @__PURE__ */ jsxs29("div", { className: "cnc-grid cnc-grid-cols-7 cnc-gap-y-3 cnc-text-center cnc-text-xs", children: [
|
|
5748
|
+
weekDays.map((dayName) => /* @__PURE__ */ jsx38(
|
|
5749
|
+
"span",
|
|
5750
|
+
{
|
|
5751
|
+
className: "cnc-text-[11px] cnc-font-medium cnc-text-brand-gray-200",
|
|
5752
|
+
children: dayName
|
|
5753
|
+
},
|
|
5754
|
+
dayName
|
|
5755
|
+
)),
|
|
5756
|
+
cells.map((cell, index) => {
|
|
5757
|
+
if (!cell) {
|
|
5758
|
+
return /* @__PURE__ */ jsx38("span", {}, `vazio-${index}`);
|
|
5759
|
+
}
|
|
5760
|
+
return /* @__PURE__ */ jsx38(
|
|
5761
|
+
"button",
|
|
5762
|
+
{
|
|
5763
|
+
type: "button",
|
|
5764
|
+
onClick: () => onSelectDate?.(cell.date),
|
|
5765
|
+
"aria-label": formatDayAriaLabel(cell.date),
|
|
5766
|
+
"aria-pressed": cell.isSelected,
|
|
5767
|
+
className: cn(
|
|
5768
|
+
"cnc-group cnc-relative cnc-flex cnc-h-8 cnc-flex-col cnc-items-center cnc-justify-center cnc-rounded-full cnc-transition-colors",
|
|
5769
|
+
cell.isSelected ? "cnc-bg-primary cnc-text-white" : "cnc-text-brand-gray-600 hover:cnc-bg-brand-blue-50 hover:cnc-text-primary",
|
|
5770
|
+
cell.isToday && !cell.isSelected && "cnc-underline cnc-decoration-primary cnc-decoration-2 cnc-underline-offset-4"
|
|
5771
|
+
),
|
|
5772
|
+
children: renderDay ? renderDay(cell) : /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
5773
|
+
/* @__PURE__ */ jsx38("span", { className: "cnc-text-xs cnc-font-semibold", children: cell.number }),
|
|
5774
|
+
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" })
|
|
5775
|
+
] })
|
|
5776
|
+
},
|
|
5777
|
+
cell.dateKey
|
|
5778
|
+
);
|
|
5779
|
+
})
|
|
5780
|
+
] })
|
|
5781
|
+
] });
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
// src/components/organisms/calendar/month-year-picker.tsx
|
|
5785
|
+
import * as React26 from "react";
|
|
5786
|
+
import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5787
|
+
function MonthYearPicker({
|
|
5788
|
+
value,
|
|
5789
|
+
onChange,
|
|
5790
|
+
disabled = false,
|
|
5791
|
+
triggerLabel = formatMonthYear,
|
|
5792
|
+
previousYearLabel = "Ano anterior",
|
|
5793
|
+
nextYearLabel = "Pr\xF3ximo ano",
|
|
5794
|
+
className,
|
|
5795
|
+
triggerClassName,
|
|
5796
|
+
contentClassName
|
|
5797
|
+
}) {
|
|
5798
|
+
const [open, setOpen] = React26.useState(false);
|
|
5799
|
+
const [viewYear, setViewYear] = React26.useState(() => value.getFullYear());
|
|
5800
|
+
React26.useEffect(() => {
|
|
5801
|
+
if (open) setViewYear(value.getFullYear());
|
|
5802
|
+
}, [open, value]);
|
|
5803
|
+
const isSelectedMonth = (monthIndex) => value.getFullYear() === viewYear && value.getMonth() === monthIndex;
|
|
5804
|
+
const handleMonthSelect = (monthIndex) => {
|
|
5805
|
+
const lastDay = new Date(viewYear, monthIndex + 1, 0).getDate();
|
|
5806
|
+
const day = Math.min(value.getDate(), lastDay);
|
|
5807
|
+
onChange(new Date(viewYear, monthIndex, day));
|
|
5808
|
+
setOpen(false);
|
|
5809
|
+
};
|
|
5810
|
+
return /* @__PURE__ */ jsxs30(Popover2, { open, onOpenChange: setOpen, children: [
|
|
5811
|
+
/* @__PURE__ */ jsx39(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs30(
|
|
5812
|
+
Button,
|
|
5813
|
+
{
|
|
5814
|
+
type: "button",
|
|
5815
|
+
variant: "outline",
|
|
5816
|
+
disabled,
|
|
5817
|
+
"aria-expanded": open,
|
|
5818
|
+
className: cn(
|
|
5819
|
+
"cnc-justify-between cnc-gap-2 cnc-font-bold",
|
|
5820
|
+
triggerClassName
|
|
5821
|
+
),
|
|
5822
|
+
children: [
|
|
5823
|
+
/* @__PURE__ */ jsx39("span", { className: "cnc-text-sm", children: triggerLabel(value) }),
|
|
5824
|
+
/* @__PURE__ */ jsx39(
|
|
5825
|
+
ChevronDown,
|
|
5826
|
+
{
|
|
5827
|
+
className: cn(
|
|
5828
|
+
"cnc-size-4 cnc-transition-transform",
|
|
5829
|
+
open && "cnc-rotate-180"
|
|
5830
|
+
)
|
|
5831
|
+
}
|
|
5832
|
+
)
|
|
5833
|
+
]
|
|
5834
|
+
}
|
|
5835
|
+
) }),
|
|
5836
|
+
/* @__PURE__ */ jsxs30(
|
|
5837
|
+
PopoverContent2,
|
|
5838
|
+
{
|
|
5839
|
+
align: "start",
|
|
5840
|
+
className: cn("cnc-w-72 cnc-p-4", className, contentClassName),
|
|
5841
|
+
children: [
|
|
5842
|
+
/* @__PURE__ */ jsxs30("div", { className: "cnc-mb-4 cnc-flex cnc-items-center cnc-justify-between", children: [
|
|
5843
|
+
/* @__PURE__ */ jsx39(
|
|
5844
|
+
"button",
|
|
5845
|
+
{
|
|
5846
|
+
type: "button",
|
|
5847
|
+
onClick: () => setViewYear((prev) => prev - 1),
|
|
5848
|
+
"aria-label": previousYearLabel,
|
|
5849
|
+
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",
|
|
5850
|
+
children: /* @__PURE__ */ jsx39(ChevronLeft, { className: "cnc-size-5" })
|
|
5851
|
+
}
|
|
5852
|
+
),
|
|
5853
|
+
/* @__PURE__ */ jsx39("span", { className: "cnc-text-base cnc-font-bold cnc-text-primary", children: viewYear }),
|
|
5854
|
+
/* @__PURE__ */ jsx39(
|
|
5855
|
+
"button",
|
|
5856
|
+
{
|
|
5857
|
+
type: "button",
|
|
5858
|
+
onClick: () => setViewYear((prev) => prev + 1),
|
|
5859
|
+
"aria-label": nextYearLabel,
|
|
5860
|
+
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",
|
|
5861
|
+
children: /* @__PURE__ */ jsx39(ChevronRight, { className: "cnc-size-5" })
|
|
5862
|
+
}
|
|
5863
|
+
)
|
|
5864
|
+
] }),
|
|
5865
|
+
/* @__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(
|
|
5866
|
+
"button",
|
|
5867
|
+
{
|
|
5868
|
+
type: "button",
|
|
5869
|
+
onClick: () => handleMonthSelect(monthIndex),
|
|
5870
|
+
"aria-pressed": isSelectedMonth(monthIndex),
|
|
5871
|
+
className: cn(
|
|
5872
|
+
"cnc-rounded-lg cnc-py-2 cnc-text-[10px] cnc-font-bold cnc-uppercase cnc-transition-colors",
|
|
5873
|
+
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"
|
|
5874
|
+
),
|
|
5875
|
+
children: month
|
|
5876
|
+
},
|
|
5877
|
+
month
|
|
5878
|
+
)) })
|
|
5879
|
+
]
|
|
5880
|
+
}
|
|
5881
|
+
)
|
|
5882
|
+
] });
|
|
5883
|
+
}
|
|
5884
|
+
|
|
5885
|
+
// src/components/organisms/period-range-list/index.tsx
|
|
5886
|
+
import * as React27 from "react";
|
|
5887
|
+
import { jsx as jsx40, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5888
|
+
var DEFAULT_LABELS = {
|
|
5889
|
+
start: "In\xEDcio",
|
|
5890
|
+
end: "Fim",
|
|
5891
|
+
add: "Adicionar",
|
|
5892
|
+
empty: "Nenhum per\xEDodo adicionado.",
|
|
5893
|
+
startColumn: "In\xEDcio",
|
|
5894
|
+
endColumn: "Fim",
|
|
5895
|
+
actionsColumn: "A\xE7\xF5es"
|
|
5896
|
+
};
|
|
5897
|
+
function createPeriodId() {
|
|
5898
|
+
return `period-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
5899
|
+
}
|
|
5900
|
+
function normalizePeriods(periods) {
|
|
5901
|
+
return periods.map((period) => ({
|
|
5902
|
+
...period,
|
|
5903
|
+
id: period.id ?? createPeriodId()
|
|
5904
|
+
}));
|
|
5905
|
+
}
|
|
5906
|
+
function formatForDisplay(value, inputType) {
|
|
5907
|
+
if (!value) return "";
|
|
5908
|
+
if (inputType === "date") {
|
|
5909
|
+
const [year2, month2, day2] = value.split("-");
|
|
5910
|
+
if (year2 && month2 && day2) return `${day2}/${month2}/${year2}`;
|
|
5911
|
+
return value;
|
|
5912
|
+
}
|
|
5913
|
+
const normalized = value.slice(0, 16);
|
|
5914
|
+
const [datePart, timePart] = normalized.split("T");
|
|
5915
|
+
if (!datePart) return value;
|
|
5916
|
+
const [year, month, day] = datePart.split("-");
|
|
5917
|
+
const dateText = year && month && day ? `${day}/${month}/${year}` : datePart;
|
|
5918
|
+
return timePart ? `${dateText} ${timePart}` : dateText;
|
|
5919
|
+
}
|
|
5920
|
+
function splitDisplay(value, inputType) {
|
|
5921
|
+
const formatted = formatForDisplay(value, inputType);
|
|
5922
|
+
if (inputType === "date") {
|
|
5923
|
+
return { date: formatted, time: "" };
|
|
5924
|
+
}
|
|
5925
|
+
const parts = formatted.split(" ");
|
|
5926
|
+
if (parts.length <= 1) {
|
|
5927
|
+
return { date: formatted, time: "" };
|
|
5928
|
+
}
|
|
5929
|
+
const time = parts.pop() ?? "";
|
|
5930
|
+
return { date: parts.join(" "), time };
|
|
5931
|
+
}
|
|
5932
|
+
function PeriodRangeList({
|
|
5933
|
+
value = [],
|
|
5934
|
+
onChange,
|
|
5935
|
+
inputType = "datetime-local",
|
|
5936
|
+
labels: labelsProp,
|
|
5937
|
+
readOnly = false,
|
|
5938
|
+
disabled = false,
|
|
5939
|
+
required = false,
|
|
5940
|
+
error,
|
|
5941
|
+
validate,
|
|
5942
|
+
className
|
|
5943
|
+
}) {
|
|
5944
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
5945
|
+
const endAfterStart = validate?.endAfterStart ?? true;
|
|
5946
|
+
const noDuplicates = validate?.noDuplicates ?? true;
|
|
5947
|
+
const [startDraft, setStartDraft] = React27.useState("");
|
|
5948
|
+
const [endDraft, setEndDraft] = React27.useState("");
|
|
5949
|
+
const periods = React27.useMemo(() => normalizePeriods(value), [value]);
|
|
5950
|
+
const isInvalidRange = Boolean(startDraft && endDraft) && endAfterStart && startDraft >= endDraft;
|
|
5951
|
+
const isDuplicate = Boolean(startDraft && endDraft) && noDuplicates && periods.some(
|
|
5952
|
+
(period) => period.start === startDraft && period.end === endDraft
|
|
5953
|
+
);
|
|
5954
|
+
const canAdd = Boolean(startDraft && endDraft) && !isInvalidRange && !isDuplicate;
|
|
5955
|
+
const addTitle = isDuplicate ? "Este per\xEDodo j\xE1 foi adicionado" : isInvalidRange ? "A data final deve ser posterior \xE0 data inicial" : void 0;
|
|
5956
|
+
function emitChange(next) {
|
|
5957
|
+
onChange?.(normalizePeriods(next));
|
|
5958
|
+
}
|
|
5959
|
+
function handleAdd() {
|
|
5960
|
+
if (!canAdd || disabled || readOnly) return;
|
|
5961
|
+
emitChange([
|
|
5962
|
+
...periods,
|
|
5963
|
+
{
|
|
5964
|
+
id: createPeriodId(),
|
|
5965
|
+
start: startDraft,
|
|
5966
|
+
end: endDraft
|
|
5967
|
+
}
|
|
5968
|
+
]);
|
|
5969
|
+
setStartDraft("");
|
|
5970
|
+
setEndDraft("");
|
|
5971
|
+
}
|
|
5972
|
+
function handleRemove(id) {
|
|
5973
|
+
if (disabled || readOnly) return;
|
|
5974
|
+
emitChange(periods.filter((period) => period.id !== id));
|
|
5975
|
+
}
|
|
5976
|
+
const showRequiredOnInputs = required && periods.length === 0;
|
|
5977
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn("cnc-w-full cnc-space-y-4", className), children: [
|
|
5978
|
+
!readOnly && /* @__PURE__ */ jsxs31("div", { className: "cnc-grid cnc-grid-cols-1 md:cnc-grid-cols-12 cnc-gap-4 cnc-items-end", children: [
|
|
5979
|
+
/* @__PURE__ */ jsx40("div", { className: "md:cnc-col-span-5", children: /* @__PURE__ */ jsx40(
|
|
5980
|
+
Input,
|
|
5981
|
+
{
|
|
5982
|
+
type: inputType,
|
|
5983
|
+
label: labels.start,
|
|
5984
|
+
required: showRequiredOnInputs,
|
|
5985
|
+
value: startDraft,
|
|
5986
|
+
disabled,
|
|
5987
|
+
onChange: (event) => setStartDraft(event.target.value)
|
|
5988
|
+
}
|
|
5989
|
+
) }),
|
|
5990
|
+
/* @__PURE__ */ jsx40("div", { className: "md:cnc-col-span-5", children: /* @__PURE__ */ jsx40(
|
|
5991
|
+
Input,
|
|
5992
|
+
{
|
|
5993
|
+
type: inputType,
|
|
5994
|
+
label: labels.end,
|
|
5995
|
+
required: showRequiredOnInputs,
|
|
5996
|
+
value: endDraft,
|
|
5997
|
+
min: startDraft || void 0,
|
|
5998
|
+
disabled,
|
|
5999
|
+
onChange: (event) => setEndDraft(event.target.value)
|
|
6000
|
+
}
|
|
6001
|
+
) }),
|
|
6002
|
+
/* @__PURE__ */ jsx40("div", { className: "md:cnc-col-span-2", children: /* @__PURE__ */ jsxs31(
|
|
6003
|
+
Button,
|
|
6004
|
+
{
|
|
6005
|
+
type: "button",
|
|
6006
|
+
variant: "outline",
|
|
6007
|
+
className: "cnc-w-full cnc-gap-2",
|
|
6008
|
+
disabled: !canAdd || disabled,
|
|
6009
|
+
title: addTitle,
|
|
6010
|
+
onClick: handleAdd,
|
|
6011
|
+
children: [
|
|
6012
|
+
/* @__PURE__ */ jsx40(Plus, { className: "cnc-h-4 cnc-w-4" }),
|
|
6013
|
+
labels.add
|
|
6014
|
+
]
|
|
6015
|
+
}
|
|
6016
|
+
) })
|
|
6017
|
+
] }),
|
|
6018
|
+
/* @__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: [
|
|
6019
|
+
/* @__PURE__ */ jsx40("thead", { className: "cnc-bg-brand-gray-10", children: /* @__PURE__ */ jsxs31("tr", { children: [
|
|
6020
|
+
/* @__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 }),
|
|
6021
|
+
/* @__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 }),
|
|
6022
|
+
!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 })
|
|
6023
|
+
] }) }),
|
|
6024
|
+
/* @__PURE__ */ jsxs31("tbody", { className: "cnc-divide-y cnc-divide-brand-gray-50 cnc-bg-white cnc-text-sm", children: [
|
|
6025
|
+
periods.map((period) => {
|
|
6026
|
+
const startDisplay = splitDisplay(period.start, inputType);
|
|
6027
|
+
const endDisplay = splitDisplay(period.end, inputType);
|
|
6028
|
+
return /* @__PURE__ */ jsxs31("tr", { className: "hover:cnc-bg-brand-gray-10/50", children: [
|
|
6029
|
+
/* @__PURE__ */ jsxs31("td", { className: "cnc-px-6 cnc-py-4 cnc-text-brand-gray-600", children: [
|
|
6030
|
+
/* @__PURE__ */ jsx40("span", { className: "cnc-font-medium cnc-text-brand-gray-600", children: startDisplay.date }),
|
|
6031
|
+
startDisplay.time ? /* @__PURE__ */ jsx40("span", { className: "cnc-ml-2 cnc-text-brand-gray-200", children: startDisplay.time }) : null
|
|
6032
|
+
] }),
|
|
6033
|
+
/* @__PURE__ */ jsxs31("td", { className: "cnc-px-6 cnc-py-4 cnc-text-brand-gray-600", children: [
|
|
6034
|
+
/* @__PURE__ */ jsx40("span", { className: "cnc-font-medium cnc-text-brand-gray-600", children: endDisplay.date }),
|
|
6035
|
+
endDisplay.time ? /* @__PURE__ */ jsx40("span", { className: "cnc-ml-2 cnc-text-brand-gray-200", children: endDisplay.time }) : null
|
|
6036
|
+
] }),
|
|
6037
|
+
!readOnly && /* @__PURE__ */ jsx40("td", { className: "cnc-px-6 cnc-py-4 cnc-text-right", children: /* @__PURE__ */ jsx40(
|
|
6038
|
+
"button",
|
|
6039
|
+
{
|
|
6040
|
+
type: "button",
|
|
6041
|
+
className: "cnc-text-brand-gray-200 hover:cnc-text-brand-red-500 cnc-transition-colors disabled:cnc-opacity-50",
|
|
6042
|
+
disabled,
|
|
6043
|
+
"aria-label": "Remover per\xEDodo",
|
|
6044
|
+
onClick: () => handleRemove(period.id),
|
|
6045
|
+
children: /* @__PURE__ */ jsx40(Trash2, { className: "cnc-h-5 cnc-w-5" })
|
|
6046
|
+
}
|
|
6047
|
+
) })
|
|
6048
|
+
] }, period.id);
|
|
6049
|
+
}),
|
|
6050
|
+
periods.length === 0 && /* @__PURE__ */ jsx40("tr", { children: /* @__PURE__ */ jsx40(
|
|
6051
|
+
"td",
|
|
6052
|
+
{
|
|
6053
|
+
colSpan: readOnly ? 2 : 3,
|
|
6054
|
+
className: "cnc-px-6 cnc-py-8 cnc-text-center cnc-text-brand-gray-200 cnc-italic",
|
|
6055
|
+
children: labels.empty
|
|
6056
|
+
}
|
|
6057
|
+
) })
|
|
6058
|
+
] })
|
|
6059
|
+
] }) }),
|
|
6060
|
+
error ? /* @__PURE__ */ jsx40("p", { className: "cnc-text-xs cnc-font-medium cnc-text-brand-red-500", children: error }) : null
|
|
6061
|
+
] });
|
|
6062
|
+
}
|
|
6063
|
+
var DateTimeRangeList = PeriodRangeList;
|
|
6064
|
+
|
|
6065
|
+
// src/components/organisms/header-notifications/index.tsx
|
|
6066
|
+
import * as React29 from "react";
|
|
6067
|
+
|
|
6068
|
+
// src/components/organisms/header-notifications/cliente.ts
|
|
6069
|
+
var URL_PADRAO_NOTIFICACOES = "https://dev-apinotificacoes-b5feekb4bdfyb7c2.eastus2-01.azurewebsites.net/v1";
|
|
6070
|
+
var ErroNotificacoes = class _ErroNotificacoes extends Error {
|
|
6071
|
+
status;
|
|
6072
|
+
constructor(mensagem, status) {
|
|
6073
|
+
super(mensagem);
|
|
6074
|
+
this.name = "ErroNotificacoes";
|
|
6075
|
+
this.status = status;
|
|
6076
|
+
Object.setPrototypeOf(this, _ErroNotificacoes.prototype);
|
|
6077
|
+
}
|
|
6078
|
+
};
|
|
6079
|
+
function normalizarBaseUrl(baseUrl) {
|
|
6080
|
+
return baseUrl.replace(/\/+$/, "");
|
|
6081
|
+
}
|
|
6082
|
+
function extrairLista(payload) {
|
|
6083
|
+
if (Array.isArray(payload)) return payload;
|
|
6084
|
+
if (payload && typeof payload === "object") {
|
|
6085
|
+
const registro = payload;
|
|
6086
|
+
const chaves = ["dados", "data", "notificacoes", "items", "content"];
|
|
6087
|
+
for (const chave of chaves) {
|
|
6088
|
+
if (Array.isArray(registro[chave])) return registro[chave];
|
|
6089
|
+
}
|
|
6090
|
+
}
|
|
6091
|
+
return [];
|
|
6092
|
+
}
|
|
6093
|
+
async function buscarNotificacoes({
|
|
6094
|
+
baseUrl,
|
|
6095
|
+
email,
|
|
6096
|
+
sistema,
|
|
6097
|
+
filtros,
|
|
6098
|
+
signal
|
|
6099
|
+
}) {
|
|
6100
|
+
const parametros = new URLSearchParams({ email, sistema });
|
|
6101
|
+
for (const [chave, valor] of Object.entries(filtros ?? {})) {
|
|
6102
|
+
if (valor !== void 0 && valor !== null) parametros.set(chave, String(valor));
|
|
6103
|
+
}
|
|
6104
|
+
const resposta = await fetch(
|
|
6105
|
+
`${normalizarBaseUrl(baseUrl)}/notificacoes?${parametros.toString()}`,
|
|
6106
|
+
{ method: "GET", headers: { Accept: "application/json" }, signal }
|
|
6107
|
+
);
|
|
6108
|
+
if (!resposta.ok) {
|
|
6109
|
+
throw new ErroNotificacoes(
|
|
6110
|
+
`Falha ao buscar notifica\xE7\xF5es de ${sistema}`,
|
|
6111
|
+
resposta.status
|
|
6112
|
+
);
|
|
6113
|
+
}
|
|
6114
|
+
return extrairLista(await resposta.json());
|
|
6115
|
+
}
|
|
6116
|
+
async function definirStatusLeitura({ baseUrl, id, signal }, statusLeitura) {
|
|
6117
|
+
const resposta = await fetch(
|
|
6118
|
+
`${normalizarBaseUrl(baseUrl)}/notificacoes/${encodeURIComponent(String(id))}`,
|
|
6119
|
+
{
|
|
6120
|
+
method: "PUT",
|
|
6121
|
+
headers: { "Content-Type": "application/json" },
|
|
6122
|
+
body: JSON.stringify({ statusLeitura }),
|
|
6123
|
+
signal
|
|
6124
|
+
}
|
|
6125
|
+
);
|
|
6126
|
+
if (!resposta.ok) {
|
|
6127
|
+
throw new ErroNotificacoes(
|
|
6128
|
+
`Falha ao definir a notifica\xE7\xE3o ${id} como ${statusLeitura}`,
|
|
6129
|
+
resposta.status
|
|
6130
|
+
);
|
|
6131
|
+
}
|
|
6132
|
+
}
|
|
6133
|
+
function marcarComoLida(parametros) {
|
|
6134
|
+
return definirStatusLeitura(parametros, "LIDO");
|
|
6135
|
+
}
|
|
6136
|
+
function marcarComoNaoLida(parametros) {
|
|
6137
|
+
return definirStatusLeitura(parametros, "NAO_LIDO");
|
|
6138
|
+
}
|
|
6139
|
+
async function excluirNotificacao({
|
|
6140
|
+
baseUrl,
|
|
6141
|
+
id,
|
|
6142
|
+
signal
|
|
6143
|
+
}) {
|
|
6144
|
+
const resposta = await fetch(
|
|
6145
|
+
`${normalizarBaseUrl(baseUrl)}/notificacoes/${encodeURIComponent(String(id))}`,
|
|
6146
|
+
{ method: "DELETE", signal }
|
|
6147
|
+
);
|
|
6148
|
+
if (!resposta.ok) {
|
|
6149
|
+
throw new ErroNotificacoes(
|
|
6150
|
+
`Falha ao excluir a notifica\xE7\xE3o ${id}`,
|
|
6151
|
+
resposta.status
|
|
6152
|
+
);
|
|
6153
|
+
}
|
|
6154
|
+
}
|
|
6155
|
+
function normalizarId(id) {
|
|
6156
|
+
if (typeof id === "number") return id;
|
|
6157
|
+
return /^\d+$/.test(id) ? Number(id) : id;
|
|
6158
|
+
}
|
|
6159
|
+
async function marcarVariasComoLidas({
|
|
6160
|
+
baseUrl,
|
|
6161
|
+
ids,
|
|
6162
|
+
signal
|
|
6163
|
+
}) {
|
|
6164
|
+
if (ids.length === 0) return;
|
|
6165
|
+
const resposta = await fetch(`${normalizarBaseUrl(baseUrl)}/notificacoes/lote`, {
|
|
6166
|
+
method: "PUT",
|
|
6167
|
+
headers: { "Content-Type": "application/json" },
|
|
6168
|
+
body: JSON.stringify({
|
|
6169
|
+
notificacoes: ids.map((id) => ({
|
|
6170
|
+
id: normalizarId(id),
|
|
6171
|
+
statusLeitura: "LIDO"
|
|
6172
|
+
}))
|
|
6173
|
+
}),
|
|
6174
|
+
signal
|
|
6175
|
+
});
|
|
6176
|
+
if (!resposta.ok) {
|
|
6177
|
+
throw new ErroNotificacoes(
|
|
6178
|
+
`Falha ao marcar ${ids.length} notifica\xE7\xF5es como lidas`,
|
|
6179
|
+
resposta.status
|
|
6180
|
+
);
|
|
6181
|
+
}
|
|
6182
|
+
}
|
|
6183
|
+
|
|
6184
|
+
// src/components/organisms/header-notifications/mapear.ts
|
|
6185
|
+
var UM_MINUTO = 6e4;
|
|
6186
|
+
var UMA_HORA = 60 * UM_MINUTO;
|
|
6187
|
+
var UM_DIA = 24 * UMA_HORA;
|
|
6188
|
+
var SETE_DIAS = 7 * UM_DIA;
|
|
6189
|
+
function formatarDataRelativa(valor, agora = Date.now()) {
|
|
6190
|
+
if (!valor) return void 0;
|
|
6191
|
+
const data = new Date(valor);
|
|
6192
|
+
const instante = data.getTime();
|
|
6193
|
+
if (Number.isNaN(instante)) return void 0;
|
|
6194
|
+
const diferenca = agora - instante;
|
|
6195
|
+
const modulo = Math.abs(diferenca);
|
|
6196
|
+
if (diferenca >= SETE_DIAS) {
|
|
6197
|
+
return new Intl.DateTimeFormat("pt-BR", {
|
|
6198
|
+
day: "2-digit",
|
|
6199
|
+
month: "2-digit",
|
|
6200
|
+
year: "2-digit"
|
|
6201
|
+
}).format(data);
|
|
6202
|
+
}
|
|
6203
|
+
if (modulo < UM_MINUTO) return "agora";
|
|
6204
|
+
const formatador = new Intl.RelativeTimeFormat("pt-BR", { numeric: "auto" });
|
|
6205
|
+
const sinal = diferenca < 0 ? 1 : -1;
|
|
6206
|
+
if (modulo < UMA_HORA) {
|
|
6207
|
+
return formatador.format(sinal * Math.trunc(modulo / UM_MINUTO), "minute");
|
|
6208
|
+
}
|
|
6209
|
+
if (modulo < UM_DIA) {
|
|
6210
|
+
return formatador.format(sinal * Math.trunc(modulo / UMA_HORA), "hour");
|
|
6211
|
+
}
|
|
6212
|
+
return formatador.format(sinal * Math.trunc(modulo / UM_DIA), "day");
|
|
6213
|
+
}
|
|
6214
|
+
function instanteDe(notificacao) {
|
|
6215
|
+
const bruto = notificacao.disparadoEm ?? notificacao.dataReferencia;
|
|
6216
|
+
const instante = bruto ? new Date(bruto).getTime() : Number.NaN;
|
|
6217
|
+
return Number.isNaN(instante) ? 0 : instante;
|
|
6218
|
+
}
|
|
6219
|
+
var STATUS_OCULTOS = ["CANCELADO", "FALHOU"];
|
|
6220
|
+
function jaAconteceu(notificacao, agora) {
|
|
6221
|
+
if (notificacao.disparadoEm) return true;
|
|
6222
|
+
const referencia = notificacao.dataReferencia ? new Date(notificacao.dataReferencia).getTime() : Number.NaN;
|
|
6223
|
+
return !Number.isNaN(referencia) && referencia <= agora;
|
|
6224
|
+
}
|
|
6225
|
+
function selecionarVisiveis(notificacoes, limite = Number.POSITIVE_INFINITY, agora = Date.now()) {
|
|
6226
|
+
return notificacoes.filter(
|
|
6227
|
+
(notificacao) => Boolean(notificacao) && jaAconteceu(notificacao, agora) && !STATUS_OCULTOS.includes(notificacao.status)
|
|
6228
|
+
).sort((a, b) => instanteDe(b) - instanteDe(a)).slice(0, limite);
|
|
6229
|
+
}
|
|
6230
|
+
function selecionarLembretesVencidos(notificacoes, agora = Date.now()) {
|
|
6231
|
+
return notificacoes.filter((notificacao) => {
|
|
6232
|
+
if (!notificacao?.lembrarNoDia) return false;
|
|
6233
|
+
if (notificacao.statusLeitura === "LIDO") return false;
|
|
6234
|
+
if (STATUS_OCULTOS.includes(notificacao.status)) return false;
|
|
6235
|
+
const lembrete = notificacao.dataLembrete ? new Date(notificacao.dataLembrete).getTime() : Number.NaN;
|
|
6236
|
+
return !Number.isNaN(lembrete) && lembrete <= agora;
|
|
6237
|
+
}).sort(
|
|
6238
|
+
(a, b) => new Date(b.dataLembrete ?? 0).getTime() - new Date(a.dataLembrete ?? 0).getTime()
|
|
6239
|
+
);
|
|
6240
|
+
}
|
|
6241
|
+
function contarNaoLidas(notificacoes) {
|
|
6242
|
+
return notificacoes.filter(
|
|
6243
|
+
(notificacao) => notificacao.statusLeitura !== "LIDO"
|
|
6244
|
+
).length;
|
|
6245
|
+
}
|
|
6246
|
+
function mapearParaItem(notificacao, getHref, agora) {
|
|
6247
|
+
return {
|
|
6248
|
+
id: notificacao.id,
|
|
6249
|
+
title: notificacao.titulo,
|
|
6250
|
+
message: notificacao.mensagem ?? void 0,
|
|
6251
|
+
date: formatarDataRelativa(
|
|
6252
|
+
notificacao.disparadoEm ?? notificacao.dataReferencia,
|
|
6253
|
+
agora
|
|
6254
|
+
),
|
|
6255
|
+
read: notificacao.statusLeitura === "LIDO",
|
|
6256
|
+
href: getHref?.(notificacao)
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
|
|
6260
|
+
// src/components/organisms/header-notifications/modal-lembretes.tsx
|
|
6261
|
+
import { jsx as jsx41, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6262
|
+
function ModalLembretes({
|
|
6263
|
+
lembretes,
|
|
6264
|
+
aberto,
|
|
6265
|
+
onDispensar,
|
|
6266
|
+
titulo,
|
|
6267
|
+
rotuloDispensar = "Entendi"
|
|
6268
|
+
}) {
|
|
6269
|
+
const visivel = aberto && lembretes.length > 0;
|
|
6270
|
+
const tituloExibido = titulo ?? (lembretes.length === 1 ? "Voc\xEA tem um lembrete" : "Voc\xEA tem lembretes");
|
|
6271
|
+
return /* @__PURE__ */ jsx41(
|
|
6272
|
+
Dialog,
|
|
6273
|
+
{
|
|
6274
|
+
open: visivel,
|
|
6275
|
+
onOpenChange: (proximoEstado) => {
|
|
6276
|
+
if (!proximoEstado) onDispensar();
|
|
6277
|
+
},
|
|
6278
|
+
children: /* @__PURE__ */ jsxs32(
|
|
6279
|
+
DialogContent,
|
|
6280
|
+
{
|
|
6281
|
+
className: "cnc-max-w-[440px] cnc-rounded-lg cnc-bg-white cnc-p-0",
|
|
6282
|
+
onOpenAutoFocus: (evento) => evento.preventDefault(),
|
|
6283
|
+
children: [
|
|
6284
|
+
/* @__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: [
|
|
6285
|
+
/* @__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(
|
|
6286
|
+
BellRing,
|
|
6287
|
+
{
|
|
6288
|
+
className: "cnc-h-[18px] cnc-w-[18px] cnc-text-brand-blue-400",
|
|
6289
|
+
"aria-hidden": "true"
|
|
6290
|
+
}
|
|
6291
|
+
) }),
|
|
6292
|
+
/* @__PURE__ */ jsx41(DialogTitle, { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: tituloExibido })
|
|
6293
|
+
] }),
|
|
6294
|
+
/* @__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(
|
|
6295
|
+
"li",
|
|
6296
|
+
{
|
|
6297
|
+
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",
|
|
6298
|
+
children: [
|
|
6299
|
+
/* @__PURE__ */ jsxs32("div", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-3", children: [
|
|
6300
|
+
/* @__PURE__ */ jsx41("span", { className: "cnc-text-sm cnc-font-bold cnc-text-brand-blue-900", children: lembrete.titulo }),
|
|
6301
|
+
/* @__PURE__ */ jsx41("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: formatarDataRelativa(lembrete.dataLembrete) })
|
|
6302
|
+
] }),
|
|
6303
|
+
lembrete.mensagem && /* @__PURE__ */ jsx41("span", { className: "cnc-text-xs cnc-leading-relaxed cnc-text-brand-gray-600", children: lembrete.mensagem })
|
|
6304
|
+
]
|
|
6305
|
+
},
|
|
6306
|
+
lembrete.id
|
|
6307
|
+
)) }),
|
|
6308
|
+
/* @__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: [
|
|
6309
|
+
/* @__PURE__ */ jsx41(Button, { variant: "confirm", className: "cnc-w-full", onClick: onDispensar, children: rotuloDispensar }),
|
|
6310
|
+
/* @__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.` })
|
|
6311
|
+
] })
|
|
6312
|
+
]
|
|
6313
|
+
}
|
|
6314
|
+
)
|
|
6315
|
+
}
|
|
6316
|
+
);
|
|
6317
|
+
}
|
|
6318
|
+
|
|
6319
|
+
// src/components/organisms/header-notifications/usar-notificacoes.ts
|
|
6320
|
+
import * as React28 from "react";
|
|
6321
|
+
function foiAbortado(erro) {
|
|
6322
|
+
return erro?.name === "AbortError";
|
|
6323
|
+
}
|
|
6324
|
+
function usarNotificacoes({
|
|
6325
|
+
email,
|
|
6326
|
+
sistema,
|
|
6327
|
+
baseUrl,
|
|
6328
|
+
filtros,
|
|
6329
|
+
intervaloAtualizacao = 6e4,
|
|
6330
|
+
habilitado = true,
|
|
6331
|
+
onErro
|
|
6332
|
+
}) {
|
|
6333
|
+
const [notificacoes, setNotificacoes] = React28.useState([]);
|
|
6334
|
+
const [carregando, setCarregando] = React28.useState(habilitado);
|
|
6335
|
+
const notificacoesRef = React28.useRef(notificacoes);
|
|
6336
|
+
const controladorRef = React28.useRef(null);
|
|
6337
|
+
const jaCarregouRef = React28.useRef(false);
|
|
6338
|
+
const onErroRef = React28.useRef(onErro);
|
|
6339
|
+
React28.useEffect(() => {
|
|
6340
|
+
notificacoesRef.current = notificacoes;
|
|
6341
|
+
}, [notificacoes]);
|
|
6342
|
+
React28.useEffect(() => {
|
|
6343
|
+
onErroRef.current = onErro;
|
|
6344
|
+
}, [onErro]);
|
|
6345
|
+
const chaveFiltros = JSON.stringify(filtros ?? {});
|
|
6346
|
+
const atualizar = React28.useCallback(() => {
|
|
6347
|
+
if (!habilitado) return;
|
|
6348
|
+
controladorRef.current?.abort();
|
|
6349
|
+
const controlador = new AbortController();
|
|
6350
|
+
controladorRef.current = controlador;
|
|
6351
|
+
void (async () => {
|
|
6352
|
+
try {
|
|
6353
|
+
const lista = await buscarNotificacoes({
|
|
6354
|
+
baseUrl,
|
|
6355
|
+
email,
|
|
6356
|
+
sistema,
|
|
6357
|
+
filtros: JSON.parse(chaveFiltros),
|
|
6358
|
+
signal: controlador.signal
|
|
6359
|
+
});
|
|
6360
|
+
if (controlador.signal.aborted) return;
|
|
6361
|
+
setNotificacoes(lista);
|
|
6362
|
+
} catch (erro) {
|
|
6363
|
+
if (controlador.signal.aborted || foiAbortado(erro)) return;
|
|
6364
|
+
onErroRef.current?.(erro);
|
|
6365
|
+
} finally {
|
|
6366
|
+
if (!controlador.signal.aborted) {
|
|
6367
|
+
jaCarregouRef.current = true;
|
|
6368
|
+
setCarregando(false);
|
|
6369
|
+
}
|
|
6370
|
+
}
|
|
6371
|
+
})();
|
|
6372
|
+
}, [baseUrl, email, sistema, chaveFiltros, habilitado]);
|
|
6373
|
+
React28.useEffect(() => {
|
|
6374
|
+
if (!habilitado) {
|
|
6375
|
+
setCarregando(false);
|
|
6376
|
+
return;
|
|
6377
|
+
}
|
|
6378
|
+
if (!jaCarregouRef.current) setCarregando(true);
|
|
6379
|
+
atualizar();
|
|
6380
|
+
return () => controladorRef.current?.abort();
|
|
6381
|
+
}, [atualizar, habilitado]);
|
|
6382
|
+
React28.useEffect(() => {
|
|
6383
|
+
if (!habilitado || !intervaloAtualizacao) return;
|
|
6384
|
+
const temporizador = window.setInterval(() => {
|
|
6385
|
+
if (typeof document !== "undefined" && document.hidden) return;
|
|
6386
|
+
atualizar();
|
|
6387
|
+
}, intervaloAtualizacao);
|
|
6388
|
+
return () => window.clearInterval(temporizador);
|
|
6389
|
+
}, [atualizar, habilitado, intervaloAtualizacao]);
|
|
6390
|
+
const aplicarLeitura = React28.useCallback((ids) => {
|
|
6391
|
+
const alvos = new Set(ids.map(String));
|
|
6392
|
+
setNotificacoes(
|
|
6393
|
+
(atuais) => atuais.map(
|
|
6394
|
+
(notificacao) => alvos.has(String(notificacao.id)) ? { ...notificacao, statusLeitura: "LIDO" } : notificacao
|
|
6395
|
+
)
|
|
6396
|
+
);
|
|
6397
|
+
}, []);
|
|
6398
|
+
const reverterLeitura = React28.useCallback((anteriores) => {
|
|
6399
|
+
const original = new Map(
|
|
6400
|
+
anteriores.map((notificacao) => [String(notificacao.id), notificacao])
|
|
6401
|
+
);
|
|
6402
|
+
setNotificacoes(
|
|
6403
|
+
(atuais) => atuais.map((notificacao) => {
|
|
6404
|
+
const anterior = original.get(String(notificacao.id));
|
|
6405
|
+
return anterior ? {
|
|
6406
|
+
...notificacao,
|
|
6407
|
+
statusLeitura: anterior.statusLeitura,
|
|
6408
|
+
lidoEm: anterior.lidoEm
|
|
6409
|
+
} : notificacao;
|
|
6410
|
+
})
|
|
6411
|
+
);
|
|
6412
|
+
}, []);
|
|
6413
|
+
const marcarUmaComoLida = React28.useCallback(
|
|
6414
|
+
(id) => {
|
|
6415
|
+
const alvo = notificacoesRef.current.find(
|
|
6416
|
+
(notificacao) => String(notificacao.id) === String(id)
|
|
6417
|
+
);
|
|
6418
|
+
if (!alvo || alvo.statusLeitura === "LIDO") return;
|
|
6419
|
+
aplicarLeitura([id]);
|
|
6420
|
+
void marcarComoLida({ baseUrl, id }).catch((erro) => {
|
|
6421
|
+
reverterLeitura([alvo]);
|
|
6422
|
+
onErroRef.current?.(erro);
|
|
6423
|
+
});
|
|
6424
|
+
},
|
|
6425
|
+
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
6426
|
+
);
|
|
6427
|
+
const marcarComoLidas = React28.useCallback(
|
|
6428
|
+
(ids) => {
|
|
6429
|
+
const alvos = new Set(ids.map(String));
|
|
6430
|
+
const naoLidas = notificacoesRef.current.filter(
|
|
6431
|
+
(notificacao) => alvos.has(String(notificacao.id)) && notificacao.statusLeitura !== "LIDO"
|
|
6432
|
+
);
|
|
6433
|
+
if (naoLidas.length === 0) return;
|
|
6434
|
+
aplicarLeitura(naoLidas.map((notificacao) => notificacao.id));
|
|
6435
|
+
void marcarVariasComoLidas({
|
|
6436
|
+
baseUrl,
|
|
6437
|
+
ids: naoLidas.map((notificacao) => notificacao.id)
|
|
6438
|
+
}).catch((erro) => {
|
|
6439
|
+
reverterLeitura(naoLidas);
|
|
6440
|
+
onErroRef.current?.(erro);
|
|
6441
|
+
});
|
|
6442
|
+
},
|
|
6443
|
+
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
6444
|
+
);
|
|
6445
|
+
const marcarTodasComoLidas = React28.useCallback(() => {
|
|
6446
|
+
marcarComoLidas(notificacoesRef.current.map((notificacao) => notificacao.id));
|
|
6447
|
+
}, [marcarComoLidas]);
|
|
6448
|
+
const marcarUmaComoNaoLida = React28.useCallback(
|
|
6449
|
+
(id) => {
|
|
6450
|
+
const alvo = notificacoesRef.current.find(
|
|
6451
|
+
(notificacao) => String(notificacao.id) === String(id)
|
|
6452
|
+
);
|
|
6453
|
+
if (!alvo || alvo.statusLeitura === "NAO_LIDO") return;
|
|
6454
|
+
setNotificacoes(
|
|
6455
|
+
(atuais) => atuais.map(
|
|
6456
|
+
(notificacao) => String(notificacao.id) === String(id) ? { ...notificacao, statusLeitura: "NAO_LIDO" } : notificacao
|
|
6457
|
+
)
|
|
6458
|
+
);
|
|
6459
|
+
void marcarComoNaoLida({ baseUrl, id }).catch((erro) => {
|
|
6460
|
+
reverterLeitura([alvo]);
|
|
6461
|
+
onErroRef.current?.(erro);
|
|
6462
|
+
});
|
|
6463
|
+
},
|
|
6464
|
+
[baseUrl, reverterLeitura]
|
|
6465
|
+
);
|
|
6466
|
+
const excluir = React28.useCallback(
|
|
6467
|
+
(id) => {
|
|
6468
|
+
const alvo = notificacoesRef.current.find(
|
|
6469
|
+
(notificacao) => String(notificacao.id) === String(id)
|
|
6470
|
+
);
|
|
6471
|
+
if (!alvo) return;
|
|
6472
|
+
setNotificacoes(
|
|
6473
|
+
(atuais) => atuais.filter((notificacao) => String(notificacao.id) !== String(id))
|
|
6474
|
+
);
|
|
6475
|
+
void excluirNotificacao({ baseUrl, id }).catch((erro) => {
|
|
6476
|
+
onErroRef.current?.(erro);
|
|
6477
|
+
atualizar();
|
|
6478
|
+
});
|
|
6479
|
+
},
|
|
6480
|
+
[baseUrl, atualizar]
|
|
6481
|
+
);
|
|
6482
|
+
return {
|
|
6483
|
+
notificacoes,
|
|
6484
|
+
carregando,
|
|
6485
|
+
atualizar,
|
|
6486
|
+
marcarUmaComoLida,
|
|
6487
|
+
marcarUmaComoNaoLida,
|
|
6488
|
+
marcarComoLidas,
|
|
6489
|
+
marcarTodasComoLidas,
|
|
6490
|
+
excluir
|
|
6491
|
+
};
|
|
6492
|
+
}
|
|
6493
|
+
|
|
6494
|
+
// src/components/organisms/header-notifications/index.tsx
|
|
6495
|
+
import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
6496
|
+
function HeaderNotifications(props) {
|
|
6497
|
+
const {
|
|
6498
|
+
items = [],
|
|
6499
|
+
isLoading = false,
|
|
6500
|
+
skeletonCount = 3,
|
|
6501
|
+
title = "Notifica\xE7\xF5es",
|
|
6502
|
+
emptyMessage = "Nenhuma notifica\xE7\xE3o",
|
|
6503
|
+
unreadCount,
|
|
6504
|
+
maxCount = 9,
|
|
6505
|
+
onSelect,
|
|
6506
|
+
onMarkAsRead,
|
|
6507
|
+
onMarkAsUnread,
|
|
6508
|
+
onDelete,
|
|
6509
|
+
onMarkAllAsRead,
|
|
6510
|
+
onOpenChange,
|
|
6511
|
+
footer,
|
|
6512
|
+
align = "end",
|
|
6513
|
+
className,
|
|
6514
|
+
contentClassName,
|
|
6515
|
+
email,
|
|
6516
|
+
sistema,
|
|
6517
|
+
baseUrl = URL_PADRAO_NOTIFICACOES,
|
|
6518
|
+
getHref,
|
|
6519
|
+
filtros,
|
|
6520
|
+
intervaloAtualizacao,
|
|
6521
|
+
limite = 20,
|
|
6522
|
+
onErro,
|
|
6523
|
+
alertarLembretes = false,
|
|
6524
|
+
tituloLembretes,
|
|
6525
|
+
rotuloDispensarLembretes
|
|
6526
|
+
} = props;
|
|
6527
|
+
const [aberto, setAberto] = React29.useState(false);
|
|
6528
|
+
const [lembretesEmAlerta, setLembretesEmAlerta] = React29.useState(
|
|
6529
|
+
[]
|
|
6530
|
+
);
|
|
6531
|
+
const avaliouLembretesRef = React29.useRef(false);
|
|
6532
|
+
const conectado = Boolean(email && sistema);
|
|
6533
|
+
const remoto = usarNotificacoes({
|
|
6534
|
+
email: email ?? "",
|
|
6535
|
+
sistema: sistema ?? "",
|
|
6536
|
+
baseUrl,
|
|
6537
|
+
filtros,
|
|
6538
|
+
intervaloAtualizacao,
|
|
6539
|
+
habilitado: conectado,
|
|
6540
|
+
onErro
|
|
6541
|
+
});
|
|
6542
|
+
const elegiveis = React29.useMemo(
|
|
6543
|
+
() => conectado ? selecionarVisiveis(remoto.notificacoes) : [],
|
|
6544
|
+
[conectado, remoto.notificacoes]
|
|
6545
|
+
);
|
|
6546
|
+
const itensRemotos = React29.useMemo(
|
|
6547
|
+
() => elegiveis.slice(0, limite).map((notificacao) => mapearParaItem(notificacao, getHref)),
|
|
6548
|
+
[elegiveis, limite, getHref]
|
|
6549
|
+
);
|
|
6550
|
+
const itens = conectado ? itensRemotos : items;
|
|
6551
|
+
const carregandoLista = conectado ? remoto.carregando : isLoading;
|
|
6552
|
+
React29.useEffect(() => {
|
|
6553
|
+
if (!conectado || !alertarLembretes) return;
|
|
6554
|
+
if (remoto.carregando || avaliouLembretesRef.current) return;
|
|
6555
|
+
avaliouLembretesRef.current = true;
|
|
6556
|
+
setLembretesEmAlerta(selecionarLembretesVencidos(remoto.notificacoes));
|
|
6557
|
+
}, [conectado, alertarLembretes, remoto.carregando, remoto.notificacoes]);
|
|
6558
|
+
const dispensarLembretes = () => {
|
|
6559
|
+
remoto.marcarComoLidas(lembretesEmAlerta.map((lembrete) => lembrete.id));
|
|
6560
|
+
setLembretesEmAlerta([]);
|
|
6561
|
+
};
|
|
6562
|
+
const naoLidas = conectado ? contarNaoLidas(elegiveis) : unreadCount ?? items.filter((item) => !item.read).length;
|
|
6563
|
+
const rotuloContagem = naoLidas > maxCount ? `${maxCount}+` : `${naoLidas}`;
|
|
6564
|
+
const alterarAbertura = (proximoEstado) => {
|
|
6565
|
+
setAberto(proximoEstado);
|
|
6566
|
+
if (proximoEstado && conectado) remoto.atualizar();
|
|
6567
|
+
onOpenChange?.(proximoEstado);
|
|
6568
|
+
};
|
|
6569
|
+
const selecionar = (item) => {
|
|
6570
|
+
if (!item.read) {
|
|
6571
|
+
if (conectado) remoto.marcarUmaComoLida(item.id);
|
|
6572
|
+
onMarkAsRead?.(item);
|
|
6573
|
+
}
|
|
6574
|
+
if (!onSelect) return;
|
|
6575
|
+
onSelect(item);
|
|
6576
|
+
alterarAbertura(false);
|
|
6577
|
+
};
|
|
6578
|
+
const marcarTodas = () => {
|
|
6579
|
+
if (conectado) remoto.marcarTodasComoLidas();
|
|
6580
|
+
onMarkAllAsRead?.();
|
|
6581
|
+
};
|
|
6582
|
+
const alternarLeitura = (item) => {
|
|
6583
|
+
if (item.read) {
|
|
6584
|
+
if (conectado) remoto.marcarUmaComoNaoLida(item.id);
|
|
6585
|
+
onMarkAsUnread?.(item);
|
|
6586
|
+
return;
|
|
6587
|
+
}
|
|
6588
|
+
if (conectado) remoto.marcarUmaComoLida(item.id);
|
|
6589
|
+
onMarkAsRead?.(item);
|
|
6590
|
+
};
|
|
6591
|
+
const excluirItem = (item) => {
|
|
6592
|
+
if (conectado) remoto.excluir(item.id);
|
|
6593
|
+
onDelete?.(item);
|
|
6594
|
+
};
|
|
6595
|
+
const podeMarcarTodas = conectado || Boolean(onMarkAllAsRead);
|
|
6596
|
+
const podeAlternarLeitura = conectado || Boolean(onMarkAsUnread);
|
|
6597
|
+
const podeExcluir = conectado || Boolean(onDelete);
|
|
6598
|
+
const alvoClicavel = conectado || Boolean(onSelect) || Boolean(onMarkAsRead);
|
|
6599
|
+
const anelDeFoco = "focus-visible:cnc-ring-2 focus-visible:cnc-ring-inset focus-visible:cnc-ring-brand-gray-500/50";
|
|
6600
|
+
const renderarConteudo = () => {
|
|
6601
|
+
if (carregandoLista) {
|
|
6602
|
+
return /* @__PURE__ */ jsx42("div", { "aria-busy": "true", children: Array.from({ length: skeletonCount }).map((_, indice) => /* @__PURE__ */ jsx42(
|
|
6603
|
+
"div",
|
|
6604
|
+
{
|
|
6605
|
+
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",
|
|
6606
|
+
children: /* @__PURE__ */ jsxs33("div", { className: "cnc-flex cnc-w-full cnc-flex-col cnc-gap-2", children: [
|
|
6607
|
+
/* @__PURE__ */ jsx42("div", { className: "cnc-h-3 cnc-w-1/2 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" }),
|
|
6608
|
+
/* @__PURE__ */ jsx42("div", { className: "cnc-h-3 cnc-w-3/4 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" })
|
|
6609
|
+
] })
|
|
6610
|
+
},
|
|
6611
|
+
indice
|
|
6612
|
+
)) });
|
|
6613
|
+
}
|
|
6614
|
+
if (itens.length === 0) {
|
|
6615
|
+
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: [
|
|
6616
|
+
/* @__PURE__ */ jsx42(BellOff, { className: "cnc-mb-2 cnc-h-7 cnc-w-7", "aria-hidden": "true" }),
|
|
6617
|
+
/* @__PURE__ */ jsx42("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
6618
|
+
] });
|
|
6619
|
+
}
|
|
6620
|
+
return /* @__PURE__ */ jsx42("ul", { className: "cnc-m-0 cnc-list-none cnc-p-0", children: itens.map((item) => {
|
|
6621
|
+
const conteudo = /* @__PURE__ */ jsxs33("span", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-flex-col cnc-gap-0.5", children: [
|
|
6622
|
+
/* @__PURE__ */ jsxs33("span", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-2", children: [
|
|
6623
|
+
/* @__PURE__ */ jsx42(
|
|
6624
|
+
"span",
|
|
6625
|
+
{
|
|
6626
|
+
className: cn(
|
|
6627
|
+
"cnc-truncate cnc-text-sm cnc-text-brand-blue-900",
|
|
6628
|
+
item.read ? "cnc-font-medium" : "cnc-font-bold"
|
|
6629
|
+
),
|
|
6630
|
+
children: item.title
|
|
6631
|
+
}
|
|
6632
|
+
),
|
|
6633
|
+
item.date && /* @__PURE__ */ jsx42("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: item.date })
|
|
6634
|
+
] }),
|
|
6635
|
+
item.message && /* @__PURE__ */ jsx42("span", { className: "cnc-line-clamp-2 cnc-text-xs cnc-text-brand-gray-600", children: item.message }),
|
|
6636
|
+
!item.read && /* @__PURE__ */ jsx42("span", { className: "cnc-sr-only", children: "N\xE3o lida" })
|
|
6637
|
+
] });
|
|
6638
|
+
const classesLinha = cn(
|
|
6639
|
+
"cnc-flex cnc-w-full cnc-items-start cnc-border-l-[3px] cnc-transition cnc-duration-200",
|
|
6640
|
+
item.read ? "cnc-border-l-transparent hover:cnc-bg-brand-blue-50" : "cnc-border-l-brand-blue-400 cnc-bg-brand-blue-50 hover:cnc-bg-brand-blue-60"
|
|
6641
|
+
);
|
|
6642
|
+
const classesAlvo = cn(
|
|
6643
|
+
"cnc-flex cnc-min-w-0 cnc-flex-1 cnc-bg-transparent cnc-py-3 cnc-pl-3 cnc-pr-2 cnc-text-left cnc-no-underline cnc-outline-none",
|
|
6644
|
+
alvoClicavel && "cnc-cursor-pointer",
|
|
6645
|
+
anelDeFoco
|
|
6646
|
+
);
|
|
6647
|
+
const classesAcao = cn(
|
|
6648
|
+
"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",
|
|
6649
|
+
anelDeFoco
|
|
6650
|
+
);
|
|
6651
|
+
const renderarAlvo = () => alvoClicavel ? /* @__PURE__ */ jsx42(
|
|
6652
|
+
"button",
|
|
6653
|
+
{
|
|
6654
|
+
type: "button",
|
|
6655
|
+
onClick: () => selecionar(item),
|
|
6656
|
+
className: classesAlvo,
|
|
6657
|
+
children: conteudo
|
|
6658
|
+
}
|
|
6659
|
+
) : /* @__PURE__ */ jsx42("div", { className: classesAlvo, children: conteudo });
|
|
6660
|
+
const rotuloLeitura = item.read ? "Marcar como n\xE3o lida" : "Marcar como lida";
|
|
6661
|
+
return /* @__PURE__ */ jsx42(
|
|
6662
|
+
"li",
|
|
6663
|
+
{
|
|
6664
|
+
className: "cnc-border-b cnc-border-brand-gray-50 last:cnc-border-b-0",
|
|
6665
|
+
children: /* @__PURE__ */ jsxs33("div", { className: classesLinha, children: [
|
|
6666
|
+
renderarAlvo(),
|
|
6667
|
+
(podeAlternarLeitura || podeExcluir) && /* @__PURE__ */ jsxs33("div", { className: "cnc-flex cnc-shrink-0 cnc-items-center cnc-gap-1 cnc-py-3 cnc-pr-2", children: [
|
|
6668
|
+
podeAlternarLeitura && /* @__PURE__ */ jsx42(
|
|
6669
|
+
"button",
|
|
6670
|
+
{
|
|
6671
|
+
type: "button",
|
|
6672
|
+
"aria-label": rotuloLeitura,
|
|
6673
|
+
title: rotuloLeitura,
|
|
6674
|
+
onClick: () => alternarLeitura(item),
|
|
6675
|
+
className: cn(
|
|
6676
|
+
classesAcao,
|
|
6677
|
+
"hover:cnc-text-brand-blue-400"
|
|
6678
|
+
),
|
|
6679
|
+
children: item.read ? /* @__PURE__ */ jsx42(Mail, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx42(
|
|
6680
|
+
MailOpen,
|
|
6681
|
+
{
|
|
6682
|
+
className: "cnc-h-4 cnc-w-4",
|
|
6683
|
+
"aria-hidden": "true"
|
|
6684
|
+
}
|
|
6685
|
+
)
|
|
6686
|
+
}
|
|
6687
|
+
),
|
|
6688
|
+
podeExcluir && /* @__PURE__ */ jsx42(
|
|
6689
|
+
"button",
|
|
6690
|
+
{
|
|
6691
|
+
type: "button",
|
|
6692
|
+
"aria-label": "Excluir notifica\xE7\xE3o",
|
|
6693
|
+
title: "Excluir notifica\xE7\xE3o",
|
|
6694
|
+
onClick: () => excluirItem(item),
|
|
6695
|
+
className: cn(classesAcao, "hover:cnc-text-brand-red-600"),
|
|
6696
|
+
children: /* @__PURE__ */ jsx42(Trash2, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" })
|
|
6697
|
+
}
|
|
6698
|
+
)
|
|
6699
|
+
] })
|
|
6700
|
+
] })
|
|
6701
|
+
},
|
|
6702
|
+
item.id
|
|
6703
|
+
);
|
|
6704
|
+
}) });
|
|
6705
|
+
};
|
|
6706
|
+
const temRodapePadrao = podeMarcarTodas && naoLidas > 0;
|
|
6707
|
+
return /* @__PURE__ */ jsxs33(Fragment8, { children: [
|
|
6708
|
+
alertarLembretes && /* @__PURE__ */ jsx42(
|
|
6709
|
+
ModalLembretes,
|
|
6710
|
+
{
|
|
6711
|
+
lembretes: lembretesEmAlerta,
|
|
6712
|
+
aberto: lembretesEmAlerta.length > 0,
|
|
6713
|
+
onDispensar: dispensarLembretes,
|
|
6714
|
+
titulo: tituloLembretes,
|
|
6715
|
+
rotuloDispensar: rotuloDispensarLembretes
|
|
6716
|
+
}
|
|
6717
|
+
),
|
|
6718
|
+
/* @__PURE__ */ jsxs33(Popover, { open: aberto, onOpenChange: alterarAbertura, children: [
|
|
6719
|
+
/* @__PURE__ */ jsx42(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs33(
|
|
6720
|
+
"button",
|
|
6721
|
+
{
|
|
6722
|
+
type: "button",
|
|
6723
|
+
"aria-label": naoLidas > 0 ? `${title}, ${naoLidas} n\xE3o ${naoLidas === 1 ? "lida" : "lidas"}` : title,
|
|
6724
|
+
className: cn(
|
|
6725
|
+
"cnc-relative cnc-flex cnc-h-10 cnc-w-10 cnc-items-center cnc-justify-center cnc-rounded-full cnc-transition cnc-duration-300 cnc-ease-in-out hover:cnc-bg-brand-blue-60 data-[state=open]:cnc-bg-brand-blue-60 cnc-cursor-pointer cnc-outline-none cnc-header-item",
|
|
6726
|
+
anelDeFoco,
|
|
6727
|
+
className
|
|
6728
|
+
),
|
|
6729
|
+
children: [
|
|
6730
|
+
/* @__PURE__ */ jsx42(
|
|
6731
|
+
Bell,
|
|
6732
|
+
{
|
|
6733
|
+
className: "cnc-h-5 cnc-w-5 cnc-text-brand-blue-900 cnc-header-item",
|
|
6734
|
+
"aria-hidden": "true"
|
|
6735
|
+
}
|
|
6736
|
+
),
|
|
6737
|
+
naoLidas > 0 && /* @__PURE__ */ jsx42(
|
|
6738
|
+
"span",
|
|
6739
|
+
{
|
|
6740
|
+
"aria-hidden": "true",
|
|
6741
|
+
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",
|
|
6742
|
+
children: rotuloContagem
|
|
6743
|
+
}
|
|
6744
|
+
)
|
|
6745
|
+
]
|
|
6746
|
+
}
|
|
6747
|
+
) }),
|
|
6748
|
+
/* @__PURE__ */ jsxs33(
|
|
6749
|
+
PopoverContent,
|
|
6750
|
+
{
|
|
6751
|
+
align,
|
|
6752
|
+
sideOffset: 20,
|
|
6753
|
+
"aria-label": title,
|
|
6754
|
+
style: { width: "min(380px, calc(100vw - 2rem))", padding: 0 },
|
|
6755
|
+
className: cn(
|
|
6756
|
+
"cnc-overflow-hidden cnc-rounded-lg cnc-border cnc-border-brand-gray-50 cnc-bg-white cnc-shadow-custom",
|
|
6757
|
+
contentClassName
|
|
6758
|
+
),
|
|
6759
|
+
children: [
|
|
6760
|
+
/* @__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: [
|
|
6761
|
+
/* @__PURE__ */ jsx42("h2", { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: title }),
|
|
6762
|
+
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` })
|
|
6763
|
+
] }),
|
|
6764
|
+
/* @__PURE__ */ jsx42("div", { className: "cnc-max-h-[360px] cnc-overflow-y-auto", children: renderarConteudo() }),
|
|
6765
|
+
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(
|
|
6766
|
+
"button",
|
|
6767
|
+
{
|
|
6768
|
+
type: "button",
|
|
6769
|
+
onClick: marcarTodas,
|
|
6770
|
+
className: cn(
|
|
6771
|
+
"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",
|
|
6772
|
+
anelDeFoco
|
|
6773
|
+
),
|
|
6774
|
+
children: "Marcar todas como lidas"
|
|
6775
|
+
}
|
|
6776
|
+
) })
|
|
6777
|
+
]
|
|
6778
|
+
}
|
|
6779
|
+
)
|
|
6780
|
+
] })
|
|
6781
|
+
] });
|
|
6782
|
+
}
|
|
6783
|
+
export {
|
|
6784
|
+
AplicationsHeader,
|
|
6785
|
+
AppsMenu,
|
|
6786
|
+
Avatar,
|
|
6787
|
+
Badge,
|
|
6788
|
+
Button,
|
|
6789
|
+
Card,
|
|
6790
|
+
CardContent,
|
|
6791
|
+
CardFooter,
|
|
6792
|
+
CardFooterItem,
|
|
6793
|
+
CardHeader,
|
|
6794
|
+
CardList,
|
|
6795
|
+
Checkbox,
|
|
6796
|
+
Collapsible,
|
|
6797
|
+
AnimatedCollapsibleContent as CollapsibleContent,
|
|
6798
|
+
CollapsibleTrigger2 as CollapsibleTrigger,
|
|
6799
|
+
Combobox,
|
|
6800
|
+
Command,
|
|
6801
|
+
CommandDialog,
|
|
6802
|
+
CommandEmpty,
|
|
6803
|
+
CommandGroup,
|
|
6804
|
+
CommandInput,
|
|
6805
|
+
CommandItem,
|
|
6806
|
+
CommandList,
|
|
6807
|
+
CommandSeparator,
|
|
6808
|
+
CommandShortcut,
|
|
6809
|
+
ConfirmDialog,
|
|
6810
|
+
DIAS_SEMANA_PT_BR,
|
|
6811
|
+
DateTimeRangeList,
|
|
6812
|
+
Dialog,
|
|
6813
|
+
DialogClose,
|
|
6814
|
+
DialogContent,
|
|
6815
|
+
DialogDescription,
|
|
6816
|
+
DialogFooter,
|
|
6817
|
+
DialogHeader,
|
|
6818
|
+
DialogOverlay,
|
|
6819
|
+
DialogPortal,
|
|
6820
|
+
DialogTitle,
|
|
6821
|
+
DialogTrigger,
|
|
6822
|
+
Drawer,
|
|
6823
|
+
DrawerBody,
|
|
6824
|
+
DrawerClose,
|
|
6825
|
+
DrawerContent,
|
|
6826
|
+
DrawerContext,
|
|
6827
|
+
DrawerDescription,
|
|
6828
|
+
DrawerFooter,
|
|
6829
|
+
DrawerHeader,
|
|
6830
|
+
DrawerOverlay,
|
|
6831
|
+
DrawerPortal,
|
|
6832
|
+
DrawerProvider,
|
|
6833
|
+
DrawerTitle,
|
|
6834
|
+
DrawerTrigger,
|
|
6835
|
+
DropdownMenu,
|
|
6836
|
+
DropdownMenuCheckboxItem,
|
|
6837
|
+
DropdownMenuContent,
|
|
6838
|
+
DropdownMenuGroup,
|
|
6839
|
+
DropdownMenuItem,
|
|
6840
|
+
DropdownMenuLabel,
|
|
6841
|
+
DropdownMenuPortal,
|
|
6842
|
+
DropdownMenuRadioGroup,
|
|
6843
|
+
DropdownMenuRadioItem,
|
|
6844
|
+
DropdownMenuSeparator,
|
|
6845
|
+
DropdownMenuShortcut,
|
|
6846
|
+
DropdownMenuSub,
|
|
6847
|
+
DropdownMenuSubContent,
|
|
6848
|
+
DropdownMenuSubTrigger,
|
|
6849
|
+
DropdownMenuTrigger,
|
|
6850
|
+
EmptyState,
|
|
6851
|
+
ErroNotificacoes,
|
|
6852
|
+
FileList,
|
|
6853
|
+
FileUpload,
|
|
6854
|
+
Filter,
|
|
6855
|
+
Header,
|
|
6856
|
+
HeaderContainer,
|
|
6857
|
+
HeaderNotifications,
|
|
6858
|
+
HeaderProfileHeader,
|
|
6859
|
+
HeaderProfileItem,
|
|
6860
|
+
Input,
|
|
6861
|
+
LabelValue,
|
|
6862
|
+
MESES_PT_BR,
|
|
6863
|
+
MESES_PT_BR_ABREV,
|
|
6864
|
+
MiniMonthCalendar,
|
|
6865
|
+
Modal,
|
|
6866
|
+
ModalEntidade,
|
|
6867
|
+
ModalMudancaEntidade,
|
|
6868
|
+
MonthYearPicker,
|
|
6869
|
+
MultiSelect,
|
|
6870
|
+
PageHeader,
|
|
6871
|
+
PageHeaderActionsContainer,
|
|
6872
|
+
PageHeaderTitle,
|
|
6873
|
+
PageHeaderTitleContent,
|
|
6874
|
+
PeriodRangeList,
|
|
6875
|
+
Popover,
|
|
6876
|
+
PopoverContent,
|
|
6877
|
+
PopoverTrigger,
|
|
6878
|
+
ResultMetadata,
|
|
6879
|
+
Select,
|
|
6880
|
+
SelectContent,
|
|
6881
|
+
SelectGroup,
|
|
6882
|
+
SelectItem,
|
|
6883
|
+
SelectLabel,
|
|
6884
|
+
SelectPortal,
|
|
6885
|
+
SelectScrollDownButton,
|
|
6886
|
+
SelectScrollUpButton,
|
|
6887
|
+
SelectSeparator,
|
|
6888
|
+
SelectTrigger,
|
|
6889
|
+
SelectValue,
|
|
6890
|
+
SelectViewport,
|
|
6891
|
+
Sidebar,
|
|
6892
|
+
SidebarContainer,
|
|
6893
|
+
SidebarImageBrand,
|
|
6894
|
+
SidebarNavCollapse,
|
|
6895
|
+
SidebarNavLink,
|
|
6896
|
+
Switch,
|
|
6897
|
+
Tabs,
|
|
6898
|
+
TabsContent,
|
|
6899
|
+
TabsList,
|
|
6900
|
+
TabsTrigger,
|
|
6901
|
+
Textarea,
|
|
6902
|
+
Title2 as Title,
|
|
6903
|
+
Tooltip,
|
|
6904
|
+
URL_PADRAO_NOTIFICACOES,
|
|
6905
|
+
availableApps,
|
|
6906
|
+
buildMonthDays,
|
|
6907
|
+
buttonVariants,
|
|
6908
|
+
formatDayAriaLabel,
|
|
6909
|
+
formatFileSize,
|
|
6910
|
+
formatMonthYear,
|
|
6911
|
+
isSameDay,
|
|
6912
|
+
isToday,
|
|
6913
|
+
toDateKey,
|
|
6914
|
+
toLocalNoon,
|
|
6915
|
+
useDrawer,
|
|
6916
|
+
validateFiles
|
|
6917
|
+
};
|
|
6918
|
+
/*! Bundled license information:
|
|
6919
|
+
|
|
6920
|
+
lucide-react/dist/esm/shared/src/utils.js:
|
|
6921
|
+
(**
|
|
6922
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6923
|
+
*
|
|
6924
|
+
* This source code is licensed under the ISC license.
|
|
6925
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6926
|
+
*)
|
|
6927
|
+
|
|
6928
|
+
lucide-react/dist/esm/defaultAttributes.js:
|
|
6929
|
+
(**
|
|
6930
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6931
|
+
*
|
|
6932
|
+
* This source code is licensed under the ISC license.
|
|
6933
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6934
|
+
*)
|
|
6935
|
+
|
|
6936
|
+
lucide-react/dist/esm/Icon.js:
|
|
6937
|
+
(**
|
|
6938
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6939
|
+
*
|
|
6940
|
+
* This source code is licensed under the ISC license.
|
|
6941
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6942
|
+
*)
|
|
6943
|
+
|
|
6944
|
+
lucide-react/dist/esm/createLucideIcon.js:
|
|
6945
|
+
(**
|
|
6946
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6947
|
+
*
|
|
6948
|
+
* This source code is licensed under the ISC license.
|
|
6949
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6950
|
+
*)
|
|
6951
|
+
|
|
6952
|
+
lucide-react/dist/esm/icons/bell-off.js:
|
|
6953
|
+
(**
|
|
6954
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6955
|
+
*
|
|
6956
|
+
* This source code is licensed under the ISC license.
|
|
6957
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6958
|
+
*)
|
|
6959
|
+
|
|
6960
|
+
lucide-react/dist/esm/icons/bell-ring.js:
|
|
6961
|
+
(**
|
|
6962
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6963
|
+
*
|
|
6964
|
+
* This source code is licensed under the ISC license.
|
|
6965
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6966
|
+
*)
|
|
6967
|
+
|
|
6968
|
+
lucide-react/dist/esm/icons/bell.js:
|
|
6969
|
+
(**
|
|
6970
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6971
|
+
*
|
|
6972
|
+
* This source code is licensed under the ISC license.
|
|
6973
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6974
|
+
*)
|
|
6975
|
+
|
|
6976
|
+
lucide-react/dist/esm/icons/check.js:
|
|
6977
|
+
(**
|
|
6978
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6979
|
+
*
|
|
6980
|
+
* This source code is licensed under the ISC license.
|
|
6981
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6982
|
+
*)
|
|
6983
|
+
|
|
6984
|
+
lucide-react/dist/esm/icons/chevron-down.js:
|
|
6985
|
+
(**
|
|
6986
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6987
|
+
*
|
|
6988
|
+
* This source code is licensed under the ISC license.
|
|
6989
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6990
|
+
*)
|
|
6991
|
+
|
|
6992
|
+
lucide-react/dist/esm/icons/chevron-left.js:
|
|
6993
|
+
(**
|
|
6994
|
+
* @license lucide-react v0.453.0 - ISC
|
|
6995
|
+
*
|
|
6996
|
+
* This source code is licensed under the ISC license.
|
|
4763
6997
|
* See the LICENSE file in the root directory of this source tree.
|
|
4764
6998
|
*)
|
|
4765
6999
|
|
|
@@ -4795,6 +7029,30 @@ lucide-react/dist/esm/icons/circle.js:
|
|
|
4795
7029
|
* See the LICENSE file in the root directory of this source tree.
|
|
4796
7030
|
*)
|
|
4797
7031
|
|
|
7032
|
+
lucide-react/dist/esm/icons/download.js:
|
|
7033
|
+
(**
|
|
7034
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7035
|
+
*
|
|
7036
|
+
* This source code is licensed under the ISC license.
|
|
7037
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7038
|
+
*)
|
|
7039
|
+
|
|
7040
|
+
lucide-react/dist/esm/icons/external-link.js:
|
|
7041
|
+
(**
|
|
7042
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7043
|
+
*
|
|
7044
|
+
* This source code is licensed under the ISC license.
|
|
7045
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7046
|
+
*)
|
|
7047
|
+
|
|
7048
|
+
lucide-react/dist/esm/icons/file-text.js:
|
|
7049
|
+
(**
|
|
7050
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7051
|
+
*
|
|
7052
|
+
* This source code is licensed under the ISC license.
|
|
7053
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7054
|
+
*)
|
|
7055
|
+
|
|
4798
7056
|
lucide-react/dist/esm/icons/filter-x.js:
|
|
4799
7057
|
(**
|
|
4800
7058
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -4827,6 +7085,38 @@ lucide-react/dist/esm/icons/loader-circle.js:
|
|
|
4827
7085
|
* See the LICENSE file in the root directory of this source tree.
|
|
4828
7086
|
*)
|
|
4829
7087
|
|
|
7088
|
+
lucide-react/dist/esm/icons/mail-open.js:
|
|
7089
|
+
(**
|
|
7090
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7091
|
+
*
|
|
7092
|
+
* This source code is licensed under the ISC license.
|
|
7093
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7094
|
+
*)
|
|
7095
|
+
|
|
7096
|
+
lucide-react/dist/esm/icons/mail.js:
|
|
7097
|
+
(**
|
|
7098
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7099
|
+
*
|
|
7100
|
+
* This source code is licensed under the ISC license.
|
|
7101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7102
|
+
*)
|
|
7103
|
+
|
|
7104
|
+
lucide-react/dist/esm/icons/paperclip.js:
|
|
7105
|
+
(**
|
|
7106
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7107
|
+
*
|
|
7108
|
+
* This source code is licensed under the ISC license.
|
|
7109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7110
|
+
*)
|
|
7111
|
+
|
|
7112
|
+
lucide-react/dist/esm/icons/plus.js:
|
|
7113
|
+
(**
|
|
7114
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7115
|
+
*
|
|
7116
|
+
* This source code is licensed under the ISC license.
|
|
7117
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7118
|
+
*)
|
|
7119
|
+
|
|
4830
7120
|
lucide-react/dist/esm/icons/search.js:
|
|
4831
7121
|
(**
|
|
4832
7122
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -4835,6 +7125,22 @@ lucide-react/dist/esm/icons/search.js:
|
|
|
4835
7125
|
* See the LICENSE file in the root directory of this source tree.
|
|
4836
7126
|
*)
|
|
4837
7127
|
|
|
7128
|
+
lucide-react/dist/esm/icons/trash-2.js:
|
|
7129
|
+
(**
|
|
7130
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7131
|
+
*
|
|
7132
|
+
* This source code is licensed under the ISC license.
|
|
7133
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7134
|
+
*)
|
|
7135
|
+
|
|
7136
|
+
lucide-react/dist/esm/icons/user.js:
|
|
7137
|
+
(**
|
|
7138
|
+
* @license lucide-react v0.453.0 - ISC
|
|
7139
|
+
*
|
|
7140
|
+
* This source code is licensed under the ISC license.
|
|
7141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7142
|
+
*)
|
|
7143
|
+
|
|
4838
7144
|
lucide-react/dist/esm/icons/x.js:
|
|
4839
7145
|
(**
|
|
4840
7146
|
* @license lucide-react v0.453.0 - ISC
|