analytica-frontend-lib 1.1.52 → 1.1.54
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/Modal/index.d.mts +14 -5
- package/dist/Modal/index.d.ts +14 -5
- package/dist/Modal/index.js +216 -31
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.mjs +217 -32
- package/dist/Modal/index.mjs.map +1 -1
- package/dist/Modal/utils/videoUtils/index.d.mts +28 -0
- package/dist/Modal/utils/videoUtils/index.d.ts +28 -0
- package/dist/Modal/utils/videoUtils/index.js +76 -0
- package/dist/Modal/utils/videoUtils/index.js.map +1 -0
- package/dist/Modal/utils/videoUtils/index.mjs +49 -0
- package/dist/Modal/utils/videoUtils/index.mjs.map +1 -0
- package/dist/NotificationCard/index.js +325 -99
- package/dist/NotificationCard/index.js.map +1 -1
- package/dist/NotificationCard/index.mjs +326 -100
- package/dist/NotificationCard/index.mjs.map +1 -1
- package/dist/Quiz/index.js +154 -26
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +166 -38
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/index.css +10 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +173 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +182 -54
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +10 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
2
|
-
import { DotsThreeVertical, Bell } from "phosphor-react";
|
|
2
|
+
import { DotsThreeVertical, Bell as Bell2 } from "phosphor-react";
|
|
3
3
|
import { useState as useState3, useEffect as useEffect4 } from "react";
|
|
4
4
|
|
|
5
5
|
// src/utils/utils.ts
|
|
@@ -644,8 +644,54 @@ IconButton.displayName = "IconButton";
|
|
|
644
644
|
var IconButton_default = IconButton;
|
|
645
645
|
|
|
646
646
|
// src/components/Modal/Modal.tsx
|
|
647
|
-
import { useEffect as useEffect2 } from "react";
|
|
647
|
+
import { useEffect as useEffect2, useId } from "react";
|
|
648
648
|
import { X } from "phosphor-react";
|
|
649
|
+
|
|
650
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
651
|
+
var isYouTubeUrl = (url) => {
|
|
652
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
653
|
+
return youtubeRegex.test(url);
|
|
654
|
+
};
|
|
655
|
+
var isValidYouTubeHost = (host) => {
|
|
656
|
+
if (host === "youtu.be") return "youtu.be";
|
|
657
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
658
|
+
if (isValidYouTubeCom) return "youtube";
|
|
659
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
660
|
+
if (isValidNoCookie) return "nocookie";
|
|
661
|
+
return null;
|
|
662
|
+
};
|
|
663
|
+
var extractYoutuBeId = (pathname) => {
|
|
664
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
665
|
+
return firstSeg || null;
|
|
666
|
+
};
|
|
667
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
668
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
669
|
+
const [first, second] = parts;
|
|
670
|
+
if (first === "embed" && second) return second;
|
|
671
|
+
if (first === "shorts" && second) return second;
|
|
672
|
+
if (first === "live" && second) return second;
|
|
673
|
+
const v = searchParams.get("v");
|
|
674
|
+
if (v) return v;
|
|
675
|
+
return null;
|
|
676
|
+
};
|
|
677
|
+
var getYouTubeVideoId = (url) => {
|
|
678
|
+
try {
|
|
679
|
+
const u = new URL(url);
|
|
680
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
681
|
+
if (!hostType) return null;
|
|
682
|
+
if (hostType === "youtu.be") {
|
|
683
|
+
return extractYoutuBeId(u.pathname);
|
|
684
|
+
}
|
|
685
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
686
|
+
} catch {
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
691
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
// src/components/Modal/Modal.tsx
|
|
649
695
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
650
696
|
var SIZE_CLASSES2 = {
|
|
651
697
|
xs: "max-w-[360px]",
|
|
@@ -661,11 +707,17 @@ var Modal = ({
|
|
|
661
707
|
children,
|
|
662
708
|
size = "md",
|
|
663
709
|
className = "",
|
|
664
|
-
closeOnBackdropClick = true,
|
|
665
710
|
closeOnEscape = true,
|
|
666
711
|
footer,
|
|
667
|
-
hideCloseButton = false
|
|
712
|
+
hideCloseButton = false,
|
|
713
|
+
variant = "default",
|
|
714
|
+
description,
|
|
715
|
+
image,
|
|
716
|
+
imageAlt,
|
|
717
|
+
actionLink,
|
|
718
|
+
actionLabel
|
|
668
719
|
}) => {
|
|
720
|
+
const titleId = useId();
|
|
669
721
|
useEffect2(() => {
|
|
670
722
|
if (!isOpen || !closeOnEscape) return;
|
|
671
723
|
const handleEscape = (event) => {
|
|
@@ -687,16 +739,6 @@ var Modal = ({
|
|
|
687
739
|
document.body.style.overflow = originalOverflow;
|
|
688
740
|
};
|
|
689
741
|
}, [isOpen]);
|
|
690
|
-
const handleBackdropClick = (event) => {
|
|
691
|
-
if (closeOnBackdropClick && event.target === event.currentTarget) {
|
|
692
|
-
onClose();
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
const handleBackdropKeyDown = (event) => {
|
|
696
|
-
if (closeOnBackdropClick && (event.key === "Enter" || event.key === " ")) {
|
|
697
|
-
onClose();
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
742
|
if (!isOpen) return null;
|
|
701
743
|
const sizeClasses = SIZE_CLASSES2[size];
|
|
702
744
|
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
@@ -707,18 +749,105 @@ var Modal = ({
|
|
|
707
749
|
dialogResetClasses,
|
|
708
750
|
className
|
|
709
751
|
);
|
|
710
|
-
|
|
711
|
-
|
|
752
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
753
|
+
const handleActionClick = () => {
|
|
754
|
+
if (actionLink) {
|
|
755
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
if (variant === "activity") {
|
|
759
|
+
return /* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ jsxs4(
|
|
760
|
+
"dialog",
|
|
761
|
+
{
|
|
762
|
+
className: modalClasses,
|
|
763
|
+
"aria-labelledby": titleId,
|
|
764
|
+
"aria-modal": "true",
|
|
765
|
+
open: true,
|
|
766
|
+
children: [
|
|
767
|
+
/* @__PURE__ */ jsx5("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ jsx5(
|
|
768
|
+
"button",
|
|
769
|
+
{
|
|
770
|
+
onClick: onClose,
|
|
771
|
+
className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
|
|
772
|
+
"aria-label": "Fechar modal",
|
|
773
|
+
children: /* @__PURE__ */ jsx5(X, { size: 18 })
|
|
774
|
+
}
|
|
775
|
+
) }),
|
|
776
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
777
|
+
image && /* @__PURE__ */ jsx5("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx5(
|
|
778
|
+
"img",
|
|
779
|
+
{
|
|
780
|
+
src: image,
|
|
781
|
+
alt: imageAlt ?? "",
|
|
782
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
783
|
+
}
|
|
784
|
+
) }),
|
|
785
|
+
/* @__PURE__ */ jsx5(
|
|
786
|
+
"h2",
|
|
787
|
+
{
|
|
788
|
+
id: titleId,
|
|
789
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
790
|
+
children: title
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
description && /* @__PURE__ */ jsx5("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
|
|
794
|
+
actionLink && /* @__PURE__ */ jsxs4("div", { className: "w-full", children: [
|
|
795
|
+
(() => {
|
|
796
|
+
const normalized = normalizeUrl(actionLink);
|
|
797
|
+
const isYT = isYouTubeUrl(normalized);
|
|
798
|
+
if (!isYT) return null;
|
|
799
|
+
const id = getYouTubeVideoId(normalized);
|
|
800
|
+
if (!id) {
|
|
801
|
+
return /* @__PURE__ */ jsx5(
|
|
802
|
+
Button_default,
|
|
803
|
+
{
|
|
804
|
+
variant: "solid",
|
|
805
|
+
action: "primary",
|
|
806
|
+
size: "large",
|
|
807
|
+
className: "w-full",
|
|
808
|
+
onClick: handleActionClick,
|
|
809
|
+
children: actionLabel || "Iniciar Atividade"
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
}
|
|
813
|
+
return /* @__PURE__ */ jsx5(
|
|
814
|
+
"iframe",
|
|
815
|
+
{
|
|
816
|
+
src: getYouTubeEmbedUrl(id),
|
|
817
|
+
className: "w-full aspect-video rounded-lg",
|
|
818
|
+
allowFullScreen: true,
|
|
819
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
820
|
+
title: "V\xEDdeo YouTube"
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
})(),
|
|
824
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ jsx5(
|
|
825
|
+
Button_default,
|
|
826
|
+
{
|
|
827
|
+
variant: "solid",
|
|
828
|
+
action: "primary",
|
|
829
|
+
size: "large",
|
|
830
|
+
className: "w-full",
|
|
831
|
+
onClick: handleActionClick,
|
|
832
|
+
children: actionLabel || "Iniciar Atividade"
|
|
833
|
+
}
|
|
834
|
+
)
|
|
835
|
+
] })
|
|
836
|
+
] })
|
|
837
|
+
]
|
|
838
|
+
}
|
|
839
|
+
) });
|
|
840
|
+
}
|
|
841
|
+
return /* @__PURE__ */ jsx5("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ jsxs4(
|
|
842
|
+
"dialog",
|
|
712
843
|
{
|
|
713
|
-
className:
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
"aria-label": "Fechar modal clicando no fundo",
|
|
719
|
-
children: /* @__PURE__ */ jsxs4("dialog", { className: modalClasses, "aria-labelledby": "modal-title", open: true, children: [
|
|
844
|
+
className: modalClasses,
|
|
845
|
+
"aria-labelledby": titleId,
|
|
846
|
+
"aria-modal": "true",
|
|
847
|
+
open: true,
|
|
848
|
+
children: [
|
|
720
849
|
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
721
|
-
/* @__PURE__ */ jsx5("h2", { id:
|
|
850
|
+
/* @__PURE__ */ jsx5("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
722
851
|
!hideCloseButton && /* @__PURE__ */ jsx5(
|
|
723
852
|
"button",
|
|
724
853
|
{
|
|
@@ -729,11 +858,11 @@ var Modal = ({
|
|
|
729
858
|
}
|
|
730
859
|
)
|
|
731
860
|
] }),
|
|
732
|
-
/* @__PURE__ */ jsx5("div", { className: "px-6 pb-6", children: /* @__PURE__ */ jsx5("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
861
|
+
children && /* @__PURE__ */ jsx5("div", { className: "px-6 pb-6", children: /* @__PURE__ */ jsx5("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
733
862
|
footer && /* @__PURE__ */ jsx5("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
734
|
-
]
|
|
863
|
+
]
|
|
735
864
|
}
|
|
736
|
-
);
|
|
865
|
+
) });
|
|
737
866
|
};
|
|
738
867
|
var Modal_default = Modal;
|
|
739
868
|
|
|
@@ -788,6 +917,103 @@ var Text = ({
|
|
|
788
917
|
};
|
|
789
918
|
var Text_default = Text;
|
|
790
919
|
|
|
920
|
+
// src/components/Badge/Badge.tsx
|
|
921
|
+
import { Bell } from "phosphor-react";
|
|
922
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
923
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
924
|
+
solid: {
|
|
925
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
926
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
927
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
928
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
929
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
930
|
+
},
|
|
931
|
+
outlined: {
|
|
932
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
933
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
934
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
935
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
936
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
937
|
+
},
|
|
938
|
+
exams: {
|
|
939
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
940
|
+
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
941
|
+
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
942
|
+
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
943
|
+
},
|
|
944
|
+
examsOutlined: {
|
|
945
|
+
exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
|
|
946
|
+
exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
|
|
947
|
+
exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
|
|
948
|
+
exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
|
|
949
|
+
},
|
|
950
|
+
resultStatus: {
|
|
951
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
952
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
953
|
+
},
|
|
954
|
+
notification: "text-primary"
|
|
955
|
+
};
|
|
956
|
+
var SIZE_CLASSES3 = {
|
|
957
|
+
small: "text-2xs px-2 py-1",
|
|
958
|
+
medium: "text-xs px-2 py-1",
|
|
959
|
+
large: "text-sm px-2 py-1"
|
|
960
|
+
};
|
|
961
|
+
var SIZE_CLASSES_ICON = {
|
|
962
|
+
small: "size-3",
|
|
963
|
+
medium: "size-3.5",
|
|
964
|
+
large: "size-4"
|
|
965
|
+
};
|
|
966
|
+
var Badge = ({
|
|
967
|
+
children,
|
|
968
|
+
iconLeft,
|
|
969
|
+
iconRight,
|
|
970
|
+
size = "medium",
|
|
971
|
+
variant = "solid",
|
|
972
|
+
action = "error",
|
|
973
|
+
className = "",
|
|
974
|
+
notificationActive = false,
|
|
975
|
+
...props
|
|
976
|
+
}) => {
|
|
977
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
978
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
979
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
980
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
981
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
982
|
+
const baseClassesIcon = "flex items-center";
|
|
983
|
+
if (variant === "notification") {
|
|
984
|
+
return /* @__PURE__ */ jsxs5(
|
|
985
|
+
"div",
|
|
986
|
+
{
|
|
987
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
988
|
+
...props,
|
|
989
|
+
children: [
|
|
990
|
+
/* @__PURE__ */ jsx7(Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
991
|
+
notificationActive && /* @__PURE__ */ jsx7(
|
|
992
|
+
"span",
|
|
993
|
+
{
|
|
994
|
+
"data-testid": "notification-dot",
|
|
995
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
return /* @__PURE__ */ jsxs5(
|
|
1003
|
+
"div",
|
|
1004
|
+
{
|
|
1005
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
1006
|
+
...props,
|
|
1007
|
+
children: [
|
|
1008
|
+
iconLeft && /* @__PURE__ */ jsx7("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
1009
|
+
children,
|
|
1010
|
+
iconRight && /* @__PURE__ */ jsx7("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
};
|
|
1015
|
+
var Badge_default = Badge;
|
|
1016
|
+
|
|
791
1017
|
// src/hooks/useMobile.ts
|
|
792
1018
|
import { useState as useState2, useEffect as useEffect3 } from "react";
|
|
793
1019
|
var MOBILE_WIDTH = 500;
|
|
@@ -878,14 +1104,14 @@ var formatTimeAgo = (date) => {
|
|
|
878
1104
|
};
|
|
879
1105
|
|
|
880
1106
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
881
|
-
import { Fragment, jsx as
|
|
1107
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
882
1108
|
var NotificationEmpty = ({
|
|
883
1109
|
emptyStateImage,
|
|
884
1110
|
emptyStateTitle = "Nenhuma notifica\xE7\xE3o no momento",
|
|
885
1111
|
emptyStateDescription = "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!"
|
|
886
1112
|
}) => {
|
|
887
|
-
return /* @__PURE__ */
|
|
888
|
-
emptyStateImage && /* @__PURE__ */
|
|
1113
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
1114
|
+
emptyStateImage && /* @__PURE__ */ jsx8("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ jsx8(
|
|
889
1115
|
"img",
|
|
890
1116
|
{
|
|
891
1117
|
src: emptyStateImage,
|
|
@@ -895,20 +1121,27 @@ var NotificationEmpty = ({
|
|
|
895
1121
|
className: "object-contain"
|
|
896
1122
|
}
|
|
897
1123
|
) }),
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
1124
|
+
/* @__PURE__ */ jsx8("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: emptyStateTitle }),
|
|
1125
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm font-normal text-text-400 text-center max-w-[316px] leading-[21px]", children: emptyStateDescription })
|
|
900
1126
|
] });
|
|
901
1127
|
};
|
|
902
1128
|
var NotificationHeader = ({
|
|
903
1129
|
unreadCount,
|
|
904
1130
|
variant = "modal"
|
|
905
1131
|
}) => {
|
|
906
|
-
return /* @__PURE__ */
|
|
907
|
-
variant === "modal" ? /* @__PURE__ */
|
|
908
|
-
unreadCount > 0 && /* @__PURE__ */
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1132
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1133
|
+
variant === "modal" ? /* @__PURE__ */ jsx8(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: "Notifica\xE7\xF5es" }) : /* @__PURE__ */ jsx8("h3", { className: "text-sm font-semibold text-text-950", children: "Notifica\xE7\xF5es" }),
|
|
1134
|
+
unreadCount > 0 && /* @__PURE__ */ jsx8(
|
|
1135
|
+
Badge_default,
|
|
1136
|
+
{
|
|
1137
|
+
variant: "solid",
|
|
1138
|
+
action: "info",
|
|
1139
|
+
size: "small",
|
|
1140
|
+
iconLeft: /* @__PURE__ */ jsx8(Bell2, { size: 12, "aria-hidden": "true", focusable: "false" }),
|
|
1141
|
+
className: "border-0",
|
|
1142
|
+
children: unreadCount === 1 ? "1 n\xE3o lida" : `${unreadCount} n\xE3o lidas`
|
|
1143
|
+
}
|
|
1144
|
+
)
|
|
912
1145
|
] });
|
|
913
1146
|
};
|
|
914
1147
|
var SingleNotificationCard = ({
|
|
@@ -940,7 +1173,7 @@ var SingleNotificationCard = ({
|
|
|
940
1173
|
onNavigate();
|
|
941
1174
|
}
|
|
942
1175
|
};
|
|
943
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */ jsxs6(
|
|
944
1177
|
"div",
|
|
945
1178
|
{
|
|
946
1179
|
className: cn(
|
|
@@ -949,20 +1182,20 @@ var SingleNotificationCard = ({
|
|
|
949
1182
|
className
|
|
950
1183
|
),
|
|
951
1184
|
children: [
|
|
952
|
-
/* @__PURE__ */
|
|
953
|
-
!isRead && /* @__PURE__ */
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
/* @__PURE__ */
|
|
956
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 w-full", children: [
|
|
1186
|
+
!isRead && /* @__PURE__ */ jsx8("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
1187
|
+
/* @__PURE__ */ jsx8("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
1188
|
+
/* @__PURE__ */ jsxs6(DropdownMenu_default, { children: [
|
|
1189
|
+
/* @__PURE__ */ jsx8(
|
|
957
1190
|
DropdownMenuTrigger,
|
|
958
1191
|
{
|
|
959
1192
|
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",
|
|
960
1193
|
"aria-label": "Menu de a\xE7\xF5es",
|
|
961
|
-
children: /* @__PURE__ */
|
|
1194
|
+
children: /* @__PURE__ */ jsx8(DotsThreeVertical, { size: 24 })
|
|
962
1195
|
}
|
|
963
1196
|
),
|
|
964
|
-
/* @__PURE__ */
|
|
965
|
-
!isRead && /* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ jsxs6(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
1198
|
+
!isRead && /* @__PURE__ */ jsx8(
|
|
966
1199
|
DropdownMenuItem,
|
|
967
1200
|
{
|
|
968
1201
|
onClick: handleMarkAsRead,
|
|
@@ -970,14 +1203,14 @@ var SingleNotificationCard = ({
|
|
|
970
1203
|
children: "Marcar como lida"
|
|
971
1204
|
}
|
|
972
1205
|
),
|
|
973
|
-
/* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ jsx8(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
974
1207
|
] })
|
|
975
1208
|
] })
|
|
976
1209
|
] }),
|
|
977
|
-
/* @__PURE__ */
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
onNavigate && actionLabel && /* @__PURE__ */
|
|
1210
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
1211
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between w-full", children: [
|
|
1212
|
+
/* @__PURE__ */ jsx8("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
1213
|
+
onNavigate && actionLabel && /* @__PURE__ */ jsx8(
|
|
981
1214
|
"button",
|
|
982
1215
|
{
|
|
983
1216
|
type: "button",
|
|
@@ -1004,9 +1237,9 @@ var NotificationList = ({
|
|
|
1004
1237
|
className
|
|
1005
1238
|
}) => {
|
|
1006
1239
|
if (error) {
|
|
1007
|
-
return /* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
onRetry && /* @__PURE__ */
|
|
1240
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
1241
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm text-error-600", children: error }),
|
|
1242
|
+
onRetry && /* @__PURE__ */ jsx8(
|
|
1010
1243
|
"button",
|
|
1011
1244
|
{
|
|
1012
1245
|
type: "button",
|
|
@@ -1018,8 +1251,8 @@ var NotificationList = ({
|
|
|
1018
1251
|
] });
|
|
1019
1252
|
}
|
|
1020
1253
|
if (loading) {
|
|
1021
|
-
return /* @__PURE__ */
|
|
1022
|
-
(skeletonId) => /* @__PURE__ */
|
|
1254
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
1255
|
+
(skeletonId) => /* @__PURE__ */ jsx8(
|
|
1023
1256
|
SkeletonCard,
|
|
1024
1257
|
{
|
|
1025
1258
|
className: "p-4 border-b border-border-200"
|
|
@@ -1029,11 +1262,11 @@ var NotificationList = ({
|
|
|
1029
1262
|
) });
|
|
1030
1263
|
}
|
|
1031
1264
|
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
1032
|
-
return renderEmpty ? /* @__PURE__ */
|
|
1265
|
+
return renderEmpty ? /* @__PURE__ */ jsx8("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ jsx8(NotificationEmpty, {});
|
|
1033
1266
|
}
|
|
1034
|
-
return /* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
group.notifications.map((notification) => /* @__PURE__ */
|
|
1267
|
+
return /* @__PURE__ */ jsx8("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
|
|
1268
|
+
/* @__PURE__ */ jsx8("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ jsx8("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
1269
|
+
group.notifications.map((notification) => /* @__PURE__ */ jsx8(
|
|
1037
1270
|
SingleNotificationCard,
|
|
1038
1271
|
{
|
|
1039
1272
|
title: notification.title,
|
|
@@ -1091,7 +1324,7 @@ var NotificationCenter = ({
|
|
|
1091
1324
|
onCleanup?.();
|
|
1092
1325
|
onNavigateById?.(entityType, entityId);
|
|
1093
1326
|
};
|
|
1094
|
-
const renderEmptyState = () => /* @__PURE__ */
|
|
1327
|
+
const renderEmptyState = () => /* @__PURE__ */ jsx8(
|
|
1095
1328
|
NotificationEmpty,
|
|
1096
1329
|
{
|
|
1097
1330
|
emptyStateImage,
|
|
@@ -1100,17 +1333,17 @@ var NotificationCenter = ({
|
|
|
1100
1333
|
}
|
|
1101
1334
|
);
|
|
1102
1335
|
if (isMobile) {
|
|
1103
|
-
return /* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1336
|
+
return /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1337
|
+
/* @__PURE__ */ jsx8(
|
|
1105
1338
|
IconButton_default,
|
|
1106
1339
|
{
|
|
1107
1340
|
active: isModalOpen,
|
|
1108
1341
|
onClick: handleMobileClick,
|
|
1109
|
-
icon: /* @__PURE__ */
|
|
1342
|
+
icon: /* @__PURE__ */ jsx8(Bell2, { size: 24, className: "text-primary" }),
|
|
1110
1343
|
className
|
|
1111
1344
|
}
|
|
1112
1345
|
),
|
|
1113
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ jsx8(
|
|
1114
1347
|
Modal_default,
|
|
1115
1348
|
{
|
|
1116
1349
|
isOpen: isModalOpen,
|
|
@@ -1118,22 +1351,21 @@ var NotificationCenter = ({
|
|
|
1118
1351
|
title: "Notifica\xE7\xF5es",
|
|
1119
1352
|
size: "md",
|
|
1120
1353
|
hideCloseButton: false,
|
|
1121
|
-
closeOnBackdropClick: true,
|
|
1122
1354
|
closeOnEscape: true,
|
|
1123
|
-
children: /* @__PURE__ */
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */
|
|
1355
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
1356
|
+
/* @__PURE__ */ jsxs6("div", { className: "px-0 pb-3 border-b border-border-200", children: [
|
|
1357
|
+
/* @__PURE__ */ jsx8(NotificationHeader, { unreadCount, variant: "modal" }),
|
|
1358
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ jsx8(
|
|
1127
1359
|
"button",
|
|
1128
1360
|
{
|
|
1129
1361
|
type: "button",
|
|
1130
1362
|
onClick: onMarkAllAsRead,
|
|
1131
|
-
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
1363
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer mt-2",
|
|
1132
1364
|
children: "Marcar todas como lidas"
|
|
1133
1365
|
}
|
|
1134
1366
|
)
|
|
1135
|
-
] })
|
|
1136
|
-
/* @__PURE__ */
|
|
1367
|
+
] }),
|
|
1368
|
+
/* @__PURE__ */ jsx8("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx8(
|
|
1137
1369
|
NotificationList,
|
|
1138
1370
|
{
|
|
1139
1371
|
groupedNotifications,
|
|
@@ -1156,14 +1388,14 @@ var NotificationCenter = ({
|
|
|
1156
1388
|
)
|
|
1157
1389
|
] });
|
|
1158
1390
|
}
|
|
1159
|
-
return /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ jsxs6(DropdownMenu_default, { children: [
|
|
1392
|
+
/* @__PURE__ */ jsx8(DropdownMenuTrigger, { className: "text-primary cursor-pointer", children: /* @__PURE__ */ jsx8(
|
|
1161
1393
|
IconButton_default,
|
|
1162
1394
|
{
|
|
1163
1395
|
active: isActive,
|
|
1164
1396
|
onClick: handleDesktopClick,
|
|
1165
|
-
icon: /* @__PURE__ */
|
|
1166
|
-
|
|
1397
|
+
icon: /* @__PURE__ */ jsx8(
|
|
1398
|
+
Bell2,
|
|
1167
1399
|
{
|
|
1168
1400
|
size: 24,
|
|
1169
1401
|
className: isActive ? "text-primary-950" : "text-primary"
|
|
@@ -1172,32 +1404,26 @@ var NotificationCenter = ({
|
|
|
1172
1404
|
className
|
|
1173
1405
|
}
|
|
1174
1406
|
) }),
|
|
1175
|
-
/* @__PURE__ */
|
|
1407
|
+
/* @__PURE__ */ jsx8(
|
|
1176
1408
|
DropdownMenuContent,
|
|
1177
1409
|
{
|
|
1178
1410
|
className: "min-w-[320px] max-w-[400px] max-h-[500px] overflow-hidden",
|
|
1179
1411
|
side: "bottom",
|
|
1180
1412
|
align: "end",
|
|
1181
|
-
children: /* @__PURE__ */
|
|
1182
|
-
/* @__PURE__ */
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
|
|
1185
|
-
{
|
|
1186
|
-
unreadCount,
|
|
1187
|
-
variant: "dropdown"
|
|
1188
|
-
}
|
|
1189
|
-
),
|
|
1190
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ jsx7(
|
|
1413
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
|
|
1414
|
+
/* @__PURE__ */ jsxs6("div", { className: "px-4 py-3 border-b border-border-200", children: [
|
|
1415
|
+
/* @__PURE__ */ jsx8(NotificationHeader, { unreadCount, variant: "dropdown" }),
|
|
1416
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ jsx8(
|
|
1191
1417
|
"button",
|
|
1192
1418
|
{
|
|
1193
1419
|
type: "button",
|
|
1194
1420
|
onClick: onMarkAllAsRead,
|
|
1195
|
-
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
1421
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer mt-2",
|
|
1196
1422
|
children: "Marcar todas como lidas"
|
|
1197
1423
|
}
|
|
1198
1424
|
)
|
|
1199
|
-
] })
|
|
1200
|
-
/* @__PURE__ */
|
|
1425
|
+
] }),
|
|
1426
|
+
/* @__PURE__ */ jsx8("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ jsx8(
|
|
1201
1427
|
NotificationList,
|
|
1202
1428
|
{
|
|
1203
1429
|
groupedNotifications,
|
|
@@ -1219,7 +1445,7 @@ var NotificationCenter = ({
|
|
|
1219
1445
|
var NotificationCard = (props) => {
|
|
1220
1446
|
switch (props.mode) {
|
|
1221
1447
|
case "single":
|
|
1222
|
-
return /* @__PURE__ */
|
|
1448
|
+
return /* @__PURE__ */ jsx8(
|
|
1223
1449
|
SingleNotificationCard,
|
|
1224
1450
|
{
|
|
1225
1451
|
title: props.title,
|
|
@@ -1234,7 +1460,7 @@ var NotificationCard = (props) => {
|
|
|
1234
1460
|
}
|
|
1235
1461
|
);
|
|
1236
1462
|
case "list":
|
|
1237
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ jsx8(
|
|
1238
1464
|
NotificationList,
|
|
1239
1465
|
{
|
|
1240
1466
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1255,9 +1481,9 @@ var NotificationCard = (props) => {
|
|
|
1255
1481
|
}
|
|
1256
1482
|
);
|
|
1257
1483
|
case "center":
|
|
1258
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ jsx8(NotificationCenter, { ...props });
|
|
1259
1485
|
default:
|
|
1260
|
-
return /* @__PURE__ */
|
|
1486
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ jsx8("p", { className: "text-sm text-text-600", children: "Modo de notifica\xE7\xE3o n\xE3o reconhecido" }) });
|
|
1261
1487
|
}
|
|
1262
1488
|
};
|
|
1263
1489
|
var LegacyNotificationCard = (props) => {
|
|
@@ -1266,10 +1492,10 @@ var LegacyNotificationCard = (props) => {
|
|
|
1266
1492
|
mode: "center",
|
|
1267
1493
|
...props
|
|
1268
1494
|
};
|
|
1269
|
-
return /* @__PURE__ */
|
|
1495
|
+
return /* @__PURE__ */ jsx8(NotificationCenter, { ...centerProps });
|
|
1270
1496
|
}
|
|
1271
1497
|
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
1272
|
-
return /* @__PURE__ */
|
|
1498
|
+
return /* @__PURE__ */ jsx8(
|
|
1273
1499
|
NotificationList,
|
|
1274
1500
|
{
|
|
1275
1501
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1306,7 +1532,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1306
1532
|
emptyStateTitle: props.emptyStateTitle,
|
|
1307
1533
|
emptyStateDescription: props.emptyStateDescription
|
|
1308
1534
|
};
|
|
1309
|
-
return /* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ jsx8(
|
|
1310
1536
|
SingleNotificationCard,
|
|
1311
1537
|
{
|
|
1312
1538
|
title: singleProps.title,
|
|
@@ -1321,7 +1547,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1321
1547
|
}
|
|
1322
1548
|
);
|
|
1323
1549
|
}
|
|
1324
|
-
return /* @__PURE__ */
|
|
1550
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ jsx8("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
1325
1551
|
};
|
|
1326
1552
|
var NotificationCard_default = NotificationCard;
|
|
1327
1553
|
export {
|