@pagamio/frontend-commons-lib 0.8.175 → 0.8.183
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/lib/api/client.d.ts +88 -0
- package/lib/api/client.js +339 -0
- package/lib/api/context.d.ts +112 -0
- package/lib/api/context.js +105 -0
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.js +4 -0
- package/lib/api/swr.d.ts +46 -0
- package/lib/api/swr.js +124 -0
- package/lib/api/types.d.ts +145 -0
- package/lib/api/types.js +10 -0
- package/lib/auth/authenticators/AuthenticatorFactory.d.ts +25 -0
- package/lib/auth/authenticators/AuthenticatorFactory.js +32 -0
- package/lib/auth/authenticators/index.d.ts +7 -0
- package/lib/auth/authenticators/index.js +7 -0
- package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.d.ts +21 -0
- package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.js +26 -0
- package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.d.ts +74 -0
- package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.js +99 -0
- package/lib/auth/authenticators/types.d.ts +26 -0
- package/lib/auth/authenticators/types.js +9 -0
- package/lib/auth/components/AppBanner.d.ts +7 -0
- package/lib/auth/components/AppBanner.js +9 -0
- package/lib/auth/components/AuthCard.d.ts +8 -0
- package/lib/auth/components/AuthCard.js +14 -0
- package/lib/auth/components/AuthFormUtils.d.ts +58 -0
- package/lib/auth/components/AuthFormUtils.js +52 -0
- package/lib/auth/components/AuthPageLayout.d.ts +45 -0
- package/lib/auth/components/AuthPageLayout.js +12 -0
- package/lib/auth/components/ChangePasswordPage.d.ts +12 -0
- package/lib/auth/components/ChangePasswordPage.js +59 -0
- package/lib/auth/components/CustomerRegistrationPage.d.ts +50 -0
- package/lib/auth/components/CustomerRegistrationPage.js +140 -0
- package/lib/auth/components/ForgotPasswordPage.d.ts +38 -0
- package/lib/auth/components/ForgotPasswordPage.js +76 -0
- package/lib/auth/components/LoginPage.d.ts +73 -0
- package/lib/auth/components/LoginPage.js +115 -0
- package/lib/auth/components/LogoutButton.d.ts +30 -0
- package/lib/auth/components/LogoutButton.js +47 -0
- package/lib/auth/components/ResetPasswordPage.d.ts +42 -0
- package/lib/auth/components/ResetPasswordPage.js +88 -0
- package/lib/auth/components/hooks/useChangeUserPassword.d.ts +26 -0
- package/lib/auth/components/hooks/useChangeUserPassword.js +63 -0
- package/lib/auth/components/index.d.ts +8 -0
- package/lib/auth/components/index.js +7 -0
- package/lib/auth/context/AuthContext.d.ts +65 -0
- package/lib/auth/context/AuthContext.js +150 -0
- package/lib/auth/context/index.d.ts +1 -0
- package/lib/auth/context/index.js +1 -0
- package/lib/auth/index.d.ts +7 -0
- package/lib/auth/index.js +7 -0
- package/lib/auth/services/AuthService.d.ts +230 -0
- package/lib/auth/services/AuthService.js +475 -0
- package/lib/auth/services/LogoutService.d.ts +27 -0
- package/lib/auth/services/LogoutService.js +98 -0
- package/lib/auth/services/index.d.ts +2 -0
- package/lib/auth/services/index.js +2 -0
- package/lib/auth/shared/index.d.ts +1 -0
- package/lib/auth/shared/index.js +1 -0
- package/lib/auth/shared/layout/AuthPageLayout.d.ts +10 -0
- package/lib/auth/shared/layout/AuthPageLayout.js +16 -0
- package/lib/auth/shared/layout/index.d.ts +1 -0
- package/lib/auth/shared/layout/index.js +1 -0
- package/lib/auth/types/auth.types.d.ts +234 -0
- package/lib/auth/types/auth.types.js +14 -0
- package/lib/auth/types/index.d.ts +1 -0
- package/lib/auth/types/index.js +1 -0
- package/lib/auth/utils/TokenManager.d.ts +43 -0
- package/lib/auth/utils/TokenManager.js +171 -0
- package/lib/auth/utils/Transformers.d.ts +158 -0
- package/lib/auth/utils/Transformers.js +263 -0
- package/lib/auth/utils/errorDetection.d.ts +22 -0
- package/lib/auth/utils/errorDetection.js +190 -0
- package/lib/auth/utils/index.d.ts +3 -0
- package/lib/auth/utils/index.js +3 -0
- package/lib/components/charts/LineGraph.d.ts +15 -0
- package/lib/components/charts/LineGraph.js +131 -0
- package/lib/components/icons/Icon.d.ts +8 -0
- package/lib/components/icons/Icon.js +13 -0
- package/lib/components/icons/index.d.ts +2 -0
- package/lib/components/icons/index.js +2 -0
- package/lib/components/icons/types.d.ts +26 -0
- package/lib/components/icons/types.js +33 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/components/layout/AppLayout.d.ts +34 -0
- package/lib/components/layout/AppLayout.js +19 -0
- package/lib/components/layout/AuthPageLayout.d.ts +13 -0
- package/lib/components/layout/AuthPageLayout.js +15 -0
- package/lib/components/layout/BreadcrumbNav.d.ts +2 -0
- package/lib/components/layout/BreadcrumbNav.js +10 -0
- package/lib/components/layout/LayoutContent.d.ts +6 -0
- package/lib/components/layout/LayoutContent.js +10 -0
- package/lib/components/layout/Navbar.d.ts +106 -0
- package/lib/components/layout/Navbar.js +66 -0
- package/lib/components/layout/PageHeader.d.ts +8 -0
- package/lib/components/layout/PageHeader.js +7 -0
- package/lib/components/layout/SessionExpiryModal.d.ts +10 -0
- package/lib/components/layout/SessionExpiryModal.js +9 -0
- package/lib/components/layout/Sidebar.d.ts +6 -0
- package/lib/components/layout/Sidebar.js +87 -0
- package/lib/components/layout/VerticalTabsLayout.d.ts +12 -0
- package/lib/components/layout/VerticalTabsLayout.js +14 -0
- package/lib/components/layout/index.d.ts +9 -0
- package/lib/components/layout/index.js +9 -0
- package/lib/components/ui/Avatar.d.ts +6 -0
- package/lib/components/ui/Avatar.js +11 -0
- package/lib/components/ui/AvatarIcon.d.ts +4 -0
- package/lib/components/ui/AvatarIcon.js +6 -0
- package/lib/components/ui/Button.d.ts +14 -0
- package/lib/components/ui/Button.js +30 -0
- package/lib/components/ui/Calendar.d.ts +9 -0
- package/lib/components/ui/Calendar.js +35 -0
- package/lib/components/ui/Card.d.ts +16 -0
- package/lib/components/ui/Card.js +6 -0
- package/lib/components/ui/Chart.d.ts +2 -0
- package/lib/components/ui/Chart.js +16 -0
- package/lib/components/ui/Checkbox.d.ts +4 -0
- package/lib/components/ui/Checkbox.js +8 -0
- package/lib/components/ui/Command.d.ts +80 -0
- package/lib/components/ui/Command.js +28 -0
- package/lib/components/ui/ContainedTab.d.ts +21 -0
- package/lib/components/ui/ContainedTab.js +37 -0
- package/lib/components/ui/DateFormat.d.ts +6 -0
- package/lib/components/ui/DateFormat.js +8 -0
- package/lib/components/ui/DatePicker.d.ts +14 -0
- package/lib/components/ui/DatePicker.js +91 -0
- package/lib/components/ui/DateRangeModal.d.ts +38 -0
- package/lib/components/ui/DateRangeModal.js +89 -0
- package/lib/components/ui/DetailsCard.d.ts +16 -0
- package/lib/components/ui/DetailsCard.js +14 -0
- package/lib/components/ui/DetailsPage.d.ts +36 -0
- package/lib/components/ui/DetailsPage.js +50 -0
- package/lib/components/ui/Dialog.d.ts +19 -0
- package/lib/components/ui/Dialog.js +22 -0
- package/lib/components/ui/EmptyState.d.ts +6 -0
- package/lib/components/ui/EmptyState.js +6 -0
- package/lib/components/ui/FilterComponent.d.ts +30 -0
- package/lib/components/ui/FilterComponent.js +80 -0
- package/lib/components/ui/FilterList.d.ts +52 -0
- package/lib/components/ui/FilterList.js +62 -0
- package/lib/components/ui/FilterSection.d.ts +31 -0
- package/lib/components/ui/FilterSection.js +21 -0
- package/lib/components/ui/FilterWrapper.d.ts +6 -0
- package/lib/components/ui/FilterWrapper.js +7 -0
- package/lib/components/ui/Form.d.ts +23 -0
- package/lib/components/ui/Form.js +62 -0
- package/lib/components/ui/HoverableValue.d.ts +7 -0
- package/lib/components/ui/HoverableValue.js +8 -0
- package/lib/components/ui/IconButton.d.ts +10 -0
- package/lib/components/ui/IconButton.js +10 -0
- package/lib/components/ui/ImageComponent.d.ts +8 -0
- package/lib/components/ui/ImageComponent.js +5 -0
- package/lib/components/ui/ImageUploader.d.ts +17 -0
- package/lib/components/ui/ImageUploader.js +144 -0
- package/lib/components/ui/Input.d.ts +4 -0
- package/lib/components/ui/Input.js +8 -0
- package/lib/components/ui/Label.d.ts +5 -0
- package/lib/components/ui/Label.js +9 -0
- package/lib/components/ui/Loader.d.ts +10 -0
- package/lib/components/ui/Loader.js +7 -0
- package/lib/components/ui/Modal.d.ts +72 -0
- package/lib/components/ui/Modal.js +31 -0
- package/lib/components/ui/MultiSelect.d.ts +16 -0
- package/lib/components/ui/MultiSelect.js +59 -0
- package/lib/components/ui/NotificationModal.d.ts +18 -0
- package/lib/components/ui/NotificationModal.js +40 -0
- package/lib/components/ui/PhoneInput.d.ts +12 -0
- package/lib/components/ui/PhoneInput.js +58 -0
- package/lib/components/ui/Popover.d.ts +7 -0
- package/lib/components/ui/Popover.js +10 -0
- package/lib/components/ui/Progress.d.ts +7 -0
- package/lib/components/ui/Progress.js +7 -0
- package/lib/components/ui/Radio.d.ts +5 -0
- package/lib/components/ui/Radio.js +14 -0
- package/lib/components/ui/RangeDatePicker.d.ts +78 -0
- package/lib/components/ui/RangeDatePicker.js +68 -0
- package/lib/components/ui/Select.d.ts +13 -0
- package/lib/components/ui/Select.js +57 -0
- package/lib/components/ui/Separator.d.ts +4 -0
- package/lib/components/ui/Separator.js +7 -0
- package/lib/components/ui/Sheet.d.ts +26 -0
- package/lib/components/ui/Sheet.js +37 -0
- package/lib/components/ui/StatusCell.d.ts +9 -0
- package/lib/components/ui/StatusCell.js +6 -0
- package/lib/components/ui/Switch.d.ts +10 -0
- package/lib/components/ui/Switch.js +22 -0
- package/lib/components/ui/Tab.d.ts +15 -0
- package/lib/components/ui/Tab.js +13 -0
- package/lib/components/ui/TableDownload.d.ts +11 -0
- package/lib/components/ui/TableDownload.js +82 -0
- package/lib/components/ui/TailwindIndicator.d.ts +1 -0
- package/lib/components/ui/TailwindIndicator.js +6 -0
- package/lib/components/ui/TextField.d.ts +60 -0
- package/lib/components/ui/TextField.js +42 -0
- package/lib/components/ui/Textarea.d.ts +5 -0
- package/lib/components/ui/Textarea.js +8 -0
- package/lib/components/ui/Toast.d.ts +12 -0
- package/lib/components/ui/Toast.js +25 -0
- package/lib/components/ui/UploadField.d.ts +15 -0
- package/lib/components/ui/UploadField.js +45 -0
- package/lib/components/ui/VerticalTab.d.ts +16 -0
- package/lib/components/ui/VerticalTab.js +13 -0
- package/lib/components/ui/index.d.ts +49 -0
- package/lib/components/ui/index.js +47 -0
- package/lib/context/BreadcrumbContext.d.ts +28 -0
- package/lib/context/BreadcrumbContext.js +238 -0
- package/lib/context/FormEngineDrawerProvider.d.ts +21 -0
- package/lib/context/FormEngineDrawerProvider.js +38 -0
- package/lib/context/MultiFormEngineDrawerProvider.d.ts +25 -0
- package/lib/context/MultiFormEngineDrawerProvider.js +89 -0
- package/lib/context/SidebarContext.d.ts +65 -0
- package/lib/context/SidebarContext.js +47 -0
- package/lib/context/ToastContext.d.ts +17 -0
- package/lib/context/ToastContext.js +29 -0
- package/lib/context/index.d.ts +5 -0
- package/lib/context/index.js +5 -0
- package/lib/dashboard-visuals/components/BaseChart.d.ts +55 -0
- package/lib/dashboard-visuals/components/BaseChart.js +201 -0
- package/lib/dashboard-visuals/components/CardWrapper.d.ts +10 -0
- package/lib/dashboard-visuals/components/CardWrapper.js +13 -0
- package/lib/dashboard-visuals/components/ChartDetailsModal.d.ts +57 -0
- package/lib/dashboard-visuals/components/ChartDetailsModal.js +27 -0
- package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.d.ts +29 -0
- package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.js +4 -0
- package/lib/dashboard-visuals/components/ChartFormatter.d.ts +22 -0
- package/lib/dashboard-visuals/components/ChartFormatter.js +46 -0
- package/lib/dashboard-visuals/components/ChartWrapper.d.ts +11 -0
- package/lib/dashboard-visuals/components/ChartWrapper.js +14 -0
- package/lib/dashboard-visuals/components/DashboardFilter.d.ts +8 -0
- package/lib/dashboard-visuals/components/DashboardFilter.js +17 -0
- package/lib/dashboard-visuals/components/DataTable.d.ts +3 -0
- package/lib/dashboard-visuals/components/DataTable.js +57 -0
- package/lib/dashboard-visuals/components/EmptyState.d.ts +6 -0
- package/lib/dashboard-visuals/components/EmptyState.js +6 -0
- package/lib/dashboard-visuals/components/ErrorState.d.ts +7 -0
- package/lib/dashboard-visuals/components/ErrorState.js +5 -0
- package/lib/dashboard-visuals/components/FilterComponentSkeleton.d.ts +3 -0
- package/lib/dashboard-visuals/components/FilterComponentSkeleton.js +11 -0
- package/lib/dashboard-visuals/components/Pagination.d.ts +10 -0
- package/lib/dashboard-visuals/components/Pagination.js +7 -0
- package/lib/dashboard-visuals/components/Switch.d.ts +8 -0
- package/lib/dashboard-visuals/components/Switch.js +10 -0
- package/lib/dashboard-visuals/components/TileSkeleton.d.ts +2 -0
- package/lib/dashboard-visuals/components/TileSkeleton.js +5 -0
- package/lib/dashboard-visuals/components/molecules/Analytics.d.ts +11 -0
- package/lib/dashboard-visuals/components/molecules/Analytics.js +9 -0
- package/lib/dashboard-visuals/components/molecules/DataGrid.d.ts +15 -0
- package/lib/dashboard-visuals/components/molecules/DataGrid.js +124 -0
- package/lib/dashboard-visuals/components/molecules/NoChartData.d.ts +6 -0
- package/lib/dashboard-visuals/components/molecules/NoChartData.js +6 -0
- package/lib/dashboard-visuals/components/molecules/VisualChart.d.ts +16 -0
- package/lib/dashboard-visuals/components/molecules/VisualChart.js +8 -0
- package/lib/dashboard-visuals/components/types.d.ts +62 -0
- package/lib/dashboard-visuals/components/types.js +1 -0
- package/lib/dashboard-visuals/hooks/useChartData.d.ts +15 -0
- package/lib/dashboard-visuals/hooks/useChartData.js +82 -0
- package/lib/dashboard-visuals/hooks/useTooltipFormatter.d.ts +13 -0
- package/lib/dashboard-visuals/hooks/useTooltipFormatter.js +10 -0
- package/lib/dashboard-visuals/index.d.ts +39 -0
- package/lib/dashboard-visuals/index.js +168 -0
- package/lib/dashboard-visuals/types/index.d.ts +83 -0
- package/lib/dashboard-visuals/types/index.js +1 -0
- package/lib/dashboard-visuals/types/metricDetailData.d.ts +25 -0
- package/lib/dashboard-visuals/types/metricDetailData.js +1 -0
- package/lib/dashboard-visuals/utils/api.d.ts +5 -0
- package/lib/dashboard-visuals/utils/api.js +6 -0
- package/lib/dashboard-visuals/utils/chartOptions.d.ts +481 -0
- package/lib/dashboard-visuals/utils/chartOptions.js +393 -0
- package/lib/dashboard-visuals/utils/chunkArray.d.ts +1 -0
- package/lib/dashboard-visuals/utils/chunkArray.js +7 -0
- package/lib/dashboard-visuals/utils/defaultColors.d.ts +1 -0
- package/lib/dashboard-visuals/utils/defaultColors.js +1 -0
- package/lib/dashboard-visuals/utils/formatUtil.d.ts +203 -0
- package/lib/dashboard-visuals/utils/formatUtil.js +472 -0
- package/lib/dashboard-visuals/utils/gridUtil.d.ts +11 -0
- package/lib/dashboard-visuals/utils/gridUtil.js +32 -0
- package/lib/dashboard-visuals/utils/index.d.ts +6 -0
- package/lib/dashboard-visuals/utils/index.js +6 -0
- package/lib/dashboard-visuals/utils/tooltipUtils.d.ts +11 -0
- package/lib/dashboard-visuals/utils/tooltipUtils.js +180 -0
- package/lib/dashboard-visuals/visualRegistry.d.ts +4 -0
- package/lib/dashboard-visuals/visualRegistry.js +41 -0
- package/lib/dashboard-visuals/visuals/BarChart.d.ts +58 -0
- package/lib/dashboard-visuals/visuals/BarChart.js +95 -0
- package/lib/dashboard-visuals/visuals/BarLineHybridChart.d.ts +33 -0
- package/lib/dashboard-visuals/visuals/BarLineHybridChart.js +60 -0
- package/lib/dashboard-visuals/visuals/BubbleChart.d.ts +25 -0
- package/lib/dashboard-visuals/visuals/BubbleChart.js +101 -0
- package/lib/dashboard-visuals/visuals/DistributionChart.d.ts +11 -0
- package/lib/dashboard-visuals/visuals/DistributionChart.js +48 -0
- package/lib/dashboard-visuals/visuals/DonutChart.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/DonutChart.js +105 -0
- package/lib/dashboard-visuals/visuals/GaugeChart.d.ts +32 -0
- package/lib/dashboard-visuals/visuals/GaugeChart.js +53 -0
- package/lib/dashboard-visuals/visuals/GroupedBarChart.d.ts +47 -0
- package/lib/dashboard-visuals/visuals/GroupedBarChart.js +131 -0
- package/lib/dashboard-visuals/visuals/HeatmapChart.d.ts +79 -0
- package/lib/dashboard-visuals/visuals/HeatmapChart.js +146 -0
- package/lib/dashboard-visuals/visuals/HorizontalBarChart.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/HorizontalBarChart.js +131 -0
- package/lib/dashboard-visuals/visuals/ItemPerformanceCard.d.ts +30 -0
- package/lib/dashboard-visuals/visuals/ItemPerformanceCard.js +31 -0
- package/lib/dashboard-visuals/visuals/LineChart.d.ts +56 -0
- package/lib/dashboard-visuals/visuals/LineChart.js +80 -0
- package/lib/dashboard-visuals/visuals/LineGraph.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/LineGraph.js +189 -0
- package/lib/dashboard-visuals/visuals/MetricSummaryCard.d.ts +14 -0
- package/lib/dashboard-visuals/visuals/MetricSummaryCard.js +8 -0
- package/lib/dashboard-visuals/visuals/MultiGaugeChart.d.ts +39 -0
- package/lib/dashboard-visuals/visuals/MultiGaugeChart.js +119 -0
- package/lib/dashboard-visuals/visuals/PieChart.d.ts +59 -0
- package/lib/dashboard-visuals/visuals/PieChart.js +194 -0
- package/lib/dashboard-visuals/visuals/SelectedEventTile.d.ts +14 -0
- package/lib/dashboard-visuals/visuals/SelectedEventTile.js +35 -0
- package/lib/dashboard-visuals/visuals/SpeedometerChart.d.ts +53 -0
- package/lib/dashboard-visuals/visuals/SpeedometerChart.js +94 -0
- package/lib/dashboard-visuals/visuals/Table.d.ts +26 -0
- package/lib/dashboard-visuals/visuals/Table.js +113 -0
- package/lib/dashboard-visuals/visuals/Tile.d.ts +16 -0
- package/lib/dashboard-visuals/visuals/Tile.js +16 -0
- package/lib/dashboard-visuals/visuals/TreeMap.d.ts +25 -0
- package/lib/dashboard-visuals/visuals/TreeMap.js +45 -0
- package/lib/dashboard-visuals/visuals/WaterfallChart.d.ts +52 -0
- package/lib/dashboard-visuals/visuals/WaterfallChart.js +266 -0
- package/lib/form-engine/Form.d.ts +4 -0
- package/lib/form-engine/Form.js +14 -0
- package/lib/form-engine/FormEngine.d.ts +3 -0
- package/lib/form-engine/FormEngine.js +121 -0
- package/lib/form-engine/components/FieldWrapper.d.ts +18 -0
- package/lib/form-engine/components/FieldWrapper.js +63 -0
- package/lib/form-engine/components/index.d.ts +2 -0
- package/lib/form-engine/components/index.js +2 -0
- package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.d.ts +16 -0
- package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.js +48 -0
- package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.js +5 -0
- package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.js +82 -0
- package/lib/form-engine/components/inputs/date-input/DateInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/date-input/DateInput.js +7 -0
- package/lib/form-engine/components/inputs/date-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/date-input/index.js +1 -0
- package/lib/form-engine/components/inputs/email-input/EmailInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/email-input/EmailInput.js +5 -0
- package/lib/form-engine/components/inputs/email-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/email-input/index.js +1 -0
- package/lib/form-engine/components/inputs/index.d.ts +13 -0
- package/lib/form-engine/components/inputs/index.js +13 -0
- package/lib/form-engine/components/inputs/label-input/LabelInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/label-input/LabelInput.js +7 -0
- package/lib/form-engine/components/inputs/label-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/label-input/index.js +1 -0
- package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.js +5 -0
- package/lib/form-engine/components/inputs/number-input/NumberInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/number-input/NumberInput.js +5 -0
- package/lib/form-engine/components/inputs/number-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/number-input/index.js +1 -0
- package/lib/form-engine/components/inputs/password-input/PasswordInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/password-input/PasswordInput.js +9 -0
- package/lib/form-engine/components/inputs/password-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/password-input/index.js +1 -0
- package/lib/form-engine/components/inputs/radio-button/RadioInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/radio-button/RadioInput.js +6 -0
- package/lib/form-engine/components/inputs/radio-button/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/radio-button/index.js +1 -0
- package/lib/form-engine/components/inputs/select/SelectInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/select/SelectInput.js +6 -0
- package/lib/form-engine/components/inputs/select/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/select/index.js +1 -0
- package/lib/form-engine/components/inputs/textarea-input/TextareaInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/textarea-input/TextareaInput.js +5 -0
- package/lib/form-engine/components/inputs/textarea-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/textarea-input/index.js +1 -0
- package/lib/form-engine/components/inputs/time-input/TimeInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/time-input/TimeInput.js +5 -0
- package/lib/form-engine/components/inputs/time-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/time-input/index.js +1 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.js +7 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/index.js +1 -0
- package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.d.ts +4 -0
- package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.js +59 -0
- package/lib/form-engine/components/inputs/upload-field/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/upload-field/index.js +1 -0
- package/lib/form-engine/hooks/useFormPersistence.d.ts +11 -0
- package/lib/form-engine/hooks/useFormPersistence.js +46 -0
- package/lib/form-engine/index.d.ts +5 -0
- package/lib/form-engine/index.js +5 -0
- package/lib/form-engine/registry/RegisterComponents.d.ts +1 -0
- package/lib/form-engine/registry/RegisterComponents.js +35 -0
- package/lib/form-engine/registry/Registry.d.ts +5 -0
- package/lib/form-engine/registry/Registry.js +13 -0
- package/lib/form-engine/registry/index.d.ts +2 -0
- package/lib/form-engine/registry/index.js +2 -0
- package/lib/form-engine/types/index.d.ts +311 -0
- package/lib/form-engine/types/index.js +1 -0
- package/lib/helpers/index.d.ts +2 -0
- package/lib/helpers/index.js +2 -0
- package/lib/helpers/utils.d.ts +37 -0
- package/lib/helpers/utils.js +77 -0
- package/lib/helpers/validations.d.ts +80 -0
- package/lib/helpers/validations.js +39 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +30 -0
- package/lib/mocks/mockApiRequestsConfig.d.ts +2 -0
- package/lib/mocks/mockApiRequestsConfig.js +343 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.d.ts +14 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.js +40 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/index.d.ts +11 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/index.js +7 -0
- package/lib/pagamio-drawer/components/BaseDrawer.d.ts +11 -0
- package/lib/pagamio-drawer/components/BaseDrawer.js +10 -0
- package/lib/pagamio-drawer/components/DrawerContent.d.ts +27 -0
- package/lib/pagamio-drawer/components/DrawerContent.js +237 -0
- package/lib/pagamio-drawer/index.d.ts +22 -0
- package/lib/pagamio-drawer/index.js +133 -0
- package/lib/pagamio-table/data-table/ExportButton.d.ts +57 -0
- package/lib/pagamio-table/data-table/ExportButton.js +96 -0
- package/lib/pagamio-table/data-table/MantineCoreTable.d.ts +44 -0
- package/lib/pagamio-table/data-table/MantineCoreTable.js +129 -0
- package/lib/pagamio-table/data-table/Pagination.d.ts +10 -0
- package/lib/pagamio-table/data-table/Pagination.js +5 -0
- package/lib/pagamio-table/data-table/TableDownload.d.ts +8 -0
- package/lib/pagamio-table/data-table/TableDownload.js +81 -0
- package/lib/pagamio-table/data-table/TableToolbar.d.ts +3 -0
- package/lib/pagamio-table/data-table/TableToolbar.js +16 -0
- package/lib/pagamio-table/data-table/exportUtils.d.ts +42 -0
- package/lib/pagamio-table/data-table/exportUtils.js +782 -0
- package/lib/pagamio-table/data-table/index.d.ts +5 -0
- package/lib/pagamio-table/data-table/index.js +11 -0
- package/lib/pagamio-table/data-table/pdfExportUtils.d.ts +111 -0
- package/lib/pagamio-table/data-table/pdfExportUtils.js +113 -0
- package/lib/pagamio-table/data-table/types.d.ts +169 -0
- package/lib/pagamio-table/data-table/types.js +1 -0
- package/lib/pagamio-table/index.d.ts +4 -0
- package/lib/pagamio-table/index.js +4 -0
- package/lib/pagamio-table/utils/functionHelper.d.ts +12 -0
- package/lib/pagamio-table/utils/functionHelper.js +24 -0
- package/lib/pagamio-table/utils/index.d.ts +1 -0
- package/lib/pagamio-table/utils/index.js +1 -0
- package/lib/rbac/hooks.d.ts +39 -0
- package/lib/rbac/hooks.js +51 -0
- package/lib/rbac/index.d.ts +8 -0
- package/lib/rbac/index.js +11 -0
- package/lib/rbac/store.d.ts +24 -0
- package/lib/rbac/store.js +37 -0
- package/lib/rbac/types.d.ts +39 -0
- package/lib/rbac/types.js +4 -0
- package/lib/rbac/utils.d.ts +44 -0
- package/lib/rbac/utils.js +117 -0
- package/lib/shared/constants/index.d.ts +2 -0
- package/lib/shared/constants/index.js +2 -0
- package/lib/shared/hooks/index.d.ts +4 -0
- package/lib/shared/hooks/index.js +4 -0
- package/lib/shared/hooks/useAnyDrawerOpen.d.ts +4 -0
- package/lib/shared/hooks/useAnyDrawerOpen.js +18 -0
- package/lib/shared/hooks/useContainerWidth.d.ts +2 -0
- package/lib/shared/hooks/useContainerWidth.js +18 -0
- package/lib/shared/hooks/useImageUpload.d.ts +15 -0
- package/lib/shared/hooks/useImageUpload.js +66 -0
- package/lib/shared/hooks/useMediaQueries.d.ts +5 -0
- package/lib/shared/hooks/useMediaQueries.js +35 -0
- package/lib/shared/hooks/usePagamioTable.d.ts +158 -0
- package/lib/shared/hooks/usePagamioTable.js +475 -0
- package/lib/shared/hooks/useSessionTimer.d.ts +33 -0
- package/lib/shared/hooks/useSessionTimer.js +96 -0
- package/lib/shared/index.d.ts +4 -0
- package/lib/shared/index.js +4 -0
- package/lib/shared/types/index.d.ts +1 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/shared/url/index.d.ts +9 -0
- package/lib/shared/url/index.js +20 -0
- package/lib/shared/utils/filterUtils.d.ts +5 -0
- package/lib/shared/utils/filterUtils.js +31 -0
- package/lib/shared/utils/functionHelper.d.ts +27 -0
- package/lib/shared/utils/functionHelper.js +124 -0
- package/lib/shared/utils/index.d.ts +2 -0
- package/lib/shared/utils/index.js +2 -0
- package/lib/shared/utils/localStorage.d.ts +53 -0
- package/lib/shared/utils/localStorage.js +139 -0
- package/lib/styles.css +6247 -0
- package/lib/translations/components/LocaleSwitcher.d.ts +7 -0
- package/lib/translations/components/LocaleSwitcher.js +18 -0
- package/lib/translations/components/index.d.ts +1 -0
- package/lib/translations/components/index.js +1 -0
- package/lib/translations/context/TranslationContext.d.ts +5 -0
- package/lib/translations/context/TranslationContext.js +151 -0
- package/lib/translations/context/index.d.ts +1 -0
- package/lib/translations/context/index.js +1 -0
- package/lib/translations/hooks/index.d.ts +2 -0
- package/lib/translations/hooks/index.js +2 -0
- package/lib/translations/hooks/useLibTranslations.d.ts +7 -0
- package/lib/translations/hooks/useLibTranslations.js +46 -0
- package/lib/translations/hooks/useTranslation.d.ts +7 -0
- package/lib/translations/hooks/useTranslation.js +11 -0
- package/lib/translations/index.d.ts +91 -0
- package/lib/translations/index.js +11 -0
- package/lib/translations/locales/en.json +21 -0
- package/lib/translations/locales/es.json +21 -0
- package/lib/translations/locales/fr.json +21 -0
- package/lib/translations/locales/pt.json +21 -0
- package/lib/translations/types/index.d.ts +24 -0
- package/lib/translations/types/index.js +1 -0
- package/lib/translations/utils/index.d.ts +6 -0
- package/lib/translations/utils/index.js +25 -0
- package/package.json +9 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// BaseChart.tsx
|
|
3
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import Card from '../components/CardWrapper';
|
|
5
|
+
import ChartDetailsModal from '../components/ChartDetailsModal';
|
|
6
|
+
import ChartWrapper from '../components/ChartWrapper';
|
|
7
|
+
import { useChartData } from '../hooks/useChartData';
|
|
8
|
+
import { DashboardPaths, formatDonutChartData } from '../utils';
|
|
9
|
+
import { getChartBarOptions, getLargeDatasetChartOptions } from '../utils/chartOptions';
|
|
10
|
+
import { createTooltipFormatter, processTooltipFields } from '../utils/tooltipUtils';
|
|
11
|
+
import { sortMetricData } from '../visuals/HorizontalBarChart';
|
|
12
|
+
const BaseChart = ({ title, url = DashboardPaths.QUERY, query, chartDetails, children, detailsModalTitle, statisticsUrl = DashboardPaths.METRICS, itemStatisticsQuery, valueMetricsQuery, averageMetricsQuery, distributionMetricsQuery, yAxisDataNameKey, xAxisNameKey, xAxisLabel, yAxisLabel, nameKey, valueKey, dataGridSearchKey, dataGridColumns, dataSearchInputPlaceHolder, chartToolTip, detailsTableTitle, getChartOptions, tooltipValueFormat = 'value', tooltipTitle = 'Value', tooltipUnit = '', tooltipAdditionalFields = [], topFivePerformingChartTitle, bottomFivePerformingChartTitle, distributionChartTooltip, showDetailsModal = true, currencyDisplaySymbol, ...props }) => {
|
|
13
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
14
|
+
const { data: metricData = [], error, isEmpty, loading, refresh } = useChartData(url, query);
|
|
15
|
+
// Process tooltip fields
|
|
16
|
+
const processedTooltipFields = useMemo(() => processTooltipFields(tooltipAdditionalFields), [tooltipAdditionalFields]);
|
|
17
|
+
const processedDistributionTooltipFields = useMemo(() => processTooltipFields(distributionChartTooltip.tooltipAdditionalFields), [distributionChartTooltip.tooltipAdditionalFields]);
|
|
18
|
+
// Create tooltip formatter function
|
|
19
|
+
const tooltipFormatterFn = useMemo(() => {
|
|
20
|
+
// Use the currency from metricData, or fallback to a default
|
|
21
|
+
const currency = metricData?.[0]?.currency || 'ZAR';
|
|
22
|
+
return createTooltipFormatter(tooltipValueFormat, tooltipTitle, tooltipUnit, processedTooltipFields, metricData, currency, currencyDisplaySymbol);
|
|
23
|
+
}, [tooltipValueFormat, tooltipTitle, tooltipUnit, processedTooltipFields, metricData, currencyDisplaySymbol]);
|
|
24
|
+
// Get full data for detailed view
|
|
25
|
+
const { data: fullMetricData = [], error: fullDataError, isEmpty: isfullMetricDataEmpty, loading: isLoadingFullMetricData, refresh: refreshFullMetricData, } = useChartData(url, {
|
|
26
|
+
...query,
|
|
27
|
+
limit: undefined,
|
|
28
|
+
});
|
|
29
|
+
// Get item Statistics Query data for detailed view
|
|
30
|
+
const { data: itemStatData, error: itemStatDataError, isEmpty: isitemStatMetricDataEmpty, loading: isLoadingItemStatlMetricData, refresh: refreshItemStatMetricData, } = useChartData(statisticsUrl, {
|
|
31
|
+
...itemStatisticsQuery.query,
|
|
32
|
+
});
|
|
33
|
+
// Get value Metrics Query data for detailed view
|
|
34
|
+
const { data: valueStatData, error: valueStatDataError, isEmpty: isValueStatMetricDataEmpty, loading: isLoadingValueStatlMetricData, refresh: refreshValueStatMetricData, } = useChartData(statisticsUrl, {
|
|
35
|
+
...valueMetricsQuery.query,
|
|
36
|
+
});
|
|
37
|
+
// Get average Metrics Query data for detailed view
|
|
38
|
+
const { data: averageStatData, error: averageStatDataError, isEmpty: isAverageStatMetricDataEmpty, loading: isLoadingAverageStatlMetricData, refresh: refreshAverageStatMetricData, } = useChartData(statisticsUrl, {
|
|
39
|
+
...averageMetricsQuery.query,
|
|
40
|
+
});
|
|
41
|
+
// Get distribution Metrics Query data for detailed view
|
|
42
|
+
const { data: distributionStatData, error: distributionStatDataError, isEmpty: isDistributionStatMetricDataEmpty, loading: isLoadingDistributionStatlMetricData, refresh: refreshDistributionStatMetricData, } = useChartData(url, {
|
|
43
|
+
...distributionMetricsQuery.query,
|
|
44
|
+
});
|
|
45
|
+
const distributionMetricData = useMemo(() => {
|
|
46
|
+
const formattedData = formatDonutChartData(distributionStatData ?? [], distributionMetricsQuery.xAxisDataValueKey, distributionMetricsQuery.seriesDataValueKey);
|
|
47
|
+
const { tooltipValueFormat, tooltipTitle, tooltipUnit, treeMapSegmentLabel } = distributionChartTooltip;
|
|
48
|
+
const labelFormatter = (params) => {
|
|
49
|
+
const formattedValue = params.value.toLocaleString();
|
|
50
|
+
return `${params.name}\n${treeMapSegmentLabel}: ${formattedValue}`;
|
|
51
|
+
};
|
|
52
|
+
const tooltipFormatter = createTooltipFormatter(tooltipValueFormat, tooltipTitle, tooltipUnit, processedDistributionTooltipFields, distributionStatData ?? [], distributionStatData?.[0]?.currency, currencyDisplaySymbol);
|
|
53
|
+
const distributionMetricOptions = getLargeDatasetChartOptions({
|
|
54
|
+
data: formattedData,
|
|
55
|
+
labelFormatter,
|
|
56
|
+
tooltipFormatter,
|
|
57
|
+
});
|
|
58
|
+
return distributionMetricOptions;
|
|
59
|
+
}, [
|
|
60
|
+
distributionStatData,
|
|
61
|
+
distributionMetricsQuery.seriesDataValueKey,
|
|
62
|
+
distributionMetricsQuery.xAxisDataValueKey,
|
|
63
|
+
currencyDisplaySymbol,
|
|
64
|
+
]);
|
|
65
|
+
const fullChartOptions = useMemo(() => {
|
|
66
|
+
const chartOptions = getChartOptions(fullMetricData);
|
|
67
|
+
return chartOptions;
|
|
68
|
+
}, [fullMetricData]);
|
|
69
|
+
const createChartOptions = useCallback((data, title, colorScheme, metricDetailData, tooltipConfig) => {
|
|
70
|
+
const currency = data?.[0]?.currency;
|
|
71
|
+
const formatterFn = tooltipConfig
|
|
72
|
+
? createTooltipFormatter(tooltipValueFormat, tooltipConfig.tooltipTitle ?? tooltipTitle, tooltipConfig.tooltipUnit ?? tooltipUnit, tooltipConfig.tooltipFields ?? processedTooltipFields, tooltipConfig.data ?? data, currency, currencyDisplaySymbol)
|
|
73
|
+
: tooltipFormatterFn;
|
|
74
|
+
return getChartBarOptions({
|
|
75
|
+
title,
|
|
76
|
+
colorScheme,
|
|
77
|
+
yAxisDataNameKey: metricDetailData.yAxisDataNameKey,
|
|
78
|
+
xAxisNameKey: metricDetailData.xAxisNameKey,
|
|
79
|
+
xAxisLabel: metricDetailData.xAxisLabel,
|
|
80
|
+
yAxisLabel: metricDetailData.yAxisLabel,
|
|
81
|
+
chartToolTip: {
|
|
82
|
+
...metricDetailData.chartToolTip,
|
|
83
|
+
formatter: formatterFn,
|
|
84
|
+
},
|
|
85
|
+
data,
|
|
86
|
+
});
|
|
87
|
+
}, [tooltipFormatterFn, tooltipTitle, tooltipUnit, processedTooltipFields]);
|
|
88
|
+
const createChartOptionsWithData = useCallback((data, tooltipConfig) => createChartOptions(data, title, ['#60A5FA', '#93C5FD'], {
|
|
89
|
+
yAxisDataNameKey,
|
|
90
|
+
xAxisNameKey,
|
|
91
|
+
xAxisLabel,
|
|
92
|
+
yAxisLabel,
|
|
93
|
+
chartToolTip,
|
|
94
|
+
}, tooltipConfig), [title, yAxisDataNameKey, xAxisNameKey, xAxisLabel, yAxisLabel, chartToolTip, createChartOptions]);
|
|
95
|
+
const sortedFullMetricData = useMemo(() => sortMetricData(fullMetricData, valueKey, 'desc'), [fullMetricData, valueKey]);
|
|
96
|
+
const { topFiveItems, bottomFiveItems } = useMemo(() => {
|
|
97
|
+
if (!sortedFullMetricData || sortedFullMetricData.length === 0) {
|
|
98
|
+
return {
|
|
99
|
+
topFiveItems: [],
|
|
100
|
+
bottomFiveItems: [],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const topFiveMetric = sortedFullMetricData.slice(0, 5);
|
|
104
|
+
const bottomFiveMetric = sortedFullMetricData.slice(-5).reverse();
|
|
105
|
+
return {
|
|
106
|
+
topFiveItems: createChartOptionsWithData(topFiveMetric, {
|
|
107
|
+
tooltipTitle: topFivePerformingChartTitle,
|
|
108
|
+
tooltipUnit,
|
|
109
|
+
tooltipFields: processedTooltipFields,
|
|
110
|
+
data: topFiveMetric,
|
|
111
|
+
}),
|
|
112
|
+
bottomFiveItems: createChartOptionsWithData(bottomFiveMetric, {
|
|
113
|
+
tooltipTitle: bottomFivePerformingChartTitle,
|
|
114
|
+
tooltipUnit,
|
|
115
|
+
tooltipFields: processedTooltipFields,
|
|
116
|
+
data: bottomFiveMetric,
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
}, [
|
|
120
|
+
sortedFullMetricData,
|
|
121
|
+
createChartOptionsWithData,
|
|
122
|
+
tooltipUnit,
|
|
123
|
+
processedTooltipFields,
|
|
124
|
+
topFivePerformingChartTitle,
|
|
125
|
+
bottomFivePerformingChartTitle,
|
|
126
|
+
]);
|
|
127
|
+
const itemMetricsData = {
|
|
128
|
+
value: itemStatData?.[itemStatisticsQuery.valueKey] ?? 0,
|
|
129
|
+
previousValue: itemStatisticsQuery.previousValueKey
|
|
130
|
+
? (itemStatData?.[itemStatisticsQuery.previousValueKey] ?? 0)
|
|
131
|
+
: undefined,
|
|
132
|
+
change: itemStatData?.[itemStatisticsQuery.changeKey] ?? 0,
|
|
133
|
+
currency: itemStatData?.additionalData?.currency,
|
|
134
|
+
};
|
|
135
|
+
const valueMetricsData = {
|
|
136
|
+
value: valueStatData?.[valueMetricsQuery.valueKey] ?? 0,
|
|
137
|
+
previousValue: valueMetricsQuery.previousValueKey
|
|
138
|
+
? (valueStatData?.[valueMetricsQuery.previousValueKey] ?? 0)
|
|
139
|
+
: undefined,
|
|
140
|
+
change: valueStatData?.[valueMetricsQuery.changeKey] ?? 0,
|
|
141
|
+
currency: valueStatData?.additionalData?.currency,
|
|
142
|
+
};
|
|
143
|
+
const averageMetricsData = {
|
|
144
|
+
value: averageStatData?.[averageMetricsQuery.valueKey] ?? 0,
|
|
145
|
+
previousValue: averageMetricsQuery.previousValueKey
|
|
146
|
+
? (averageStatData?.[averageMetricsQuery.previousValueKey] ?? 0)
|
|
147
|
+
: undefined,
|
|
148
|
+
change: averageStatData?.[averageMetricsQuery.changeKey] ?? 0,
|
|
149
|
+
currency: averageStatData?.additionalData?.currency,
|
|
150
|
+
};
|
|
151
|
+
return (_jsxs(_Fragment, { children: [_jsx(Card, { title: title, ...props, onOpenDetails: metricData.length > 0 && showDetailsModal ? () => setIsModalOpen(true) : undefined, children: _jsx(ChartWrapper, { loading: loading, error: error, isEmpty: isEmpty, onRetry: refresh, children: children({
|
|
152
|
+
loading,
|
|
153
|
+
error,
|
|
154
|
+
isEmpty,
|
|
155
|
+
refresh,
|
|
156
|
+
metricData,
|
|
157
|
+
tooltipFormatterFn,
|
|
158
|
+
processedTooltipFields,
|
|
159
|
+
}) }) }), showDetailsModal && (_jsx(ChartDetailsModal, { title: detailsModalTitle, isOpen: isModalOpen, onClose: () => setIsModalOpen(false), data: fullMetricData, columns: dataGridColumns, error: fullDataError, isEmpty: isfullMetricDataEmpty, loading: isLoadingFullMetricData, detailsTableTitle: detailsTableTitle, refresh: refreshFullMetricData, renderDetailsChart: fullMetricData.length <= 40, chartData: fullChartOptions, topFivePerformingChartTitle: topFivePerformingChartTitle, bottomFivePerformingChartTitle: bottomFivePerformingChartTitle, top5PerformingItems: topFiveItems, bottom5NonPerformingItems: bottomFiveItems, valueKey: valueKey, dataGridQuery: query, searchKey: dataGridSearchKey, searchInputPlaceHolder: dataSearchInputPlaceHolder, itemMetricsData: {
|
|
160
|
+
...itemMetricsData,
|
|
161
|
+
title: itemStatisticsQuery.title,
|
|
162
|
+
format: itemStatisticsQuery.format,
|
|
163
|
+
isEmpty: isitemStatMetricDataEmpty,
|
|
164
|
+
loading: isLoadingItemStatlMetricData,
|
|
165
|
+
error: itemStatDataError,
|
|
166
|
+
refresh: () => {
|
|
167
|
+
refreshItemStatMetricData().catch(() => { });
|
|
168
|
+
},
|
|
169
|
+
}, valueMetricsData: {
|
|
170
|
+
...valueMetricsData,
|
|
171
|
+
title: valueMetricsQuery.title,
|
|
172
|
+
format: valueMetricsQuery.format,
|
|
173
|
+
isEmpty: isValueStatMetricDataEmpty,
|
|
174
|
+
loading: isLoadingValueStatlMetricData,
|
|
175
|
+
error: valueStatDataError,
|
|
176
|
+
refresh: () => {
|
|
177
|
+
refreshValueStatMetricData().catch(() => { });
|
|
178
|
+
},
|
|
179
|
+
}, averageMetricsData: {
|
|
180
|
+
...averageMetricsData,
|
|
181
|
+
title: averageMetricsQuery.title,
|
|
182
|
+
format: averageMetricsQuery.format,
|
|
183
|
+
isEmpty: isAverageStatMetricDataEmpty,
|
|
184
|
+
loading: isLoadingAverageStatlMetricData,
|
|
185
|
+
error: averageStatDataError,
|
|
186
|
+
refresh: () => {
|
|
187
|
+
refreshAverageStatMetricData().catch(() => { });
|
|
188
|
+
},
|
|
189
|
+
}, distributionMetricsData: {
|
|
190
|
+
data: distributionMetricData ?? [],
|
|
191
|
+
title: distributionMetricsQuery.title,
|
|
192
|
+
isEmpty: isDistributionStatMetricDataEmpty,
|
|
193
|
+
loading: isLoadingDistributionStatlMetricData,
|
|
194
|
+
error: distributionStatDataError,
|
|
195
|
+
refresh: () => {
|
|
196
|
+
refreshDistributionStatMetricData().catch(() => { });
|
|
197
|
+
},
|
|
198
|
+
chartToolTip: distributionMetricsQuery.chartToolTip,
|
|
199
|
+
} }))] }));
|
|
200
|
+
};
|
|
201
|
+
export default BaseChart;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExternalLinkIcon } from '@radix-ui/react-icons';
|
|
3
|
+
import { Card as FlowbiteCard } from 'flowbite-react';
|
|
4
|
+
const Card = ({ title, children, onOpenDetails, className, showDetailsModal = true }) => {
|
|
5
|
+
return (_jsxs(FlowbiteCard, { className: `relative w-full sm:w-auto ${className} border-b-4 border-b-primary-500`, style: {
|
|
6
|
+
height: '100%',
|
|
7
|
+
}, theme: {
|
|
8
|
+
root: {
|
|
9
|
+
children: 'p-3 gap-1',
|
|
10
|
+
},
|
|
11
|
+
}, children: [title && (_jsxs("div", { className: "mb-1 flex justify-between", children: [_jsx("h3", { className: "text-[15px] text-bold font-medium", children: title }), onOpenDetails && showDetailsModal && (_jsx("button", { onClick: onOpenDetails, className: "text-gray-500 hover:text-gray-700 focus:outline-none", "aria-label": "Open in new window", children: _jsx(ExternalLinkIcon, { className: "h-5 w-5" }) }))] })), children] }));
|
|
12
|
+
};
|
|
13
|
+
export default Card;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ApiErrorResponse } from '../../api';
|
|
3
|
+
import type { QueryProps } from '../../shared/types';
|
|
4
|
+
import type { ChartOptionsProps, ChartToolTipProps } from '../types';
|
|
5
|
+
export type ColumnProps = {
|
|
6
|
+
header: string;
|
|
7
|
+
accessor: string;
|
|
8
|
+
};
|
|
9
|
+
export type StatisticsMetricsProps = {
|
|
10
|
+
title: string;
|
|
11
|
+
format: string;
|
|
12
|
+
value: number;
|
|
13
|
+
previousValue?: number;
|
|
14
|
+
change: number;
|
|
15
|
+
isEmpty: boolean;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
error?: ApiErrorResponse;
|
|
18
|
+
currency?: string;
|
|
19
|
+
refresh: () => void;
|
|
20
|
+
};
|
|
21
|
+
export type DistributionMetricsProps = {
|
|
22
|
+
title: string;
|
|
23
|
+
data: ChartOptionsProps<unknown>;
|
|
24
|
+
isEmpty: boolean;
|
|
25
|
+
loading: boolean;
|
|
26
|
+
error?: ApiErrorResponse;
|
|
27
|
+
refresh: () => void;
|
|
28
|
+
chartToolTip?: ChartToolTipProps;
|
|
29
|
+
};
|
|
30
|
+
interface DetailsModalProps {
|
|
31
|
+
isOpen: boolean;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
error?: ApiErrorResponse;
|
|
34
|
+
isEmpty: boolean;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
refresh: () => void;
|
|
37
|
+
data: any[];
|
|
38
|
+
columns: any[];
|
|
39
|
+
title?: string;
|
|
40
|
+
itemMetricsData: StatisticsMetricsProps;
|
|
41
|
+
valueMetricsData: StatisticsMetricsProps;
|
|
42
|
+
averageMetricsData: StatisticsMetricsProps;
|
|
43
|
+
distributionMetricsData: DistributionMetricsProps;
|
|
44
|
+
chartData: ChartOptionsProps<unknown>;
|
|
45
|
+
top5PerformingItems: ChartOptionsProps<unknown>;
|
|
46
|
+
bottom5NonPerformingItems: ChartOptionsProps<unknown>;
|
|
47
|
+
valueKey: string;
|
|
48
|
+
searchKey: string;
|
|
49
|
+
dataGridQuery: QueryProps;
|
|
50
|
+
searchInputPlaceHolder: string;
|
|
51
|
+
renderDetailsChart: boolean;
|
|
52
|
+
detailsTableTitle?: string;
|
|
53
|
+
topFivePerformingChartTitle?: string;
|
|
54
|
+
bottomFivePerformingChartTitle?: string;
|
|
55
|
+
}
|
|
56
|
+
declare const ChartDetailsModal: React.FC<DetailsModalProps>;
|
|
57
|
+
export default ChartDetailsModal;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal } from 'flowbite-react';
|
|
3
|
+
import { Tab } from '../../components';
|
|
4
|
+
import Analytics from './molecules/Analytics';
|
|
5
|
+
import DataGrid from './molecules/DataGrid';
|
|
6
|
+
import VisualChart from './molecules/VisualChart';
|
|
7
|
+
const ChartDetailsModal = ({ error, isEmpty, loading, refresh, isOpen, onClose, title, itemMetricsData, valueMetricsData, averageMetricsData, distributionMetricsData, data, columns, chartData, top5PerformingItems, bottom5NonPerformingItems, valueKey, searchKey, dataGridQuery, renderDetailsChart, searchInputPlaceHolder, detailsTableTitle, topFivePerformingChartTitle, bottomFivePerformingChartTitle, }) => {
|
|
8
|
+
const tabs = [
|
|
9
|
+
{
|
|
10
|
+
id: 1,
|
|
11
|
+
title: 'Visual Chart',
|
|
12
|
+
content: (_jsx(VisualChart, { loading: loading, error: error, isEmpty: isEmpty, refresh: refresh, chartData: chartData, top5PerformingItems: top5PerformingItems, bottom5NonPerformingItems: bottom5NonPerformingItems, renderChart: renderDetailsChart, topFivePerformingChartTitle: topFivePerformingChartTitle, bottomFivePerformingChartTitle: bottomFivePerformingChartTitle })),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 2,
|
|
16
|
+
title: 'Data Table',
|
|
17
|
+
content: (_jsx(DataGrid, { dataGridQuery: dataGridQuery, columns: columns, searchInputPlaceHolder: searchInputPlaceHolder, searchKey: searchKey, title: detailsTableTitle })),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 3,
|
|
21
|
+
title: 'Analytics',
|
|
22
|
+
content: (_jsx(Analytics, { data: data, valueKey: valueKey, itemMetricsData: itemMetricsData, valueMetricsData: valueMetricsData, averageMetricsData: averageMetricsData, distributionMetricsData: distributionMetricsData })),
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
return (_jsxs(Modal, { show: isOpen, onClose: onClose, size: "7xl", children: [_jsx(Modal.Header, { children: _jsx("div", { className: "flex justify-between items-center w-full", children: _jsxs("h3", { className: "text-xl font-semibold", children: [title, " - Detailed Analysis"] }) }) }), _jsx(Modal.Body, { children: _jsx(Tab, { tabs: tabs, defaultTab: 0 }) })] }));
|
|
26
|
+
};
|
|
27
|
+
export default ChartDetailsModal;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ChartOptionsProps } from '../types';
|
|
2
|
+
interface ChartDetailsModalWrapperProps {
|
|
3
|
+
metricDetailData: any;
|
|
4
|
+
isModalOpen: boolean;
|
|
5
|
+
setIsModalOpen: (open: boolean) => void;
|
|
6
|
+
fullData: any[];
|
|
7
|
+
columns: any[];
|
|
8
|
+
error: any;
|
|
9
|
+
isEmpty: boolean;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
detailsTableTitle?: string;
|
|
12
|
+
refresh: () => void;
|
|
13
|
+
renderDetailsChart: boolean;
|
|
14
|
+
chartData: ChartOptionsProps<unknown>;
|
|
15
|
+
top5PerformingItems: ChartOptionsProps<unknown>;
|
|
16
|
+
bottom5NonPerformingItems: ChartOptionsProps<unknown>;
|
|
17
|
+
valueKey: string;
|
|
18
|
+
dataGridQuery: any;
|
|
19
|
+
searchKey: string;
|
|
20
|
+
searchInputPlaceHolder: string;
|
|
21
|
+
itemMetricsData: any;
|
|
22
|
+
valueMetricsData: any;
|
|
23
|
+
averageMetricsData: any;
|
|
24
|
+
distributionMetricsData: any;
|
|
25
|
+
topFivePerformingChartTitle?: string;
|
|
26
|
+
bottomFivePerformingChartTitle?: string;
|
|
27
|
+
}
|
|
28
|
+
declare const ChartDetailsModalWrapper: ({ metricDetailData, isModalOpen, setIsModalOpen, fullData, columns, error, isEmpty, loading, detailsTableTitle, refresh, renderDetailsChart, chartData, top5PerformingItems, bottom5NonPerformingItems, valueKey, dataGridQuery, searchKey, searchInputPlaceHolder, itemMetricsData, valueMetricsData, averageMetricsData, distributionMetricsData, topFivePerformingChartTitle, bottomFivePerformingChartTitle, }: ChartDetailsModalWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export default ChartDetailsModalWrapper;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ChartDetailsModal from './ChartDetailsModal';
|
|
3
|
+
const ChartDetailsModalWrapper = ({ metricDetailData, isModalOpen, setIsModalOpen, fullData, columns, error, isEmpty, loading, detailsTableTitle, refresh, renderDetailsChart, chartData, top5PerformingItems, bottom5NonPerformingItems, valueKey, dataGridQuery, searchKey, searchInputPlaceHolder, itemMetricsData, valueMetricsData, averageMetricsData, distributionMetricsData, topFivePerformingChartTitle, bottomFivePerformingChartTitle, }) => (_jsx(ChartDetailsModal, { title: metricDetailData.title, isOpen: isModalOpen, onClose: () => setIsModalOpen(false), data: fullData, columns: columns, error: error, isEmpty: isEmpty, loading: loading, detailsTableTitle: detailsTableTitle, refresh: refresh, renderDetailsChart: renderDetailsChart, chartData: chartData, top5PerformingItems: top5PerformingItems, bottom5NonPerformingItems: bottom5NonPerformingItems, valueKey: valueKey, dataGridQuery: dataGridQuery, searchKey: searchKey, searchInputPlaceHolder: searchInputPlaceHolder, itemMetricsData: itemMetricsData, valueMetricsData: valueMetricsData, averageMetricsData: averageMetricsData, distributionMetricsData: distributionMetricsData, topFivePerformingChartTitle: topFivePerformingChartTitle, bottomFivePerformingChartTitle: bottomFivePerformingChartTitle }));
|
|
4
|
+
export default ChartDetailsModalWrapper;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ChartFormatterProps {
|
|
3
|
+
metricData: any[];
|
|
4
|
+
xAxisDataValueKey: string;
|
|
5
|
+
seriesDataNameKey: string;
|
|
6
|
+
seriesDataValueKey: string;
|
|
7
|
+
chartType: 'bar' | 'line';
|
|
8
|
+
chartOptions: any;
|
|
9
|
+
chartHeight?: string | number;
|
|
10
|
+
notMerge?: boolean;
|
|
11
|
+
stacked?: boolean;
|
|
12
|
+
smooth?: boolean;
|
|
13
|
+
symbolConfig?: {
|
|
14
|
+
symbol?: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
color?: string;
|
|
17
|
+
borderColor?: string;
|
|
18
|
+
borderWidth?: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
declare const ChartFormatter: React.FC<ChartFormatterProps>;
|
|
22
|
+
export default ChartFormatter;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactECharts from 'echarts-for-react';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { getBarChartData } from '../utils';
|
|
5
|
+
const ChartFormatter = ({ metricData, xAxisDataValueKey, seriesDataNameKey, seriesDataValueKey, chartType, chartOptions, chartHeight = '350px', notMerge = false, stacked, smooth = false, symbolConfig, }) => {
|
|
6
|
+
const formattedChartData = useMemo(() => {
|
|
7
|
+
if (metricData.length === 0)
|
|
8
|
+
return { xAxisValues: [], seriesData: [] };
|
|
9
|
+
const { xAxisValues, seriesData } = getBarChartData(metricData, xAxisDataValueKey, seriesDataNameKey, seriesDataValueKey);
|
|
10
|
+
let transformedSeries;
|
|
11
|
+
if (chartType === 'bar') {
|
|
12
|
+
transformedSeries = seriesData.map((series) => ({
|
|
13
|
+
...series,
|
|
14
|
+
type: 'bar',
|
|
15
|
+
stack: stacked ? 'stack' : undefined,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
else if (chartType === 'line') {
|
|
19
|
+
transformedSeries = seriesData.map((series) => ({
|
|
20
|
+
...series,
|
|
21
|
+
type: 'line',
|
|
22
|
+
smooth: smooth,
|
|
23
|
+
symbol: symbolConfig?.symbol || 'circle',
|
|
24
|
+
symbolSize: symbolConfig?.size || 8,
|
|
25
|
+
itemStyle: {
|
|
26
|
+
color: symbolConfig?.color,
|
|
27
|
+
borderColor: symbolConfig?.borderColor,
|
|
28
|
+
borderWidth: symbolConfig?.borderWidth || 2,
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
return { xAxisValues, seriesData: transformedSeries };
|
|
33
|
+
}, [metricData, xAxisDataValueKey, seriesDataNameKey, seriesDataValueKey, chartType, stacked, smooth, symbolConfig]);
|
|
34
|
+
const mergedOptions = useMemo(() => {
|
|
35
|
+
return {
|
|
36
|
+
...chartOptions,
|
|
37
|
+
xAxis: {
|
|
38
|
+
...chartOptions.xAxis,
|
|
39
|
+
data: formattedChartData.xAxisValues,
|
|
40
|
+
},
|
|
41
|
+
series: formattedChartData.seriesData,
|
|
42
|
+
};
|
|
43
|
+
}, [chartOptions, formattedChartData]);
|
|
44
|
+
return (_jsx("div", { className: "mt-4", children: _jsx(ReactECharts, { option: mergedOptions, style: { height: chartHeight }, notMerge: notMerge }) }));
|
|
45
|
+
};
|
|
46
|
+
export default ChartFormatter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ApiErrorResponse } from '../../api';
|
|
3
|
+
interface ChartWrapperProps {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: ApiErrorResponse | undefined;
|
|
6
|
+
isEmpty: boolean;
|
|
7
|
+
onRetry: () => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const ChartWrapper: ({ loading, error, isEmpty, onRetry, children }: ChartWrapperProps) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | null | undefined;
|
|
11
|
+
export default ChartWrapper;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import EmptyMetricState from './EmptyState';
|
|
3
|
+
import ErrorState from './ErrorState';
|
|
4
|
+
import TileSkeleton from './TileSkeleton';
|
|
5
|
+
const ChartWrapper = ({ loading, error, isEmpty, onRetry, children }) => {
|
|
6
|
+
if (loading)
|
|
7
|
+
return _jsx(TileSkeleton, {});
|
|
8
|
+
if (error)
|
|
9
|
+
return _jsx(ErrorState, { error: error, onRetry: onRetry });
|
|
10
|
+
if (isEmpty)
|
|
11
|
+
return _jsx(EmptyMetricState, {});
|
|
12
|
+
return children;
|
|
13
|
+
};
|
|
14
|
+
export default ChartWrapper;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FilterConfig } from './types';
|
|
2
|
+
interface DashboardFilterProps {
|
|
3
|
+
filters: FilterConfig[];
|
|
4
|
+
selectedFilters: Record<string, string | string[] | null>;
|
|
5
|
+
handleFilterChange: (name: string, value: string | string[] | null) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const DashboardFilter: ({ filters, selectedFilters, handleFilterChange }: DashboardFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default DashboardFilter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FilterWrapper, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../components';
|
|
3
|
+
import { useMediaQueries } from '../../shared';
|
|
4
|
+
const DashboardFilter = ({ filters, selectedFilters, handleFilterChange }) => {
|
|
5
|
+
const { isSm } = useMediaQueries();
|
|
6
|
+
return (_jsx(FilterWrapper, { isNarrow: isSm, children: filters.length > 0 &&
|
|
7
|
+
filters.map((filterObj) => {
|
|
8
|
+
if (filterObj.type !== 'select') {
|
|
9
|
+
// Handle other filter types if needed
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const { name, options } = filterObj;
|
|
13
|
+
const value = selectedFilters[name];
|
|
14
|
+
return (_jsx("div", { className: isSm ? 'w-full' : 'flex-1 min-w-[150px]', children: _jsxs(Select, { value: value || 'All', onValueChange: (val) => handleFilterChange(name, val), children: [_jsx(SelectTrigger, { className: "w-full bg-white", children: _jsx(SelectValue, { placeholder: `Filter by ${name}` }) }), _jsx(SelectContent, { children: options.map((item) => (_jsx(SelectItem, { value: item.value, children: item.label }, item.value))) })] }, `filter-${name}`) }, name));
|
|
15
|
+
}) }));
|
|
16
|
+
};
|
|
17
|
+
export default DashboardFilter;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ReusableTableProps } from './types';
|
|
2
|
+
declare const ReusableTable: <TData extends Record<string, any>>({ columns, data, title, initialState, enableGlobalSearch, enableColumnFilters, enableSorting, enablePagination, enableRowSelection, enableColumnReordering, enableStickyHeader, tableOptions, }: ReusableTableProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default ReusableTable;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ActionIcon, Text, Tooltip } from '@mantine/core';
|
|
3
|
+
import { IconCopy } from '@tabler/icons-react';
|
|
4
|
+
import { MantineReactTable } from 'mantine-react-table';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
const ReusableTable = ({ columns, data, title, initialState, enableGlobalSearch = false, enableColumnFilters = false, enableSorting = true, enablePagination = false, enableRowSelection = false, enableColumnReordering = false, enableStickyHeader = false, tableOptions, }) => {
|
|
7
|
+
const enhancedColumns = useMemo(() => {
|
|
8
|
+
return columns.map((column) => {
|
|
9
|
+
const extendedColumn = column;
|
|
10
|
+
if (extendedColumn.enableCopy) {
|
|
11
|
+
return {
|
|
12
|
+
...extendedColumn,
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14
|
+
Cell: ({ cell }) => (_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [_jsx("span", { children: cell.getValue() }), _jsx(Tooltip, { label: "Copy", children: _jsx(ActionIcon, { size: "xs", onClick: () => navigator.clipboard.writeText(cell.getValue()), style: { marginLeft: 8 }, children: _jsx(IconCopy, { size: 16 }) }) })] })),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (extendedColumn.formattedCellElement) {
|
|
18
|
+
return {
|
|
19
|
+
...extendedColumn,
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
21
|
+
Cell: ({ cell }) => {
|
|
22
|
+
return extendedColumn.formattedCellElement(cell.getValue());
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return column;
|
|
27
|
+
});
|
|
28
|
+
}, [columns]);
|
|
29
|
+
const memoizedData = useMemo(() => data, [data]);
|
|
30
|
+
const tableOptionsMerged = useMemo(() => ({
|
|
31
|
+
columns: enhancedColumns,
|
|
32
|
+
data: memoizedData,
|
|
33
|
+
initialState,
|
|
34
|
+
enableGlobalFilter: enableGlobalSearch,
|
|
35
|
+
enableColumnFilters,
|
|
36
|
+
enableSorting,
|
|
37
|
+
enablePagination,
|
|
38
|
+
enableRowSelection,
|
|
39
|
+
enableColumnReordering,
|
|
40
|
+
enableStickyHeader,
|
|
41
|
+
...tableOptions,
|
|
42
|
+
}), [
|
|
43
|
+
enhancedColumns,
|
|
44
|
+
memoizedData,
|
|
45
|
+
initialState,
|
|
46
|
+
enableGlobalSearch,
|
|
47
|
+
enableColumnFilters,
|
|
48
|
+
enableSorting,
|
|
49
|
+
enablePagination,
|
|
50
|
+
enableRowSelection,
|
|
51
|
+
enableColumnReordering,
|
|
52
|
+
enableStickyHeader,
|
|
53
|
+
tableOptions,
|
|
54
|
+
]);
|
|
55
|
+
return (_jsx(MantineReactTable, { ...tableOptionsMerged, renderTopToolbarCustomActions: () => title ? (_jsx(Text, { size: "lg", weight: 700, children: title })) : null }));
|
|
56
|
+
};
|
|
57
|
+
export default ReusableTable;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HiOutlineInformationCircle } from 'react-icons/hi';
|
|
3
|
+
const EmptyMetricState = ({ message = 'No metric data available', icon }) => {
|
|
4
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center h-full gap-y-2 text-center pb-4", "aria-live": "polite", "aria-atomic": "true", children: [icon ?? _jsx(HiOutlineInformationCircle, { className: "w-[50px] h-[50px] text-gray-400", "aria-hidden": "true" }), _jsx("div", { className: "space-y-1", children: message && _jsx("p", { className: "text-xs text-gray-500 max-w-[160px] mx-auto", children: message }) })] }));
|
|
5
|
+
};
|
|
6
|
+
export default EmptyMetricState;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApiErrorResponse } from '../../api';
|
|
2
|
+
interface ErrorStateProps {
|
|
3
|
+
error: ApiErrorResponse | Error;
|
|
4
|
+
onRetry?: () => void;
|
|
5
|
+
}
|
|
6
|
+
declare const ErrorState: ({ error, onRetry }: ErrorStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ErrorState;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const ErrorState = ({ error, onRetry }) => {
|
|
3
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center space-y-2 py-4", children: [_jsx("div", { className: "text-red-500 mb-2", children: _jsx("svg", { className: "w-8 h-8", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }) }), _jsx("p", { className: "text-sm text-gray-600 text-center", children: error.message ?? 'Failed to fetch data' }), onRetry && (_jsx("button", { onClick: onRetry, className: "mt-2 px-4 py-2 text-sm text-white bg-blue-500 rounded hover:bg-blue-600 transition-colors", children: "Retry" }))] }));
|
|
4
|
+
};
|
|
5
|
+
export default ErrorState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from 'flowbite-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
const SkeletonItem = () => _jsx("div", { className: "h-6 bg-gray-200 rounded-full w-[16%]" });
|
|
5
|
+
const FilterComponentSkeleton = () => {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
const skeletonItems = Array.from({ length: 4 }, (_, index) => _jsx(SkeletonItem, {}, index));
|
|
8
|
+
return (_jsx(Card, { className: "mb-5", children: _jsx("div", { className: "animate-pulse", children: _jsx("div", { className: "flex space-x-3", children: skeletonItems }) }) }));
|
|
9
|
+
};
|
|
10
|
+
// Wrapping the component with React.memo since it will always render the same output.
|
|
11
|
+
export default React.memo(FilterComponentSkeleton);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PaginationProps {
|
|
3
|
+
currentPage: number;
|
|
4
|
+
pageSize: number;
|
|
5
|
+
totalItems: number;
|
|
6
|
+
onPageChange: (page: number) => void;
|
|
7
|
+
onPageSizeChange: (size: number) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
10
|
+
export default Pagination;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const PAGE_SIZES = [5, 10, 20, 50];
|
|
3
|
+
const Pagination = ({ currentPage, pageSize, totalItems, onPageChange, onPageSizeChange, }) => {
|
|
4
|
+
const totalPages = Math.ceil(totalItems / pageSize);
|
|
5
|
+
return (_jsxs("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4 mt-2 px-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm text-gray-600", children: "Items per page:" }), _jsx("select", { value: pageSize, onChange: (e) => onPageSizeChange(Number(e.target.value)), className: "border rounded-md px-2 py-1 text-sm bg-white", children: PAGE_SIZES.map((size) => (_jsx("option", { value: size, children: size }, size))) })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { onClick: () => onPageChange(currentPage - 1), disabled: currentPage === 1, className: "px-3 py-1 rounded-md border disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50", children: "Previous" }), _jsxs("span", { className: "text-sm text-gray-600", children: ["Page ", currentPage, " of ", totalPages] }), _jsx("button", { onClick: () => onPageChange(currentPage + 1), disabled: currentPage === totalPages, className: "px-3 py-1 rounded-md border disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50", children: "Next" })] })] }));
|
|
6
|
+
};
|
|
7
|
+
export default Pagination;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
const CustomSwitch = ({ checked, onCheckedChange, themeColor }) => {
|
|
4
|
+
return (_jsx(SwitchPrimitive.Root, { className: `relative inline-flex h-6 w-11 items-center rounded-full border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500`, checked: checked, onCheckedChange: onCheckedChange, style: {
|
|
5
|
+
backgroundColor: checked ? themeColor : '#E5E7EB',
|
|
6
|
+
}, children: _jsx(SwitchPrimitive.Thumb, { className: `block h-4 w-4 rounded-full border-transparent bg-white transition-transform ${checked ? 'translate-x-5' : 'translate-x-1'}`, style: {
|
|
7
|
+
border: `2px solid ${themeColor}`,
|
|
8
|
+
} }) }));
|
|
9
|
+
};
|
|
10
|
+
export default CustomSwitch;
|