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
package/dist/Search/index.js
CHANGED
|
@@ -23,12 +23,12 @@ __export(Search_exports, {
|
|
|
23
23
|
default: () => Search_default
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(Search_exports);
|
|
26
|
-
var
|
|
27
|
-
var
|
|
26
|
+
var import_phosphor_react4 = require("phosphor-react");
|
|
27
|
+
var import_react6 = require("react");
|
|
28
28
|
|
|
29
29
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
30
|
-
var
|
|
31
|
-
var
|
|
30
|
+
var import_phosphor_react3 = require("phosphor-react");
|
|
31
|
+
var import_react5 = require("react");
|
|
32
32
|
var import_zustand = require("zustand");
|
|
33
33
|
|
|
34
34
|
// src/utils/utils.ts
|
|
@@ -96,8 +96,495 @@ var Button = ({
|
|
|
96
96
|
};
|
|
97
97
|
var Button_default = Button;
|
|
98
98
|
|
|
99
|
-
// src/components/
|
|
99
|
+
// src/components/Text/Text.tsx
|
|
100
100
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
101
|
+
var Text = ({
|
|
102
|
+
children,
|
|
103
|
+
size = "md",
|
|
104
|
+
weight = "normal",
|
|
105
|
+
color = "text-text-950",
|
|
106
|
+
as,
|
|
107
|
+
className = "",
|
|
108
|
+
...props
|
|
109
|
+
}) => {
|
|
110
|
+
let sizeClasses = "";
|
|
111
|
+
let weightClasses = "";
|
|
112
|
+
const sizeClassMap = {
|
|
113
|
+
"2xs": "text-2xs",
|
|
114
|
+
xs: "text-xs",
|
|
115
|
+
sm: "text-sm",
|
|
116
|
+
md: "text-md",
|
|
117
|
+
lg: "text-lg",
|
|
118
|
+
xl: "text-xl",
|
|
119
|
+
"2xl": "text-2xl",
|
|
120
|
+
"3xl": "text-3xl",
|
|
121
|
+
"4xl": "text-4xl",
|
|
122
|
+
"5xl": "text-5xl",
|
|
123
|
+
"6xl": "text-6xl"
|
|
124
|
+
};
|
|
125
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
126
|
+
const weightClassMap = {
|
|
127
|
+
hairline: "font-hairline",
|
|
128
|
+
light: "font-light",
|
|
129
|
+
normal: "font-normal",
|
|
130
|
+
medium: "font-medium",
|
|
131
|
+
semibold: "font-semibold",
|
|
132
|
+
bold: "font-bold",
|
|
133
|
+
extrabold: "font-extrabold",
|
|
134
|
+
black: "font-black"
|
|
135
|
+
};
|
|
136
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
137
|
+
const baseClasses = "font-primary";
|
|
138
|
+
const Component = as ?? "p";
|
|
139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
140
|
+
Component,
|
|
141
|
+
{
|
|
142
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
143
|
+
...props,
|
|
144
|
+
children
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
var Text_default = Text;
|
|
149
|
+
|
|
150
|
+
// src/components/Modal/Modal.tsx
|
|
151
|
+
var import_react = require("react");
|
|
152
|
+
var import_phosphor_react = require("phosphor-react");
|
|
153
|
+
|
|
154
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
155
|
+
var isYouTubeUrl = (url) => {
|
|
156
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
157
|
+
return youtubeRegex.test(url);
|
|
158
|
+
};
|
|
159
|
+
var isValidYouTubeHost = (host) => {
|
|
160
|
+
if (host === "youtu.be") return "youtu.be";
|
|
161
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
162
|
+
if (isValidYouTubeCom) return "youtube";
|
|
163
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
164
|
+
if (isValidNoCookie) return "nocookie";
|
|
165
|
+
return null;
|
|
166
|
+
};
|
|
167
|
+
var extractYoutuBeId = (pathname) => {
|
|
168
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
169
|
+
return firstSeg || null;
|
|
170
|
+
};
|
|
171
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
172
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
173
|
+
const [first, second] = parts;
|
|
174
|
+
if (first === "embed" && second) return second;
|
|
175
|
+
if (first === "shorts" && second) return second;
|
|
176
|
+
if (first === "live" && second) return second;
|
|
177
|
+
const v = searchParams.get("v");
|
|
178
|
+
if (v) return v;
|
|
179
|
+
return null;
|
|
180
|
+
};
|
|
181
|
+
var getYouTubeVideoId = (url) => {
|
|
182
|
+
try {
|
|
183
|
+
const u = new URL(url);
|
|
184
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
185
|
+
if (!hostType) return null;
|
|
186
|
+
if (hostType === "youtu.be") {
|
|
187
|
+
return extractYoutuBeId(u.pathname);
|
|
188
|
+
}
|
|
189
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
190
|
+
} catch {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
195
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/components/Modal/Modal.tsx
|
|
199
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
200
|
+
var SIZE_CLASSES2 = {
|
|
201
|
+
xs: "max-w-[360px]",
|
|
202
|
+
sm: "max-w-[420px]",
|
|
203
|
+
md: "max-w-[510px]",
|
|
204
|
+
lg: "max-w-[640px]",
|
|
205
|
+
xl: "max-w-[970px]"
|
|
206
|
+
};
|
|
207
|
+
var Modal = ({
|
|
208
|
+
isOpen,
|
|
209
|
+
onClose,
|
|
210
|
+
title,
|
|
211
|
+
children,
|
|
212
|
+
size = "md",
|
|
213
|
+
className = "",
|
|
214
|
+
closeOnEscape = true,
|
|
215
|
+
footer,
|
|
216
|
+
hideCloseButton = false,
|
|
217
|
+
variant = "default",
|
|
218
|
+
description,
|
|
219
|
+
image,
|
|
220
|
+
imageAlt,
|
|
221
|
+
actionLink,
|
|
222
|
+
actionLabel
|
|
223
|
+
}) => {
|
|
224
|
+
const titleId = (0, import_react.useId)();
|
|
225
|
+
(0, import_react.useEffect)(() => {
|
|
226
|
+
if (!isOpen || !closeOnEscape) return;
|
|
227
|
+
const handleEscape = (event) => {
|
|
228
|
+
if (event.key === "Escape") {
|
|
229
|
+
onClose();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
document.addEventListener("keydown", handleEscape);
|
|
233
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
234
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
235
|
+
(0, import_react.useEffect)(() => {
|
|
236
|
+
const originalOverflow = document.body.style.overflow;
|
|
237
|
+
if (isOpen) {
|
|
238
|
+
document.body.style.overflow = "hidden";
|
|
239
|
+
} else {
|
|
240
|
+
document.body.style.overflow = originalOverflow;
|
|
241
|
+
}
|
|
242
|
+
return () => {
|
|
243
|
+
document.body.style.overflow = originalOverflow;
|
|
244
|
+
};
|
|
245
|
+
}, [isOpen]);
|
|
246
|
+
if (!isOpen) return null;
|
|
247
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
248
|
+
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
249
|
+
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
250
|
+
const modalClasses = cn(
|
|
251
|
+
baseClasses,
|
|
252
|
+
sizeClasses,
|
|
253
|
+
dialogResetClasses,
|
|
254
|
+
className
|
|
255
|
+
);
|
|
256
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
257
|
+
const handleActionClick = () => {
|
|
258
|
+
if (actionLink) {
|
|
259
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
if (variant === "activity") {
|
|
263
|
+
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)(
|
|
264
|
+
"dialog",
|
|
265
|
+
{
|
|
266
|
+
className: modalClasses,
|
|
267
|
+
"aria-labelledby": titleId,
|
|
268
|
+
"aria-modal": "true",
|
|
269
|
+
open: true,
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
272
|
+
"button",
|
|
273
|
+
{
|
|
274
|
+
onClick: onClose,
|
|
275
|
+
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",
|
|
276
|
+
"aria-label": "Fechar modal",
|
|
277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.X, { size: 18 })
|
|
278
|
+
}
|
|
279
|
+
) }),
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
281
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
282
|
+
"img",
|
|
283
|
+
{
|
|
284
|
+
src: image,
|
|
285
|
+
alt: imageAlt ?? "",
|
|
286
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
287
|
+
}
|
|
288
|
+
) }),
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
290
|
+
"h2",
|
|
291
|
+
{
|
|
292
|
+
id: titleId,
|
|
293
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
294
|
+
children: title
|
|
295
|
+
}
|
|
296
|
+
),
|
|
297
|
+
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 }),
|
|
298
|
+
actionLink && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "w-full", children: [
|
|
299
|
+
(() => {
|
|
300
|
+
const normalized = normalizeUrl(actionLink);
|
|
301
|
+
const isYT = isYouTubeUrl(normalized);
|
|
302
|
+
if (!isYT) return null;
|
|
303
|
+
const id = getYouTubeVideoId(normalized);
|
|
304
|
+
if (!id) {
|
|
305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
306
|
+
Button_default,
|
|
307
|
+
{
|
|
308
|
+
variant: "solid",
|
|
309
|
+
action: "primary",
|
|
310
|
+
size: "large",
|
|
311
|
+
className: "w-full",
|
|
312
|
+
onClick: handleActionClick,
|
|
313
|
+
children: actionLabel || "Iniciar Atividade"
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
318
|
+
"iframe",
|
|
319
|
+
{
|
|
320
|
+
src: getYouTubeEmbedUrl(id),
|
|
321
|
+
className: "w-full aspect-video rounded-lg",
|
|
322
|
+
allowFullScreen: true,
|
|
323
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
324
|
+
title: "V\xEDdeo YouTube"
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
})(),
|
|
328
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
329
|
+
Button_default,
|
|
330
|
+
{
|
|
331
|
+
variant: "solid",
|
|
332
|
+
action: "primary",
|
|
333
|
+
size: "large",
|
|
334
|
+
className: "w-full",
|
|
335
|
+
onClick: handleActionClick,
|
|
336
|
+
children: actionLabel || "Iniciar Atividade"
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
] })
|
|
340
|
+
] })
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
) });
|
|
344
|
+
}
|
|
345
|
+
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)(
|
|
346
|
+
"dialog",
|
|
347
|
+
{
|
|
348
|
+
className: modalClasses,
|
|
349
|
+
"aria-labelledby": titleId,
|
|
350
|
+
"aria-modal": "true",
|
|
351
|
+
open: true,
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
355
|
+
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
356
|
+
"button",
|
|
357
|
+
{
|
|
358
|
+
onClick: onClose,
|
|
359
|
+
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",
|
|
360
|
+
"aria-label": "Fechar modal",
|
|
361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.X, { size: 18 })
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
] }),
|
|
365
|
+
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 }) }),
|
|
366
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
) });
|
|
370
|
+
};
|
|
371
|
+
var Modal_default = Modal;
|
|
372
|
+
|
|
373
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
374
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
375
|
+
var import_react4 = require("react");
|
|
376
|
+
|
|
377
|
+
// src/components/SelectionButton/SelectionButton.tsx
|
|
378
|
+
var import_react2 = require("react");
|
|
379
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
380
|
+
var SelectionButton = (0, import_react2.forwardRef)(
|
|
381
|
+
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
382
|
+
const baseClasses = [
|
|
383
|
+
"inline-flex",
|
|
384
|
+
"items-center",
|
|
385
|
+
"justify-start",
|
|
386
|
+
"gap-2",
|
|
387
|
+
"p-4",
|
|
388
|
+
"rounded-xl",
|
|
389
|
+
"cursor-pointer",
|
|
390
|
+
"border",
|
|
391
|
+
"border-border-50",
|
|
392
|
+
"bg-background",
|
|
393
|
+
"text-sm",
|
|
394
|
+
"text-text-700",
|
|
395
|
+
"font-bold",
|
|
396
|
+
"shadow-soft-shadow-1",
|
|
397
|
+
"hover:bg-background-100",
|
|
398
|
+
"focus-visible:outline-none",
|
|
399
|
+
"focus-visible:ring-2",
|
|
400
|
+
"focus-visible:ring-indicator-info",
|
|
401
|
+
"focus-visible:ring-offset-0",
|
|
402
|
+
"focus-visible:shadow-none",
|
|
403
|
+
"active:ring-2",
|
|
404
|
+
"active:ring-primary-950",
|
|
405
|
+
"active:ring-offset-0",
|
|
406
|
+
"active:shadow-none",
|
|
407
|
+
"disabled:opacity-50",
|
|
408
|
+
"disabled:cursor-not-allowed"
|
|
409
|
+
];
|
|
410
|
+
const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
|
|
411
|
+
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
413
|
+
"button",
|
|
414
|
+
{
|
|
415
|
+
ref,
|
|
416
|
+
type: "button",
|
|
417
|
+
className: cn(allClasses, className),
|
|
418
|
+
disabled,
|
|
419
|
+
"aria-pressed": selected,
|
|
420
|
+
...props,
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
SelectionButton.displayName = "SelectionButton";
|
|
430
|
+
var SelectionButton_default = SelectionButton;
|
|
431
|
+
|
|
432
|
+
// src/hooks/useTheme.ts
|
|
433
|
+
var import_react3 = require("react");
|
|
434
|
+
var useTheme = () => {
|
|
435
|
+
const [themeMode, setThemeMode] = (0, import_react3.useState)("system");
|
|
436
|
+
const [isDark, setIsDark] = (0, import_react3.useState)(false);
|
|
437
|
+
const themeModeRef = (0, import_react3.useRef)("system");
|
|
438
|
+
const applyTheme = (0, import_react3.useCallback)((mode) => {
|
|
439
|
+
const htmlElement = document.documentElement;
|
|
440
|
+
const originalTheme = htmlElement.getAttribute("data-original-theme");
|
|
441
|
+
if (mode === "dark") {
|
|
442
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
443
|
+
setIsDark(true);
|
|
444
|
+
} else if (mode === "light") {
|
|
445
|
+
if (originalTheme) {
|
|
446
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
447
|
+
}
|
|
448
|
+
setIsDark(false);
|
|
449
|
+
} else if (mode === "system") {
|
|
450
|
+
const isSystemDark = window.matchMedia(
|
|
451
|
+
"(prefers-color-scheme: dark)"
|
|
452
|
+
).matches;
|
|
453
|
+
if (isSystemDark) {
|
|
454
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
455
|
+
setIsDark(true);
|
|
456
|
+
} else if (originalTheme) {
|
|
457
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
458
|
+
setIsDark(false);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}, []);
|
|
462
|
+
const toggleTheme = (0, import_react3.useCallback)(() => {
|
|
463
|
+
let newMode;
|
|
464
|
+
if (themeMode === "light") {
|
|
465
|
+
newMode = "dark";
|
|
466
|
+
} else if (themeMode === "dark") {
|
|
467
|
+
newMode = "light";
|
|
468
|
+
} else {
|
|
469
|
+
newMode = "dark";
|
|
470
|
+
}
|
|
471
|
+
setThemeMode(newMode);
|
|
472
|
+
themeModeRef.current = newMode;
|
|
473
|
+
applyTheme(newMode);
|
|
474
|
+
localStorage.setItem("theme-mode", newMode);
|
|
475
|
+
}, [themeMode, applyTheme]);
|
|
476
|
+
const setTheme = (0, import_react3.useCallback)(
|
|
477
|
+
(mode) => {
|
|
478
|
+
setThemeMode(mode);
|
|
479
|
+
themeModeRef.current = mode;
|
|
480
|
+
applyTheme(mode);
|
|
481
|
+
localStorage.setItem("theme-mode", mode);
|
|
482
|
+
},
|
|
483
|
+
[applyTheme]
|
|
484
|
+
);
|
|
485
|
+
(0, import_react3.useEffect)(() => {
|
|
486
|
+
const htmlElement = document.documentElement;
|
|
487
|
+
const currentTheme = htmlElement.getAttribute("data-theme");
|
|
488
|
+
if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
|
|
489
|
+
htmlElement.setAttribute("data-original-theme", currentTheme);
|
|
490
|
+
}
|
|
491
|
+
const savedThemeMode = localStorage.getItem("theme-mode");
|
|
492
|
+
const initialMode = savedThemeMode || "system";
|
|
493
|
+
if (!savedThemeMode) {
|
|
494
|
+
localStorage.setItem("theme-mode", "system");
|
|
495
|
+
}
|
|
496
|
+
setThemeMode(initialMode);
|
|
497
|
+
themeModeRef.current = initialMode;
|
|
498
|
+
applyTheme(initialMode);
|
|
499
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
500
|
+
const handleSystemThemeChange = () => {
|
|
501
|
+
if (themeModeRef.current === "system") {
|
|
502
|
+
applyTheme("system");
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
mediaQuery.addEventListener("change", handleSystemThemeChange);
|
|
506
|
+
return () => {
|
|
507
|
+
mediaQuery.removeEventListener("change", handleSystemThemeChange);
|
|
508
|
+
};
|
|
509
|
+
}, [applyTheme]);
|
|
510
|
+
return {
|
|
511
|
+
themeMode,
|
|
512
|
+
isDark,
|
|
513
|
+
toggleTheme,
|
|
514
|
+
setTheme
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
519
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
520
|
+
var ThemeToggle = ({
|
|
521
|
+
variant = "default",
|
|
522
|
+
onToggle
|
|
523
|
+
}) => {
|
|
524
|
+
const { themeMode, setTheme } = useTheme();
|
|
525
|
+
const [tempTheme, setTempTheme] = (0, import_react4.useState)(themeMode);
|
|
526
|
+
(0, import_react4.useEffect)(() => {
|
|
527
|
+
setTempTheme(themeMode);
|
|
528
|
+
}, [themeMode]);
|
|
529
|
+
const problemTypes = [
|
|
530
|
+
{
|
|
531
|
+
id: "light",
|
|
532
|
+
title: "Claro",
|
|
533
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Sun, { size: 24 })
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
id: "dark",
|
|
537
|
+
title: "Escuro",
|
|
538
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Moon, { size: 24 })
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
id: "system",
|
|
542
|
+
title: "Sistema",
|
|
543
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
544
|
+
"svg",
|
|
545
|
+
{
|
|
546
|
+
width: "25",
|
|
547
|
+
height: "25",
|
|
548
|
+
viewBox: "0 0 25 25",
|
|
549
|
+
fill: "none",
|
|
550
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
552
|
+
"path",
|
|
553
|
+
{
|
|
554
|
+
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",
|
|
555
|
+
fill: "#525252"
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
}
|
|
559
|
+
)
|
|
560
|
+
}
|
|
561
|
+
];
|
|
562
|
+
const handleThemeSelect = (selectedTheme) => {
|
|
563
|
+
if (variant === "with-save") {
|
|
564
|
+
setTempTheme(selectedTheme);
|
|
565
|
+
} else {
|
|
566
|
+
setTheme(selectedTheme);
|
|
567
|
+
}
|
|
568
|
+
if (onToggle) {
|
|
569
|
+
onToggle(selectedTheme);
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
const currentTheme = variant === "with-save" ? tempTheme : themeMode;
|
|
573
|
+
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)(
|
|
574
|
+
SelectionButton_default,
|
|
575
|
+
{
|
|
576
|
+
icon: type.icon,
|
|
577
|
+
label: type.title,
|
|
578
|
+
selected: currentTheme === type.id,
|
|
579
|
+
onClick: () => handleThemeSelect(type.id),
|
|
580
|
+
className: "w-full p-2 sm:p-4"
|
|
581
|
+
},
|
|
582
|
+
type.id
|
|
583
|
+
)) });
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
587
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
101
588
|
function createDropdownStore() {
|
|
102
589
|
return (0, import_zustand.create)((set) => ({
|
|
103
590
|
open: false,
|
|
@@ -113,8 +600,8 @@ var useDropdownStore = (externalStore) => {
|
|
|
113
600
|
return externalStore;
|
|
114
601
|
};
|
|
115
602
|
var injectStore = (children, store) => {
|
|
116
|
-
return
|
|
117
|
-
if ((0,
|
|
603
|
+
return import_react5.Children.map(children, (child) => {
|
|
604
|
+
if ((0, import_react5.isValidElement)(child)) {
|
|
118
605
|
const typedChild = child;
|
|
119
606
|
const newProps = {
|
|
120
607
|
store
|
|
@@ -122,7 +609,7 @@ var injectStore = (children, store) => {
|
|
|
122
609
|
if (typedChild.props.children) {
|
|
123
610
|
newProps.children = injectStore(typedChild.props.children, store);
|
|
124
611
|
}
|
|
125
|
-
return (0,
|
|
612
|
+
return (0, import_react5.cloneElement)(typedChild, newProps);
|
|
126
613
|
}
|
|
127
614
|
return child;
|
|
128
615
|
});
|
|
@@ -132,14 +619,14 @@ var DropdownMenu = ({
|
|
|
132
619
|
open: propOpen,
|
|
133
620
|
onOpenChange
|
|
134
621
|
}) => {
|
|
135
|
-
const storeRef = (0,
|
|
622
|
+
const storeRef = (0, import_react5.useRef)(null);
|
|
136
623
|
storeRef.current ??= createDropdownStore();
|
|
137
624
|
const store = storeRef.current;
|
|
138
625
|
const { open, setOpen: storeSetOpen } = (0, import_zustand.useStore)(store, (s) => s);
|
|
139
626
|
const setOpen = (newOpen) => {
|
|
140
627
|
storeSetOpen(newOpen);
|
|
141
628
|
};
|
|
142
|
-
const menuRef = (0,
|
|
629
|
+
const menuRef = (0, import_react5.useRef)(null);
|
|
143
630
|
const handleArrowDownOrArrowUp = (event) => {
|
|
144
631
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
145
632
|
if (menuContent) {
|
|
@@ -173,7 +660,7 @@ var DropdownMenu = ({
|
|
|
173
660
|
setOpen(false);
|
|
174
661
|
}
|
|
175
662
|
};
|
|
176
|
-
(0,
|
|
663
|
+
(0, import_react5.useEffect)(() => {
|
|
177
664
|
if (open) {
|
|
178
665
|
document.addEventListener("mousedown", handleClickOutside);
|
|
179
666
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -183,16 +670,16 @@ var DropdownMenu = ({
|
|
|
183
670
|
document.removeEventListener("keydown", handleDownkey);
|
|
184
671
|
};
|
|
185
672
|
}, [open]);
|
|
186
|
-
(0,
|
|
673
|
+
(0, import_react5.useEffect)(() => {
|
|
187
674
|
setOpen(open);
|
|
188
675
|
onOpenChange?.(open);
|
|
189
676
|
}, [open, onOpenChange]);
|
|
190
|
-
(0,
|
|
677
|
+
(0, import_react5.useEffect)(() => {
|
|
191
678
|
if (propOpen) {
|
|
192
679
|
setOpen(propOpen);
|
|
193
680
|
}
|
|
194
681
|
}, [propOpen]);
|
|
195
|
-
return /* @__PURE__ */ (0,
|
|
682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
196
683
|
};
|
|
197
684
|
var DropdownMenuTrigger = ({
|
|
198
685
|
className,
|
|
@@ -204,7 +691,7 @@ var DropdownMenuTrigger = ({
|
|
|
204
691
|
const store = useDropdownStore(externalStore);
|
|
205
692
|
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
206
693
|
const toggleOpen = () => store.setState({ open: !open });
|
|
207
|
-
return /* @__PURE__ */ (0,
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
208
695
|
"button",
|
|
209
696
|
{
|
|
210
697
|
onClick: (e) => {
|
|
@@ -239,8 +726,8 @@ var MENUCONTENT_VARIANT_CLASSES = {
|
|
|
239
726
|
menu: "p-1",
|
|
240
727
|
profile: "p-6"
|
|
241
728
|
};
|
|
242
|
-
var MenuLabel = (0,
|
|
243
|
-
return /* @__PURE__ */ (0,
|
|
729
|
+
var MenuLabel = (0, import_react5.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
244
731
|
"div",
|
|
245
732
|
{
|
|
246
733
|
ref,
|
|
@@ -250,7 +737,7 @@ var MenuLabel = (0, import_react.forwardRef)(({ className, inset, store: _store,
|
|
|
250
737
|
);
|
|
251
738
|
});
|
|
252
739
|
MenuLabel.displayName = "MenuLabel";
|
|
253
|
-
var DropdownMenuContent = (0,
|
|
740
|
+
var DropdownMenuContent = (0, import_react5.forwardRef)(
|
|
254
741
|
({
|
|
255
742
|
className,
|
|
256
743
|
align = "start",
|
|
@@ -263,8 +750,8 @@ var DropdownMenuContent = (0, import_react.forwardRef)(
|
|
|
263
750
|
}, ref) => {
|
|
264
751
|
const store = useDropdownStore(externalStore);
|
|
265
752
|
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
266
|
-
const [isVisible, setIsVisible] = (0,
|
|
267
|
-
(0,
|
|
753
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(open);
|
|
754
|
+
(0, import_react5.useEffect)(() => {
|
|
268
755
|
if (open) {
|
|
269
756
|
setIsVisible(true);
|
|
270
757
|
} else {
|
|
@@ -279,7 +766,7 @@ var DropdownMenuContent = (0, import_react.forwardRef)(
|
|
|
279
766
|
return `absolute ${vertical} ${horizontal}`;
|
|
280
767
|
};
|
|
281
768
|
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
282
|
-
return /* @__PURE__ */ (0,
|
|
769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
283
770
|
"div",
|
|
284
771
|
{
|
|
285
772
|
ref,
|
|
@@ -304,7 +791,7 @@ var DropdownMenuContent = (0, import_react.forwardRef)(
|
|
|
304
791
|
}
|
|
305
792
|
);
|
|
306
793
|
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
307
|
-
var DropdownMenuItem = (0,
|
|
794
|
+
var DropdownMenuItem = (0, import_react5.forwardRef)(
|
|
308
795
|
({
|
|
309
796
|
className,
|
|
310
797
|
size = "small",
|
|
@@ -338,7 +825,7 @@ var DropdownMenuItem = (0, import_react.forwardRef)(
|
|
|
338
825
|
const getVariantProps = () => {
|
|
339
826
|
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
340
827
|
};
|
|
341
|
-
return /* @__PURE__ */ (0,
|
|
828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
342
829
|
"div",
|
|
343
830
|
{
|
|
344
831
|
ref,
|
|
@@ -360,7 +847,7 @@ var DropdownMenuItem = (0, import_react.forwardRef)(
|
|
|
360
847
|
...props,
|
|
361
848
|
children: [
|
|
362
849
|
iconLeft,
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-full", children }),
|
|
364
851
|
iconRight
|
|
365
852
|
]
|
|
366
853
|
}
|
|
@@ -368,7 +855,7 @@ var DropdownMenuItem = (0, import_react.forwardRef)(
|
|
|
368
855
|
}
|
|
369
856
|
);
|
|
370
857
|
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
371
|
-
var DropdownMenuSeparator = (0,
|
|
858
|
+
var DropdownMenuSeparator = (0, import_react5.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
372
859
|
"div",
|
|
373
860
|
{
|
|
374
861
|
ref,
|
|
@@ -377,11 +864,11 @@ var DropdownMenuSeparator = (0, import_react.forwardRef)(({ className, store: _s
|
|
|
377
864
|
}
|
|
378
865
|
));
|
|
379
866
|
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
380
|
-
var ProfileMenuTrigger = (0,
|
|
867
|
+
var ProfileMenuTrigger = (0, import_react5.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
381
868
|
const store = useDropdownStore(externalStore);
|
|
382
869
|
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
383
870
|
const toggleOpen = () => store.setState({ open: !open });
|
|
384
|
-
return /* @__PURE__ */ (0,
|
|
871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
385
872
|
"button",
|
|
386
873
|
{
|
|
387
874
|
ref,
|
|
@@ -396,13 +883,13 @@ var ProfileMenuTrigger = (0, import_react.forwardRef)(({ className, onClick, sto
|
|
|
396
883
|
},
|
|
397
884
|
"aria-expanded": open,
|
|
398
885
|
...props,
|
|
399
|
-
children: /* @__PURE__ */ (0,
|
|
886
|
+
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 }) })
|
|
400
887
|
}
|
|
401
888
|
);
|
|
402
889
|
});
|
|
403
890
|
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
404
|
-
var ProfileMenuHeader = (0,
|
|
405
|
-
return /* @__PURE__ */ (0,
|
|
891
|
+
var ProfileMenuHeader = (0, import_react5.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
|
|
892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
406
893
|
"div",
|
|
407
894
|
{
|
|
408
895
|
ref,
|
|
@@ -410,18 +897,98 @@ var ProfileMenuHeader = (0, import_react.forwardRef)(({ className, name, email,
|
|
|
410
897
|
className: cn("flex flex-row gap-4 items-center", className),
|
|
411
898
|
...props,
|
|
412
899
|
children: [
|
|
413
|
-
/* @__PURE__ */ (0,
|
|
414
|
-
/* @__PURE__ */ (0,
|
|
415
|
-
/* @__PURE__ */ (0,
|
|
416
|
-
/* @__PURE__ */ (0,
|
|
900
|
+
/* @__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" }) }),
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col ", children: [
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "xl", weight: "bold", color: "text-text-950", children: name }),
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "md", color: "text-text-600", children: email })
|
|
417
904
|
] })
|
|
418
905
|
]
|
|
419
906
|
}
|
|
420
907
|
);
|
|
421
908
|
});
|
|
422
909
|
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
423
|
-
var
|
|
424
|
-
|
|
910
|
+
var ProfileToggleTheme = ({ ...props }) => {
|
|
911
|
+
const { themeMode, setTheme } = useTheme();
|
|
912
|
+
const [modalThemeToggle, setModalThemeToggle] = (0, import_react5.useState)(false);
|
|
913
|
+
const [selectedTheme, setSelectedTheme] = (0, import_react5.useState)(themeMode);
|
|
914
|
+
const handleClick = (e) => {
|
|
915
|
+
e.preventDefault();
|
|
916
|
+
e.stopPropagation();
|
|
917
|
+
setModalThemeToggle(true);
|
|
918
|
+
};
|
|
919
|
+
const handleSave = () => {
|
|
920
|
+
setTheme(selectedTheme);
|
|
921
|
+
setModalThemeToggle(false);
|
|
922
|
+
};
|
|
923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
925
|
+
"div",
|
|
926
|
+
{
|
|
927
|
+
role: "menuitem",
|
|
928
|
+
"data-variant": "profile",
|
|
929
|
+
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",
|
|
930
|
+
onClick: handleClick,
|
|
931
|
+
onKeyDown: (e) => {
|
|
932
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
933
|
+
e.preventDefault();
|
|
934
|
+
e.stopPropagation();
|
|
935
|
+
setModalThemeToggle(true);
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
tabIndex: 0,
|
|
939
|
+
...props,
|
|
940
|
+
children: [
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
942
|
+
"svg",
|
|
943
|
+
{
|
|
944
|
+
width: "25",
|
|
945
|
+
height: "25",
|
|
946
|
+
viewBox: "0 0 25 25",
|
|
947
|
+
fill: "none",
|
|
948
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
950
|
+
"path",
|
|
951
|
+
{
|
|
952
|
+
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",
|
|
953
|
+
fill: "#525252"
|
|
954
|
+
}
|
|
955
|
+
)
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { className: "w-full", size: "md", children: "Apar\xEAncia" }),
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.CaretRight, {})
|
|
960
|
+
]
|
|
961
|
+
}
|
|
962
|
+
),
|
|
963
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
964
|
+
Modal_default,
|
|
965
|
+
{
|
|
966
|
+
isOpen: modalThemeToggle,
|
|
967
|
+
onClose: () => setModalThemeToggle(false),
|
|
968
|
+
title: "Apar\xEAncia",
|
|
969
|
+
size: "md",
|
|
970
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-3", children: [
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
972
|
+
Button_default,
|
|
973
|
+
{
|
|
974
|
+
variant: "outline",
|
|
975
|
+
onClick: () => setModalThemeToggle(false),
|
|
976
|
+
children: "Cancelar"
|
|
977
|
+
}
|
|
978
|
+
),
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button_default, { variant: "solid", onClick: () => handleSave(), children: "Salvar" })
|
|
980
|
+
] }),
|
|
981
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
|
|
984
|
+
] })
|
|
985
|
+
}
|
|
986
|
+
)
|
|
987
|
+
] });
|
|
988
|
+
};
|
|
989
|
+
ProfileToggleTheme.displayName = "ProfileToggleTheme";
|
|
990
|
+
var ProfileMenuSection = (0, import_react5.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
|
|
425
992
|
});
|
|
426
993
|
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
427
994
|
var ProfileMenuFooter = ({
|
|
@@ -433,7 +1000,7 @@ var ProfileMenuFooter = ({
|
|
|
433
1000
|
}) => {
|
|
434
1001
|
const store = useDropdownStore(externalStore);
|
|
435
1002
|
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
436
|
-
return /* @__PURE__ */ (0,
|
|
1003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
437
1004
|
Button_default,
|
|
438
1005
|
{
|
|
439
1006
|
variant: "outline",
|
|
@@ -445,8 +1012,8 @@ var ProfileMenuFooter = ({
|
|
|
445
1012
|
},
|
|
446
1013
|
...props,
|
|
447
1014
|
children: [
|
|
448
|
-
/* @__PURE__ */ (0,
|
|
449
|
-
/* @__PURE__ */ (0,
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.SignOut, {}) }),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { children: "Sair" })
|
|
450
1017
|
]
|
|
451
1018
|
}
|
|
452
1019
|
);
|
|
@@ -455,7 +1022,7 @@ ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
|
455
1022
|
var DropdownMenu_default = DropdownMenu;
|
|
456
1023
|
|
|
457
1024
|
// src/components/Search/Search.tsx
|
|
458
|
-
var
|
|
1025
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
459
1026
|
var filterOptions = (options, query) => {
|
|
460
1027
|
if (!query || query.length < 1) return [];
|
|
461
1028
|
return options.filter(
|
|
@@ -480,7 +1047,7 @@ var updateInputValue = (value, ref, onChange) => {
|
|
|
480
1047
|
onChange(event);
|
|
481
1048
|
}
|
|
482
1049
|
};
|
|
483
|
-
var Search = (0,
|
|
1050
|
+
var Search = (0, import_react6.forwardRef)(
|
|
484
1051
|
({
|
|
485
1052
|
options = [],
|
|
486
1053
|
onSelect,
|
|
@@ -500,10 +1067,10 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
500
1067
|
placeholder = "Buscar...",
|
|
501
1068
|
...props
|
|
502
1069
|
}, ref) => {
|
|
503
|
-
const [dropdownOpen, setDropdownOpen] = (0,
|
|
504
|
-
const dropdownStore = (0,
|
|
505
|
-
const dropdownRef = (0,
|
|
506
|
-
const filteredOptions = (0,
|
|
1070
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react6.useState)(false);
|
|
1071
|
+
const dropdownStore = (0, import_react6.useRef)(createDropdownStore()).current;
|
|
1072
|
+
const dropdownRef = (0, import_react6.useRef)(null);
|
|
1073
|
+
const filteredOptions = (0, import_react6.useMemo)(() => {
|
|
507
1074
|
if (!options.length) {
|
|
508
1075
|
return [];
|
|
509
1076
|
}
|
|
@@ -511,7 +1078,7 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
511
1078
|
return filtered;
|
|
512
1079
|
}, [options, value]);
|
|
513
1080
|
const showDropdown = controlledShowDropdown ?? (dropdownOpen && value && String(value).length > 0);
|
|
514
|
-
(0,
|
|
1081
|
+
(0, import_react6.useEffect)(() => {
|
|
515
1082
|
const shouldShow = Boolean(value && String(value).length > 0);
|
|
516
1083
|
setDropdownOpen(shouldShow);
|
|
517
1084
|
dropdownStore.setState({ open: shouldShow });
|
|
@@ -523,7 +1090,7 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
523
1090
|
dropdownStore.setState({ open: false });
|
|
524
1091
|
updateInputValue(option, ref, onChange);
|
|
525
1092
|
};
|
|
526
|
-
(0,
|
|
1093
|
+
(0, import_react6.useEffect)(() => {
|
|
527
1094
|
const handleClickOutside = (event) => {
|
|
528
1095
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
529
1096
|
setDropdownOpen(false);
|
|
@@ -537,7 +1104,7 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
537
1104
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
538
1105
|
};
|
|
539
1106
|
}, [showDropdown, dropdownStore]);
|
|
540
|
-
const generatedId = (0,
|
|
1107
|
+
const generatedId = (0, import_react6.useId)();
|
|
541
1108
|
const inputId = id ?? `search-${generatedId}`;
|
|
542
1109
|
const handleClear = () => {
|
|
543
1110
|
if (onClear) {
|
|
@@ -566,24 +1133,24 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
566
1133
|
return "hover:border-border-400";
|
|
567
1134
|
};
|
|
568
1135
|
const showClearButton = value && !disabled && !readOnly;
|
|
569
|
-
return /* @__PURE__ */ (0,
|
|
1136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
570
1137
|
"div",
|
|
571
1138
|
{
|
|
572
1139
|
ref: dropdownRef,
|
|
573
1140
|
className: `w-full max-w-lg md:w-[488px] ${containerClassName}`,
|
|
574
1141
|
children: [
|
|
575
|
-
/* @__PURE__ */ (0,
|
|
576
|
-
/* @__PURE__ */ (0,
|
|
1142
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative flex items-center", children: [
|
|
1143
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
577
1144
|
"button",
|
|
578
1145
|
{
|
|
579
1146
|
type: "button",
|
|
580
1147
|
className: "w-6 h-6 text-text-800 flex items-center justify-center bg-transparent border-0 p-0 cursor-pointer hover:text-text-600 transition-colors",
|
|
581
1148
|
onClick: handleLeftIconClick,
|
|
582
1149
|
"aria-label": "Voltar",
|
|
583
|
-
children: /* @__PURE__ */ (0,
|
|
1150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react4.CaretLeft, {})
|
|
584
1151
|
}
|
|
585
1152
|
) }),
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
587
1154
|
"input",
|
|
588
1155
|
{
|
|
589
1156
|
ref,
|
|
@@ -601,24 +1168,24 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
601
1168
|
...props
|
|
602
1169
|
}
|
|
603
1170
|
),
|
|
604
|
-
showClearButton && /* @__PURE__ */ (0,
|
|
1171
|
+
showClearButton && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
605
1172
|
"button",
|
|
606
1173
|
{
|
|
607
1174
|
type: "button",
|
|
608
1175
|
className: "p-0 border-0 bg-transparent cursor-pointer",
|
|
609
1176
|
onMouseDown: handleClearClick,
|
|
610
1177
|
"aria-label": "Limpar busca",
|
|
611
|
-
children: /* @__PURE__ */ (0,
|
|
1178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "w-6 h-6 text-text-800 flex items-center justify-center hover:text-text-600 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react4.X, {}) })
|
|
612
1179
|
}
|
|
613
1180
|
) })
|
|
614
1181
|
] }),
|
|
615
|
-
showDropdown && /* @__PURE__ */ (0,
|
|
1182
|
+
showDropdown && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu_default, { open: showDropdown, onOpenChange: setDropdownOpen, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
616
1183
|
DropdownMenuContent,
|
|
617
1184
|
{
|
|
618
1185
|
className: "w-full mt-1",
|
|
619
1186
|
style: { maxHeight: dropdownMaxHeight },
|
|
620
1187
|
align: "start",
|
|
621
|
-
children: filteredOptions.length > 0 ? filteredOptions.map((option) => /* @__PURE__ */ (0,
|
|
1188
|
+
children: filteredOptions.length > 0 ? filteredOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
622
1189
|
DropdownMenuItem,
|
|
623
1190
|
{
|
|
624
1191
|
onClick: () => handleSelectOption(option),
|
|
@@ -626,7 +1193,7 @@ var Search = (0, import_react2.forwardRef)(
|
|
|
626
1193
|
children: option
|
|
627
1194
|
},
|
|
628
1195
|
option
|
|
629
|
-
)) : /* @__PURE__ */ (0,
|
|
1196
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "px-3 py-3 text-text-700 text-base", children: noResultsText })
|
|
630
1197
|
}
|
|
631
1198
|
) })
|
|
632
1199
|
]
|