analytica-frontend-lib 1.1.53 → 1.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DropdownMenu/index.d.mts +5 -1
- package/dist/DropdownMenu/index.d.ts +5 -1
- package/dist/DropdownMenu/index.js +606 -37
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +605 -37
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/Modal/index.d.mts +14 -5
- package/dist/Modal/index.d.ts +14 -5
- package/dist/Modal/index.js +216 -31
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.mjs +217 -32
- package/dist/Modal/index.mjs.map +1 -1
- package/dist/Modal/utils/videoUtils/index.d.mts +28 -0
- package/dist/Modal/utils/videoUtils/index.d.ts +28 -0
- package/dist/Modal/utils/videoUtils/index.js +76 -0
- package/dist/Modal/utils/videoUtils/index.js.map +1 -0
- package/dist/Modal/utils/videoUtils/index.mjs +49 -0
- package/dist/Modal/utils/videoUtils/index.mjs.map +1 -0
- package/dist/NotificationCard/index.js +716 -295
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs +713 -292
- package/dist/NotificationCard/index.mjs.map +1 -1
- package/dist/Quiz/index.js +154 -26
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +166 -38
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Search/index.js +625 -58
- package/dist/Search/index.js.map +1 -1
- package/dist/Search/index.mjs +628 -61
- package/dist/Search/index.mjs.map +1 -1
- package/dist/ThemeToggle/index.d.mts +8 -49
- package/dist/ThemeToggle/index.d.ts +8 -49
- package/dist/ThemeToggle/index.js +128 -114
- package/dist/ThemeToggle/index.js.map +1 -1
- package/dist/ThemeToggle/index.mjs +119 -105
- package/dist/ThemeToggle/index.mjs.map +1 -1
- package/dist/hooks/useTheme/index.d.mts +1 -1
- package/dist/hooks/useTheme/index.d.ts +1 -1
- package/dist/hooks/useTheme/index.js.map +1 -1
- package/dist/hooks/useTheme/index.mjs.map +1 -1
- package/dist/index.css +10 -39
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +995 -825
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1083 -914
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +10 -39
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
2
2
|
import { DotsThreeVertical, Bell as Bell2 } from "phosphor-react";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as useState5, useEffect as useEffect6 } from "react";
|
|
4
4
|
|
|
5
5
|
// src/utils/utils.ts
|
|
6
6
|
import { clsx } from "clsx";
|
|
@@ -10,15 +10,15 @@ function cn(...inputs) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
13
|
-
import { SignOut, User } from "phosphor-react";
|
|
13
|
+
import { CaretRight, SignOut, User } from "phosphor-react";
|
|
14
14
|
import {
|
|
15
|
-
forwardRef,
|
|
16
|
-
useEffect,
|
|
17
|
-
useRef,
|
|
15
|
+
forwardRef as forwardRef2,
|
|
16
|
+
useEffect as useEffect4,
|
|
17
|
+
useRef as useRef2,
|
|
18
18
|
isValidElement,
|
|
19
19
|
Children,
|
|
20
20
|
cloneElement,
|
|
21
|
-
useState
|
|
21
|
+
useState as useState3
|
|
22
22
|
} from "react";
|
|
23
23
|
import { create, useStore } from "zustand";
|
|
24
24
|
|
|
@@ -80,8 +80,495 @@ var Button = ({
|
|
|
80
80
|
};
|
|
81
81
|
var Button_default = Button;
|
|
82
82
|
|
|
83
|
+
// src/components/Text/Text.tsx
|
|
84
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
85
|
+
var Text = ({
|
|
86
|
+
children,
|
|
87
|
+
size = "md",
|
|
88
|
+
weight = "normal",
|
|
89
|
+
color = "text-text-950",
|
|
90
|
+
as,
|
|
91
|
+
className = "",
|
|
92
|
+
...props
|
|
93
|
+
}) => {
|
|
94
|
+
let sizeClasses = "";
|
|
95
|
+
let weightClasses = "";
|
|
96
|
+
const sizeClassMap = {
|
|
97
|
+
"2xs": "text-2xs",
|
|
98
|
+
xs: "text-xs",
|
|
99
|
+
sm: "text-sm",
|
|
100
|
+
md: "text-md",
|
|
101
|
+
lg: "text-lg",
|
|
102
|
+
xl: "text-xl",
|
|
103
|
+
"2xl": "text-2xl",
|
|
104
|
+
"3xl": "text-3xl",
|
|
105
|
+
"4xl": "text-4xl",
|
|
106
|
+
"5xl": "text-5xl",
|
|
107
|
+
"6xl": "text-6xl"
|
|
108
|
+
};
|
|
109
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
110
|
+
const weightClassMap = {
|
|
111
|
+
hairline: "font-hairline",
|
|
112
|
+
light: "font-light",
|
|
113
|
+
normal: "font-normal",
|
|
114
|
+
medium: "font-medium",
|
|
115
|
+
semibold: "font-semibold",
|
|
116
|
+
bold: "font-bold",
|
|
117
|
+
extrabold: "font-extrabold",
|
|
118
|
+
black: "font-black"
|
|
119
|
+
};
|
|
120
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
121
|
+
const baseClasses = "font-primary";
|
|
122
|
+
const Component = as ?? "p";
|
|
123
|
+
return /* @__PURE__ */ jsx2(
|
|
124
|
+
Component,
|
|
125
|
+
{
|
|
126
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
127
|
+
...props,
|
|
128
|
+
children
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
var Text_default = Text;
|
|
133
|
+
|
|
134
|
+
// src/components/Modal/Modal.tsx
|
|
135
|
+
import { useEffect, useId } from "react";
|
|
136
|
+
import { X } from "phosphor-react";
|
|
137
|
+
|
|
138
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
139
|
+
var isYouTubeUrl = (url) => {
|
|
140
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
141
|
+
return youtubeRegex.test(url);
|
|
142
|
+
};
|
|
143
|
+
var isValidYouTubeHost = (host) => {
|
|
144
|
+
if (host === "youtu.be") return "youtu.be";
|
|
145
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
146
|
+
if (isValidYouTubeCom) return "youtube";
|
|
147
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
148
|
+
if (isValidNoCookie) return "nocookie";
|
|
149
|
+
return null;
|
|
150
|
+
};
|
|
151
|
+
var extractYoutuBeId = (pathname) => {
|
|
152
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
153
|
+
return firstSeg || null;
|
|
154
|
+
};
|
|
155
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
156
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
157
|
+
const [first, second] = parts;
|
|
158
|
+
if (first === "embed" && second) return second;
|
|
159
|
+
if (first === "shorts" && second) return second;
|
|
160
|
+
if (first === "live" && second) return second;
|
|
161
|
+
const v = searchParams.get("v");
|
|
162
|
+
if (v) return v;
|
|
163
|
+
return null;
|
|
164
|
+
};
|
|
165
|
+
var getYouTubeVideoId = (url) => {
|
|
166
|
+
try {
|
|
167
|
+
const u = new URL(url);
|
|
168
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
169
|
+
if (!hostType) return null;
|
|
170
|
+
if (hostType === "youtu.be") {
|
|
171
|
+
return extractYoutuBeId(u.pathname);
|
|
172
|
+
}
|
|
173
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
174
|
+
} catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
179
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/components/Modal/Modal.tsx
|
|
183
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
184
|
+
var SIZE_CLASSES2 = {
|
|
185
|
+
xs: "max-w-[360px]",
|
|
186
|
+
sm: "max-w-[420px]",
|
|
187
|
+
md: "max-w-[510px]",
|
|
188
|
+
lg: "max-w-[640px]",
|
|
189
|
+
xl: "max-w-[970px]"
|
|
190
|
+
};
|
|
191
|
+
var Modal = ({
|
|
192
|
+
isOpen,
|
|
193
|
+
onClose,
|
|
194
|
+
title,
|
|
195
|
+
children,
|
|
196
|
+
size = "md",
|
|
197
|
+
className = "",
|
|
198
|
+
closeOnEscape = true,
|
|
199
|
+
footer,
|
|
200
|
+
hideCloseButton = false,
|
|
201
|
+
variant = "default",
|
|
202
|
+
description,
|
|
203
|
+
image,
|
|
204
|
+
imageAlt,
|
|
205
|
+
actionLink,
|
|
206
|
+
actionLabel
|
|
207
|
+
}) => {
|
|
208
|
+
const titleId = useId();
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (!isOpen || !closeOnEscape) return;
|
|
211
|
+
const handleEscape = (event) => {
|
|
212
|
+
if (event.key === "Escape") {
|
|
213
|
+
onClose();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
document.addEventListener("keydown", handleEscape);
|
|
217
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
218
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
const originalOverflow = document.body.style.overflow;
|
|
221
|
+
if (isOpen) {
|
|
222
|
+
document.body.style.overflow = "hidden";
|
|
223
|
+
} else {
|
|
224
|
+
document.body.style.overflow = originalOverflow;
|
|
225
|
+
}
|
|
226
|
+
return () => {
|
|
227
|
+
document.body.style.overflow = originalOverflow;
|
|
228
|
+
};
|
|
229
|
+
}, [isOpen]);
|
|
230
|
+
if (!isOpen) return null;
|
|
231
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
232
|
+
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
233
|
+
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
234
|
+
const modalClasses = cn(
|
|
235
|
+
baseClasses,
|
|
236
|
+
sizeClasses,
|
|
237
|
+
dialogResetClasses,
|
|
238
|
+
className
|
|
239
|
+
);
|
|
240
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
241
|
+
const handleActionClick = () => {
|
|
242
|
+
if (actionLink) {
|
|
243
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
if (variant === "activity") {
|
|
247
|
+
return /* @__PURE__ */ jsx3("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ jsxs2(
|
|
248
|
+
"dialog",
|
|
249
|
+
{
|
|
250
|
+
className: modalClasses,
|
|
251
|
+
"aria-labelledby": titleId,
|
|
252
|
+
"aria-modal": "true",
|
|
253
|
+
open: true,
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx3("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ jsx3(
|
|
256
|
+
"button",
|
|
257
|
+
{
|
|
258
|
+
onClick: onClose,
|
|
259
|
+
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
260
|
+
"aria-label": "Fechar modal",
|
|
261
|
+
children: /* @__PURE__ */ jsx3(X, { size: 18 })
|
|
262
|
+
}
|
|
263
|
+
) }),
|
|
264
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
265
|
+
image && /* @__PURE__ */ jsx3("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx3(
|
|
266
|
+
"img",
|
|
267
|
+
{
|
|
268
|
+
src: image,
|
|
269
|
+
alt: imageAlt ?? "",
|
|
270
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
271
|
+
}
|
|
272
|
+
) }),
|
|
273
|
+
/* @__PURE__ */ jsx3(
|
|
274
|
+
"h2",
|
|
275
|
+
{
|
|
276
|
+
id: titleId,
|
|
277
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
278
|
+
children: title
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
description && /* @__PURE__ */ jsx3("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
|
|
282
|
+
actionLink && /* @__PURE__ */ jsxs2("div", { className: "w-full", children: [
|
|
283
|
+
(() => {
|
|
284
|
+
const normalized = normalizeUrl(actionLink);
|
|
285
|
+
const isYT = isYouTubeUrl(normalized);
|
|
286
|
+
if (!isYT) return null;
|
|
287
|
+
const id = getYouTubeVideoId(normalized);
|
|
288
|
+
if (!id) {
|
|
289
|
+
return /* @__PURE__ */ jsx3(
|
|
290
|
+
Button_default,
|
|
291
|
+
{
|
|
292
|
+
variant: "solid",
|
|
293
|
+
action: "primary",
|
|
294
|
+
size: "large",
|
|
295
|
+
className: "w-full",
|
|
296
|
+
onClick: handleActionClick,
|
|
297
|
+
children: actionLabel || "Iniciar Atividade"
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
return /* @__PURE__ */ jsx3(
|
|
302
|
+
"iframe",
|
|
303
|
+
{
|
|
304
|
+
src: getYouTubeEmbedUrl(id),
|
|
305
|
+
className: "w-full aspect-video rounded-lg",
|
|
306
|
+
allowFullScreen: true,
|
|
307
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
308
|
+
title: "V\xEDdeo YouTube"
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
})(),
|
|
312
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ jsx3(
|
|
313
|
+
Button_default,
|
|
314
|
+
{
|
|
315
|
+
variant: "solid",
|
|
316
|
+
action: "primary",
|
|
317
|
+
size: "large",
|
|
318
|
+
className: "w-full",
|
|
319
|
+
onClick: handleActionClick,
|
|
320
|
+
children: actionLabel || "Iniciar Atividade"
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
] })
|
|
324
|
+
] })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
) });
|
|
328
|
+
}
|
|
329
|
+
return /* @__PURE__ */ jsx3("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ jsxs2(
|
|
330
|
+
"dialog",
|
|
331
|
+
{
|
|
332
|
+
className: modalClasses,
|
|
333
|
+
"aria-labelledby": titleId,
|
|
334
|
+
"aria-modal": "true",
|
|
335
|
+
open: true,
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
338
|
+
/* @__PURE__ */ jsx3("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
339
|
+
!hideCloseButton && /* @__PURE__ */ jsx3(
|
|
340
|
+
"button",
|
|
341
|
+
{
|
|
342
|
+
onClick: onClose,
|
|
343
|
+
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
344
|
+
"aria-label": "Fechar modal",
|
|
345
|
+
children: /* @__PURE__ */ jsx3(X, { size: 18 })
|
|
346
|
+
}
|
|
347
|
+
)
|
|
348
|
+
] }),
|
|
349
|
+
children && /* @__PURE__ */ jsx3("div", { className: "px-6 pb-6", children: /* @__PURE__ */ jsx3("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
350
|
+
footer && /* @__PURE__ */ jsx3("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
) });
|
|
354
|
+
};
|
|
355
|
+
var Modal_default = Modal;
|
|
356
|
+
|
|
357
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
358
|
+
import { Moon, Sun } from "phosphor-react";
|
|
359
|
+
import { useState as useState2, useEffect as useEffect3 } from "react";
|
|
360
|
+
|
|
361
|
+
// src/components/SelectionButton/SelectionButton.tsx
|
|
362
|
+
import { forwardRef } from "react";
|
|
363
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
364
|
+
var SelectionButton = forwardRef(
|
|
365
|
+
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
366
|
+
const baseClasses = [
|
|
367
|
+
"inline-flex",
|
|
368
|
+
"items-center",
|
|
369
|
+
"justify-start",
|
|
370
|
+
"gap-2",
|
|
371
|
+
"p-4",
|
|
372
|
+
"rounded-xl",
|
|
373
|
+
"cursor-pointer",
|
|
374
|
+
"border",
|
|
375
|
+
"border-border-50",
|
|
376
|
+
"bg-background",
|
|
377
|
+
"text-sm",
|
|
378
|
+
"text-text-700",
|
|
379
|
+
"font-bold",
|
|
380
|
+
"shadow-soft-shadow-1",
|
|
381
|
+
"hover:bg-background-100",
|
|
382
|
+
"focus-visible:outline-none",
|
|
383
|
+
"focus-visible:ring-2",
|
|
384
|
+
"focus-visible:ring-indicator-info",
|
|
385
|
+
"focus-visible:ring-offset-0",
|
|
386
|
+
"focus-visible:shadow-none",
|
|
387
|
+
"active:ring-2",
|
|
388
|
+
"active:ring-primary-950",
|
|
389
|
+
"active:ring-offset-0",
|
|
390
|
+
"active:shadow-none",
|
|
391
|
+
"disabled:opacity-50",
|
|
392
|
+
"disabled:cursor-not-allowed"
|
|
393
|
+
];
|
|
394
|
+
const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
|
|
395
|
+
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
396
|
+
return /* @__PURE__ */ jsxs3(
|
|
397
|
+
"button",
|
|
398
|
+
{
|
|
399
|
+
ref,
|
|
400
|
+
type: "button",
|
|
401
|
+
className: cn(allClasses, className),
|
|
402
|
+
disabled,
|
|
403
|
+
"aria-pressed": selected,
|
|
404
|
+
...props,
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ jsx4("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
|
|
407
|
+
/* @__PURE__ */ jsx4("span", { children: label })
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
SelectionButton.displayName = "SelectionButton";
|
|
414
|
+
var SelectionButton_default = SelectionButton;
|
|
415
|
+
|
|
416
|
+
// src/hooks/useTheme.ts
|
|
417
|
+
import { useEffect as useEffect2, useState, useCallback, useRef } from "react";
|
|
418
|
+
var useTheme = () => {
|
|
419
|
+
const [themeMode, setThemeMode] = useState("system");
|
|
420
|
+
const [isDark, setIsDark] = useState(false);
|
|
421
|
+
const themeModeRef = useRef("system");
|
|
422
|
+
const applyTheme = useCallback((mode) => {
|
|
423
|
+
const htmlElement = document.documentElement;
|
|
424
|
+
const originalTheme = htmlElement.getAttribute("data-original-theme");
|
|
425
|
+
if (mode === "dark") {
|
|
426
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
427
|
+
setIsDark(true);
|
|
428
|
+
} else if (mode === "light") {
|
|
429
|
+
if (originalTheme) {
|
|
430
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
431
|
+
}
|
|
432
|
+
setIsDark(false);
|
|
433
|
+
} else if (mode === "system") {
|
|
434
|
+
const isSystemDark = window.matchMedia(
|
|
435
|
+
"(prefers-color-scheme: dark)"
|
|
436
|
+
).matches;
|
|
437
|
+
if (isSystemDark) {
|
|
438
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
439
|
+
setIsDark(true);
|
|
440
|
+
} else if (originalTheme) {
|
|
441
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
442
|
+
setIsDark(false);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}, []);
|
|
446
|
+
const toggleTheme = useCallback(() => {
|
|
447
|
+
let newMode;
|
|
448
|
+
if (themeMode === "light") {
|
|
449
|
+
newMode = "dark";
|
|
450
|
+
} else if (themeMode === "dark") {
|
|
451
|
+
newMode = "light";
|
|
452
|
+
} else {
|
|
453
|
+
newMode = "dark";
|
|
454
|
+
}
|
|
455
|
+
setThemeMode(newMode);
|
|
456
|
+
themeModeRef.current = newMode;
|
|
457
|
+
applyTheme(newMode);
|
|
458
|
+
localStorage.setItem("theme-mode", newMode);
|
|
459
|
+
}, [themeMode, applyTheme]);
|
|
460
|
+
const setTheme = useCallback(
|
|
461
|
+
(mode) => {
|
|
462
|
+
setThemeMode(mode);
|
|
463
|
+
themeModeRef.current = mode;
|
|
464
|
+
applyTheme(mode);
|
|
465
|
+
localStorage.setItem("theme-mode", mode);
|
|
466
|
+
},
|
|
467
|
+
[applyTheme]
|
|
468
|
+
);
|
|
469
|
+
useEffect2(() => {
|
|
470
|
+
const htmlElement = document.documentElement;
|
|
471
|
+
const currentTheme = htmlElement.getAttribute("data-theme");
|
|
472
|
+
if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
|
|
473
|
+
htmlElement.setAttribute("data-original-theme", currentTheme);
|
|
474
|
+
}
|
|
475
|
+
const savedThemeMode = localStorage.getItem("theme-mode");
|
|
476
|
+
const initialMode = savedThemeMode || "system";
|
|
477
|
+
if (!savedThemeMode) {
|
|
478
|
+
localStorage.setItem("theme-mode", "system");
|
|
479
|
+
}
|
|
480
|
+
setThemeMode(initialMode);
|
|
481
|
+
themeModeRef.current = initialMode;
|
|
482
|
+
applyTheme(initialMode);
|
|
483
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
484
|
+
const handleSystemThemeChange = () => {
|
|
485
|
+
if (themeModeRef.current === "system") {
|
|
486
|
+
applyTheme("system");
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
mediaQuery.addEventListener("change", handleSystemThemeChange);
|
|
490
|
+
return () => {
|
|
491
|
+
mediaQuery.removeEventListener("change", handleSystemThemeChange);
|
|
492
|
+
};
|
|
493
|
+
}, [applyTheme]);
|
|
494
|
+
return {
|
|
495
|
+
themeMode,
|
|
496
|
+
isDark,
|
|
497
|
+
toggleTheme,
|
|
498
|
+
setTheme
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
503
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
504
|
+
var ThemeToggle = ({
|
|
505
|
+
variant = "default",
|
|
506
|
+
onToggle
|
|
507
|
+
}) => {
|
|
508
|
+
const { themeMode, setTheme } = useTheme();
|
|
509
|
+
const [tempTheme, setTempTheme] = useState2(themeMode);
|
|
510
|
+
useEffect3(() => {
|
|
511
|
+
setTempTheme(themeMode);
|
|
512
|
+
}, [themeMode]);
|
|
513
|
+
const problemTypes = [
|
|
514
|
+
{
|
|
515
|
+
id: "light",
|
|
516
|
+
title: "Claro",
|
|
517
|
+
icon: /* @__PURE__ */ jsx5(Sun, { size: 24 })
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
id: "dark",
|
|
521
|
+
title: "Escuro",
|
|
522
|
+
icon: /* @__PURE__ */ jsx5(Moon, { size: 24 })
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
id: "system",
|
|
526
|
+
title: "Sistema",
|
|
527
|
+
icon: /* @__PURE__ */ jsx5(
|
|
528
|
+
"svg",
|
|
529
|
+
{
|
|
530
|
+
width: "25",
|
|
531
|
+
height: "25",
|
|
532
|
+
viewBox: "0 0 25 25",
|
|
533
|
+
fill: "none",
|
|
534
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
535
|
+
children: /* @__PURE__ */ jsx5(
|
|
536
|
+
"path",
|
|
537
|
+
{
|
|
538
|
+
d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
|
|
539
|
+
fill: "#525252"
|
|
540
|
+
}
|
|
541
|
+
)
|
|
542
|
+
}
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
];
|
|
546
|
+
const handleThemeSelect = (selectedTheme) => {
|
|
547
|
+
if (variant === "with-save") {
|
|
548
|
+
setTempTheme(selectedTheme);
|
|
549
|
+
} else {
|
|
550
|
+
setTheme(selectedTheme);
|
|
551
|
+
}
|
|
552
|
+
if (onToggle) {
|
|
553
|
+
onToggle(selectedTheme);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
const currentTheme = variant === "with-save" ? tempTheme : themeMode;
|
|
557
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex flex-row gap-2 sm:gap-4 py-2", children: problemTypes.map((type) => /* @__PURE__ */ jsx5(
|
|
558
|
+
SelectionButton_default,
|
|
559
|
+
{
|
|
560
|
+
icon: type.icon,
|
|
561
|
+
label: type.title,
|
|
562
|
+
selected: currentTheme === type.id,
|
|
563
|
+
onClick: () => handleThemeSelect(type.id),
|
|
564
|
+
className: "w-full p-2 sm:p-4"
|
|
565
|
+
},
|
|
566
|
+
type.id
|
|
567
|
+
)) });
|
|
568
|
+
};
|
|
569
|
+
|
|
83
570
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
84
|
-
import { jsx as
|
|
571
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
85
572
|
function createDropdownStore() {
|
|
86
573
|
return create((set) => ({
|
|
87
574
|
open: false,
|
|
@@ -116,14 +603,14 @@ var DropdownMenu = ({
|
|
|
116
603
|
open: propOpen,
|
|
117
604
|
onOpenChange
|
|
118
605
|
}) => {
|
|
119
|
-
const storeRef =
|
|
606
|
+
const storeRef = useRef2(null);
|
|
120
607
|
storeRef.current ??= createDropdownStore();
|
|
121
608
|
const store = storeRef.current;
|
|
122
609
|
const { open, setOpen: storeSetOpen } = useStore(store, (s) => s);
|
|
123
610
|
const setOpen = (newOpen) => {
|
|
124
611
|
storeSetOpen(newOpen);
|
|
125
612
|
};
|
|
126
|
-
const menuRef =
|
|
613
|
+
const menuRef = useRef2(null);
|
|
127
614
|
const handleArrowDownOrArrowUp = (event) => {
|
|
128
615
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
129
616
|
if (menuContent) {
|
|
@@ -157,7 +644,7 @@ var DropdownMenu = ({
|
|
|
157
644
|
setOpen(false);
|
|
158
645
|
}
|
|
159
646
|
};
|
|
160
|
-
|
|
647
|
+
useEffect4(() => {
|
|
161
648
|
if (open) {
|
|
162
649
|
document.addEventListener("mousedown", handleClickOutside);
|
|
163
650
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -167,16 +654,16 @@ var DropdownMenu = ({
|
|
|
167
654
|
document.removeEventListener("keydown", handleDownkey);
|
|
168
655
|
};
|
|
169
656
|
}, [open]);
|
|
170
|
-
|
|
657
|
+
useEffect4(() => {
|
|
171
658
|
setOpen(open);
|
|
172
659
|
onOpenChange?.(open);
|
|
173
660
|
}, [open, onOpenChange]);
|
|
174
|
-
|
|
661
|
+
useEffect4(() => {
|
|
175
662
|
if (propOpen) {
|
|
176
663
|
setOpen(propOpen);
|
|
177
664
|
}
|
|
178
665
|
}, [propOpen]);
|
|
179
|
-
return /* @__PURE__ */
|
|
666
|
+
return /* @__PURE__ */ jsx6("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
180
667
|
};
|
|
181
668
|
var DropdownMenuTrigger = ({
|
|
182
669
|
className,
|
|
@@ -188,7 +675,7 @@ var DropdownMenuTrigger = ({
|
|
|
188
675
|
const store = useDropdownStore(externalStore);
|
|
189
676
|
const open = useStore(store, (s) => s.open);
|
|
190
677
|
const toggleOpen = () => store.setState({ open: !open });
|
|
191
|
-
return /* @__PURE__ */
|
|
678
|
+
return /* @__PURE__ */ jsx6(
|
|
192
679
|
"button",
|
|
193
680
|
{
|
|
194
681
|
onClick: (e) => {
|
|
@@ -223,8 +710,8 @@ var MENUCONTENT_VARIANT_CLASSES = {
|
|
|
223
710
|
menu: "p-1",
|
|
224
711
|
profile: "p-6"
|
|
225
712
|
};
|
|
226
|
-
var MenuLabel =
|
|
227
|
-
return /* @__PURE__ */
|
|
713
|
+
var MenuLabel = forwardRef2(({ className, inset, store: _store, ...props }, ref) => {
|
|
714
|
+
return /* @__PURE__ */ jsx6(
|
|
228
715
|
"div",
|
|
229
716
|
{
|
|
230
717
|
ref,
|
|
@@ -234,7 +721,7 @@ var MenuLabel = forwardRef(({ className, inset, store: _store, ...props }, ref)
|
|
|
234
721
|
);
|
|
235
722
|
});
|
|
236
723
|
MenuLabel.displayName = "MenuLabel";
|
|
237
|
-
var DropdownMenuContent =
|
|
724
|
+
var DropdownMenuContent = forwardRef2(
|
|
238
725
|
({
|
|
239
726
|
className,
|
|
240
727
|
align = "start",
|
|
@@ -247,8 +734,8 @@ var DropdownMenuContent = forwardRef(
|
|
|
247
734
|
}, ref) => {
|
|
248
735
|
const store = useDropdownStore(externalStore);
|
|
249
736
|
const open = useStore(store, (s) => s.open);
|
|
250
|
-
const [isVisible, setIsVisible] =
|
|
251
|
-
|
|
737
|
+
const [isVisible, setIsVisible] = useState3(open);
|
|
738
|
+
useEffect4(() => {
|
|
252
739
|
if (open) {
|
|
253
740
|
setIsVisible(true);
|
|
254
741
|
} else {
|
|
@@ -263,7 +750,7 @@ var DropdownMenuContent = forwardRef(
|
|
|
263
750
|
return `absolute ${vertical} ${horizontal}`;
|
|
264
751
|
};
|
|
265
752
|
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
266
|
-
return /* @__PURE__ */
|
|
753
|
+
return /* @__PURE__ */ jsx6(
|
|
267
754
|
"div",
|
|
268
755
|
{
|
|
269
756
|
ref,
|
|
@@ -288,7 +775,7 @@ var DropdownMenuContent = forwardRef(
|
|
|
288
775
|
}
|
|
289
776
|
);
|
|
290
777
|
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
291
|
-
var DropdownMenuItem =
|
|
778
|
+
var DropdownMenuItem = forwardRef2(
|
|
292
779
|
({
|
|
293
780
|
className,
|
|
294
781
|
size = "small",
|
|
@@ -322,7 +809,7 @@ var DropdownMenuItem = forwardRef(
|
|
|
322
809
|
const getVariantProps = () => {
|
|
323
810
|
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
324
811
|
};
|
|
325
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsxs4(
|
|
326
813
|
"div",
|
|
327
814
|
{
|
|
328
815
|
ref,
|
|
@@ -344,7 +831,7 @@ var DropdownMenuItem = forwardRef(
|
|
|
344
831
|
...props,
|
|
345
832
|
children: [
|
|
346
833
|
iconLeft,
|
|
347
|
-
/* @__PURE__ */
|
|
834
|
+
/* @__PURE__ */ jsx6("div", { className: "w-full", children }),
|
|
348
835
|
iconRight
|
|
349
836
|
]
|
|
350
837
|
}
|
|
@@ -352,7 +839,7 @@ var DropdownMenuItem = forwardRef(
|
|
|
352
839
|
}
|
|
353
840
|
);
|
|
354
841
|
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
355
|
-
var DropdownMenuSeparator =
|
|
842
|
+
var DropdownMenuSeparator = forwardRef2(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
356
843
|
"div",
|
|
357
844
|
{
|
|
358
845
|
ref,
|
|
@@ -361,11 +848,11 @@ var DropdownMenuSeparator = forwardRef(({ className, store: _store, ...props },
|
|
|
361
848
|
}
|
|
362
849
|
));
|
|
363
850
|
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
364
|
-
var ProfileMenuTrigger =
|
|
851
|
+
var ProfileMenuTrigger = forwardRef2(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
365
852
|
const store = useDropdownStore(externalStore);
|
|
366
853
|
const open = useStore(store, (s) => s.open);
|
|
367
854
|
const toggleOpen = () => store.setState({ open: !open });
|
|
368
|
-
return /* @__PURE__ */
|
|
855
|
+
return /* @__PURE__ */ jsx6(
|
|
369
856
|
"button",
|
|
370
857
|
{
|
|
371
858
|
ref,
|
|
@@ -380,13 +867,13 @@ var ProfileMenuTrigger = forwardRef(({ className, onClick, store: externalStore,
|
|
|
380
867
|
},
|
|
381
868
|
"aria-expanded": open,
|
|
382
869
|
...props,
|
|
383
|
-
children: /* @__PURE__ */
|
|
870
|
+
children: /* @__PURE__ */ jsx6("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ jsx6(User, { className: "text-primary-950", size: 18 }) })
|
|
384
871
|
}
|
|
385
872
|
);
|
|
386
873
|
});
|
|
387
874
|
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
388
|
-
var ProfileMenuHeader =
|
|
389
|
-
return /* @__PURE__ */
|
|
875
|
+
var ProfileMenuHeader = forwardRef2(({ className, name, email, store: _store, ...props }, ref) => {
|
|
876
|
+
return /* @__PURE__ */ jsxs4(
|
|
390
877
|
"div",
|
|
391
878
|
{
|
|
392
879
|
ref,
|
|
@@ -394,18 +881,98 @@ var ProfileMenuHeader = forwardRef(({ className, name, email, store: _store, ...
|
|
|
394
881
|
className: cn("flex flex-row gap-4 items-center", className),
|
|
395
882
|
...props,
|
|
396
883
|
children: [
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
/* @__PURE__ */
|
|
400
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ jsx6("span", { className: "size-16 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx6(User, { size: 34, className: "text-primary-950" }) }),
|
|
885
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col ", children: [
|
|
886
|
+
/* @__PURE__ */ jsx6(Text_default, { size: "xl", weight: "bold", color: "text-text-950", children: name }),
|
|
887
|
+
/* @__PURE__ */ jsx6(Text_default, { size: "md", color: "text-text-600", children: email })
|
|
401
888
|
] })
|
|
402
889
|
]
|
|
403
890
|
}
|
|
404
891
|
);
|
|
405
892
|
});
|
|
406
893
|
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
407
|
-
var
|
|
408
|
-
|
|
894
|
+
var ProfileToggleTheme = ({ ...props }) => {
|
|
895
|
+
const { themeMode, setTheme } = useTheme();
|
|
896
|
+
const [modalThemeToggle, setModalThemeToggle] = useState3(false);
|
|
897
|
+
const [selectedTheme, setSelectedTheme] = useState3(themeMode);
|
|
898
|
+
const handleClick = (e) => {
|
|
899
|
+
e.preventDefault();
|
|
900
|
+
e.stopPropagation();
|
|
901
|
+
setModalThemeToggle(true);
|
|
902
|
+
};
|
|
903
|
+
const handleSave = () => {
|
|
904
|
+
setTheme(selectedTheme);
|
|
905
|
+
setModalThemeToggle(false);
|
|
906
|
+
};
|
|
907
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
908
|
+
/* @__PURE__ */ jsxs4(
|
|
909
|
+
"div",
|
|
910
|
+
{
|
|
911
|
+
role: "menuitem",
|
|
912
|
+
"data-variant": "profile",
|
|
913
|
+
className: "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-4 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0 cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground",
|
|
914
|
+
onClick: handleClick,
|
|
915
|
+
onKeyDown: (e) => {
|
|
916
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
917
|
+
e.preventDefault();
|
|
918
|
+
e.stopPropagation();
|
|
919
|
+
setModalThemeToggle(true);
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
tabIndex: 0,
|
|
923
|
+
...props,
|
|
924
|
+
children: [
|
|
925
|
+
/* @__PURE__ */ jsx6(
|
|
926
|
+
"svg",
|
|
927
|
+
{
|
|
928
|
+
width: "25",
|
|
929
|
+
height: "25",
|
|
930
|
+
viewBox: "0 0 25 25",
|
|
931
|
+
fill: "none",
|
|
932
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
933
|
+
children: /* @__PURE__ */ jsx6(
|
|
934
|
+
"path",
|
|
935
|
+
{
|
|
936
|
+
d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
|
|
937
|
+
fill: "#525252"
|
|
938
|
+
}
|
|
939
|
+
)
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ jsx6(Text_default, { className: "w-full", size: "md", children: "Apar\xEAncia" }),
|
|
943
|
+
/* @__PURE__ */ jsx6(CaretRight, {})
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
),
|
|
947
|
+
/* @__PURE__ */ jsx6(
|
|
948
|
+
Modal_default,
|
|
949
|
+
{
|
|
950
|
+
isOpen: modalThemeToggle,
|
|
951
|
+
onClose: () => setModalThemeToggle(false),
|
|
952
|
+
title: "Apar\xEAncia",
|
|
953
|
+
size: "md",
|
|
954
|
+
footer: /* @__PURE__ */ jsxs4("div", { className: "flex gap-3", children: [
|
|
955
|
+
/* @__PURE__ */ jsx6(
|
|
956
|
+
Button_default,
|
|
957
|
+
{
|
|
958
|
+
variant: "outline",
|
|
959
|
+
onClick: () => setModalThemeToggle(false),
|
|
960
|
+
children: "Cancelar"
|
|
961
|
+
}
|
|
962
|
+
),
|
|
963
|
+
/* @__PURE__ */ jsx6(Button_default, { variant: "solid", onClick: () => handleSave(), children: "Salvar" })
|
|
964
|
+
] }),
|
|
965
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
|
|
966
|
+
/* @__PURE__ */ jsx6("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
|
|
967
|
+
/* @__PURE__ */ jsx6(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
|
|
968
|
+
] })
|
|
969
|
+
}
|
|
970
|
+
)
|
|
971
|
+
] });
|
|
972
|
+
};
|
|
973
|
+
ProfileToggleTheme.displayName = "ProfileToggleTheme";
|
|
974
|
+
var ProfileMenuSection = forwardRef2(({ className, children, store: _store, ...props }, ref) => {
|
|
975
|
+
return /* @__PURE__ */ jsx6("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
|
|
409
976
|
});
|
|
410
977
|
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
411
978
|
var ProfileMenuFooter = ({
|
|
@@ -417,7 +984,7 @@ var ProfileMenuFooter = ({
|
|
|
417
984
|
}) => {
|
|
418
985
|
const store = useDropdownStore(externalStore);
|
|
419
986
|
const setOpen = useStore(store, (s) => s.setOpen);
|
|
420
|
-
return /* @__PURE__ */
|
|
987
|
+
return /* @__PURE__ */ jsxs4(
|
|
421
988
|
Button_default,
|
|
422
989
|
{
|
|
423
990
|
variant: "outline",
|
|
@@ -429,8 +996,8 @@ var ProfileMenuFooter = ({
|
|
|
429
996
|
},
|
|
430
997
|
...props,
|
|
431
998
|
children: [
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ jsx6("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx6(SignOut, {}) }),
|
|
1000
|
+
/* @__PURE__ */ jsx6(Text_default, { children: "Sair" })
|
|
434
1001
|
]
|
|
435
1002
|
}
|
|
436
1003
|
);
|
|
@@ -439,8 +1006,8 @@ ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
|
439
1006
|
var DropdownMenu_default = DropdownMenu;
|
|
440
1007
|
|
|
441
1008
|
// src/components/Skeleton/Skeleton.tsx
|
|
442
|
-
import { forwardRef as
|
|
443
|
-
import { jsx as
|
|
1009
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
1010
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
444
1011
|
var SKELETON_ANIMATION_CLASSES = {
|
|
445
1012
|
pulse: "animate-pulse",
|
|
446
1013
|
none: ""
|
|
@@ -457,7 +1024,7 @@ var SPACING_CLASSES = {
|
|
|
457
1024
|
medium: "space-y-2",
|
|
458
1025
|
large: "space-y-3"
|
|
459
1026
|
};
|
|
460
|
-
var Skeleton =
|
|
1027
|
+
var Skeleton = forwardRef3(
|
|
461
1028
|
({
|
|
462
1029
|
variant = "text",
|
|
463
1030
|
width,
|
|
@@ -477,13 +1044,13 @@ var Skeleton = forwardRef2(
|
|
|
477
1044
|
height: typeof height === "number" ? `${height}px` : height
|
|
478
1045
|
};
|
|
479
1046
|
if (variant === "text" && lines > 1) {
|
|
480
|
-
return /* @__PURE__ */
|
|
1047
|
+
return /* @__PURE__ */ jsx7(
|
|
481
1048
|
"div",
|
|
482
1049
|
{
|
|
483
1050
|
ref,
|
|
484
1051
|
className: cn("flex flex-col", spacingClass, className),
|
|
485
1052
|
...props,
|
|
486
|
-
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */
|
|
1053
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx7(
|
|
487
1054
|
"div",
|
|
488
1055
|
{
|
|
489
1056
|
className: cn(variantClass, animationClass),
|
|
@@ -494,7 +1061,7 @@ var Skeleton = forwardRef2(
|
|
|
494
1061
|
}
|
|
495
1062
|
);
|
|
496
1063
|
}
|
|
497
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ jsx7(
|
|
498
1065
|
"div",
|
|
499
1066
|
{
|
|
500
1067
|
ref,
|
|
@@ -506,13 +1073,13 @@ var Skeleton = forwardRef2(
|
|
|
506
1073
|
);
|
|
507
1074
|
}
|
|
508
1075
|
);
|
|
509
|
-
var SkeletonText =
|
|
510
|
-
(props, ref) => /* @__PURE__ */
|
|
1076
|
+
var SkeletonText = forwardRef3(
|
|
1077
|
+
(props, ref) => /* @__PURE__ */ jsx7(Skeleton, { ref, variant: "text", ...props })
|
|
511
1078
|
);
|
|
512
|
-
var SkeletonCircle =
|
|
513
|
-
var SkeletonRectangle =
|
|
514
|
-
var SkeletonRounded =
|
|
515
|
-
var SkeletonCard =
|
|
1079
|
+
var SkeletonCircle = forwardRef3((props, ref) => /* @__PURE__ */ jsx7(Skeleton, { ref, variant: "circular", ...props }));
|
|
1080
|
+
var SkeletonRectangle = forwardRef3((props, ref) => /* @__PURE__ */ jsx7(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
1081
|
+
var SkeletonRounded = forwardRef3((props, ref) => /* @__PURE__ */ jsx7(Skeleton, { ref, variant: "rounded", ...props }));
|
|
1082
|
+
var SkeletonCard = forwardRef3(
|
|
516
1083
|
({
|
|
517
1084
|
showAvatar = true,
|
|
518
1085
|
showTitle = true,
|
|
@@ -522,7 +1089,7 @@ var SkeletonCard = forwardRef2(
|
|
|
522
1089
|
className = "",
|
|
523
1090
|
...props
|
|
524
1091
|
}, ref) => {
|
|
525
|
-
return /* @__PURE__ */
|
|
1092
|
+
return /* @__PURE__ */ jsxs5(
|
|
526
1093
|
"div",
|
|
527
1094
|
{
|
|
528
1095
|
ref,
|
|
@@ -532,23 +1099,23 @@ var SkeletonCard = forwardRef2(
|
|
|
532
1099
|
),
|
|
533
1100
|
...props,
|
|
534
1101
|
children: [
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
showAvatar && /* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
showTitle && /* @__PURE__ */
|
|
539
|
-
showDescription && /* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-start space-x-3", children: [
|
|
1103
|
+
showAvatar && /* @__PURE__ */ jsx7(SkeletonCircle, { width: 40, height: 40 }),
|
|
1104
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex-1 space-y-2", children: [
|
|
1105
|
+
showTitle && /* @__PURE__ */ jsx7(SkeletonText, { width: "60%", height: 20 }),
|
|
1106
|
+
showDescription && /* @__PURE__ */ jsx7(SkeletonText, { lines, spacing: "small" })
|
|
540
1107
|
] })
|
|
541
1108
|
] }),
|
|
542
|
-
showActions && /* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
/* @__PURE__ */
|
|
1109
|
+
showActions && /* @__PURE__ */ jsxs5("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
1110
|
+
/* @__PURE__ */ jsx7(SkeletonRectangle, { width: 80, height: 32 }),
|
|
1111
|
+
/* @__PURE__ */ jsx7(SkeletonRectangle, { width: 80, height: 32 })
|
|
545
1112
|
] })
|
|
546
1113
|
]
|
|
547
1114
|
}
|
|
548
1115
|
);
|
|
549
1116
|
}
|
|
550
1117
|
);
|
|
551
|
-
var SkeletonList =
|
|
1118
|
+
var SkeletonList = forwardRef3(
|
|
552
1119
|
({
|
|
553
1120
|
items = 3,
|
|
554
1121
|
showAvatar = true,
|
|
@@ -558,19 +1125,19 @@ var SkeletonList = forwardRef2(
|
|
|
558
1125
|
className = "",
|
|
559
1126
|
...props
|
|
560
1127
|
}, ref) => {
|
|
561
|
-
return /* @__PURE__ */
|
|
562
|
-
showAvatar && /* @__PURE__ */
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
showTitle && /* @__PURE__ */
|
|
565
|
-
showDescription && /* @__PURE__ */
|
|
1128
|
+
return /* @__PURE__ */ jsx7("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs5("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
1129
|
+
showAvatar && /* @__PURE__ */ jsx7(SkeletonCircle, { width: 32, height: 32 }),
|
|
1130
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex-1 space-y-2", children: [
|
|
1131
|
+
showTitle && /* @__PURE__ */ jsx7(SkeletonText, { width: "40%", height: 16 }),
|
|
1132
|
+
showDescription && /* @__PURE__ */ jsx7(SkeletonText, { lines, spacing: "small" })
|
|
566
1133
|
] })
|
|
567
1134
|
] }, index)) });
|
|
568
1135
|
}
|
|
569
1136
|
);
|
|
570
|
-
var SkeletonTable =
|
|
1137
|
+
var SkeletonTable = forwardRef3(
|
|
571
1138
|
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
572
|
-
return /* @__PURE__ */
|
|
573
|
-
showHeader && /* @__PURE__ */
|
|
1139
|
+
return /* @__PURE__ */ jsxs5("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
1140
|
+
showHeader && /* @__PURE__ */ jsx7("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ jsx7(
|
|
574
1141
|
SkeletonText,
|
|
575
1142
|
{
|
|
576
1143
|
width: `${100 / columns}%`,
|
|
@@ -578,7 +1145,7 @@ var SkeletonTable = forwardRef2(
|
|
|
578
1145
|
},
|
|
579
1146
|
index
|
|
580
1147
|
)) }),
|
|
581
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ jsx7("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx7("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ jsx7(
|
|
582
1149
|
SkeletonText,
|
|
583
1150
|
{
|
|
584
1151
|
width: `${100 / columns}%`,
|
|
@@ -591,9 +1158,9 @@ var SkeletonTable = forwardRef2(
|
|
|
591
1158
|
);
|
|
592
1159
|
|
|
593
1160
|
// src/components/IconButton/IconButton.tsx
|
|
594
|
-
import { forwardRef as
|
|
595
|
-
import { jsx as
|
|
596
|
-
var IconButton =
|
|
1161
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
1162
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1163
|
+
var IconButton = forwardRef4(
|
|
597
1164
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
598
1165
|
const baseClasses = [
|
|
599
1166
|
"inline-flex",
|
|
@@ -625,7 +1192,7 @@ var IconButton = forwardRef3(
|
|
|
625
1192
|
...activeClasses
|
|
626
1193
|
].join(" ");
|
|
627
1194
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
628
|
-
return /* @__PURE__ */
|
|
1195
|
+
return /* @__PURE__ */ jsx8(
|
|
629
1196
|
"button",
|
|
630
1197
|
{
|
|
631
1198
|
ref,
|
|
@@ -635,7 +1202,7 @@ var IconButton = forwardRef3(
|
|
|
635
1202
|
"aria-pressed": active,
|
|
636
1203
|
"aria-label": ariaLabel,
|
|
637
1204
|
...props,
|
|
638
|
-
children: /* @__PURE__ */
|
|
1205
|
+
children: /* @__PURE__ */ jsx8("span", { className: "flex items-center justify-center", children: icon })
|
|
639
1206
|
}
|
|
640
1207
|
);
|
|
641
1208
|
}
|
|
@@ -643,154 +1210,9 @@ var IconButton = forwardRef3(
|
|
|
643
1210
|
IconButton.displayName = "IconButton";
|
|
644
1211
|
var IconButton_default = IconButton;
|
|
645
1212
|
|
|
646
|
-
// src/components/Modal/Modal.tsx
|
|
647
|
-
import { useEffect as useEffect2 } from "react";
|
|
648
|
-
import { X } from "phosphor-react";
|
|
649
|
-
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
650
|
-
var SIZE_CLASSES2 = {
|
|
651
|
-
xs: "max-w-[360px]",
|
|
652
|
-
sm: "max-w-[420px]",
|
|
653
|
-
md: "max-w-[510px]",
|
|
654
|
-
lg: "max-w-[640px]",
|
|
655
|
-
xl: "max-w-[970px]"
|
|
656
|
-
};
|
|
657
|
-
var Modal = ({
|
|
658
|
-
isOpen,
|
|
659
|
-
onClose,
|
|
660
|
-
title,
|
|
661
|
-
children,
|
|
662
|
-
size = "md",
|
|
663
|
-
className = "",
|
|
664
|
-
closeOnBackdropClick = true,
|
|
665
|
-
closeOnEscape = true,
|
|
666
|
-
footer,
|
|
667
|
-
hideCloseButton = false
|
|
668
|
-
}) => {
|
|
669
|
-
useEffect2(() => {
|
|
670
|
-
if (!isOpen || !closeOnEscape) return;
|
|
671
|
-
const handleEscape = (event) => {
|
|
672
|
-
if (event.key === "Escape") {
|
|
673
|
-
onClose();
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
document.addEventListener("keydown", handleEscape);
|
|
677
|
-
return () => document.removeEventListener("keydown", handleEscape);
|
|
678
|
-
}, [isOpen, closeOnEscape, onClose]);
|
|
679
|
-
useEffect2(() => {
|
|
680
|
-
const originalOverflow = document.body.style.overflow;
|
|
681
|
-
if (isOpen) {
|
|
682
|
-
document.body.style.overflow = "hidden";
|
|
683
|
-
} else {
|
|
684
|
-
document.body.style.overflow = originalOverflow;
|
|
685
|
-
}
|
|
686
|
-
return () => {
|
|
687
|
-
document.body.style.overflow = originalOverflow;
|
|
688
|
-
};
|
|
689
|
-
}, [isOpen]);
|
|
690
|
-
const handleBackdropClick = (event) => {
|
|
691
|
-
if (closeOnBackdropClick && event.target === event.currentTarget) {
|
|
692
|
-
onClose();
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
const handleBackdropKeyDown = (event) => {
|
|
696
|
-
if (closeOnBackdropClick && (event.key === "Enter" || event.key === " ")) {
|
|
697
|
-
onClose();
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
if (!isOpen) return null;
|
|
701
|
-
const sizeClasses = SIZE_CLASSES2[size];
|
|
702
|
-
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
703
|
-
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
704
|
-
const modalClasses = cn(
|
|
705
|
-
baseClasses,
|
|
706
|
-
sizeClasses,
|
|
707
|
-
dialogResetClasses,
|
|
708
|
-
className
|
|
709
|
-
);
|
|
710
|
-
return /* @__PURE__ */ jsx5(
|
|
711
|
-
"div",
|
|
712
|
-
{
|
|
713
|
-
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs",
|
|
714
|
-
onClick: handleBackdropClick,
|
|
715
|
-
onKeyDown: handleBackdropKeyDown,
|
|
716
|
-
role: "button",
|
|
717
|
-
tabIndex: closeOnBackdropClick ? 0 : -1,
|
|
718
|
-
"aria-label": "Fechar modal clicando no fundo",
|
|
719
|
-
children: /* @__PURE__ */ jsxs4("dialog", { className: modalClasses, "aria-labelledby": "modal-title", open: true, children: [
|
|
720
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
721
|
-
/* @__PURE__ */ jsx5("h2", { id: "modal-title", className: "text-lg font-semibold text-text-950", children: title }),
|
|
722
|
-
!hideCloseButton && /* @__PURE__ */ jsx5(
|
|
723
|
-
"button",
|
|
724
|
-
{
|
|
725
|
-
onClick: onClose,
|
|
726
|
-
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
727
|
-
"aria-label": "Fechar modal",
|
|
728
|
-
children: /* @__PURE__ */ jsx5(X, { size: 18 })
|
|
729
|
-
}
|
|
730
|
-
)
|
|
731
|
-
] }),
|
|
732
|
-
/* @__PURE__ */ jsx5("div", { className: "px-6 pb-6", children: /* @__PURE__ */ jsx5("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
733
|
-
footer && /* @__PURE__ */ jsx5("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
734
|
-
] })
|
|
735
|
-
}
|
|
736
|
-
);
|
|
737
|
-
};
|
|
738
|
-
var Modal_default = Modal;
|
|
739
|
-
|
|
740
|
-
// src/components/Text/Text.tsx
|
|
741
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
742
|
-
var Text = ({
|
|
743
|
-
children,
|
|
744
|
-
size = "md",
|
|
745
|
-
weight = "normal",
|
|
746
|
-
color = "text-text-950",
|
|
747
|
-
as,
|
|
748
|
-
className = "",
|
|
749
|
-
...props
|
|
750
|
-
}) => {
|
|
751
|
-
let sizeClasses = "";
|
|
752
|
-
let weightClasses = "";
|
|
753
|
-
const sizeClassMap = {
|
|
754
|
-
"2xs": "text-2xs",
|
|
755
|
-
xs: "text-xs",
|
|
756
|
-
sm: "text-sm",
|
|
757
|
-
md: "text-md",
|
|
758
|
-
lg: "text-lg",
|
|
759
|
-
xl: "text-xl",
|
|
760
|
-
"2xl": "text-2xl",
|
|
761
|
-
"3xl": "text-3xl",
|
|
762
|
-
"4xl": "text-4xl",
|
|
763
|
-
"5xl": "text-5xl",
|
|
764
|
-
"6xl": "text-6xl"
|
|
765
|
-
};
|
|
766
|
-
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
767
|
-
const weightClassMap = {
|
|
768
|
-
hairline: "font-hairline",
|
|
769
|
-
light: "font-light",
|
|
770
|
-
normal: "font-normal",
|
|
771
|
-
medium: "font-medium",
|
|
772
|
-
semibold: "font-semibold",
|
|
773
|
-
bold: "font-bold",
|
|
774
|
-
extrabold: "font-extrabold",
|
|
775
|
-
black: "font-black"
|
|
776
|
-
};
|
|
777
|
-
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
778
|
-
const baseClasses = "font-primary";
|
|
779
|
-
const Component = as ?? "p";
|
|
780
|
-
return /* @__PURE__ */ jsx6(
|
|
781
|
-
Component,
|
|
782
|
-
{
|
|
783
|
-
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
784
|
-
...props,
|
|
785
|
-
children
|
|
786
|
-
}
|
|
787
|
-
);
|
|
788
|
-
};
|
|
789
|
-
var Text_default = Text;
|
|
790
|
-
|
|
791
1213
|
// src/components/Badge/Badge.tsx
|
|
792
1214
|
import { Bell } from "phosphor-react";
|
|
793
|
-
import { jsx as
|
|
1215
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
794
1216
|
var VARIANT_ACTION_CLASSES2 = {
|
|
795
1217
|
solid: {
|
|
796
1218
|
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
@@ -852,14 +1274,14 @@ var Badge = ({
|
|
|
852
1274
|
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
853
1275
|
const baseClassesIcon = "flex items-center";
|
|
854
1276
|
if (variant === "notification") {
|
|
855
|
-
return /* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ jsxs6(
|
|
856
1278
|
"div",
|
|
857
1279
|
{
|
|
858
1280
|
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
859
1281
|
...props,
|
|
860
1282
|
children: [
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
notificationActive && /* @__PURE__ */
|
|
1283
|
+
/* @__PURE__ */ jsx9(Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
1284
|
+
notificationActive && /* @__PURE__ */ jsx9(
|
|
863
1285
|
"span",
|
|
864
1286
|
{
|
|
865
1287
|
"data-testid": "notification-dot",
|
|
@@ -870,15 +1292,15 @@ var Badge = ({
|
|
|
870
1292
|
}
|
|
871
1293
|
);
|
|
872
1294
|
}
|
|
873
|
-
return /* @__PURE__ */
|
|
1295
|
+
return /* @__PURE__ */ jsxs6(
|
|
874
1296
|
"div",
|
|
875
1297
|
{
|
|
876
1298
|
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
877
1299
|
...props,
|
|
878
1300
|
children: [
|
|
879
|
-
iconLeft && /* @__PURE__ */
|
|
1301
|
+
iconLeft && /* @__PURE__ */ jsx9("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
880
1302
|
children,
|
|
881
|
-
iconRight && /* @__PURE__ */
|
|
1303
|
+
iconRight && /* @__PURE__ */ jsx9("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
882
1304
|
]
|
|
883
1305
|
}
|
|
884
1306
|
);
|
|
@@ -886,7 +1308,7 @@ var Badge = ({
|
|
|
886
1308
|
var Badge_default = Badge;
|
|
887
1309
|
|
|
888
1310
|
// src/hooks/useMobile.ts
|
|
889
|
-
import { useState as
|
|
1311
|
+
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
890
1312
|
var MOBILE_WIDTH = 500;
|
|
891
1313
|
var TABLET_WIDTH = 931;
|
|
892
1314
|
var DEFAULT_WIDTH = 1200;
|
|
@@ -901,9 +1323,9 @@ var getDeviceType = () => {
|
|
|
901
1323
|
return width < TABLET_WIDTH ? "responsive" : "desktop";
|
|
902
1324
|
};
|
|
903
1325
|
var useMobile = () => {
|
|
904
|
-
const [isMobile, setIsMobile] =
|
|
905
|
-
const [isTablet, setIsTablet] =
|
|
906
|
-
|
|
1326
|
+
const [isMobile, setIsMobile] = useState4(false);
|
|
1327
|
+
const [isTablet, setIsTablet] = useState4(false);
|
|
1328
|
+
useEffect5(() => {
|
|
907
1329
|
const checkScreenSize = () => {
|
|
908
1330
|
const width = getWindowWidth();
|
|
909
1331
|
setIsMobile(width < MOBILE_WIDTH);
|
|
@@ -975,14 +1397,14 @@ var formatTimeAgo = (date) => {
|
|
|
975
1397
|
};
|
|
976
1398
|
|
|
977
1399
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
978
|
-
import { Fragment, jsx as
|
|
1400
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
979
1401
|
var NotificationEmpty = ({
|
|
980
1402
|
emptyStateImage,
|
|
981
1403
|
emptyStateTitle = "Nenhuma notifica\xE7\xE3o no momento",
|
|
982
1404
|
emptyStateDescription = "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!"
|
|
983
1405
|
}) => {
|
|
984
|
-
return /* @__PURE__ */
|
|
985
|
-
emptyStateImage && /* @__PURE__ */
|
|
1406
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
1407
|
+
emptyStateImage && /* @__PURE__ */ jsx10("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ jsx10(
|
|
986
1408
|
"img",
|
|
987
1409
|
{
|
|
988
1410
|
src: emptyStateImage,
|
|
@@ -992,23 +1414,23 @@ var NotificationEmpty = ({
|
|
|
992
1414
|
className: "object-contain"
|
|
993
1415
|
}
|
|
994
1416
|
) }),
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ jsx10("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: emptyStateTitle }),
|
|
1418
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm font-normal text-text-400 text-center max-w-[316px] leading-[21px]", children: emptyStateDescription })
|
|
997
1419
|
] });
|
|
998
1420
|
};
|
|
999
1421
|
var NotificationHeader = ({
|
|
1000
1422
|
unreadCount,
|
|
1001
1423
|
variant = "modal"
|
|
1002
1424
|
}) => {
|
|
1003
|
-
return /* @__PURE__ */
|
|
1004
|
-
variant === "modal" ? /* @__PURE__ */
|
|
1005
|
-
unreadCount > 0 && /* @__PURE__ */
|
|
1425
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1426
|
+
variant === "modal" ? /* @__PURE__ */ jsx10(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: "Notifica\xE7\xF5es" }) : /* @__PURE__ */ jsx10("h3", { className: "text-sm font-semibold text-text-950", children: "Notifica\xE7\xF5es" }),
|
|
1427
|
+
unreadCount > 0 && /* @__PURE__ */ jsx10(
|
|
1006
1428
|
Badge_default,
|
|
1007
1429
|
{
|
|
1008
1430
|
variant: "solid",
|
|
1009
1431
|
action: "info",
|
|
1010
1432
|
size: "small",
|
|
1011
|
-
iconLeft: /* @__PURE__ */
|
|
1433
|
+
iconLeft: /* @__PURE__ */ jsx10(Bell2, { size: 12, "aria-hidden": "true", focusable: "false" }),
|
|
1012
1434
|
className: "border-0",
|
|
1013
1435
|
children: unreadCount === 1 ? "1 n\xE3o lida" : `${unreadCount} n\xE3o lidas`
|
|
1014
1436
|
}
|
|
@@ -1044,7 +1466,7 @@ var SingleNotificationCard = ({
|
|
|
1044
1466
|
onNavigate();
|
|
1045
1467
|
}
|
|
1046
1468
|
};
|
|
1047
|
-
return /* @__PURE__ */
|
|
1469
|
+
return /* @__PURE__ */ jsxs7(
|
|
1048
1470
|
"div",
|
|
1049
1471
|
{
|
|
1050
1472
|
className: cn(
|
|
@@ -1053,20 +1475,20 @@ var SingleNotificationCard = ({
|
|
|
1053
1475
|
className
|
|
1054
1476
|
),
|
|
1055
1477
|
children: [
|
|
1056
|
-
/* @__PURE__ */
|
|
1057
|
-
!isRead && /* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
/* @__PURE__ */
|
|
1478
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 w-full", children: [
|
|
1479
|
+
!isRead && /* @__PURE__ */ jsx10("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
1480
|
+
/* @__PURE__ */ jsx10("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
1481
|
+
/* @__PURE__ */ jsxs7(DropdownMenu_default, { children: [
|
|
1482
|
+
/* @__PURE__ */ jsx10(
|
|
1061
1483
|
DropdownMenuTrigger,
|
|
1062
1484
|
{
|
|
1063
1485
|
className: "flex-shrink-0 inline-flex items-center justify-center font-medium bg-transparent text-text-950 cursor-pointer hover:bg-info-50 w-6 h-6 rounded-lg",
|
|
1064
1486
|
"aria-label": "Menu de a\xE7\xF5es",
|
|
1065
|
-
children: /* @__PURE__ */
|
|
1487
|
+
children: /* @__PURE__ */ jsx10(DotsThreeVertical, { size: 24 })
|
|
1066
1488
|
}
|
|
1067
1489
|
),
|
|
1068
|
-
/* @__PURE__ */
|
|
1069
|
-
!isRead && /* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ jsxs7(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
1491
|
+
!isRead && /* @__PURE__ */ jsx10(
|
|
1070
1492
|
DropdownMenuItem,
|
|
1071
1493
|
{
|
|
1072
1494
|
onClick: handleMarkAsRead,
|
|
@@ -1074,14 +1496,14 @@ var SingleNotificationCard = ({
|
|
|
1074
1496
|
children: "Marcar como lida"
|
|
1075
1497
|
}
|
|
1076
1498
|
),
|
|
1077
|
-
/* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ jsx10(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
1078
1500
|
] })
|
|
1079
1501
|
] })
|
|
1080
1502
|
] }),
|
|
1081
|
-
/* @__PURE__ */
|
|
1082
|
-
/* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1084
|
-
onNavigate && actionLabel && /* @__PURE__ */
|
|
1503
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
1504
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between w-full", children: [
|
|
1505
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
1506
|
+
onNavigate && actionLabel && /* @__PURE__ */ jsx10(
|
|
1085
1507
|
"button",
|
|
1086
1508
|
{
|
|
1087
1509
|
type: "button",
|
|
@@ -1108,9 +1530,9 @@ var NotificationList = ({
|
|
|
1108
1530
|
className
|
|
1109
1531
|
}) => {
|
|
1110
1532
|
if (error) {
|
|
1111
|
-
return /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
onRetry && /* @__PURE__ */
|
|
1533
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
1534
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm text-error-600", children: error }),
|
|
1535
|
+
onRetry && /* @__PURE__ */ jsx10(
|
|
1114
1536
|
"button",
|
|
1115
1537
|
{
|
|
1116
1538
|
type: "button",
|
|
@@ -1122,8 +1544,8 @@ var NotificationList = ({
|
|
|
1122
1544
|
] });
|
|
1123
1545
|
}
|
|
1124
1546
|
if (loading) {
|
|
1125
|
-
return /* @__PURE__ */
|
|
1126
|
-
(skeletonId) => /* @__PURE__ */
|
|
1547
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
1548
|
+
(skeletonId) => /* @__PURE__ */ jsx10(
|
|
1127
1549
|
SkeletonCard,
|
|
1128
1550
|
{
|
|
1129
1551
|
className: "p-4 border-b border-border-200"
|
|
@@ -1133,11 +1555,11 @@ var NotificationList = ({
|
|
|
1133
1555
|
) });
|
|
1134
1556
|
}
|
|
1135
1557
|
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
1136
|
-
return renderEmpty ? /* @__PURE__ */
|
|
1558
|
+
return renderEmpty ? /* @__PURE__ */ jsx10("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ jsx10(NotificationEmpty, {});
|
|
1137
1559
|
}
|
|
1138
|
-
return /* @__PURE__ */
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
group.notifications.map((notification) => /* @__PURE__ */
|
|
1560
|
+
return /* @__PURE__ */ jsx10("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ jsxs7("div", { className: "flex flex-col", children: [
|
|
1561
|
+
/* @__PURE__ */ jsx10("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ jsx10("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
1562
|
+
group.notifications.map((notification) => /* @__PURE__ */ jsx10(
|
|
1141
1563
|
SingleNotificationCard,
|
|
1142
1564
|
{
|
|
1143
1565
|
title: notification.title,
|
|
@@ -1178,7 +1600,7 @@ var NotificationCenter = ({
|
|
|
1178
1600
|
className
|
|
1179
1601
|
}) => {
|
|
1180
1602
|
const { isMobile } = useMobile();
|
|
1181
|
-
const [isModalOpen, setIsModalOpen] =
|
|
1603
|
+
const [isModalOpen, setIsModalOpen] = useState5(false);
|
|
1182
1604
|
const handleMobileClick = () => {
|
|
1183
1605
|
setIsModalOpen(true);
|
|
1184
1606
|
onFetchNotifications?.();
|
|
@@ -1186,7 +1608,7 @@ var NotificationCenter = ({
|
|
|
1186
1608
|
const handleDesktopClick = () => {
|
|
1187
1609
|
onToggleActive?.();
|
|
1188
1610
|
};
|
|
1189
|
-
|
|
1611
|
+
useEffect6(() => {
|
|
1190
1612
|
if (isActive) {
|
|
1191
1613
|
onFetchNotifications?.();
|
|
1192
1614
|
}
|
|
@@ -1195,7 +1617,7 @@ var NotificationCenter = ({
|
|
|
1195
1617
|
onCleanup?.();
|
|
1196
1618
|
onNavigateById?.(entityType, entityId);
|
|
1197
1619
|
};
|
|
1198
|
-
const renderEmptyState = () => /* @__PURE__ */
|
|
1620
|
+
const renderEmptyState = () => /* @__PURE__ */ jsx10(
|
|
1199
1621
|
NotificationEmpty,
|
|
1200
1622
|
{
|
|
1201
1623
|
emptyStateImage,
|
|
@@ -1204,17 +1626,17 @@ var NotificationCenter = ({
|
|
|
1204
1626
|
}
|
|
1205
1627
|
);
|
|
1206
1628
|
if (isMobile) {
|
|
1207
|
-
return /* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1629
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1630
|
+
/* @__PURE__ */ jsx10(
|
|
1209
1631
|
IconButton_default,
|
|
1210
1632
|
{
|
|
1211
1633
|
active: isModalOpen,
|
|
1212
1634
|
onClick: handleMobileClick,
|
|
1213
|
-
icon: /* @__PURE__ */
|
|
1635
|
+
icon: /* @__PURE__ */ jsx10(Bell2, { size: 24, className: "text-primary" }),
|
|
1214
1636
|
className
|
|
1215
1637
|
}
|
|
1216
1638
|
),
|
|
1217
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ jsx10(
|
|
1218
1640
|
Modal_default,
|
|
1219
1641
|
{
|
|
1220
1642
|
isOpen: isModalOpen,
|
|
@@ -1222,12 +1644,11 @@ var NotificationCenter = ({
|
|
|
1222
1644
|
title: "Notifica\xE7\xF5es",
|
|
1223
1645
|
size: "md",
|
|
1224
1646
|
hideCloseButton: false,
|
|
1225
|
-
closeOnBackdropClick: true,
|
|
1226
1647
|
closeOnEscape: true,
|
|
1227
|
-
children: /* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1230
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */
|
|
1648
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
1649
|
+
/* @__PURE__ */ jsxs7("div", { className: "px-0 pb-3 border-b border-border-200", children: [
|
|
1650
|
+
/* @__PURE__ */ jsx10(NotificationHeader, { unreadCount, variant: "modal" }),
|
|
1651
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ jsx10(
|
|
1231
1652
|
"button",
|
|
1232
1653
|
{
|
|
1233
1654
|
type: "button",
|
|
@@ -1237,7 +1658,7 @@ var NotificationCenter = ({
|
|
|
1237
1658
|
}
|
|
1238
1659
|
)
|
|
1239
1660
|
] }),
|
|
1240
|
-
/* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ jsx10("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx10(
|
|
1241
1662
|
NotificationList,
|
|
1242
1663
|
{
|
|
1243
1664
|
groupedNotifications,
|
|
@@ -1260,13 +1681,13 @@ var NotificationCenter = ({
|
|
|
1260
1681
|
)
|
|
1261
1682
|
] });
|
|
1262
1683
|
}
|
|
1263
|
-
return /* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1684
|
+
return /* @__PURE__ */ jsxs7(DropdownMenu_default, { children: [
|
|
1685
|
+
/* @__PURE__ */ jsx10(DropdownMenuTrigger, { className: "text-primary cursor-pointer", children: /* @__PURE__ */ jsx10(
|
|
1265
1686
|
IconButton_default,
|
|
1266
1687
|
{
|
|
1267
1688
|
active: isActive,
|
|
1268
1689
|
onClick: handleDesktopClick,
|
|
1269
|
-
icon: /* @__PURE__ */
|
|
1690
|
+
icon: /* @__PURE__ */ jsx10(
|
|
1270
1691
|
Bell2,
|
|
1271
1692
|
{
|
|
1272
1693
|
size: 24,
|
|
@@ -1276,16 +1697,16 @@ var NotificationCenter = ({
|
|
|
1276
1697
|
className
|
|
1277
1698
|
}
|
|
1278
1699
|
) }),
|
|
1279
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsx10(
|
|
1280
1701
|
DropdownMenuContent,
|
|
1281
1702
|
{
|
|
1282
1703
|
className: "min-w-[320px] max-w-[400px] max-h-[500px] overflow-hidden",
|
|
1283
1704
|
side: "bottom",
|
|
1284
1705
|
align: "end",
|
|
1285
|
-
children: /* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
/* @__PURE__ */
|
|
1288
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */
|
|
1706
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col", children: [
|
|
1707
|
+
/* @__PURE__ */ jsxs7("div", { className: "px-4 py-3 border-b border-border-200", children: [
|
|
1708
|
+
/* @__PURE__ */ jsx10(NotificationHeader, { unreadCount, variant: "dropdown" }),
|
|
1709
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ jsx10(
|
|
1289
1710
|
"button",
|
|
1290
1711
|
{
|
|
1291
1712
|
type: "button",
|
|
@@ -1295,7 +1716,7 @@ var NotificationCenter = ({
|
|
|
1295
1716
|
}
|
|
1296
1717
|
)
|
|
1297
1718
|
] }),
|
|
1298
|
-
/* @__PURE__ */
|
|
1719
|
+
/* @__PURE__ */ jsx10("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ jsx10(
|
|
1299
1720
|
NotificationList,
|
|
1300
1721
|
{
|
|
1301
1722
|
groupedNotifications,
|
|
@@ -1317,7 +1738,7 @@ var NotificationCenter = ({
|
|
|
1317
1738
|
var NotificationCard = (props) => {
|
|
1318
1739
|
switch (props.mode) {
|
|
1319
1740
|
case "single":
|
|
1320
|
-
return /* @__PURE__ */
|
|
1741
|
+
return /* @__PURE__ */ jsx10(
|
|
1321
1742
|
SingleNotificationCard,
|
|
1322
1743
|
{
|
|
1323
1744
|
title: props.title,
|
|
@@ -1332,7 +1753,7 @@ var NotificationCard = (props) => {
|
|
|
1332
1753
|
}
|
|
1333
1754
|
);
|
|
1334
1755
|
case "list":
|
|
1335
|
-
return /* @__PURE__ */
|
|
1756
|
+
return /* @__PURE__ */ jsx10(
|
|
1336
1757
|
NotificationList,
|
|
1337
1758
|
{
|
|
1338
1759
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1353,9 +1774,9 @@ var NotificationCard = (props) => {
|
|
|
1353
1774
|
}
|
|
1354
1775
|
);
|
|
1355
1776
|
case "center":
|
|
1356
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsx10(NotificationCenter, { ...props });
|
|
1357
1778
|
default:
|
|
1358
|
-
return /* @__PURE__ */
|
|
1779
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ jsx10("p", { className: "text-sm text-text-600", children: "Modo de notifica\xE7\xE3o n\xE3o reconhecido" }) });
|
|
1359
1780
|
}
|
|
1360
1781
|
};
|
|
1361
1782
|
var LegacyNotificationCard = (props) => {
|
|
@@ -1364,10 +1785,10 @@ var LegacyNotificationCard = (props) => {
|
|
|
1364
1785
|
mode: "center",
|
|
1365
1786
|
...props
|
|
1366
1787
|
};
|
|
1367
|
-
return /* @__PURE__ */
|
|
1788
|
+
return /* @__PURE__ */ jsx10(NotificationCenter, { ...centerProps });
|
|
1368
1789
|
}
|
|
1369
1790
|
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
1370
|
-
return /* @__PURE__ */
|
|
1791
|
+
return /* @__PURE__ */ jsx10(
|
|
1371
1792
|
NotificationList,
|
|
1372
1793
|
{
|
|
1373
1794
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1404,7 +1825,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1404
1825
|
emptyStateTitle: props.emptyStateTitle,
|
|
1405
1826
|
emptyStateDescription: props.emptyStateDescription
|
|
1406
1827
|
};
|
|
1407
|
-
return /* @__PURE__ */
|
|
1828
|
+
return /* @__PURE__ */ jsx10(
|
|
1408
1829
|
SingleNotificationCard,
|
|
1409
1830
|
{
|
|
1410
1831
|
title: singleProps.title,
|
|
@@ -1419,7 +1840,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1419
1840
|
}
|
|
1420
1841
|
);
|
|
1421
1842
|
}
|
|
1422
|
-
return /* @__PURE__ */
|
|
1843
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ jsx10("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
1423
1844
|
};
|
|
1424
1845
|
var NotificationCard_default = NotificationCard;
|
|
1425
1846
|
export {
|