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
@@ -29,13 +29,14 @@ __export(DropdownMenu_exports, {
29
29
  ProfileMenuHeader: () => ProfileMenuHeader,
30
30
  ProfileMenuSection: () => ProfileMenuSection,
31
31
  ProfileMenuTrigger: () => ProfileMenuTrigger,
32
+ ProfileToggleTheme: () => ProfileToggleTheme,
32
33
  createDropdownStore: () => createDropdownStore,
33
34
  default: () => DropdownMenu_default,
34
35
  useDropdownStore: () => useDropdownStore
35
36
  });
36
37
  module.exports = __toCommonJS(DropdownMenu_exports);
37
- var import_phosphor_react = require("phosphor-react");
38
- var import_react = require("react");
38
+ var import_phosphor_react3 = require("phosphor-react");
39
+ var import_react5 = require("react");
39
40
  var import_zustand = require("zustand");
40
41
 
41
42
  // src/utils/utils.ts
@@ -103,8 +104,495 @@ var Button = ({
103
104
  };
104
105
  var Button_default = Button;
105
106
 
106
- // src/components/DropdownMenu/DropdownMenu.tsx
107
+ // src/components/Text/Text.tsx
107
108
  var import_jsx_runtime2 = require("react/jsx-runtime");
109
+ var Text = ({
110
+ children,
111
+ size = "md",
112
+ weight = "normal",
113
+ color = "text-text-950",
114
+ as,
115
+ className = "",
116
+ ...props
117
+ }) => {
118
+ let sizeClasses = "";
119
+ let weightClasses = "";
120
+ const sizeClassMap = {
121
+ "2xs": "text-2xs",
122
+ xs: "text-xs",
123
+ sm: "text-sm",
124
+ md: "text-md",
125
+ lg: "text-lg",
126
+ xl: "text-xl",
127
+ "2xl": "text-2xl",
128
+ "3xl": "text-3xl",
129
+ "4xl": "text-4xl",
130
+ "5xl": "text-5xl",
131
+ "6xl": "text-6xl"
132
+ };
133
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
134
+ const weightClassMap = {
135
+ hairline: "font-hairline",
136
+ light: "font-light",
137
+ normal: "font-normal",
138
+ medium: "font-medium",
139
+ semibold: "font-semibold",
140
+ bold: "font-bold",
141
+ extrabold: "font-extrabold",
142
+ black: "font-black"
143
+ };
144
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
145
+ const baseClasses = "font-primary";
146
+ const Component = as ?? "p";
147
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
148
+ Component,
149
+ {
150
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
151
+ ...props,
152
+ children
153
+ }
154
+ );
155
+ };
156
+ var Text_default = Text;
157
+
158
+ // src/components/Modal/Modal.tsx
159
+ var import_react = require("react");
160
+ var import_phosphor_react = require("phosphor-react");
161
+
162
+ // src/components/Modal/utils/videoUtils.ts
163
+ var isYouTubeUrl = (url) => {
164
+ const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
165
+ return youtubeRegex.test(url);
166
+ };
167
+ var isValidYouTubeHost = (host) => {
168
+ if (host === "youtu.be") return "youtu.be";
169
+ const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
170
+ if (isValidYouTubeCom) return "youtube";
171
+ const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
172
+ if (isValidNoCookie) return "nocookie";
173
+ return null;
174
+ };
175
+ var extractYoutuBeId = (pathname) => {
176
+ const firstSeg = pathname.split("/").filter(Boolean)[0];
177
+ return firstSeg || null;
178
+ };
179
+ var extractYouTubeId = (pathname, searchParams) => {
180
+ const parts = pathname.split("/").filter(Boolean);
181
+ const [first, second] = parts;
182
+ if (first === "embed" && second) return second;
183
+ if (first === "shorts" && second) return second;
184
+ if (first === "live" && second) return second;
185
+ const v = searchParams.get("v");
186
+ if (v) return v;
187
+ return null;
188
+ };
189
+ var getYouTubeVideoId = (url) => {
190
+ try {
191
+ const u = new URL(url);
192
+ const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
193
+ if (!hostType) return null;
194
+ if (hostType === "youtu.be") {
195
+ return extractYoutuBeId(u.pathname);
196
+ }
197
+ return extractYouTubeId(u.pathname, u.searchParams);
198
+ } catch {
199
+ return null;
200
+ }
201
+ };
202
+ var getYouTubeEmbedUrl = (videoId) => {
203
+ return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
204
+ };
205
+
206
+ // src/components/Modal/Modal.tsx
207
+ var import_jsx_runtime3 = require("react/jsx-runtime");
208
+ var SIZE_CLASSES2 = {
209
+ xs: "max-w-[360px]",
210
+ sm: "max-w-[420px]",
211
+ md: "max-w-[510px]",
212
+ lg: "max-w-[640px]",
213
+ xl: "max-w-[970px]"
214
+ };
215
+ var Modal = ({
216
+ isOpen,
217
+ onClose,
218
+ title,
219
+ children,
220
+ size = "md",
221
+ className = "",
222
+ closeOnEscape = true,
223
+ footer,
224
+ hideCloseButton = false,
225
+ variant = "default",
226
+ description,
227
+ image,
228
+ imageAlt,
229
+ actionLink,
230
+ actionLabel
231
+ }) => {
232
+ const titleId = (0, import_react.useId)();
233
+ (0, import_react.useEffect)(() => {
234
+ if (!isOpen || !closeOnEscape) return;
235
+ const handleEscape = (event) => {
236
+ if (event.key === "Escape") {
237
+ onClose();
238
+ }
239
+ };
240
+ document.addEventListener("keydown", handleEscape);
241
+ return () => document.removeEventListener("keydown", handleEscape);
242
+ }, [isOpen, closeOnEscape, onClose]);
243
+ (0, import_react.useEffect)(() => {
244
+ const originalOverflow = document.body.style.overflow;
245
+ if (isOpen) {
246
+ document.body.style.overflow = "hidden";
247
+ } else {
248
+ document.body.style.overflow = originalOverflow;
249
+ }
250
+ return () => {
251
+ document.body.style.overflow = originalOverflow;
252
+ };
253
+ }, [isOpen]);
254
+ if (!isOpen) return null;
255
+ const sizeClasses = SIZE_CLASSES2[size];
256
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
257
+ const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
258
+ const modalClasses = cn(
259
+ baseClasses,
260
+ sizeClasses,
261
+ dialogResetClasses,
262
+ className
263
+ );
264
+ const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
265
+ const handleActionClick = () => {
266
+ if (actionLink) {
267
+ window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
268
+ }
269
+ };
270
+ if (variant === "activity") {
271
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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__ */ (0, import_jsx_runtime3.jsxs)(
272
+ "dialog",
273
+ {
274
+ className: modalClasses,
275
+ "aria-labelledby": titleId,
276
+ "aria-modal": "true",
277
+ open: true,
278
+ children: [
279
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
280
+ "button",
281
+ {
282
+ onClick: onClose,
283
+ 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",
284
+ "aria-label": "Fechar modal",
285
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.X, { size: 18 })
286
+ }
287
+ ) }),
288
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
289
+ image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
290
+ "img",
291
+ {
292
+ src: image,
293
+ alt: imageAlt ?? "",
294
+ className: "w-[122px] h-[122px] object-contain"
295
+ }
296
+ ) }),
297
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
298
+ "h2",
299
+ {
300
+ id: titleId,
301
+ className: "text-lg font-semibold text-text-950 text-center",
302
+ children: title
303
+ }
304
+ ),
305
+ description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
306
+ actionLink && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "w-full", children: [
307
+ (() => {
308
+ const normalized = normalizeUrl(actionLink);
309
+ const isYT = isYouTubeUrl(normalized);
310
+ if (!isYT) return null;
311
+ const id = getYouTubeVideoId(normalized);
312
+ if (!id) {
313
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
314
+ Button_default,
315
+ {
316
+ variant: "solid",
317
+ action: "primary",
318
+ size: "large",
319
+ className: "w-full",
320
+ onClick: handleActionClick,
321
+ children: actionLabel || "Iniciar Atividade"
322
+ }
323
+ );
324
+ }
325
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
326
+ "iframe",
327
+ {
328
+ src: getYouTubeEmbedUrl(id),
329
+ className: "w-full aspect-video rounded-lg",
330
+ allowFullScreen: true,
331
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
332
+ title: "V\xEDdeo YouTube"
333
+ }
334
+ );
335
+ })(),
336
+ !isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
337
+ Button_default,
338
+ {
339
+ variant: "solid",
340
+ action: "primary",
341
+ size: "large",
342
+ className: "w-full",
343
+ onClick: handleActionClick,
344
+ children: actionLabel || "Iniciar Atividade"
345
+ }
346
+ )
347
+ ] })
348
+ ] })
349
+ ]
350
+ }
351
+ ) });
352
+ }
353
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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__ */ (0, import_jsx_runtime3.jsxs)(
354
+ "dialog",
355
+ {
356
+ className: modalClasses,
357
+ "aria-labelledby": titleId,
358
+ "aria-modal": "true",
359
+ open: true,
360
+ children: [
361
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
362
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
363
+ !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
364
+ "button",
365
+ {
366
+ onClick: onClose,
367
+ 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",
368
+ "aria-label": "Fechar modal",
369
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.X, { size: 18 })
370
+ }
371
+ )
372
+ ] }),
373
+ children && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
374
+ footer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
375
+ ]
376
+ }
377
+ ) });
378
+ };
379
+ var Modal_default = Modal;
380
+
381
+ // src/components/ThemeToggle/ThemeToggle.tsx
382
+ var import_phosphor_react2 = require("phosphor-react");
383
+ var import_react4 = require("react");
384
+
385
+ // src/components/SelectionButton/SelectionButton.tsx
386
+ var import_react2 = require("react");
387
+ var import_jsx_runtime4 = require("react/jsx-runtime");
388
+ var SelectionButton = (0, import_react2.forwardRef)(
389
+ ({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
390
+ const baseClasses = [
391
+ "inline-flex",
392
+ "items-center",
393
+ "justify-start",
394
+ "gap-2",
395
+ "p-4",
396
+ "rounded-xl",
397
+ "cursor-pointer",
398
+ "border",
399
+ "border-border-50",
400
+ "bg-background",
401
+ "text-sm",
402
+ "text-text-700",
403
+ "font-bold",
404
+ "shadow-soft-shadow-1",
405
+ "hover:bg-background-100",
406
+ "focus-visible:outline-none",
407
+ "focus-visible:ring-2",
408
+ "focus-visible:ring-indicator-info",
409
+ "focus-visible:ring-offset-0",
410
+ "focus-visible:shadow-none",
411
+ "active:ring-2",
412
+ "active:ring-primary-950",
413
+ "active:ring-offset-0",
414
+ "active:shadow-none",
415
+ "disabled:opacity-50",
416
+ "disabled:cursor-not-allowed"
417
+ ];
418
+ const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
419
+ const allClasses = [...baseClasses, ...stateClasses].join(" ");
420
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
421
+ "button",
422
+ {
423
+ ref,
424
+ type: "button",
425
+ className: cn(allClasses, className),
426
+ disabled,
427
+ "aria-pressed": selected,
428
+ ...props,
429
+ children: [
430
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
431
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
432
+ ]
433
+ }
434
+ );
435
+ }
436
+ );
437
+ SelectionButton.displayName = "SelectionButton";
438
+ var SelectionButton_default = SelectionButton;
439
+
440
+ // src/hooks/useTheme.ts
441
+ var import_react3 = require("react");
442
+ var useTheme = () => {
443
+ const [themeMode, setThemeMode] = (0, import_react3.useState)("system");
444
+ const [isDark, setIsDark] = (0, import_react3.useState)(false);
445
+ const themeModeRef = (0, import_react3.useRef)("system");
446
+ const applyTheme = (0, import_react3.useCallback)((mode) => {
447
+ const htmlElement = document.documentElement;
448
+ const originalTheme = htmlElement.getAttribute("data-original-theme");
449
+ if (mode === "dark") {
450
+ htmlElement.setAttribute("data-theme", "dark");
451
+ setIsDark(true);
452
+ } else if (mode === "light") {
453
+ if (originalTheme) {
454
+ htmlElement.setAttribute("data-theme", originalTheme);
455
+ }
456
+ setIsDark(false);
457
+ } else if (mode === "system") {
458
+ const isSystemDark = window.matchMedia(
459
+ "(prefers-color-scheme: dark)"
460
+ ).matches;
461
+ if (isSystemDark) {
462
+ htmlElement.setAttribute("data-theme", "dark");
463
+ setIsDark(true);
464
+ } else if (originalTheme) {
465
+ htmlElement.setAttribute("data-theme", originalTheme);
466
+ setIsDark(false);
467
+ }
468
+ }
469
+ }, []);
470
+ const toggleTheme = (0, import_react3.useCallback)(() => {
471
+ let newMode;
472
+ if (themeMode === "light") {
473
+ newMode = "dark";
474
+ } else if (themeMode === "dark") {
475
+ newMode = "light";
476
+ } else {
477
+ newMode = "dark";
478
+ }
479
+ setThemeMode(newMode);
480
+ themeModeRef.current = newMode;
481
+ applyTheme(newMode);
482
+ localStorage.setItem("theme-mode", newMode);
483
+ }, [themeMode, applyTheme]);
484
+ const setTheme = (0, import_react3.useCallback)(
485
+ (mode) => {
486
+ setThemeMode(mode);
487
+ themeModeRef.current = mode;
488
+ applyTheme(mode);
489
+ localStorage.setItem("theme-mode", mode);
490
+ },
491
+ [applyTheme]
492
+ );
493
+ (0, import_react3.useEffect)(() => {
494
+ const htmlElement = document.documentElement;
495
+ const currentTheme = htmlElement.getAttribute("data-theme");
496
+ if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
497
+ htmlElement.setAttribute("data-original-theme", currentTheme);
498
+ }
499
+ const savedThemeMode = localStorage.getItem("theme-mode");
500
+ const initialMode = savedThemeMode || "system";
501
+ if (!savedThemeMode) {
502
+ localStorage.setItem("theme-mode", "system");
503
+ }
504
+ setThemeMode(initialMode);
505
+ themeModeRef.current = initialMode;
506
+ applyTheme(initialMode);
507
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
508
+ const handleSystemThemeChange = () => {
509
+ if (themeModeRef.current === "system") {
510
+ applyTheme("system");
511
+ }
512
+ };
513
+ mediaQuery.addEventListener("change", handleSystemThemeChange);
514
+ return () => {
515
+ mediaQuery.removeEventListener("change", handleSystemThemeChange);
516
+ };
517
+ }, [applyTheme]);
518
+ return {
519
+ themeMode,
520
+ isDark,
521
+ toggleTheme,
522
+ setTheme
523
+ };
524
+ };
525
+
526
+ // src/components/ThemeToggle/ThemeToggle.tsx
527
+ var import_jsx_runtime5 = require("react/jsx-runtime");
528
+ var ThemeToggle = ({
529
+ variant = "default",
530
+ onToggle
531
+ }) => {
532
+ const { themeMode, setTheme } = useTheme();
533
+ const [tempTheme, setTempTheme] = (0, import_react4.useState)(themeMode);
534
+ (0, import_react4.useEffect)(() => {
535
+ setTempTheme(themeMode);
536
+ }, [themeMode]);
537
+ const problemTypes = [
538
+ {
539
+ id: "light",
540
+ title: "Claro",
541
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Sun, { size: 24 })
542
+ },
543
+ {
544
+ id: "dark",
545
+ title: "Escuro",
546
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Moon, { size: 24 })
547
+ },
548
+ {
549
+ id: "system",
550
+ title: "Sistema",
551
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
552
+ "svg",
553
+ {
554
+ width: "25",
555
+ height: "25",
556
+ viewBox: "0 0 25 25",
557
+ fill: "none",
558
+ xmlns: "http://www.w3.org/2000/svg",
559
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
560
+ "path",
561
+ {
562
+ 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",
563
+ fill: "#525252"
564
+ }
565
+ )
566
+ }
567
+ )
568
+ }
569
+ ];
570
+ const handleThemeSelect = (selectedTheme) => {
571
+ if (variant === "with-save") {
572
+ setTempTheme(selectedTheme);
573
+ } else {
574
+ setTheme(selectedTheme);
575
+ }
576
+ if (onToggle) {
577
+ onToggle(selectedTheme);
578
+ }
579
+ };
580
+ const currentTheme = variant === "with-save" ? tempTheme : themeMode;
581
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex flex-row gap-2 sm:gap-4 py-2", children: problemTypes.map((type) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
582
+ SelectionButton_default,
583
+ {
584
+ icon: type.icon,
585
+ label: type.title,
586
+ selected: currentTheme === type.id,
587
+ onClick: () => handleThemeSelect(type.id),
588
+ className: "w-full p-2 sm:p-4"
589
+ },
590
+ type.id
591
+ )) });
592
+ };
593
+
594
+ // src/components/DropdownMenu/DropdownMenu.tsx
595
+ var import_jsx_runtime6 = require("react/jsx-runtime");
108
596
  function createDropdownStore() {
109
597
  return (0, import_zustand.create)((set) => ({
110
598
  open: false,
@@ -120,8 +608,8 @@ var useDropdownStore = (externalStore) => {
120
608
  return externalStore;
121
609
  };
122
610
  var injectStore = (children, store) => {
123
- return import_react.Children.map(children, (child) => {
124
- if ((0, import_react.isValidElement)(child)) {
611
+ return import_react5.Children.map(children, (child) => {
612
+ if ((0, import_react5.isValidElement)(child)) {
125
613
  const typedChild = child;
126
614
  const newProps = {
127
615
  store
@@ -129,7 +617,7 @@ var injectStore = (children, store) => {
129
617
  if (typedChild.props.children) {
130
618
  newProps.children = injectStore(typedChild.props.children, store);
131
619
  }
132
- return (0, import_react.cloneElement)(typedChild, newProps);
620
+ return (0, import_react5.cloneElement)(typedChild, newProps);
133
621
  }
134
622
  return child;
135
623
  });
@@ -139,14 +627,14 @@ var DropdownMenu = ({
139
627
  open: propOpen,
140
628
  onOpenChange
141
629
  }) => {
142
- const storeRef = (0, import_react.useRef)(null);
630
+ const storeRef = (0, import_react5.useRef)(null);
143
631
  storeRef.current ??= createDropdownStore();
144
632
  const store = storeRef.current;
145
633
  const { open, setOpen: storeSetOpen } = (0, import_zustand.useStore)(store, (s) => s);
146
634
  const setOpen = (newOpen) => {
147
635
  storeSetOpen(newOpen);
148
636
  };
149
- const menuRef = (0, import_react.useRef)(null);
637
+ const menuRef = (0, import_react5.useRef)(null);
150
638
  const handleArrowDownOrArrowUp = (event) => {
151
639
  const menuContent = menuRef.current?.querySelector('[role="menu"]');
152
640
  if (menuContent) {
@@ -180,7 +668,7 @@ var DropdownMenu = ({
180
668
  setOpen(false);
181
669
  }
182
670
  };
183
- (0, import_react.useEffect)(() => {
671
+ (0, import_react5.useEffect)(() => {
184
672
  if (open) {
185
673
  document.addEventListener("mousedown", handleClickOutside);
186
674
  document.addEventListener("keydown", handleDownkey);
@@ -190,16 +678,16 @@ var DropdownMenu = ({
190
678
  document.removeEventListener("keydown", handleDownkey);
191
679
  };
192
680
  }, [open]);
193
- (0, import_react.useEffect)(() => {
681
+ (0, import_react5.useEffect)(() => {
194
682
  setOpen(open);
195
683
  onOpenChange?.(open);
196
684
  }, [open, onOpenChange]);
197
- (0, import_react.useEffect)(() => {
685
+ (0, import_react5.useEffect)(() => {
198
686
  if (propOpen) {
199
687
  setOpen(propOpen);
200
688
  }
201
689
  }, [propOpen]);
202
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
690
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
203
691
  };
204
692
  var DropdownMenuTrigger = ({
205
693
  className,
@@ -211,7 +699,7 @@ var DropdownMenuTrigger = ({
211
699
  const store = useDropdownStore(externalStore);
212
700
  const open = (0, import_zustand.useStore)(store, (s) => s.open);
213
701
  const toggleOpen = () => store.setState({ open: !open });
214
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
702
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
215
703
  "button",
216
704
  {
217
705
  onClick: (e) => {
@@ -246,8 +734,8 @@ var MENUCONTENT_VARIANT_CLASSES = {
246
734
  menu: "p-1",
247
735
  profile: "p-6"
248
736
  };
249
- var MenuLabel = (0, import_react.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
250
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
737
+ var MenuLabel = (0, import_react5.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
738
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
251
739
  "div",
252
740
  {
253
741
  ref,
@@ -257,7 +745,7 @@ var MenuLabel = (0, import_react.forwardRef)(({ className, inset, store: _store,
257
745
  );
258
746
  });
259
747
  MenuLabel.displayName = "MenuLabel";
260
- var DropdownMenuContent = (0, import_react.forwardRef)(
748
+ var DropdownMenuContent = (0, import_react5.forwardRef)(
261
749
  ({
262
750
  className,
263
751
  align = "start",
@@ -270,8 +758,8 @@ var DropdownMenuContent = (0, import_react.forwardRef)(
270
758
  }, ref) => {
271
759
  const store = useDropdownStore(externalStore);
272
760
  const open = (0, import_zustand.useStore)(store, (s) => s.open);
273
- const [isVisible, setIsVisible] = (0, import_react.useState)(open);
274
- (0, import_react.useEffect)(() => {
761
+ const [isVisible, setIsVisible] = (0, import_react5.useState)(open);
762
+ (0, import_react5.useEffect)(() => {
275
763
  if (open) {
276
764
  setIsVisible(true);
277
765
  } else {
@@ -286,7 +774,7 @@ var DropdownMenuContent = (0, import_react.forwardRef)(
286
774
  return `absolute ${vertical} ${horizontal}`;
287
775
  };
288
776
  const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
289
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
777
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
290
778
  "div",
291
779
  {
292
780
  ref,
@@ -311,7 +799,7 @@ var DropdownMenuContent = (0, import_react.forwardRef)(
311
799
  }
312
800
  );
313
801
  DropdownMenuContent.displayName = "DropdownMenuContent";
314
- var DropdownMenuItem = (0, import_react.forwardRef)(
802
+ var DropdownMenuItem = (0, import_react5.forwardRef)(
315
803
  ({
316
804
  className,
317
805
  size = "small",
@@ -345,7 +833,7 @@ var DropdownMenuItem = (0, import_react.forwardRef)(
345
833
  const getVariantProps = () => {
346
834
  return variant === "profile" ? { "data-variant": "profile" } : {};
347
835
  };
348
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
836
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
349
837
  "div",
350
838
  {
351
839
  ref,
@@ -367,7 +855,7 @@ var DropdownMenuItem = (0, import_react.forwardRef)(
367
855
  ...props,
368
856
  children: [
369
857
  iconLeft,
370
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "w-full text-md", children }),
858
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-full", children }),
371
859
  iconRight
372
860
  ]
373
861
  }
@@ -375,7 +863,7 @@ var DropdownMenuItem = (0, import_react.forwardRef)(
375
863
  }
376
864
  );
377
865
  DropdownMenuItem.displayName = "DropdownMenuItem";
378
- var DropdownMenuSeparator = (0, import_react.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
866
+ var DropdownMenuSeparator = (0, import_react5.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
379
867
  "div",
380
868
  {
381
869
  ref,
@@ -384,11 +872,11 @@ var DropdownMenuSeparator = (0, import_react.forwardRef)(({ className, store: _s
384
872
  }
385
873
  ));
386
874
  DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
387
- var ProfileMenuTrigger = (0, import_react.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
875
+ var ProfileMenuTrigger = (0, import_react5.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
388
876
  const store = useDropdownStore(externalStore);
389
877
  const open = (0, import_zustand.useStore)(store, (s) => s.open);
390
878
  const toggleOpen = () => store.setState({ open: !open });
391
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
879
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
392
880
  "button",
393
881
  {
394
882
  ref,
@@ -403,13 +891,13 @@ var ProfileMenuTrigger = (0, import_react.forwardRef)(({ className, onClick, sto
403
891
  },
404
892
  "aria-expanded": open,
405
893
  ...props,
406
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.User, { className: "text-primary-950", size: 18 }) })
894
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.User, { className: "text-primary-950", size: 18 }) })
407
895
  }
408
896
  );
409
897
  });
410
898
  ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
411
- var ProfileMenuHeader = (0, import_react.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
412
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
899
+ var ProfileMenuHeader = (0, import_react5.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
900
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
413
901
  "div",
414
902
  {
415
903
  ref,
@@ -417,18 +905,98 @@ var ProfileMenuHeader = (0, import_react.forwardRef)(({ className, name, email,
417
905
  className: cn("flex flex-row gap-4 items-center", className),
418
906
  ...props,
419
907
  children: [
420
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "size-16 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.User, { size: 34, className: "text-primary-950" }) }),
421
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col ", children: [
422
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
423
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-md text-text-600", children: email })
908
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "size-16 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.User, { size: 34, className: "text-primary-950" }) }),
909
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col ", children: [
910
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "xl", weight: "bold", color: "text-text-950", children: name }),
911
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "md", color: "text-text-600", children: email })
424
912
  ] })
425
913
  ]
426
914
  }
427
915
  );
428
916
  });
429
917
  ProfileMenuHeader.displayName = "ProfileMenuHeader";
430
- var ProfileMenuSection = (0, import_react.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
431
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
918
+ var ProfileToggleTheme = ({ ...props }) => {
919
+ const { themeMode, setTheme } = useTheme();
920
+ const [modalThemeToggle, setModalThemeToggle] = (0, import_react5.useState)(false);
921
+ const [selectedTheme, setSelectedTheme] = (0, import_react5.useState)(themeMode);
922
+ const handleClick = (e) => {
923
+ e.preventDefault();
924
+ e.stopPropagation();
925
+ setModalThemeToggle(true);
926
+ };
927
+ const handleSave = () => {
928
+ setTheme(selectedTheme);
929
+ setModalThemeToggle(false);
930
+ };
931
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
932
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
933
+ "div",
934
+ {
935
+ role: "menuitem",
936
+ "data-variant": "profile",
937
+ 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",
938
+ onClick: handleClick,
939
+ onKeyDown: (e) => {
940
+ if (e.key === "Enter" || e.key === " ") {
941
+ e.preventDefault();
942
+ e.stopPropagation();
943
+ setModalThemeToggle(true);
944
+ }
945
+ },
946
+ tabIndex: 0,
947
+ ...props,
948
+ children: [
949
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
950
+ "svg",
951
+ {
952
+ width: "25",
953
+ height: "25",
954
+ viewBox: "0 0 25 25",
955
+ fill: "none",
956
+ xmlns: "http://www.w3.org/2000/svg",
957
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
958
+ "path",
959
+ {
960
+ 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",
961
+ fill: "#525252"
962
+ }
963
+ )
964
+ }
965
+ ),
966
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { className: "w-full", size: "md", children: "Apar\xEAncia" }),
967
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.CaretRight, {})
968
+ ]
969
+ }
970
+ ),
971
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
972
+ Modal_default,
973
+ {
974
+ isOpen: modalThemeToggle,
975
+ onClose: () => setModalThemeToggle(false),
976
+ title: "Apar\xEAncia",
977
+ size: "md",
978
+ footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-3", children: [
979
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
980
+ Button_default,
981
+ {
982
+ variant: "outline",
983
+ onClick: () => setModalThemeToggle(false),
984
+ children: "Cancelar"
985
+ }
986
+ ),
987
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button_default, { variant: "solid", onClick: () => handleSave(), children: "Salvar" })
988
+ ] }),
989
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
990
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
991
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
992
+ ] })
993
+ }
994
+ )
995
+ ] });
996
+ };
997
+ ProfileToggleTheme.displayName = "ProfileToggleTheme";
998
+ var ProfileMenuSection = (0, import_react5.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
999
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
432
1000
  });
433
1001
  ProfileMenuSection.displayName = "ProfileMenuSection";
434
1002
  var ProfileMenuFooter = ({
@@ -440,7 +1008,7 @@ var ProfileMenuFooter = ({
440
1008
  }) => {
441
1009
  const store = useDropdownStore(externalStore);
442
1010
  const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
443
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1011
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
444
1012
  Button_default,
445
1013
  {
446
1014
  variant: "outline",
@@ -452,8 +1020,8 @@ var ProfileMenuFooter = ({
452
1020
  },
453
1021
  ...props,
454
1022
  children: [
455
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.SignOut, {}) }),
456
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Sair" })
1023
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.SignOut, {}) }),
1024
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { children: "Sair" })
457
1025
  ]
458
1026
  }
459
1027
  );
@@ -471,6 +1039,7 @@ var DropdownMenu_default = DropdownMenu;
471
1039
  ProfileMenuHeader,
472
1040
  ProfileMenuSection,
473
1041
  ProfileMenuTrigger,
1042
+ ProfileToggleTheme,
474
1043
  createDropdownStore,
475
1044
  useDropdownStore
476
1045
  });