analytica-frontend-lib 1.1.21 → 1.1.23
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/Accordation/index.js +1 -1
- package/dist/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs +1 -1
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/Card/index.js +1 -1
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +1 -1
- package/dist/Card/index.mjs.map +1 -1
- package/dist/LoadingModal/index.d.mts +11 -0
- package/dist/LoadingModal/index.d.ts +11 -0
- package/dist/LoadingModal/index.js +79 -0
- package/dist/LoadingModal/index.js.map +1 -0
- package/dist/LoadingModal/index.mjs +58 -0
- package/dist/LoadingModal/index.mjs.map +1 -0
- package/dist/NotificationCard/index.d.mts +104 -0
- package/dist/NotificationCard/index.d.ts +104 -0
- package/dist/NotificationCard/index.js +799 -0
- package/dist/NotificationCard/index.js.map +1 -0
- package/dist/NotificationCard/index.mjs +786 -0
- package/dist/NotificationCard/index.mjs.map +1 -0
- package/dist/Quiz/index.js +3 -14
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +3 -14
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/index.css +49 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +257 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +255 -14
- package/dist/index.mjs.map +1 -1
- package/dist/no-notification-result-7Y3ACV6V.png +0 -0
- package/dist/styles.css +49 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
21
|
+
var NotificationCard_exports = {};
|
|
22
|
+
__export(NotificationCard_exports, {
|
|
23
|
+
default: () => NotificationCard_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(NotificationCard_exports);
|
|
26
|
+
var import_phosphor_react2 = require("phosphor-react");
|
|
27
|
+
|
|
28
|
+
// src/utils/utils.ts
|
|
29
|
+
var import_clsx = require("clsx");
|
|
30
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
31
|
+
function cn(...inputs) {
|
|
32
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/assets/img/no-notification-result.png
|
|
36
|
+
var no_notification_result_default = "../no-notification-result-7Y3ACV6V.png";
|
|
37
|
+
|
|
38
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
39
|
+
var import_phosphor_react = require("phosphor-react");
|
|
40
|
+
var import_react = require("react");
|
|
41
|
+
var import_zustand = require("zustand");
|
|
42
|
+
|
|
43
|
+
// src/components/Button/Button.tsx
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var VARIANT_ACTION_CLASSES = {
|
|
46
|
+
solid: {
|
|
47
|
+
primary: "bg-primary-950 text-text border border-primary-950 hover:bg-primary-800 hover:border-primary-800 focus-visible:outline-none focus-visible:bg-primary-950 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-primary-700 active:border-primary-700 disabled:bg-primary-500 disabled:border-primary-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
48
|
+
positive: "bg-success-500 text-text border border-success-500 hover:bg-success-600 hover:border-success-600 focus-visible:outline-none focus-visible:bg-success-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-success-700 active:border-success-700 disabled:bg-success-500 disabled:border-success-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
49
|
+
negative: "bg-error-500 text-text border border-error-500 hover:bg-error-600 hover:border-error-600 focus-visible:outline-none focus-visible:bg-error-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-error-700 active:border-error-700 disabled:bg-error-500 disabled:border-error-500 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
50
|
+
},
|
|
51
|
+
outline: {
|
|
52
|
+
primary: "bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
53
|
+
positive: "bg-transparent text-success-500 border border-success-300 hover:bg-background-50 hover:text-success-400 hover:border-success-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 active:border-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
54
|
+
negative: "bg-transparent text-error-500 border border-error-300 hover:bg-background-50 hover:text-error-400 hover:border-error-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 active:border-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
55
|
+
},
|
|
56
|
+
link: {
|
|
57
|
+
primary: "bg-transparent text-primary-950 hover:text-primary-400 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
58
|
+
positive: "bg-transparent text-success-500 hover:text-success-400 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
59
|
+
negative: "bg-transparent text-error-500 hover:text-error-400 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var SIZE_CLASSES = {
|
|
63
|
+
"extra-small": "text-xs px-3.5 py-2",
|
|
64
|
+
small: "text-sm px-4 py-2.5",
|
|
65
|
+
medium: "text-md px-5 py-2.5",
|
|
66
|
+
large: "text-lg px-6 py-3",
|
|
67
|
+
"extra-large": "text-lg px-7 py-3.5"
|
|
68
|
+
};
|
|
69
|
+
var Button = ({
|
|
70
|
+
children,
|
|
71
|
+
iconLeft,
|
|
72
|
+
iconRight,
|
|
73
|
+
size = "medium",
|
|
74
|
+
variant = "solid",
|
|
75
|
+
action = "primary",
|
|
76
|
+
className = "",
|
|
77
|
+
disabled,
|
|
78
|
+
type = "button",
|
|
79
|
+
...props
|
|
80
|
+
}) => {
|
|
81
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
82
|
+
const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
|
|
83
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
88
|
+
disabled,
|
|
89
|
+
type,
|
|
90
|
+
...props,
|
|
91
|
+
children: [
|
|
92
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mr-2 flex items-center", children: iconLeft }),
|
|
93
|
+
children,
|
|
94
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ml-2 flex items-center", children: iconRight })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
var Button_default = Button;
|
|
100
|
+
|
|
101
|
+
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
102
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
103
|
+
function createDropdownStore() {
|
|
104
|
+
return (0, import_zustand.create)((set) => ({
|
|
105
|
+
open: false,
|
|
106
|
+
setOpen: (open) => set({ open })
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
var useDropdownStore = (externalStore) => {
|
|
110
|
+
if (!externalStore) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
"Component must be used within a DropdownMenu (store is missing)"
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return externalStore;
|
|
116
|
+
};
|
|
117
|
+
var injectStore = (children, store) => {
|
|
118
|
+
return import_react.Children.map(children, (child) => {
|
|
119
|
+
if ((0, import_react.isValidElement)(child)) {
|
|
120
|
+
const typedChild = child;
|
|
121
|
+
const newProps = {
|
|
122
|
+
store
|
|
123
|
+
};
|
|
124
|
+
if (typedChild.props.children) {
|
|
125
|
+
newProps.children = injectStore(typedChild.props.children, store);
|
|
126
|
+
}
|
|
127
|
+
return (0, import_react.cloneElement)(typedChild, newProps);
|
|
128
|
+
}
|
|
129
|
+
return child;
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
var DropdownMenu = ({
|
|
133
|
+
children,
|
|
134
|
+
open: propOpen,
|
|
135
|
+
onOpenChange
|
|
136
|
+
}) => {
|
|
137
|
+
const storeRef = (0, import_react.useRef)(null);
|
|
138
|
+
storeRef.current ??= createDropdownStore();
|
|
139
|
+
const store = storeRef.current;
|
|
140
|
+
const { open, setOpen: storeSetOpen } = (0, import_zustand.useStore)(store, (s) => s);
|
|
141
|
+
const setOpen = (newOpen) => {
|
|
142
|
+
storeSetOpen(newOpen);
|
|
143
|
+
};
|
|
144
|
+
const menuRef = (0, import_react.useRef)(null);
|
|
145
|
+
const handleArrowDownOrArrowUp = (event) => {
|
|
146
|
+
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
147
|
+
if (menuContent) {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
const items = Array.from(
|
|
150
|
+
menuContent.querySelectorAll(
|
|
151
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
152
|
+
)
|
|
153
|
+
).filter((el) => el instanceof HTMLElement);
|
|
154
|
+
if (items.length === 0) return;
|
|
155
|
+
const focusedItem = document.activeElement;
|
|
156
|
+
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
157
|
+
let nextIndex;
|
|
158
|
+
if (event.key === "ArrowDown") {
|
|
159
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
160
|
+
} else {
|
|
161
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
162
|
+
}
|
|
163
|
+
items[nextIndex]?.focus();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const handleDownkey = (event) => {
|
|
167
|
+
if (event.key === "Escape") {
|
|
168
|
+
setOpen(false);
|
|
169
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
170
|
+
handleArrowDownOrArrowUp(event);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const handleClickOutside = (event) => {
|
|
174
|
+
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
175
|
+
setOpen(false);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
(0, import_react.useEffect)(() => {
|
|
179
|
+
if (open) {
|
|
180
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
181
|
+
document.addEventListener("keydown", handleDownkey);
|
|
182
|
+
}
|
|
183
|
+
return () => {
|
|
184
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
185
|
+
document.removeEventListener("keydown", handleDownkey);
|
|
186
|
+
};
|
|
187
|
+
}, [open]);
|
|
188
|
+
(0, import_react.useEffect)(() => {
|
|
189
|
+
setOpen(open);
|
|
190
|
+
onOpenChange?.(open);
|
|
191
|
+
}, [open, onOpenChange]);
|
|
192
|
+
(0, import_react.useEffect)(() => {
|
|
193
|
+
if (propOpen) {
|
|
194
|
+
setOpen(propOpen);
|
|
195
|
+
}
|
|
196
|
+
}, [propOpen]);
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
198
|
+
};
|
|
199
|
+
var DropdownMenuTrigger = ({
|
|
200
|
+
className,
|
|
201
|
+
children,
|
|
202
|
+
onClick,
|
|
203
|
+
store: externalStore,
|
|
204
|
+
...props
|
|
205
|
+
}) => {
|
|
206
|
+
const store = useDropdownStore(externalStore);
|
|
207
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
208
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
onClick: (e) => {
|
|
213
|
+
e.stopPropagation();
|
|
214
|
+
toggleOpen();
|
|
215
|
+
if (onClick) onClick(e);
|
|
216
|
+
},
|
|
217
|
+
"aria-expanded": open,
|
|
218
|
+
className: cn(className),
|
|
219
|
+
...props,
|
|
220
|
+
children
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
225
|
+
var ITEM_SIZE_CLASSES = {
|
|
226
|
+
small: "text-sm",
|
|
227
|
+
medium: "text-md"
|
|
228
|
+
};
|
|
229
|
+
var SIDE_CLASSES = {
|
|
230
|
+
top: "bottom-full",
|
|
231
|
+
right: "top-full",
|
|
232
|
+
bottom: "top-full",
|
|
233
|
+
left: "top-full"
|
|
234
|
+
};
|
|
235
|
+
var ALIGN_CLASSES = {
|
|
236
|
+
start: "left-0",
|
|
237
|
+
center: "left-1/2 -translate-x-1/2",
|
|
238
|
+
end: "right-0"
|
|
239
|
+
};
|
|
240
|
+
var MENUCONTENT_VARIANT_CLASSES = {
|
|
241
|
+
menu: "p-1",
|
|
242
|
+
profile: "p-6"
|
|
243
|
+
};
|
|
244
|
+
var MenuLabel = (0, import_react.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
ref,
|
|
249
|
+
className: cn("text-sm w-full", inset ? "pl-8" : "", className),
|
|
250
|
+
...props
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
MenuLabel.displayName = "MenuLabel";
|
|
255
|
+
var DropdownMenuContent = (0, import_react.forwardRef)(
|
|
256
|
+
({
|
|
257
|
+
className,
|
|
258
|
+
align = "start",
|
|
259
|
+
side = "bottom",
|
|
260
|
+
variant = "menu",
|
|
261
|
+
sideOffset = 4,
|
|
262
|
+
children,
|
|
263
|
+
store: externalStore,
|
|
264
|
+
...props
|
|
265
|
+
}, ref) => {
|
|
266
|
+
const store = useDropdownStore(externalStore);
|
|
267
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
268
|
+
const [isVisible, setIsVisible] = (0, import_react.useState)(open);
|
|
269
|
+
(0, import_react.useEffect)(() => {
|
|
270
|
+
if (open) {
|
|
271
|
+
setIsVisible(true);
|
|
272
|
+
} else {
|
|
273
|
+
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
274
|
+
return () => clearTimeout(timer);
|
|
275
|
+
}
|
|
276
|
+
}, [open]);
|
|
277
|
+
if (!isVisible) return null;
|
|
278
|
+
const getPositionClasses = () => {
|
|
279
|
+
const vertical = SIDE_CLASSES[side];
|
|
280
|
+
const horizontal = ALIGN_CLASSES[align];
|
|
281
|
+
return `absolute ${vertical} ${horizontal}`;
|
|
282
|
+
};
|
|
283
|
+
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
ref,
|
|
288
|
+
role: "menu",
|
|
289
|
+
className: `
|
|
290
|
+
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
|
|
291
|
+
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
292
|
+
${getPositionClasses()}
|
|
293
|
+
${variantClasses}
|
|
294
|
+
${className}
|
|
295
|
+
`,
|
|
296
|
+
style: {
|
|
297
|
+
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
298
|
+
marginBottom: side === "top" ? sideOffset : void 0,
|
|
299
|
+
marginLeft: side === "right" ? sideOffset : void 0,
|
|
300
|
+
marginRight: side === "left" ? sideOffset : void 0
|
|
301
|
+
},
|
|
302
|
+
...props,
|
|
303
|
+
children
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
DropdownMenuContent.displayName = "DropdownMenuContent";
|
|
309
|
+
var DropdownMenuItem = (0, import_react.forwardRef)(
|
|
310
|
+
({
|
|
311
|
+
className,
|
|
312
|
+
size = "small",
|
|
313
|
+
children,
|
|
314
|
+
iconRight,
|
|
315
|
+
iconLeft,
|
|
316
|
+
disabled = false,
|
|
317
|
+
onClick,
|
|
318
|
+
variant = "menu",
|
|
319
|
+
store: externalStore,
|
|
320
|
+
...props
|
|
321
|
+
}, ref) => {
|
|
322
|
+
const store = useDropdownStore(externalStore);
|
|
323
|
+
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
324
|
+
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
325
|
+
const handleClick = (e) => {
|
|
326
|
+
if (disabled) {
|
|
327
|
+
e.preventDefault();
|
|
328
|
+
e.stopPropagation();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
onClick?.(e);
|
|
332
|
+
setOpen(false);
|
|
333
|
+
};
|
|
334
|
+
const getVariantClasses = () => {
|
|
335
|
+
if (variant === "profile") {
|
|
336
|
+
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";
|
|
337
|
+
}
|
|
338
|
+
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";
|
|
339
|
+
};
|
|
340
|
+
const getVariantProps = () => {
|
|
341
|
+
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
342
|
+
};
|
|
343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
344
|
+
"div",
|
|
345
|
+
{
|
|
346
|
+
ref,
|
|
347
|
+
role: "menuitem",
|
|
348
|
+
...getVariantProps(),
|
|
349
|
+
"aria-disabled": disabled,
|
|
350
|
+
className: `
|
|
351
|
+
focus-visible:bg-background-50
|
|
352
|
+
${getVariantClasses()}
|
|
353
|
+
${sizeClasses}
|
|
354
|
+
${className}
|
|
355
|
+
${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"}
|
|
356
|
+
`,
|
|
357
|
+
onClick: handleClick,
|
|
358
|
+
onKeyDown: (e) => {
|
|
359
|
+
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
360
|
+
},
|
|
361
|
+
tabIndex: disabled ? -1 : 0,
|
|
362
|
+
...props,
|
|
363
|
+
children: [
|
|
364
|
+
iconLeft,
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "w-full text-md", children }),
|
|
366
|
+
iconRight
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
373
|
+
var DropdownMenuSeparator = (0, import_react.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
374
|
+
"div",
|
|
375
|
+
{
|
|
376
|
+
ref,
|
|
377
|
+
className: cn("my-1 h-px bg-border-200", className),
|
|
378
|
+
...props
|
|
379
|
+
}
|
|
380
|
+
));
|
|
381
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
382
|
+
var ProfileMenuTrigger = (0, import_react.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
383
|
+
const store = useDropdownStore(externalStore);
|
|
384
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
385
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
387
|
+
"button",
|
|
388
|
+
{
|
|
389
|
+
ref,
|
|
390
|
+
className: cn(
|
|
391
|
+
"rounded-lg size-10 bg-primary-50 flex items-center justify-center cursor-pointer",
|
|
392
|
+
className
|
|
393
|
+
),
|
|
394
|
+
onClick: (e) => {
|
|
395
|
+
e.stopPropagation();
|
|
396
|
+
toggleOpen();
|
|
397
|
+
onClick?.(e);
|
|
398
|
+
},
|
|
399
|
+
"aria-expanded": open,
|
|
400
|
+
...props,
|
|
401
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.User, { className: "text-primary-950", size: 18 }) })
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
});
|
|
405
|
+
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
406
|
+
var ProfileMenuHeader = (0, import_react.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
|
|
407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
408
|
+
"div",
|
|
409
|
+
{
|
|
410
|
+
ref,
|
|
411
|
+
"data-component": "ProfileMenuHeader",
|
|
412
|
+
className: cn("flex flex-row gap-4 items-center", className),
|
|
413
|
+
...props,
|
|
414
|
+
children: [
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "size-16 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.User, { size: 34, className: "text-primary-950" }) }),
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col ", children: [
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
|
|
418
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "text-md text-text-600", children: email })
|
|
419
|
+
] })
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
});
|
|
424
|
+
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
425
|
+
var ProfileMenuSection = (0, import_react.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
|
|
427
|
+
});
|
|
428
|
+
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
429
|
+
var ProfileMenuFooter = ({
|
|
430
|
+
className,
|
|
431
|
+
disabled = false,
|
|
432
|
+
onClick,
|
|
433
|
+
store: externalStore,
|
|
434
|
+
...props
|
|
435
|
+
}) => {
|
|
436
|
+
const store = useDropdownStore(externalStore);
|
|
437
|
+
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
439
|
+
Button_default,
|
|
440
|
+
{
|
|
441
|
+
variant: "outline",
|
|
442
|
+
className: cn("w-full", className),
|
|
443
|
+
disabled,
|
|
444
|
+
onClick: (e) => {
|
|
445
|
+
setOpen(false);
|
|
446
|
+
onClick?.(e);
|
|
447
|
+
},
|
|
448
|
+
...props,
|
|
449
|
+
children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_phosphor_react.SignOut, {}) }),
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Sair" })
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
);
|
|
455
|
+
};
|
|
456
|
+
ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
457
|
+
var DropdownMenu_default = DropdownMenu;
|
|
458
|
+
|
|
459
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
460
|
+
var import_react2 = require("react");
|
|
461
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
462
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
463
|
+
pulse: "animate-pulse",
|
|
464
|
+
none: ""
|
|
465
|
+
};
|
|
466
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
467
|
+
text: "h-4 bg-background-200 rounded",
|
|
468
|
+
circular: "bg-background-200 rounded-full",
|
|
469
|
+
rectangular: "bg-background-200",
|
|
470
|
+
rounded: "bg-background-200 rounded-lg"
|
|
471
|
+
};
|
|
472
|
+
var SPACING_CLASSES = {
|
|
473
|
+
none: "",
|
|
474
|
+
small: "space-y-1",
|
|
475
|
+
medium: "space-y-2",
|
|
476
|
+
large: "space-y-3"
|
|
477
|
+
};
|
|
478
|
+
var Skeleton = (0, import_react2.forwardRef)(
|
|
479
|
+
({
|
|
480
|
+
variant = "text",
|
|
481
|
+
width,
|
|
482
|
+
height,
|
|
483
|
+
animation = "pulse",
|
|
484
|
+
lines = 1,
|
|
485
|
+
spacing = "none",
|
|
486
|
+
className = "",
|
|
487
|
+
children,
|
|
488
|
+
...props
|
|
489
|
+
}, ref) => {
|
|
490
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
491
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
492
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
493
|
+
const style = {
|
|
494
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
495
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
496
|
+
};
|
|
497
|
+
if (variant === "text" && lines > 1) {
|
|
498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
499
|
+
"div",
|
|
500
|
+
{
|
|
501
|
+
ref,
|
|
502
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
503
|
+
...props,
|
|
504
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
505
|
+
"div",
|
|
506
|
+
{
|
|
507
|
+
className: cn(variantClass, animationClass),
|
|
508
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
509
|
+
},
|
|
510
|
+
index
|
|
511
|
+
))
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
516
|
+
"div",
|
|
517
|
+
{
|
|
518
|
+
ref,
|
|
519
|
+
className: cn(variantClass, animationClass, className),
|
|
520
|
+
style,
|
|
521
|
+
...props,
|
|
522
|
+
children
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
var SkeletonText = (0, import_react2.forwardRef)(
|
|
528
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
529
|
+
);
|
|
530
|
+
var SkeletonCircle = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
531
|
+
var SkeletonRectangle = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
532
|
+
var SkeletonRounded = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
533
|
+
var SkeletonCard = (0, import_react2.forwardRef)(
|
|
534
|
+
({
|
|
535
|
+
showAvatar = true,
|
|
536
|
+
showTitle = true,
|
|
537
|
+
showDescription = true,
|
|
538
|
+
showActions = true,
|
|
539
|
+
lines = 2,
|
|
540
|
+
className = "",
|
|
541
|
+
...props
|
|
542
|
+
}, ref) => {
|
|
543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
544
|
+
"div",
|
|
545
|
+
{
|
|
546
|
+
ref,
|
|
547
|
+
className: cn(
|
|
548
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
549
|
+
className
|
|
550
|
+
),
|
|
551
|
+
...props,
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
554
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
556
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
557
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
558
|
+
] })
|
|
559
|
+
] }),
|
|
560
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
561
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
562
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
563
|
+
] })
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
var SkeletonList = (0, import_react2.forwardRef)(
|
|
570
|
+
({
|
|
571
|
+
items = 3,
|
|
572
|
+
showAvatar = true,
|
|
573
|
+
showTitle = true,
|
|
574
|
+
showDescription = true,
|
|
575
|
+
lines = 1,
|
|
576
|
+
className = "",
|
|
577
|
+
...props
|
|
578
|
+
}, ref) => {
|
|
579
|
+
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: [
|
|
580
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
582
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
583
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
584
|
+
] })
|
|
585
|
+
] }, index)) });
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
var SkeletonTable = (0, import_react2.forwardRef)(
|
|
589
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
591
|
+
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)(
|
|
592
|
+
SkeletonText,
|
|
593
|
+
{
|
|
594
|
+
width: `${100 / columns}%`,
|
|
595
|
+
height: 20
|
|
596
|
+
},
|
|
597
|
+
index
|
|
598
|
+
)) }),
|
|
599
|
+
/* @__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)(
|
|
600
|
+
SkeletonText,
|
|
601
|
+
{
|
|
602
|
+
width: `${100 / columns}%`,
|
|
603
|
+
height: 16
|
|
604
|
+
},
|
|
605
|
+
colIndex
|
|
606
|
+
)) }, rowIndex)) })
|
|
607
|
+
] });
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
612
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
613
|
+
var SingleNotificationCard = ({
|
|
614
|
+
title,
|
|
615
|
+
message,
|
|
616
|
+
time,
|
|
617
|
+
isRead,
|
|
618
|
+
onMarkAsRead,
|
|
619
|
+
onDelete,
|
|
620
|
+
onNavigate,
|
|
621
|
+
actionLabel,
|
|
622
|
+
className
|
|
623
|
+
}) => {
|
|
624
|
+
const handleMarkAsRead = (e) => {
|
|
625
|
+
e.preventDefault();
|
|
626
|
+
e.stopPropagation();
|
|
627
|
+
if (!isRead) {
|
|
628
|
+
onMarkAsRead();
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
const handleDelete = (e) => {
|
|
632
|
+
e.preventDefault();
|
|
633
|
+
e.stopPropagation();
|
|
634
|
+
onDelete();
|
|
635
|
+
};
|
|
636
|
+
const handleNavigate = (e) => {
|
|
637
|
+
e.stopPropagation();
|
|
638
|
+
if (onNavigate) {
|
|
639
|
+
onNavigate();
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
643
|
+
"div",
|
|
644
|
+
{
|
|
645
|
+
className: cn(
|
|
646
|
+
"flex flex-col justify-center items-start p-4 gap-2 w-full bg-background border-b border-border-200",
|
|
647
|
+
"last:border-b-0",
|
|
648
|
+
className
|
|
649
|
+
),
|
|
650
|
+
children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-2 w-full", children: [
|
|
652
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
654
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(DropdownMenu_default, { children: [
|
|
655
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
656
|
+
DropdownMenuTrigger,
|
|
657
|
+
{
|
|
658
|
+
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",
|
|
659
|
+
"aria-label": "Menu de a\xE7\xF5es",
|
|
660
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_phosphor_react2.DotsThreeVertical, { size: 24 })
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
664
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
665
|
+
DropdownMenuItem,
|
|
666
|
+
{
|
|
667
|
+
onClick: handleMarkAsRead,
|
|
668
|
+
className: "text-text-950",
|
|
669
|
+
children: "Marcar como lida"
|
|
670
|
+
}
|
|
671
|
+
),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
673
|
+
] })
|
|
674
|
+
] })
|
|
675
|
+
] }),
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
679
|
+
onNavigate && actionLabel && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
680
|
+
"button",
|
|
681
|
+
{
|
|
682
|
+
type: "button",
|
|
683
|
+
onClick: handleNavigate,
|
|
684
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
685
|
+
children: actionLabel
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] })
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
};
|
|
693
|
+
var NotificationEmpty = () => {
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
696
|
+
"img",
|
|
697
|
+
{
|
|
698
|
+
src: no_notification_result_default,
|
|
699
|
+
alt: "Sem notifica\xE7\xF5es",
|
|
700
|
+
width: 82,
|
|
701
|
+
height: 82,
|
|
702
|
+
className: "object-contain"
|
|
703
|
+
}
|
|
704
|
+
) }),
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: "Nenhuma notifica\xE7\xE3o no momento" }),
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-[316px] leading-[21px]", children: "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!" })
|
|
707
|
+
] });
|
|
708
|
+
};
|
|
709
|
+
var NotificationList = ({
|
|
710
|
+
groupedNotifications = [],
|
|
711
|
+
loading = false,
|
|
712
|
+
error = null,
|
|
713
|
+
onRetry,
|
|
714
|
+
onMarkAsReadById,
|
|
715
|
+
onDeleteById,
|
|
716
|
+
onNavigateById,
|
|
717
|
+
getActionLabel,
|
|
718
|
+
renderEmpty,
|
|
719
|
+
className
|
|
720
|
+
}) => {
|
|
721
|
+
if (error) {
|
|
722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-error-600", children: error }),
|
|
724
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
725
|
+
"button",
|
|
726
|
+
{
|
|
727
|
+
type: "button",
|
|
728
|
+
onClick: onRetry,
|
|
729
|
+
className: "text-sm text-info-600 hover:text-info-700",
|
|
730
|
+
children: "Tentar novamente"
|
|
731
|
+
}
|
|
732
|
+
)
|
|
733
|
+
] });
|
|
734
|
+
}
|
|
735
|
+
if (loading) {
|
|
736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
737
|
+
(skeletonId) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
738
|
+
SkeletonCard,
|
|
739
|
+
{
|
|
740
|
+
className: "p-4 border-b border-border-200"
|
|
741
|
+
},
|
|
742
|
+
skeletonId
|
|
743
|
+
)
|
|
744
|
+
) });
|
|
745
|
+
}
|
|
746
|
+
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
747
|
+
return renderEmpty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NotificationEmpty, {});
|
|
748
|
+
}
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col", children: [
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
751
|
+
group.notifications.map((notification) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
752
|
+
SingleNotificationCard,
|
|
753
|
+
{
|
|
754
|
+
title: notification.title,
|
|
755
|
+
message: notification.message,
|
|
756
|
+
time: notification.time,
|
|
757
|
+
isRead: notification.isRead,
|
|
758
|
+
onMarkAsRead: () => onMarkAsReadById?.(notification.id),
|
|
759
|
+
onDelete: () => onDeleteById?.(notification.id),
|
|
760
|
+
onNavigate: notification.entityType && notification.entityId && onNavigateById ? () => onNavigateById(
|
|
761
|
+
notification.entityType,
|
|
762
|
+
notification.entityId
|
|
763
|
+
) : void 0,
|
|
764
|
+
actionLabel: getActionLabel?.(notification.entityType)
|
|
765
|
+
},
|
|
766
|
+
notification.id
|
|
767
|
+
))
|
|
768
|
+
] }, `${group.label}-${idx}`)) });
|
|
769
|
+
};
|
|
770
|
+
var NotificationCard = (props) => {
|
|
771
|
+
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
773
|
+
NotificationList,
|
|
774
|
+
{
|
|
775
|
+
...props,
|
|
776
|
+
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [{ label: "Notifica\xE7\xF5es", notifications: props.notifications }] : [])
|
|
777
|
+
}
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
if (props.title !== void 0 && props.message !== void 0 && props.time !== void 0 && props.isRead !== void 0 && props.onMarkAsRead && props.onDelete) {
|
|
781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
782
|
+
SingleNotificationCard,
|
|
783
|
+
{
|
|
784
|
+
title: props.title,
|
|
785
|
+
message: props.message,
|
|
786
|
+
time: props.time,
|
|
787
|
+
isRead: props.isRead,
|
|
788
|
+
onMarkAsRead: props.onMarkAsRead,
|
|
789
|
+
onDelete: props.onDelete,
|
|
790
|
+
onNavigate: props.onNavigate,
|
|
791
|
+
actionLabel: props.actionLabel,
|
|
792
|
+
className: props.className
|
|
793
|
+
}
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
797
|
+
};
|
|
798
|
+
var NotificationCard_default = NotificationCard;
|
|
799
|
+
//# sourceMappingURL=index.js.map
|