@cnc-ti/layout-basic 8.4.0 → 8.5.0
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/README.md +59 -0
- package/dist/index.css +147 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +206 -1
- package/dist/index.d.ts +206 -1
- package/dist/index.js +827 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +824 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -84,9 +84,11 @@ __export(src_exports, {
|
|
|
84
84
|
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
85
85
|
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
86
86
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
87
|
+
ErroNotificacoes: () => ErroNotificacoes,
|
|
87
88
|
Filter: () => Filter,
|
|
88
89
|
Header: () => Header,
|
|
89
90
|
HeaderContainer: () => HeaderContainer,
|
|
91
|
+
HeaderNotifications: () => HeaderNotifications,
|
|
90
92
|
HeaderProfileHeader: () => HeaderProfileHeader,
|
|
91
93
|
HeaderProfileItem: () => HeaderProfileItem,
|
|
92
94
|
Input: () => Input,
|
|
@@ -123,6 +125,7 @@ __export(src_exports, {
|
|
|
123
125
|
TabsList: () => TabsList,
|
|
124
126
|
TabsTrigger: () => TabsTrigger,
|
|
125
127
|
Title: () => Title2,
|
|
128
|
+
URL_PADRAO_NOTIFICACOES: () => URL_PADRAO_NOTIFICACOES,
|
|
126
129
|
availableApps: () => availableApps,
|
|
127
130
|
buttonVariants: () => buttonVariants
|
|
128
131
|
});
|
|
@@ -259,6 +262,28 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
259
262
|
return Component;
|
|
260
263
|
};
|
|
261
264
|
|
|
265
|
+
// ../../node_modules/lucide-react/dist/esm/icons/bell-off.js
|
|
266
|
+
var BellOff = createLucideIcon("BellOff", [
|
|
267
|
+
["path", { d: "M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5", key: "o7mx20" }],
|
|
268
|
+
["path", { d: "M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7", key: "16f1lm" }],
|
|
269
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }],
|
|
270
|
+
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
271
|
+
]);
|
|
272
|
+
|
|
273
|
+
// ../../node_modules/lucide-react/dist/esm/icons/bell-ring.js
|
|
274
|
+
var BellRing = createLucideIcon("BellRing", [
|
|
275
|
+
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
276
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }],
|
|
277
|
+
["path", { d: "M4 2C2.8 3.7 2 5.7 2 8", key: "tap9e0" }],
|
|
278
|
+
["path", { d: "M22 8c0-2.3-.8-4.3-2-6", key: "5bb3ad" }]
|
|
279
|
+
]);
|
|
280
|
+
|
|
281
|
+
// ../../node_modules/lucide-react/dist/esm/icons/bell.js
|
|
282
|
+
var Bell = createLucideIcon("Bell", [
|
|
283
|
+
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
284
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
285
|
+
]);
|
|
286
|
+
|
|
262
287
|
// ../../node_modules/lucide-react/dist/esm/icons/check.js
|
|
263
288
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
264
289
|
|
|
@@ -316,12 +341,39 @@ var LoaderCircle = createLucideIcon("LoaderCircle", [
|
|
|
316
341
|
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
317
342
|
]);
|
|
318
343
|
|
|
344
|
+
// ../../node_modules/lucide-react/dist/esm/icons/mail-open.js
|
|
345
|
+
var MailOpen = createLucideIcon("MailOpen", [
|
|
346
|
+
[
|
|
347
|
+
"path",
|
|
348
|
+
{
|
|
349
|
+
d: "M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",
|
|
350
|
+
key: "1jhwl8"
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
["path", { d: "m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10", key: "1qfld7" }]
|
|
354
|
+
]);
|
|
355
|
+
|
|
356
|
+
// ../../node_modules/lucide-react/dist/esm/icons/mail.js
|
|
357
|
+
var Mail = createLucideIcon("Mail", [
|
|
358
|
+
["rect", { width: "20", height: "16", x: "2", y: "4", rx: "2", key: "18n3k1" }],
|
|
359
|
+
["path", { d: "m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7", key: "1ocrg3" }]
|
|
360
|
+
]);
|
|
361
|
+
|
|
319
362
|
// ../../node_modules/lucide-react/dist/esm/icons/search.js
|
|
320
363
|
var Search = createLucideIcon("Search", [
|
|
321
364
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
322
365
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
|
323
366
|
]);
|
|
324
367
|
|
|
368
|
+
// ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
|
|
369
|
+
var Trash2 = createLucideIcon("Trash2", [
|
|
370
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
371
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
372
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
373
|
+
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
374
|
+
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
375
|
+
]);
|
|
376
|
+
|
|
325
377
|
// ../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
326
378
|
var X = createLucideIcon("X", [
|
|
327
379
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
@@ -3051,6 +3103,7 @@ var HeaderContainer = ({
|
|
|
3051
3103
|
container = false,
|
|
3052
3104
|
logo,
|
|
3053
3105
|
logoLink,
|
|
3106
|
+
notifications,
|
|
3054
3107
|
children,
|
|
3055
3108
|
...props
|
|
3056
3109
|
}) => {
|
|
@@ -3100,7 +3153,10 @@ var HeaderContainer = ({
|
|
|
3100
3153
|
)
|
|
3101
3154
|
}
|
|
3102
3155
|
) : !hasSidebar && renderLogo() }),
|
|
3103
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "cnc-flex", children: [
|
|
3157
|
+
notifications && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "cnc-flex cnc-items-center cnc-pr-3", children: notifications }),
|
|
3158
|
+
children
|
|
3159
|
+
] })
|
|
3104
3160
|
]
|
|
3105
3161
|
}
|
|
3106
3162
|
);
|
|
@@ -4738,6 +4794,725 @@ function CardList({
|
|
|
4738
4794
|
}
|
|
4739
4795
|
);
|
|
4740
4796
|
}
|
|
4797
|
+
|
|
4798
|
+
// src/components/organisms/header-notifications/index.tsx
|
|
4799
|
+
var React18 = __toESM(require("react"));
|
|
4800
|
+
|
|
4801
|
+
// src/components/organisms/header-notifications/cliente.ts
|
|
4802
|
+
var URL_PADRAO_NOTIFICACOES = "https://dev-apinotificacoes-b5feekb4bdfyb7c2.eastus2-01.azurewebsites.net/v1";
|
|
4803
|
+
var ErroNotificacoes = class _ErroNotificacoes extends Error {
|
|
4804
|
+
status;
|
|
4805
|
+
constructor(mensagem, status) {
|
|
4806
|
+
super(mensagem);
|
|
4807
|
+
this.name = "ErroNotificacoes";
|
|
4808
|
+
this.status = status;
|
|
4809
|
+
Object.setPrototypeOf(this, _ErroNotificacoes.prototype);
|
|
4810
|
+
}
|
|
4811
|
+
};
|
|
4812
|
+
function normalizarBaseUrl(baseUrl) {
|
|
4813
|
+
return baseUrl.replace(/\/+$/, "");
|
|
4814
|
+
}
|
|
4815
|
+
function extrairLista(payload) {
|
|
4816
|
+
if (Array.isArray(payload)) return payload;
|
|
4817
|
+
if (payload && typeof payload === "object") {
|
|
4818
|
+
const registro = payload;
|
|
4819
|
+
const chaves = ["dados", "data", "notificacoes", "items", "content"];
|
|
4820
|
+
for (const chave of chaves) {
|
|
4821
|
+
if (Array.isArray(registro[chave])) return registro[chave];
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
return [];
|
|
4825
|
+
}
|
|
4826
|
+
async function buscarNotificacoes({
|
|
4827
|
+
baseUrl,
|
|
4828
|
+
email,
|
|
4829
|
+
sistema,
|
|
4830
|
+
filtros,
|
|
4831
|
+
signal
|
|
4832
|
+
}) {
|
|
4833
|
+
const parametros = new URLSearchParams({ email, sistema });
|
|
4834
|
+
for (const [chave, valor] of Object.entries(filtros ?? {})) {
|
|
4835
|
+
if (valor !== void 0 && valor !== null) parametros.set(chave, String(valor));
|
|
4836
|
+
}
|
|
4837
|
+
const resposta = await fetch(
|
|
4838
|
+
`${normalizarBaseUrl(baseUrl)}/notificacoes?${parametros.toString()}`,
|
|
4839
|
+
{ method: "GET", headers: { Accept: "application/json" }, signal }
|
|
4840
|
+
);
|
|
4841
|
+
if (!resposta.ok) {
|
|
4842
|
+
throw new ErroNotificacoes(
|
|
4843
|
+
`Falha ao buscar notifica\xE7\xF5es de ${sistema}`,
|
|
4844
|
+
resposta.status
|
|
4845
|
+
);
|
|
4846
|
+
}
|
|
4847
|
+
return extrairLista(await resposta.json());
|
|
4848
|
+
}
|
|
4849
|
+
async function definirStatusLeitura({ baseUrl, id, signal }, statusLeitura) {
|
|
4850
|
+
const resposta = await fetch(
|
|
4851
|
+
`${normalizarBaseUrl(baseUrl)}/notificacoes/${encodeURIComponent(String(id))}`,
|
|
4852
|
+
{
|
|
4853
|
+
method: "PUT",
|
|
4854
|
+
headers: { "Content-Type": "application/json" },
|
|
4855
|
+
body: JSON.stringify({ statusLeitura }),
|
|
4856
|
+
signal
|
|
4857
|
+
}
|
|
4858
|
+
);
|
|
4859
|
+
if (!resposta.ok) {
|
|
4860
|
+
throw new ErroNotificacoes(
|
|
4861
|
+
`Falha ao definir a notifica\xE7\xE3o ${id} como ${statusLeitura}`,
|
|
4862
|
+
resposta.status
|
|
4863
|
+
);
|
|
4864
|
+
}
|
|
4865
|
+
}
|
|
4866
|
+
function marcarComoLida(parametros) {
|
|
4867
|
+
return definirStatusLeitura(parametros, "LIDO");
|
|
4868
|
+
}
|
|
4869
|
+
function marcarComoNaoLida(parametros) {
|
|
4870
|
+
return definirStatusLeitura(parametros, "NAO_LIDO");
|
|
4871
|
+
}
|
|
4872
|
+
async function excluirNotificacao({
|
|
4873
|
+
baseUrl,
|
|
4874
|
+
id,
|
|
4875
|
+
signal
|
|
4876
|
+
}) {
|
|
4877
|
+
const resposta = await fetch(
|
|
4878
|
+
`${normalizarBaseUrl(baseUrl)}/notificacoes/${encodeURIComponent(String(id))}`,
|
|
4879
|
+
{ method: "DELETE", signal }
|
|
4880
|
+
);
|
|
4881
|
+
if (!resposta.ok) {
|
|
4882
|
+
throw new ErroNotificacoes(
|
|
4883
|
+
`Falha ao excluir a notifica\xE7\xE3o ${id}`,
|
|
4884
|
+
resposta.status
|
|
4885
|
+
);
|
|
4886
|
+
}
|
|
4887
|
+
}
|
|
4888
|
+
function normalizarId(id) {
|
|
4889
|
+
if (typeof id === "number") return id;
|
|
4890
|
+
return /^\d+$/.test(id) ? Number(id) : id;
|
|
4891
|
+
}
|
|
4892
|
+
async function marcarVariasComoLidas({
|
|
4893
|
+
baseUrl,
|
|
4894
|
+
ids,
|
|
4895
|
+
signal
|
|
4896
|
+
}) {
|
|
4897
|
+
if (ids.length === 0) return;
|
|
4898
|
+
const resposta = await fetch(`${normalizarBaseUrl(baseUrl)}/notificacoes/lote`, {
|
|
4899
|
+
method: "PUT",
|
|
4900
|
+
headers: { "Content-Type": "application/json" },
|
|
4901
|
+
body: JSON.stringify({
|
|
4902
|
+
notificacoes: ids.map((id) => ({
|
|
4903
|
+
id: normalizarId(id),
|
|
4904
|
+
statusLeitura: "LIDO"
|
|
4905
|
+
}))
|
|
4906
|
+
}),
|
|
4907
|
+
signal
|
|
4908
|
+
});
|
|
4909
|
+
if (!resposta.ok) {
|
|
4910
|
+
throw new ErroNotificacoes(
|
|
4911
|
+
`Falha ao marcar ${ids.length} notifica\xE7\xF5es como lidas`,
|
|
4912
|
+
resposta.status
|
|
4913
|
+
);
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4917
|
+
// src/components/organisms/header-notifications/mapear.ts
|
|
4918
|
+
var UM_MINUTO = 6e4;
|
|
4919
|
+
var UMA_HORA = 60 * UM_MINUTO;
|
|
4920
|
+
var UM_DIA = 24 * UMA_HORA;
|
|
4921
|
+
var SETE_DIAS = 7 * UM_DIA;
|
|
4922
|
+
function formatarDataRelativa(valor, agora = Date.now()) {
|
|
4923
|
+
if (!valor) return void 0;
|
|
4924
|
+
const data = new Date(valor);
|
|
4925
|
+
const instante = data.getTime();
|
|
4926
|
+
if (Number.isNaN(instante)) return void 0;
|
|
4927
|
+
const diferenca = agora - instante;
|
|
4928
|
+
const modulo = Math.abs(diferenca);
|
|
4929
|
+
if (diferenca >= SETE_DIAS) {
|
|
4930
|
+
return new Intl.DateTimeFormat("pt-BR", {
|
|
4931
|
+
day: "2-digit",
|
|
4932
|
+
month: "2-digit",
|
|
4933
|
+
year: "2-digit"
|
|
4934
|
+
}).format(data);
|
|
4935
|
+
}
|
|
4936
|
+
if (modulo < UM_MINUTO) return "agora";
|
|
4937
|
+
const formatador = new Intl.RelativeTimeFormat("pt-BR", { numeric: "auto" });
|
|
4938
|
+
const sinal = diferenca < 0 ? 1 : -1;
|
|
4939
|
+
if (modulo < UMA_HORA) {
|
|
4940
|
+
return formatador.format(sinal * Math.trunc(modulo / UM_MINUTO), "minute");
|
|
4941
|
+
}
|
|
4942
|
+
if (modulo < UM_DIA) {
|
|
4943
|
+
return formatador.format(sinal * Math.trunc(modulo / UMA_HORA), "hour");
|
|
4944
|
+
}
|
|
4945
|
+
return formatador.format(sinal * Math.trunc(modulo / UM_DIA), "day");
|
|
4946
|
+
}
|
|
4947
|
+
function instanteDe(notificacao) {
|
|
4948
|
+
const bruto = notificacao.disparadoEm ?? notificacao.dataReferencia;
|
|
4949
|
+
const instante = bruto ? new Date(bruto).getTime() : Number.NaN;
|
|
4950
|
+
return Number.isNaN(instante) ? 0 : instante;
|
|
4951
|
+
}
|
|
4952
|
+
var STATUS_OCULTOS = ["CANCELADO", "FALHOU"];
|
|
4953
|
+
function jaAconteceu(notificacao, agora) {
|
|
4954
|
+
if (notificacao.disparadoEm) return true;
|
|
4955
|
+
const referencia = notificacao.dataReferencia ? new Date(notificacao.dataReferencia).getTime() : Number.NaN;
|
|
4956
|
+
return !Number.isNaN(referencia) && referencia <= agora;
|
|
4957
|
+
}
|
|
4958
|
+
function selecionarVisiveis(notificacoes, limite = Number.POSITIVE_INFINITY, agora = Date.now()) {
|
|
4959
|
+
return notificacoes.filter(
|
|
4960
|
+
(notificacao) => Boolean(notificacao) && jaAconteceu(notificacao, agora) && !STATUS_OCULTOS.includes(notificacao.status)
|
|
4961
|
+
).sort((a, b) => instanteDe(b) - instanteDe(a)).slice(0, limite);
|
|
4962
|
+
}
|
|
4963
|
+
function selecionarLembretesVencidos(notificacoes, agora = Date.now()) {
|
|
4964
|
+
return notificacoes.filter((notificacao) => {
|
|
4965
|
+
if (!notificacao?.lembrarNoDia) return false;
|
|
4966
|
+
if (notificacao.statusLeitura === "LIDO") return false;
|
|
4967
|
+
if (STATUS_OCULTOS.includes(notificacao.status)) return false;
|
|
4968
|
+
const lembrete = notificacao.dataLembrete ? new Date(notificacao.dataLembrete).getTime() : Number.NaN;
|
|
4969
|
+
return !Number.isNaN(lembrete) && lembrete <= agora;
|
|
4970
|
+
}).sort(
|
|
4971
|
+
(a, b) => new Date(b.dataLembrete ?? 0).getTime() - new Date(a.dataLembrete ?? 0).getTime()
|
|
4972
|
+
);
|
|
4973
|
+
}
|
|
4974
|
+
function contarNaoLidas(notificacoes) {
|
|
4975
|
+
return notificacoes.filter(
|
|
4976
|
+
(notificacao) => notificacao.statusLeitura !== "LIDO"
|
|
4977
|
+
).length;
|
|
4978
|
+
}
|
|
4979
|
+
function mapearParaItem(notificacao, getHref, agora) {
|
|
4980
|
+
return {
|
|
4981
|
+
id: notificacao.id,
|
|
4982
|
+
title: notificacao.titulo,
|
|
4983
|
+
message: notificacao.mensagem ?? void 0,
|
|
4984
|
+
date: formatarDataRelativa(
|
|
4985
|
+
notificacao.disparadoEm ?? notificacao.dataReferencia,
|
|
4986
|
+
agora
|
|
4987
|
+
),
|
|
4988
|
+
read: notificacao.statusLeitura === "LIDO",
|
|
4989
|
+
href: getHref?.(notificacao)
|
|
4990
|
+
};
|
|
4991
|
+
}
|
|
4992
|
+
|
|
4993
|
+
// src/components/organisms/header-notifications/modal-lembretes.tsx
|
|
4994
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4995
|
+
function ModalLembretes({
|
|
4996
|
+
lembretes,
|
|
4997
|
+
aberto,
|
|
4998
|
+
onDispensar,
|
|
4999
|
+
titulo,
|
|
5000
|
+
rotuloDispensar = "Entendi"
|
|
5001
|
+
}) {
|
|
5002
|
+
const visivel = aberto && lembretes.length > 0;
|
|
5003
|
+
const tituloExibido = titulo ?? (lembretes.length === 1 ? "Voc\xEA tem um lembrete" : "Voc\xEA tem lembretes");
|
|
5004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5005
|
+
Dialog,
|
|
5006
|
+
{
|
|
5007
|
+
open: visivel,
|
|
5008
|
+
onOpenChange: (proximoEstado) => {
|
|
5009
|
+
if (!proximoEstado) onDispensar();
|
|
5010
|
+
},
|
|
5011
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5012
|
+
DialogContent,
|
|
5013
|
+
{
|
|
5014
|
+
className: "cnc-max-w-[440px] cnc-rounded-lg cnc-bg-white cnc-p-0",
|
|
5015
|
+
onOpenAutoFocus: (evento) => evento.preventDefault(),
|
|
5016
|
+
children: [
|
|
5017
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cnc-flex cnc-items-center cnc-gap-3 cnc-border-b cnc-border-brand-gray-50 cnc-px-5 cnc-py-4", children: [
|
|
5018
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "cnc-flex cnc-h-9 cnc-w-9 cnc-shrink-0 cnc-items-center cnc-justify-center cnc-rounded-full cnc-bg-brand-blue-60", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5019
|
+
BellRing,
|
|
5020
|
+
{
|
|
5021
|
+
className: "cnc-h-[18px] cnc-w-[18px] cnc-text-brand-blue-400",
|
|
5022
|
+
"aria-hidden": "true"
|
|
5023
|
+
}
|
|
5024
|
+
) }),
|
|
5025
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: tituloExibido })
|
|
5026
|
+
] }),
|
|
5027
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("ul", { className: "cnc-m-0 cnc-max-h-[320px] cnc-list-none cnc-overflow-y-auto cnc-p-0", children: lembretes.map((lembrete) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5028
|
+
"li",
|
|
5029
|
+
{
|
|
5030
|
+
className: "cnc-flex cnc-flex-col cnc-gap-1 cnc-border-b cnc-border-brand-gray-50 cnc-px-5 cnc-py-4 last:cnc-border-b-0",
|
|
5031
|
+
children: [
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-3", children: [
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "cnc-text-sm cnc-font-bold cnc-text-brand-blue-900", children: lembrete.titulo }),
|
|
5034
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: formatarDataRelativa(lembrete.dataLembrete) })
|
|
5035
|
+
] }),
|
|
5036
|
+
lembrete.mensagem && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "cnc-text-xs cnc-leading-relaxed cnc-text-brand-gray-600", children: lembrete.mensagem })
|
|
5037
|
+
]
|
|
5038
|
+
},
|
|
5039
|
+
lembrete.id
|
|
5040
|
+
)) }),
|
|
5041
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "cnc-flex cnc-flex-col cnc-gap-2 cnc-border-t cnc-border-brand-gray-50 cnc-px-5 cnc-py-4", children: [
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "confirm", className: "cnc-w-full", onClick: onDispensar, children: rotuloDispensar }),
|
|
5043
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "cnc-m-0 cnc-text-center cnc-text-[11px] cnc-text-brand-gray-600", children: lembretes.length === 1 ? "Ao fechar, este lembrete \xE9 marcado como lido." : `Ao fechar, os ${lembretes.length} lembretes s\xE3o marcados como lidos.` })
|
|
5044
|
+
] })
|
|
5045
|
+
]
|
|
5046
|
+
}
|
|
5047
|
+
)
|
|
5048
|
+
}
|
|
5049
|
+
);
|
|
5050
|
+
}
|
|
5051
|
+
|
|
5052
|
+
// src/components/organisms/header-notifications/usar-notificacoes.ts
|
|
5053
|
+
var React17 = __toESM(require("react"));
|
|
5054
|
+
function foiAbortado(erro) {
|
|
5055
|
+
return erro?.name === "AbortError";
|
|
5056
|
+
}
|
|
5057
|
+
function usarNotificacoes({
|
|
5058
|
+
email,
|
|
5059
|
+
sistema,
|
|
5060
|
+
baseUrl,
|
|
5061
|
+
filtros,
|
|
5062
|
+
intervaloAtualizacao = 6e4,
|
|
5063
|
+
habilitado = true,
|
|
5064
|
+
onErro
|
|
5065
|
+
}) {
|
|
5066
|
+
const [notificacoes, setNotificacoes] = React17.useState([]);
|
|
5067
|
+
const [carregando, setCarregando] = React17.useState(habilitado);
|
|
5068
|
+
const notificacoesRef = React17.useRef(notificacoes);
|
|
5069
|
+
const controladorRef = React17.useRef(null);
|
|
5070
|
+
const jaCarregouRef = React17.useRef(false);
|
|
5071
|
+
const onErroRef = React17.useRef(onErro);
|
|
5072
|
+
React17.useEffect(() => {
|
|
5073
|
+
notificacoesRef.current = notificacoes;
|
|
5074
|
+
}, [notificacoes]);
|
|
5075
|
+
React17.useEffect(() => {
|
|
5076
|
+
onErroRef.current = onErro;
|
|
5077
|
+
}, [onErro]);
|
|
5078
|
+
const chaveFiltros = JSON.stringify(filtros ?? {});
|
|
5079
|
+
const atualizar = React17.useCallback(() => {
|
|
5080
|
+
if (!habilitado) return;
|
|
5081
|
+
controladorRef.current?.abort();
|
|
5082
|
+
const controlador = new AbortController();
|
|
5083
|
+
controladorRef.current = controlador;
|
|
5084
|
+
void (async () => {
|
|
5085
|
+
try {
|
|
5086
|
+
const lista = await buscarNotificacoes({
|
|
5087
|
+
baseUrl,
|
|
5088
|
+
email,
|
|
5089
|
+
sistema,
|
|
5090
|
+
filtros: JSON.parse(chaveFiltros),
|
|
5091
|
+
signal: controlador.signal
|
|
5092
|
+
});
|
|
5093
|
+
if (controlador.signal.aborted) return;
|
|
5094
|
+
setNotificacoes(lista);
|
|
5095
|
+
} catch (erro) {
|
|
5096
|
+
if (controlador.signal.aborted || foiAbortado(erro)) return;
|
|
5097
|
+
onErroRef.current?.(erro);
|
|
5098
|
+
} finally {
|
|
5099
|
+
if (!controlador.signal.aborted) {
|
|
5100
|
+
jaCarregouRef.current = true;
|
|
5101
|
+
setCarregando(false);
|
|
5102
|
+
}
|
|
5103
|
+
}
|
|
5104
|
+
})();
|
|
5105
|
+
}, [baseUrl, email, sistema, chaveFiltros, habilitado]);
|
|
5106
|
+
React17.useEffect(() => {
|
|
5107
|
+
if (!habilitado) {
|
|
5108
|
+
setCarregando(false);
|
|
5109
|
+
return;
|
|
5110
|
+
}
|
|
5111
|
+
if (!jaCarregouRef.current) setCarregando(true);
|
|
5112
|
+
atualizar();
|
|
5113
|
+
return () => controladorRef.current?.abort();
|
|
5114
|
+
}, [atualizar, habilitado]);
|
|
5115
|
+
React17.useEffect(() => {
|
|
5116
|
+
if (!habilitado || !intervaloAtualizacao) return;
|
|
5117
|
+
const temporizador = window.setInterval(() => {
|
|
5118
|
+
if (typeof document !== "undefined" && document.hidden) return;
|
|
5119
|
+
atualizar();
|
|
5120
|
+
}, intervaloAtualizacao);
|
|
5121
|
+
return () => window.clearInterval(temporizador);
|
|
5122
|
+
}, [atualizar, habilitado, intervaloAtualizacao]);
|
|
5123
|
+
const aplicarLeitura = React17.useCallback((ids) => {
|
|
5124
|
+
const alvos = new Set(ids.map(String));
|
|
5125
|
+
setNotificacoes(
|
|
5126
|
+
(atuais) => atuais.map(
|
|
5127
|
+
(notificacao) => alvos.has(String(notificacao.id)) ? { ...notificacao, statusLeitura: "LIDO" } : notificacao
|
|
5128
|
+
)
|
|
5129
|
+
);
|
|
5130
|
+
}, []);
|
|
5131
|
+
const reverterLeitura = React17.useCallback((anteriores) => {
|
|
5132
|
+
const original = new Map(
|
|
5133
|
+
anteriores.map((notificacao) => [String(notificacao.id), notificacao])
|
|
5134
|
+
);
|
|
5135
|
+
setNotificacoes(
|
|
5136
|
+
(atuais) => atuais.map((notificacao) => {
|
|
5137
|
+
const anterior = original.get(String(notificacao.id));
|
|
5138
|
+
return anterior ? {
|
|
5139
|
+
...notificacao,
|
|
5140
|
+
statusLeitura: anterior.statusLeitura,
|
|
5141
|
+
lidoEm: anterior.lidoEm
|
|
5142
|
+
} : notificacao;
|
|
5143
|
+
})
|
|
5144
|
+
);
|
|
5145
|
+
}, []);
|
|
5146
|
+
const marcarUmaComoLida = React17.useCallback(
|
|
5147
|
+
(id) => {
|
|
5148
|
+
const alvo = notificacoesRef.current.find(
|
|
5149
|
+
(notificacao) => String(notificacao.id) === String(id)
|
|
5150
|
+
);
|
|
5151
|
+
if (!alvo || alvo.statusLeitura === "LIDO") return;
|
|
5152
|
+
aplicarLeitura([id]);
|
|
5153
|
+
void marcarComoLida({ baseUrl, id }).catch((erro) => {
|
|
5154
|
+
reverterLeitura([alvo]);
|
|
5155
|
+
onErroRef.current?.(erro);
|
|
5156
|
+
});
|
|
5157
|
+
},
|
|
5158
|
+
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
5159
|
+
);
|
|
5160
|
+
const marcarComoLidas = React17.useCallback(
|
|
5161
|
+
(ids) => {
|
|
5162
|
+
const alvos = new Set(ids.map(String));
|
|
5163
|
+
const naoLidas = notificacoesRef.current.filter(
|
|
5164
|
+
(notificacao) => alvos.has(String(notificacao.id)) && notificacao.statusLeitura !== "LIDO"
|
|
5165
|
+
);
|
|
5166
|
+
if (naoLidas.length === 0) return;
|
|
5167
|
+
aplicarLeitura(naoLidas.map((notificacao) => notificacao.id));
|
|
5168
|
+
void marcarVariasComoLidas({
|
|
5169
|
+
baseUrl,
|
|
5170
|
+
ids: naoLidas.map((notificacao) => notificacao.id)
|
|
5171
|
+
}).catch((erro) => {
|
|
5172
|
+
reverterLeitura(naoLidas);
|
|
5173
|
+
onErroRef.current?.(erro);
|
|
5174
|
+
});
|
|
5175
|
+
},
|
|
5176
|
+
[baseUrl, aplicarLeitura, reverterLeitura]
|
|
5177
|
+
);
|
|
5178
|
+
const marcarTodasComoLidas = React17.useCallback(() => {
|
|
5179
|
+
marcarComoLidas(notificacoesRef.current.map((notificacao) => notificacao.id));
|
|
5180
|
+
}, [marcarComoLidas]);
|
|
5181
|
+
const marcarUmaComoNaoLida = React17.useCallback(
|
|
5182
|
+
(id) => {
|
|
5183
|
+
const alvo = notificacoesRef.current.find(
|
|
5184
|
+
(notificacao) => String(notificacao.id) === String(id)
|
|
5185
|
+
);
|
|
5186
|
+
if (!alvo || alvo.statusLeitura === "NAO_LIDO") return;
|
|
5187
|
+
setNotificacoes(
|
|
5188
|
+
(atuais) => atuais.map(
|
|
5189
|
+
(notificacao) => String(notificacao.id) === String(id) ? { ...notificacao, statusLeitura: "NAO_LIDO" } : notificacao
|
|
5190
|
+
)
|
|
5191
|
+
);
|
|
5192
|
+
void marcarComoNaoLida({ baseUrl, id }).catch((erro) => {
|
|
5193
|
+
reverterLeitura([alvo]);
|
|
5194
|
+
onErroRef.current?.(erro);
|
|
5195
|
+
});
|
|
5196
|
+
},
|
|
5197
|
+
[baseUrl, reverterLeitura]
|
|
5198
|
+
);
|
|
5199
|
+
const excluir = React17.useCallback(
|
|
5200
|
+
(id) => {
|
|
5201
|
+
const alvo = notificacoesRef.current.find(
|
|
5202
|
+
(notificacao) => String(notificacao.id) === String(id)
|
|
5203
|
+
);
|
|
5204
|
+
if (!alvo) return;
|
|
5205
|
+
setNotificacoes(
|
|
5206
|
+
(atuais) => atuais.filter((notificacao) => String(notificacao.id) !== String(id))
|
|
5207
|
+
);
|
|
5208
|
+
void excluirNotificacao({ baseUrl, id }).catch((erro) => {
|
|
5209
|
+
onErroRef.current?.(erro);
|
|
5210
|
+
atualizar();
|
|
5211
|
+
});
|
|
5212
|
+
},
|
|
5213
|
+
[baseUrl, atualizar]
|
|
5214
|
+
);
|
|
5215
|
+
return {
|
|
5216
|
+
notificacoes,
|
|
5217
|
+
carregando,
|
|
5218
|
+
atualizar,
|
|
5219
|
+
marcarUmaComoLida,
|
|
5220
|
+
marcarUmaComoNaoLida,
|
|
5221
|
+
marcarComoLidas,
|
|
5222
|
+
marcarTodasComoLidas,
|
|
5223
|
+
excluir
|
|
5224
|
+
};
|
|
5225
|
+
}
|
|
5226
|
+
|
|
5227
|
+
// src/components/organisms/header-notifications/index.tsx
|
|
5228
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5229
|
+
function HeaderNotifications(props) {
|
|
5230
|
+
const {
|
|
5231
|
+
items = [],
|
|
5232
|
+
isLoading = false,
|
|
5233
|
+
skeletonCount = 3,
|
|
5234
|
+
title = "Notifica\xE7\xF5es",
|
|
5235
|
+
emptyMessage = "Nenhuma notifica\xE7\xE3o",
|
|
5236
|
+
unreadCount,
|
|
5237
|
+
maxCount = 9,
|
|
5238
|
+
onSelect,
|
|
5239
|
+
onMarkAsRead,
|
|
5240
|
+
onMarkAsUnread,
|
|
5241
|
+
onDelete,
|
|
5242
|
+
onMarkAllAsRead,
|
|
5243
|
+
onOpenChange,
|
|
5244
|
+
footer,
|
|
5245
|
+
align = "end",
|
|
5246
|
+
className,
|
|
5247
|
+
contentClassName,
|
|
5248
|
+
email,
|
|
5249
|
+
sistema,
|
|
5250
|
+
baseUrl = URL_PADRAO_NOTIFICACOES,
|
|
5251
|
+
getHref,
|
|
5252
|
+
filtros,
|
|
5253
|
+
intervaloAtualizacao,
|
|
5254
|
+
limite = 20,
|
|
5255
|
+
onErro,
|
|
5256
|
+
alertarLembretes = false,
|
|
5257
|
+
tituloLembretes,
|
|
5258
|
+
rotuloDispensarLembretes
|
|
5259
|
+
} = props;
|
|
5260
|
+
const [aberto, setAberto] = React18.useState(false);
|
|
5261
|
+
const [lembretesEmAlerta, setLembretesEmAlerta] = React18.useState(
|
|
5262
|
+
[]
|
|
5263
|
+
);
|
|
5264
|
+
const avaliouLembretesRef = React18.useRef(false);
|
|
5265
|
+
const conectado = Boolean(email && sistema);
|
|
5266
|
+
const remoto = usarNotificacoes({
|
|
5267
|
+
email: email ?? "",
|
|
5268
|
+
sistema: sistema ?? "",
|
|
5269
|
+
baseUrl,
|
|
5270
|
+
filtros,
|
|
5271
|
+
intervaloAtualizacao,
|
|
5272
|
+
habilitado: conectado,
|
|
5273
|
+
onErro
|
|
5274
|
+
});
|
|
5275
|
+
const elegiveis = React18.useMemo(
|
|
5276
|
+
() => conectado ? selecionarVisiveis(remoto.notificacoes) : [],
|
|
5277
|
+
[conectado, remoto.notificacoes]
|
|
5278
|
+
);
|
|
5279
|
+
const itensRemotos = React18.useMemo(
|
|
5280
|
+
() => elegiveis.slice(0, limite).map((notificacao) => mapearParaItem(notificacao, getHref)),
|
|
5281
|
+
[elegiveis, limite, getHref]
|
|
5282
|
+
);
|
|
5283
|
+
const itens = conectado ? itensRemotos : items;
|
|
5284
|
+
const carregandoLista = conectado ? remoto.carregando : isLoading;
|
|
5285
|
+
React18.useEffect(() => {
|
|
5286
|
+
if (!conectado || !alertarLembretes) return;
|
|
5287
|
+
if (remoto.carregando || avaliouLembretesRef.current) return;
|
|
5288
|
+
avaliouLembretesRef.current = true;
|
|
5289
|
+
setLembretesEmAlerta(selecionarLembretesVencidos(remoto.notificacoes));
|
|
5290
|
+
}, [conectado, alertarLembretes, remoto.carregando, remoto.notificacoes]);
|
|
5291
|
+
const dispensarLembretes = () => {
|
|
5292
|
+
remoto.marcarComoLidas(lembretesEmAlerta.map((lembrete) => lembrete.id));
|
|
5293
|
+
setLembretesEmAlerta([]);
|
|
5294
|
+
};
|
|
5295
|
+
const naoLidas = conectado ? contarNaoLidas(elegiveis) : unreadCount ?? items.filter((item) => !item.read).length;
|
|
5296
|
+
const rotuloContagem = naoLidas > maxCount ? `${maxCount}+` : `${naoLidas}`;
|
|
5297
|
+
const alterarAbertura = (proximoEstado) => {
|
|
5298
|
+
setAberto(proximoEstado);
|
|
5299
|
+
if (proximoEstado && conectado) remoto.atualizar();
|
|
5300
|
+
onOpenChange?.(proximoEstado);
|
|
5301
|
+
};
|
|
5302
|
+
const selecionar = (item) => {
|
|
5303
|
+
if (!item.read) {
|
|
5304
|
+
if (conectado) remoto.marcarUmaComoLida(item.id);
|
|
5305
|
+
onMarkAsRead?.(item);
|
|
5306
|
+
}
|
|
5307
|
+
if (!onSelect) return;
|
|
5308
|
+
onSelect(item);
|
|
5309
|
+
alterarAbertura(false);
|
|
5310
|
+
};
|
|
5311
|
+
const marcarTodas = () => {
|
|
5312
|
+
if (conectado) remoto.marcarTodasComoLidas();
|
|
5313
|
+
onMarkAllAsRead?.();
|
|
5314
|
+
};
|
|
5315
|
+
const alternarLeitura = (item) => {
|
|
5316
|
+
if (item.read) {
|
|
5317
|
+
if (conectado) remoto.marcarUmaComoNaoLida(item.id);
|
|
5318
|
+
onMarkAsUnread?.(item);
|
|
5319
|
+
return;
|
|
5320
|
+
}
|
|
5321
|
+
if (conectado) remoto.marcarUmaComoLida(item.id);
|
|
5322
|
+
onMarkAsRead?.(item);
|
|
5323
|
+
};
|
|
5324
|
+
const excluirItem = (item) => {
|
|
5325
|
+
if (conectado) remoto.excluir(item.id);
|
|
5326
|
+
onDelete?.(item);
|
|
5327
|
+
};
|
|
5328
|
+
const podeMarcarTodas = conectado || Boolean(onMarkAllAsRead);
|
|
5329
|
+
const podeAlternarLeitura = conectado || Boolean(onMarkAsUnread);
|
|
5330
|
+
const podeExcluir = conectado || Boolean(onDelete);
|
|
5331
|
+
const alvoClicavel = conectado || Boolean(onSelect) || Boolean(onMarkAsRead);
|
|
5332
|
+
const anelDeFoco = "focus-visible:cnc-ring-2 focus-visible:cnc-ring-inset focus-visible:cnc-ring-brand-gray-500/50";
|
|
5333
|
+
const renderarConteudo = () => {
|
|
5334
|
+
if (carregandoLista) {
|
|
5335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { "aria-busy": "true", children: Array.from({ length: skeletonCount }).map((_, indice) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5336
|
+
"div",
|
|
5337
|
+
{
|
|
5338
|
+
className: "cnc-flex cnc-border-b cnc-border-l-[3px] cnc-border-brand-gray-50 cnc-border-l-transparent cnc-py-3 cnc-pl-3 cnc-pr-4 last:cnc-border-b-0",
|
|
5339
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "cnc-flex cnc-w-full cnc-flex-col cnc-gap-2", children: [
|
|
5340
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "cnc-h-3 cnc-w-1/2 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" }),
|
|
5341
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "cnc-h-3 cnc-w-3/4 cnc-animate-pulse cnc-rounded cnc-bg-brand-gray-20" })
|
|
5342
|
+
] })
|
|
5343
|
+
},
|
|
5344
|
+
indice
|
|
5345
|
+
)) });
|
|
5346
|
+
}
|
|
5347
|
+
if (itens.length === 0) {
|
|
5348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "cnc-flex cnc-flex-col cnc-items-center cnc-justify-center cnc-px-4 cnc-py-12 cnc-text-brand-gray-200", children: [
|
|
5349
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BellOff, { className: "cnc-mb-2 cnc-h-7 cnc-w-7", "aria-hidden": "true" }),
|
|
5350
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "cnc-text-sm", children: emptyMessage })
|
|
5351
|
+
] });
|
|
5352
|
+
}
|
|
5353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("ul", { className: "cnc-m-0 cnc-list-none cnc-p-0", children: itens.map((item) => {
|
|
5354
|
+
const conteudo = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "cnc-flex cnc-min-w-0 cnc-flex-1 cnc-flex-col cnc-gap-0.5", children: [
|
|
5355
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "cnc-flex cnc-items-baseline cnc-justify-between cnc-gap-2", children: [
|
|
5356
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5357
|
+
"span",
|
|
5358
|
+
{
|
|
5359
|
+
className: cn(
|
|
5360
|
+
"cnc-truncate cnc-text-sm cnc-text-brand-blue-900",
|
|
5361
|
+
item.read ? "cnc-font-medium" : "cnc-font-bold"
|
|
5362
|
+
),
|
|
5363
|
+
children: item.title
|
|
5364
|
+
}
|
|
5365
|
+
),
|
|
5366
|
+
item.date && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "cnc-shrink-0 cnc-text-[11px] cnc-text-brand-gray-600", children: item.date })
|
|
5367
|
+
] }),
|
|
5368
|
+
item.message && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "cnc-line-clamp-2 cnc-text-xs cnc-text-brand-gray-600", children: item.message }),
|
|
5369
|
+
!item.read && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "cnc-sr-only", children: "N\xE3o lida" })
|
|
5370
|
+
] });
|
|
5371
|
+
const classesLinha = cn(
|
|
5372
|
+
"cnc-flex cnc-w-full cnc-items-start cnc-border-l-[3px] cnc-transition cnc-duration-200",
|
|
5373
|
+
item.read ? "cnc-border-l-transparent hover:cnc-bg-brand-blue-50" : "cnc-border-l-brand-blue-400 cnc-bg-brand-blue-50 hover:cnc-bg-brand-blue-60"
|
|
5374
|
+
);
|
|
5375
|
+
const classesAlvo = cn(
|
|
5376
|
+
"cnc-flex cnc-min-w-0 cnc-flex-1 cnc-bg-transparent cnc-py-3 cnc-pl-3 cnc-pr-2 cnc-text-left cnc-no-underline cnc-outline-none",
|
|
5377
|
+
alvoClicavel && "cnc-cursor-pointer",
|
|
5378
|
+
anelDeFoco
|
|
5379
|
+
);
|
|
5380
|
+
const classesAcao = cn(
|
|
5381
|
+
"cnc-flex cnc-h-7 cnc-w-7 cnc-shrink-0 cnc-cursor-pointer cnc-items-center cnc-justify-center cnc-rounded cnc-border-0 cnc-bg-transparent cnc-p-0 cnc-text-brand-gray-200 cnc-outline-none cnc-transition cnc-duration-200 hover:cnc-bg-white",
|
|
5382
|
+
anelDeFoco
|
|
5383
|
+
);
|
|
5384
|
+
const renderarAlvo = () => alvoClicavel ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5385
|
+
"button",
|
|
5386
|
+
{
|
|
5387
|
+
type: "button",
|
|
5388
|
+
onClick: () => selecionar(item),
|
|
5389
|
+
className: classesAlvo,
|
|
5390
|
+
children: conteudo
|
|
5391
|
+
}
|
|
5392
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: classesAlvo, children: conteudo });
|
|
5393
|
+
const rotuloLeitura = item.read ? "Marcar como n\xE3o lida" : "Marcar como lida";
|
|
5394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5395
|
+
"li",
|
|
5396
|
+
{
|
|
5397
|
+
className: "cnc-border-b cnc-border-brand-gray-50 last:cnc-border-b-0",
|
|
5398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: classesLinha, children: [
|
|
5399
|
+
renderarAlvo(),
|
|
5400
|
+
(podeAlternarLeitura || podeExcluir) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "cnc-flex cnc-shrink-0 cnc-items-center cnc-gap-1 cnc-py-3 cnc-pr-2", children: [
|
|
5401
|
+
podeAlternarLeitura && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5402
|
+
"button",
|
|
5403
|
+
{
|
|
5404
|
+
type: "button",
|
|
5405
|
+
"aria-label": rotuloLeitura,
|
|
5406
|
+
title: rotuloLeitura,
|
|
5407
|
+
onClick: () => alternarLeitura(item),
|
|
5408
|
+
className: cn(
|
|
5409
|
+
classesAcao,
|
|
5410
|
+
"hover:cnc-text-brand-blue-400"
|
|
5411
|
+
),
|
|
5412
|
+
children: item.read ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Mail, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5413
|
+
MailOpen,
|
|
5414
|
+
{
|
|
5415
|
+
className: "cnc-h-4 cnc-w-4",
|
|
5416
|
+
"aria-hidden": "true"
|
|
5417
|
+
}
|
|
5418
|
+
)
|
|
5419
|
+
}
|
|
5420
|
+
),
|
|
5421
|
+
podeExcluir && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5422
|
+
"button",
|
|
5423
|
+
{
|
|
5424
|
+
type: "button",
|
|
5425
|
+
"aria-label": "Excluir notifica\xE7\xE3o",
|
|
5426
|
+
title: "Excluir notifica\xE7\xE3o",
|
|
5427
|
+
onClick: () => excluirItem(item),
|
|
5428
|
+
className: cn(classesAcao, "hover:cnc-text-brand-red-600"),
|
|
5429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Trash2, { className: "cnc-h-4 cnc-w-4", "aria-hidden": "true" })
|
|
5430
|
+
}
|
|
5431
|
+
)
|
|
5432
|
+
] })
|
|
5433
|
+
] })
|
|
5434
|
+
},
|
|
5435
|
+
item.id
|
|
5436
|
+
);
|
|
5437
|
+
}) });
|
|
5438
|
+
};
|
|
5439
|
+
const temRodapePadrao = podeMarcarTodas && naoLidas > 0;
|
|
5440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
5441
|
+
alertarLembretes && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5442
|
+
ModalLembretes,
|
|
5443
|
+
{
|
|
5444
|
+
lembretes: lembretesEmAlerta,
|
|
5445
|
+
aberto: lembretesEmAlerta.length > 0,
|
|
5446
|
+
onDispensar: dispensarLembretes,
|
|
5447
|
+
titulo: tituloLembretes,
|
|
5448
|
+
rotuloDispensar: rotuloDispensarLembretes
|
|
5449
|
+
}
|
|
5450
|
+
),
|
|
5451
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Popover, { open: aberto, onOpenChange: alterarAbertura, children: [
|
|
5452
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5453
|
+
"button",
|
|
5454
|
+
{
|
|
5455
|
+
type: "button",
|
|
5456
|
+
"aria-label": naoLidas > 0 ? `${title}, ${naoLidas} n\xE3o ${naoLidas === 1 ? "lida" : "lidas"}` : title,
|
|
5457
|
+
className: cn(
|
|
5458
|
+
"cnc-relative cnc-flex cnc-h-10 cnc-w-10 cnc-items-center cnc-justify-center cnc-rounded-full cnc-transition cnc-duration-300 cnc-ease-in-out hover:cnc-bg-brand-blue-60 data-[state=open]:cnc-bg-brand-blue-60 cnc-cursor-pointer cnc-outline-none cnc-header-item",
|
|
5459
|
+
anelDeFoco,
|
|
5460
|
+
className
|
|
5461
|
+
),
|
|
5462
|
+
children: [
|
|
5463
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5464
|
+
Bell,
|
|
5465
|
+
{
|
|
5466
|
+
className: "cnc-h-5 cnc-w-5 cnc-text-brand-blue-900 cnc-header-item",
|
|
5467
|
+
"aria-hidden": "true"
|
|
5468
|
+
}
|
|
5469
|
+
),
|
|
5470
|
+
naoLidas > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5471
|
+
"span",
|
|
5472
|
+
{
|
|
5473
|
+
"aria-hidden": "true",
|
|
5474
|
+
className: "cnc-absolute -cnc-right-0.5 -cnc-top-0.5 cnc-flex cnc-h-[18px] cnc-min-w-[18px] cnc-items-center cnc-justify-center cnc-rounded-full cnc-border-2 cnc-border-white cnc-bg-brand-red-500 cnc-px-1 cnc-text-[10px] cnc-font-bold cnc-leading-none cnc-text-white",
|
|
5475
|
+
children: rotuloContagem
|
|
5476
|
+
}
|
|
5477
|
+
)
|
|
5478
|
+
]
|
|
5479
|
+
}
|
|
5480
|
+
) }),
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5482
|
+
PopoverContent,
|
|
5483
|
+
{
|
|
5484
|
+
align,
|
|
5485
|
+
sideOffset: 20,
|
|
5486
|
+
"aria-label": title,
|
|
5487
|
+
style: { width: "min(380px, calc(100vw - 2rem))", padding: 0 },
|
|
5488
|
+
className: cn(
|
|
5489
|
+
"cnc-overflow-hidden cnc-rounded-lg cnc-border cnc-border-brand-gray-50 cnc-bg-white cnc-shadow-custom",
|
|
5490
|
+
contentClassName
|
|
5491
|
+
),
|
|
5492
|
+
children: [
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "cnc-flex cnc-items-center cnc-justify-between cnc-gap-2 cnc-border-b cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: [
|
|
5494
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "cnc-m-0 cnc-text-base cnc-font-extrabold cnc-text-brand-blue-900", children: title }),
|
|
5495
|
+
naoLidas > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "cnc-rounded-md cnc-bg-brand-blue-60 cnc-px-2 cnc-py-1 cnc-text-xs cnc-font-semibold cnc-text-brand-blue-400", children: naoLidas === 1 ? "1 nova" : `${naoLidas} novas` })
|
|
5496
|
+
] }),
|
|
5497
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "cnc-max-h-[360px] cnc-overflow-y-auto", children: renderarConteudo() }),
|
|
5498
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "cnc-border-t cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: footer }) : temRodapePadrao && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "cnc-flex cnc-justify-end cnc-border-t cnc-border-brand-gray-50 cnc-px-4 cnc-py-3", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5499
|
+
"button",
|
|
5500
|
+
{
|
|
5501
|
+
type: "button",
|
|
5502
|
+
onClick: marcarTodas,
|
|
5503
|
+
className: cn(
|
|
5504
|
+
"cnc-cursor-pointer cnc-rounded cnc-bg-transparent cnc-p-0 cnc-text-xs cnc-font-semibold cnc-text-brand-blue-100 cnc-outline-none hover:cnc-underline",
|
|
5505
|
+
anelDeFoco
|
|
5506
|
+
),
|
|
5507
|
+
children: "Marcar todas como lidas"
|
|
5508
|
+
}
|
|
5509
|
+
) })
|
|
5510
|
+
]
|
|
5511
|
+
}
|
|
5512
|
+
)
|
|
5513
|
+
] })
|
|
5514
|
+
] });
|
|
5515
|
+
}
|
|
4741
5516
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4742
5517
|
0 && (module.exports = {
|
|
4743
5518
|
AplicationsHeader,
|
|
@@ -4789,9 +5564,11 @@ function CardList({
|
|
|
4789
5564
|
DropdownMenuSubContent,
|
|
4790
5565
|
DropdownMenuSubTrigger,
|
|
4791
5566
|
DropdownMenuTrigger,
|
|
5567
|
+
ErroNotificacoes,
|
|
4792
5568
|
Filter,
|
|
4793
5569
|
Header,
|
|
4794
5570
|
HeaderContainer,
|
|
5571
|
+
HeaderNotifications,
|
|
4795
5572
|
HeaderProfileHeader,
|
|
4796
5573
|
HeaderProfileItem,
|
|
4797
5574
|
Input,
|
|
@@ -4828,6 +5605,7 @@ function CardList({
|
|
|
4828
5605
|
TabsList,
|
|
4829
5606
|
TabsTrigger,
|
|
4830
5607
|
Title,
|
|
5608
|
+
URL_PADRAO_NOTIFICACOES,
|
|
4831
5609
|
availableApps,
|
|
4832
5610
|
buttonVariants
|
|
4833
5611
|
});
|
|
@@ -4865,6 +5643,30 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
4865
5643
|
* See the LICENSE file in the root directory of this source tree.
|
|
4866
5644
|
*)
|
|
4867
5645
|
|
|
5646
|
+
lucide-react/dist/esm/icons/bell-off.js:
|
|
5647
|
+
(**
|
|
5648
|
+
* @license lucide-react v0.453.0 - ISC
|
|
5649
|
+
*
|
|
5650
|
+
* This source code is licensed under the ISC license.
|
|
5651
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
5652
|
+
*)
|
|
5653
|
+
|
|
5654
|
+
lucide-react/dist/esm/icons/bell-ring.js:
|
|
5655
|
+
(**
|
|
5656
|
+
* @license lucide-react v0.453.0 - ISC
|
|
5657
|
+
*
|
|
5658
|
+
* This source code is licensed under the ISC license.
|
|
5659
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
5660
|
+
*)
|
|
5661
|
+
|
|
5662
|
+
lucide-react/dist/esm/icons/bell.js:
|
|
5663
|
+
(**
|
|
5664
|
+
* @license lucide-react v0.453.0 - ISC
|
|
5665
|
+
*
|
|
5666
|
+
* This source code is licensed under the ISC license.
|
|
5667
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
5668
|
+
*)
|
|
5669
|
+
|
|
4868
5670
|
lucide-react/dist/esm/icons/check.js:
|
|
4869
5671
|
(**
|
|
4870
5672
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -4945,6 +5747,22 @@ lucide-react/dist/esm/icons/loader-circle.js:
|
|
|
4945
5747
|
* See the LICENSE file in the root directory of this source tree.
|
|
4946
5748
|
*)
|
|
4947
5749
|
|
|
5750
|
+
lucide-react/dist/esm/icons/mail-open.js:
|
|
5751
|
+
(**
|
|
5752
|
+
* @license lucide-react v0.453.0 - ISC
|
|
5753
|
+
*
|
|
5754
|
+
* This source code is licensed under the ISC license.
|
|
5755
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
5756
|
+
*)
|
|
5757
|
+
|
|
5758
|
+
lucide-react/dist/esm/icons/mail.js:
|
|
5759
|
+
(**
|
|
5760
|
+
* @license lucide-react v0.453.0 - ISC
|
|
5761
|
+
*
|
|
5762
|
+
* This source code is licensed under the ISC license.
|
|
5763
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
5764
|
+
*)
|
|
5765
|
+
|
|
4948
5766
|
lucide-react/dist/esm/icons/search.js:
|
|
4949
5767
|
(**
|
|
4950
5768
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -4953,6 +5771,14 @@ lucide-react/dist/esm/icons/search.js:
|
|
|
4953
5771
|
* See the LICENSE file in the root directory of this source tree.
|
|
4954
5772
|
*)
|
|
4955
5773
|
|
|
5774
|
+
lucide-react/dist/esm/icons/trash-2.js:
|
|
5775
|
+
(**
|
|
5776
|
+
* @license lucide-react v0.453.0 - ISC
|
|
5777
|
+
*
|
|
5778
|
+
* This source code is licensed under the ISC license.
|
|
5779
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
5780
|
+
*)
|
|
5781
|
+
|
|
4956
5782
|
lucide-react/dist/esm/icons/x.js:
|
|
4957
5783
|
(**
|
|
4958
5784
|
* @license lucide-react v0.453.0 - ISC
|