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.
Files changed (51) hide show
  1. package/dist/DropdownMenu/index.d.mts +5 -1
  2. package/dist/DropdownMenu/index.d.ts +5 -1
  3. package/dist/DropdownMenu/index.js +606 -37
  4. package/dist/DropdownMenu/index.js.map +1 -1
  5. package/dist/DropdownMenu/index.mjs +605 -37
  6. package/dist/DropdownMenu/index.mjs.map +1 -1
  7. package/dist/Modal/index.d.mts +14 -5
  8. package/dist/Modal/index.d.ts +14 -5
  9. package/dist/Modal/index.js +216 -31
  10. package/dist/Modal/index.js.map +1 -1
  11. package/dist/Modal/index.mjs +217 -32
  12. package/dist/Modal/index.mjs.map +1 -1
  13. package/dist/Modal/utils/videoUtils/index.d.mts +28 -0
  14. package/dist/Modal/utils/videoUtils/index.d.ts +28 -0
  15. package/dist/Modal/utils/videoUtils/index.js +76 -0
  16. package/dist/Modal/utils/videoUtils/index.js.map +1 -0
  17. package/dist/Modal/utils/videoUtils/index.mjs +49 -0
  18. package/dist/Modal/utils/videoUtils/index.mjs.map +1 -0
  19. package/dist/NotificationCard/index.js +716 -295
  20. package/dist/NotificationCard/index.js.map +1 -1
  21. package/dist/NotificationCard/index.mjs +713 -292
  22. package/dist/NotificationCard/index.mjs.map +1 -1
  23. package/dist/Quiz/index.js +154 -26
  24. package/dist/Quiz/index.js.map +1 -1
  25. package/dist/Quiz/index.mjs +166 -38
  26. package/dist/Quiz/index.mjs.map +1 -1
  27. package/dist/Search/index.js +625 -58
  28. package/dist/Search/index.js.map +1 -1
  29. package/dist/Search/index.mjs +628 -61
  30. package/dist/Search/index.mjs.map +1 -1
  31. package/dist/ThemeToggle/index.d.mts +8 -49
  32. package/dist/ThemeToggle/index.d.ts +8 -49
  33. package/dist/ThemeToggle/index.js +128 -114
  34. package/dist/ThemeToggle/index.js.map +1 -1
  35. package/dist/ThemeToggle/index.mjs +119 -105
  36. package/dist/ThemeToggle/index.mjs.map +1 -1
  37. package/dist/hooks/useTheme/index.d.mts +1 -1
  38. package/dist/hooks/useTheme/index.d.ts +1 -1
  39. package/dist/hooks/useTheme/index.js.map +1 -1
  40. package/dist/hooks/useTheme/index.mjs.map +1 -1
  41. package/dist/index.css +10 -39
  42. package/dist/index.css.map +1 -1
  43. package/dist/index.d.mts +3 -3
  44. package/dist/index.d.ts +3 -3
  45. package/dist/index.js +995 -825
  46. package/dist/index.js.map +1 -1
  47. package/dist/index.mjs +1083 -914
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/styles.css +10 -39
  50. package/dist/styles.css.map +1 -1
  51. package/package.json +2 -1
@@ -1,13 +1,13 @@
1
1
  // src/components/DropdownMenu/DropdownMenu.tsx
2
- import { SignOut, User } from "phosphor-react";
2
+ import { CaretRight, SignOut, User } from "phosphor-react";
3
3
  import {
4
- forwardRef,
5
- useEffect,
6
- useRef,
4
+ forwardRef as forwardRef2,
5
+ useEffect as useEffect4,
6
+ useRef as useRef2,
7
7
  isValidElement,
8
8
  Children,
9
9
  cloneElement,
10
- useState
10
+ useState as useState3
11
11
  } from "react";
12
12
  import { create, useStore } from "zustand";
13
13
 
@@ -76,8 +76,495 @@ var Button = ({
76
76
  };
77
77
  var Button_default = Button;
78
78
 
79
+ // src/components/Text/Text.tsx
80
+ import { jsx as jsx2 } from "react/jsx-runtime";
81
+ var Text = ({
82
+ children,
83
+ size = "md",
84
+ weight = "normal",
85
+ color = "text-text-950",
86
+ as,
87
+ className = "",
88
+ ...props
89
+ }) => {
90
+ let sizeClasses = "";
91
+ let weightClasses = "";
92
+ const sizeClassMap = {
93
+ "2xs": "text-2xs",
94
+ xs: "text-xs",
95
+ sm: "text-sm",
96
+ md: "text-md",
97
+ lg: "text-lg",
98
+ xl: "text-xl",
99
+ "2xl": "text-2xl",
100
+ "3xl": "text-3xl",
101
+ "4xl": "text-4xl",
102
+ "5xl": "text-5xl",
103
+ "6xl": "text-6xl"
104
+ };
105
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
106
+ const weightClassMap = {
107
+ hairline: "font-hairline",
108
+ light: "font-light",
109
+ normal: "font-normal",
110
+ medium: "font-medium",
111
+ semibold: "font-semibold",
112
+ bold: "font-bold",
113
+ extrabold: "font-extrabold",
114
+ black: "font-black"
115
+ };
116
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
117
+ const baseClasses = "font-primary";
118
+ const Component = as ?? "p";
119
+ return /* @__PURE__ */ jsx2(
120
+ Component,
121
+ {
122
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
123
+ ...props,
124
+ children
125
+ }
126
+ );
127
+ };
128
+ var Text_default = Text;
129
+
130
+ // src/components/Modal/Modal.tsx
131
+ import { useEffect, useId } from "react";
132
+ import { X } from "phosphor-react";
133
+
134
+ // src/components/Modal/utils/videoUtils.ts
135
+ var isYouTubeUrl = (url) => {
136
+ const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
137
+ return youtubeRegex.test(url);
138
+ };
139
+ var isValidYouTubeHost = (host) => {
140
+ if (host === "youtu.be") return "youtu.be";
141
+ const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
142
+ if (isValidYouTubeCom) return "youtube";
143
+ const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
144
+ if (isValidNoCookie) return "nocookie";
145
+ return null;
146
+ };
147
+ var extractYoutuBeId = (pathname) => {
148
+ const firstSeg = pathname.split("/").filter(Boolean)[0];
149
+ return firstSeg || null;
150
+ };
151
+ var extractYouTubeId = (pathname, searchParams) => {
152
+ const parts = pathname.split("/").filter(Boolean);
153
+ const [first, second] = parts;
154
+ if (first === "embed" && second) return second;
155
+ if (first === "shorts" && second) return second;
156
+ if (first === "live" && second) return second;
157
+ const v = searchParams.get("v");
158
+ if (v) return v;
159
+ return null;
160
+ };
161
+ var getYouTubeVideoId = (url) => {
162
+ try {
163
+ const u = new URL(url);
164
+ const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
165
+ if (!hostType) return null;
166
+ if (hostType === "youtu.be") {
167
+ return extractYoutuBeId(u.pathname);
168
+ }
169
+ return extractYouTubeId(u.pathname, u.searchParams);
170
+ } catch {
171
+ return null;
172
+ }
173
+ };
174
+ var getYouTubeEmbedUrl = (videoId) => {
175
+ return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
176
+ };
177
+
178
+ // src/components/Modal/Modal.tsx
179
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
180
+ var SIZE_CLASSES2 = {
181
+ xs: "max-w-[360px]",
182
+ sm: "max-w-[420px]",
183
+ md: "max-w-[510px]",
184
+ lg: "max-w-[640px]",
185
+ xl: "max-w-[970px]"
186
+ };
187
+ var Modal = ({
188
+ isOpen,
189
+ onClose,
190
+ title,
191
+ children,
192
+ size = "md",
193
+ className = "",
194
+ closeOnEscape = true,
195
+ footer,
196
+ hideCloseButton = false,
197
+ variant = "default",
198
+ description,
199
+ image,
200
+ imageAlt,
201
+ actionLink,
202
+ actionLabel
203
+ }) => {
204
+ const titleId = useId();
205
+ useEffect(() => {
206
+ if (!isOpen || !closeOnEscape) return;
207
+ const handleEscape = (event) => {
208
+ if (event.key === "Escape") {
209
+ onClose();
210
+ }
211
+ };
212
+ document.addEventListener("keydown", handleEscape);
213
+ return () => document.removeEventListener("keydown", handleEscape);
214
+ }, [isOpen, closeOnEscape, onClose]);
215
+ useEffect(() => {
216
+ const originalOverflow = document.body.style.overflow;
217
+ if (isOpen) {
218
+ document.body.style.overflow = "hidden";
219
+ } else {
220
+ document.body.style.overflow = originalOverflow;
221
+ }
222
+ return () => {
223
+ document.body.style.overflow = originalOverflow;
224
+ };
225
+ }, [isOpen]);
226
+ if (!isOpen) return null;
227
+ const sizeClasses = SIZE_CLASSES2[size];
228
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
229
+ const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
230
+ const modalClasses = cn(
231
+ baseClasses,
232
+ sizeClasses,
233
+ dialogResetClasses,
234
+ className
235
+ );
236
+ const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
237
+ const handleActionClick = () => {
238
+ if (actionLink) {
239
+ window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
240
+ }
241
+ };
242
+ if (variant === "activity") {
243
+ 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(
244
+ "dialog",
245
+ {
246
+ className: modalClasses,
247
+ "aria-labelledby": titleId,
248
+ "aria-modal": "true",
249
+ open: true,
250
+ children: [
251
+ /* @__PURE__ */ jsx3("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ jsx3(
252
+ "button",
253
+ {
254
+ onClick: onClose,
255
+ 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",
256
+ "aria-label": "Fechar modal",
257
+ children: /* @__PURE__ */ jsx3(X, { size: 18 })
258
+ }
259
+ ) }),
260
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
261
+ image && /* @__PURE__ */ jsx3("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx3(
262
+ "img",
263
+ {
264
+ src: image,
265
+ alt: imageAlt ?? "",
266
+ className: "w-[122px] h-[122px] object-contain"
267
+ }
268
+ ) }),
269
+ /* @__PURE__ */ jsx3(
270
+ "h2",
271
+ {
272
+ id: titleId,
273
+ className: "text-lg font-semibold text-text-950 text-center",
274
+ children: title
275
+ }
276
+ ),
277
+ description && /* @__PURE__ */ jsx3("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
278
+ actionLink && /* @__PURE__ */ jsxs2("div", { className: "w-full", children: [
279
+ (() => {
280
+ const normalized = normalizeUrl(actionLink);
281
+ const isYT = isYouTubeUrl(normalized);
282
+ if (!isYT) return null;
283
+ const id = getYouTubeVideoId(normalized);
284
+ if (!id) {
285
+ return /* @__PURE__ */ jsx3(
286
+ Button_default,
287
+ {
288
+ variant: "solid",
289
+ action: "primary",
290
+ size: "large",
291
+ className: "w-full",
292
+ onClick: handleActionClick,
293
+ children: actionLabel || "Iniciar Atividade"
294
+ }
295
+ );
296
+ }
297
+ return /* @__PURE__ */ jsx3(
298
+ "iframe",
299
+ {
300
+ src: getYouTubeEmbedUrl(id),
301
+ className: "w-full aspect-video rounded-lg",
302
+ allowFullScreen: true,
303
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
304
+ title: "V\xEDdeo YouTube"
305
+ }
306
+ );
307
+ })(),
308
+ !isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ jsx3(
309
+ Button_default,
310
+ {
311
+ variant: "solid",
312
+ action: "primary",
313
+ size: "large",
314
+ className: "w-full",
315
+ onClick: handleActionClick,
316
+ children: actionLabel || "Iniciar Atividade"
317
+ }
318
+ )
319
+ ] })
320
+ ] })
321
+ ]
322
+ }
323
+ ) });
324
+ }
325
+ 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(
326
+ "dialog",
327
+ {
328
+ className: modalClasses,
329
+ "aria-labelledby": titleId,
330
+ "aria-modal": "true",
331
+ open: true,
332
+ children: [
333
+ /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-6", children: [
334
+ /* @__PURE__ */ jsx3("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
335
+ !hideCloseButton && /* @__PURE__ */ jsx3(
336
+ "button",
337
+ {
338
+ onClick: onClose,
339
+ 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",
340
+ "aria-label": "Fechar modal",
341
+ children: /* @__PURE__ */ jsx3(X, { size: 18 })
342
+ }
343
+ )
344
+ ] }),
345
+ children && /* @__PURE__ */ jsx3("div", { className: "px-6 pb-6", children: /* @__PURE__ */ jsx3("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
346
+ footer && /* @__PURE__ */ jsx3("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
347
+ ]
348
+ }
349
+ ) });
350
+ };
351
+ var Modal_default = Modal;
352
+
353
+ // src/components/ThemeToggle/ThemeToggle.tsx
354
+ import { Moon, Sun } from "phosphor-react";
355
+ import { useState as useState2, useEffect as useEffect3 } from "react";
356
+
357
+ // src/components/SelectionButton/SelectionButton.tsx
358
+ import { forwardRef } from "react";
359
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
360
+ var SelectionButton = forwardRef(
361
+ ({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
362
+ const baseClasses = [
363
+ "inline-flex",
364
+ "items-center",
365
+ "justify-start",
366
+ "gap-2",
367
+ "p-4",
368
+ "rounded-xl",
369
+ "cursor-pointer",
370
+ "border",
371
+ "border-border-50",
372
+ "bg-background",
373
+ "text-sm",
374
+ "text-text-700",
375
+ "font-bold",
376
+ "shadow-soft-shadow-1",
377
+ "hover:bg-background-100",
378
+ "focus-visible:outline-none",
379
+ "focus-visible:ring-2",
380
+ "focus-visible:ring-indicator-info",
381
+ "focus-visible:ring-offset-0",
382
+ "focus-visible:shadow-none",
383
+ "active:ring-2",
384
+ "active:ring-primary-950",
385
+ "active:ring-offset-0",
386
+ "active:shadow-none",
387
+ "disabled:opacity-50",
388
+ "disabled:cursor-not-allowed"
389
+ ];
390
+ const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
391
+ const allClasses = [...baseClasses, ...stateClasses].join(" ");
392
+ return /* @__PURE__ */ jsxs3(
393
+ "button",
394
+ {
395
+ ref,
396
+ type: "button",
397
+ className: cn(allClasses, className),
398
+ disabled,
399
+ "aria-pressed": selected,
400
+ ...props,
401
+ children: [
402
+ /* @__PURE__ */ jsx4("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
403
+ /* @__PURE__ */ jsx4("span", { children: label })
404
+ ]
405
+ }
406
+ );
407
+ }
408
+ );
409
+ SelectionButton.displayName = "SelectionButton";
410
+ var SelectionButton_default = SelectionButton;
411
+
412
+ // src/hooks/useTheme.ts
413
+ import { useEffect as useEffect2, useState, useCallback, useRef } from "react";
414
+ var useTheme = () => {
415
+ const [themeMode, setThemeMode] = useState("system");
416
+ const [isDark, setIsDark] = useState(false);
417
+ const themeModeRef = useRef("system");
418
+ const applyTheme = useCallback((mode) => {
419
+ const htmlElement = document.documentElement;
420
+ const originalTheme = htmlElement.getAttribute("data-original-theme");
421
+ if (mode === "dark") {
422
+ htmlElement.setAttribute("data-theme", "dark");
423
+ setIsDark(true);
424
+ } else if (mode === "light") {
425
+ if (originalTheme) {
426
+ htmlElement.setAttribute("data-theme", originalTheme);
427
+ }
428
+ setIsDark(false);
429
+ } else if (mode === "system") {
430
+ const isSystemDark = window.matchMedia(
431
+ "(prefers-color-scheme: dark)"
432
+ ).matches;
433
+ if (isSystemDark) {
434
+ htmlElement.setAttribute("data-theme", "dark");
435
+ setIsDark(true);
436
+ } else if (originalTheme) {
437
+ htmlElement.setAttribute("data-theme", originalTheme);
438
+ setIsDark(false);
439
+ }
440
+ }
441
+ }, []);
442
+ const toggleTheme = useCallback(() => {
443
+ let newMode;
444
+ if (themeMode === "light") {
445
+ newMode = "dark";
446
+ } else if (themeMode === "dark") {
447
+ newMode = "light";
448
+ } else {
449
+ newMode = "dark";
450
+ }
451
+ setThemeMode(newMode);
452
+ themeModeRef.current = newMode;
453
+ applyTheme(newMode);
454
+ localStorage.setItem("theme-mode", newMode);
455
+ }, [themeMode, applyTheme]);
456
+ const setTheme = useCallback(
457
+ (mode) => {
458
+ setThemeMode(mode);
459
+ themeModeRef.current = mode;
460
+ applyTheme(mode);
461
+ localStorage.setItem("theme-mode", mode);
462
+ },
463
+ [applyTheme]
464
+ );
465
+ useEffect2(() => {
466
+ const htmlElement = document.documentElement;
467
+ const currentTheme = htmlElement.getAttribute("data-theme");
468
+ if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
469
+ htmlElement.setAttribute("data-original-theme", currentTheme);
470
+ }
471
+ const savedThemeMode = localStorage.getItem("theme-mode");
472
+ const initialMode = savedThemeMode || "system";
473
+ if (!savedThemeMode) {
474
+ localStorage.setItem("theme-mode", "system");
475
+ }
476
+ setThemeMode(initialMode);
477
+ themeModeRef.current = initialMode;
478
+ applyTheme(initialMode);
479
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
480
+ const handleSystemThemeChange = () => {
481
+ if (themeModeRef.current === "system") {
482
+ applyTheme("system");
483
+ }
484
+ };
485
+ mediaQuery.addEventListener("change", handleSystemThemeChange);
486
+ return () => {
487
+ mediaQuery.removeEventListener("change", handleSystemThemeChange);
488
+ };
489
+ }, [applyTheme]);
490
+ return {
491
+ themeMode,
492
+ isDark,
493
+ toggleTheme,
494
+ setTheme
495
+ };
496
+ };
497
+
498
+ // src/components/ThemeToggle/ThemeToggle.tsx
499
+ import { jsx as jsx5 } from "react/jsx-runtime";
500
+ var ThemeToggle = ({
501
+ variant = "default",
502
+ onToggle
503
+ }) => {
504
+ const { themeMode, setTheme } = useTheme();
505
+ const [tempTheme, setTempTheme] = useState2(themeMode);
506
+ useEffect3(() => {
507
+ setTempTheme(themeMode);
508
+ }, [themeMode]);
509
+ const problemTypes = [
510
+ {
511
+ id: "light",
512
+ title: "Claro",
513
+ icon: /* @__PURE__ */ jsx5(Sun, { size: 24 })
514
+ },
515
+ {
516
+ id: "dark",
517
+ title: "Escuro",
518
+ icon: /* @__PURE__ */ jsx5(Moon, { size: 24 })
519
+ },
520
+ {
521
+ id: "system",
522
+ title: "Sistema",
523
+ icon: /* @__PURE__ */ jsx5(
524
+ "svg",
525
+ {
526
+ width: "25",
527
+ height: "25",
528
+ viewBox: "0 0 25 25",
529
+ fill: "none",
530
+ xmlns: "http://www.w3.org/2000/svg",
531
+ children: /* @__PURE__ */ jsx5(
532
+ "path",
533
+ {
534
+ 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",
535
+ fill: "#525252"
536
+ }
537
+ )
538
+ }
539
+ )
540
+ }
541
+ ];
542
+ const handleThemeSelect = (selectedTheme) => {
543
+ if (variant === "with-save") {
544
+ setTempTheme(selectedTheme);
545
+ } else {
546
+ setTheme(selectedTheme);
547
+ }
548
+ if (onToggle) {
549
+ onToggle(selectedTheme);
550
+ }
551
+ };
552
+ const currentTheme = variant === "with-save" ? tempTheme : themeMode;
553
+ return /* @__PURE__ */ jsx5("div", { className: "flex flex-row gap-2 sm:gap-4 py-2", children: problemTypes.map((type) => /* @__PURE__ */ jsx5(
554
+ SelectionButton_default,
555
+ {
556
+ icon: type.icon,
557
+ label: type.title,
558
+ selected: currentTheme === type.id,
559
+ onClick: () => handleThemeSelect(type.id),
560
+ className: "w-full p-2 sm:p-4"
561
+ },
562
+ type.id
563
+ )) });
564
+ };
565
+
79
566
  // src/components/DropdownMenu/DropdownMenu.tsx
80
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
567
+ import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
81
568
  function createDropdownStore() {
82
569
  return create((set) => ({
83
570
  open: false,
@@ -112,14 +599,14 @@ var DropdownMenu = ({
112
599
  open: propOpen,
113
600
  onOpenChange
114
601
  }) => {
115
- const storeRef = useRef(null);
602
+ const storeRef = useRef2(null);
116
603
  storeRef.current ??= createDropdownStore();
117
604
  const store = storeRef.current;
118
605
  const { open, setOpen: storeSetOpen } = useStore(store, (s) => s);
119
606
  const setOpen = (newOpen) => {
120
607
  storeSetOpen(newOpen);
121
608
  };
122
- const menuRef = useRef(null);
609
+ const menuRef = useRef2(null);
123
610
  const handleArrowDownOrArrowUp = (event) => {
124
611
  const menuContent = menuRef.current?.querySelector('[role="menu"]');
125
612
  if (menuContent) {
@@ -153,7 +640,7 @@ var DropdownMenu = ({
153
640
  setOpen(false);
154
641
  }
155
642
  };
156
- useEffect(() => {
643
+ useEffect4(() => {
157
644
  if (open) {
158
645
  document.addEventListener("mousedown", handleClickOutside);
159
646
  document.addEventListener("keydown", handleDownkey);
@@ -163,16 +650,16 @@ var DropdownMenu = ({
163
650
  document.removeEventListener("keydown", handleDownkey);
164
651
  };
165
652
  }, [open]);
166
- useEffect(() => {
653
+ useEffect4(() => {
167
654
  setOpen(open);
168
655
  onOpenChange?.(open);
169
656
  }, [open, onOpenChange]);
170
- useEffect(() => {
657
+ useEffect4(() => {
171
658
  if (propOpen) {
172
659
  setOpen(propOpen);
173
660
  }
174
661
  }, [propOpen]);
175
- return /* @__PURE__ */ jsx2("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
662
+ return /* @__PURE__ */ jsx6("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
176
663
  };
177
664
  var DropdownMenuTrigger = ({
178
665
  className,
@@ -184,7 +671,7 @@ var DropdownMenuTrigger = ({
184
671
  const store = useDropdownStore(externalStore);
185
672
  const open = useStore(store, (s) => s.open);
186
673
  const toggleOpen = () => store.setState({ open: !open });
187
- return /* @__PURE__ */ jsx2(
674
+ return /* @__PURE__ */ jsx6(
188
675
  "button",
189
676
  {
190
677
  onClick: (e) => {
@@ -219,8 +706,8 @@ var MENUCONTENT_VARIANT_CLASSES = {
219
706
  menu: "p-1",
220
707
  profile: "p-6"
221
708
  };
222
- var MenuLabel = forwardRef(({ className, inset, store: _store, ...props }, ref) => {
223
- return /* @__PURE__ */ jsx2(
709
+ var MenuLabel = forwardRef2(({ className, inset, store: _store, ...props }, ref) => {
710
+ return /* @__PURE__ */ jsx6(
224
711
  "div",
225
712
  {
226
713
  ref,
@@ -230,7 +717,7 @@ var MenuLabel = forwardRef(({ className, inset, store: _store, ...props }, ref)
230
717
  );
231
718
  });
232
719
  MenuLabel.displayName = "MenuLabel";
233
- var DropdownMenuContent = forwardRef(
720
+ var DropdownMenuContent = forwardRef2(
234
721
  ({
235
722
  className,
236
723
  align = "start",
@@ -243,8 +730,8 @@ var DropdownMenuContent = forwardRef(
243
730
  }, ref) => {
244
731
  const store = useDropdownStore(externalStore);
245
732
  const open = useStore(store, (s) => s.open);
246
- const [isVisible, setIsVisible] = useState(open);
247
- useEffect(() => {
733
+ const [isVisible, setIsVisible] = useState3(open);
734
+ useEffect4(() => {
248
735
  if (open) {
249
736
  setIsVisible(true);
250
737
  } else {
@@ -259,7 +746,7 @@ var DropdownMenuContent = forwardRef(
259
746
  return `absolute ${vertical} ${horizontal}`;
260
747
  };
261
748
  const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
262
- return /* @__PURE__ */ jsx2(
749
+ return /* @__PURE__ */ jsx6(
263
750
  "div",
264
751
  {
265
752
  ref,
@@ -284,7 +771,7 @@ var DropdownMenuContent = forwardRef(
284
771
  }
285
772
  );
286
773
  DropdownMenuContent.displayName = "DropdownMenuContent";
287
- var DropdownMenuItem = forwardRef(
774
+ var DropdownMenuItem = forwardRef2(
288
775
  ({
289
776
  className,
290
777
  size = "small",
@@ -318,7 +805,7 @@ var DropdownMenuItem = forwardRef(
318
805
  const getVariantProps = () => {
319
806
  return variant === "profile" ? { "data-variant": "profile" } : {};
320
807
  };
321
- return /* @__PURE__ */ jsxs2(
808
+ return /* @__PURE__ */ jsxs4(
322
809
  "div",
323
810
  {
324
811
  ref,
@@ -340,7 +827,7 @@ var DropdownMenuItem = forwardRef(
340
827
  ...props,
341
828
  children: [
342
829
  iconLeft,
343
- /* @__PURE__ */ jsx2("span", { className: "w-full text-md", children }),
830
+ /* @__PURE__ */ jsx6("div", { className: "w-full", children }),
344
831
  iconRight
345
832
  ]
346
833
  }
@@ -348,7 +835,7 @@ var DropdownMenuItem = forwardRef(
348
835
  }
349
836
  );
350
837
  DropdownMenuItem.displayName = "DropdownMenuItem";
351
- var DropdownMenuSeparator = forwardRef(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ jsx2(
838
+ var DropdownMenuSeparator = forwardRef2(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ jsx6(
352
839
  "div",
353
840
  {
354
841
  ref,
@@ -357,11 +844,11 @@ var DropdownMenuSeparator = forwardRef(({ className, store: _store, ...props },
357
844
  }
358
845
  ));
359
846
  DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
360
- var ProfileMenuTrigger = forwardRef(({ className, onClick, store: externalStore, ...props }, ref) => {
847
+ var ProfileMenuTrigger = forwardRef2(({ className, onClick, store: externalStore, ...props }, ref) => {
361
848
  const store = useDropdownStore(externalStore);
362
849
  const open = useStore(store, (s) => s.open);
363
850
  const toggleOpen = () => store.setState({ open: !open });
364
- return /* @__PURE__ */ jsx2(
851
+ return /* @__PURE__ */ jsx6(
365
852
  "button",
366
853
  {
367
854
  ref,
@@ -376,13 +863,13 @@ var ProfileMenuTrigger = forwardRef(({ className, onClick, store: externalStore,
376
863
  },
377
864
  "aria-expanded": open,
378
865
  ...props,
379
- children: /* @__PURE__ */ jsx2("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ jsx2(User, { className: "text-primary-950", size: 18 }) })
866
+ 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 }) })
380
867
  }
381
868
  );
382
869
  });
383
870
  ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
384
- var ProfileMenuHeader = forwardRef(({ className, name, email, store: _store, ...props }, ref) => {
385
- return /* @__PURE__ */ jsxs2(
871
+ var ProfileMenuHeader = forwardRef2(({ className, name, email, store: _store, ...props }, ref) => {
872
+ return /* @__PURE__ */ jsxs4(
386
873
  "div",
387
874
  {
388
875
  ref,
@@ -390,18 +877,98 @@ var ProfileMenuHeader = forwardRef(({ className, name, email, store: _store, ...
390
877
  className: cn("flex flex-row gap-4 items-center", className),
391
878
  ...props,
392
879
  children: [
393
- /* @__PURE__ */ jsx2("span", { className: "size-16 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx2(User, { size: 34, className: "text-primary-950" }) }),
394
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col ", children: [
395
- /* @__PURE__ */ jsx2("p", { className: "text-xl font-bold text-text-950", children: name }),
396
- /* @__PURE__ */ jsx2("p", { className: "text-md text-text-600", children: email })
880
+ /* @__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" }) }),
881
+ /* @__PURE__ */ jsxs4("div", { className: "flex flex-col ", children: [
882
+ /* @__PURE__ */ jsx6(Text_default, { size: "xl", weight: "bold", color: "text-text-950", children: name }),
883
+ /* @__PURE__ */ jsx6(Text_default, { size: "md", color: "text-text-600", children: email })
397
884
  ] })
398
885
  ]
399
886
  }
400
887
  );
401
888
  });
402
889
  ProfileMenuHeader.displayName = "ProfileMenuHeader";
403
- var ProfileMenuSection = forwardRef(({ className, children, store: _store, ...props }, ref) => {
404
- return /* @__PURE__ */ jsx2("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
890
+ var ProfileToggleTheme = ({ ...props }) => {
891
+ const { themeMode, setTheme } = useTheme();
892
+ const [modalThemeToggle, setModalThemeToggle] = useState3(false);
893
+ const [selectedTheme, setSelectedTheme] = useState3(themeMode);
894
+ const handleClick = (e) => {
895
+ e.preventDefault();
896
+ e.stopPropagation();
897
+ setModalThemeToggle(true);
898
+ };
899
+ const handleSave = () => {
900
+ setTheme(selectedTheme);
901
+ setModalThemeToggle(false);
902
+ };
903
+ return /* @__PURE__ */ jsxs4(Fragment, { children: [
904
+ /* @__PURE__ */ jsxs4(
905
+ "div",
906
+ {
907
+ role: "menuitem",
908
+ "data-variant": "profile",
909
+ 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",
910
+ onClick: handleClick,
911
+ onKeyDown: (e) => {
912
+ if (e.key === "Enter" || e.key === " ") {
913
+ e.preventDefault();
914
+ e.stopPropagation();
915
+ setModalThemeToggle(true);
916
+ }
917
+ },
918
+ tabIndex: 0,
919
+ ...props,
920
+ children: [
921
+ /* @__PURE__ */ jsx6(
922
+ "svg",
923
+ {
924
+ width: "25",
925
+ height: "25",
926
+ viewBox: "0 0 25 25",
927
+ fill: "none",
928
+ xmlns: "http://www.w3.org/2000/svg",
929
+ children: /* @__PURE__ */ jsx6(
930
+ "path",
931
+ {
932
+ 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",
933
+ fill: "#525252"
934
+ }
935
+ )
936
+ }
937
+ ),
938
+ /* @__PURE__ */ jsx6(Text_default, { className: "w-full", size: "md", children: "Apar\xEAncia" }),
939
+ /* @__PURE__ */ jsx6(CaretRight, {})
940
+ ]
941
+ }
942
+ ),
943
+ /* @__PURE__ */ jsx6(
944
+ Modal_default,
945
+ {
946
+ isOpen: modalThemeToggle,
947
+ onClose: () => setModalThemeToggle(false),
948
+ title: "Apar\xEAncia",
949
+ size: "md",
950
+ footer: /* @__PURE__ */ jsxs4("div", { className: "flex gap-3", children: [
951
+ /* @__PURE__ */ jsx6(
952
+ Button_default,
953
+ {
954
+ variant: "outline",
955
+ onClick: () => setModalThemeToggle(false),
956
+ children: "Cancelar"
957
+ }
958
+ ),
959
+ /* @__PURE__ */ jsx6(Button_default, { variant: "solid", onClick: () => handleSave(), children: "Salvar" })
960
+ ] }),
961
+ children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
962
+ /* @__PURE__ */ jsx6("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
963
+ /* @__PURE__ */ jsx6(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
964
+ ] })
965
+ }
966
+ )
967
+ ] });
968
+ };
969
+ ProfileToggleTheme.displayName = "ProfileToggleTheme";
970
+ var ProfileMenuSection = forwardRef2(({ className, children, store: _store, ...props }, ref) => {
971
+ return /* @__PURE__ */ jsx6("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
405
972
  });
406
973
  ProfileMenuSection.displayName = "ProfileMenuSection";
407
974
  var ProfileMenuFooter = ({
@@ -413,7 +980,7 @@ var ProfileMenuFooter = ({
413
980
  }) => {
414
981
  const store = useDropdownStore(externalStore);
415
982
  const setOpen = useStore(store, (s) => s.setOpen);
416
- return /* @__PURE__ */ jsxs2(
983
+ return /* @__PURE__ */ jsxs4(
417
984
  Button_default,
418
985
  {
419
986
  variant: "outline",
@@ -425,8 +992,8 @@ var ProfileMenuFooter = ({
425
992
  },
426
993
  ...props,
427
994
  children: [
428
- /* @__PURE__ */ jsx2("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx2(SignOut, {}) }),
429
- /* @__PURE__ */ jsx2("span", { children: "Sair" })
995
+ /* @__PURE__ */ jsx6("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx6(SignOut, {}) }),
996
+ /* @__PURE__ */ jsx6(Text_default, { children: "Sair" })
430
997
  ]
431
998
  }
432
999
  );
@@ -443,6 +1010,7 @@ export {
443
1010
  ProfileMenuHeader,
444
1011
  ProfileMenuSection,
445
1012
  ProfileMenuTrigger,
1013
+ ProfileToggleTheme,
446
1014
  createDropdownStore,
447
1015
  DropdownMenu_default as default,
448
1016
  useDropdownStore