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.mjs
CHANGED
|
@@ -9999,6 +9999,201 @@ var LoadingModal = forwardRef20(
|
|
|
9999
9999
|
}
|
|
10000
10000
|
);
|
|
10001
10001
|
var loadingModal_default = LoadingModal;
|
|
10002
|
+
|
|
10003
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
10004
|
+
import { DotsThreeVertical as DotsThreeVertical3 } from "phosphor-react";
|
|
10005
|
+
|
|
10006
|
+
// src/assets/img/no-notification-result.png
|
|
10007
|
+
var no_notification_result_default = "./no-notification-result-7Y3ACV6V.png";
|
|
10008
|
+
|
|
10009
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
10010
|
+
import { jsx as jsx41, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10011
|
+
var SingleNotificationCard = ({
|
|
10012
|
+
title,
|
|
10013
|
+
message,
|
|
10014
|
+
time,
|
|
10015
|
+
isRead,
|
|
10016
|
+
onMarkAsRead,
|
|
10017
|
+
onDelete,
|
|
10018
|
+
onNavigate,
|
|
10019
|
+
actionLabel,
|
|
10020
|
+
className
|
|
10021
|
+
}) => {
|
|
10022
|
+
const handleMarkAsRead = (e) => {
|
|
10023
|
+
e.preventDefault();
|
|
10024
|
+
e.stopPropagation();
|
|
10025
|
+
if (!isRead) {
|
|
10026
|
+
onMarkAsRead();
|
|
10027
|
+
}
|
|
10028
|
+
};
|
|
10029
|
+
const handleDelete = (e) => {
|
|
10030
|
+
e.preventDefault();
|
|
10031
|
+
e.stopPropagation();
|
|
10032
|
+
onDelete();
|
|
10033
|
+
};
|
|
10034
|
+
const handleNavigate = (e) => {
|
|
10035
|
+
e.stopPropagation();
|
|
10036
|
+
if (onNavigate) {
|
|
10037
|
+
onNavigate();
|
|
10038
|
+
}
|
|
10039
|
+
};
|
|
10040
|
+
return /* @__PURE__ */ jsxs34(
|
|
10041
|
+
"div",
|
|
10042
|
+
{
|
|
10043
|
+
className: cn(
|
|
10044
|
+
"flex flex-col justify-center items-start p-4 gap-2 w-full bg-background border-b border-border-200",
|
|
10045
|
+
"last:border-b-0",
|
|
10046
|
+
className
|
|
10047
|
+
),
|
|
10048
|
+
children: [
|
|
10049
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-2 w-full", children: [
|
|
10050
|
+
!isRead && /* @__PURE__ */ jsx41("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
10051
|
+
/* @__PURE__ */ jsx41("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
10052
|
+
/* @__PURE__ */ jsxs34(DropdownMenu_default, { children: [
|
|
10053
|
+
/* @__PURE__ */ jsx41(
|
|
10054
|
+
DropdownMenuTrigger,
|
|
10055
|
+
{
|
|
10056
|
+
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",
|
|
10057
|
+
"aria-label": "Menu de a\xE7\xF5es",
|
|
10058
|
+
children: /* @__PURE__ */ jsx41(DotsThreeVertical3, { size: 24 })
|
|
10059
|
+
}
|
|
10060
|
+
),
|
|
10061
|
+
/* @__PURE__ */ jsxs34(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
10062
|
+
!isRead && /* @__PURE__ */ jsx41(
|
|
10063
|
+
DropdownMenuItem,
|
|
10064
|
+
{
|
|
10065
|
+
onClick: handleMarkAsRead,
|
|
10066
|
+
className: "text-text-950",
|
|
10067
|
+
children: "Marcar como lida"
|
|
10068
|
+
}
|
|
10069
|
+
),
|
|
10070
|
+
/* @__PURE__ */ jsx41(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
10071
|
+
] })
|
|
10072
|
+
] })
|
|
10073
|
+
] }),
|
|
10074
|
+
/* @__PURE__ */ jsx41("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
10075
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between w-full", children: [
|
|
10076
|
+
/* @__PURE__ */ jsx41("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
10077
|
+
onNavigate && actionLabel && /* @__PURE__ */ jsx41(
|
|
10078
|
+
"button",
|
|
10079
|
+
{
|
|
10080
|
+
type: "button",
|
|
10081
|
+
onClick: handleNavigate,
|
|
10082
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
10083
|
+
children: actionLabel
|
|
10084
|
+
}
|
|
10085
|
+
)
|
|
10086
|
+
] })
|
|
10087
|
+
]
|
|
10088
|
+
}
|
|
10089
|
+
);
|
|
10090
|
+
};
|
|
10091
|
+
var NotificationEmpty = () => {
|
|
10092
|
+
return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
10093
|
+
/* @__PURE__ */ jsx41("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ jsx41(
|
|
10094
|
+
"img",
|
|
10095
|
+
{
|
|
10096
|
+
src: no_notification_result_default,
|
|
10097
|
+
alt: "Sem notifica\xE7\xF5es",
|
|
10098
|
+
width: 82,
|
|
10099
|
+
height: 82,
|
|
10100
|
+
className: "object-contain"
|
|
10101
|
+
}
|
|
10102
|
+
) }),
|
|
10103
|
+
/* @__PURE__ */ jsx41("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: "Nenhuma notifica\xE7\xE3o no momento" }),
|
|
10104
|
+
/* @__PURE__ */ jsx41("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!" })
|
|
10105
|
+
] });
|
|
10106
|
+
};
|
|
10107
|
+
var NotificationList = ({
|
|
10108
|
+
groupedNotifications = [],
|
|
10109
|
+
loading = false,
|
|
10110
|
+
error = null,
|
|
10111
|
+
onRetry,
|
|
10112
|
+
onMarkAsReadById,
|
|
10113
|
+
onDeleteById,
|
|
10114
|
+
onNavigateById,
|
|
10115
|
+
getActionLabel,
|
|
10116
|
+
renderEmpty,
|
|
10117
|
+
className
|
|
10118
|
+
}) => {
|
|
10119
|
+
if (error) {
|
|
10120
|
+
return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
10121
|
+
/* @__PURE__ */ jsx41("p", { className: "text-sm text-error-600", children: error }),
|
|
10122
|
+
onRetry && /* @__PURE__ */ jsx41(
|
|
10123
|
+
"button",
|
|
10124
|
+
{
|
|
10125
|
+
type: "button",
|
|
10126
|
+
onClick: onRetry,
|
|
10127
|
+
className: "text-sm text-info-600 hover:text-info-700",
|
|
10128
|
+
children: "Tentar novamente"
|
|
10129
|
+
}
|
|
10130
|
+
)
|
|
10131
|
+
] });
|
|
10132
|
+
}
|
|
10133
|
+
if (loading) {
|
|
10134
|
+
return /* @__PURE__ */ jsx41("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
10135
|
+
(skeletonId) => /* @__PURE__ */ jsx41(
|
|
10136
|
+
SkeletonCard,
|
|
10137
|
+
{
|
|
10138
|
+
className: "p-4 border-b border-border-200"
|
|
10139
|
+
},
|
|
10140
|
+
skeletonId
|
|
10141
|
+
)
|
|
10142
|
+
) });
|
|
10143
|
+
}
|
|
10144
|
+
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
10145
|
+
return renderEmpty ? /* @__PURE__ */ jsx41("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ jsx41(NotificationEmpty, {});
|
|
10146
|
+
}
|
|
10147
|
+
return /* @__PURE__ */ jsx41("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ jsxs34("div", { className: "flex flex-col", children: [
|
|
10148
|
+
/* @__PURE__ */ jsx41("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ jsx41("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
10149
|
+
group.notifications.map((notification) => /* @__PURE__ */ jsx41(
|
|
10150
|
+
SingleNotificationCard,
|
|
10151
|
+
{
|
|
10152
|
+
title: notification.title,
|
|
10153
|
+
message: notification.message,
|
|
10154
|
+
time: notification.time,
|
|
10155
|
+
isRead: notification.isRead,
|
|
10156
|
+
onMarkAsRead: () => onMarkAsReadById?.(notification.id),
|
|
10157
|
+
onDelete: () => onDeleteById?.(notification.id),
|
|
10158
|
+
onNavigate: notification.entityType && notification.entityId && onNavigateById ? () => onNavigateById(
|
|
10159
|
+
notification.entityType,
|
|
10160
|
+
notification.entityId
|
|
10161
|
+
) : void 0,
|
|
10162
|
+
actionLabel: getActionLabel?.(notification.entityType)
|
|
10163
|
+
},
|
|
10164
|
+
notification.id
|
|
10165
|
+
))
|
|
10166
|
+
] }, `${group.label}-${idx}`)) });
|
|
10167
|
+
};
|
|
10168
|
+
var NotificationCard = (props) => {
|
|
10169
|
+
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
10170
|
+
return /* @__PURE__ */ jsx41(
|
|
10171
|
+
NotificationList,
|
|
10172
|
+
{
|
|
10173
|
+
...props,
|
|
10174
|
+
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [{ label: "Notifica\xE7\xF5es", notifications: props.notifications }] : [])
|
|
10175
|
+
}
|
|
10176
|
+
);
|
|
10177
|
+
}
|
|
10178
|
+
if (props.title !== void 0 && props.message !== void 0 && props.time !== void 0 && props.isRead !== void 0 && props.onMarkAsRead && props.onDelete) {
|
|
10179
|
+
return /* @__PURE__ */ jsx41(
|
|
10180
|
+
SingleNotificationCard,
|
|
10181
|
+
{
|
|
10182
|
+
title: props.title,
|
|
10183
|
+
message: props.message,
|
|
10184
|
+
time: props.time,
|
|
10185
|
+
isRead: props.isRead,
|
|
10186
|
+
onMarkAsRead: props.onMarkAsRead,
|
|
10187
|
+
onDelete: props.onDelete,
|
|
10188
|
+
onNavigate: props.onNavigate,
|
|
10189
|
+
actionLabel: props.actionLabel,
|
|
10190
|
+
className: props.className
|
|
10191
|
+
}
|
|
10192
|
+
);
|
|
10193
|
+
}
|
|
10194
|
+
return /* @__PURE__ */ jsx41("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ jsx41("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
10195
|
+
};
|
|
10196
|
+
var NotificationCard_default = NotificationCard;
|
|
10002
10197
|
export {
|
|
10003
10198
|
ANSWER_STATUS,
|
|
10004
10199
|
Alert_default as Alert,
|
|
@@ -10044,6 +10239,7 @@ export {
|
|
|
10044
10239
|
MultipleChoiceList,
|
|
10045
10240
|
NavButton_default as NavButton,
|
|
10046
10241
|
NotFound_default as NotFound,
|
|
10242
|
+
NotificationCard_default as NotificationCard,
|
|
10047
10243
|
ProfileMenuFooter,
|
|
10048
10244
|
ProfileMenuHeader,
|
|
10049
10245
|
ProfileMenuSection,
|