analytica-frontend-lib 1.1.22 → 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/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/index.css +22 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +196 -0
- package/dist/index.mjs.map +1 -1
- package/dist/no-notification-result-7Y3ACV6V.png +0 -0
- package/dist/styles.css +22 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -46,6 +46,7 @@ export { useApiConfig } from './Auth/useApiConfig/index.mjs';
|
|
|
46
46
|
export { Quiz, QuizAlternative, QuizConnectDots, QuizContent, QuizDissertative, QuizFooter, QuizHeader, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizQuestionList, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTitle, QuizTrueOrFalse, getStatusBadge } from './Quiz/index.mjs';
|
|
47
47
|
export { ANSWER_STATUS, Activity, Lesson, QUESTION_DIFFICULTY, QUESTION_STATUS, QUESTION_TYPE, Question, QuestionResult, QuizState, Simulated, UserAnswerItem, useQuizStore } from './Quiz/useQuizStore/index.mjs';
|
|
48
48
|
export { default as LoadingModal } from './LoadingModal/index.mjs';
|
|
49
|
+
export { default as NotificationCard, NotificationGroup, NotificationItem } from './NotificationCard/index.mjs';
|
|
49
50
|
import 'react/jsx-runtime';
|
|
50
51
|
|
|
51
52
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { useApiConfig } from './Auth/useApiConfig/index.js';
|
|
|
46
46
|
export { Quiz, QuizAlternative, QuizConnectDots, QuizContent, QuizDissertative, QuizFooter, QuizHeader, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizQuestionList, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTitle, QuizTrueOrFalse, getStatusBadge } from './Quiz/index.js';
|
|
47
47
|
export { ANSWER_STATUS, Activity, Lesson, QUESTION_DIFFICULTY, QUESTION_STATUS, QUESTION_TYPE, Question, QuestionResult, QuizState, Simulated, UserAnswerItem, useQuizStore } from './Quiz/useQuizStore/index.js';
|
|
48
48
|
export { default as LoadingModal } from './LoadingModal/index.js';
|
|
49
|
+
export { default as NotificationCard, NotificationGroup, NotificationItem } from './NotificationCard/index.js';
|
|
49
50
|
import 'react/jsx-runtime';
|
|
50
51
|
|
|
51
52
|
/**
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,7 @@ __export(src_exports, {
|
|
|
74
74
|
MultipleChoiceList: () => MultipleChoiceList,
|
|
75
75
|
NavButton: () => NavButton_default,
|
|
76
76
|
NotFound: () => NotFound_default,
|
|
77
|
+
NotificationCard: () => NotificationCard_default,
|
|
77
78
|
ProfileMenuFooter: () => ProfileMenuFooter,
|
|
78
79
|
ProfileMenuHeader: () => ProfileMenuHeader,
|
|
79
80
|
ProfileMenuSection: () => ProfileMenuSection,
|
|
@@ -10019,6 +10020,201 @@ var LoadingModal = (0, import_react29.forwardRef)(
|
|
|
10019
10020
|
}
|
|
10020
10021
|
);
|
|
10021
10022
|
var loadingModal_default = LoadingModal;
|
|
10023
|
+
|
|
10024
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
10025
|
+
var import_phosphor_react21 = require("phosphor-react");
|
|
10026
|
+
|
|
10027
|
+
// src/assets/img/no-notification-result.png
|
|
10028
|
+
var no_notification_result_default = "./no-notification-result-7Y3ACV6V.png";
|
|
10029
|
+
|
|
10030
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
10031
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
10032
|
+
var SingleNotificationCard = ({
|
|
10033
|
+
title,
|
|
10034
|
+
message,
|
|
10035
|
+
time,
|
|
10036
|
+
isRead,
|
|
10037
|
+
onMarkAsRead,
|
|
10038
|
+
onDelete,
|
|
10039
|
+
onNavigate,
|
|
10040
|
+
actionLabel,
|
|
10041
|
+
className
|
|
10042
|
+
}) => {
|
|
10043
|
+
const handleMarkAsRead = (e) => {
|
|
10044
|
+
e.preventDefault();
|
|
10045
|
+
e.stopPropagation();
|
|
10046
|
+
if (!isRead) {
|
|
10047
|
+
onMarkAsRead();
|
|
10048
|
+
}
|
|
10049
|
+
};
|
|
10050
|
+
const handleDelete = (e) => {
|
|
10051
|
+
e.preventDefault();
|
|
10052
|
+
e.stopPropagation();
|
|
10053
|
+
onDelete();
|
|
10054
|
+
};
|
|
10055
|
+
const handleNavigate = (e) => {
|
|
10056
|
+
e.stopPropagation();
|
|
10057
|
+
if (onNavigate) {
|
|
10058
|
+
onNavigate();
|
|
10059
|
+
}
|
|
10060
|
+
};
|
|
10061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
10062
|
+
"div",
|
|
10063
|
+
{
|
|
10064
|
+
className: cn(
|
|
10065
|
+
"flex flex-col justify-center items-start p-4 gap-2 w-full bg-background border-b border-border-200",
|
|
10066
|
+
"last:border-b-0",
|
|
10067
|
+
className
|
|
10068
|
+
),
|
|
10069
|
+
children: [
|
|
10070
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2 w-full", children: [
|
|
10071
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
10072
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
10073
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(DropdownMenu_default, { children: [
|
|
10074
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10075
|
+
DropdownMenuTrigger,
|
|
10076
|
+
{
|
|
10077
|
+
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",
|
|
10078
|
+
"aria-label": "Menu de a\xE7\xF5es",
|
|
10079
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_phosphor_react21.DotsThreeVertical, { size: 24 })
|
|
10080
|
+
}
|
|
10081
|
+
),
|
|
10082
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
10083
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10084
|
+
DropdownMenuItem,
|
|
10085
|
+
{
|
|
10086
|
+
onClick: handleMarkAsRead,
|
|
10087
|
+
className: "text-text-950",
|
|
10088
|
+
children: "Marcar como lida"
|
|
10089
|
+
}
|
|
10090
|
+
),
|
|
10091
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
10092
|
+
] })
|
|
10093
|
+
] })
|
|
10094
|
+
] }),
|
|
10095
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
10096
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
10097
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
10098
|
+
onNavigate && actionLabel && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10099
|
+
"button",
|
|
10100
|
+
{
|
|
10101
|
+
type: "button",
|
|
10102
|
+
onClick: handleNavigate,
|
|
10103
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
10104
|
+
children: actionLabel
|
|
10105
|
+
}
|
|
10106
|
+
)
|
|
10107
|
+
] })
|
|
10108
|
+
]
|
|
10109
|
+
}
|
|
10110
|
+
);
|
|
10111
|
+
};
|
|
10112
|
+
var NotificationEmpty = () => {
|
|
10113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
10114
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10115
|
+
"img",
|
|
10116
|
+
{
|
|
10117
|
+
src: no_notification_result_default,
|
|
10118
|
+
alt: "Sem notifica\xE7\xF5es",
|
|
10119
|
+
width: 82,
|
|
10120
|
+
height: 82,
|
|
10121
|
+
className: "object-contain"
|
|
10122
|
+
}
|
|
10123
|
+
) }),
|
|
10124
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: "Nenhuma notifica\xE7\xE3o no momento" }),
|
|
10125
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.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!" })
|
|
10126
|
+
] });
|
|
10127
|
+
};
|
|
10128
|
+
var NotificationList = ({
|
|
10129
|
+
groupedNotifications = [],
|
|
10130
|
+
loading = false,
|
|
10131
|
+
error = null,
|
|
10132
|
+
onRetry,
|
|
10133
|
+
onMarkAsReadById,
|
|
10134
|
+
onDeleteById,
|
|
10135
|
+
onNavigateById,
|
|
10136
|
+
getActionLabel,
|
|
10137
|
+
renderEmpty,
|
|
10138
|
+
className
|
|
10139
|
+
}) => {
|
|
10140
|
+
if (error) {
|
|
10141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
10142
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm text-error-600", children: error }),
|
|
10143
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10144
|
+
"button",
|
|
10145
|
+
{
|
|
10146
|
+
type: "button",
|
|
10147
|
+
onClick: onRetry,
|
|
10148
|
+
className: "text-sm text-info-600 hover:text-info-700",
|
|
10149
|
+
children: "Tentar novamente"
|
|
10150
|
+
}
|
|
10151
|
+
)
|
|
10152
|
+
] });
|
|
10153
|
+
}
|
|
10154
|
+
if (loading) {
|
|
10155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
10156
|
+
(skeletonId) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10157
|
+
SkeletonCard,
|
|
10158
|
+
{
|
|
10159
|
+
className: "p-4 border-b border-border-200"
|
|
10160
|
+
},
|
|
10161
|
+
skeletonId
|
|
10162
|
+
)
|
|
10163
|
+
) });
|
|
10164
|
+
}
|
|
10165
|
+
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
10166
|
+
return renderEmpty ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(NotificationEmpty, {});
|
|
10167
|
+
}
|
|
10168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col", children: [
|
|
10169
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
10170
|
+
group.notifications.map((notification) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10171
|
+
SingleNotificationCard,
|
|
10172
|
+
{
|
|
10173
|
+
title: notification.title,
|
|
10174
|
+
message: notification.message,
|
|
10175
|
+
time: notification.time,
|
|
10176
|
+
isRead: notification.isRead,
|
|
10177
|
+
onMarkAsRead: () => onMarkAsReadById?.(notification.id),
|
|
10178
|
+
onDelete: () => onDeleteById?.(notification.id),
|
|
10179
|
+
onNavigate: notification.entityType && notification.entityId && onNavigateById ? () => onNavigateById(
|
|
10180
|
+
notification.entityType,
|
|
10181
|
+
notification.entityId
|
|
10182
|
+
) : void 0,
|
|
10183
|
+
actionLabel: getActionLabel?.(notification.entityType)
|
|
10184
|
+
},
|
|
10185
|
+
notification.id
|
|
10186
|
+
))
|
|
10187
|
+
] }, `${group.label}-${idx}`)) });
|
|
10188
|
+
};
|
|
10189
|
+
var NotificationCard = (props) => {
|
|
10190
|
+
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
10191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10192
|
+
NotificationList,
|
|
10193
|
+
{
|
|
10194
|
+
...props,
|
|
10195
|
+
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [{ label: "Notifica\xE7\xF5es", notifications: props.notifications }] : [])
|
|
10196
|
+
}
|
|
10197
|
+
);
|
|
10198
|
+
}
|
|
10199
|
+
if (props.title !== void 0 && props.message !== void 0 && props.time !== void 0 && props.isRead !== void 0 && props.onMarkAsRead && props.onDelete) {
|
|
10200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
10201
|
+
SingleNotificationCard,
|
|
10202
|
+
{
|
|
10203
|
+
title: props.title,
|
|
10204
|
+
message: props.message,
|
|
10205
|
+
time: props.time,
|
|
10206
|
+
isRead: props.isRead,
|
|
10207
|
+
onMarkAsRead: props.onMarkAsRead,
|
|
10208
|
+
onDelete: props.onDelete,
|
|
10209
|
+
onNavigate: props.onNavigate,
|
|
10210
|
+
actionLabel: props.actionLabel,
|
|
10211
|
+
className: props.className
|
|
10212
|
+
}
|
|
10213
|
+
);
|
|
10214
|
+
}
|
|
10215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
10216
|
+
};
|
|
10217
|
+
var NotificationCard_default = NotificationCard;
|
|
10022
10218
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10023
10219
|
0 && (module.exports = {
|
|
10024
10220
|
ANSWER_STATUS,
|
|
@@ -10065,6 +10261,7 @@ var loadingModal_default = LoadingModal;
|
|
|
10065
10261
|
MultipleChoiceList,
|
|
10066
10262
|
NavButton,
|
|
10067
10263
|
NotFound,
|
|
10264
|
+
NotificationCard,
|
|
10068
10265
|
ProfileMenuFooter,
|
|
10069
10266
|
ProfileMenuHeader,
|
|
10070
10267
|
ProfileMenuSection,
|