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
|
@@ -24,7 +24,7 @@ __export(NotificationCard_exports, {
|
|
|
24
24
|
default: () => NotificationCard_default
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(NotificationCard_exports);
|
|
27
|
-
var
|
|
27
|
+
var import_phosphor_react4 = require("phosphor-react");
|
|
28
28
|
var import_react6 = require("react");
|
|
29
29
|
|
|
30
30
|
// src/utils/utils.ts
|
|
@@ -663,6 +663,52 @@ var IconButton_default = IconButton;
|
|
|
663
663
|
// src/components/Modal/Modal.tsx
|
|
664
664
|
var import_react4 = require("react");
|
|
665
665
|
var import_phosphor_react2 = require("phosphor-react");
|
|
666
|
+
|
|
667
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
668
|
+
var isYouTubeUrl = (url) => {
|
|
669
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
670
|
+
return youtubeRegex.test(url);
|
|
671
|
+
};
|
|
672
|
+
var isValidYouTubeHost = (host) => {
|
|
673
|
+
if (host === "youtu.be") return "youtu.be";
|
|
674
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
675
|
+
if (isValidYouTubeCom) return "youtube";
|
|
676
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
677
|
+
if (isValidNoCookie) return "nocookie";
|
|
678
|
+
return null;
|
|
679
|
+
};
|
|
680
|
+
var extractYoutuBeId = (pathname) => {
|
|
681
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
682
|
+
return firstSeg || null;
|
|
683
|
+
};
|
|
684
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
685
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
686
|
+
const [first, second] = parts;
|
|
687
|
+
if (first === "embed" && second) return second;
|
|
688
|
+
if (first === "shorts" && second) return second;
|
|
689
|
+
if (first === "live" && second) return second;
|
|
690
|
+
const v = searchParams.get("v");
|
|
691
|
+
if (v) return v;
|
|
692
|
+
return null;
|
|
693
|
+
};
|
|
694
|
+
var getYouTubeVideoId = (url) => {
|
|
695
|
+
try {
|
|
696
|
+
const u = new URL(url);
|
|
697
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
698
|
+
if (!hostType) return null;
|
|
699
|
+
if (hostType === "youtu.be") {
|
|
700
|
+
return extractYoutuBeId(u.pathname);
|
|
701
|
+
}
|
|
702
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
703
|
+
} catch {
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
708
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// src/components/Modal/Modal.tsx
|
|
666
712
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
667
713
|
var SIZE_CLASSES2 = {
|
|
668
714
|
xs: "max-w-[360px]",
|
|
@@ -678,11 +724,17 @@ var Modal = ({
|
|
|
678
724
|
children,
|
|
679
725
|
size = "md",
|
|
680
726
|
className = "",
|
|
681
|
-
closeOnBackdropClick = true,
|
|
682
727
|
closeOnEscape = true,
|
|
683
728
|
footer,
|
|
684
|
-
hideCloseButton = false
|
|
729
|
+
hideCloseButton = false,
|
|
730
|
+
variant = "default",
|
|
731
|
+
description,
|
|
732
|
+
image,
|
|
733
|
+
imageAlt,
|
|
734
|
+
actionLink,
|
|
735
|
+
actionLabel
|
|
685
736
|
}) => {
|
|
737
|
+
const titleId = (0, import_react4.useId)();
|
|
686
738
|
(0, import_react4.useEffect)(() => {
|
|
687
739
|
if (!isOpen || !closeOnEscape) return;
|
|
688
740
|
const handleEscape = (event) => {
|
|
@@ -704,16 +756,6 @@ var Modal = ({
|
|
|
704
756
|
document.body.style.overflow = originalOverflow;
|
|
705
757
|
};
|
|
706
758
|
}, [isOpen]);
|
|
707
|
-
const handleBackdropClick = (event) => {
|
|
708
|
-
if (closeOnBackdropClick && event.target === event.currentTarget) {
|
|
709
|
-
onClose();
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
const handleBackdropKeyDown = (event) => {
|
|
713
|
-
if (closeOnBackdropClick && (event.key === "Enter" || event.key === " ")) {
|
|
714
|
-
onClose();
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
759
|
if (!isOpen) return null;
|
|
718
760
|
const sizeClasses = SIZE_CLASSES2[size];
|
|
719
761
|
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
@@ -724,18 +766,105 @@ var Modal = ({
|
|
|
724
766
|
dialogResetClasses,
|
|
725
767
|
className
|
|
726
768
|
);
|
|
727
|
-
|
|
728
|
-
|
|
769
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
770
|
+
const handleActionClick = () => {
|
|
771
|
+
if (actionLink) {
|
|
772
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
773
|
+
}
|
|
774
|
+
};
|
|
775
|
+
if (variant === "activity") {
|
|
776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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__ */ (0, import_jsx_runtime5.jsxs)(
|
|
777
|
+
"dialog",
|
|
778
|
+
{
|
|
779
|
+
className: modalClasses,
|
|
780
|
+
"aria-labelledby": titleId,
|
|
781
|
+
"aria-modal": "true",
|
|
782
|
+
open: true,
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
785
|
+
"button",
|
|
786
|
+
{
|
|
787
|
+
onClick: onClose,
|
|
788
|
+
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",
|
|
789
|
+
"aria-label": "Fechar modal",
|
|
790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.X, { size: 18 })
|
|
791
|
+
}
|
|
792
|
+
) }),
|
|
793
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
794
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
795
|
+
"img",
|
|
796
|
+
{
|
|
797
|
+
src: image,
|
|
798
|
+
alt: imageAlt ?? "",
|
|
799
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
800
|
+
}
|
|
801
|
+
) }),
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
803
|
+
"h2",
|
|
804
|
+
{
|
|
805
|
+
id: titleId,
|
|
806
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
807
|
+
children: title
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
|
|
811
|
+
actionLink && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full", children: [
|
|
812
|
+
(() => {
|
|
813
|
+
const normalized = normalizeUrl(actionLink);
|
|
814
|
+
const isYT = isYouTubeUrl(normalized);
|
|
815
|
+
if (!isYT) return null;
|
|
816
|
+
const id = getYouTubeVideoId(normalized);
|
|
817
|
+
if (!id) {
|
|
818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
819
|
+
Button_default,
|
|
820
|
+
{
|
|
821
|
+
variant: "solid",
|
|
822
|
+
action: "primary",
|
|
823
|
+
size: "large",
|
|
824
|
+
className: "w-full",
|
|
825
|
+
onClick: handleActionClick,
|
|
826
|
+
children: actionLabel || "Iniciar Atividade"
|
|
827
|
+
}
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
831
|
+
"iframe",
|
|
832
|
+
{
|
|
833
|
+
src: getYouTubeEmbedUrl(id),
|
|
834
|
+
className: "w-full aspect-video rounded-lg",
|
|
835
|
+
allowFullScreen: true,
|
|
836
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
837
|
+
title: "V\xEDdeo YouTube"
|
|
838
|
+
}
|
|
839
|
+
);
|
|
840
|
+
})(),
|
|
841
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
842
|
+
Button_default,
|
|
843
|
+
{
|
|
844
|
+
variant: "solid",
|
|
845
|
+
action: "primary",
|
|
846
|
+
size: "large",
|
|
847
|
+
className: "w-full",
|
|
848
|
+
onClick: handleActionClick,
|
|
849
|
+
children: actionLabel || "Iniciar Atividade"
|
|
850
|
+
}
|
|
851
|
+
)
|
|
852
|
+
] })
|
|
853
|
+
] })
|
|
854
|
+
]
|
|
855
|
+
}
|
|
856
|
+
) });
|
|
857
|
+
}
|
|
858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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__ */ (0, import_jsx_runtime5.jsxs)(
|
|
859
|
+
"dialog",
|
|
729
860
|
{
|
|
730
|
-
className:
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
"aria-label": "Fechar modal clicando no fundo",
|
|
736
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("dialog", { className: modalClasses, "aria-labelledby": "modal-title", open: true, children: [
|
|
861
|
+
className: modalClasses,
|
|
862
|
+
"aria-labelledby": titleId,
|
|
863
|
+
"aria-modal": "true",
|
|
864
|
+
open: true,
|
|
865
|
+
children: [
|
|
737
866
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
738
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { id:
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
739
868
|
!hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
740
869
|
"button",
|
|
741
870
|
{
|
|
@@ -746,11 +875,11 @@ var Modal = ({
|
|
|
746
875
|
}
|
|
747
876
|
)
|
|
748
877
|
] }),
|
|
749
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
878
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
750
879
|
footer && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
751
|
-
]
|
|
880
|
+
]
|
|
752
881
|
}
|
|
753
|
-
);
|
|
882
|
+
) });
|
|
754
883
|
};
|
|
755
884
|
var Modal_default = Modal;
|
|
756
885
|
|
|
@@ -805,6 +934,103 @@ var Text = ({
|
|
|
805
934
|
};
|
|
806
935
|
var Text_default = Text;
|
|
807
936
|
|
|
937
|
+
// src/components/Badge/Badge.tsx
|
|
938
|
+
var import_phosphor_react3 = require("phosphor-react");
|
|
939
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
940
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
941
|
+
solid: {
|
|
942
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
943
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
944
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
945
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
946
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
947
|
+
},
|
|
948
|
+
outlined: {
|
|
949
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
950
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
951
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
952
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
953
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
954
|
+
},
|
|
955
|
+
exams: {
|
|
956
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
957
|
+
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
958
|
+
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
959
|
+
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
960
|
+
},
|
|
961
|
+
examsOutlined: {
|
|
962
|
+
exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
|
|
963
|
+
exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
|
|
964
|
+
exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
|
|
965
|
+
exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
|
|
966
|
+
},
|
|
967
|
+
resultStatus: {
|
|
968
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
969
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
970
|
+
},
|
|
971
|
+
notification: "text-primary"
|
|
972
|
+
};
|
|
973
|
+
var SIZE_CLASSES3 = {
|
|
974
|
+
small: "text-2xs px-2 py-1",
|
|
975
|
+
medium: "text-xs px-2 py-1",
|
|
976
|
+
large: "text-sm px-2 py-1"
|
|
977
|
+
};
|
|
978
|
+
var SIZE_CLASSES_ICON = {
|
|
979
|
+
small: "size-3",
|
|
980
|
+
medium: "size-3.5",
|
|
981
|
+
large: "size-4"
|
|
982
|
+
};
|
|
983
|
+
var Badge = ({
|
|
984
|
+
children,
|
|
985
|
+
iconLeft,
|
|
986
|
+
iconRight,
|
|
987
|
+
size = "medium",
|
|
988
|
+
variant = "solid",
|
|
989
|
+
action = "error",
|
|
990
|
+
className = "",
|
|
991
|
+
notificationActive = false,
|
|
992
|
+
...props
|
|
993
|
+
}) => {
|
|
994
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
995
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
996
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
997
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
998
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
999
|
+
const baseClassesIcon = "flex items-center";
|
|
1000
|
+
if (variant === "notification") {
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1002
|
+
"div",
|
|
1003
|
+
{
|
|
1004
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
1005
|
+
...props,
|
|
1006
|
+
children: [
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react3.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
1008
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1009
|
+
"span",
|
|
1010
|
+
{
|
|
1011
|
+
"data-testid": "notification-dot",
|
|
1012
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
1013
|
+
}
|
|
1014
|
+
)
|
|
1015
|
+
]
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1020
|
+
"div",
|
|
1021
|
+
{
|
|
1022
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
1023
|
+
...props,
|
|
1024
|
+
children: [
|
|
1025
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
1026
|
+
children,
|
|
1027
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
);
|
|
1031
|
+
};
|
|
1032
|
+
var Badge_default = Badge;
|
|
1033
|
+
|
|
808
1034
|
// src/hooks/useMobile.ts
|
|
809
1035
|
var import_react5 = require("react");
|
|
810
1036
|
var MOBILE_WIDTH = 500;
|
|
@@ -895,14 +1121,14 @@ var formatTimeAgo = (date) => {
|
|
|
895
1121
|
};
|
|
896
1122
|
|
|
897
1123
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
898
|
-
var
|
|
1124
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
899
1125
|
var NotificationEmpty = ({
|
|
900
1126
|
emptyStateImage,
|
|
901
1127
|
emptyStateTitle = "Nenhuma notifica\xE7\xE3o no momento",
|
|
902
1128
|
emptyStateDescription = "Voc\xEA est\xE1 em dia com todas as novidades. Volte depois para conferir atualiza\xE7\xF5es!"
|
|
903
1129
|
}) => {
|
|
904
|
-
return /* @__PURE__ */ (0,
|
|
905
|
-
emptyStateImage && /* @__PURE__ */ (0,
|
|
1130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4 p-6 w-full", children: [
|
|
1131
|
+
emptyStateImage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-20 h-20 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
906
1132
|
"img",
|
|
907
1133
|
{
|
|
908
1134
|
src: emptyStateImage,
|
|
@@ -912,20 +1138,27 @@ var NotificationEmpty = ({
|
|
|
912
1138
|
className: "object-contain"
|
|
913
1139
|
}
|
|
914
1140
|
) }),
|
|
915
|
-
/* @__PURE__ */ (0,
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
1141
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: "text-xl font-semibold text-text-950 text-center leading-[23px]", children: emptyStateTitle }),
|
|
1142
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm font-normal text-text-400 text-center max-w-[316px] leading-[21px]", children: emptyStateDescription })
|
|
917
1143
|
] });
|
|
918
1144
|
};
|
|
919
1145
|
var NotificationHeader = ({
|
|
920
1146
|
unreadCount,
|
|
921
1147
|
variant = "modal"
|
|
922
1148
|
}) => {
|
|
923
|
-
return /* @__PURE__ */ (0,
|
|
924
|
-
variant === "modal" ? /* @__PURE__ */ (0,
|
|
925
|
-
unreadCount > 0 && /* @__PURE__ */ (0,
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1150
|
+
variant === "modal" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-950", children: "Notifica\xE7\xF5es" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: "text-sm font-semibold text-text-950", children: "Notifica\xE7\xF5es" }),
|
|
1151
|
+
unreadCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1152
|
+
Badge_default,
|
|
1153
|
+
{
|
|
1154
|
+
variant: "solid",
|
|
1155
|
+
action: "info",
|
|
1156
|
+
size: "small",
|
|
1157
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react4.Bell, { size: 12, "aria-hidden": "true", focusable: "false" }),
|
|
1158
|
+
className: "border-0",
|
|
1159
|
+
children: unreadCount === 1 ? "1 n\xE3o lida" : `${unreadCount} n\xE3o lidas`
|
|
1160
|
+
}
|
|
1161
|
+
)
|
|
929
1162
|
] });
|
|
930
1163
|
};
|
|
931
1164
|
var SingleNotificationCard = ({
|
|
@@ -957,7 +1190,7 @@ var SingleNotificationCard = ({
|
|
|
957
1190
|
onNavigate();
|
|
958
1191
|
}
|
|
959
1192
|
};
|
|
960
|
-
return /* @__PURE__ */ (0,
|
|
1193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
961
1194
|
"div",
|
|
962
1195
|
{
|
|
963
1196
|
className: cn(
|
|
@@ -966,20 +1199,20 @@ var SingleNotificationCard = ({
|
|
|
966
1199
|
className
|
|
967
1200
|
),
|
|
968
1201
|
children: [
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
970
|
-
!isRead && /* @__PURE__ */ (0,
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
972
|
-
/* @__PURE__ */ (0,
|
|
973
|
-
/* @__PURE__ */ (0,
|
|
1202
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2 w-full", children: [
|
|
1203
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-[7px] h-[7px] bg-info-300 rounded-full flex-shrink-0" }),
|
|
1204
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: "font-bold text-sm leading-4 text-text-950 flex-grow", children: title }),
|
|
1205
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu_default, { children: [
|
|
1206
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
974
1207
|
DropdownMenuTrigger,
|
|
975
1208
|
{
|
|
976
1209
|
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",
|
|
977
1210
|
"aria-label": "Menu de a\xE7\xF5es",
|
|
978
|
-
children: /* @__PURE__ */ (0,
|
|
1211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react4.DotsThreeVertical, { size: 24 })
|
|
979
1212
|
}
|
|
980
1213
|
),
|
|
981
|
-
/* @__PURE__ */ (0,
|
|
982
|
-
!isRead && /* @__PURE__ */ (0,
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuContent, { align: "end", className: "min-w-[160px]", children: [
|
|
1215
|
+
!isRead && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
983
1216
|
DropdownMenuItem,
|
|
984
1217
|
{
|
|
985
1218
|
onClick: handleMarkAsRead,
|
|
@@ -987,14 +1220,14 @@ var SingleNotificationCard = ({
|
|
|
987
1220
|
children: "Marcar como lida"
|
|
988
1221
|
}
|
|
989
1222
|
),
|
|
990
|
-
/* @__PURE__ */ (0,
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuItem, { onClick: handleDelete, className: "text-error-600", children: "Deletar" })
|
|
991
1224
|
] })
|
|
992
1225
|
] })
|
|
993
1226
|
] }),
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
996
|
-
/* @__PURE__ */ (0,
|
|
997
|
-
onNavigate && actionLabel && /* @__PURE__ */ (0,
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm leading-[21px] text-text-800 w-full", children: message }),
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-sm font-medium text-text-400", children: time }),
|
|
1230
|
+
onNavigate && actionLabel && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
998
1231
|
"button",
|
|
999
1232
|
{
|
|
1000
1233
|
type: "button",
|
|
@@ -1021,9 +1254,9 @@ var NotificationList = ({
|
|
|
1021
1254
|
className
|
|
1022
1255
|
}) => {
|
|
1023
1256
|
if (error) {
|
|
1024
|
-
return /* @__PURE__ */ (0,
|
|
1025
|
-
/* @__PURE__ */ (0,
|
|
1026
|
-
onRetry && /* @__PURE__ */ (0,
|
|
1257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: [
|
|
1258
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm text-error-600", children: error }),
|
|
1259
|
+
onRetry && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1027
1260
|
"button",
|
|
1028
1261
|
{
|
|
1029
1262
|
type: "button",
|
|
@@ -1035,8 +1268,8 @@ var NotificationList = ({
|
|
|
1035
1268
|
] });
|
|
1036
1269
|
}
|
|
1037
1270
|
if (loading) {
|
|
1038
|
-
return /* @__PURE__ */ (0,
|
|
1039
|
-
(skeletonId) => /* @__PURE__ */ (0,
|
|
1271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-0 w-full", children: ["skeleton-first", "skeleton-second", "skeleton-third"].map(
|
|
1272
|
+
(skeletonId) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1040
1273
|
SkeletonCard,
|
|
1041
1274
|
{
|
|
1042
1275
|
className: "p-4 border-b border-border-200"
|
|
@@ -1046,11 +1279,11 @@ var NotificationList = ({
|
|
|
1046
1279
|
) });
|
|
1047
1280
|
}
|
|
1048
1281
|
if (!groupedNotifications || groupedNotifications.length === 0) {
|
|
1049
|
-
return renderEmpty ? /* @__PURE__ */ (0,
|
|
1282
|
+
return renderEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-full", children: renderEmpty() }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NotificationEmpty, {});
|
|
1050
1283
|
}
|
|
1051
|
-
return /* @__PURE__ */ (0,
|
|
1052
|
-
/* @__PURE__ */ (0,
|
|
1053
|
-
group.notifications.map((notification) => /* @__PURE__ */ (0,
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("flex flex-col gap-0 w-full", className), children: groupedNotifications.map((group, idx) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col", children: [
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-end px-4 py-6 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h4", { className: "text-lg font-bold text-text-500 flex-grow", children: group.label }) }),
|
|
1286
|
+
group.notifications.map((notification) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1054
1287
|
SingleNotificationCard,
|
|
1055
1288
|
{
|
|
1056
1289
|
title: notification.title,
|
|
@@ -1108,7 +1341,7 @@ var NotificationCenter = ({
|
|
|
1108
1341
|
onCleanup?.();
|
|
1109
1342
|
onNavigateById?.(entityType, entityId);
|
|
1110
1343
|
};
|
|
1111
|
-
const renderEmptyState = () => /* @__PURE__ */ (0,
|
|
1344
|
+
const renderEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1112
1345
|
NotificationEmpty,
|
|
1113
1346
|
{
|
|
1114
1347
|
emptyStateImage,
|
|
@@ -1117,17 +1350,17 @@ var NotificationCenter = ({
|
|
|
1117
1350
|
}
|
|
1118
1351
|
);
|
|
1119
1352
|
if (isMobile) {
|
|
1120
|
-
return /* @__PURE__ */ (0,
|
|
1121
|
-
/* @__PURE__ */ (0,
|
|
1353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1354
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1122
1355
|
IconButton_default,
|
|
1123
1356
|
{
|
|
1124
1357
|
active: isModalOpen,
|
|
1125
1358
|
onClick: handleMobileClick,
|
|
1126
|
-
icon: /* @__PURE__ */ (0,
|
|
1359
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react4.Bell, { size: 24, className: "text-primary" }),
|
|
1127
1360
|
className
|
|
1128
1361
|
}
|
|
1129
1362
|
),
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1131
1364
|
Modal_default,
|
|
1132
1365
|
{
|
|
1133
1366
|
isOpen: isModalOpen,
|
|
@@ -1135,22 +1368,21 @@ var NotificationCenter = ({
|
|
|
1135
1368
|
title: "Notifica\xE7\xF5es",
|
|
1136
1369
|
size: "md",
|
|
1137
1370
|
hideCloseButton: false,
|
|
1138
|
-
closeOnBackdropClick: true,
|
|
1139
1371
|
closeOnEscape: true,
|
|
1140
|
-
children: /* @__PURE__ */ (0,
|
|
1141
|
-
/* @__PURE__ */ (0,
|
|
1142
|
-
/* @__PURE__ */ (0,
|
|
1143
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0,
|
|
1372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "px-0 pb-3 border-b border-border-200", children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NotificationHeader, { unreadCount, variant: "modal" }),
|
|
1375
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1144
1376
|
"button",
|
|
1145
1377
|
{
|
|
1146
1378
|
type: "button",
|
|
1147
1379
|
onClick: onMarkAllAsRead,
|
|
1148
|
-
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
1380
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer mt-2",
|
|
1149
1381
|
children: "Marcar todas como lidas"
|
|
1150
1382
|
}
|
|
1151
1383
|
)
|
|
1152
|
-
] })
|
|
1153
|
-
/* @__PURE__ */ (0,
|
|
1384
|
+
] }),
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1154
1386
|
NotificationList,
|
|
1155
1387
|
{
|
|
1156
1388
|
groupedNotifications,
|
|
@@ -1173,14 +1405,14 @@ var NotificationCenter = ({
|
|
|
1173
1405
|
)
|
|
1174
1406
|
] });
|
|
1175
1407
|
}
|
|
1176
|
-
return /* @__PURE__ */ (0,
|
|
1177
|
-
/* @__PURE__ */ (0,
|
|
1408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu_default, { children: [
|
|
1409
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuTrigger, { className: "text-primary cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1178
1410
|
IconButton_default,
|
|
1179
1411
|
{
|
|
1180
1412
|
active: isActive,
|
|
1181
1413
|
onClick: handleDesktopClick,
|
|
1182
|
-
icon: /* @__PURE__ */ (0,
|
|
1183
|
-
|
|
1414
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1415
|
+
import_phosphor_react4.Bell,
|
|
1184
1416
|
{
|
|
1185
1417
|
size: 24,
|
|
1186
1418
|
className: isActive ? "text-primary-950" : "text-primary"
|
|
@@ -1189,32 +1421,26 @@ var NotificationCenter = ({
|
|
|
1189
1421
|
className
|
|
1190
1422
|
}
|
|
1191
1423
|
) }),
|
|
1192
|
-
/* @__PURE__ */ (0,
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1193
1425
|
DropdownMenuContent,
|
|
1194
1426
|
{
|
|
1195
1427
|
className: "min-w-[320px] max-w-[400px] max-h-[500px] overflow-hidden",
|
|
1196
1428
|
side: "bottom",
|
|
1197
1429
|
align: "end",
|
|
1198
|
-
children: /* @__PURE__ */ (0,
|
|
1199
|
-
/* @__PURE__ */ (0,
|
|
1200
|
-
/* @__PURE__ */ (0,
|
|
1201
|
-
|
|
1202
|
-
{
|
|
1203
|
-
unreadCount,
|
|
1204
|
-
variant: "dropdown"
|
|
1205
|
-
}
|
|
1206
|
-
),
|
|
1207
|
-
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col", children: [
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "px-4 py-3 border-b border-border-200", children: [
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NotificationHeader, { unreadCount, variant: "dropdown" }),
|
|
1433
|
+
unreadCount > 0 && onMarkAllAsRead && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1208
1434
|
"button",
|
|
1209
1435
|
{
|
|
1210
1436
|
type: "button",
|
|
1211
1437
|
onClick: onMarkAllAsRead,
|
|
1212
|
-
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer",
|
|
1438
|
+
className: "text-sm font-medium text-info-600 hover:text-info-700 cursor-pointer mt-2",
|
|
1213
1439
|
children: "Marcar todas como lidas"
|
|
1214
1440
|
}
|
|
1215
1441
|
)
|
|
1216
|
-
] })
|
|
1217
|
-
/* @__PURE__ */ (0,
|
|
1442
|
+
] }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1218
1444
|
NotificationList,
|
|
1219
1445
|
{
|
|
1220
1446
|
groupedNotifications,
|
|
@@ -1236,7 +1462,7 @@ var NotificationCenter = ({
|
|
|
1236
1462
|
var NotificationCard = (props) => {
|
|
1237
1463
|
switch (props.mode) {
|
|
1238
1464
|
case "single":
|
|
1239
|
-
return /* @__PURE__ */ (0,
|
|
1465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1240
1466
|
SingleNotificationCard,
|
|
1241
1467
|
{
|
|
1242
1468
|
title: props.title,
|
|
@@ -1251,7 +1477,7 @@ var NotificationCard = (props) => {
|
|
|
1251
1477
|
}
|
|
1252
1478
|
);
|
|
1253
1479
|
case "list":
|
|
1254
|
-
return /* @__PURE__ */ (0,
|
|
1480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1255
1481
|
NotificationList,
|
|
1256
1482
|
{
|
|
1257
1483
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1272,9 +1498,9 @@ var NotificationCard = (props) => {
|
|
|
1272
1498
|
}
|
|
1273
1499
|
);
|
|
1274
1500
|
case "center":
|
|
1275
|
-
return /* @__PURE__ */ (0,
|
|
1501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NotificationCenter, { ...props });
|
|
1276
1502
|
default:
|
|
1277
|
-
return /* @__PURE__ */ (0,
|
|
1503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm text-text-600", children: "Modo de notifica\xE7\xE3o n\xE3o reconhecido" }) });
|
|
1278
1504
|
}
|
|
1279
1505
|
};
|
|
1280
1506
|
var LegacyNotificationCard = (props) => {
|
|
@@ -1283,10 +1509,10 @@ var LegacyNotificationCard = (props) => {
|
|
|
1283
1509
|
mode: "center",
|
|
1284
1510
|
...props
|
|
1285
1511
|
};
|
|
1286
|
-
return /* @__PURE__ */ (0,
|
|
1512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NotificationCenter, { ...centerProps });
|
|
1287
1513
|
}
|
|
1288
1514
|
if (props.groupedNotifications !== void 0 || props.notifications !== void 0 || props.loading || props.error) {
|
|
1289
|
-
return /* @__PURE__ */ (0,
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1290
1516
|
NotificationList,
|
|
1291
1517
|
{
|
|
1292
1518
|
groupedNotifications: props.groupedNotifications ?? (props.notifications ? [
|
|
@@ -1323,7 +1549,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1323
1549
|
emptyStateTitle: props.emptyStateTitle,
|
|
1324
1550
|
emptyStateDescription: props.emptyStateDescription
|
|
1325
1551
|
};
|
|
1326
|
-
return /* @__PURE__ */ (0,
|
|
1552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1327
1553
|
SingleNotificationCard,
|
|
1328
1554
|
{
|
|
1329
1555
|
title: singleProps.title,
|
|
@@ -1338,7 +1564,7 @@ var LegacyNotificationCard = (props) => {
|
|
|
1338
1564
|
}
|
|
1339
1565
|
);
|
|
1340
1566
|
}
|
|
1341
|
-
return /* @__PURE__ */ (0,
|
|
1567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col items-center gap-4 p-6 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "text-sm text-text-600", children: "Nenhuma notifica\xE7\xE3o configurada" }) });
|
|
1342
1568
|
};
|
|
1343
1569
|
var NotificationCard_default = NotificationCard;
|
|
1344
1570
|
// Annotate the CommonJS export names for ESM import in node:
|