analytica-frontend-lib 1.1.54 → 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/NotificationCard/index.js +1107 -814
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs +1051 -758
- package/dist/NotificationCard/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 +0 -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 -952
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1068 -1026
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -39
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
|
@@ -24,8 +24,8 @@ __export(NotificationCard_exports, {
|
|
|
24
24
|
default: () => NotificationCard_default
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(NotificationCard_exports);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
27
|
+
var import_phosphor_react5 = require("phosphor-react");
|
|
28
|
+
var import_react9 = require("react");
|
|
29
29
|
|
|
30
30
|
// src/utils/utils.ts
|
|
31
31
|
var import_clsx = require("clsx");
|
|
@@ -35,8 +35,8 @@ function cn(...inputs) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var import_phosphor_react3 = require("phosphor-react");
|
|
39
|
+
var import_react5 = require("react");
|
|
40
40
|
var import_zustand = require("zustand");
|
|
41
41
|
|
|
42
42
|
// src/components/Button/Button.tsx
|
|
@@ -97,846 +97,1139 @@ var Button = ({
|
|
|
97
97
|
};
|
|
98
98
|
var Button_default = Button;
|
|
99
99
|
|
|
100
|
-
// src/components/
|
|
100
|
+
// src/components/Text/Text.tsx
|
|
101
101
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
102
|
-
|
|
103
|
-
return (0, import_zustand.create)((set) => ({
|
|
104
|
-
open: false,
|
|
105
|
-
setOpen: (open) => set({ open })
|
|
106
|
-
}));
|
|
107
|
-
}
|
|
108
|
-
var useDropdownStore = (externalStore) => {
|
|
109
|
-
if (!externalStore) {
|
|
110
|
-
throw new Error(
|
|
111
|
-
"Component must be used within a DropdownMenu (store is missing)"
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
return externalStore;
|
|
115
|
-
};
|
|
116
|
-
var injectStore = (children, store) => {
|
|
117
|
-
return import_react.Children.map(children, (child) => {
|
|
118
|
-
if ((0, import_react.isValidElement)(child)) {
|
|
119
|
-
const typedChild = child;
|
|
120
|
-
const newProps = {
|
|
121
|
-
store
|
|
122
|
-
};
|
|
123
|
-
if (typedChild.props.children) {
|
|
124
|
-
newProps.children = injectStore(typedChild.props.children, store);
|
|
125
|
-
}
|
|
126
|
-
return (0, import_react.cloneElement)(typedChild, newProps);
|
|
127
|
-
}
|
|
128
|
-
return child;
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
var DropdownMenu = ({
|
|
102
|
+
var Text = ({
|
|
132
103
|
children,
|
|
133
|
-
|
|
134
|
-
|
|
104
|
+
size = "md",
|
|
105
|
+
weight = "normal",
|
|
106
|
+
color = "text-text-950",
|
|
107
|
+
as,
|
|
108
|
+
className = "",
|
|
109
|
+
...props
|
|
135
110
|
}) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
151
|
-
)
|
|
152
|
-
).filter((el) => el instanceof HTMLElement);
|
|
153
|
-
if (items.length === 0) return;
|
|
154
|
-
const focusedItem = document.activeElement;
|
|
155
|
-
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
156
|
-
let nextIndex;
|
|
157
|
-
if (event.key === "ArrowDown") {
|
|
158
|
-
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
159
|
-
} else {
|
|
160
|
-
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
161
|
-
}
|
|
162
|
-
items[nextIndex]?.focus();
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const handleDownkey = (event) => {
|
|
166
|
-
if (event.key === "Escape") {
|
|
167
|
-
setOpen(false);
|
|
168
|
-
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
169
|
-
handleArrowDownOrArrowUp(event);
|
|
170
|
-
}
|
|
111
|
+
let sizeClasses = "";
|
|
112
|
+
let weightClasses = "";
|
|
113
|
+
const sizeClassMap = {
|
|
114
|
+
"2xs": "text-2xs",
|
|
115
|
+
xs: "text-xs",
|
|
116
|
+
sm: "text-sm",
|
|
117
|
+
md: "text-md",
|
|
118
|
+
lg: "text-lg",
|
|
119
|
+
xl: "text-xl",
|
|
120
|
+
"2xl": "text-2xl",
|
|
121
|
+
"3xl": "text-3xl",
|
|
122
|
+
"4xl": "text-4xl",
|
|
123
|
+
"5xl": "text-5xl",
|
|
124
|
+
"6xl": "text-6xl"
|
|
171
125
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
126
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
127
|
+
const weightClassMap = {
|
|
128
|
+
hairline: "font-hairline",
|
|
129
|
+
light: "font-light",
|
|
130
|
+
normal: "font-normal",
|
|
131
|
+
medium: "font-medium",
|
|
132
|
+
semibold: "font-semibold",
|
|
133
|
+
bold: "font-bold",
|
|
134
|
+
extrabold: "font-extrabold",
|
|
135
|
+
black: "font-black"
|
|
176
136
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
document.addEventListener("keydown", handleDownkey);
|
|
181
|
-
}
|
|
182
|
-
return () => {
|
|
183
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
184
|
-
document.removeEventListener("keydown", handleDownkey);
|
|
185
|
-
};
|
|
186
|
-
}, [open]);
|
|
187
|
-
(0, import_react.useEffect)(() => {
|
|
188
|
-
setOpen(open);
|
|
189
|
-
onOpenChange?.(open);
|
|
190
|
-
}, [open, onOpenChange]);
|
|
191
|
-
(0, import_react.useEffect)(() => {
|
|
192
|
-
if (propOpen) {
|
|
193
|
-
setOpen(propOpen);
|
|
194
|
-
}
|
|
195
|
-
}, [propOpen]);
|
|
196
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
197
|
-
};
|
|
198
|
-
var DropdownMenuTrigger = ({
|
|
199
|
-
className,
|
|
200
|
-
children,
|
|
201
|
-
onClick,
|
|
202
|
-
store: externalStore,
|
|
203
|
-
...props
|
|
204
|
-
}) => {
|
|
205
|
-
const store = useDropdownStore(externalStore);
|
|
206
|
-
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
207
|
-
const toggleOpen = () => store.setState({ open: !open });
|
|
137
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
138
|
+
const baseClasses = "font-primary";
|
|
139
|
+
const Component = as ?? "p";
|
|
208
140
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
209
|
-
|
|
141
|
+
Component,
|
|
210
142
|
{
|
|
211
|
-
|
|
212
|
-
e.stopPropagation();
|
|
213
|
-
toggleOpen();
|
|
214
|
-
if (onClick) onClick(e);
|
|
215
|
-
},
|
|
216
|
-
"aria-expanded": open,
|
|
217
|
-
className: cn(className),
|
|
143
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
218
144
|
...props,
|
|
219
145
|
children
|
|
220
146
|
}
|
|
221
147
|
);
|
|
222
148
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
149
|
+
var Text_default = Text;
|
|
150
|
+
|
|
151
|
+
// src/components/Modal/Modal.tsx
|
|
152
|
+
var import_react = require("react");
|
|
153
|
+
var import_phosphor_react = require("phosphor-react");
|
|
154
|
+
|
|
155
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
156
|
+
var isYouTubeUrl = (url) => {
|
|
157
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
158
|
+
return youtubeRegex.test(url);
|
|
227
159
|
};
|
|
228
|
-
var
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
160
|
+
var isValidYouTubeHost = (host) => {
|
|
161
|
+
if (host === "youtu.be") return "youtu.be";
|
|
162
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
163
|
+
if (isValidYouTubeCom) return "youtube";
|
|
164
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
165
|
+
if (isValidNoCookie) return "nocookie";
|
|
166
|
+
return null;
|
|
233
167
|
};
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
end: "right-0"
|
|
168
|
+
var extractYoutuBeId = (pathname) => {
|
|
169
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
170
|
+
return firstSeg || null;
|
|
238
171
|
};
|
|
239
|
-
var
|
|
240
|
-
|
|
241
|
-
|
|
172
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
173
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
174
|
+
const [first, second] = parts;
|
|
175
|
+
if (first === "embed" && second) return second;
|
|
176
|
+
if (first === "shorts" && second) return second;
|
|
177
|
+
if (first === "live" && second) return second;
|
|
178
|
+
const v = searchParams.get("v");
|
|
179
|
+
if (v) return v;
|
|
180
|
+
return null;
|
|
242
181
|
};
|
|
243
|
-
var
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
182
|
+
var getYouTubeVideoId = (url) => {
|
|
183
|
+
try {
|
|
184
|
+
const u = new URL(url);
|
|
185
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
186
|
+
if (!hostType) return null;
|
|
187
|
+
if (hostType === "youtu.be") {
|
|
188
|
+
return extractYoutuBeId(u.pathname);
|
|
250
189
|
}
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
var DropdownMenuContent = (0, import_react.forwardRef)(
|
|
255
|
-
({
|
|
256
|
-
className,
|
|
257
|
-
align = "start",
|
|
258
|
-
side = "bottom",
|
|
259
|
-
variant = "menu",
|
|
260
|
-
sideOffset = 4,
|
|
261
|
-
children,
|
|
262
|
-
store: externalStore,
|
|
263
|
-
...props
|
|
264
|
-
}, ref) => {
|
|
265
|
-
const store = useDropdownStore(externalStore);
|
|
266
|
-
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
267
|
-
const [isVisible, setIsVisible] = (0, import_react.useState)(open);
|
|
268
|
-
(0, import_react.useEffect)(() => {
|
|
269
|
-
if (open) {
|
|
270
|
-
setIsVisible(true);
|
|
271
|
-
} else {
|
|
272
|
-
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
273
|
-
return () => clearTimeout(timer);
|
|
274
|
-
}
|
|
275
|
-
}, [open]);
|
|
276
|
-
if (!isVisible) return null;
|
|
277
|
-
const getPositionClasses = () => {
|
|
278
|
-
const vertical = SIDE_CLASSES[side];
|
|
279
|
-
const horizontal = ALIGN_CLASSES[align];
|
|
280
|
-
return `absolute ${vertical} ${horizontal}`;
|
|
281
|
-
};
|
|
282
|
-
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
283
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
284
|
-
"div",
|
|
285
|
-
{
|
|
286
|
-
ref,
|
|
287
|
-
role: "menu",
|
|
288
|
-
className: `
|
|
289
|
-
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
|
|
290
|
-
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
291
|
-
${getPositionClasses()}
|
|
292
|
-
${variantClasses}
|
|
293
|
-
${className}
|
|
294
|
-
`,
|
|
295
|
-
style: {
|
|
296
|
-
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
297
|
-
marginBottom: side === "top" ? sideOffset : void 0,
|
|
298
|
-
marginLeft: side === "right" ? sideOffset : void 0,
|
|
299
|
-
marginRight: side === "left" ? sideOffset : void 0
|
|
300
|
-
},
|
|
301
|
-
...props,
|
|
302
|
-
children
|
|
303
|
-
}
|
|
304
|
-
);
|
|
190
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
191
|
+
} catch {
|
|
192
|
+
return null;
|
|
305
193
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
194
|
+
};
|
|
195
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
196
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// src/components/Modal/Modal.tsx
|
|
200
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
201
|
+
var SIZE_CLASSES2 = {
|
|
202
|
+
xs: "max-w-[360px]",
|
|
203
|
+
sm: "max-w-[420px]",
|
|
204
|
+
md: "max-w-[510px]",
|
|
205
|
+
lg: "max-w-[640px]",
|
|
206
|
+
xl: "max-w-[970px]"
|
|
207
|
+
};
|
|
208
|
+
var Modal = ({
|
|
209
|
+
isOpen,
|
|
210
|
+
onClose,
|
|
211
|
+
title,
|
|
212
|
+
children,
|
|
213
|
+
size = "md",
|
|
214
|
+
className = "",
|
|
215
|
+
closeOnEscape = true,
|
|
216
|
+
footer,
|
|
217
|
+
hideCloseButton = false,
|
|
218
|
+
variant = "default",
|
|
219
|
+
description,
|
|
220
|
+
image,
|
|
221
|
+
imageAlt,
|
|
222
|
+
actionLink,
|
|
223
|
+
actionLabel
|
|
224
|
+
}) => {
|
|
225
|
+
const titleId = (0, import_react.useId)();
|
|
226
|
+
(0, import_react.useEffect)(() => {
|
|
227
|
+
if (!isOpen || !closeOnEscape) return;
|
|
228
|
+
const handleEscape = (event) => {
|
|
229
|
+
if (event.key === "Escape") {
|
|
230
|
+
onClose();
|
|
336
231
|
}
|
|
337
|
-
return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
|
|
338
232
|
};
|
|
339
|
-
|
|
340
|
-
|
|
233
|
+
document.addEventListener("keydown", handleEscape);
|
|
234
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
235
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
236
|
+
(0, import_react.useEffect)(() => {
|
|
237
|
+
const originalOverflow = document.body.style.overflow;
|
|
238
|
+
if (isOpen) {
|
|
239
|
+
document.body.style.overflow = "hidden";
|
|
240
|
+
} else {
|
|
241
|
+
document.body.style.overflow = originalOverflow;
|
|
242
|
+
}
|
|
243
|
+
return () => {
|
|
244
|
+
document.body.style.overflow = originalOverflow;
|
|
341
245
|
};
|
|
342
|
-
|
|
343
|
-
|
|
246
|
+
}, [isOpen]);
|
|
247
|
+
if (!isOpen) return null;
|
|
248
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
249
|
+
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
250
|
+
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
251
|
+
const modalClasses = cn(
|
|
252
|
+
baseClasses,
|
|
253
|
+
sizeClasses,
|
|
254
|
+
dialogResetClasses,
|
|
255
|
+
className
|
|
256
|
+
);
|
|
257
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
258
|
+
const handleActionClick = () => {
|
|
259
|
+
if (actionLink) {
|
|
260
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
if (variant === "activity") {
|
|
264
|
+
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)(
|
|
265
|
+
"dialog",
|
|
266
|
+
{
|
|
267
|
+
className: modalClasses,
|
|
268
|
+
"aria-labelledby": titleId,
|
|
269
|
+
"aria-modal": "true",
|
|
270
|
+
open: true,
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
273
|
+
"button",
|
|
274
|
+
{
|
|
275
|
+
onClick: onClose,
|
|
276
|
+
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",
|
|
277
|
+
"aria-label": "Fechar modal",
|
|
278
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.X, { size: 18 })
|
|
279
|
+
}
|
|
280
|
+
) }),
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
282
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
283
|
+
"img",
|
|
284
|
+
{
|
|
285
|
+
src: image,
|
|
286
|
+
alt: imageAlt ?? "",
|
|
287
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
288
|
+
}
|
|
289
|
+
) }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
291
|
+
"h2",
|
|
292
|
+
{
|
|
293
|
+
id: titleId,
|
|
294
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
295
|
+
children: title
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
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 }),
|
|
299
|
+
actionLink && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "w-full", children: [
|
|
300
|
+
(() => {
|
|
301
|
+
const normalized = normalizeUrl(actionLink);
|
|
302
|
+
const isYT = isYouTubeUrl(normalized);
|
|
303
|
+
if (!isYT) return null;
|
|
304
|
+
const id = getYouTubeVideoId(normalized);
|
|
305
|
+
if (!id) {
|
|
306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
307
|
+
Button_default,
|
|
308
|
+
{
|
|
309
|
+
variant: "solid",
|
|
310
|
+
action: "primary",
|
|
311
|
+
size: "large",
|
|
312
|
+
className: "w-full",
|
|
313
|
+
onClick: handleActionClick,
|
|
314
|
+
children: actionLabel || "Iniciar Atividade"
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
319
|
+
"iframe",
|
|
320
|
+
{
|
|
321
|
+
src: getYouTubeEmbedUrl(id),
|
|
322
|
+
className: "w-full aspect-video rounded-lg",
|
|
323
|
+
allowFullScreen: true,
|
|
324
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
325
|
+
title: "V\xEDdeo YouTube"
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
})(),
|
|
329
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
330
|
+
Button_default,
|
|
331
|
+
{
|
|
332
|
+
variant: "solid",
|
|
333
|
+
action: "primary",
|
|
334
|
+
size: "large",
|
|
335
|
+
className: "w-full",
|
|
336
|
+
onClick: handleActionClick,
|
|
337
|
+
children: actionLabel || "Iniciar Atividade"
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] })
|
|
341
|
+
] })
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
) });
|
|
345
|
+
}
|
|
346
|
+
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)(
|
|
347
|
+
"dialog",
|
|
348
|
+
{
|
|
349
|
+
className: modalClasses,
|
|
350
|
+
"aria-labelledby": titleId,
|
|
351
|
+
"aria-modal": "true",
|
|
352
|
+
open: true,
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
356
|
+
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
357
|
+
"button",
|
|
358
|
+
{
|
|
359
|
+
onClick: onClose,
|
|
360
|
+
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",
|
|
361
|
+
"aria-label": "Fechar modal",
|
|
362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_phosphor_react.X, { size: 18 })
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
] }),
|
|
366
|
+
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 }) }),
|
|
367
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
) });
|
|
371
|
+
};
|
|
372
|
+
var Modal_default = Modal;
|
|
373
|
+
|
|
374
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
375
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
376
|
+
var import_react4 = require("react");
|
|
377
|
+
|
|
378
|
+
// src/components/SelectionButton/SelectionButton.tsx
|
|
379
|
+
var import_react2 = require("react");
|
|
380
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
381
|
+
var SelectionButton = (0, import_react2.forwardRef)(
|
|
382
|
+
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
383
|
+
const baseClasses = [
|
|
384
|
+
"inline-flex",
|
|
385
|
+
"items-center",
|
|
386
|
+
"justify-start",
|
|
387
|
+
"gap-2",
|
|
388
|
+
"p-4",
|
|
389
|
+
"rounded-xl",
|
|
390
|
+
"cursor-pointer",
|
|
391
|
+
"border",
|
|
392
|
+
"border-border-50",
|
|
393
|
+
"bg-background",
|
|
394
|
+
"text-sm",
|
|
395
|
+
"text-text-700",
|
|
396
|
+
"font-bold",
|
|
397
|
+
"shadow-soft-shadow-1",
|
|
398
|
+
"hover:bg-background-100",
|
|
399
|
+
"focus-visible:outline-none",
|
|
400
|
+
"focus-visible:ring-2",
|
|
401
|
+
"focus-visible:ring-indicator-info",
|
|
402
|
+
"focus-visible:ring-offset-0",
|
|
403
|
+
"focus-visible:shadow-none",
|
|
404
|
+
"active:ring-2",
|
|
405
|
+
"active:ring-primary-950",
|
|
406
|
+
"active:ring-offset-0",
|
|
407
|
+
"active:shadow-none",
|
|
408
|
+
"disabled:opacity-50",
|
|
409
|
+
"disabled:cursor-not-allowed"
|
|
410
|
+
];
|
|
411
|
+
const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
|
|
412
|
+
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
414
|
+
"button",
|
|
344
415
|
{
|
|
345
416
|
ref,
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
focus-visible:bg-background-50
|
|
351
|
-
${getVariantClasses()}
|
|
352
|
-
${sizeClasses}
|
|
353
|
-
${className}
|
|
354
|
-
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
355
|
-
`,
|
|
356
|
-
onClick: handleClick,
|
|
357
|
-
onKeyDown: (e) => {
|
|
358
|
-
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
359
|
-
},
|
|
360
|
-
tabIndex: disabled ? -1 : 0,
|
|
417
|
+
type: "button",
|
|
418
|
+
className: cn(allClasses, className),
|
|
419
|
+
disabled,
|
|
420
|
+
"aria-pressed": selected,
|
|
361
421
|
...props,
|
|
362
422
|
children: [
|
|
363
|
-
|
|
364
|
-
/* @__PURE__ */ (0,
|
|
365
|
-
iconRight
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: label })
|
|
366
425
|
]
|
|
367
426
|
}
|
|
368
427
|
);
|
|
369
428
|
}
|
|
370
429
|
);
|
|
371
|
-
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
));
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
"
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
430
|
+
SelectionButton.displayName = "SelectionButton";
|
|
431
|
+
var SelectionButton_default = SelectionButton;
|
|
432
|
+
|
|
433
|
+
// src/hooks/useTheme.ts
|
|
434
|
+
var import_react3 = require("react");
|
|
435
|
+
var useTheme = () => {
|
|
436
|
+
const [themeMode, setThemeMode] = (0, import_react3.useState)("system");
|
|
437
|
+
const [isDark, setIsDark] = (0, import_react3.useState)(false);
|
|
438
|
+
const themeModeRef = (0, import_react3.useRef)("system");
|
|
439
|
+
const applyTheme = (0, import_react3.useCallback)((mode) => {
|
|
440
|
+
const htmlElement = document.documentElement;
|
|
441
|
+
const originalTheme = htmlElement.getAttribute("data-original-theme");
|
|
442
|
+
if (mode === "dark") {
|
|
443
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
444
|
+
setIsDark(true);
|
|
445
|
+
} else if (mode === "light") {
|
|
446
|
+
if (originalTheme) {
|
|
447
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
448
|
+
}
|
|
449
|
+
setIsDark(false);
|
|
450
|
+
} else if (mode === "system") {
|
|
451
|
+
const isSystemDark = window.matchMedia(
|
|
452
|
+
"(prefers-color-scheme: dark)"
|
|
453
|
+
).matches;
|
|
454
|
+
if (isSystemDark) {
|
|
455
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
456
|
+
setIsDark(true);
|
|
457
|
+
} else if (originalTheme) {
|
|
458
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
459
|
+
setIsDark(false);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}, []);
|
|
463
|
+
const toggleTheme = (0, import_react3.useCallback)(() => {
|
|
464
|
+
let newMode;
|
|
465
|
+
if (themeMode === "light") {
|
|
466
|
+
newMode = "dark";
|
|
467
|
+
} else if (themeMode === "dark") {
|
|
468
|
+
newMode = "light";
|
|
469
|
+
} else {
|
|
470
|
+
newMode = "dark";
|
|
401
471
|
}
|
|
472
|
+
setThemeMode(newMode);
|
|
473
|
+
themeModeRef.current = newMode;
|
|
474
|
+
applyTheme(newMode);
|
|
475
|
+
localStorage.setItem("theme-mode", newMode);
|
|
476
|
+
}, [themeMode, applyTheme]);
|
|
477
|
+
const setTheme = (0, import_react3.useCallback)(
|
|
478
|
+
(mode) => {
|
|
479
|
+
setThemeMode(mode);
|
|
480
|
+
themeModeRef.current = mode;
|
|
481
|
+
applyTheme(mode);
|
|
482
|
+
localStorage.setItem("theme-mode", mode);
|
|
483
|
+
},
|
|
484
|
+
[applyTheme]
|
|
402
485
|
);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
486
|
+
(0, import_react3.useEffect)(() => {
|
|
487
|
+
const htmlElement = document.documentElement;
|
|
488
|
+
const currentTheme = htmlElement.getAttribute("data-theme");
|
|
489
|
+
if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
|
|
490
|
+
htmlElement.setAttribute("data-original-theme", currentTheme);
|
|
491
|
+
}
|
|
492
|
+
const savedThemeMode = localStorage.getItem("theme-mode");
|
|
493
|
+
const initialMode = savedThemeMode || "system";
|
|
494
|
+
if (!savedThemeMode) {
|
|
495
|
+
localStorage.setItem("theme-mode", "system");
|
|
496
|
+
}
|
|
497
|
+
setThemeMode(initialMode);
|
|
498
|
+
themeModeRef.current = initialMode;
|
|
499
|
+
applyTheme(initialMode);
|
|
500
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
501
|
+
const handleSystemThemeChange = () => {
|
|
502
|
+
if (themeModeRef.current === "system") {
|
|
503
|
+
applyTheme("system");
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
mediaQuery.addEventListener("change", handleSystemThemeChange);
|
|
507
|
+
return () => {
|
|
508
|
+
mediaQuery.removeEventListener("change", handleSystemThemeChange);
|
|
509
|
+
};
|
|
510
|
+
}, [applyTheme]);
|
|
511
|
+
return {
|
|
512
|
+
themeMode,
|
|
513
|
+
isDark,
|
|
514
|
+
toggleTheme,
|
|
515
|
+
setTheme
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
// src/components/ThemeToggle/ThemeToggle.tsx
|
|
520
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
521
|
+
var ThemeToggle = ({
|
|
522
|
+
variant = "default",
|
|
523
|
+
onToggle
|
|
524
|
+
}) => {
|
|
525
|
+
const { themeMode, setTheme } = useTheme();
|
|
526
|
+
const [tempTheme, setTempTheme] = (0, import_react4.useState)(themeMode);
|
|
527
|
+
(0, import_react4.useEffect)(() => {
|
|
528
|
+
setTempTheme(themeMode);
|
|
529
|
+
}, [themeMode]);
|
|
530
|
+
const problemTypes = [
|
|
408
531
|
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
532
|
+
id: "light",
|
|
533
|
+
title: "Claro",
|
|
534
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Sun, { size: 24 })
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
id: "dark",
|
|
538
|
+
title: "Escuro",
|
|
539
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.Moon, { size: 24 })
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
id: "system",
|
|
543
|
+
title: "Sistema",
|
|
544
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
545
|
+
"svg",
|
|
546
|
+
{
|
|
547
|
+
width: "25",
|
|
548
|
+
height: "25",
|
|
549
|
+
viewBox: "0 0 25 25",
|
|
550
|
+
fill: "none",
|
|
551
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
553
|
+
"path",
|
|
554
|
+
{
|
|
555
|
+
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",
|
|
556
|
+
fill: "#525252"
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
}
|
|
560
|
+
)
|
|
420
561
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
562
|
+
];
|
|
563
|
+
const handleThemeSelect = (selectedTheme) => {
|
|
564
|
+
if (variant === "with-save") {
|
|
565
|
+
setTempTheme(selectedTheme);
|
|
566
|
+
} else {
|
|
567
|
+
setTheme(selectedTheme);
|
|
568
|
+
}
|
|
569
|
+
if (onToggle) {
|
|
570
|
+
onToggle(selectedTheme);
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
const currentTheme = variant === "with-save" ? tempTheme : themeMode;
|
|
574
|
+
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)(
|
|
575
|
+
SelectionButton_default,
|
|
576
|
+
{
|
|
577
|
+
icon: type.icon,
|
|
578
|
+
label: type.title,
|
|
579
|
+
selected: currentTheme === type.id,
|
|
580
|
+
onClick: () => handleThemeSelect(type.id),
|
|
581
|
+
className: "w-full p-2 sm:p-4"
|
|
582
|
+
},
|
|
583
|
+
type.id
|
|
584
|
+
)) });
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
588
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
589
|
+
function createDropdownStore() {
|
|
590
|
+
return (0, import_zustand.create)((set) => ({
|
|
591
|
+
open: false,
|
|
592
|
+
setOpen: (open) => set({ open })
|
|
593
|
+
}));
|
|
594
|
+
}
|
|
595
|
+
var useDropdownStore = (externalStore) => {
|
|
596
|
+
if (!externalStore) {
|
|
597
|
+
throw new Error(
|
|
598
|
+
"Component must be used within a DropdownMenu (store is missing)"
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
return externalStore;
|
|
602
|
+
};
|
|
603
|
+
var injectStore = (children, store) => {
|
|
604
|
+
return import_react5.Children.map(children, (child) => {
|
|
605
|
+
if ((0, import_react5.isValidElement)(child)) {
|
|
606
|
+
const typedChild = child;
|
|
607
|
+
const newProps = {
|
|
608
|
+
store
|
|
609
|
+
};
|
|
610
|
+
if (typedChild.props.children) {
|
|
611
|
+
newProps.children = injectStore(typedChild.props.children, store);
|
|
612
|
+
}
|
|
613
|
+
return (0, import_react5.cloneElement)(typedChild, newProps);
|
|
614
|
+
}
|
|
615
|
+
return child;
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
var DropdownMenu = ({
|
|
619
|
+
children,
|
|
620
|
+
open: propOpen,
|
|
621
|
+
onOpenChange
|
|
622
|
+
}) => {
|
|
623
|
+
const storeRef = (0, import_react5.useRef)(null);
|
|
624
|
+
storeRef.current ??= createDropdownStore();
|
|
625
|
+
const store = storeRef.current;
|
|
626
|
+
const { open, setOpen: storeSetOpen } = (0, import_zustand.useStore)(store, (s) => s);
|
|
627
|
+
const setOpen = (newOpen) => {
|
|
628
|
+
storeSetOpen(newOpen);
|
|
629
|
+
};
|
|
630
|
+
const menuRef = (0, import_react5.useRef)(null);
|
|
631
|
+
const handleArrowDownOrArrowUp = (event) => {
|
|
632
|
+
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
633
|
+
if (menuContent) {
|
|
634
|
+
event.preventDefault();
|
|
635
|
+
const items = Array.from(
|
|
636
|
+
menuContent.querySelectorAll(
|
|
637
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
638
|
+
)
|
|
639
|
+
).filter((el) => el instanceof HTMLElement);
|
|
640
|
+
if (items.length === 0) return;
|
|
641
|
+
const focusedItem = document.activeElement;
|
|
642
|
+
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
643
|
+
let nextIndex;
|
|
644
|
+
if (event.key === "ArrowDown") {
|
|
645
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
646
|
+
} else {
|
|
647
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
648
|
+
}
|
|
649
|
+
items[nextIndex]?.focus();
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
const handleDownkey = (event) => {
|
|
653
|
+
if (event.key === "Escape") {
|
|
654
|
+
setOpen(false);
|
|
655
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
656
|
+
handleArrowDownOrArrowUp(event);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
const handleClickOutside = (event) => {
|
|
660
|
+
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
661
|
+
setOpen(false);
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
(0, import_react5.useEffect)(() => {
|
|
665
|
+
if (open) {
|
|
666
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
667
|
+
document.addEventListener("keydown", handleDownkey);
|
|
668
|
+
}
|
|
669
|
+
return () => {
|
|
670
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
671
|
+
document.removeEventListener("keydown", handleDownkey);
|
|
672
|
+
};
|
|
673
|
+
}, [open]);
|
|
674
|
+
(0, import_react5.useEffect)(() => {
|
|
675
|
+
setOpen(open);
|
|
676
|
+
onOpenChange?.(open);
|
|
677
|
+
}, [open, onOpenChange]);
|
|
678
|
+
(0, import_react5.useEffect)(() => {
|
|
679
|
+
if (propOpen) {
|
|
680
|
+
setOpen(propOpen);
|
|
681
|
+
}
|
|
682
|
+
}, [propOpen]);
|
|
683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
684
|
+
};
|
|
685
|
+
var DropdownMenuTrigger = ({
|
|
429
686
|
className,
|
|
430
|
-
|
|
687
|
+
children,
|
|
431
688
|
onClick,
|
|
432
689
|
store: externalStore,
|
|
433
690
|
...props
|
|
434
691
|
}) => {
|
|
435
692
|
const store = useDropdownStore(externalStore);
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
693
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
694
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
696
|
+
"button",
|
|
439
697
|
{
|
|
440
|
-
variant: "outline",
|
|
441
|
-
className: cn("w-full", className),
|
|
442
|
-
disabled,
|
|
443
698
|
onClick: (e) => {
|
|
444
|
-
|
|
445
|
-
|
|
699
|
+
e.stopPropagation();
|
|
700
|
+
toggleOpen();
|
|
701
|
+
if (onClick) onClick(e);
|
|
446
702
|
},
|
|
703
|
+
"aria-expanded": open,
|
|
704
|
+
className: cn(className),
|
|
447
705
|
...props,
|
|
448
|
-
children
|
|
449
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.SignOut, {}) }),
|
|
450
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Sair" })
|
|
451
|
-
]
|
|
706
|
+
children
|
|
452
707
|
}
|
|
453
708
|
);
|
|
454
709
|
};
|
|
455
|
-
|
|
456
|
-
var
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
var import_react2 = require("react");
|
|
460
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
461
|
-
var SKELETON_ANIMATION_CLASSES = {
|
|
462
|
-
pulse: "animate-pulse",
|
|
463
|
-
none: ""
|
|
710
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
711
|
+
var ITEM_SIZE_CLASSES = {
|
|
712
|
+
small: "text-sm",
|
|
713
|
+
medium: "text-md"
|
|
464
714
|
};
|
|
465
|
-
var
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
715
|
+
var SIDE_CLASSES = {
|
|
716
|
+
top: "bottom-full",
|
|
717
|
+
right: "top-full",
|
|
718
|
+
bottom: "top-full",
|
|
719
|
+
left: "top-full"
|
|
470
720
|
};
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
721
|
+
var ALIGN_CLASSES = {
|
|
722
|
+
start: "left-0",
|
|
723
|
+
center: "left-1/2 -translate-x-1/2",
|
|
724
|
+
end: "right-0"
|
|
725
|
+
};
|
|
726
|
+
var MENUCONTENT_VARIANT_CLASSES = {
|
|
727
|
+
menu: "p-1",
|
|
728
|
+
profile: "p-6"
|
|
476
729
|
};
|
|
477
|
-
var
|
|
730
|
+
var MenuLabel = (0, import_react5.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
732
|
+
"div",
|
|
733
|
+
{
|
|
734
|
+
ref,
|
|
735
|
+
className: cn("text-sm w-full", inset ? "pl-8" : "", className),
|
|
736
|
+
...props
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
});
|
|
740
|
+
MenuLabel.displayName = "MenuLabel";
|
|
741
|
+
var DropdownMenuContent = (0, import_react5.forwardRef)(
|
|
478
742
|
({
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
spacing = "none",
|
|
485
|
-
className = "",
|
|
743
|
+
className,
|
|
744
|
+
align = "start",
|
|
745
|
+
side = "bottom",
|
|
746
|
+
variant = "menu",
|
|
747
|
+
sideOffset = 4,
|
|
486
748
|
children,
|
|
749
|
+
store: externalStore,
|
|
487
750
|
...props
|
|
488
751
|
}, ref) => {
|
|
489
|
-
const
|
|
490
|
-
const
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
752
|
+
const store = useDropdownStore(externalStore);
|
|
753
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
754
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(open);
|
|
755
|
+
(0, import_react5.useEffect)(() => {
|
|
756
|
+
if (open) {
|
|
757
|
+
setIsVisible(true);
|
|
758
|
+
} else {
|
|
759
|
+
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
760
|
+
return () => clearTimeout(timer);
|
|
761
|
+
}
|
|
762
|
+
}, [open]);
|
|
763
|
+
if (!isVisible) return null;
|
|
764
|
+
const getPositionClasses = () => {
|
|
765
|
+
const vertical = SIDE_CLASSES[side];
|
|
766
|
+
const horizontal = ALIGN_CLASSES[align];
|
|
767
|
+
return `absolute ${vertical} ${horizontal}`;
|
|
495
768
|
};
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
"div",
|
|
499
|
-
{
|
|
500
|
-
ref,
|
|
501
|
-
className: cn("flex flex-col", spacingClass, className),
|
|
502
|
-
...props,
|
|
503
|
-
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
504
|
-
"div",
|
|
505
|
-
{
|
|
506
|
-
className: cn(variantClass, animationClass),
|
|
507
|
-
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
508
|
-
},
|
|
509
|
-
index
|
|
510
|
-
))
|
|
511
|
-
}
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
769
|
+
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
515
771
|
"div",
|
|
516
772
|
{
|
|
517
773
|
ref,
|
|
518
|
-
|
|
519
|
-
|
|
774
|
+
role: "menu",
|
|
775
|
+
className: `
|
|
776
|
+
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
|
|
777
|
+
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
778
|
+
${getPositionClasses()}
|
|
779
|
+
${variantClasses}
|
|
780
|
+
${className}
|
|
781
|
+
`,
|
|
782
|
+
style: {
|
|
783
|
+
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
784
|
+
marginBottom: side === "top" ? sideOffset : void 0,
|
|
785
|
+
marginLeft: side === "right" ? sideOffset : void 0,
|
|
786
|
+
marginRight: side === "left" ? sideOffset : void 0
|
|
787
|
+
},
|
|
520
788
|
...props,
|
|
521
789
|
children
|
|
522
790
|
}
|
|
523
791
|
);
|
|
524
792
|
}
|
|
525
793
|
);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
);
|
|
529
|
-
var SkeletonCircle = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
530
|
-
var SkeletonRectangle = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
531
|
-
var SkeletonRounded = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
532
|
-
var SkeletonCard = (0, import_react2.forwardRef)(
|
|
794
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
795
|
+
var DropdownMenuItem = (0, import_react5.forwardRef)(
|
|
533
796
|
({
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
797
|
+
className,
|
|
798
|
+
size = "small",
|
|
799
|
+
children,
|
|
800
|
+
iconRight,
|
|
801
|
+
iconLeft,
|
|
802
|
+
disabled = false,
|
|
803
|
+
onClick,
|
|
804
|
+
variant = "menu",
|
|
805
|
+
store: externalStore,
|
|
540
806
|
...props
|
|
541
807
|
}, ref) => {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
...props,
|
|
551
|
-
children: [
|
|
552
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
553
|
-
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
554
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
555
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
556
|
-
showDescription && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
557
|
-
] })
|
|
558
|
-
] }),
|
|
559
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
560
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
561
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
562
|
-
] })
|
|
563
|
-
]
|
|
808
|
+
const store = useDropdownStore(externalStore);
|
|
809
|
+
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
810
|
+
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
811
|
+
const handleClick = (e) => {
|
|
812
|
+
if (disabled) {
|
|
813
|
+
e.preventDefault();
|
|
814
|
+
e.stopPropagation();
|
|
815
|
+
return;
|
|
564
816
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
);
|
|
568
|
-
var SkeletonList = (0, import_react2.forwardRef)(
|
|
569
|
-
({
|
|
570
|
-
items = 3,
|
|
571
|
-
showAvatar = true,
|
|
572
|
-
showTitle = true,
|
|
573
|
-
showDescription = true,
|
|
574
|
-
lines = 1,
|
|
575
|
-
className = "",
|
|
576
|
-
...props
|
|
577
|
-
}, ref) => {
|
|
578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
579
|
-
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
580
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
581
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
582
|
-
showDescription && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
583
|
-
] })
|
|
584
|
-
] }, index)) });
|
|
585
|
-
}
|
|
586
|
-
);
|
|
587
|
-
var SkeletonTable = (0, import_react2.forwardRef)(
|
|
588
|
-
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
589
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
590
|
-
showHeader && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
591
|
-
SkeletonText,
|
|
592
|
-
{
|
|
593
|
-
width: `${100 / columns}%`,
|
|
594
|
-
height: 20
|
|
595
|
-
},
|
|
596
|
-
index
|
|
597
|
-
)) }),
|
|
598
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
599
|
-
SkeletonText,
|
|
600
|
-
{
|
|
601
|
-
width: `${100 / columns}%`,
|
|
602
|
-
height: 16
|
|
603
|
-
},
|
|
604
|
-
colIndex
|
|
605
|
-
)) }, rowIndex)) })
|
|
606
|
-
] });
|
|
607
|
-
}
|
|
608
|
-
);
|
|
609
|
-
|
|
610
|
-
// src/components/IconButton/IconButton.tsx
|
|
611
|
-
var import_react3 = require("react");
|
|
612
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
613
|
-
var IconButton = (0, import_react3.forwardRef)(
|
|
614
|
-
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
615
|
-
const baseClasses = [
|
|
616
|
-
"inline-flex",
|
|
617
|
-
"items-center",
|
|
618
|
-
"justify-center",
|
|
619
|
-
"rounded-lg",
|
|
620
|
-
"font-medium",
|
|
621
|
-
"bg-transparent",
|
|
622
|
-
"text-text-950",
|
|
623
|
-
"cursor-pointer",
|
|
624
|
-
"hover:bg-primary-600",
|
|
625
|
-
"hover:text-text",
|
|
626
|
-
"focus-visible:outline-none",
|
|
627
|
-
"focus-visible:ring-2",
|
|
628
|
-
"focus-visible:ring-offset-0",
|
|
629
|
-
"focus-visible:ring-indicator-info",
|
|
630
|
-
"disabled:opacity-50",
|
|
631
|
-
"disabled:cursor-not-allowed",
|
|
632
|
-
"disabled:pointer-events-none"
|
|
633
|
-
];
|
|
634
|
-
const sizeClasses = {
|
|
635
|
-
sm: ["w-6", "h-6", "text-sm"],
|
|
636
|
-
md: ["w-10", "h-10", "text-base"]
|
|
817
|
+
onClick?.(e);
|
|
818
|
+
setOpen(false);
|
|
637
819
|
};
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
|
|
820
|
+
const getVariantClasses = () => {
|
|
821
|
+
if (variant === "profile") {
|
|
822
|
+
return "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";
|
|
823
|
+
}
|
|
824
|
+
return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
|
|
825
|
+
};
|
|
826
|
+
const getVariantProps = () => {
|
|
827
|
+
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
828
|
+
};
|
|
829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
830
|
+
"div",
|
|
647
831
|
{
|
|
648
832
|
ref,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
disabled,
|
|
652
|
-
|
|
653
|
-
|
|
833
|
+
role: "menuitem",
|
|
834
|
+
...getVariantProps(),
|
|
835
|
+
"aria-disabled": disabled,
|
|
836
|
+
className: `
|
|
837
|
+
focus-visible:bg-background-50
|
|
838
|
+
${getVariantClasses()}
|
|
839
|
+
${sizeClasses}
|
|
840
|
+
${className}
|
|
841
|
+
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
842
|
+
`,
|
|
843
|
+
onClick: handleClick,
|
|
844
|
+
onKeyDown: (e) => {
|
|
845
|
+
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
846
|
+
},
|
|
847
|
+
tabIndex: disabled ? -1 : 0,
|
|
654
848
|
...props,
|
|
655
|
-
children:
|
|
849
|
+
children: [
|
|
850
|
+
iconLeft,
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-full", children }),
|
|
852
|
+
iconRight
|
|
853
|
+
]
|
|
656
854
|
}
|
|
657
855
|
);
|
|
658
856
|
}
|
|
659
857
|
);
|
|
660
|
-
|
|
661
|
-
var
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
// src/components/Modal/utils/videoUtils.ts
|
|
668
|
-
var isYouTubeUrl = (url) => {
|
|
669
|
-
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
670
|
-
return youtubeRegex.test(url);
|
|
671
|
-
};
|
|
672
|
-
var isValidYouTubeHost = (host) => {
|
|
673
|
-
if (host === "youtu.be") return "youtu.be";
|
|
674
|
-
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
675
|
-
if (isValidYouTubeCom) return "youtube";
|
|
676
|
-
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
677
|
-
if (isValidNoCookie) return "nocookie";
|
|
678
|
-
return null;
|
|
679
|
-
};
|
|
680
|
-
var extractYoutuBeId = (pathname) => {
|
|
681
|
-
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
682
|
-
return firstSeg || null;
|
|
683
|
-
};
|
|
684
|
-
var extractYouTubeId = (pathname, searchParams) => {
|
|
685
|
-
const parts = pathname.split("/").filter(Boolean);
|
|
686
|
-
const [first, second] = parts;
|
|
687
|
-
if (first === "embed" && second) return second;
|
|
688
|
-
if (first === "shorts" && second) return second;
|
|
689
|
-
if (first === "live" && second) return second;
|
|
690
|
-
const v = searchParams.get("v");
|
|
691
|
-
if (v) return v;
|
|
692
|
-
return null;
|
|
693
|
-
};
|
|
694
|
-
var getYouTubeVideoId = (url) => {
|
|
695
|
-
try {
|
|
696
|
-
const u = new URL(url);
|
|
697
|
-
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
698
|
-
if (!hostType) return null;
|
|
699
|
-
if (hostType === "youtu.be") {
|
|
700
|
-
return extractYoutuBeId(u.pathname);
|
|
701
|
-
}
|
|
702
|
-
return extractYouTubeId(u.pathname, u.searchParams);
|
|
703
|
-
} catch {
|
|
704
|
-
return null;
|
|
858
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
859
|
+
var DropdownMenuSeparator = (0, import_react5.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
860
|
+
"div",
|
|
861
|
+
{
|
|
862
|
+
ref,
|
|
863
|
+
className: cn("my-1 h-px bg-border-200", className),
|
|
864
|
+
...props
|
|
705
865
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
footer,
|
|
729
|
-
hideCloseButton = false,
|
|
730
|
-
variant = "default",
|
|
731
|
-
description,
|
|
732
|
-
image,
|
|
733
|
-
imageAlt,
|
|
734
|
-
actionLink,
|
|
735
|
-
actionLabel
|
|
736
|
-
}) => {
|
|
737
|
-
const titleId = (0, import_react4.useId)();
|
|
738
|
-
(0, import_react4.useEffect)(() => {
|
|
739
|
-
if (!isOpen || !closeOnEscape) return;
|
|
740
|
-
const handleEscape = (event) => {
|
|
741
|
-
if (event.key === "Escape") {
|
|
742
|
-
onClose();
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
document.addEventListener("keydown", handleEscape);
|
|
746
|
-
return () => document.removeEventListener("keydown", handleEscape);
|
|
747
|
-
}, [isOpen, closeOnEscape, onClose]);
|
|
748
|
-
(0, import_react4.useEffect)(() => {
|
|
749
|
-
const originalOverflow = document.body.style.overflow;
|
|
750
|
-
if (isOpen) {
|
|
751
|
-
document.body.style.overflow = "hidden";
|
|
752
|
-
} else {
|
|
753
|
-
document.body.style.overflow = originalOverflow;
|
|
866
|
+
));
|
|
867
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
868
|
+
var ProfileMenuTrigger = (0, import_react5.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
869
|
+
const store = useDropdownStore(externalStore);
|
|
870
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
871
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
873
|
+
"button",
|
|
874
|
+
{
|
|
875
|
+
ref,
|
|
876
|
+
className: cn(
|
|
877
|
+
"rounded-lg size-10 bg-primary-50 flex items-center justify-center cursor-pointer",
|
|
878
|
+
className
|
|
879
|
+
),
|
|
880
|
+
onClick: (e) => {
|
|
881
|
+
e.stopPropagation();
|
|
882
|
+
toggleOpen();
|
|
883
|
+
onClick?.(e);
|
|
884
|
+
},
|
|
885
|
+
"aria-expanded": open,
|
|
886
|
+
...props,
|
|
887
|
+
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 }) })
|
|
754
888
|
}
|
|
755
|
-
return () => {
|
|
756
|
-
document.body.style.overflow = originalOverflow;
|
|
757
|
-
};
|
|
758
|
-
}, [isOpen]);
|
|
759
|
-
if (!isOpen) return null;
|
|
760
|
-
const sizeClasses = SIZE_CLASSES2[size];
|
|
761
|
-
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
762
|
-
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
763
|
-
const modalClasses = cn(
|
|
764
|
-
baseClasses,
|
|
765
|
-
sizeClasses,
|
|
766
|
-
dialogResetClasses,
|
|
767
|
-
className
|
|
768
889
|
);
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
890
|
+
});
|
|
891
|
+
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
892
|
+
var ProfileMenuHeader = (0, import_react5.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
|
|
893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
894
|
+
"div",
|
|
895
|
+
{
|
|
896
|
+
ref,
|
|
897
|
+
"data-component": "ProfileMenuHeader",
|
|
898
|
+
className: cn("flex flex-row gap-4 items-center", className),
|
|
899
|
+
...props,
|
|
900
|
+
children: [
|
|
901
|
+
/* @__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" }) }),
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col ", children: [
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "xl", weight: "bold", color: "text-text-950", children: name }),
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { size: "md", color: "text-text-600", children: email })
|
|
905
|
+
] })
|
|
906
|
+
]
|
|
773
907
|
}
|
|
908
|
+
);
|
|
909
|
+
});
|
|
910
|
+
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
911
|
+
var ProfileToggleTheme = ({ ...props }) => {
|
|
912
|
+
const { themeMode, setTheme } = useTheme();
|
|
913
|
+
const [modalThemeToggle, setModalThemeToggle] = (0, import_react5.useState)(false);
|
|
914
|
+
const [selectedTheme, setSelectedTheme] = (0, import_react5.useState)(themeMode);
|
|
915
|
+
const handleClick = (e) => {
|
|
916
|
+
e.preventDefault();
|
|
917
|
+
e.stopPropagation();
|
|
918
|
+
setModalThemeToggle(true);
|
|
774
919
|
};
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
920
|
+
const handleSave = () => {
|
|
921
|
+
setTheme(selectedTheme);
|
|
922
|
+
setModalThemeToggle(false);
|
|
923
|
+
};
|
|
924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
926
|
+
"div",
|
|
778
927
|
{
|
|
779
|
-
|
|
780
|
-
"
|
|
781
|
-
"
|
|
782
|
-
|
|
928
|
+
role: "menuitem",
|
|
929
|
+
"data-variant": "profile",
|
|
930
|
+
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",
|
|
931
|
+
onClick: handleClick,
|
|
932
|
+
onKeyDown: (e) => {
|
|
933
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
934
|
+
e.preventDefault();
|
|
935
|
+
e.stopPropagation();
|
|
936
|
+
setModalThemeToggle(true);
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
tabIndex: 0,
|
|
940
|
+
...props,
|
|
783
941
|
children: [
|
|
784
|
-
/* @__PURE__ */ (0,
|
|
785
|
-
"
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
943
|
+
"svg",
|
|
786
944
|
{
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
image && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
795
|
-
"img",
|
|
796
|
-
{
|
|
797
|
-
src: image,
|
|
798
|
-
alt: imageAlt ?? "",
|
|
799
|
-
className: "w-[122px] h-[122px] object-contain"
|
|
800
|
-
}
|
|
801
|
-
) }),
|
|
802
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
803
|
-
"h2",
|
|
804
|
-
{
|
|
805
|
-
id: titleId,
|
|
806
|
-
className: "text-lg font-semibold text-text-950 text-center",
|
|
807
|
-
children: title
|
|
808
|
-
}
|
|
809
|
-
),
|
|
810
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
|
|
811
|
-
actionLink && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full", children: [
|
|
812
|
-
(() => {
|
|
813
|
-
const normalized = normalizeUrl(actionLink);
|
|
814
|
-
const isYT = isYouTubeUrl(normalized);
|
|
815
|
-
if (!isYT) return null;
|
|
816
|
-
const id = getYouTubeVideoId(normalized);
|
|
817
|
-
if (!id) {
|
|
818
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
819
|
-
Button_default,
|
|
820
|
-
{
|
|
821
|
-
variant: "solid",
|
|
822
|
-
action: "primary",
|
|
823
|
-
size: "large",
|
|
824
|
-
className: "w-full",
|
|
825
|
-
onClick: handleActionClick,
|
|
826
|
-
children: actionLabel || "Iniciar Atividade"
|
|
827
|
-
}
|
|
828
|
-
);
|
|
829
|
-
}
|
|
830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
831
|
-
"iframe",
|
|
832
|
-
{
|
|
833
|
-
src: getYouTubeEmbedUrl(id),
|
|
834
|
-
className: "w-full aspect-video rounded-lg",
|
|
835
|
-
allowFullScreen: true,
|
|
836
|
-
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
837
|
-
title: "V\xEDdeo YouTube"
|
|
838
|
-
}
|
|
839
|
-
);
|
|
840
|
-
})(),
|
|
841
|
-
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
842
|
-
Button_default,
|
|
945
|
+
width: "25",
|
|
946
|
+
height: "25",
|
|
947
|
+
viewBox: "0 0 25 25",
|
|
948
|
+
fill: "none",
|
|
949
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
951
|
+
"path",
|
|
843
952
|
{
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
size: "large",
|
|
847
|
-
className: "w-full",
|
|
848
|
-
onClick: handleActionClick,
|
|
849
|
-
children: actionLabel || "Iniciar Atividade"
|
|
953
|
+
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",
|
|
954
|
+
fill: "#525252"
|
|
850
955
|
}
|
|
851
956
|
)
|
|
852
|
-
|
|
853
|
-
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { className: "w-full", size: "md", children: "Apar\xEAncia" }),
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.CaretRight, {})
|
|
854
961
|
]
|
|
855
962
|
}
|
|
856
|
-
)
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
868
|
-
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
869
|
-
"button",
|
|
963
|
+
),
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
965
|
+
Modal_default,
|
|
966
|
+
{
|
|
967
|
+
isOpen: modalThemeToggle,
|
|
968
|
+
onClose: () => setModalThemeToggle(false),
|
|
969
|
+
title: "Apar\xEAncia",
|
|
970
|
+
size: "md",
|
|
971
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-3", children: [
|
|
972
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
973
|
+
Button_default,
|
|
870
974
|
{
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.X, { size: 18 })
|
|
975
|
+
variant: "outline",
|
|
976
|
+
onClick: () => setModalThemeToggle(false),
|
|
977
|
+
children: "Cancelar"
|
|
875
978
|
}
|
|
876
|
-
)
|
|
979
|
+
),
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button_default, { variant: "solid", onClick: () => handleSave(), children: "Salvar" })
|
|
877
981
|
] }),
|
|
878
|
-
children
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
|
|
985
|
+
] })
|
|
986
|
+
}
|
|
987
|
+
)
|
|
988
|
+
] });
|
|
883
989
|
};
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
className = "",
|
|
990
|
+
ProfileToggleTheme.displayName = "ProfileToggleTheme";
|
|
991
|
+
var ProfileMenuSection = (0, import_react5.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
|
|
993
|
+
});
|
|
994
|
+
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
995
|
+
var ProfileMenuFooter = ({
|
|
996
|
+
className,
|
|
997
|
+
disabled = false,
|
|
998
|
+
onClick,
|
|
999
|
+
store: externalStore,
|
|
895
1000
|
...props
|
|
896
1001
|
}) => {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
xs: "text-xs",
|
|
902
|
-
sm: "text-sm",
|
|
903
|
-
md: "text-md",
|
|
904
|
-
lg: "text-lg",
|
|
905
|
-
xl: "text-xl",
|
|
906
|
-
"2xl": "text-2xl",
|
|
907
|
-
"3xl": "text-3xl",
|
|
908
|
-
"4xl": "text-4xl",
|
|
909
|
-
"5xl": "text-5xl",
|
|
910
|
-
"6xl": "text-6xl"
|
|
911
|
-
};
|
|
912
|
-
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
913
|
-
const weightClassMap = {
|
|
914
|
-
hairline: "font-hairline",
|
|
915
|
-
light: "font-light",
|
|
916
|
-
normal: "font-normal",
|
|
917
|
-
medium: "font-medium",
|
|
918
|
-
semibold: "font-semibold",
|
|
919
|
-
bold: "font-bold",
|
|
920
|
-
extrabold: "font-extrabold",
|
|
921
|
-
black: "font-black"
|
|
922
|
-
};
|
|
923
|
-
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
924
|
-
const baseClasses = "font-primary";
|
|
925
|
-
const Component = as ?? "p";
|
|
926
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
927
|
-
Component,
|
|
1002
|
+
const store = useDropdownStore(externalStore);
|
|
1003
|
+
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
1004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1005
|
+
Button_default,
|
|
928
1006
|
{
|
|
929
|
-
|
|
1007
|
+
variant: "outline",
|
|
1008
|
+
className: cn("w-full", className),
|
|
1009
|
+
disabled,
|
|
1010
|
+
onClick: (e) => {
|
|
1011
|
+
setOpen(false);
|
|
1012
|
+
onClick?.(e);
|
|
1013
|
+
},
|
|
930
1014
|
...props,
|
|
931
|
-
children
|
|
1015
|
+
children: [
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react3.SignOut, {}) }),
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { children: "Sair" })
|
|
1018
|
+
]
|
|
932
1019
|
}
|
|
933
1020
|
);
|
|
934
1021
|
};
|
|
935
|
-
|
|
1022
|
+
ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
1023
|
+
var DropdownMenu_default = DropdownMenu;
|
|
936
1024
|
|
|
937
|
-
// src/components/
|
|
938
|
-
var
|
|
1025
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
1026
|
+
var import_react6 = require("react");
|
|
939
1027
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1028
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
1029
|
+
pulse: "animate-pulse",
|
|
1030
|
+
none: ""
|
|
1031
|
+
};
|
|
1032
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
1033
|
+
text: "h-4 bg-background-200 rounded",
|
|
1034
|
+
circular: "bg-background-200 rounded-full",
|
|
1035
|
+
rectangular: "bg-background-200",
|
|
1036
|
+
rounded: "bg-background-200 rounded-lg"
|
|
1037
|
+
};
|
|
1038
|
+
var SPACING_CLASSES = {
|
|
1039
|
+
none: "",
|
|
1040
|
+
small: "space-y-1",
|
|
1041
|
+
medium: "space-y-2",
|
|
1042
|
+
large: "space-y-3"
|
|
1043
|
+
};
|
|
1044
|
+
var Skeleton = (0, import_react6.forwardRef)(
|
|
1045
|
+
({
|
|
1046
|
+
variant = "text",
|
|
1047
|
+
width,
|
|
1048
|
+
height,
|
|
1049
|
+
animation = "pulse",
|
|
1050
|
+
lines = 1,
|
|
1051
|
+
spacing = "none",
|
|
1052
|
+
className = "",
|
|
1053
|
+
children,
|
|
1054
|
+
...props
|
|
1055
|
+
}, ref) => {
|
|
1056
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
1057
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
1058
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
1059
|
+
const style = {
|
|
1060
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
1061
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
1062
|
+
};
|
|
1063
|
+
if (variant === "text" && lines > 1) {
|
|
1064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1065
|
+
"div",
|
|
1066
|
+
{
|
|
1067
|
+
ref,
|
|
1068
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
1069
|
+
...props,
|
|
1070
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1071
|
+
"div",
|
|
1072
|
+
{
|
|
1073
|
+
className: cn(variantClass, animationClass),
|
|
1074
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
1075
|
+
},
|
|
1076
|
+
index
|
|
1077
|
+
))
|
|
1078
|
+
}
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1082
|
+
"div",
|
|
1083
|
+
{
|
|
1084
|
+
ref,
|
|
1085
|
+
className: cn(variantClass, animationClass, className),
|
|
1086
|
+
style,
|
|
1087
|
+
...props,
|
|
1088
|
+
children
|
|
1089
|
+
}
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
);
|
|
1093
|
+
var SkeletonText = (0, import_react6.forwardRef)(
|
|
1094
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
1095
|
+
);
|
|
1096
|
+
var SkeletonCircle = (0, import_react6.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
1097
|
+
var SkeletonRectangle = (0, import_react6.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
1098
|
+
var SkeletonRounded = (0, import_react6.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
1099
|
+
var SkeletonCard = (0, import_react6.forwardRef)(
|
|
1100
|
+
({
|
|
1101
|
+
showAvatar = true,
|
|
1102
|
+
showTitle = true,
|
|
1103
|
+
showDescription = true,
|
|
1104
|
+
showActions = true,
|
|
1105
|
+
lines = 2,
|
|
1106
|
+
className = "",
|
|
1107
|
+
...props
|
|
1108
|
+
}, ref) => {
|
|
1109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1110
|
+
"div",
|
|
1111
|
+
{
|
|
1112
|
+
ref,
|
|
1113
|
+
className: cn(
|
|
1114
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
1115
|
+
className
|
|
1116
|
+
),
|
|
1117
|
+
...props,
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
1120
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
1122
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
1123
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
1124
|
+
] })
|
|
1125
|
+
] }),
|
|
1126
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
1129
|
+
] })
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1132
|
+
);
|
|
1133
|
+
}
|
|
1134
|
+
);
|
|
1135
|
+
var SkeletonList = (0, import_react6.forwardRef)(
|
|
1136
|
+
({
|
|
1137
|
+
items = 3,
|
|
1138
|
+
showAvatar = true,
|
|
1139
|
+
showTitle = true,
|
|
1140
|
+
showDescription = true,
|
|
1141
|
+
lines = 1,
|
|
1142
|
+
className = "",
|
|
1143
|
+
...props
|
|
1144
|
+
}, ref) => {
|
|
1145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
1146
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
1147
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
1148
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
1149
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
1150
|
+
] })
|
|
1151
|
+
] }, index)) });
|
|
1152
|
+
}
|
|
1153
|
+
);
|
|
1154
|
+
var SkeletonTable = (0, import_react6.forwardRef)(
|
|
1155
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
1156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
1157
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1158
|
+
SkeletonText,
|
|
1159
|
+
{
|
|
1160
|
+
width: `${100 / columns}%`,
|
|
1161
|
+
height: 20
|
|
1162
|
+
},
|
|
1163
|
+
index
|
|
1164
|
+
)) }),
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1166
|
+
SkeletonText,
|
|
1167
|
+
{
|
|
1168
|
+
width: `${100 / columns}%`,
|
|
1169
|
+
height: 16
|
|
1170
|
+
},
|
|
1171
|
+
colIndex
|
|
1172
|
+
)) }, rowIndex)) })
|
|
1173
|
+
] });
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1176
|
+
|
|
1177
|
+
// src/components/IconButton/IconButton.tsx
|
|
1178
|
+
var import_react7 = require("react");
|
|
1179
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1180
|
+
var IconButton = (0, import_react7.forwardRef)(
|
|
1181
|
+
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
1182
|
+
const baseClasses = [
|
|
1183
|
+
"inline-flex",
|
|
1184
|
+
"items-center",
|
|
1185
|
+
"justify-center",
|
|
1186
|
+
"rounded-lg",
|
|
1187
|
+
"font-medium",
|
|
1188
|
+
"bg-transparent",
|
|
1189
|
+
"text-text-950",
|
|
1190
|
+
"cursor-pointer",
|
|
1191
|
+
"hover:bg-primary-600",
|
|
1192
|
+
"hover:text-text",
|
|
1193
|
+
"focus-visible:outline-none",
|
|
1194
|
+
"focus-visible:ring-2",
|
|
1195
|
+
"focus-visible:ring-offset-0",
|
|
1196
|
+
"focus-visible:ring-indicator-info",
|
|
1197
|
+
"disabled:opacity-50",
|
|
1198
|
+
"disabled:cursor-not-allowed",
|
|
1199
|
+
"disabled:pointer-events-none"
|
|
1200
|
+
];
|
|
1201
|
+
const sizeClasses = {
|
|
1202
|
+
sm: ["w-6", "h-6", "text-sm"],
|
|
1203
|
+
md: ["w-10", "h-10", "text-base"]
|
|
1204
|
+
};
|
|
1205
|
+
const activeClasses = active ? ["!bg-primary-50", "!text-primary-950", "hover:!bg-primary-100"] : [];
|
|
1206
|
+
const allClasses = [
|
|
1207
|
+
...baseClasses,
|
|
1208
|
+
...sizeClasses[size],
|
|
1209
|
+
...activeClasses
|
|
1210
|
+
].join(" ");
|
|
1211
|
+
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
1212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1213
|
+
"button",
|
|
1214
|
+
{
|
|
1215
|
+
ref,
|
|
1216
|
+
type: "button",
|
|
1217
|
+
className: cn(allClasses, className),
|
|
1218
|
+
disabled,
|
|
1219
|
+
"aria-pressed": active,
|
|
1220
|
+
"aria-label": ariaLabel,
|
|
1221
|
+
...props,
|
|
1222
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "flex items-center justify-center", children: icon })
|
|
1223
|
+
}
|
|
1224
|
+
);
|
|
1225
|
+
}
|
|
1226
|
+
);
|
|
1227
|
+
IconButton.displayName = "IconButton";
|
|
1228
|
+
var IconButton_default = IconButton;
|
|
1229
|
+
|
|
1230
|
+
// src/components/Badge/Badge.tsx
|
|
1231
|
+
var import_phosphor_react4 = require("phosphor-react");
|
|
1232
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
940
1233
|
var VARIANT_ACTION_CLASSES2 = {
|
|
941
1234
|
solid: {
|
|
942
1235
|
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
@@ -998,14 +1291,14 @@ var Badge = ({
|
|
|
998
1291
|
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
999
1292
|
const baseClassesIcon = "flex items-center";
|
|
1000
1293
|
if (variant === "notification") {
|
|
1001
|
-
return /* @__PURE__ */ (0,
|
|
1294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1002
1295
|
"div",
|
|
1003
1296
|
{
|
|
1004
1297
|
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
1005
1298
|
...props,
|
|
1006
1299
|
children: [
|
|
1007
|
-
/* @__PURE__ */ (0,
|
|
1008
|
-
notificationActive && /* @__PURE__ */ (0,
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
1301
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1009
1302
|
"span",
|
|
1010
1303
|
{
|
|
1011
1304
|
"data-testid": "notification-dot",
|
|
@@ -1016,15 +1309,15 @@ var Badge = ({
|
|
|
1016
1309
|
}
|
|
1017
1310
|
);
|
|
1018
1311
|
}
|
|
1019
|
-
return /* @__PURE__ */ (0,
|
|
1312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1020
1313
|
"div",
|
|
1021
1314
|
{
|
|
1022
1315
|
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
1023
1316
|
...props,
|
|
1024
1317
|
children: [
|
|
1025
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1318
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
1026
1319
|
children,
|
|
1027
|
-
iconRight && /* @__PURE__ */ (0,
|
|
1320
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
1028
1321
|
]
|
|
1029
1322
|
}
|
|
1030
1323
|
);
|
|
@@ -1032,7 +1325,7 @@ var Badge = ({
|
|
|
1032
1325
|
var Badge_default = Badge;
|
|
1033
1326
|
|
|
1034
1327
|
// src/hooks/useMobile.ts
|
|
1035
|
-
var
|
|
1328
|
+
var import_react8 = require("react");
|
|
1036
1329
|
var MOBILE_WIDTH = 500;
|
|
1037
1330
|
var TABLET_WIDTH = 931;
|
|
1038
1331
|
var DEFAULT_WIDTH = 1200;
|
|
@@ -1047,9 +1340,9 @@ var getDeviceType = () => {
|
|
|
1047
1340
|
return width < TABLET_WIDTH ? "responsive" : "desktop";
|
|
1048
1341
|
};
|
|
1049
1342
|
var useMobile = () => {
|
|
1050
|
-
const [isMobile, setIsMobile] = (0,
|
|
1051
|
-
const [isTablet, setIsTablet] = (0,
|
|
1052
|
-
(0,
|
|
1343
|
+
const [isMobile, setIsMobile] = (0, import_react8.useState)(false);
|
|
1344
|
+
const [isTablet, setIsTablet] = (0, import_react8.useState)(false);
|
|
1345
|
+
(0, import_react8.useEffect)(() => {
|
|
1053
1346
|
const checkScreenSize = () => {
|
|
1054
1347
|
const width = getWindowWidth();
|
|
1055
1348
|
setIsMobile(width < MOBILE_WIDTH);
|
|
@@ -1121,14 +1414,14 @@ var formatTimeAgo = (date) => {
|
|
|
1121
1414
|
};
|
|
1122
1415
|
|
|
1123
1416
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
1124
|
-
var
|
|
1417
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1125
1418
|
var NotificationEmpty = ({
|
|
1126
1419
|
emptyStateImage,
|
|
1127
1420
|
emptyStateTitle = "Nenhuma notifica\xE7\xE3o no momento",
|
|
1128
1421
|
emptyStateDescription = "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!"
|
|
1129
1422
|
}) => {
|
|
1130
|
-
return /* @__PURE__ */ (0,
|
|
1131
|
-
emptyStateImage && /* @__PURE__ */ (0,
|
|
1423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
1424
|
+
emptyStateImage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1132
1425
|
"img",
|
|
1133
1426
|
{
|
|
1134
1427
|
src: emptyStateImage,
|
|
@@ -1138,23 +1431,23 @@ var NotificationEmpty = ({
|
|
|
1138
1431
|
className: "object-contain"
|
|
1139
1432
|
}
|
|
1140
1433
|
) }),
|
|
1141
|
-
/* @__PURE__ */ (0,
|
|
1142
|
-
/* @__PURE__ */ (0,
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: emptyStateTitle }),
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-[316px] leading-[21px]", children: emptyStateDescription })
|
|
1143
1436
|
] });
|
|
1144
1437
|
};
|
|
1145
1438
|
var NotificationHeader = ({
|
|
1146
1439
|
unreadCount,
|
|
1147
1440
|
variant = "modal"
|
|
1148
1441
|
}) => {
|
|
1149
|
-
return /* @__PURE__ */ (0,
|
|
1150
|
-
variant === "modal" ? /* @__PURE__ */ (0,
|
|
1151
|
-
unreadCount > 0 && /* @__PURE__ */ (0,
|
|
1442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1443
|
+
variant === "modal" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: "Notifica\xE7\xF5es" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "text-sm font-semibold text-text-950", children: "Notifica\xE7\xF5es" }),
|
|
1444
|
+
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1152
1445
|
Badge_default,
|
|
1153
1446
|
{
|
|
1154
1447
|
variant: "solid",
|
|
1155
1448
|
action: "info",
|
|
1156
1449
|
size: "small",
|
|
1157
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
1450
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_phosphor_react5.Bell, { size: 12, "aria-hidden": "true", focusable: "false" }),
|
|
1158
1451
|
className: "border-0",
|
|
1159
1452
|
children: unreadCount === 1 ? "1 n\xE3o lida" : `${unreadCount} n\xE3o lidas`
|
|
1160
1453
|
}
|
|
@@ -1190,7 +1483,7 @@ var SingleNotificationCard = ({
|
|
|
1190
1483
|
onNavigate();
|
|
1191
1484
|
}
|
|
1192
1485
|
};
|
|
1193
|
-
return /* @__PURE__ */ (0,
|
|
1486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1194
1487
|
"div",
|
|
1195
1488
|
{
|
|
1196
1489
|
className: cn(
|
|
@@ -1199,20 +1492,20 @@ var SingleNotificationCard = ({
|
|
|
1199
1492
|
className
|
|
1200
1493
|
),
|
|
1201
1494
|
children: [
|
|
1202
|
-
/* @__PURE__ */ (0,
|
|
1203
|
-
!isRead && /* @__PURE__ */ (0,
|
|
1204
|
-
/* @__PURE__ */ (0,
|
|
1205
|
-
/* @__PURE__ */ (0,
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1495
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-2 w-full", children: [
|
|
1496
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenu_default, { children: [
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1207
1500
|
DropdownMenuTrigger,
|
|
1208
1501
|
{
|
|
1209
1502
|
className: "flex-shrink-0 inline-flex items-center justify-center font-medium bg-transparent text-text-950 cursor-pointer hover:bg-info-50 w-6 h-6 rounded-lg",
|
|
1210
1503
|
"aria-label": "Menu de a\xE7\xF5es",
|
|
1211
|
-
children: /* @__PURE__ */ (0,
|
|
1504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_phosphor_react5.DotsThreeVertical, { size: 24 })
|
|
1212
1505
|
}
|
|
1213
1506
|
),
|
|
1214
|
-
/* @__PURE__ */ (0,
|
|
1215
|
-
!isRead && /* @__PURE__ */ (0,
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
1508
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1216
1509
|
DropdownMenuItem,
|
|
1217
1510
|
{
|
|
1218
1511
|
onClick: handleMarkAsRead,
|
|
@@ -1220,14 +1513,14 @@ var SingleNotificationCard = ({
|
|
|
1220
1513
|
children: "Marcar como lida"
|
|
1221
1514
|
}
|
|
1222
1515
|
),
|
|
1223
|
-
/* @__PURE__ */ (0,
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
1224
1517
|
] })
|
|
1225
1518
|
] })
|
|
1226
1519
|
] }),
|
|
1227
|
-
/* @__PURE__ */ (0,
|
|
1228
|
-
/* @__PURE__ */ (0,
|
|
1229
|
-
/* @__PURE__ */ (0,
|
|
1230
|
-
onNavigate && actionLabel && /* @__PURE__ */ (0,
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
1523
|
+
onNavigate && actionLabel && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1231
1524
|
"button",
|
|
1232
1525
|
{
|
|
1233
1526
|
type: "button",
|
|
@@ -1254,9 +1547,9 @@ var NotificationList = ({
|
|
|
1254
1547
|
className
|
|
1255
1548
|
}) => {
|
|
1256
1549
|
if (error) {
|
|
1257
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1259
|
-
onRetry && /* @__PURE__ */ (0,
|
|
1550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
1551
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm text-error-600", children: error }),
|
|
1552
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1260
1553
|
"button",
|
|
1261
1554
|
{
|
|
1262
1555
|
type: "button",
|
|
@@ -1268,8 +1561,8 @@ var NotificationList = ({
|
|
|
1268
1561
|
] });
|
|
1269
1562
|
}
|
|
1270
1563
|
if (loading) {
|
|
1271
|
-
return /* @__PURE__ */ (0,
|
|
1272
|
-
(skeletonId) => /* @__PURE__ */ (0,
|
|
1564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
1565
|
+
(skeletonId) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1273
1566
|
SkeletonCard,
|
|
1274
1567
|
{
|
|
1275
1568
|
className: "p-4 border-b border-border-200"
|
|
@@ -1279,11 +1572,11 @@ var NotificationList = ({
|
|
|
1279
1572
|
) });
|
|
1280
1573
|
}
|
|
1281
1574
|
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
1282
|
-
return renderEmpty ? /* @__PURE__ */ (0,
|
|
1575
|
+
return renderEmpty ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NotificationEmpty, {});
|
|
1283
1576
|
}
|
|
1284
|
-
return /* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
group.notifications.map((notification) => /* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col", children: [
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
1579
|
+
group.notifications.map((notification) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1287
1580
|
SingleNotificationCard,
|
|
1288
1581
|
{
|
|
1289
1582
|
title: notification.title,
|
|
@@ -1324,7 +1617,7 @@ var NotificationCenter = ({
|
|
|
1324
1617
|
className
|
|
1325
1618
|
}) => {
|
|
1326
1619
|
const { isMobile } = useMobile();
|
|
1327
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
1620
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react9.useState)(false);
|
|
1328
1621
|
const handleMobileClick = () => {
|
|
1329
1622
|
setIsModalOpen(true);
|
|
1330
1623
|
onFetchNotifications?.();
|
|
@@ -1332,7 +1625,7 @@ var NotificationCenter = ({
|
|
|
1332
1625
|
const handleDesktopClick = () => {
|
|
1333
1626
|
onToggleActive?.();
|
|
1334
1627
|
};
|
|
1335
|
-
(0,
|
|
1628
|
+
(0, import_react9.useEffect)(() => {
|
|
1336
1629
|
if (isActive) {
|
|
1337
1630
|
onFetchNotifications?.();
|
|
1338
1631
|
}
|
|
@@ -1341,7 +1634,7 @@ var NotificationCenter = ({
|
|
|
1341
1634
|
onCleanup?.();
|
|
1342
1635
|
onNavigateById?.(entityType, entityId);
|
|
1343
1636
|
};
|
|
1344
|
-
const renderEmptyState = () => /* @__PURE__ */ (0,
|
|
1637
|
+
const renderEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1345
1638
|
NotificationEmpty,
|
|
1346
1639
|
{
|
|
1347
1640
|
emptyStateImage,
|
|
@@ -1350,17 +1643,17 @@ var NotificationCenter = ({
|
|
|
1350
1643
|
}
|
|
1351
1644
|
);
|
|
1352
1645
|
if (isMobile) {
|
|
1353
|
-
return /* @__PURE__ */ (0,
|
|
1354
|
-
/* @__PURE__ */ (0,
|
|
1646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1355
1648
|
IconButton_default,
|
|
1356
1649
|
{
|
|
1357
1650
|
active: isModalOpen,
|
|
1358
1651
|
onClick: handleMobileClick,
|
|
1359
|
-
icon: /* @__PURE__ */ (0,
|
|
1652
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_phosphor_react5.Bell, { size: 24, className: "text-primary" }),
|
|
1360
1653
|
className
|
|
1361
1654
|
}
|
|
1362
1655
|
),
|
|
1363
|
-
/* @__PURE__ */ (0,
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1364
1657
|
Modal_default,
|
|
1365
1658
|
{
|
|
1366
1659
|
isOpen: isModalOpen,
|
|
@@ -1369,10 +1662,10 @@ var NotificationCenter = ({
|
|
|
1369
1662
|
size: "md",
|
|
1370
1663
|
hideCloseButton: false,
|
|
1371
1664
|
closeOnEscape: true,
|
|
1372
|
-
children: /* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1375
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
1665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-0 pb-3 border-b border-border-200", children: [
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NotificationHeader, { unreadCount, variant: "modal" }),
|
|
1668
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1376
1669
|
"button",
|
|
1377
1670
|
{
|
|
1378
1671
|
type: "button",
|
|
@@ -1382,7 +1675,7 @@ var NotificationCenter = ({
|
|
|
1382
1675
|
}
|
|
1383
1676
|
)
|
|
1384
1677
|
] }),
|
|
1385
|
-
/* @__PURE__ */ (0,
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1386
1679
|
NotificationList,
|
|
1387
1680
|
{
|
|
1388
1681
|
groupedNotifications,
|
|
@@ -1405,14 +1698,14 @@ var NotificationCenter = ({
|
|
|
1405
1698
|
)
|
|
1406
1699
|
] });
|
|
1407
1700
|
}
|
|
1408
|
-
return /* @__PURE__ */ (0,
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenu_default, { children: [
|
|
1702
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuTrigger, { className: "text-primary cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1410
1703
|
IconButton_default,
|
|
1411
1704
|
{
|
|
1412
1705
|
active: isActive,
|
|
1413
1706
|
onClick: handleDesktopClick,
|
|
1414
|
-
icon: /* @__PURE__ */ (0,
|
|
1415
|
-
|
|
1707
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1708
|
+
import_phosphor_react5.Bell,
|
|
1416
1709
|
{
|
|
1417
1710
|
size: 24,
|
|
1418
1711
|
className: isActive ? "text-primary-950" : "text-primary"
|
|
@@ -1421,16 +1714,16 @@ var NotificationCenter = ({
|
|
|
1421
1714
|
className
|
|
1422
1715
|
}
|
|
1423
1716
|
) }),
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1425
1718
|
DropdownMenuContent,
|
|
1426
1719
|
{
|
|
1427
1720
|
className: "min-w-[320px] max-w-[400px] max-h-[500px] overflow-hidden",
|
|
1428
1721
|
side: "bottom",
|
|
1429
1722
|
align: "end",
|
|
1430
|
-
children: /* @__PURE__ */ (0,
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1433
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
1723
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col", children: [
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "px-4 py-3 border-b border-border-200", children: [
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NotificationHeader, { unreadCount, variant: "dropdown" }),
|
|
1726
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1434
1727
|
"button",
|
|
1435
1728
|
{
|
|
1436
1729
|
type: "button",
|
|
@@ -1440,7 +1733,7 @@ var NotificationCenter = ({
|
|
|
1440
1733
|
}
|
|
1441
1734
|
)
|
|
1442
1735
|
] }),
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1444
1737
|
NotificationList,
|
|
1445
1738
|
{
|
|
1446
1739
|
groupedNotifications,
|
|
@@ -1462,7 +1755,7 @@ var NotificationCenter = ({
|
|
|
1462
1755
|
var NotificationCard = (props) => {
|
|
1463
1756
|
switch (props.mode) {
|
|
1464
1757
|
case "single":
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
1758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1466
1759
|
SingleNotificationCard,
|
|
1467
1760
|
{
|
|
1468
1761
|
title: props.title,
|
|
@@ -1477,7 +1770,7 @@ var NotificationCard = (props) => {
|
|
|
1477
1770
|
}
|
|
1478
1771
|
);
|
|
1479
1772
|
case "list":
|
|
1480
|
-
return /* @__PURE__ */ (0,
|
|
1773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1481
1774
|
NotificationList,
|
|
1482
1775
|
{
|
|
1483
1776
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1498,9 +1791,9 @@ var NotificationCard = (props) => {
|
|
|
1498
1791
|
}
|
|
1499
1792
|
);
|
|
1500
1793
|
case "center":
|
|
1501
|
-
return /* @__PURE__ */ (0,
|
|
1794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NotificationCenter, { ...props });
|
|
1502
1795
|
default:
|
|
1503
|
-
return /* @__PURE__ */ (0,
|
|
1796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm text-text-600", children: "Modo de notifica\xE7\xE3o n\xE3o reconhecido" }) });
|
|
1504
1797
|
}
|
|
1505
1798
|
};
|
|
1506
1799
|
var LegacyNotificationCard = (props) => {
|
|
@@ -1509,10 +1802,10 @@ var LegacyNotificationCard = (props) => {
|
|
|
1509
1802
|
mode: "center",
|
|
1510
1803
|
...props
|
|
1511
1804
|
};
|
|
1512
|
-
return /* @__PURE__ */ (0,
|
|
1805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NotificationCenter, { ...centerProps });
|
|
1513
1806
|
}
|
|
1514
1807
|
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
1515
|
-
return /* @__PURE__ */ (0,
|
|
1808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1516
1809
|
NotificationList,
|
|
1517
1810
|
{
|
|
1518
1811
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1549,7 +1842,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1549
1842
|
emptyStateTitle: props.emptyStateTitle,
|
|
1550
1843
|
emptyStateDescription: props.emptyStateDescription
|
|
1551
1844
|
};
|
|
1552
|
-
return /* @__PURE__ */ (0,
|
|
1845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1553
1846
|
SingleNotificationCard,
|
|
1554
1847
|
{
|
|
1555
1848
|
title: singleProps.title,
|
|
@@ -1564,7 +1857,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1564
1857
|
}
|
|
1565
1858
|
);
|
|
1566
1859
|
}
|
|
1567
|
-
return /* @__PURE__ */ (0,
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
1568
1861
|
};
|
|
1569
1862
|
var NotificationCard_default = NotificationCard;
|
|
1570
1863
|
// Annotate the CommonJS export names for ESM import in node:
|