analytica-frontend-lib 1.2.25 → 1.2.29
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/Accordation/index.d.ts +4 -5
- package/dist/Accordation/index.d.ts.map +1 -0
- package/dist/ActivityDetails/index.css +19293 -0
- package/dist/ActivityDetails/index.css.map +1 -0
- package/dist/ActivityDetails/index.d.ts +31 -0
- package/dist/ActivityDetails/index.d.ts.map +1 -0
- package/dist/ActivityDetails/index.js +7389 -0
- package/dist/ActivityDetails/index.js.map +1 -0
- package/dist/ActivityDetails/index.mjs +7438 -0
- package/dist/ActivityDetails/index.mjs.map +1 -0
- package/dist/ActivityFilters/index.css +112 -0
- package/dist/ActivityFilters/index.css.map +1 -1
- package/dist/ActivityFilters/index.d.ts +44 -5
- package/dist/ActivityFilters/index.d.ts.map +1 -0
- package/dist/ActivityFilters/index.js +67 -33
- package/dist/ActivityFilters/index.js.map +1 -1
- package/dist/ActivityFilters/index.mjs +89 -55
- package/dist/ActivityFilters/index.mjs.map +1 -1
- package/dist/Alert/index.d.ts +3 -5
- package/dist/Alert/index.d.ts.map +1 -0
- package/dist/AlertDialog/index.d.ts +2 -4
- package/dist/AlertDialog/index.d.ts.map +1 -0
- package/dist/AlertManager/index.css +112 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/AlertManager/index.d.ts +4 -8
- package/dist/AlertManager/index.d.ts.map +1 -0
- package/dist/AlertManager/index.js +56 -22
- package/dist/AlertManager/index.js.map +1 -1
- package/dist/AlertManager/index.mjs +78 -44
- package/dist/AlertManager/index.mjs.map +1 -1
- package/dist/AlertManagerView/index.d.ts +6 -10
- package/dist/AlertManagerView/index.d.ts.map +1 -0
- package/dist/Alternative/index.d.ts +6 -9
- package/dist/Alternative/index.d.ts.map +1 -0
- package/dist/Auth/AuthProvider/index.d.ts +324 -3
- package/dist/Auth/AuthProvider/index.d.ts.map +1 -0
- package/dist/Auth/ProtectedRoute/index.d.ts +324 -3
- package/dist/Auth/ProtectedRoute/index.d.ts.map +1 -0
- package/dist/Auth/PublicRoute/index.d.ts +324 -3
- package/dist/Auth/PublicRoute/index.d.ts.map +1 -0
- package/dist/Auth/getRootDomain/index.d.ts +324 -3
- package/dist/Auth/getRootDomain/index.d.ts.map +1 -0
- package/dist/Auth/index.d.ts +24 -26
- package/dist/Auth/index.d.ts.map +1 -0
- package/dist/Auth/useApiConfig/index.d.ts +3 -3
- package/dist/Auth/useApiConfig/index.d.ts.map +1 -0
- package/dist/Auth/useAuth/index.d.ts +324 -3
- package/dist/Auth/useAuth/index.d.ts.map +1 -0
- package/dist/Auth/useAuthGuard/index.d.ts +324 -3
- package/dist/Auth/useAuthGuard/index.d.ts.map +1 -0
- package/dist/Auth/useRouteAuth/index.d.ts +324 -3
- package/dist/Auth/useRouteAuth/index.d.ts.map +1 -0
- package/dist/Auth/useUrlAuthentication/index.d.ts +3 -4
- package/dist/Auth/useUrlAuthentication/index.d.ts.map +1 -0
- package/dist/Auth/withAuth/index.d.ts +324 -3
- package/dist/Auth/withAuth/index.d.ts.map +1 -0
- package/dist/Auth/zustandAuthAdapter/index.d.ts +2 -3
- package/dist/Auth/zustandAuthAdapter/index.d.ts.map +1 -0
- package/dist/Badge/index.d.ts +4 -6
- package/dist/Badge/index.d.ts.map +1 -0
- package/dist/BreadcrumbMenu/breadcrumbStore/index.d.ts +5 -7
- package/dist/BreadcrumbMenu/breadcrumbStore/index.d.ts.map +1 -0
- package/dist/BreadcrumbMenu/index.d.ts +4 -8
- package/dist/BreadcrumbMenu/index.d.ts.map +1 -0
- package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.d.ts +7 -10
- package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.d.ts.map +1 -0
- package/dist/BreadcrumbMenu/useUrlParams/index.d.ts +3 -4
- package/dist/BreadcrumbMenu/useUrlParams/index.d.ts.map +1 -0
- package/dist/Button/index.d.ts +4 -6
- package/dist/Button/index.d.ts.map +1 -0
- package/dist/Calendar/index.d.ts +9 -11
- package/dist/Calendar/index.d.ts.map +1 -0
- package/dist/Card/index.d.ts +17 -19
- package/dist/Card/index.d.ts.map +1 -0
- package/dist/CheckBox/index.d.ts +6 -8
- package/dist/CheckBox/index.d.ts.map +1 -0
- package/dist/Chips/index.d.ts +4 -6
- package/dist/Chips/index.d.ts.map +1 -0
- package/dist/CorrectActivityModal/index.d.ts +39 -0
- package/dist/CorrectActivityModal/index.d.ts.map +1 -0
- package/dist/CorrectActivityModal/index.js +3674 -0
- package/dist/CorrectActivityModal/index.js.map +1 -0
- package/dist/CorrectActivityModal/index.mjs +3689 -0
- package/dist/CorrectActivityModal/index.mjs.map +1 -0
- package/dist/Divider/index.d.ts +3 -5
- package/dist/Divider/index.d.ts.map +1 -0
- package/dist/DownloadButton/index.d.ts +5 -7
- package/dist/DownloadButton/index.d.ts.map +1 -0
- package/dist/DropdownMenu/index.d.ts +26 -28
- package/dist/DropdownMenu/index.d.ts.map +1 -0
- package/dist/EmptyState/index.d.ts +5 -7
- package/dist/EmptyState/index.d.ts.map +1 -0
- package/dist/FileAttachment/index.d.ts +72 -0
- package/dist/FileAttachment/index.d.ts.map +1 -0
- package/dist/FileAttachment/index.js +239 -0
- package/dist/FileAttachment/index.js.map +1 -0
- package/dist/FileAttachment/index.mjs +213 -0
- package/dist/FileAttachment/index.mjs.map +1 -0
- package/dist/IconButton/index.d.ts +6 -8
- package/dist/IconButton/index.d.ts.map +1 -0
- package/dist/IconRender/index.d.ts +5 -6
- package/dist/IconRender/index.d.ts.map +1 -0
- package/dist/IconRoundedButton/index.d.ts +4 -6
- package/dist/IconRoundedButton/index.d.ts.map +1 -0
- package/dist/Input/index.d.ts +5 -7
- package/dist/Input/index.d.ts.map +1 -0
- package/dist/LatexRenderer/index.d.ts +5 -6
- package/dist/LatexRenderer/index.d.ts.map +1 -0
- package/dist/LoadingModal/index.d.ts +3 -5
- package/dist/LoadingModal/index.d.ts.map +1 -0
- package/dist/Menu/index.d.ts +12 -14
- package/dist/Menu/index.d.ts.map +1 -0
- package/dist/Modal/index.d.ts +3 -5
- package/dist/Modal/index.d.ts.map +1 -0
- package/dist/Modal/utils/videoUtils/index.d.ts +4 -5
- package/dist/Modal/utils/videoUtils/index.d.ts.map +1 -0
- package/dist/MultipleChoice/index.d.ts +2 -4
- package/dist/MultipleChoice/index.d.ts.map +1 -0
- package/dist/NavButton/index.d.ts +5 -7
- package/dist/NavButton/index.d.ts.map +1 -0
- package/dist/NoSearchResult/index.d.ts +4 -6
- package/dist/NoSearchResult/index.d.ts.map +1 -0
- package/dist/NotFound/index.d.ts +4 -6
- package/dist/NotFound/index.d.ts.map +1 -0
- package/dist/NotificationCard/index.d.ts +218 -3
- package/dist/NotificationCard/index.d.ts.map +1 -0
- package/dist/ProgressBar/index.d.ts +4 -6
- package/dist/ProgressBar/index.d.ts.map +1 -0
- package/dist/ProgressCircle/index.d.ts +4 -6
- package/dist/ProgressCircle/index.d.ts.map +1 -0
- package/dist/Quiz/index.d.ts +19 -23
- package/dist/Quiz/index.d.ts.map +1 -0
- package/dist/Quiz/useQuizStore/index.d.ts +14 -17
- package/dist/Quiz/useQuizStore/index.d.ts.map +1 -0
- package/dist/Radio/index.d.ts +14 -15
- package/dist/Radio/index.d.ts.map +1 -0
- package/dist/Search/index.d.ts +4 -6
- package/dist/Search/index.d.ts.map +1 -0
- package/dist/Select/index.d.ts +12 -14
- package/dist/Select/index.d.ts.map +1 -0
- package/dist/SelectionButton/index.d.ts +5 -7
- package/dist/SelectionButton/index.d.ts.map +1 -0
- package/dist/Skeleton/index.d.ts +10 -12
- package/dist/Skeleton/index.d.ts.map +1 -0
- package/dist/StatisticsCard/index.d.ts +3 -5
- package/dist/StatisticsCard/index.d.ts.map +1 -0
- package/dist/Stepper/index.d.ts +6 -8
- package/dist/Stepper/index.d.ts.map +1 -0
- package/dist/SubjectInfo/index.d.ts +17 -2
- package/dist/SubjectInfo/index.d.ts.map +1 -0
- package/dist/Support/TicketModal/index.d.ts +14 -0
- package/dist/Support/TicketModal/index.d.ts.map +1 -0
- package/dist/Support/TicketModal/index.js +1279 -0
- package/dist/Support/TicketModal/index.js.map +1 -0
- package/dist/Support/TicketModal/index.mjs +1248 -0
- package/dist/Support/TicketModal/index.mjs.map +1 -0
- package/dist/Support/index.d.ts +8 -0
- package/dist/Support/index.d.ts.map +1 -0
- package/dist/Support/index.js +2686 -0
- package/dist/Support/index.js.map +1 -0
- package/dist/Support/index.mjs +2676 -0
- package/dist/Support/index.mjs.map +1 -0
- package/dist/Table/TablePagination/index.d.ts +4 -6
- package/dist/Table/TablePagination/index.d.ts.map +1 -0
- package/dist/Table/index.d.ts +18 -19
- package/dist/Table/index.d.ts.map +1 -0
- package/dist/TableProvider/index.css +112 -0
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/TableProvider/index.d.ts +198 -4
- package/dist/TableProvider/index.d.ts.map +1 -0
- package/dist/TableProvider/index.js +56 -22
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs +78 -44
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/Text/index.d.ts +4 -6
- package/dist/Text/index.d.ts.map +1 -0
- package/dist/TextArea/index.d.ts +6 -8
- package/dist/TextArea/index.d.ts.map +1 -0
- package/dist/ThemeToggle/index.d.ts +4 -8
- package/dist/ThemeToggle/index.d.ts.map +1 -0
- package/dist/Toast/ToastStore/index.d.ts +3 -5
- package/dist/Toast/ToastStore/index.d.ts.map +1 -0
- package/dist/Toast/Toaster/index.d.ts +4 -6
- package/dist/Toast/Toaster/index.d.ts.map +1 -0
- package/dist/Toast/index.d.ts +3 -5
- package/dist/Toast/index.d.ts.map +1 -0
- package/dist/VideoPlayer/index.d.ts +4 -6
- package/dist/VideoPlayer/index.d.ts.map +1 -0
- package/dist/Whiteboard/index.d.ts +5 -7
- package/dist/Whiteboard/index.d.ts.map +1 -0
- package/dist/assets/icons/subjects/BookOpenText.d.ts +5 -0
- package/dist/assets/icons/subjects/BookOpenText.d.ts.map +1 -0
- package/dist/assets/icons/subjects/ChatEN.d.ts +5 -0
- package/dist/assets/icons/subjects/ChatEN.d.ts.map +1 -0
- package/dist/assets/icons/subjects/ChatES.d.ts +5 -0
- package/dist/assets/icons/subjects/ChatES.d.ts.map +1 -0
- package/dist/assets/icons/subjects/ChatPT.d.ts +5 -0
- package/dist/assets/icons/subjects/ChatPT.d.ts.map +1 -0
- package/dist/assets/icons/subjects/HeadCircuit.d.ts +5 -0
- package/dist/assets/icons/subjects/HeadCircuit.d.ts.map +1 -0
- package/dist/assets/icons/subjects/Microscope.d.ts +5 -0
- package/dist/assets/icons/subjects/Microscope.d.ts.map +1 -0
- package/dist/enums/SubjectEnum.d.ts +19 -0
- package/dist/enums/SubjectEnum.d.ts.map +1 -0
- package/dist/hooks/useAppContent.d.ts +55 -0
- package/dist/hooks/useAppContent.d.ts.map +1 -0
- package/dist/hooks/useAppInitialization.d.ts +21 -0
- package/dist/hooks/useAppInitialization.d.ts.map +1 -0
- package/dist/hooks/useInstitution.d.ts +2 -0
- package/dist/hooks/useInstitution.d.ts.map +1 -0
- package/dist/hooks/useMobile/index.d.ts +4 -5
- package/dist/hooks/useMobile/index.d.ts.map +1 -0
- package/dist/hooks/useNotificationStore.d.ts +34 -0
- package/dist/hooks/useNotificationStore.d.ts.map +1 -0
- package/dist/hooks/useNotifications.d.ts +129 -0
- package/dist/hooks/useNotifications.d.ts.map +1 -0
- package/dist/hooks/useScreen.d.ts +38 -0
- package/dist/hooks/useScreen.d.ts.map +1 -0
- package/dist/hooks/useTheme/index.d.ts +4 -7
- package/dist/hooks/useTheme/index.d.ts.map +1 -0
- package/dist/index.css +112 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +127 -789
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9031 -7012
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9093 -7085
- package/dist/index.mjs.map +1 -1
- package/dist/store/appStore.d.ts +27 -0
- package/dist/store/appStore.d.ts.map +1 -0
- package/dist/store/authStore.d.ts +75 -0
- package/dist/store/authStore.d.ts.map +1 -0
- package/dist/store/notificationStore.d.ts +89 -0
- package/dist/store/notificationStore.d.ts.map +1 -0
- package/dist/{themeStore-P2X64zC-.d.ts → store/themeStore.d.ts} +8 -12
- package/dist/store/themeStore.d.ts.map +1 -0
- package/dist/styles.css +112 -0
- package/dist/styles.css.map +1 -1
- package/dist/suporthistory-W5LBGAUP.png +0 -0
- package/dist/types/activityDetails.d.ts +127 -0
- package/dist/types/activityDetails.d.ts.map +1 -0
- package/dist/types/activityFilters.d.ts +51 -0
- package/dist/types/activityFilters.d.ts.map +1 -0
- package/dist/types/auth.d.ts +53 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/notifications.d.ts +199 -0
- package/dist/types/notifications.d.ts.map +1 -0
- package/dist/types/questionTypes.d.ts +6 -0
- package/dist/types/questionTypes.d.ts.map +1 -0
- package/dist/types/studentActivityCorrection.d.ts +57 -0
- package/dist/types/studentActivityCorrection.d.ts.map +1 -0
- package/dist/types/support/index.d.ts +111 -0
- package/dist/types/support/index.d.ts.map +1 -0
- package/dist/types/support/index.js +115 -0
- package/dist/types/support/index.js.map +1 -0
- package/dist/types/support/index.mjs +84 -0
- package/dist/types/support/index.mjs.map +1 -0
- package/dist/utils/activityFilters.d.ts +23 -0
- package/dist/utils/activityFilters.d.ts.map +1 -0
- package/dist/utils/dropdown.d.ts +12 -0
- package/dist/utils/dropdown.d.ts.map +1 -0
- package/dist/utils/index.d.ts +6 -43
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/keys.d.ts +24 -0
- package/dist/utils/keys.d.ts.map +1 -0
- package/package.json +20 -4
- package/dist/Accordation/index.d.mts +0 -15
- package/dist/ActivityFilters/index.d.mts +0 -5
- package/dist/ActivityFilters-Cs3TpGAY.d.ts +0 -97
- package/dist/ActivityFilters-CsX8y41f.d.mts +0 -97
- package/dist/Alert/index.d.mts +0 -13
- package/dist/AlertDialog/index.d.mts +0 -36
- package/dist/AlertManager/index.d.mts +0 -17
- package/dist/AlertManagerView/index.d.mts +0 -31
- package/dist/Alternative/index.d.mts +0 -81
- package/dist/Auth/AuthProvider/index.d.mts +0 -3
- package/dist/Auth/ProtectedRoute/index.d.mts +0 -3
- package/dist/Auth/PublicRoute/index.d.mts +0 -3
- package/dist/Auth/getRootDomain/index.d.mts +0 -3
- package/dist/Auth/index.d.mts +0 -326
- package/dist/Auth/useApiConfig/index.d.mts +0 -43
- package/dist/Auth/useAuth/index.d.mts +0 -3
- package/dist/Auth/useAuthGuard/index.d.mts +0 -3
- package/dist/Auth/useRouteAuth/index.d.mts +0 -3
- package/dist/Auth/useUrlAuthentication/index.d.mts +0 -69
- package/dist/Auth/withAuth/index.d.mts +0 -3
- package/dist/Auth/zustandAuthAdapter/index.d.mts +0 -75
- package/dist/Badge/index.d.mts +0 -46
- package/dist/BreadcrumbMenu/breadcrumbStore/index.d.mts +0 -77
- package/dist/BreadcrumbMenu/index.d.mts +0 -31
- package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.d.mts +0 -48
- package/dist/BreadcrumbMenu/useUrlParams/index.d.mts +0 -28
- package/dist/Button/index.d.mts +0 -45
- package/dist/Calendar/index.d.mts +0 -60
- package/dist/Card/index.d.mts +0 -150
- package/dist/CheckBox/index.d.mts +0 -74
- package/dist/CheckBoxGroup-9n5C0OH4.d.mts +0 -24
- package/dist/CheckBoxGroup-9n5C0OH4.d.ts +0 -24
- package/dist/Chips/index.d.mts +0 -41
- package/dist/Divider/index.d.mts +0 -32
- package/dist/DownloadButton/index.d.mts +0 -46
- package/dist/DropdownMenu/index.d.mts +0 -82
- package/dist/EmptyState/index.d.mts +0 -65
- package/dist/IconButton/index.d.mts +0 -76
- package/dist/IconRender/index.d.mts +0 -36
- package/dist/IconRoundedButton/index.d.mts +0 -34
- package/dist/Input/index.d.mts +0 -27
- package/dist/LatexRenderer/index.d.mts +0 -50
- package/dist/LoadingModal/index.d.mts +0 -11
- package/dist/Menu/index.d.mts +0 -48
- package/dist/Modal/index.d.mts +0 -76
- package/dist/Modal/utils/videoUtils/index.d.mts +0 -28
- package/dist/MultipleChoice/index.d.mts +0 -20
- package/dist/NavButton/index.d.mts +0 -57
- package/dist/NoSearchResult/index.d.mts +0 -37
- package/dist/NotFound/index.d.mts +0 -58
- package/dist/NotificationCard/index.d.mts +0 -3
- package/dist/NotificationCard-4GgB0Nsf.d.mts +0 -417
- package/dist/NotificationCard-4GgB0Nsf.d.ts +0 -417
- package/dist/ProgressBar/index.d.mts +0 -95
- package/dist/ProgressCircle/index.d.mts +0 -60
- package/dist/Quiz/index.d.mts +0 -55
- package/dist/Quiz/useQuizStore/index.d.mts +0 -258
- package/dist/Radio/index.d.mts +0 -203
- package/dist/Search/index.d.mts +0 -27
- package/dist/Select/index.d.mts +0 -59
- package/dist/SelectionButton/index.d.mts +0 -57
- package/dist/Skeleton/index.d.mts +0 -40
- package/dist/StatisticsCard/index.d.mts +0 -79
- package/dist/Stepper/index.d.mts +0 -169
- package/dist/SubjectInfo/index.d.mts +0 -2
- package/dist/SubjectInfo-Dvt0OodP.d.mts +0 -37
- package/dist/SubjectInfo-Dvt0OodP.d.ts +0 -37
- package/dist/Table/TablePagination/index.d.mts +0 -64
- package/dist/Table/index.d.mts +0 -93
- package/dist/TableProvider/index.d.mts +0 -4
- package/dist/TableProvider-BnAnv3OV.d.mts +0 -239
- package/dist/TableProvider-GfPlLqzg.d.ts +0 -239
- package/dist/Text/index.d.mts +0 -58
- package/dist/TextArea/index.d.mts +0 -74
- package/dist/ThemeToggle/index.d.mts +0 -12
- package/dist/Toast/ToastStore/index.d.mts +0 -19
- package/dist/Toast/Toaster/index.d.mts +0 -16
- package/dist/Toast/index.d.mts +0 -17
- package/dist/VideoPlayer/index.d.mts +0 -52
- package/dist/Whiteboard/index.d.mts +0 -34
- package/dist/hooks/useMobile/index.d.mts +0 -29
- package/dist/hooks/useTheme/index.d.mts +0 -17
- package/dist/index.d.mts +0 -789
- package/dist/styles.d.mts +0 -2
- package/dist/styles.d.ts +0 -2
- package/dist/themeStore-P2X64zC-.d.mts +0 -79
- package/dist/types-DqZRjqxh.d.ts +0 -67
- package/dist/types-pd3QVhSu.d.mts +0 -67
- package/dist/utils/index.d.mts +0 -51
|
@@ -0,0 +1,2676 @@
|
|
|
1
|
+
// src/components/Support/Support.tsx
|
|
2
|
+
import { useState as useState5, useEffect as useEffect5 } from "react";
|
|
3
|
+
import { useForm } from "react-hook-form";
|
|
4
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
|
+
import {
|
|
6
|
+
KeyIcon as KeyIcon2,
|
|
7
|
+
InfoIcon as InfoIcon2,
|
|
8
|
+
BugIcon as BugIcon2,
|
|
9
|
+
CaretRightIcon
|
|
10
|
+
} from "@phosphor-icons/react";
|
|
11
|
+
import dayjs2 from "dayjs";
|
|
12
|
+
|
|
13
|
+
// src/utils/utils.ts
|
|
14
|
+
import { clsx } from "clsx";
|
|
15
|
+
import { twMerge } from "tailwind-merge";
|
|
16
|
+
function cn(...inputs) {
|
|
17
|
+
return twMerge(clsx(inputs));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/components/Text/Text.tsx
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
var Text = ({
|
|
23
|
+
children,
|
|
24
|
+
size = "md",
|
|
25
|
+
weight = "normal",
|
|
26
|
+
color = "text-text-950",
|
|
27
|
+
as,
|
|
28
|
+
className = "",
|
|
29
|
+
...props
|
|
30
|
+
}) => {
|
|
31
|
+
let sizeClasses = "";
|
|
32
|
+
let weightClasses = "";
|
|
33
|
+
const sizeClassMap = {
|
|
34
|
+
"2xs": "text-2xs",
|
|
35
|
+
xs: "text-xs",
|
|
36
|
+
sm: "text-sm",
|
|
37
|
+
md: "text-md",
|
|
38
|
+
lg: "text-lg",
|
|
39
|
+
xl: "text-xl",
|
|
40
|
+
"2xl": "text-2xl",
|
|
41
|
+
"3xl": "text-3xl",
|
|
42
|
+
"4xl": "text-4xl",
|
|
43
|
+
"5xl": "text-5xl",
|
|
44
|
+
"6xl": "text-6xl"
|
|
45
|
+
};
|
|
46
|
+
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
47
|
+
const weightClassMap = {
|
|
48
|
+
hairline: "font-hairline",
|
|
49
|
+
light: "font-light",
|
|
50
|
+
normal: "font-normal",
|
|
51
|
+
medium: "font-medium",
|
|
52
|
+
semibold: "font-semibold",
|
|
53
|
+
bold: "font-bold",
|
|
54
|
+
extrabold: "font-extrabold",
|
|
55
|
+
black: "font-black"
|
|
56
|
+
};
|
|
57
|
+
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
58
|
+
const baseClasses = "font-primary";
|
|
59
|
+
const Component = as ?? "p";
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
Component,
|
|
62
|
+
{
|
|
63
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
64
|
+
...props,
|
|
65
|
+
children
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
var Text_default = Text;
|
|
70
|
+
|
|
71
|
+
// src/components/SelectionButton/SelectionButton.tsx
|
|
72
|
+
import { forwardRef } from "react";
|
|
73
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
74
|
+
var SelectionButton = forwardRef(
|
|
75
|
+
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
76
|
+
const baseClasses = [
|
|
77
|
+
"inline-flex",
|
|
78
|
+
"items-center",
|
|
79
|
+
"justify-start",
|
|
80
|
+
"gap-2",
|
|
81
|
+
"p-4",
|
|
82
|
+
"rounded-xl",
|
|
83
|
+
"cursor-pointer",
|
|
84
|
+
"border",
|
|
85
|
+
"border-border-50",
|
|
86
|
+
"bg-background",
|
|
87
|
+
"text-sm",
|
|
88
|
+
"text-text-700",
|
|
89
|
+
"font-bold",
|
|
90
|
+
"shadow-soft-shadow-1",
|
|
91
|
+
"hover:bg-background-100",
|
|
92
|
+
"focus-visible:outline-none",
|
|
93
|
+
"focus-visible:ring-2",
|
|
94
|
+
"focus-visible:ring-indicator-info",
|
|
95
|
+
"focus-visible:ring-offset-0",
|
|
96
|
+
"focus-visible:shadow-none",
|
|
97
|
+
"active:ring-2",
|
|
98
|
+
"active:ring-primary-950",
|
|
99
|
+
"active:ring-offset-0",
|
|
100
|
+
"active:shadow-none",
|
|
101
|
+
"disabled:opacity-50",
|
|
102
|
+
"disabled:cursor-not-allowed"
|
|
103
|
+
];
|
|
104
|
+
const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
|
|
105
|
+
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
106
|
+
return /* @__PURE__ */ jsxs(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
ref,
|
|
110
|
+
type: "button",
|
|
111
|
+
className: cn(allClasses, className),
|
|
112
|
+
disabled,
|
|
113
|
+
"aria-pressed": selected,
|
|
114
|
+
...props,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx2("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
|
|
117
|
+
/* @__PURE__ */ jsx2("span", { children: label })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
SelectionButton.displayName = "SelectionButton";
|
|
124
|
+
var SelectionButton_default = SelectionButton;
|
|
125
|
+
|
|
126
|
+
// src/components/Input/Input.tsx
|
|
127
|
+
import { WarningCircle, Eye, EyeSlash } from "phosphor-react";
|
|
128
|
+
import {
|
|
129
|
+
forwardRef as forwardRef2,
|
|
130
|
+
useState,
|
|
131
|
+
useId,
|
|
132
|
+
useMemo
|
|
133
|
+
} from "react";
|
|
134
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
135
|
+
var SIZE_CLASSES = {
|
|
136
|
+
small: "text-sm",
|
|
137
|
+
medium: "text-md",
|
|
138
|
+
large: "text-lg",
|
|
139
|
+
"extra-large": "text-xl"
|
|
140
|
+
};
|
|
141
|
+
var STATE_CLASSES = {
|
|
142
|
+
default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
|
|
143
|
+
error: "border-2 border-indicator-error placeholder:text-text-600",
|
|
144
|
+
disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
|
|
145
|
+
"read-only": "border-transparent !text-text-600 cursor-default focus:outline-none bg-transparent"
|
|
146
|
+
};
|
|
147
|
+
var VARIANT_CLASSES = {
|
|
148
|
+
outlined: "border rounded-lg",
|
|
149
|
+
underlined: "border-0 border-b rounded-none bg-transparent focus:outline-none focus:border-primary-950 focus:border-b-2",
|
|
150
|
+
rounded: "border rounded-full"
|
|
151
|
+
};
|
|
152
|
+
var getActualState = (disabled, readOnly, errorMessage, state) => {
|
|
153
|
+
if (disabled) return "disabled";
|
|
154
|
+
if (readOnly) return "read-only";
|
|
155
|
+
if (errorMessage) return "error";
|
|
156
|
+
return state || "default";
|
|
157
|
+
};
|
|
158
|
+
var getIconSize = (size) => {
|
|
159
|
+
const iconSizeClasses = {
|
|
160
|
+
small: "w-4 h-4",
|
|
161
|
+
medium: "w-5 h-5",
|
|
162
|
+
large: "w-6 h-6",
|
|
163
|
+
"extra-large": "w-7 h-7"
|
|
164
|
+
};
|
|
165
|
+
return iconSizeClasses[size] || iconSizeClasses.medium;
|
|
166
|
+
};
|
|
167
|
+
var getPasswordToggleConfig = (type, disabled, readOnly, showPassword, iconRight) => {
|
|
168
|
+
const isPasswordType = type === "password";
|
|
169
|
+
const shouldShowPasswordToggle = isPasswordType && !disabled && !readOnly;
|
|
170
|
+
let actualIconRight = iconRight;
|
|
171
|
+
let ariaLabel;
|
|
172
|
+
if (shouldShowPasswordToggle) {
|
|
173
|
+
actualIconRight = showPassword ? /* @__PURE__ */ jsx3(EyeSlash, {}) : /* @__PURE__ */ jsx3(Eye, {});
|
|
174
|
+
ariaLabel = showPassword ? "Ocultar senha" : "Mostrar senha";
|
|
175
|
+
}
|
|
176
|
+
return { shouldShowPasswordToggle, actualIconRight, ariaLabel };
|
|
177
|
+
};
|
|
178
|
+
var getCombinedClasses = (actualState, variant) => {
|
|
179
|
+
const stateClasses = STATE_CLASSES[actualState];
|
|
180
|
+
const variantClasses = VARIANT_CLASSES[variant];
|
|
181
|
+
if (actualState === "error" && variant === "underlined") {
|
|
182
|
+
return "border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600";
|
|
183
|
+
}
|
|
184
|
+
if (actualState === "read-only" && variant === "underlined") {
|
|
185
|
+
return "border-0 border-b-0 rounded-none bg-transparent focus:outline-none !text-text-900 cursor-default";
|
|
186
|
+
}
|
|
187
|
+
return `${stateClasses} ${variantClasses}`;
|
|
188
|
+
};
|
|
189
|
+
var Input = forwardRef2(
|
|
190
|
+
({
|
|
191
|
+
label,
|
|
192
|
+
helperText,
|
|
193
|
+
errorMessage,
|
|
194
|
+
size = "medium",
|
|
195
|
+
variant = "outlined",
|
|
196
|
+
state = "default",
|
|
197
|
+
iconLeft,
|
|
198
|
+
iconRight,
|
|
199
|
+
className = "",
|
|
200
|
+
containerClassName = "",
|
|
201
|
+
disabled,
|
|
202
|
+
readOnly,
|
|
203
|
+
required,
|
|
204
|
+
id,
|
|
205
|
+
type = "text",
|
|
206
|
+
...props
|
|
207
|
+
}, ref) => {
|
|
208
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
209
|
+
const isPasswordType = type === "password";
|
|
210
|
+
const actualType = isPasswordType && showPassword ? "text" : type;
|
|
211
|
+
const actualState = getActualState(disabled, readOnly, errorMessage, state);
|
|
212
|
+
const sizeClasses = SIZE_CLASSES[size];
|
|
213
|
+
const combinedClasses = useMemo(
|
|
214
|
+
() => getCombinedClasses(actualState, variant),
|
|
215
|
+
[actualState, variant]
|
|
216
|
+
);
|
|
217
|
+
const iconSize = getIconSize(size);
|
|
218
|
+
const baseClasses = `bg-background w-full py-2 ${actualState === "read-only" ? "px-0" : "px-3"} font-normal text-text-900 focus:outline-primary-950`;
|
|
219
|
+
const generatedId = useId();
|
|
220
|
+
const inputId = id ?? `input-${generatedId}`;
|
|
221
|
+
const togglePasswordVisibility = () => setShowPassword(!showPassword);
|
|
222
|
+
const { shouldShowPasswordToggle, actualIconRight, ariaLabel } = getPasswordToggleConfig(
|
|
223
|
+
type,
|
|
224
|
+
disabled,
|
|
225
|
+
readOnly,
|
|
226
|
+
showPassword,
|
|
227
|
+
iconRight
|
|
228
|
+
);
|
|
229
|
+
return /* @__PURE__ */ jsxs2("div", { className: `${containerClassName}`, children: [
|
|
230
|
+
label && /* @__PURE__ */ jsxs2(
|
|
231
|
+
"label",
|
|
232
|
+
{
|
|
233
|
+
htmlFor: inputId,
|
|
234
|
+
className: `block font-bold text-text-900 mb-1.5 ${sizeClasses}`,
|
|
235
|
+
children: [
|
|
236
|
+
label,
|
|
237
|
+
" ",
|
|
238
|
+
required && /* @__PURE__ */ jsx3("span", { className: "text-indicator-error", children: "*" })
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
243
|
+
iconLeft && /* @__PURE__ */ jsx3("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx3(
|
|
244
|
+
"span",
|
|
245
|
+
{
|
|
246
|
+
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
247
|
+
children: iconLeft
|
|
248
|
+
}
|
|
249
|
+
) }),
|
|
250
|
+
/* @__PURE__ */ jsx3(
|
|
251
|
+
"input",
|
|
252
|
+
{
|
|
253
|
+
ref,
|
|
254
|
+
id: inputId,
|
|
255
|
+
type: actualType,
|
|
256
|
+
className: `${baseClasses} ${sizeClasses} ${combinedClasses} ${iconLeft ? "pl-10" : ""} ${actualIconRight ? "pr-10" : ""} ${className}`,
|
|
257
|
+
disabled,
|
|
258
|
+
readOnly,
|
|
259
|
+
required,
|
|
260
|
+
"aria-invalid": actualState === "error" ? "true" : void 0,
|
|
261
|
+
...props
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
actualIconRight && (shouldShowPasswordToggle ? /* @__PURE__ */ jsx3(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
type: "button",
|
|
268
|
+
className: "absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0",
|
|
269
|
+
onClick: togglePasswordVisibility,
|
|
270
|
+
"aria-label": ariaLabel,
|
|
271
|
+
children: /* @__PURE__ */ jsx3(
|
|
272
|
+
"span",
|
|
273
|
+
{
|
|
274
|
+
className: `${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`,
|
|
275
|
+
children: actualIconRight
|
|
276
|
+
}
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
) : /* @__PURE__ */ jsx3("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ jsx3(
|
|
280
|
+
"span",
|
|
281
|
+
{
|
|
282
|
+
className: `${iconSize} text-text-400 flex items-center justify-center`,
|
|
283
|
+
children: actualIconRight
|
|
284
|
+
}
|
|
285
|
+
) }))
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-1.5 gap-1.5", children: [
|
|
288
|
+
helperText && /* @__PURE__ */ jsx3("p", { className: "text-sm text-text-500", children: helperText }),
|
|
289
|
+
errorMessage && /* @__PURE__ */ jsxs2("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
|
|
290
|
+
/* @__PURE__ */ jsx3(WarningCircle, { size: 16 }),
|
|
291
|
+
" ",
|
|
292
|
+
errorMessage
|
|
293
|
+
] })
|
|
294
|
+
] })
|
|
295
|
+
] });
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
var Input_default = Input;
|
|
299
|
+
|
|
300
|
+
// src/components/TextArea/TextArea.tsx
|
|
301
|
+
import {
|
|
302
|
+
forwardRef as forwardRef3,
|
|
303
|
+
useState as useState2,
|
|
304
|
+
useId as useId2
|
|
305
|
+
} from "react";
|
|
306
|
+
import { WarningCircle as WarningCircle2 } from "phosphor-react";
|
|
307
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
308
|
+
var SIZE_CLASSES2 = {
|
|
309
|
+
small: {
|
|
310
|
+
textarea: "h-24 text-sm",
|
|
311
|
+
// 96px height, 14px font
|
|
312
|
+
textSize: "sm"
|
|
313
|
+
},
|
|
314
|
+
medium: {
|
|
315
|
+
textarea: "h-24 text-base",
|
|
316
|
+
// 96px height, 16px font
|
|
317
|
+
textSize: "md"
|
|
318
|
+
},
|
|
319
|
+
large: {
|
|
320
|
+
textarea: "h-24 text-lg",
|
|
321
|
+
// 96px height, 18px font
|
|
322
|
+
textSize: "lg"
|
|
323
|
+
},
|
|
324
|
+
extraLarge: {
|
|
325
|
+
textarea: "h-24 text-xl",
|
|
326
|
+
// 96px height, 20px font
|
|
327
|
+
textSize: "xl"
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
var BASE_TEXTAREA_CLASSES = "w-full box-border p-3 bg-background border border-solid rounded-[4px] resize-none focus:outline-none font-roboto font-normal leading-[150%] placeholder:text-text-600 transition-all duration-200";
|
|
331
|
+
var STATE_CLASSES2 = {
|
|
332
|
+
default: {
|
|
333
|
+
base: "border-border-300 bg-background text-text-600",
|
|
334
|
+
hover: "hover:border-border-400",
|
|
335
|
+
focus: "focus:border-border-500"
|
|
336
|
+
},
|
|
337
|
+
hovered: {
|
|
338
|
+
base: "border-border-400 bg-background text-text-600",
|
|
339
|
+
hover: "",
|
|
340
|
+
focus: "focus:border-border-500"
|
|
341
|
+
},
|
|
342
|
+
focused: {
|
|
343
|
+
base: "border-2 border-primary-950 bg-background text-text-900",
|
|
344
|
+
hover: "",
|
|
345
|
+
focus: ""
|
|
346
|
+
},
|
|
347
|
+
invalid: {
|
|
348
|
+
base: "border-2 border-red-700 bg-white text-gray-800",
|
|
349
|
+
hover: "hover:border-red-700",
|
|
350
|
+
focus: "focus:border-red-700"
|
|
351
|
+
},
|
|
352
|
+
disabled: {
|
|
353
|
+
base: "border-border-300 bg-background text-text-600 cursor-not-allowed opacity-40",
|
|
354
|
+
hover: "",
|
|
355
|
+
focus: ""
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
var TextArea = forwardRef3(
|
|
359
|
+
({
|
|
360
|
+
label,
|
|
361
|
+
size = "medium",
|
|
362
|
+
state = "default",
|
|
363
|
+
errorMessage,
|
|
364
|
+
helperMessage,
|
|
365
|
+
className = "",
|
|
366
|
+
labelClassName = "",
|
|
367
|
+
disabled,
|
|
368
|
+
id,
|
|
369
|
+
onChange,
|
|
370
|
+
placeholder,
|
|
371
|
+
required,
|
|
372
|
+
showCharacterCount = false,
|
|
373
|
+
maxLength,
|
|
374
|
+
value,
|
|
375
|
+
...props
|
|
376
|
+
}, ref) => {
|
|
377
|
+
const generatedId = useId2();
|
|
378
|
+
const inputId = id ?? `textarea-${generatedId}`;
|
|
379
|
+
const [isFocused, setIsFocused] = useState2(false);
|
|
380
|
+
const currentLength = typeof value === "string" ? value.length : 0;
|
|
381
|
+
const isNearLimit = maxLength && currentLength >= maxLength * 0.8;
|
|
382
|
+
const handleChange = (event) => {
|
|
383
|
+
onChange?.(event);
|
|
384
|
+
};
|
|
385
|
+
const handleFocus = (event) => {
|
|
386
|
+
setIsFocused(true);
|
|
387
|
+
props.onFocus?.(event);
|
|
388
|
+
};
|
|
389
|
+
const handleBlur = (event) => {
|
|
390
|
+
setIsFocused(false);
|
|
391
|
+
props.onBlur?.(event);
|
|
392
|
+
};
|
|
393
|
+
let currentState = disabled ? "disabled" : state;
|
|
394
|
+
if (isFocused && currentState !== "invalid" && currentState !== "disabled") {
|
|
395
|
+
currentState = "focused";
|
|
396
|
+
}
|
|
397
|
+
const sizeClasses = SIZE_CLASSES2[size];
|
|
398
|
+
const stateClasses = STATE_CLASSES2[currentState];
|
|
399
|
+
const textareaClasses = cn(
|
|
400
|
+
BASE_TEXTAREA_CLASSES,
|
|
401
|
+
sizeClasses.textarea,
|
|
402
|
+
stateClasses.base,
|
|
403
|
+
stateClasses.hover,
|
|
404
|
+
stateClasses.focus,
|
|
405
|
+
className
|
|
406
|
+
);
|
|
407
|
+
return /* @__PURE__ */ jsxs3("div", { className: `flex flex-col`, children: [
|
|
408
|
+
label && /* @__PURE__ */ jsxs3(
|
|
409
|
+
Text_default,
|
|
410
|
+
{
|
|
411
|
+
as: "label",
|
|
412
|
+
htmlFor: inputId,
|
|
413
|
+
size: sizeClasses.textSize,
|
|
414
|
+
weight: "medium",
|
|
415
|
+
color: "text-text-950",
|
|
416
|
+
className: cn("mb-1.5", labelClassName),
|
|
417
|
+
children: [
|
|
418
|
+
label,
|
|
419
|
+
" ",
|
|
420
|
+
required && /* @__PURE__ */ jsx4("span", { className: "text-indicator-error", children: "*" })
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ jsx4(
|
|
425
|
+
"textarea",
|
|
426
|
+
{
|
|
427
|
+
ref,
|
|
428
|
+
id: inputId,
|
|
429
|
+
disabled,
|
|
430
|
+
onChange: handleChange,
|
|
431
|
+
onFocus: handleFocus,
|
|
432
|
+
onBlur: handleBlur,
|
|
433
|
+
className: textareaClasses,
|
|
434
|
+
placeholder,
|
|
435
|
+
required,
|
|
436
|
+
maxLength,
|
|
437
|
+
value,
|
|
438
|
+
...props
|
|
439
|
+
}
|
|
440
|
+
),
|
|
441
|
+
errorMessage && /* @__PURE__ */ jsxs3("p", { className: "flex gap-1 items-center text-sm text-indicator-error mt-1.5", children: [
|
|
442
|
+
/* @__PURE__ */ jsx4(WarningCircle2, { size: 16 }),
|
|
443
|
+
" ",
|
|
444
|
+
errorMessage
|
|
445
|
+
] }),
|
|
446
|
+
!errorMessage && showCharacterCount && maxLength && /* @__PURE__ */ jsxs3(
|
|
447
|
+
Text_default,
|
|
448
|
+
{
|
|
449
|
+
size: "sm",
|
|
450
|
+
weight: "normal",
|
|
451
|
+
className: `mt-1.5 ${isNearLimit ? "text-indicator-warning" : "text-text-500"}`,
|
|
452
|
+
children: [
|
|
453
|
+
currentLength,
|
|
454
|
+
"/",
|
|
455
|
+
maxLength,
|
|
456
|
+
" caracteres"
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
),
|
|
460
|
+
!errorMessage && helperMessage && !(showCharacterCount && maxLength) && /* @__PURE__ */ jsx4(Text_default, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperMessage })
|
|
461
|
+
] });
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
TextArea.displayName = "TextArea";
|
|
465
|
+
var TextArea_default = TextArea;
|
|
466
|
+
|
|
467
|
+
// src/components/Button/Button.tsx
|
|
468
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
469
|
+
var VARIANT_ACTION_CLASSES = {
|
|
470
|
+
solid: {
|
|
471
|
+
primary: "bg-primary-950 text-text border border-primary-950 hover:bg-primary-800 hover:border-primary-800 focus-visible:outline-none focus-visible:bg-primary-950 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-primary-700 active:border-primary-700 disabled:bg-primary-500 disabled:border-primary-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
472
|
+
positive: "bg-success-500 text-text border border-success-500 hover:bg-success-600 hover:border-success-600 focus-visible:outline-none focus-visible:bg-success-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-success-700 active:border-success-700 disabled:bg-success-500 disabled:border-success-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
473
|
+
negative: "bg-error-500 text-text border border-error-500 hover:bg-error-600 hover:border-error-600 focus-visible:outline-none focus-visible:bg-error-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-error-700 active:border-error-700 disabled:bg-error-500 disabled:border-error-500 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
474
|
+
},
|
|
475
|
+
outline: {
|
|
476
|
+
primary: "bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
477
|
+
positive: "bg-transparent text-success-500 border border-success-300 hover:bg-background-50 hover:text-success-400 hover:border-success-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 active:border-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
478
|
+
negative: "bg-transparent text-error-500 border border-error-300 hover:bg-background-50 hover:text-error-400 hover:border-error-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 active:border-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
479
|
+
},
|
|
480
|
+
link: {
|
|
481
|
+
primary: "bg-transparent text-primary-950 hover:text-primary-400 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
482
|
+
positive: "bg-transparent text-success-500 hover:text-success-400 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
483
|
+
negative: "bg-transparent text-error-500 hover:text-error-400 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
var SIZE_CLASSES3 = {
|
|
487
|
+
"extra-small": "text-xs px-3.5 py-2",
|
|
488
|
+
small: "text-sm px-4 py-2.5",
|
|
489
|
+
medium: "text-md px-5 py-2.5",
|
|
490
|
+
large: "text-lg px-6 py-3",
|
|
491
|
+
"extra-large": "text-lg px-7 py-3.5"
|
|
492
|
+
};
|
|
493
|
+
var Button = ({
|
|
494
|
+
children,
|
|
495
|
+
iconLeft,
|
|
496
|
+
iconRight,
|
|
497
|
+
size = "medium",
|
|
498
|
+
variant = "solid",
|
|
499
|
+
action = "primary",
|
|
500
|
+
className = "",
|
|
501
|
+
disabled,
|
|
502
|
+
type = "button",
|
|
503
|
+
...props
|
|
504
|
+
}) => {
|
|
505
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
506
|
+
const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
|
|
507
|
+
const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
|
|
508
|
+
return /* @__PURE__ */ jsxs4(
|
|
509
|
+
"button",
|
|
510
|
+
{
|
|
511
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
512
|
+
disabled,
|
|
513
|
+
type,
|
|
514
|
+
...props,
|
|
515
|
+
children: [
|
|
516
|
+
iconLeft && /* @__PURE__ */ jsx5("span", { className: "mr-2 flex items-center", children: iconLeft }),
|
|
517
|
+
children,
|
|
518
|
+
iconRight && /* @__PURE__ */ jsx5("span", { className: "ml-2 flex items-center", children: iconRight })
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
};
|
|
523
|
+
var Button_default = Button;
|
|
524
|
+
|
|
525
|
+
// src/components/Select/Select.tsx
|
|
526
|
+
import { create, useStore } from "zustand";
|
|
527
|
+
import {
|
|
528
|
+
useEffect,
|
|
529
|
+
useRef,
|
|
530
|
+
forwardRef as forwardRef4,
|
|
531
|
+
isValidElement,
|
|
532
|
+
Children,
|
|
533
|
+
cloneElement,
|
|
534
|
+
useId as useId3
|
|
535
|
+
} from "react";
|
|
536
|
+
import { CaretDown, Check, WarningCircle as WarningCircle3 } from "phosphor-react";
|
|
537
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
538
|
+
var VARIANT_CLASSES2 = {
|
|
539
|
+
outlined: "border-2 rounded-lg focus:border-primary-950",
|
|
540
|
+
underlined: "border-b-2 focus:border-primary-950",
|
|
541
|
+
rounded: "border-2 rounded-full focus:border-primary-950"
|
|
542
|
+
};
|
|
543
|
+
var SIZE_CLASSES4 = {
|
|
544
|
+
small: "text-sm",
|
|
545
|
+
medium: "text-md",
|
|
546
|
+
large: "text-lg",
|
|
547
|
+
"extra-large": "text-lg"
|
|
548
|
+
};
|
|
549
|
+
var HEIGHT_CLASSES = {
|
|
550
|
+
small: "h-8",
|
|
551
|
+
medium: "h-9",
|
|
552
|
+
large: "h-10",
|
|
553
|
+
"extra-large": "h-12"
|
|
554
|
+
};
|
|
555
|
+
var PADDING_CLASSES = {
|
|
556
|
+
small: "px-2 py-1",
|
|
557
|
+
medium: "px-3 py-2",
|
|
558
|
+
large: "px-4 py-3",
|
|
559
|
+
"extra-large": "px-5 py-4"
|
|
560
|
+
};
|
|
561
|
+
var SIDE_CLASSES = {
|
|
562
|
+
top: "bottom-full -translate-y-1",
|
|
563
|
+
right: "top-full translate-y-1",
|
|
564
|
+
bottom: "top-full translate-y-1",
|
|
565
|
+
left: "top-full translate-y-1"
|
|
566
|
+
};
|
|
567
|
+
var ALIGN_CLASSES = {
|
|
568
|
+
start: "left-0",
|
|
569
|
+
center: "left-1/2 -translate-x-1/2",
|
|
570
|
+
end: "right-0"
|
|
571
|
+
};
|
|
572
|
+
function createSelectStore(onValueChange) {
|
|
573
|
+
return create((set) => ({
|
|
574
|
+
open: false,
|
|
575
|
+
setOpen: (open) => set({ open }),
|
|
576
|
+
value: "",
|
|
577
|
+
setValue: (value) => set({ value }),
|
|
578
|
+
selectedLabel: "",
|
|
579
|
+
setSelectedLabel: (label) => set({ selectedLabel: label }),
|
|
580
|
+
onValueChange
|
|
581
|
+
}));
|
|
582
|
+
}
|
|
583
|
+
var useSelectStore = (externalStore) => {
|
|
584
|
+
if (!externalStore) {
|
|
585
|
+
throw new Error(
|
|
586
|
+
"Component must be used within a Select (store is missing)"
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
return externalStore;
|
|
590
|
+
};
|
|
591
|
+
function getLabelAsNode(children) {
|
|
592
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
593
|
+
return children;
|
|
594
|
+
}
|
|
595
|
+
const flattened = Children.toArray(children);
|
|
596
|
+
if (flattened.length === 1) return flattened[0];
|
|
597
|
+
return /* @__PURE__ */ jsx6(Fragment, { children: flattened });
|
|
598
|
+
}
|
|
599
|
+
var injectStore = (children, store, size, selectId) => {
|
|
600
|
+
return Children.map(children, (child) => {
|
|
601
|
+
if (isValidElement(child)) {
|
|
602
|
+
const typedChild = child;
|
|
603
|
+
const newProps = {
|
|
604
|
+
store
|
|
605
|
+
};
|
|
606
|
+
if (typedChild.type === SelectTrigger) {
|
|
607
|
+
newProps.size = size;
|
|
608
|
+
newProps.selectId = selectId;
|
|
609
|
+
}
|
|
610
|
+
if (typedChild.props.children) {
|
|
611
|
+
newProps.children = injectStore(
|
|
612
|
+
typedChild.props.children,
|
|
613
|
+
store,
|
|
614
|
+
size,
|
|
615
|
+
selectId
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
return cloneElement(typedChild, newProps);
|
|
619
|
+
}
|
|
620
|
+
return child;
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
var Select = ({
|
|
624
|
+
children,
|
|
625
|
+
defaultValue = "",
|
|
626
|
+
className,
|
|
627
|
+
value: propValue,
|
|
628
|
+
onValueChange,
|
|
629
|
+
size = "small",
|
|
630
|
+
label,
|
|
631
|
+
helperText,
|
|
632
|
+
errorMessage,
|
|
633
|
+
id
|
|
634
|
+
}) => {
|
|
635
|
+
const storeRef = useRef(null);
|
|
636
|
+
storeRef.current ??= createSelectStore(onValueChange);
|
|
637
|
+
const store = storeRef.current;
|
|
638
|
+
const selectRef = useRef(null);
|
|
639
|
+
const { open, setOpen, setValue, selectedLabel } = useStore(store, (s) => s);
|
|
640
|
+
const generatedId = useId3();
|
|
641
|
+
const selectId = id ?? `select-${generatedId}`;
|
|
642
|
+
const findLabelForValue = (children2, targetValue) => {
|
|
643
|
+
let found = null;
|
|
644
|
+
const search = (nodes) => {
|
|
645
|
+
Children.forEach(nodes, (child) => {
|
|
646
|
+
if (!isValidElement(child)) return;
|
|
647
|
+
const typedChild = child;
|
|
648
|
+
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
649
|
+
if (typeof typedChild.props.children === "string")
|
|
650
|
+
found = typedChild.props.children;
|
|
651
|
+
}
|
|
652
|
+
if (typedChild.props.children && !found)
|
|
653
|
+
search(typedChild.props.children);
|
|
654
|
+
});
|
|
655
|
+
};
|
|
656
|
+
search(children2);
|
|
657
|
+
return found;
|
|
658
|
+
};
|
|
659
|
+
useEffect(() => {
|
|
660
|
+
if (!selectedLabel && defaultValue) {
|
|
661
|
+
const label2 = findLabelForValue(children, defaultValue);
|
|
662
|
+
if (label2) store.setState({ selectedLabel: label2 });
|
|
663
|
+
}
|
|
664
|
+
}, [children, defaultValue, selectedLabel]);
|
|
665
|
+
useEffect(() => {
|
|
666
|
+
const handleClickOutside = (event) => {
|
|
667
|
+
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
668
|
+
setOpen(false);
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
const handleArrowKeys = (event) => {
|
|
672
|
+
const selectContent = selectRef.current?.querySelector('[role="menu"]');
|
|
673
|
+
if (selectContent) {
|
|
674
|
+
event.preventDefault();
|
|
675
|
+
const items = Array.from(
|
|
676
|
+
selectContent.querySelectorAll(
|
|
677
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
678
|
+
)
|
|
679
|
+
).filter((el) => el instanceof HTMLElement);
|
|
680
|
+
const focused = document.activeElement;
|
|
681
|
+
const currentIndex = items.findIndex((item) => item === focused);
|
|
682
|
+
let nextIndex = 0;
|
|
683
|
+
if (event.key === "ArrowDown") {
|
|
684
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
685
|
+
} else {
|
|
686
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
687
|
+
}
|
|
688
|
+
items[nextIndex]?.focus();
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
if (open) {
|
|
692
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
693
|
+
document.addEventListener("keydown", handleArrowKeys);
|
|
694
|
+
}
|
|
695
|
+
return () => {
|
|
696
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
697
|
+
document.removeEventListener("keydown", handleArrowKeys);
|
|
698
|
+
};
|
|
699
|
+
}, [open]);
|
|
700
|
+
useEffect(() => {
|
|
701
|
+
if (propValue) {
|
|
702
|
+
setValue(propValue);
|
|
703
|
+
const label2 = findLabelForValue(children, propValue);
|
|
704
|
+
if (label2) store.setState({ selectedLabel: label2 });
|
|
705
|
+
}
|
|
706
|
+
}, [propValue]);
|
|
707
|
+
const sizeClasses = SIZE_CLASSES4[size];
|
|
708
|
+
return /* @__PURE__ */ jsxs5("div", { className: cn("w-full", className), children: [
|
|
709
|
+
label && /* @__PURE__ */ jsx6(
|
|
710
|
+
"label",
|
|
711
|
+
{
|
|
712
|
+
htmlFor: selectId,
|
|
713
|
+
className: cn("block font-bold text-text-900 mb-1.5", sizeClasses),
|
|
714
|
+
children: label
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
/* @__PURE__ */ jsx6("div", { className: cn("relative w-full"), ref: selectRef, children: injectStore(children, store, size, selectId) }),
|
|
718
|
+
(helperText || errorMessage) && /* @__PURE__ */ jsxs5("div", { className: "mt-1.5 gap-1.5", children: [
|
|
719
|
+
helperText && /* @__PURE__ */ jsx6("p", { className: "text-sm text-text-500", children: helperText }),
|
|
720
|
+
errorMessage && /* @__PURE__ */ jsxs5("p", { className: "flex gap-1 items-center text-sm text-indicator-error", children: [
|
|
721
|
+
/* @__PURE__ */ jsx6(WarningCircle3, { size: 16 }),
|
|
722
|
+
" ",
|
|
723
|
+
errorMessage
|
|
724
|
+
] })
|
|
725
|
+
] })
|
|
726
|
+
] });
|
|
727
|
+
};
|
|
728
|
+
var SelectValue = ({
|
|
729
|
+
placeholder,
|
|
730
|
+
store: externalStore
|
|
731
|
+
}) => {
|
|
732
|
+
const store = useSelectStore(externalStore);
|
|
733
|
+
const selectedLabel = useStore(store, (s) => s.selectedLabel);
|
|
734
|
+
const value = useStore(store, (s) => s.value);
|
|
735
|
+
return /* @__PURE__ */ jsx6("span", { className: "text-inherit flex gap-2 items-center", children: selectedLabel || placeholder || value });
|
|
736
|
+
};
|
|
737
|
+
var SelectTrigger = forwardRef4(
|
|
738
|
+
({
|
|
739
|
+
className,
|
|
740
|
+
invalid = false,
|
|
741
|
+
variant = "outlined",
|
|
742
|
+
store: externalStore,
|
|
743
|
+
disabled,
|
|
744
|
+
size = "medium",
|
|
745
|
+
selectId,
|
|
746
|
+
...props
|
|
747
|
+
}, ref) => {
|
|
748
|
+
const store = useSelectStore(externalStore);
|
|
749
|
+
const open = useStore(store, (s) => s.open);
|
|
750
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
751
|
+
const variantClasses = VARIANT_CLASSES2[variant];
|
|
752
|
+
const heightClasses = HEIGHT_CLASSES[size];
|
|
753
|
+
const paddingClasses = PADDING_CLASSES[size];
|
|
754
|
+
return /* @__PURE__ */ jsxs5(
|
|
755
|
+
"button",
|
|
756
|
+
{
|
|
757
|
+
ref,
|
|
758
|
+
id: selectId,
|
|
759
|
+
className: cn(
|
|
760
|
+
"flex w-full items-center justify-between border-border-300",
|
|
761
|
+
heightClasses,
|
|
762
|
+
paddingClasses,
|
|
763
|
+
invalid && `${variant == "underlined" ? "border-b-2" : "border-2"} border-indicator-error text-text-600`,
|
|
764
|
+
disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground",
|
|
765
|
+
!invalid && !disabled ? "text-text-700" : "",
|
|
766
|
+
variantClasses,
|
|
767
|
+
className
|
|
768
|
+
),
|
|
769
|
+
onClick: toggleOpen,
|
|
770
|
+
"aria-expanded": open,
|
|
771
|
+
"aria-haspopup": "listbox",
|
|
772
|
+
"aria-controls": open ? "select-content" : void 0,
|
|
773
|
+
...props,
|
|
774
|
+
children: [
|
|
775
|
+
props.children,
|
|
776
|
+
/* @__PURE__ */ jsx6(
|
|
777
|
+
CaretDown,
|
|
778
|
+
{
|
|
779
|
+
className: cn(
|
|
780
|
+
"h-[1em] w-[1em] opacity-50 transition-transform",
|
|
781
|
+
open ? "rotate-180" : ""
|
|
782
|
+
)
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
);
|
|
790
|
+
SelectTrigger.displayName = "SelectTrigger";
|
|
791
|
+
var SelectContent = forwardRef4(
|
|
792
|
+
({
|
|
793
|
+
children,
|
|
794
|
+
className,
|
|
795
|
+
align = "start",
|
|
796
|
+
side = "bottom",
|
|
797
|
+
store: externalStore,
|
|
798
|
+
...props
|
|
799
|
+
}, ref) => {
|
|
800
|
+
const store = useSelectStore(externalStore);
|
|
801
|
+
const open = useStore(store, (s) => s.open);
|
|
802
|
+
if (!open) return null;
|
|
803
|
+
const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES[side]} ${ALIGN_CLASSES[align]}`;
|
|
804
|
+
return /* @__PURE__ */ jsx6(
|
|
805
|
+
"div",
|
|
806
|
+
{
|
|
807
|
+
role: "menu",
|
|
808
|
+
ref,
|
|
809
|
+
className: cn(
|
|
810
|
+
"bg-secondary z-50 min-w-[210px] max-h-[300px] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md border-border-100",
|
|
811
|
+
getPositionClasses(),
|
|
812
|
+
className
|
|
813
|
+
),
|
|
814
|
+
...props,
|
|
815
|
+
children
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
SelectContent.displayName = "SelectContent";
|
|
821
|
+
var SelectItem = forwardRef4(
|
|
822
|
+
({
|
|
823
|
+
className,
|
|
824
|
+
children,
|
|
825
|
+
value,
|
|
826
|
+
disabled = false,
|
|
827
|
+
store: externalStore,
|
|
828
|
+
...props
|
|
829
|
+
}, ref) => {
|
|
830
|
+
const store = useSelectStore(externalStore);
|
|
831
|
+
const {
|
|
832
|
+
value: selectedValue,
|
|
833
|
+
setValue,
|
|
834
|
+
setOpen,
|
|
835
|
+
setSelectedLabel,
|
|
836
|
+
onValueChange
|
|
837
|
+
} = useStore(store, (s) => s);
|
|
838
|
+
const handleClick = (e) => {
|
|
839
|
+
const labelNode = getLabelAsNode(children);
|
|
840
|
+
if (!disabled) {
|
|
841
|
+
setValue(value);
|
|
842
|
+
setSelectedLabel(labelNode);
|
|
843
|
+
setOpen(false);
|
|
844
|
+
onValueChange?.(value);
|
|
845
|
+
}
|
|
846
|
+
props.onClick?.(e);
|
|
847
|
+
};
|
|
848
|
+
return /* @__PURE__ */ jsxs5(
|
|
849
|
+
"div",
|
|
850
|
+
{
|
|
851
|
+
role: "menuitem",
|
|
852
|
+
"aria-disabled": disabled,
|
|
853
|
+
ref,
|
|
854
|
+
className: `
|
|
855
|
+
bg-secondary focus-visible:bg-background-50
|
|
856
|
+
relative flex select-none items-center gap-2 rounded-sm p-3 outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
|
|
857
|
+
${className}
|
|
858
|
+
${disabled ? "cursor-not-allowed text-text-400 pointer-events-none opacity-50" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
859
|
+
${selectedValue === value && "bg-background-50"}
|
|
860
|
+
`,
|
|
861
|
+
onClick: handleClick,
|
|
862
|
+
onKeyDown: (e) => {
|
|
863
|
+
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
864
|
+
},
|
|
865
|
+
tabIndex: disabled ? -1 : 0,
|
|
866
|
+
...props,
|
|
867
|
+
children: [
|
|
868
|
+
/* @__PURE__ */ jsx6("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ jsx6(Check, { className: "" }) }),
|
|
869
|
+
children
|
|
870
|
+
]
|
|
871
|
+
}
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
);
|
|
875
|
+
SelectItem.displayName = "SelectItem";
|
|
876
|
+
var Select_default = Select;
|
|
877
|
+
|
|
878
|
+
// src/components/Badge/Badge.tsx
|
|
879
|
+
import { Bell } from "phosphor-react";
|
|
880
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
881
|
+
var VARIANT_ACTION_CLASSES2 = {
|
|
882
|
+
solid: {
|
|
883
|
+
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
884
|
+
warning: "bg-warning text-warning-800 focus-visible:outline-none",
|
|
885
|
+
success: "bg-success text-success-800 focus-visible:outline-none",
|
|
886
|
+
info: "bg-info text-info-800 focus-visible:outline-none",
|
|
887
|
+
muted: "bg-background-muted text-background-800 focus-visible:outline-none"
|
|
888
|
+
},
|
|
889
|
+
outlined: {
|
|
890
|
+
error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
|
|
891
|
+
warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
|
|
892
|
+
success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
|
|
893
|
+
info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
|
|
894
|
+
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
895
|
+
},
|
|
896
|
+
exams: {
|
|
897
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
898
|
+
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
899
|
+
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
900
|
+
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
901
|
+
},
|
|
902
|
+
examsOutlined: {
|
|
903
|
+
exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
|
|
904
|
+
exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
|
|
905
|
+
exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
|
|
906
|
+
exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
|
|
907
|
+
},
|
|
908
|
+
resultStatus: {
|
|
909
|
+
negative: "bg-error text-error-800 focus-visible:outline-none",
|
|
910
|
+
positive: "bg-success text-success-800 focus-visible:outline-none"
|
|
911
|
+
},
|
|
912
|
+
notification: "text-primary"
|
|
913
|
+
};
|
|
914
|
+
var SIZE_CLASSES5 = {
|
|
915
|
+
small: "text-2xs px-2 py-1",
|
|
916
|
+
medium: "text-xs px-2 py-1",
|
|
917
|
+
large: "text-sm px-2 py-1"
|
|
918
|
+
};
|
|
919
|
+
var SIZE_CLASSES_ICON = {
|
|
920
|
+
small: "size-3",
|
|
921
|
+
medium: "size-3.5",
|
|
922
|
+
large: "size-4"
|
|
923
|
+
};
|
|
924
|
+
var Badge = ({
|
|
925
|
+
children,
|
|
926
|
+
iconLeft,
|
|
927
|
+
iconRight,
|
|
928
|
+
size = "medium",
|
|
929
|
+
variant = "solid",
|
|
930
|
+
action = "error",
|
|
931
|
+
className = "",
|
|
932
|
+
notificationActive = false,
|
|
933
|
+
...props
|
|
934
|
+
}) => {
|
|
935
|
+
const sizeClasses = SIZE_CLASSES5[size];
|
|
936
|
+
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
937
|
+
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
938
|
+
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
939
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
940
|
+
const baseClassesIcon = "flex items-center";
|
|
941
|
+
if (variant === "notification") {
|
|
942
|
+
return /* @__PURE__ */ jsxs6(
|
|
943
|
+
"div",
|
|
944
|
+
{
|
|
945
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
946
|
+
...props,
|
|
947
|
+
children: [
|
|
948
|
+
/* @__PURE__ */ jsx7(Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
949
|
+
notificationActive && /* @__PURE__ */ jsx7(
|
|
950
|
+
"span",
|
|
951
|
+
{
|
|
952
|
+
"data-testid": "notification-dot",
|
|
953
|
+
className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
|
|
954
|
+
}
|
|
955
|
+
)
|
|
956
|
+
]
|
|
957
|
+
}
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
return /* @__PURE__ */ jsxs6(
|
|
961
|
+
"div",
|
|
962
|
+
{
|
|
963
|
+
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
964
|
+
...props,
|
|
965
|
+
children: [
|
|
966
|
+
iconLeft && /* @__PURE__ */ jsx7("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
967
|
+
children,
|
|
968
|
+
iconRight && /* @__PURE__ */ jsx7("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
);
|
|
972
|
+
};
|
|
973
|
+
var Badge_default = Badge;
|
|
974
|
+
|
|
975
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
976
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
977
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
978
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
979
|
+
pulse: "animate-pulse",
|
|
980
|
+
none: ""
|
|
981
|
+
};
|
|
982
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
983
|
+
text: "h-4 bg-background-200 rounded",
|
|
984
|
+
circular: "bg-background-200 rounded-full",
|
|
985
|
+
rectangular: "bg-background-200",
|
|
986
|
+
rounded: "bg-background-200 rounded-lg"
|
|
987
|
+
};
|
|
988
|
+
var SPACING_CLASSES = {
|
|
989
|
+
none: "",
|
|
990
|
+
small: "space-y-1",
|
|
991
|
+
medium: "space-y-2",
|
|
992
|
+
large: "space-y-3"
|
|
993
|
+
};
|
|
994
|
+
var Skeleton = forwardRef5(
|
|
995
|
+
({
|
|
996
|
+
variant = "text",
|
|
997
|
+
width,
|
|
998
|
+
height,
|
|
999
|
+
animation = "pulse",
|
|
1000
|
+
lines = 1,
|
|
1001
|
+
spacing = "none",
|
|
1002
|
+
className = "",
|
|
1003
|
+
children,
|
|
1004
|
+
...props
|
|
1005
|
+
}, ref) => {
|
|
1006
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
1007
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
1008
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
1009
|
+
const style = {
|
|
1010
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
1011
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
1012
|
+
};
|
|
1013
|
+
if (variant === "text" && lines > 1) {
|
|
1014
|
+
return /* @__PURE__ */ jsx8(
|
|
1015
|
+
"div",
|
|
1016
|
+
{
|
|
1017
|
+
ref,
|
|
1018
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
1019
|
+
...props,
|
|
1020
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx8(
|
|
1021
|
+
"div",
|
|
1022
|
+
{
|
|
1023
|
+
className: cn(variantClass, animationClass),
|
|
1024
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
1025
|
+
},
|
|
1026
|
+
index
|
|
1027
|
+
))
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
return /* @__PURE__ */ jsx8(
|
|
1032
|
+
"div",
|
|
1033
|
+
{
|
|
1034
|
+
ref,
|
|
1035
|
+
className: cn(variantClass, animationClass, className),
|
|
1036
|
+
style,
|
|
1037
|
+
...props,
|
|
1038
|
+
children
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
var SkeletonText = forwardRef5(
|
|
1044
|
+
(props, ref) => /* @__PURE__ */ jsx8(Skeleton, { ref, variant: "text", ...props })
|
|
1045
|
+
);
|
|
1046
|
+
var SkeletonCircle = forwardRef5((props, ref) => /* @__PURE__ */ jsx8(Skeleton, { ref, variant: "circular", ...props }));
|
|
1047
|
+
var SkeletonRectangle = forwardRef5((props, ref) => /* @__PURE__ */ jsx8(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
1048
|
+
var SkeletonRounded = forwardRef5((props, ref) => /* @__PURE__ */ jsx8(Skeleton, { ref, variant: "rounded", ...props }));
|
|
1049
|
+
var SkeletonCard = forwardRef5(
|
|
1050
|
+
({
|
|
1051
|
+
showAvatar = true,
|
|
1052
|
+
showTitle = true,
|
|
1053
|
+
showDescription = true,
|
|
1054
|
+
showActions = true,
|
|
1055
|
+
lines = 2,
|
|
1056
|
+
className = "",
|
|
1057
|
+
...props
|
|
1058
|
+
}, ref) => {
|
|
1059
|
+
return /* @__PURE__ */ jsxs7(
|
|
1060
|
+
"div",
|
|
1061
|
+
{
|
|
1062
|
+
ref,
|
|
1063
|
+
className: cn(
|
|
1064
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
1065
|
+
className
|
|
1066
|
+
),
|
|
1067
|
+
...props,
|
|
1068
|
+
children: [
|
|
1069
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-start space-x-3", children: [
|
|
1070
|
+
showAvatar && /* @__PURE__ */ jsx8(SkeletonCircle, { width: 40, height: 40 }),
|
|
1071
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex-1 space-y-2", children: [
|
|
1072
|
+
showTitle && /* @__PURE__ */ jsx8(SkeletonText, { width: "60%", height: 20 }),
|
|
1073
|
+
showDescription && /* @__PURE__ */ jsx8(SkeletonText, { lines, spacing: "small" })
|
|
1074
|
+
] })
|
|
1075
|
+
] }),
|
|
1076
|
+
showActions && /* @__PURE__ */ jsxs7("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
1077
|
+
/* @__PURE__ */ jsx8(SkeletonRectangle, { width: 80, height: 32 }),
|
|
1078
|
+
/* @__PURE__ */ jsx8(SkeletonRectangle, { width: 80, height: 32 })
|
|
1079
|
+
] })
|
|
1080
|
+
]
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
var SkeletonList = forwardRef5(
|
|
1086
|
+
({
|
|
1087
|
+
items = 3,
|
|
1088
|
+
showAvatar = true,
|
|
1089
|
+
showTitle = true,
|
|
1090
|
+
showDescription = true,
|
|
1091
|
+
lines = 1,
|
|
1092
|
+
className = "",
|
|
1093
|
+
...props
|
|
1094
|
+
}, ref) => {
|
|
1095
|
+
return /* @__PURE__ */ jsx8("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs7("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
1096
|
+
showAvatar && /* @__PURE__ */ jsx8(SkeletonCircle, { width: 32, height: 32 }),
|
|
1097
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex-1 space-y-2", children: [
|
|
1098
|
+
showTitle && /* @__PURE__ */ jsx8(SkeletonText, { width: "40%", height: 16 }),
|
|
1099
|
+
showDescription && /* @__PURE__ */ jsx8(SkeletonText, { lines, spacing: "small" })
|
|
1100
|
+
] })
|
|
1101
|
+
] }, index)) });
|
|
1102
|
+
}
|
|
1103
|
+
);
|
|
1104
|
+
var SkeletonTable = forwardRef5(
|
|
1105
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
1106
|
+
return /* @__PURE__ */ jsxs7("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
1107
|
+
showHeader && /* @__PURE__ */ jsx8("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ jsx8(
|
|
1108
|
+
SkeletonText,
|
|
1109
|
+
{
|
|
1110
|
+
width: `${100 / columns}%`,
|
|
1111
|
+
height: 20
|
|
1112
|
+
},
|
|
1113
|
+
index
|
|
1114
|
+
)) }),
|
|
1115
|
+
/* @__PURE__ */ jsx8("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx8("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ jsx8(
|
|
1116
|
+
SkeletonText,
|
|
1117
|
+
{
|
|
1118
|
+
width: `${100 / columns}%`,
|
|
1119
|
+
height: 16
|
|
1120
|
+
},
|
|
1121
|
+
colIndex
|
|
1122
|
+
)) }, rowIndex)) })
|
|
1123
|
+
] });
|
|
1124
|
+
}
|
|
1125
|
+
);
|
|
1126
|
+
|
|
1127
|
+
// src/components/Toast/Toast.tsx
|
|
1128
|
+
import { CheckCircle, WarningCircle as WarningCircle4, Info, X } from "phosphor-react";
|
|
1129
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1130
|
+
var VARIANT_ACTION_CLASSES3 = {
|
|
1131
|
+
solid: {
|
|
1132
|
+
warning: "bg-warning text-warning-600 border-none focus-visible:outline-none",
|
|
1133
|
+
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
1134
|
+
info: "bg-info text-info-600 border-none focus-visible:outline-none"
|
|
1135
|
+
},
|
|
1136
|
+
outlined: {
|
|
1137
|
+
warning: "bg-warning text-warning-600 border border-warning-300 focus-visible:outline-none",
|
|
1138
|
+
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
1139
|
+
info: "bg-info text-info-600 border border-info-600 focus-visible:outline-none"
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
var iconMap = {
|
|
1143
|
+
success: CheckCircle,
|
|
1144
|
+
info: Info,
|
|
1145
|
+
warning: WarningCircle4
|
|
1146
|
+
};
|
|
1147
|
+
var Toast = ({
|
|
1148
|
+
variant = "outlined",
|
|
1149
|
+
action = "success",
|
|
1150
|
+
className = "",
|
|
1151
|
+
onClose,
|
|
1152
|
+
title,
|
|
1153
|
+
description,
|
|
1154
|
+
position = "default",
|
|
1155
|
+
...props
|
|
1156
|
+
}) => {
|
|
1157
|
+
const variantClasses = VARIANT_ACTION_CLASSES3[variant][action];
|
|
1158
|
+
const positionClasses = {
|
|
1159
|
+
"top-left": "fixed top-4 left-4",
|
|
1160
|
+
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
1161
|
+
"top-right": "fixed top-4 right-4",
|
|
1162
|
+
"bottom-left": "fixed bottom-4 left-4",
|
|
1163
|
+
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
1164
|
+
"bottom-right": "fixed bottom-4 right-4",
|
|
1165
|
+
default: ""
|
|
1166
|
+
};
|
|
1167
|
+
const IconAction = iconMap[action] || iconMap["success"];
|
|
1168
|
+
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
1169
|
+
return /* @__PURE__ */ jsxs8(
|
|
1170
|
+
"div",
|
|
1171
|
+
{
|
|
1172
|
+
role: "alert",
|
|
1173
|
+
"aria-live": "assertive",
|
|
1174
|
+
"aria-atomic": "true",
|
|
1175
|
+
className: cn(
|
|
1176
|
+
baseClasses,
|
|
1177
|
+
positionClasses[position],
|
|
1178
|
+
variantClasses,
|
|
1179
|
+
className
|
|
1180
|
+
),
|
|
1181
|
+
...props,
|
|
1182
|
+
children: [
|
|
1183
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-row items-start gap-3", children: [
|
|
1184
|
+
/* @__PURE__ */ jsx9("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ jsx9(IconAction, {}) }),
|
|
1185
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col items-start justify-start", children: [
|
|
1186
|
+
/* @__PURE__ */ jsx9("p", { className: "font-semibold text-md", children: title }),
|
|
1187
|
+
description && /* @__PURE__ */ jsx9("p", { className: "text-md text-text-900", children: description })
|
|
1188
|
+
] })
|
|
1189
|
+
] }),
|
|
1190
|
+
/* @__PURE__ */ jsx9(
|
|
1191
|
+
"button",
|
|
1192
|
+
{
|
|
1193
|
+
onClick: onClose,
|
|
1194
|
+
"aria-label": "Dismiss notification",
|
|
1195
|
+
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1196
|
+
children: /* @__PURE__ */ jsx9(X, {})
|
|
1197
|
+
}
|
|
1198
|
+
)
|
|
1199
|
+
]
|
|
1200
|
+
}
|
|
1201
|
+
);
|
|
1202
|
+
};
|
|
1203
|
+
var Toast_default = Toast;
|
|
1204
|
+
|
|
1205
|
+
// src/components/Menu/Menu.tsx
|
|
1206
|
+
import { create as create2, useStore as useStore2 } from "zustand";
|
|
1207
|
+
import {
|
|
1208
|
+
useEffect as useEffect2,
|
|
1209
|
+
useRef as useRef2,
|
|
1210
|
+
forwardRef as forwardRef6,
|
|
1211
|
+
isValidElement as isValidElement2,
|
|
1212
|
+
Children as Children2,
|
|
1213
|
+
cloneElement as cloneElement2,
|
|
1214
|
+
useState as useState3
|
|
1215
|
+
} from "react";
|
|
1216
|
+
import { CaretLeft, CaretRight } from "phosphor-react";
|
|
1217
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1218
|
+
var createMenuStore = (onValueChange) => create2((set) => ({
|
|
1219
|
+
value: "",
|
|
1220
|
+
setValue: (value) => {
|
|
1221
|
+
set({ value });
|
|
1222
|
+
onValueChange?.(value);
|
|
1223
|
+
},
|
|
1224
|
+
onValueChange
|
|
1225
|
+
}));
|
|
1226
|
+
var useMenuStore = (externalStore) => {
|
|
1227
|
+
if (!externalStore) throw new Error("MenuItem must be inside Menu");
|
|
1228
|
+
return externalStore;
|
|
1229
|
+
};
|
|
1230
|
+
var VARIANT_CLASSES3 = {
|
|
1231
|
+
menu: "bg-background shadow-soft-shadow-1 px-6",
|
|
1232
|
+
menu2: "",
|
|
1233
|
+
"menu-overflow": "",
|
|
1234
|
+
breadcrumb: "bg-transparent shadow-none !px-0"
|
|
1235
|
+
};
|
|
1236
|
+
var Menu = forwardRef6(
|
|
1237
|
+
({
|
|
1238
|
+
className,
|
|
1239
|
+
children,
|
|
1240
|
+
defaultValue,
|
|
1241
|
+
value: propValue,
|
|
1242
|
+
variant = "menu",
|
|
1243
|
+
onValueChange,
|
|
1244
|
+
...props
|
|
1245
|
+
}, ref) => {
|
|
1246
|
+
const storeRef = useRef2(null);
|
|
1247
|
+
storeRef.current ??= createMenuStore(onValueChange);
|
|
1248
|
+
const store = storeRef.current;
|
|
1249
|
+
const { setValue } = useStore2(store, (s) => s);
|
|
1250
|
+
useEffect2(() => {
|
|
1251
|
+
setValue(propValue ?? defaultValue);
|
|
1252
|
+
}, [defaultValue, propValue, setValue]);
|
|
1253
|
+
const baseClasses = variant === "menu-overflow" ? "w-fit py-2 flex flex-row items-center justify-center" : "w-full py-2 flex flex-row items-center justify-center";
|
|
1254
|
+
const variantClasses = VARIANT_CLASSES3[variant];
|
|
1255
|
+
return /* @__PURE__ */ jsx10(
|
|
1256
|
+
"div",
|
|
1257
|
+
{
|
|
1258
|
+
ref,
|
|
1259
|
+
className: `
|
|
1260
|
+
${baseClasses}
|
|
1261
|
+
${variantClasses}
|
|
1262
|
+
${className ?? ""}
|
|
1263
|
+
`,
|
|
1264
|
+
...props,
|
|
1265
|
+
children: injectStore2(children, store)
|
|
1266
|
+
}
|
|
1267
|
+
);
|
|
1268
|
+
}
|
|
1269
|
+
);
|
|
1270
|
+
Menu.displayName = "Menu";
|
|
1271
|
+
var MenuContent = forwardRef6(
|
|
1272
|
+
({ className, children, variant = "menu", ...props }, ref) => {
|
|
1273
|
+
const baseClasses = "w-full flex flex-row items-center gap-2";
|
|
1274
|
+
const variantClasses = variant === "menu2" || variant === "menu-overflow" ? "overflow-x-auto scroll-smooth" : "";
|
|
1275
|
+
return /* @__PURE__ */ jsx10(
|
|
1276
|
+
"ul",
|
|
1277
|
+
{
|
|
1278
|
+
ref,
|
|
1279
|
+
className: `
|
|
1280
|
+
${baseClasses}
|
|
1281
|
+
${variantClasses}
|
|
1282
|
+
${variant == "breadcrumb" ? "flex-wrap" : ""}
|
|
1283
|
+
${className ?? ""}
|
|
1284
|
+
`,
|
|
1285
|
+
style: variant === "menu2" || variant === "menu-overflow" ? { scrollbarWidth: "none", msOverflowStyle: "none" } : void 0,
|
|
1286
|
+
...props,
|
|
1287
|
+
children
|
|
1288
|
+
}
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
);
|
|
1292
|
+
MenuContent.displayName = "MenuContent";
|
|
1293
|
+
var MenuItem = forwardRef6(
|
|
1294
|
+
({
|
|
1295
|
+
className,
|
|
1296
|
+
children,
|
|
1297
|
+
value,
|
|
1298
|
+
disabled = false,
|
|
1299
|
+
store: externalStore,
|
|
1300
|
+
variant = "menu",
|
|
1301
|
+
separator = false,
|
|
1302
|
+
...props
|
|
1303
|
+
}, ref) => {
|
|
1304
|
+
const store = useMenuStore(externalStore);
|
|
1305
|
+
const { value: selectedValue, setValue } = useStore2(store, (s) => s);
|
|
1306
|
+
const handleClick = (e) => {
|
|
1307
|
+
if (!disabled) {
|
|
1308
|
+
setValue(value);
|
|
1309
|
+
}
|
|
1310
|
+
props.onClick?.(e);
|
|
1311
|
+
};
|
|
1312
|
+
const commonProps = {
|
|
1313
|
+
role: "menuitem",
|
|
1314
|
+
"aria-disabled": disabled,
|
|
1315
|
+
ref,
|
|
1316
|
+
onClick: handleClick,
|
|
1317
|
+
onKeyDown: (e) => {
|
|
1318
|
+
if (["Enter", " "].includes(e.key)) handleClick(e);
|
|
1319
|
+
},
|
|
1320
|
+
tabIndex: disabled ? -1 : 0,
|
|
1321
|
+
onMouseDown: (e) => {
|
|
1322
|
+
e.preventDefault();
|
|
1323
|
+
},
|
|
1324
|
+
...props
|
|
1325
|
+
};
|
|
1326
|
+
const variants = {
|
|
1327
|
+
menu: /* @__PURE__ */ jsx10(
|
|
1328
|
+
"li",
|
|
1329
|
+
{
|
|
1330
|
+
"data-variant": "menu",
|
|
1331
|
+
className: `
|
|
1332
|
+
w-full flex flex-col items-center justify-center gap-0.5 py-1 px-2 rounded-sm font-medium text-xs
|
|
1333
|
+
[&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text
|
|
1334
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
1335
|
+
${selectedValue === value ? "bg-primary-50 text-primary-950" : "text-text-950"}
|
|
1336
|
+
${className ?? ""}
|
|
1337
|
+
`,
|
|
1338
|
+
...commonProps,
|
|
1339
|
+
children
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
menu2: /* @__PURE__ */ jsxs9(
|
|
1343
|
+
"li",
|
|
1344
|
+
{
|
|
1345
|
+
"data-variant": "menu2",
|
|
1346
|
+
className: `
|
|
1347
|
+
w-full flex flex-col items-center px-2 pt-4 gap-3 cursor-pointer focus:rounded-sm justify-center hover:bg-background-100 rounded-lg
|
|
1348
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
1349
|
+
${selectedValue === value ? "" : "pb-4"}
|
|
1350
|
+
`,
|
|
1351
|
+
...commonProps,
|
|
1352
|
+
children: [
|
|
1353
|
+
/* @__PURE__ */ jsx10(
|
|
1354
|
+
"span",
|
|
1355
|
+
{
|
|
1356
|
+
className: cn(
|
|
1357
|
+
"flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold",
|
|
1358
|
+
className
|
|
1359
|
+
),
|
|
1360
|
+
children
|
|
1361
|
+
}
|
|
1362
|
+
),
|
|
1363
|
+
selectedValue === value && /* @__PURE__ */ jsx10("div", { className: "h-1 w-full bg-primary-950 rounded-lg" })
|
|
1364
|
+
]
|
|
1365
|
+
}
|
|
1366
|
+
),
|
|
1367
|
+
"menu-overflow": /* @__PURE__ */ jsxs9(
|
|
1368
|
+
"li",
|
|
1369
|
+
{
|
|
1370
|
+
"data-variant": "menu-overflow",
|
|
1371
|
+
className: `
|
|
1372
|
+
w-fit flex flex-col items-center px-2 pt-4 gap-3 cursor-pointer focus:rounded-sm justify-center hover:bg-background-100 rounded-lg
|
|
1373
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
1374
|
+
${selectedValue === value ? "" : "pb-4"}
|
|
1375
|
+
`,
|
|
1376
|
+
...commonProps,
|
|
1377
|
+
children: [
|
|
1378
|
+
/* @__PURE__ */ jsx10(
|
|
1379
|
+
"span",
|
|
1380
|
+
{
|
|
1381
|
+
className: cn(
|
|
1382
|
+
"flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold",
|
|
1383
|
+
className
|
|
1384
|
+
),
|
|
1385
|
+
children
|
|
1386
|
+
}
|
|
1387
|
+
),
|
|
1388
|
+
selectedValue === value && /* @__PURE__ */ jsx10("div", { className: "h-1 w-full bg-primary-950 rounded-lg" })
|
|
1389
|
+
]
|
|
1390
|
+
}
|
|
1391
|
+
),
|
|
1392
|
+
breadcrumb: /* @__PURE__ */ jsxs9(
|
|
1393
|
+
"li",
|
|
1394
|
+
{
|
|
1395
|
+
"data-variant": "breadcrumb",
|
|
1396
|
+
className: `
|
|
1397
|
+
flex flex-row gap-2 items-center w-fit p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs
|
|
1398
|
+
focus:outline-none focus:border-indicator-info focus:border-2
|
|
1399
|
+
${selectedValue === value ? "text-text-950" : "text-text-600"}
|
|
1400
|
+
${className ?? ""}
|
|
1401
|
+
`,
|
|
1402
|
+
...commonProps,
|
|
1403
|
+
children: [
|
|
1404
|
+
/* @__PURE__ */ jsx10(
|
|
1405
|
+
"span",
|
|
1406
|
+
{
|
|
1407
|
+
className: cn(
|
|
1408
|
+
"border-b border-text-600 hover:border-primary-600 text-inherit text-xs",
|
|
1409
|
+
selectedValue === value ? "border-b-0 font-bold" : "border-b-text-600"
|
|
1410
|
+
),
|
|
1411
|
+
children
|
|
1412
|
+
}
|
|
1413
|
+
),
|
|
1414
|
+
separator && /* @__PURE__ */ jsx10(
|
|
1415
|
+
CaretRight,
|
|
1416
|
+
{
|
|
1417
|
+
size: 16,
|
|
1418
|
+
className: "text-text-600",
|
|
1419
|
+
"data-testid": "separator"
|
|
1420
|
+
}
|
|
1421
|
+
)
|
|
1422
|
+
]
|
|
1423
|
+
}
|
|
1424
|
+
)
|
|
1425
|
+
};
|
|
1426
|
+
return variants[variant] ?? variants["menu"];
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
MenuItem.displayName = "MenuItem";
|
|
1430
|
+
var injectStore2 = (children, store) => Children2.map(children, (child) => {
|
|
1431
|
+
if (!isValidElement2(child)) return child;
|
|
1432
|
+
const typedChild = child;
|
|
1433
|
+
const shouldInject = typedChild.type === MenuItem;
|
|
1434
|
+
return cloneElement2(typedChild, {
|
|
1435
|
+
...shouldInject ? { store } : {},
|
|
1436
|
+
...typedChild.props.children ? { children: injectStore2(typedChild.props.children, store) } : {}
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
var Menu_default = Menu;
|
|
1440
|
+
|
|
1441
|
+
// src/components/Support/schema/index.ts
|
|
1442
|
+
import { z } from "zod";
|
|
1443
|
+
var supportSchema = z.object({
|
|
1444
|
+
// Tipo de problema selecionado
|
|
1445
|
+
problemType: z.enum(["tecnico", "acesso", "outros"], {
|
|
1446
|
+
// istanbul ignore next - errorMap é testado em runtime pelo zod real
|
|
1447
|
+
errorMap: (
|
|
1448
|
+
/* istanbul ignore next */
|
|
1449
|
+
() => ({
|
|
1450
|
+
message: "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar."
|
|
1451
|
+
})
|
|
1452
|
+
)
|
|
1453
|
+
}),
|
|
1454
|
+
// Título do problema
|
|
1455
|
+
title: z.string().min(1, "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.").min(5, "T\xEDtulo deve ter pelo menos 5 caracteres").max(100, "T\xEDtulo deve ter no m\xE1ximo 100 caracteres").trim(),
|
|
1456
|
+
// Descrição do problema
|
|
1457
|
+
description: z.string().min(1, "Campo obrigat\xF3rio! Por favor, preencha este campo para continuar.").min(10, "Descri\xE7\xE3o deve ter pelo menos 10 caracteres").max(1e3, "Descri\xE7\xE3o deve ter no m\xE1ximo 1000 caracteres").trim()
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
// src/components/Support/components/TicketModal.tsx
|
|
1461
|
+
import { useState as useState4, useEffect as useEffect4, useCallback } from "react";
|
|
1462
|
+
import dayjs from "dayjs";
|
|
1463
|
+
import "dayjs/locale/pt-br";
|
|
1464
|
+
|
|
1465
|
+
// src/components/Divider/Divider.tsx
|
|
1466
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1467
|
+
var Divider = ({
|
|
1468
|
+
orientation = "horizontal",
|
|
1469
|
+
className = "",
|
|
1470
|
+
...props
|
|
1471
|
+
}) => {
|
|
1472
|
+
const baseClasses = "bg-border-200 border-0";
|
|
1473
|
+
const orientationClasses = {
|
|
1474
|
+
horizontal: "w-full h-px",
|
|
1475
|
+
vertical: "h-full w-px"
|
|
1476
|
+
};
|
|
1477
|
+
return /* @__PURE__ */ jsx11(
|
|
1478
|
+
"hr",
|
|
1479
|
+
{
|
|
1480
|
+
className: cn(baseClasses, orientationClasses[orientation], className),
|
|
1481
|
+
"aria-orientation": orientation,
|
|
1482
|
+
...props
|
|
1483
|
+
}
|
|
1484
|
+
);
|
|
1485
|
+
};
|
|
1486
|
+
var Divider_default = Divider;
|
|
1487
|
+
|
|
1488
|
+
// src/components/Modal/Modal.tsx
|
|
1489
|
+
import { useEffect as useEffect3, useId as useId4 } from "react";
|
|
1490
|
+
import { X as X2 } from "phosphor-react";
|
|
1491
|
+
|
|
1492
|
+
// src/components/Modal/utils/videoUtils.ts
|
|
1493
|
+
var isYouTubeUrl = (url) => {
|
|
1494
|
+
const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
|
|
1495
|
+
return youtubeRegex.test(url);
|
|
1496
|
+
};
|
|
1497
|
+
var isValidYouTubeHost = (host) => {
|
|
1498
|
+
if (host === "youtu.be") return "youtu.be";
|
|
1499
|
+
const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
|
|
1500
|
+
if (isValidYouTubeCom) return "youtube";
|
|
1501
|
+
const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
|
|
1502
|
+
if (isValidNoCookie) return "nocookie";
|
|
1503
|
+
return null;
|
|
1504
|
+
};
|
|
1505
|
+
var extractYoutuBeId = (pathname) => {
|
|
1506
|
+
const firstSeg = pathname.split("/").filter(Boolean)[0];
|
|
1507
|
+
return firstSeg || null;
|
|
1508
|
+
};
|
|
1509
|
+
var extractYouTubeId = (pathname, searchParams) => {
|
|
1510
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
1511
|
+
const [first, second] = parts;
|
|
1512
|
+
if (first === "embed" && second) return second;
|
|
1513
|
+
if (first === "shorts" && second) return second;
|
|
1514
|
+
if (first === "live" && second) return second;
|
|
1515
|
+
const v = searchParams.get("v");
|
|
1516
|
+
if (v) return v;
|
|
1517
|
+
return null;
|
|
1518
|
+
};
|
|
1519
|
+
var getYouTubeVideoId = (url) => {
|
|
1520
|
+
try {
|
|
1521
|
+
const u = new URL(url);
|
|
1522
|
+
const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
|
|
1523
|
+
if (!hostType) return null;
|
|
1524
|
+
if (hostType === "youtu.be") {
|
|
1525
|
+
return extractYoutuBeId(u.pathname);
|
|
1526
|
+
}
|
|
1527
|
+
return extractYouTubeId(u.pathname, u.searchParams);
|
|
1528
|
+
} catch {
|
|
1529
|
+
return null;
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
var getYouTubeEmbedUrl = (videoId) => {
|
|
1533
|
+
return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
// src/components/Modal/Modal.tsx
|
|
1537
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1538
|
+
var SIZE_CLASSES6 = {
|
|
1539
|
+
xs: "max-w-[360px]",
|
|
1540
|
+
sm: "max-w-[420px]",
|
|
1541
|
+
md: "max-w-[510px]",
|
|
1542
|
+
lg: "max-w-[640px]",
|
|
1543
|
+
xl: "max-w-[970px]"
|
|
1544
|
+
};
|
|
1545
|
+
var Modal = ({
|
|
1546
|
+
isOpen,
|
|
1547
|
+
onClose,
|
|
1548
|
+
title,
|
|
1549
|
+
children,
|
|
1550
|
+
size = "md",
|
|
1551
|
+
className = "",
|
|
1552
|
+
closeOnEscape = true,
|
|
1553
|
+
footer,
|
|
1554
|
+
hideCloseButton = false,
|
|
1555
|
+
variant = "default",
|
|
1556
|
+
description,
|
|
1557
|
+
image,
|
|
1558
|
+
imageAlt,
|
|
1559
|
+
actionLink,
|
|
1560
|
+
actionLabel,
|
|
1561
|
+
contentClassName = ""
|
|
1562
|
+
}) => {
|
|
1563
|
+
const titleId = useId4();
|
|
1564
|
+
useEffect3(() => {
|
|
1565
|
+
if (!isOpen || !closeOnEscape) return;
|
|
1566
|
+
const handleEscape = (event) => {
|
|
1567
|
+
if (event.key === "Escape") {
|
|
1568
|
+
onClose();
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
document.addEventListener("keydown", handleEscape);
|
|
1572
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
1573
|
+
}, [isOpen, closeOnEscape, onClose]);
|
|
1574
|
+
useEffect3(() => {
|
|
1575
|
+
if (!isOpen) return;
|
|
1576
|
+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
1577
|
+
const originalOverflow = document.body.style.overflow;
|
|
1578
|
+
const originalPaddingRight = document.body.style.paddingRight;
|
|
1579
|
+
document.body.style.overflow = "hidden";
|
|
1580
|
+
if (scrollbarWidth > 0) {
|
|
1581
|
+
document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
1582
|
+
const overlay = document.createElement("div");
|
|
1583
|
+
overlay.id = "modal-scrollbar-overlay";
|
|
1584
|
+
overlay.style.cssText = `
|
|
1585
|
+
position: fixed;
|
|
1586
|
+
top: 0;
|
|
1587
|
+
right: 0;
|
|
1588
|
+
width: ${scrollbarWidth}px;
|
|
1589
|
+
height: 100vh;
|
|
1590
|
+
background-color: rgb(0 0 0 / 0.6);
|
|
1591
|
+
z-index: 40;
|
|
1592
|
+
pointer-events: none;
|
|
1593
|
+
`;
|
|
1594
|
+
document.body.appendChild(overlay);
|
|
1595
|
+
}
|
|
1596
|
+
return () => {
|
|
1597
|
+
document.body.style.overflow = originalOverflow;
|
|
1598
|
+
document.body.style.paddingRight = originalPaddingRight;
|
|
1599
|
+
const overlay = document.getElementById("modal-scrollbar-overlay");
|
|
1600
|
+
if (overlay) {
|
|
1601
|
+
overlay.remove();
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
}, [isOpen]);
|
|
1605
|
+
if (!isOpen) return null;
|
|
1606
|
+
const sizeClasses = SIZE_CLASSES6[size];
|
|
1607
|
+
const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
|
|
1608
|
+
const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
|
|
1609
|
+
const modalClasses = cn(
|
|
1610
|
+
baseClasses,
|
|
1611
|
+
sizeClasses,
|
|
1612
|
+
dialogResetClasses,
|
|
1613
|
+
className
|
|
1614
|
+
);
|
|
1615
|
+
const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
|
|
1616
|
+
const handleActionClick = () => {
|
|
1617
|
+
if (actionLink) {
|
|
1618
|
+
window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
if (variant === "activity") {
|
|
1622
|
+
return /* @__PURE__ */ jsx12("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__ */ jsxs10(
|
|
1623
|
+
"dialog",
|
|
1624
|
+
{
|
|
1625
|
+
className: modalClasses,
|
|
1626
|
+
"aria-labelledby": titleId,
|
|
1627
|
+
"aria-modal": "true",
|
|
1628
|
+
open: true,
|
|
1629
|
+
children: [
|
|
1630
|
+
/* @__PURE__ */ jsx12("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ jsx12(
|
|
1631
|
+
"button",
|
|
1632
|
+
{
|
|
1633
|
+
onClick: onClose,
|
|
1634
|
+
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",
|
|
1635
|
+
"aria-label": "Fechar modal",
|
|
1636
|
+
children: /* @__PURE__ */ jsx12(X2, { size: 18 })
|
|
1637
|
+
}
|
|
1638
|
+
) }),
|
|
1639
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
|
|
1640
|
+
image && /* @__PURE__ */ jsx12("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx12(
|
|
1641
|
+
"img",
|
|
1642
|
+
{
|
|
1643
|
+
src: image,
|
|
1644
|
+
alt: imageAlt ?? "",
|
|
1645
|
+
className: "w-[122px] h-[122px] object-contain"
|
|
1646
|
+
}
|
|
1647
|
+
) }),
|
|
1648
|
+
/* @__PURE__ */ jsx12(
|
|
1649
|
+
"h2",
|
|
1650
|
+
{
|
|
1651
|
+
id: titleId,
|
|
1652
|
+
className: "text-lg font-semibold text-text-950 text-center",
|
|
1653
|
+
children: title
|
|
1654
|
+
}
|
|
1655
|
+
),
|
|
1656
|
+
description && /* @__PURE__ */ jsx12("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
|
|
1657
|
+
actionLink && /* @__PURE__ */ jsxs10("div", { className: "w-full", children: [
|
|
1658
|
+
(() => {
|
|
1659
|
+
const normalized = normalizeUrl(actionLink);
|
|
1660
|
+
const isYT = isYouTubeUrl(normalized);
|
|
1661
|
+
if (!isYT) return null;
|
|
1662
|
+
const id = getYouTubeVideoId(normalized);
|
|
1663
|
+
if (!id) {
|
|
1664
|
+
return /* @__PURE__ */ jsx12(
|
|
1665
|
+
Button_default,
|
|
1666
|
+
{
|
|
1667
|
+
variant: "solid",
|
|
1668
|
+
action: "primary",
|
|
1669
|
+
size: "large",
|
|
1670
|
+
className: "w-full",
|
|
1671
|
+
onClick: handleActionClick,
|
|
1672
|
+
children: actionLabel || "Iniciar Atividade"
|
|
1673
|
+
}
|
|
1674
|
+
);
|
|
1675
|
+
}
|
|
1676
|
+
return /* @__PURE__ */ jsx12(
|
|
1677
|
+
"iframe",
|
|
1678
|
+
{
|
|
1679
|
+
src: getYouTubeEmbedUrl(id),
|
|
1680
|
+
className: "w-full aspect-video rounded-lg",
|
|
1681
|
+
allowFullScreen: true,
|
|
1682
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
1683
|
+
title: "V\xEDdeo YouTube"
|
|
1684
|
+
}
|
|
1685
|
+
);
|
|
1686
|
+
})(),
|
|
1687
|
+
!isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ jsx12(
|
|
1688
|
+
Button_default,
|
|
1689
|
+
{
|
|
1690
|
+
variant: "solid",
|
|
1691
|
+
action: "primary",
|
|
1692
|
+
size: "large",
|
|
1693
|
+
className: "w-full",
|
|
1694
|
+
onClick: handleActionClick,
|
|
1695
|
+
children: actionLabel || "Iniciar Atividade"
|
|
1696
|
+
}
|
|
1697
|
+
)
|
|
1698
|
+
] })
|
|
1699
|
+
] })
|
|
1700
|
+
]
|
|
1701
|
+
}
|
|
1702
|
+
) });
|
|
1703
|
+
}
|
|
1704
|
+
return /* @__PURE__ */ jsx12("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__ */ jsxs10(
|
|
1705
|
+
"dialog",
|
|
1706
|
+
{
|
|
1707
|
+
className: modalClasses,
|
|
1708
|
+
"aria-labelledby": titleId,
|
|
1709
|
+
"aria-modal": "true",
|
|
1710
|
+
open: true,
|
|
1711
|
+
children: [
|
|
1712
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between px-6 py-6", children: [
|
|
1713
|
+
/* @__PURE__ */ jsx12("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
|
|
1714
|
+
!hideCloseButton && /* @__PURE__ */ jsx12(
|
|
1715
|
+
"button",
|
|
1716
|
+
{
|
|
1717
|
+
onClick: onClose,
|
|
1718
|
+
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",
|
|
1719
|
+
"aria-label": "Fechar modal",
|
|
1720
|
+
children: /* @__PURE__ */ jsx12(X2, { size: 18 })
|
|
1721
|
+
}
|
|
1722
|
+
)
|
|
1723
|
+
] }),
|
|
1724
|
+
children && /* @__PURE__ */ jsx12("div", { className: cn("px-6 pb-6", contentClassName), children: /* @__PURE__ */ jsx12("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
|
|
1725
|
+
footer && /* @__PURE__ */ jsx12("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
|
|
1726
|
+
]
|
|
1727
|
+
}
|
|
1728
|
+
) });
|
|
1729
|
+
};
|
|
1730
|
+
var Modal_default = Modal;
|
|
1731
|
+
|
|
1732
|
+
// src/types/support.ts
|
|
1733
|
+
var getStatusBadgeAction = (status) => {
|
|
1734
|
+
switch (status) {
|
|
1735
|
+
case "aberto" /* ABERTO */:
|
|
1736
|
+
return "success";
|
|
1737
|
+
case "respondido" /* RESPONDIDO */:
|
|
1738
|
+
return "warning";
|
|
1739
|
+
case "encerrado" /* ENCERRADO */:
|
|
1740
|
+
return "info";
|
|
1741
|
+
default:
|
|
1742
|
+
return "info";
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
var getStatusText = (status) => {
|
|
1746
|
+
switch (status) {
|
|
1747
|
+
case "aberto" /* ABERTO */:
|
|
1748
|
+
return "Aberto";
|
|
1749
|
+
case "respondido" /* RESPONDIDO */:
|
|
1750
|
+
return "Respondido";
|
|
1751
|
+
case "encerrado" /* ENCERRADO */:
|
|
1752
|
+
return "Encerrado";
|
|
1753
|
+
default:
|
|
1754
|
+
return status;
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
var getCategoryText = (category) => {
|
|
1758
|
+
if (!category) return "";
|
|
1759
|
+
switch (category) {
|
|
1760
|
+
case "acesso" /* ACESSO */:
|
|
1761
|
+
return "Acesso";
|
|
1762
|
+
case "tecnico" /* TECNICO */:
|
|
1763
|
+
return "T\xE9cnico";
|
|
1764
|
+
case "outros" /* OUTROS */:
|
|
1765
|
+
return "Outros";
|
|
1766
|
+
default:
|
|
1767
|
+
return category;
|
|
1768
|
+
}
|
|
1769
|
+
};
|
|
1770
|
+
var mapApiStatusToInternal = (apiStatus) => {
|
|
1771
|
+
switch (apiStatus) {
|
|
1772
|
+
case "ABERTO":
|
|
1773
|
+
return "aberto" /* ABERTO */;
|
|
1774
|
+
case "PENDENTE":
|
|
1775
|
+
return "respondido" /* RESPONDIDO */;
|
|
1776
|
+
case "FECHADO":
|
|
1777
|
+
return "encerrado" /* ENCERRADO */;
|
|
1778
|
+
default:
|
|
1779
|
+
return "aberto" /* ABERTO */;
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
var mapInternalStatusToApi = (internalStatus) => {
|
|
1783
|
+
switch (internalStatus) {
|
|
1784
|
+
case "aberto" /* ABERTO */:
|
|
1785
|
+
return "ABERTO";
|
|
1786
|
+
case "respondido" /* RESPONDIDO */:
|
|
1787
|
+
return "PENDENTE";
|
|
1788
|
+
case "encerrado" /* ENCERRADO */:
|
|
1789
|
+
return "FECHADO";
|
|
1790
|
+
default:
|
|
1791
|
+
return "ABERTO";
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
|
|
1795
|
+
// src/components/Support/utils/supportUtils.tsx
|
|
1796
|
+
import { KeyIcon, BugIcon, InfoIcon } from "@phosphor-icons/react";
|
|
1797
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1798
|
+
var getCategoryIcon = (category, size = 16) => {
|
|
1799
|
+
if (!category) return null;
|
|
1800
|
+
switch (category) {
|
|
1801
|
+
case "acesso" /* ACESSO */:
|
|
1802
|
+
return /* @__PURE__ */ jsx13(KeyIcon, { size });
|
|
1803
|
+
case "tecnico" /* TECNICO */:
|
|
1804
|
+
return /* @__PURE__ */ jsx13(BugIcon, { size });
|
|
1805
|
+
case "outros" /* OUTROS */:
|
|
1806
|
+
return /* @__PURE__ */ jsx13(InfoIcon, { size });
|
|
1807
|
+
default:
|
|
1808
|
+
return /* @__PURE__ */ jsx13(InfoIcon, { size });
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
// src/components/Support/components/TicketModal.tsx
|
|
1813
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1814
|
+
dayjs.locale("pt-br");
|
|
1815
|
+
var AnswerSkeleton = () => /* @__PURE__ */ jsxs11("div", { className: "bg-background p-4 space-y-6 rounded-xl", children: [
|
|
1816
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
1817
|
+
/* @__PURE__ */ jsx14(SkeletonText, { width: "80px", height: 16 }),
|
|
1818
|
+
/* @__PURE__ */ jsx14(SkeletonText, { width: "200px", height: 16 })
|
|
1819
|
+
] }),
|
|
1820
|
+
/* @__PURE__ */ jsx14(Divider_default, {}),
|
|
1821
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start space-x-6", children: [
|
|
1822
|
+
/* @__PURE__ */ jsx14(SkeletonText, { width: "80px", height: 16 }),
|
|
1823
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 space-y-2", children: [
|
|
1824
|
+
/* @__PURE__ */ jsx14(SkeletonText, { width: "100%", height: 16 }),
|
|
1825
|
+
/* @__PURE__ */ jsx14(SkeletonText, { width: "80%", height: 16 }),
|
|
1826
|
+
/* @__PURE__ */ jsx14(SkeletonText, { width: "60%", height: 16 })
|
|
1827
|
+
] })
|
|
1828
|
+
] })
|
|
1829
|
+
] });
|
|
1830
|
+
var TicketModal = ({
|
|
1831
|
+
ticket,
|
|
1832
|
+
isOpen,
|
|
1833
|
+
onClose,
|
|
1834
|
+
onTicketClose,
|
|
1835
|
+
apiClient,
|
|
1836
|
+
userId
|
|
1837
|
+
}) => {
|
|
1838
|
+
const [showCloseConfirmation, setShowCloseConfirmation] = useState4(false);
|
|
1839
|
+
const [responseText, setResponseText] = useState4("");
|
|
1840
|
+
const [answers, setAnswers] = useState4([]);
|
|
1841
|
+
const [isSubmittingAnswer, setIsSubmittingAnswer] = useState4(false);
|
|
1842
|
+
const [isLoadingAnswers, setIsLoadingAnswers] = useState4(false);
|
|
1843
|
+
const handleCloseTicket = () => {
|
|
1844
|
+
onTicketClose?.(ticket.id);
|
|
1845
|
+
setShowCloseConfirmation(false);
|
|
1846
|
+
onClose();
|
|
1847
|
+
};
|
|
1848
|
+
const fetchAnswers = useCallback(async () => {
|
|
1849
|
+
if (!ticket.id || ticket.status !== "respondido" /* RESPONDIDO */) return;
|
|
1850
|
+
setIsLoadingAnswers(true);
|
|
1851
|
+
try {
|
|
1852
|
+
const response = await apiClient.get(
|
|
1853
|
+
`/support/answer/${ticket.id}`
|
|
1854
|
+
);
|
|
1855
|
+
setAnswers(response.data.data || []);
|
|
1856
|
+
} catch (error) {
|
|
1857
|
+
console.error("Erro ao buscar respostas:", error);
|
|
1858
|
+
setAnswers([]);
|
|
1859
|
+
} finally {
|
|
1860
|
+
setIsLoadingAnswers(false);
|
|
1861
|
+
}
|
|
1862
|
+
}, [ticket.id, ticket.status, apiClient]);
|
|
1863
|
+
const handleSubmitAnswer = async () => {
|
|
1864
|
+
if (!responseText.trim() || !userId || !ticket.id) {
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
setIsSubmittingAnswer(true);
|
|
1868
|
+
try {
|
|
1869
|
+
const requestData = {
|
|
1870
|
+
userId,
|
|
1871
|
+
supportId: ticket.id,
|
|
1872
|
+
answer: responseText.trim()
|
|
1873
|
+
};
|
|
1874
|
+
await apiClient.post(
|
|
1875
|
+
"/support/answer",
|
|
1876
|
+
requestData
|
|
1877
|
+
);
|
|
1878
|
+
setResponseText("");
|
|
1879
|
+
await fetchAnswers();
|
|
1880
|
+
} catch (error) {
|
|
1881
|
+
console.error("Erro ao enviar resposta:", error);
|
|
1882
|
+
} finally {
|
|
1883
|
+
setIsSubmittingAnswer(false);
|
|
1884
|
+
}
|
|
1885
|
+
};
|
|
1886
|
+
const canCloseTicket = ticket.status !== "encerrado" /* ENCERRADO */;
|
|
1887
|
+
useEffect4(() => {
|
|
1888
|
+
if (isOpen) {
|
|
1889
|
+
setResponseText("");
|
|
1890
|
+
(async () => {
|
|
1891
|
+
await fetchAnswers();
|
|
1892
|
+
})().catch((error) => {
|
|
1893
|
+
console.error("Erro ao carregar respostas:", error);
|
|
1894
|
+
});
|
|
1895
|
+
} else {
|
|
1896
|
+
setAnswers([]);
|
|
1897
|
+
}
|
|
1898
|
+
}, [isOpen, fetchAnswers]);
|
|
1899
|
+
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1900
|
+
/* @__PURE__ */ jsx14(
|
|
1901
|
+
Modal_default,
|
|
1902
|
+
{
|
|
1903
|
+
isOpen,
|
|
1904
|
+
onClose,
|
|
1905
|
+
title: `Pedido: ${ticket.title}`,
|
|
1906
|
+
size: "lg",
|
|
1907
|
+
hideCloseButton: false,
|
|
1908
|
+
closeOnEscape: true,
|
|
1909
|
+
"data-testid": "ticket-modal",
|
|
1910
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col h-full max-h-[80vh]", children: [
|
|
1911
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between items-center mb-3", children: [
|
|
1912
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "bold", className: "text-text-950", children: "Detalhes" }),
|
|
1913
|
+
canCloseTicket && /* @__PURE__ */ jsx14(
|
|
1914
|
+
Button_default,
|
|
1915
|
+
{
|
|
1916
|
+
variant: "outline",
|
|
1917
|
+
size: "small",
|
|
1918
|
+
action: "negative",
|
|
1919
|
+
onClick: () => setShowCloseConfirmation(true),
|
|
1920
|
+
children: "Encerrar Pedido"
|
|
1921
|
+
}
|
|
1922
|
+
)
|
|
1923
|
+
] }),
|
|
1924
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 overflow-y-auto pr-2 space-y-6", children: [
|
|
1925
|
+
/* @__PURE__ */ jsxs11("div", { className: "bg-background p-4 space-y-6 rounded-xl", children: [
|
|
1926
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
1927
|
+
/* @__PURE__ */ jsx14(
|
|
1928
|
+
Text_default,
|
|
1929
|
+
{
|
|
1930
|
+
size: "md",
|
|
1931
|
+
weight: "semibold",
|
|
1932
|
+
className: "text-text-700 w-20",
|
|
1933
|
+
children: "ID"
|
|
1934
|
+
}
|
|
1935
|
+
),
|
|
1936
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "normal", className: "text-text-600", children: ticket.id })
|
|
1937
|
+
] }),
|
|
1938
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
1939
|
+
/* @__PURE__ */ jsx14(
|
|
1940
|
+
Text_default,
|
|
1941
|
+
{
|
|
1942
|
+
size: "md",
|
|
1943
|
+
weight: "semibold",
|
|
1944
|
+
className: "text-text-700 w-20",
|
|
1945
|
+
children: "Aberto em"
|
|
1946
|
+
}
|
|
1947
|
+
),
|
|
1948
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "normal", className: "text-text-600", children: dayjs(ticket.createdAt).format("DD MMMM YYYY, [\xE0s] HH[h]") })
|
|
1949
|
+
] }),
|
|
1950
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
1951
|
+
/* @__PURE__ */ jsx14(
|
|
1952
|
+
Text_default,
|
|
1953
|
+
{
|
|
1954
|
+
size: "md",
|
|
1955
|
+
weight: "semibold",
|
|
1956
|
+
className: "text-text-700 w-20",
|
|
1957
|
+
children: "Status"
|
|
1958
|
+
}
|
|
1959
|
+
),
|
|
1960
|
+
/* @__PURE__ */ jsx14(
|
|
1961
|
+
Badge_default,
|
|
1962
|
+
{
|
|
1963
|
+
variant: "solid",
|
|
1964
|
+
size: "small",
|
|
1965
|
+
action: getStatusBadgeAction(ticket.status),
|
|
1966
|
+
className: "w-fit",
|
|
1967
|
+
children: getStatusText(ticket.status)
|
|
1968
|
+
}
|
|
1969
|
+
)
|
|
1970
|
+
] }),
|
|
1971
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
1972
|
+
/* @__PURE__ */ jsx14(
|
|
1973
|
+
Text_default,
|
|
1974
|
+
{
|
|
1975
|
+
size: "md",
|
|
1976
|
+
weight: "semibold",
|
|
1977
|
+
className: "text-text-700 w-20",
|
|
1978
|
+
children: "Tipo"
|
|
1979
|
+
}
|
|
1980
|
+
),
|
|
1981
|
+
/* @__PURE__ */ jsxs11(
|
|
1982
|
+
Badge_default,
|
|
1983
|
+
{
|
|
1984
|
+
variant: "solid",
|
|
1985
|
+
size: "small",
|
|
1986
|
+
action: "muted",
|
|
1987
|
+
className: "w-fit",
|
|
1988
|
+
children: [
|
|
1989
|
+
getCategoryIcon(ticket.category),
|
|
1990
|
+
getCategoryText(ticket.category)
|
|
1991
|
+
]
|
|
1992
|
+
}
|
|
1993
|
+
)
|
|
1994
|
+
] }),
|
|
1995
|
+
/* @__PURE__ */ jsx14(Divider_default, {}),
|
|
1996
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start space-x-6", children: [
|
|
1997
|
+
/* @__PURE__ */ jsx14(
|
|
1998
|
+
Text_default,
|
|
1999
|
+
{
|
|
2000
|
+
size: "md",
|
|
2001
|
+
weight: "semibold",
|
|
2002
|
+
className: "text-text-700 w-20",
|
|
2003
|
+
children: "Descri\xE7\xE3o"
|
|
2004
|
+
}
|
|
2005
|
+
),
|
|
2006
|
+
ticket.description && /* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "normal", className: "text-text-600", children: ticket.description })
|
|
2007
|
+
] })
|
|
2008
|
+
] }),
|
|
2009
|
+
ticket.status === "respondido" /* RESPONDIDO */ && isLoadingAnswers && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2010
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "bold", className: "text-text-950 my-6", children: "Resposta de Suporte T\xE9cnico" }),
|
|
2011
|
+
/* @__PURE__ */ jsx14(AnswerSkeleton, {})
|
|
2012
|
+
] }),
|
|
2013
|
+
!isLoadingAnswers && answers.some((answer) => answer.userId !== userId) && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2014
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "bold", className: "text-text-950 my-6", children: "Resposta de Suporte T\xE9cnico" }),
|
|
2015
|
+
answers.filter((answer) => answer.userId !== userId).sort(
|
|
2016
|
+
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
2017
|
+
).slice(0, 1).map((answer) => /* @__PURE__ */ jsxs11(
|
|
2018
|
+
"div",
|
|
2019
|
+
{
|
|
2020
|
+
className: "bg-background p-4 space-y-6 rounded-xl",
|
|
2021
|
+
children: [
|
|
2022
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
2023
|
+
/* @__PURE__ */ jsx14(
|
|
2024
|
+
Text_default,
|
|
2025
|
+
{
|
|
2026
|
+
size: "md",
|
|
2027
|
+
weight: "semibold",
|
|
2028
|
+
className: "text-text-700 w-20",
|
|
2029
|
+
children: "Recebido"
|
|
2030
|
+
}
|
|
2031
|
+
),
|
|
2032
|
+
/* @__PURE__ */ jsx14(
|
|
2033
|
+
Text_default,
|
|
2034
|
+
{
|
|
2035
|
+
size: "md",
|
|
2036
|
+
weight: "normal",
|
|
2037
|
+
className: "text-text-600",
|
|
2038
|
+
children: dayjs(answer.createdAt).format(
|
|
2039
|
+
"DD MMMM YYYY, [\xE0s] HH[h]"
|
|
2040
|
+
)
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
2043
|
+
] }),
|
|
2044
|
+
/* @__PURE__ */ jsx14(Divider_default, {}),
|
|
2045
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start space-x-6", children: [
|
|
2046
|
+
/* @__PURE__ */ jsx14(
|
|
2047
|
+
Text_default,
|
|
2048
|
+
{
|
|
2049
|
+
size: "md",
|
|
2050
|
+
weight: "semibold",
|
|
2051
|
+
className: "text-text-700 w-20",
|
|
2052
|
+
children: "Resposta"
|
|
2053
|
+
}
|
|
2054
|
+
),
|
|
2055
|
+
/* @__PURE__ */ jsx14(
|
|
2056
|
+
Text_default,
|
|
2057
|
+
{
|
|
2058
|
+
size: "md",
|
|
2059
|
+
weight: "normal",
|
|
2060
|
+
className: "text-text-600",
|
|
2061
|
+
children: answer.answer
|
|
2062
|
+
}
|
|
2063
|
+
)
|
|
2064
|
+
] })
|
|
2065
|
+
]
|
|
2066
|
+
},
|
|
2067
|
+
answer.id
|
|
2068
|
+
))
|
|
2069
|
+
] }),
|
|
2070
|
+
!isLoadingAnswers && answers.some((answer) => answer.userId === userId) && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2071
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "md", weight: "bold", className: "text-text-950 my-6", children: "Resposta enviada" }),
|
|
2072
|
+
answers.filter((answer) => answer.userId === userId).sort(
|
|
2073
|
+
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
2074
|
+
).slice(0, 1).map((answer) => /* @__PURE__ */ jsxs11(
|
|
2075
|
+
"div",
|
|
2076
|
+
{
|
|
2077
|
+
className: "bg-background p-4 space-y-6 rounded-xl",
|
|
2078
|
+
children: [
|
|
2079
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center space-x-6", children: [
|
|
2080
|
+
/* @__PURE__ */ jsx14(
|
|
2081
|
+
Text_default,
|
|
2082
|
+
{
|
|
2083
|
+
size: "md",
|
|
2084
|
+
weight: "semibold",
|
|
2085
|
+
className: "text-text-700 w-20",
|
|
2086
|
+
children: "Enviada"
|
|
2087
|
+
}
|
|
2088
|
+
),
|
|
2089
|
+
/* @__PURE__ */ jsx14(
|
|
2090
|
+
Text_default,
|
|
2091
|
+
{
|
|
2092
|
+
size: "md",
|
|
2093
|
+
weight: "normal",
|
|
2094
|
+
className: "text-text-600",
|
|
2095
|
+
children: dayjs(answer.createdAt).format(
|
|
2096
|
+
"DD MMMM YYYY, [\xE0s] HH[h]"
|
|
2097
|
+
)
|
|
2098
|
+
}
|
|
2099
|
+
)
|
|
2100
|
+
] }),
|
|
2101
|
+
/* @__PURE__ */ jsx14(Divider_default, {}),
|
|
2102
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start space-x-6", children: [
|
|
2103
|
+
/* @__PURE__ */ jsx14(
|
|
2104
|
+
Text_default,
|
|
2105
|
+
{
|
|
2106
|
+
size: "md",
|
|
2107
|
+
weight: "semibold",
|
|
2108
|
+
className: "text-text-700 w-20",
|
|
2109
|
+
children: "Resposta"
|
|
2110
|
+
}
|
|
2111
|
+
),
|
|
2112
|
+
/* @__PURE__ */ jsx14(
|
|
2113
|
+
Text_default,
|
|
2114
|
+
{
|
|
2115
|
+
size: "md",
|
|
2116
|
+
weight: "normal",
|
|
2117
|
+
className: "text-text-600",
|
|
2118
|
+
children: answer.answer
|
|
2119
|
+
}
|
|
2120
|
+
)
|
|
2121
|
+
] })
|
|
2122
|
+
]
|
|
2123
|
+
},
|
|
2124
|
+
answer.id
|
|
2125
|
+
))
|
|
2126
|
+
] }),
|
|
2127
|
+
!isLoadingAnswers && answers.some((answer) => answer.userId !== userId) && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2128
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "lg", weight: "bold", className: "text-text-950 my-6", children: "Responder" }),
|
|
2129
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
|
|
2130
|
+
/* @__PURE__ */ jsx14(
|
|
2131
|
+
TextArea_default,
|
|
2132
|
+
{
|
|
2133
|
+
placeholder: "Detalhe o problema aqui.",
|
|
2134
|
+
rows: 4,
|
|
2135
|
+
className: "w-full",
|
|
2136
|
+
value: responseText,
|
|
2137
|
+
onChange: (e) => setResponseText(e.target.value)
|
|
2138
|
+
}
|
|
2139
|
+
),
|
|
2140
|
+
responseText.trim().length > 0 && /* @__PURE__ */ jsx14("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx14(
|
|
2141
|
+
Button_default,
|
|
2142
|
+
{
|
|
2143
|
+
variant: "solid",
|
|
2144
|
+
size: "medium",
|
|
2145
|
+
onClick: handleSubmitAnswer,
|
|
2146
|
+
disabled: isSubmittingAnswer,
|
|
2147
|
+
children: isSubmittingAnswer ? "Enviando..." : "Enviar"
|
|
2148
|
+
}
|
|
2149
|
+
) })
|
|
2150
|
+
] })
|
|
2151
|
+
] })
|
|
2152
|
+
] })
|
|
2153
|
+
] })
|
|
2154
|
+
}
|
|
2155
|
+
),
|
|
2156
|
+
/* @__PURE__ */ jsx14(
|
|
2157
|
+
Modal_default,
|
|
2158
|
+
{
|
|
2159
|
+
isOpen: showCloseConfirmation,
|
|
2160
|
+
onClose: () => setShowCloseConfirmation(false),
|
|
2161
|
+
title: "Encerrar pedido?",
|
|
2162
|
+
size: "md",
|
|
2163
|
+
hideCloseButton: false,
|
|
2164
|
+
closeOnEscape: true,
|
|
2165
|
+
"data-testid": "close-ticket-modal",
|
|
2166
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "space-y-6", children: [
|
|
2167
|
+
/* @__PURE__ */ jsx14(Text_default, { size: "sm", weight: "normal", className: "text-text-700", children: "Ao encerrar este pedido, ele ser\xE1 fechado e n\xE3o poder\xE1 mais ser atualizado." }),
|
|
2168
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex gap-3 justify-end", children: [
|
|
2169
|
+
/* @__PURE__ */ jsx14(
|
|
2170
|
+
Button_default,
|
|
2171
|
+
{
|
|
2172
|
+
variant: "outline",
|
|
2173
|
+
size: "medium",
|
|
2174
|
+
onClick: () => setShowCloseConfirmation(false),
|
|
2175
|
+
children: "Cancelar"
|
|
2176
|
+
}
|
|
2177
|
+
),
|
|
2178
|
+
/* @__PURE__ */ jsx14(
|
|
2179
|
+
Button_default,
|
|
2180
|
+
{
|
|
2181
|
+
variant: "solid",
|
|
2182
|
+
size: "medium",
|
|
2183
|
+
action: "negative",
|
|
2184
|
+
onClick: handleCloseTicket,
|
|
2185
|
+
children: "Encerrar"
|
|
2186
|
+
}
|
|
2187
|
+
)
|
|
2188
|
+
] })
|
|
2189
|
+
] })
|
|
2190
|
+
}
|
|
2191
|
+
)
|
|
2192
|
+
] });
|
|
2193
|
+
};
|
|
2194
|
+
|
|
2195
|
+
// src/assets/img/suporthistory.png
|
|
2196
|
+
var suporthistory_default = "../suporthistory-W5LBGAUP.png";
|
|
2197
|
+
|
|
2198
|
+
// src/components/Support/Support.tsx
|
|
2199
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2200
|
+
var TicketCard = ({
|
|
2201
|
+
ticket,
|
|
2202
|
+
onTicketClick
|
|
2203
|
+
}) => /* @__PURE__ */ jsxs12(
|
|
2204
|
+
"button",
|
|
2205
|
+
{
|
|
2206
|
+
type: "button",
|
|
2207
|
+
className: "flex items-center justify-between p-4 bg-background rounded-xl cursor-pointer w-full text-left hover:bg-background-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2",
|
|
2208
|
+
onClick: () => onTicketClick(ticket),
|
|
2209
|
+
children: [
|
|
2210
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx15(Text_default, { size: "xs", weight: "bold", className: "text-text-900", children: ticket.title }) }),
|
|
2211
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
|
|
2212
|
+
/* @__PURE__ */ jsx15(
|
|
2213
|
+
Badge_default,
|
|
2214
|
+
{
|
|
2215
|
+
variant: "solid",
|
|
2216
|
+
className: "flex items-center gap-1",
|
|
2217
|
+
action: getStatusBadgeAction(ticket.status),
|
|
2218
|
+
children: getStatusText(ticket.status)
|
|
2219
|
+
}
|
|
2220
|
+
),
|
|
2221
|
+
/* @__PURE__ */ jsxs12(Badge_default, { variant: "solid", className: "flex items-center gap-1", action: "muted", children: [
|
|
2222
|
+
getCategoryIcon(ticket.category, 18),
|
|
2223
|
+
getCategoryText(ticket.category)
|
|
2224
|
+
] }),
|
|
2225
|
+
/* @__PURE__ */ jsx15(CaretRightIcon, { size: 24, className: "text-text-800" })
|
|
2226
|
+
] })
|
|
2227
|
+
]
|
|
2228
|
+
},
|
|
2229
|
+
ticket.id
|
|
2230
|
+
);
|
|
2231
|
+
var TicketGroup = ({
|
|
2232
|
+
date,
|
|
2233
|
+
tickets,
|
|
2234
|
+
onTicketClick
|
|
2235
|
+
}) => /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
2236
|
+
/* @__PURE__ */ jsx15(Text_default, { size: "md", weight: "bold", className: "text-text-900", children: dayjs2(date).format("DD MMM YYYY") }),
|
|
2237
|
+
/* @__PURE__ */ jsx15("div", { className: "space-y-3", children: tickets.map((ticket) => /* @__PURE__ */ jsx15(
|
|
2238
|
+
TicketCard,
|
|
2239
|
+
{
|
|
2240
|
+
ticket,
|
|
2241
|
+
onTicketClick
|
|
2242
|
+
},
|
|
2243
|
+
ticket.id
|
|
2244
|
+
)) })
|
|
2245
|
+
] }, date);
|
|
2246
|
+
var EmptyState = ({ imageSrc }) => /* @__PURE__ */ jsxs12("div", { className: "flex flex-row justify-center items-center mt-48", children: [
|
|
2247
|
+
imageSrc && /* @__PURE__ */ jsx15("img", { src: imageSrc, alt: "Imagem de suporte" }),
|
|
2248
|
+
/* @__PURE__ */ jsx15(Text_default, { size: "3xl", weight: "semibold", children: "Nenhum pedido encontrado." })
|
|
2249
|
+
] });
|
|
2250
|
+
var TicketSkeleton = () => /* @__PURE__ */ jsx15("div", { className: "space-y-6", children: [0, 1].map((groupIndex) => /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
2251
|
+
/* @__PURE__ */ jsx15(SkeletonText, { width: "150px", height: 20 }),
|
|
2252
|
+
/* @__PURE__ */ jsx15("div", { className: "space-y-3", children: [0, 1].map((ticketIndex) => /* @__PURE__ */ jsx15(
|
|
2253
|
+
SkeletonRounded,
|
|
2254
|
+
{
|
|
2255
|
+
width: "100%",
|
|
2256
|
+
height: 72,
|
|
2257
|
+
className: "p-4"
|
|
2258
|
+
},
|
|
2259
|
+
ticketIndex
|
|
2260
|
+
)) })
|
|
2261
|
+
] }, groupIndex)) });
|
|
2262
|
+
var Support = ({
|
|
2263
|
+
apiClient,
|
|
2264
|
+
userId,
|
|
2265
|
+
emptyStateImage,
|
|
2266
|
+
title = "Suporte",
|
|
2267
|
+
onTicketCreated,
|
|
2268
|
+
onTicketClosed
|
|
2269
|
+
}) => {
|
|
2270
|
+
const [activeTab, setActiveTab] = useState5("criar-pedido");
|
|
2271
|
+
const [selectedProblem, setSelectedProblem] = useState5(null);
|
|
2272
|
+
const [statusFilter, setStatusFilter] = useState5("todos");
|
|
2273
|
+
const [categoryFilter, setCategoryFilter] = useState5("todos");
|
|
2274
|
+
const [selectedTicket, setSelectedTicket] = useState5(
|
|
2275
|
+
null
|
|
2276
|
+
);
|
|
2277
|
+
const [isModalOpen, setIsModalOpen] = useState5(false);
|
|
2278
|
+
const [submitError, setSubmitError] = useState5(null);
|
|
2279
|
+
const [showSuccessToast, setShowSuccessToast] = useState5(false);
|
|
2280
|
+
const [showCloseSuccessToast, setShowCloseSuccessToast] = useState5(false);
|
|
2281
|
+
const [showCloseErrorToast, setShowCloseErrorToast] = useState5(false);
|
|
2282
|
+
const [allTickets, setAllTickets] = useState5([]);
|
|
2283
|
+
const [loadingTickets, setLoadingTickets] = useState5(false);
|
|
2284
|
+
const [currentPage, setCurrentPage] = useState5(1);
|
|
2285
|
+
const ITEMS_PER_PAGE = 10;
|
|
2286
|
+
const handlePrevPage = () => {
|
|
2287
|
+
if (currentPage > 1) {
|
|
2288
|
+
setCurrentPage(currentPage - 1);
|
|
2289
|
+
}
|
|
2290
|
+
};
|
|
2291
|
+
const handleNextPage = () => {
|
|
2292
|
+
const totalPages2 = Math.ceil(filteredTickets.length / ITEMS_PER_PAGE);
|
|
2293
|
+
if (currentPage < totalPages2) {
|
|
2294
|
+
setCurrentPage(currentPage + 1);
|
|
2295
|
+
}
|
|
2296
|
+
};
|
|
2297
|
+
useEffect5(() => {
|
|
2298
|
+
if (activeTab === "historico") {
|
|
2299
|
+
fetchTickets(statusFilter);
|
|
2300
|
+
setCurrentPage(1);
|
|
2301
|
+
}
|
|
2302
|
+
}, [activeTab, statusFilter]);
|
|
2303
|
+
useEffect5(() => {
|
|
2304
|
+
setCurrentPage(1);
|
|
2305
|
+
}, [categoryFilter]);
|
|
2306
|
+
const convertApiTicketToComponent = (apiTicket) => {
|
|
2307
|
+
return {
|
|
2308
|
+
id: apiTicket.id,
|
|
2309
|
+
title: apiTicket.subject,
|
|
2310
|
+
status: mapApiStatusToInternal(apiTicket.status),
|
|
2311
|
+
createdAt: apiTicket.createdAt,
|
|
2312
|
+
category: apiTicket.type,
|
|
2313
|
+
description: apiTicket.description
|
|
2314
|
+
};
|
|
2315
|
+
};
|
|
2316
|
+
const filteredTickets = allTickets.map(convertApiTicketToComponent).filter((ticket) => {
|
|
2317
|
+
const categoryMatch = categoryFilter === "todos" || ticket.category === categoryFilter;
|
|
2318
|
+
return categoryMatch;
|
|
2319
|
+
}).sort(
|
|
2320
|
+
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
2321
|
+
);
|
|
2322
|
+
const totalPages = Math.ceil(filteredTickets.length / ITEMS_PER_PAGE);
|
|
2323
|
+
const startIndex = (currentPage - 1) * ITEMS_PER_PAGE;
|
|
2324
|
+
const endIndex = startIndex + ITEMS_PER_PAGE;
|
|
2325
|
+
const paginatedTickets = filteredTickets.slice(startIndex, endIndex);
|
|
2326
|
+
const groupedTickets = paginatedTickets.reduce(
|
|
2327
|
+
(groups, ticket) => {
|
|
2328
|
+
const date = dayjs2(ticket.createdAt).format("YYYY-MM-DD");
|
|
2329
|
+
if (!groups[date]) {
|
|
2330
|
+
groups[date] = [];
|
|
2331
|
+
}
|
|
2332
|
+
groups[date].push(ticket);
|
|
2333
|
+
return groups;
|
|
2334
|
+
},
|
|
2335
|
+
{}
|
|
2336
|
+
);
|
|
2337
|
+
const {
|
|
2338
|
+
register,
|
|
2339
|
+
handleSubmit,
|
|
2340
|
+
setValue,
|
|
2341
|
+
reset,
|
|
2342
|
+
formState: { errors, isSubmitting }
|
|
2343
|
+
} = useForm({
|
|
2344
|
+
resolver: zodResolver(supportSchema),
|
|
2345
|
+
defaultValues: {
|
|
2346
|
+
problemType: void 0,
|
|
2347
|
+
title: "",
|
|
2348
|
+
description: ""
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
const fetchTickets = async (status) => {
|
|
2352
|
+
setLoadingTickets(true);
|
|
2353
|
+
try {
|
|
2354
|
+
const params = new URLSearchParams({
|
|
2355
|
+
page: "1",
|
|
2356
|
+
limit: "100"
|
|
2357
|
+
// Buscar o máximo permitido pela API
|
|
2358
|
+
});
|
|
2359
|
+
if (status && status !== "todos") {
|
|
2360
|
+
const apiStatus = mapInternalStatusToApi(status);
|
|
2361
|
+
params.append("status", apiStatus);
|
|
2362
|
+
}
|
|
2363
|
+
const response = await apiClient.get(
|
|
2364
|
+
`/support?${params.toString()}`
|
|
2365
|
+
);
|
|
2366
|
+
setAllTickets(response.data.data.support);
|
|
2367
|
+
} catch (error) {
|
|
2368
|
+
console.error("Erro ao buscar tickets:", error);
|
|
2369
|
+
setAllTickets([]);
|
|
2370
|
+
} finally {
|
|
2371
|
+
setLoadingTickets(false);
|
|
2372
|
+
}
|
|
2373
|
+
};
|
|
2374
|
+
const handleProblemSelection = (type) => {
|
|
2375
|
+
setSelectedProblem(type);
|
|
2376
|
+
if (type) {
|
|
2377
|
+
setValue("problemType", type, { shouldValidate: true });
|
|
2378
|
+
}
|
|
2379
|
+
};
|
|
2380
|
+
const onSubmit = async (data) => {
|
|
2381
|
+
setSubmitError(null);
|
|
2382
|
+
try {
|
|
2383
|
+
const requestData = {
|
|
2384
|
+
subject: data.title,
|
|
2385
|
+
description: data.description,
|
|
2386
|
+
type: data.problemType
|
|
2387
|
+
};
|
|
2388
|
+
await apiClient.post(
|
|
2389
|
+
"/support",
|
|
2390
|
+
requestData
|
|
2391
|
+
);
|
|
2392
|
+
setShowSuccessToast(true);
|
|
2393
|
+
setTimeout(() => setShowSuccessToast(false), 4e3);
|
|
2394
|
+
setSelectedProblem(null);
|
|
2395
|
+
reset();
|
|
2396
|
+
setActiveTab("historico");
|
|
2397
|
+
fetchTickets(statusFilter);
|
|
2398
|
+
onTicketCreated?.();
|
|
2399
|
+
} catch (error) {
|
|
2400
|
+
console.error("Erro ao criar ticket de suporte:", error);
|
|
2401
|
+
setSubmitError("Erro ao criar ticket. Tente novamente.");
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
const handleTicketClick = (ticket) => {
|
|
2405
|
+
setSelectedTicket(ticket);
|
|
2406
|
+
setIsModalOpen(true);
|
|
2407
|
+
};
|
|
2408
|
+
const handleModalClose = () => {
|
|
2409
|
+
setIsModalOpen(false);
|
|
2410
|
+
setSelectedTicket(null);
|
|
2411
|
+
};
|
|
2412
|
+
const handleTicketClose = async (ticketId) => {
|
|
2413
|
+
try {
|
|
2414
|
+
await apiClient.patch(`/support/${ticketId}`, {
|
|
2415
|
+
status: mapInternalStatusToApi("encerrado" /* ENCERRADO */)
|
|
2416
|
+
});
|
|
2417
|
+
setShowCloseSuccessToast(true);
|
|
2418
|
+
setTimeout(() => setShowCloseSuccessToast(false), 4e3);
|
|
2419
|
+
if (activeTab === "historico") {
|
|
2420
|
+
fetchTickets(statusFilter);
|
|
2421
|
+
}
|
|
2422
|
+
onTicketClosed?.();
|
|
2423
|
+
} catch (error) {
|
|
2424
|
+
console.error("Erro ao encerrar ticket:", error);
|
|
2425
|
+
setShowCloseErrorToast(true);
|
|
2426
|
+
setTimeout(() => setShowCloseErrorToast(false), 4e3);
|
|
2427
|
+
}
|
|
2428
|
+
};
|
|
2429
|
+
const problemTypes = [
|
|
2430
|
+
{
|
|
2431
|
+
id: "tecnico" /* TECNICO */,
|
|
2432
|
+
title: "T\xE9cnico",
|
|
2433
|
+
icon: /* @__PURE__ */ jsx15(BugIcon2, { size: 24 })
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
id: "acesso" /* ACESSO */,
|
|
2437
|
+
title: "Acesso",
|
|
2438
|
+
icon: /* @__PURE__ */ jsx15(KeyIcon2, { size: 24 })
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
id: "outros" /* OUTROS */,
|
|
2442
|
+
title: "Outros",
|
|
2443
|
+
icon: /* @__PURE__ */ jsx15(InfoIcon2, { size: 24 })
|
|
2444
|
+
}
|
|
2445
|
+
];
|
|
2446
|
+
const emptyImage = emptyStateImage || suporthistory_default;
|
|
2447
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col w-full h-full relative justify-start items-center mb-5 overflow-y-auto", children: [
|
|
2448
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col w-full h-full max-w-[992px] z-10 lg:px-0 px-4", children: /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
2449
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex w-full mb-4 flex-row items-center justify-between not-lg:gap-4 lg:gap-6", children: [
|
|
2450
|
+
/* @__PURE__ */ jsx15("h1", { className: "font-bold leading-[28px] tracking-[0.2px] text-text-950 text-xl mt-4 sm:text-2xl sm:flex-1 sm:self-end sm:mt-0", children: title }),
|
|
2451
|
+
/* @__PURE__ */ jsx15("div", { className: "sm:flex-shrink-0 sm:self-end", children: /* @__PURE__ */ jsx15(
|
|
2452
|
+
Menu_default,
|
|
2453
|
+
{
|
|
2454
|
+
value: activeTab,
|
|
2455
|
+
defaultValue: "criar-pedido",
|
|
2456
|
+
variant: "menu2",
|
|
2457
|
+
onValueChange: (value) => setActiveTab(value),
|
|
2458
|
+
className: "bg-transparent shadow-none px-0",
|
|
2459
|
+
children: /* @__PURE__ */ jsxs12(MenuContent, { variant: "menu2", children: [
|
|
2460
|
+
/* @__PURE__ */ jsx15(
|
|
2461
|
+
MenuItem,
|
|
2462
|
+
{
|
|
2463
|
+
variant: "menu2",
|
|
2464
|
+
value: "criar-pedido",
|
|
2465
|
+
className: "whitespace-nowrap px-17 not-sm:px-5",
|
|
2466
|
+
children: "Criar Pedido"
|
|
2467
|
+
}
|
|
2468
|
+
),
|
|
2469
|
+
/* @__PURE__ */ jsx15(
|
|
2470
|
+
MenuItem,
|
|
2471
|
+
{
|
|
2472
|
+
variant: "menu2",
|
|
2473
|
+
value: "historico",
|
|
2474
|
+
className: "whitespace-nowrap px-17 not-sm:px-5",
|
|
2475
|
+
children: "Hist\xF3rico"
|
|
2476
|
+
}
|
|
2477
|
+
)
|
|
2478
|
+
] })
|
|
2479
|
+
}
|
|
2480
|
+
) })
|
|
2481
|
+
] }),
|
|
2482
|
+
activeTab === "criar-pedido" && /* @__PURE__ */ jsxs12("div", { className: "space-y-2", children: [
|
|
2483
|
+
/* @__PURE__ */ jsx15(Text_default, { as: "h2", size: "md", weight: "bold", className: "text-text-900", children: "Selecione o tipo de problema" }),
|
|
2484
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col sm:flex-row gap-2 sm:gap-4", children: problemTypes.map((type) => /* @__PURE__ */ jsx15(
|
|
2485
|
+
SelectionButton_default,
|
|
2486
|
+
{
|
|
2487
|
+
icon: type.icon,
|
|
2488
|
+
label: type.title,
|
|
2489
|
+
selected: selectedProblem === type.id,
|
|
2490
|
+
onClick: () => handleProblemSelection(type.id),
|
|
2491
|
+
className: "w-full p-4"
|
|
2492
|
+
},
|
|
2493
|
+
type.id
|
|
2494
|
+
)) }),
|
|
2495
|
+
errors.problemType && /* @__PURE__ */ jsx15(Text_default, { size: "sm", className: "text-red-500 mt-1", children: errors.problemType.message })
|
|
2496
|
+
] }),
|
|
2497
|
+
selectedProblem && activeTab === "criar-pedido" && /* @__PURE__ */ jsxs12("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
|
|
2498
|
+
/* @__PURE__ */ jsx15("div", { className: "space-y-1", children: /* @__PURE__ */ jsx15(
|
|
2499
|
+
Input_default,
|
|
2500
|
+
{
|
|
2501
|
+
size: "large",
|
|
2502
|
+
variant: "rounded",
|
|
2503
|
+
label: "T\xEDtulo",
|
|
2504
|
+
placeholder: "Digite o t\xEDtulo",
|
|
2505
|
+
...register("title"),
|
|
2506
|
+
errorMessage: errors.title?.message
|
|
2507
|
+
}
|
|
2508
|
+
) }),
|
|
2509
|
+
/* @__PURE__ */ jsx15("div", { className: "space-y-1", children: /* @__PURE__ */ jsx15(
|
|
2510
|
+
TextArea_default,
|
|
2511
|
+
{
|
|
2512
|
+
size: "large",
|
|
2513
|
+
label: "Descri\xE7\xE3o",
|
|
2514
|
+
placeholder: "Descreva o problema aqui",
|
|
2515
|
+
...register("description"),
|
|
2516
|
+
errorMessage: errors.description?.message
|
|
2517
|
+
}
|
|
2518
|
+
) }),
|
|
2519
|
+
/* @__PURE__ */ jsx15(
|
|
2520
|
+
Button_default,
|
|
2521
|
+
{
|
|
2522
|
+
size: "large",
|
|
2523
|
+
className: "float-end mt-10",
|
|
2524
|
+
type: "submit",
|
|
2525
|
+
disabled: isSubmitting,
|
|
2526
|
+
children: isSubmitting ? "Enviando..." : "Enviar Pedido"
|
|
2527
|
+
}
|
|
2528
|
+
),
|
|
2529
|
+
submitError && /* @__PURE__ */ jsx15("div", { className: "mt-4 p-4 bg-red-100 border border-red-400 text-red-700 rounded", children: /* @__PURE__ */ jsx15(Text_default, { size: "sm", className: "text-red-700", children: submitError }) })
|
|
2530
|
+
] }),
|
|
2531
|
+
activeTab === "historico" && /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
|
|
2532
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex gap-4", children: [
|
|
2533
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col flex-1/2 space-y-1", children: /* @__PURE__ */ jsxs12(
|
|
2534
|
+
Select_default,
|
|
2535
|
+
{
|
|
2536
|
+
label: "Status",
|
|
2537
|
+
size: "large",
|
|
2538
|
+
value: statusFilter,
|
|
2539
|
+
onValueChange: setStatusFilter,
|
|
2540
|
+
children: [
|
|
2541
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { variant: "rounded", className: "", children: /* @__PURE__ */ jsx15(SelectValue, { placeholder: "Todos" }) }),
|
|
2542
|
+
/* @__PURE__ */ jsxs12(SelectContent, { children: [
|
|
2543
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "todos", children: "Todos" }),
|
|
2544
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "aberto" /* ABERTO */, children: "Aberto" }),
|
|
2545
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "respondido" /* RESPONDIDO */, children: "Respondido" }),
|
|
2546
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "encerrado" /* ENCERRADO */, children: "Encerrado" })
|
|
2547
|
+
] })
|
|
2548
|
+
]
|
|
2549
|
+
}
|
|
2550
|
+
) }),
|
|
2551
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col flex-1/2 space-y-1", children: /* @__PURE__ */ jsxs12(
|
|
2552
|
+
Select_default,
|
|
2553
|
+
{
|
|
2554
|
+
label: "Tipo",
|
|
2555
|
+
size: "large",
|
|
2556
|
+
value: categoryFilter,
|
|
2557
|
+
onValueChange: setCategoryFilter,
|
|
2558
|
+
children: [
|
|
2559
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { variant: "rounded", className: "", children: /* @__PURE__ */ jsx15(SelectValue, { placeholder: "Todos" }) }),
|
|
2560
|
+
/* @__PURE__ */ jsxs12(SelectContent, { children: [
|
|
2561
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "todos", children: "Todos" }),
|
|
2562
|
+
/* @__PURE__ */ jsxs12(SelectItem, { value: "tecnico" /* TECNICO */, children: [
|
|
2563
|
+
/* @__PURE__ */ jsx15(BugIcon2, { size: 16 }),
|
|
2564
|
+
" T\xE9cnico"
|
|
2565
|
+
] }),
|
|
2566
|
+
/* @__PURE__ */ jsxs12(SelectItem, { value: "acesso" /* ACESSO */, children: [
|
|
2567
|
+
/* @__PURE__ */ jsx15(KeyIcon2, { size: 16 }),
|
|
2568
|
+
" Acesso"
|
|
2569
|
+
] }),
|
|
2570
|
+
/* @__PURE__ */ jsxs12(SelectItem, { value: "outros" /* OUTROS */, children: [
|
|
2571
|
+
/* @__PURE__ */ jsx15(InfoIcon2, { size: 16 }),
|
|
2572
|
+
" Outros"
|
|
2573
|
+
] })
|
|
2574
|
+
] })
|
|
2575
|
+
]
|
|
2576
|
+
}
|
|
2577
|
+
) })
|
|
2578
|
+
] }),
|
|
2579
|
+
(() => {
|
|
2580
|
+
if (loadingTickets) {
|
|
2581
|
+
return /* @__PURE__ */ jsx15(TicketSkeleton, {});
|
|
2582
|
+
}
|
|
2583
|
+
if (Object.keys(groupedTickets).length === 0) {
|
|
2584
|
+
return /* @__PURE__ */ jsx15(EmptyState, { imageSrc: emptyImage });
|
|
2585
|
+
}
|
|
2586
|
+
return /* @__PURE__ */ jsx15("div", { className: "space-y-6", children: Object.entries(groupedTickets).sort(
|
|
2587
|
+
([a], [b]) => new Date(b).getTime() - new Date(a).getTime()
|
|
2588
|
+
).map(([date, tickets]) => /* @__PURE__ */ jsx15(
|
|
2589
|
+
TicketGroup,
|
|
2590
|
+
{
|
|
2591
|
+
date,
|
|
2592
|
+
tickets,
|
|
2593
|
+
onTicketClick: handleTicketClick
|
|
2594
|
+
},
|
|
2595
|
+
date
|
|
2596
|
+
)) });
|
|
2597
|
+
})(),
|
|
2598
|
+
!loadingTickets && totalPages > 1 && /* @__PURE__ */ jsxs12("div", { className: "flex justify-center items-center gap-4 mt-6", children: [
|
|
2599
|
+
/* @__PURE__ */ jsx15(
|
|
2600
|
+
Button_default,
|
|
2601
|
+
{
|
|
2602
|
+
variant: "outline",
|
|
2603
|
+
size: "small",
|
|
2604
|
+
onClick: handlePrevPage,
|
|
2605
|
+
disabled: currentPage === 1,
|
|
2606
|
+
children: "Anterior"
|
|
2607
|
+
}
|
|
2608
|
+
),
|
|
2609
|
+
/* @__PURE__ */ jsxs12(Text_default, { size: "sm", className: "text-text-600", children: [
|
|
2610
|
+
"P\xE1gina ",
|
|
2611
|
+
currentPage,
|
|
2612
|
+
" de ",
|
|
2613
|
+
totalPages
|
|
2614
|
+
] }),
|
|
2615
|
+
/* @__PURE__ */ jsx15(
|
|
2616
|
+
Button_default,
|
|
2617
|
+
{
|
|
2618
|
+
variant: "outline",
|
|
2619
|
+
size: "small",
|
|
2620
|
+
onClick: handleNextPage,
|
|
2621
|
+
disabled: currentPage === totalPages,
|
|
2622
|
+
children: "Pr\xF3xima"
|
|
2623
|
+
}
|
|
2624
|
+
)
|
|
2625
|
+
] })
|
|
2626
|
+
] })
|
|
2627
|
+
] }) }),
|
|
2628
|
+
selectedTicket && /* @__PURE__ */ jsx15(
|
|
2629
|
+
TicketModal,
|
|
2630
|
+
{
|
|
2631
|
+
ticket: selectedTicket,
|
|
2632
|
+
isOpen: isModalOpen,
|
|
2633
|
+
onClose: handleModalClose,
|
|
2634
|
+
onTicketClose: handleTicketClose,
|
|
2635
|
+
apiClient,
|
|
2636
|
+
userId
|
|
2637
|
+
}
|
|
2638
|
+
),
|
|
2639
|
+
showSuccessToast && /* @__PURE__ */ jsx15("div", { className: "fixed top-4 left-1/2 transform -translate-x-1/2 z-50", children: /* @__PURE__ */ jsx15(
|
|
2640
|
+
Toast_default,
|
|
2641
|
+
{
|
|
2642
|
+
title: "Pedido enviado!",
|
|
2643
|
+
description: "Agora voc\xEA pode acompanhar o andamento do seu pedido.",
|
|
2644
|
+
variant: "solid",
|
|
2645
|
+
onClose: () => setShowSuccessToast(false)
|
|
2646
|
+
}
|
|
2647
|
+
) }),
|
|
2648
|
+
showCloseSuccessToast && /* @__PURE__ */ jsx15("div", { className: "fixed top-4 left-1/2 transform -translate-x-1/2 z-50", children: /* @__PURE__ */ jsx15(
|
|
2649
|
+
Toast_default,
|
|
2650
|
+
{
|
|
2651
|
+
title: "Pedido encerrado!",
|
|
2652
|
+
description: "",
|
|
2653
|
+
variant: "solid",
|
|
2654
|
+
onClose: () => setShowCloseSuccessToast(false)
|
|
2655
|
+
}
|
|
2656
|
+
) }),
|
|
2657
|
+
showCloseErrorToast && /* @__PURE__ */ jsx15("div", { className: "fixed top-4 left-1/2 transform -translate-x-1/2 z-50", children: /* @__PURE__ */ jsx15(
|
|
2658
|
+
Toast_default,
|
|
2659
|
+
{
|
|
2660
|
+
title: "Erro ao encerrar pedido",
|
|
2661
|
+
description: "N\xE3o foi poss\xEDvel encerrar o pedido. Tente novamente.",
|
|
2662
|
+
variant: "solid",
|
|
2663
|
+
action: "warning",
|
|
2664
|
+
onClose: () => setShowCloseErrorToast(false)
|
|
2665
|
+
}
|
|
2666
|
+
) })
|
|
2667
|
+
] });
|
|
2668
|
+
};
|
|
2669
|
+
var Support_default = Support;
|
|
2670
|
+
export {
|
|
2671
|
+
Support_default as Support,
|
|
2672
|
+
TicketModal,
|
|
2673
|
+
getCategoryIcon,
|
|
2674
|
+
supportSchema
|
|
2675
|
+
};
|
|
2676
|
+
//# sourceMappingURL=index.mjs.map
|