@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,5 @@
|
|
|
1
|
+
import { type PagamioMantineTableProps } from './types';
|
|
2
|
+
declare const PagamioTable: <T extends {
|
|
3
|
+
id: string | number;
|
|
4
|
+
}>({ columns, data, isLoading, pagination, sorting, filtering, search, exportable, addButton, addText, onAdd, onClearFilters, handleSearchTable, showClearFilters, showApplyFilterButton, searctInputPlaceHolder, expandable, extraExportOptions, pdfExportOptions, xlsxExportOptions, csvExportOptions, renderExpandableComponent, onRowClick, rowClassName, ...props }: PagamioMantineTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default PagamioTable;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMediaQueries } from '../../shared';
|
|
3
|
+
import CoreTable from './MantineCoreTable';
|
|
4
|
+
import TableToolbar from './TableToolbar';
|
|
5
|
+
const PagamioTable = ({ columns, data, isLoading, pagination, sorting, filtering, search, exportable = false, addButton = false, addText, onAdd, onClearFilters, handleSearchTable, showClearFilters = false, showApplyFilterButton = true, searctInputPlaceHolder, expandable = false, extraExportOptions, pdfExportOptions, xlsxExportOptions, csvExportOptions, renderExpandableComponent, onRowClick, rowClassName, ...props }) => {
|
|
6
|
+
const hasPagination = pagination?.enabled;
|
|
7
|
+
const { isSm, isXs } = useMediaQueries();
|
|
8
|
+
const isNarrow = isXs || isSm;
|
|
9
|
+
return (_jsxs("div", { className: "mt-2", children: [_jsx(TableToolbar, { searchable: search?.enabled ?? false, searchQuery: search?.searchQuery ?? '', onSearch: search?.onSearch ?? (() => { }), filters: filtering?.filters ?? [], appliedFilters: filtering?.appliedFilters ?? {}, onTableFilter: filtering?.onTableFilter ?? (() => { }), exportable: exportable, addButton: addButton, addText: addText, onAdd: onAdd ?? (() => { }), handleSearchTable: handleSearchTable, onClearFilters: onClearFilters, showClearFilters: showClearFilters, showApplyFilterButton: showApplyFilterButton, searctInputPlaceHolder: searctInputPlaceHolder, data: data, columns: columns, isNarrow: isNarrow, extraExportOptions: extraExportOptions, pdfExportOptions: pdfExportOptions, xlsxExportOptions: xlsxExportOptions, csvExportOptions: csvExportOptions, exportAll: props.exportAll, fetchData: props.fetchData }), _jsx("div", { className: "border border-gray-200 rounded-md overflow-hidden", children: _jsx(CoreTable, { columns: columns, data: data, isLoading: isLoading, onSort: sorting?.onSort, sortConfig: sorting?.sortConfig ?? null, multiSorting: sorting?.multiSorting || false, sortable: props.sortable, setSortBy: sorting?.setSortBy, setSortDir: sorting?.setSortDir, enablePagination: hasPagination, pagination: pagination, expandable: expandable, onRowClick: onRowClick, rowClassName: rowClassName, renderExpandableComponent: renderExpandableComponent, ...props }) })] }));
|
|
10
|
+
};
|
|
11
|
+
export default PagamioTable;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
interface ClientConfig {
|
|
2
|
+
branding: {
|
|
3
|
+
name: string;
|
|
4
|
+
logo: {
|
|
5
|
+
path: string;
|
|
6
|
+
altText: string;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
navbarLogo?: {
|
|
11
|
+
path: string;
|
|
12
|
+
altText: string;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
theme: {
|
|
18
|
+
colors: {
|
|
19
|
+
primary: {
|
|
20
|
+
500: string;
|
|
21
|
+
600: string;
|
|
22
|
+
700: string;
|
|
23
|
+
};
|
|
24
|
+
core: {
|
|
25
|
+
primary: string;
|
|
26
|
+
secondary: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface CsvExportOptions {
|
|
32
|
+
title?: string;
|
|
33
|
+
includeTimestamp?: boolean;
|
|
34
|
+
includeHeaders?: boolean;
|
|
35
|
+
delimiter?: string;
|
|
36
|
+
filename?: string;
|
|
37
|
+
}
|
|
38
|
+
interface PdfExportOptions {
|
|
39
|
+
title?: string;
|
|
40
|
+
subtitle?: string;
|
|
41
|
+
colors?: {
|
|
42
|
+
primary: {
|
|
43
|
+
500: string;
|
|
44
|
+
600: string;
|
|
45
|
+
700: string;
|
|
46
|
+
};
|
|
47
|
+
core: {
|
|
48
|
+
primary: string;
|
|
49
|
+
secondary: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
logo?: {
|
|
53
|
+
url: string;
|
|
54
|
+
width?: number;
|
|
55
|
+
height?: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
interface XlsxExportOptions {
|
|
59
|
+
title?: string;
|
|
60
|
+
subtitle?: string;
|
|
61
|
+
colors?: {
|
|
62
|
+
primary: {
|
|
63
|
+
500: string;
|
|
64
|
+
600: string;
|
|
65
|
+
700: string;
|
|
66
|
+
};
|
|
67
|
+
core: {
|
|
68
|
+
primary: string;
|
|
69
|
+
secondary: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
sheetName?: string;
|
|
73
|
+
includeTimestamp?: boolean;
|
|
74
|
+
autoFitColumns?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates PDF export options from client configuration
|
|
78
|
+
* @param config - The client configuration object
|
|
79
|
+
* @param title - Optional custom title for the PDF
|
|
80
|
+
* @returns PdfExportOptions object configured with app theme and branding
|
|
81
|
+
*/
|
|
82
|
+
export declare const createPdfExportOptions: (config: ClientConfig, title?: string) => PdfExportOptions;
|
|
83
|
+
/**
|
|
84
|
+
* Creates Excel export options from client configuration
|
|
85
|
+
* @param config - The client configuration object
|
|
86
|
+
* @param title - Optional custom title for the Excel file
|
|
87
|
+
* @param sheetName - Optional custom sheet name
|
|
88
|
+
* @returns XlsxExportOptions object configured with app theme and branding
|
|
89
|
+
*/
|
|
90
|
+
export declare const createXlsxExportOptions: (config: ClientConfig, title?: string, sheetName?: string) => XlsxExportOptions;
|
|
91
|
+
/**
|
|
92
|
+
* Creates Excel export options with fallback values when no config is available
|
|
93
|
+
* @param title - Optional custom title for the Excel file
|
|
94
|
+
* @param sheetName - Optional custom sheet name
|
|
95
|
+
* @returns XlsxExportOptions object with default styling
|
|
96
|
+
*/
|
|
97
|
+
export declare const createDefaultXlsxExportOptions: (title?: string, sheetName?: string) => XlsxExportOptions;
|
|
98
|
+
/**
|
|
99
|
+
* Creates CSV export options from client configuration
|
|
100
|
+
* @param config - The client configuration object
|
|
101
|
+
* @param title - Optional custom title for the CSV file
|
|
102
|
+
* @returns CsvExportOptions object configured with app branding
|
|
103
|
+
*/
|
|
104
|
+
export declare const createCsvExportOptions: (config: ClientConfig, title?: string) => CsvExportOptions;
|
|
105
|
+
/**
|
|
106
|
+
* Creates CSV export options with fallback values when no config is available
|
|
107
|
+
* @param title - Optional custom title for the CSV file
|
|
108
|
+
* @returns CsvExportOptions object with default settings
|
|
109
|
+
*/
|
|
110
|
+
export declare const createDefaultCsvExportOptions: (title?: string) => CsvExportOptions;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Utility functions for PDF export configuration
|
|
2
|
+
/**
|
|
3
|
+
* Creates PDF export options from client configuration
|
|
4
|
+
* @param config - The client configuration object
|
|
5
|
+
* @param title - Optional custom title for the PDF
|
|
6
|
+
* @returns PdfExportOptions object configured with app theme and branding
|
|
7
|
+
*/
|
|
8
|
+
export const createPdfExportOptions = (config, title) => {
|
|
9
|
+
return {
|
|
10
|
+
title: title || `${config.branding.name} Report`,
|
|
11
|
+
subtitle: `Generated on ${new Date().toLocaleDateString('en-US', {
|
|
12
|
+
year: 'numeric',
|
|
13
|
+
month: 'long',
|
|
14
|
+
day: 'numeric',
|
|
15
|
+
hour: '2-digit',
|
|
16
|
+
minute: '2-digit',
|
|
17
|
+
})}`,
|
|
18
|
+
colors: {
|
|
19
|
+
primary: config.theme.colors.primary,
|
|
20
|
+
core: config.theme.colors.core,
|
|
21
|
+
},
|
|
22
|
+
logo: {
|
|
23
|
+
url: config.branding.navbarLogo?.path || config.branding.logo.path,
|
|
24
|
+
width: config.branding.navbarLogo?.width || config.branding.logo.width,
|
|
25
|
+
height: config.branding.navbarLogo?.height || config.branding.logo.height,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Creates Excel export options from client configuration
|
|
31
|
+
* @param config - The client configuration object
|
|
32
|
+
* @param title - Optional custom title for the Excel file
|
|
33
|
+
* @param sheetName - Optional custom sheet name
|
|
34
|
+
* @returns XlsxExportOptions object configured with app theme and branding
|
|
35
|
+
*/
|
|
36
|
+
export const createXlsxExportOptions = (config, title, sheetName) => {
|
|
37
|
+
return {
|
|
38
|
+
title: title || `${config.branding.name} Report`,
|
|
39
|
+
subtitle: `Generated on ${new Date().toLocaleDateString('en-US', {
|
|
40
|
+
year: 'numeric',
|
|
41
|
+
month: 'long',
|
|
42
|
+
day: 'numeric',
|
|
43
|
+
hour: '2-digit',
|
|
44
|
+
minute: '2-digit',
|
|
45
|
+
})}`,
|
|
46
|
+
colors: {
|
|
47
|
+
primary: config.theme.colors.primary,
|
|
48
|
+
core: config.theme.colors.core,
|
|
49
|
+
},
|
|
50
|
+
sheetName: sheetName || 'Data',
|
|
51
|
+
includeTimestamp: true,
|
|
52
|
+
autoFitColumns: true,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates Excel export options with fallback values when no config is available
|
|
57
|
+
* @param title - Optional custom title for the Excel file
|
|
58
|
+
* @param sheetName - Optional custom sheet name
|
|
59
|
+
* @returns XlsxExportOptions object with default styling
|
|
60
|
+
*/
|
|
61
|
+
export const createDefaultXlsxExportOptions = (title, sheetName) => {
|
|
62
|
+
return {
|
|
63
|
+
title: title || 'Data Export',
|
|
64
|
+
subtitle: `Generated on ${new Date().toLocaleDateString('en-US', {
|
|
65
|
+
year: 'numeric',
|
|
66
|
+
month: 'long',
|
|
67
|
+
day: 'numeric',
|
|
68
|
+
hour: '2-digit',
|
|
69
|
+
minute: '2-digit',
|
|
70
|
+
})}`,
|
|
71
|
+
colors: {
|
|
72
|
+
primary: {
|
|
73
|
+
500: '#b45dae',
|
|
74
|
+
600: '#a14d9e',
|
|
75
|
+
700: '#8e3d8e',
|
|
76
|
+
},
|
|
77
|
+
core: {
|
|
78
|
+
primary: '#b45dae',
|
|
79
|
+
secondary: '#170e31',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
sheetName: sheetName || 'Data',
|
|
83
|
+
includeTimestamp: true,
|
|
84
|
+
autoFitColumns: true,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Creates CSV export options from client configuration
|
|
89
|
+
* @param config - The client configuration object
|
|
90
|
+
* @param title - Optional custom title for the CSV file
|
|
91
|
+
* @returns CsvExportOptions object configured with app branding
|
|
92
|
+
*/
|
|
93
|
+
export const createCsvExportOptions = (config, title) => {
|
|
94
|
+
return {
|
|
95
|
+
title: title || `${config.branding.name} Report`,
|
|
96
|
+
includeTimestamp: true,
|
|
97
|
+
includeHeaders: true,
|
|
98
|
+
delimiter: ',',
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Creates CSV export options with fallback values when no config is available
|
|
103
|
+
* @param title - Optional custom title for the CSV file
|
|
104
|
+
* @returns CsvExportOptions object with default settings
|
|
105
|
+
*/
|
|
106
|
+
export const createDefaultCsvExportOptions = (title) => {
|
|
107
|
+
return {
|
|
108
|
+
title: title || 'Data Export',
|
|
109
|
+
includeTimestamp: true,
|
|
110
|
+
includeHeaders: true,
|
|
111
|
+
delimiter: ',',
|
|
112
|
+
};
|
|
113
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { type TableProps } from '@mantine/core';
|
|
2
|
+
import type { MRT_ColumnDef, MRT_Row, MRT_TableInstance } from 'mantine-react-table';
|
|
3
|
+
import { type ChangeEvent } from 'react';
|
|
4
|
+
import type { ExtraOption } from './ExportButton';
|
|
5
|
+
interface ThemeColors {
|
|
6
|
+
primary: {
|
|
7
|
+
500: string;
|
|
8
|
+
600: string;
|
|
9
|
+
700: string;
|
|
10
|
+
};
|
|
11
|
+
core: {
|
|
12
|
+
primary: string;
|
|
13
|
+
secondary: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
interface PdfExportOptions {
|
|
17
|
+
title?: string;
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
colors?: ThemeColors;
|
|
20
|
+
logo?: {
|
|
21
|
+
url: string;
|
|
22
|
+
width?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface XlsxExportOptions {
|
|
27
|
+
title?: string;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
colors?: ThemeColors;
|
|
30
|
+
sheetName?: string;
|
|
31
|
+
includeTimestamp?: boolean;
|
|
32
|
+
autoFitColumns?: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface CsvExportOptions {
|
|
35
|
+
title?: string;
|
|
36
|
+
includeTimestamp?: boolean;
|
|
37
|
+
includeHeaders?: boolean;
|
|
38
|
+
delimiter?: string;
|
|
39
|
+
filename?: string;
|
|
40
|
+
}
|
|
41
|
+
export type { PdfExportOptions, XlsxExportOptions, CsvExportOptions, ThemeColors };
|
|
42
|
+
export type CoreTableColumnDef<T extends Record<string, any>> = MRT_ColumnDef<T> & {
|
|
43
|
+
showHeader?: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type PagamioMantineTableProps<T extends Record<string, any>> = {
|
|
46
|
+
columns: CoreTableColumnDef<T>[];
|
|
47
|
+
data: T[];
|
|
48
|
+
selectable?: boolean;
|
|
49
|
+
isLoading?: boolean;
|
|
50
|
+
sortable?: boolean;
|
|
51
|
+
enableGlobalFilters?: boolean;
|
|
52
|
+
enableManualSorting?: boolean;
|
|
53
|
+
enableManualPagination?: boolean;
|
|
54
|
+
enablePagination?: boolean;
|
|
55
|
+
rowCount: number;
|
|
56
|
+
onClearFilters?: () => void;
|
|
57
|
+
showClearFilters?: boolean;
|
|
58
|
+
showApplyFilterButton?: boolean;
|
|
59
|
+
onRowClick?: (row: T) => void;
|
|
60
|
+
rowClassName?: string;
|
|
61
|
+
pagination?: {
|
|
62
|
+
enabled: boolean;
|
|
63
|
+
pageIndex: number;
|
|
64
|
+
totalPages?: number;
|
|
65
|
+
onPageChange: (page: number) => void;
|
|
66
|
+
pageSize: number;
|
|
67
|
+
itemsPerPage: number;
|
|
68
|
+
itemsPerPageOptions: number[];
|
|
69
|
+
onPaginationChange: (index: number, itemsPerPage: number) => void;
|
|
70
|
+
};
|
|
71
|
+
sorting?: {
|
|
72
|
+
multiSorting?: boolean;
|
|
73
|
+
sortConfig: SortConfig;
|
|
74
|
+
onSort: (sortKey: string, sortDirection: 'asc' | 'desc') => void;
|
|
75
|
+
setSortBy?: (sortKey: string) => void;
|
|
76
|
+
setSortDir?: (dir: string) => void;
|
|
77
|
+
};
|
|
78
|
+
filtering?: {
|
|
79
|
+
filters: BaseFilter[];
|
|
80
|
+
appliedFilters: Record<string, string>;
|
|
81
|
+
onTableFilter: (columnKey: string, value: string) => void;
|
|
82
|
+
};
|
|
83
|
+
search?: {
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
searchQuery: string;
|
|
86
|
+
onSearch: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
87
|
+
};
|
|
88
|
+
exportable?: boolean;
|
|
89
|
+
addButton?: boolean | React.ReactNode;
|
|
90
|
+
searctInputPlaceHolder?: string;
|
|
91
|
+
addText?: string;
|
|
92
|
+
onAdd?: () => void;
|
|
93
|
+
handleSearchTable: () => void;
|
|
94
|
+
renderEmptyRowsFallback?: React.ReactNode;
|
|
95
|
+
mantineTableProps?: TableProps;
|
|
96
|
+
mantineTableContainerProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
97
|
+
mantinePaperProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
98
|
+
mantinePaginationProps?: React.ComponentPropsWithoutRef<'div'>;
|
|
99
|
+
defaultColumn?: Partial<MRT_ColumnDef<T>>;
|
|
100
|
+
manualFilters?: boolean;
|
|
101
|
+
manualSorting?: boolean;
|
|
102
|
+
manualPagination?: boolean;
|
|
103
|
+
enableStickyHeader?: boolean;
|
|
104
|
+
enableRowSelection?: boolean;
|
|
105
|
+
enableColumnResizing?: boolean;
|
|
106
|
+
expandable?: boolean;
|
|
107
|
+
extraExportOptions?: ExtraOption[];
|
|
108
|
+
pdfExportOptions?: PdfExportOptions;
|
|
109
|
+
xlsxExportOptions?: XlsxExportOptions;
|
|
110
|
+
csvExportOptions?: CsvExportOptions;
|
|
111
|
+
exportAll?: boolean;
|
|
112
|
+
fetchData?: (params?: Record<string, string>) => Promise<T[]>;
|
|
113
|
+
renderExpandableComponent?: (props: {
|
|
114
|
+
row: MRT_Row<T>;
|
|
115
|
+
table: MRT_TableInstance<T>;
|
|
116
|
+
}) => React.ReactNode;
|
|
117
|
+
};
|
|
118
|
+
export type TableToolbarProps<T extends Record<string, any>> = {
|
|
119
|
+
searchable: boolean;
|
|
120
|
+
searchQuery: string;
|
|
121
|
+
onSearch: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
122
|
+
onClearFilters?: () => void;
|
|
123
|
+
showClearFilters?: boolean;
|
|
124
|
+
showApplyFilterButton?: boolean;
|
|
125
|
+
filters?: BaseFilter[];
|
|
126
|
+
appliedFilters: Record<string, string>;
|
|
127
|
+
exportable: boolean;
|
|
128
|
+
columns: MRT_ColumnDef<T>[];
|
|
129
|
+
data: T[];
|
|
130
|
+
onTableFilter?: (columnKey: string, value: string) => void;
|
|
131
|
+
addButton: boolean | React.ReactNode;
|
|
132
|
+
addText?: string;
|
|
133
|
+
isNarrow: boolean;
|
|
134
|
+
searctInputPlaceHolder?: string;
|
|
135
|
+
onAdd: () => void;
|
|
136
|
+
handleSearchTable: () => void;
|
|
137
|
+
handleApplyFilters?: () => void;
|
|
138
|
+
extraExportOptions?: ExtraOption[];
|
|
139
|
+
pdfExportOptions?: PdfExportOptions;
|
|
140
|
+
xlsxExportOptions?: XlsxExportOptions;
|
|
141
|
+
csvExportOptions?: CsvExportOptions;
|
|
142
|
+
exportAll?: boolean;
|
|
143
|
+
fetchData?: (params?: Record<string, string>) => Promise<T[]>;
|
|
144
|
+
};
|
|
145
|
+
export interface BaseEntity {
|
|
146
|
+
id: number | string;
|
|
147
|
+
createdById?: number;
|
|
148
|
+
lastModifiedById?: number;
|
|
149
|
+
createdDate?: string;
|
|
150
|
+
lastModifiedDate?: string;
|
|
151
|
+
state?: number;
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
}
|
|
154
|
+
export interface BaseFilter {
|
|
155
|
+
columnKey: string;
|
|
156
|
+
label?: string;
|
|
157
|
+
type?: 'select' | 'multi-select' | 'date' | 'range' | 'boolean';
|
|
158
|
+
options: Array<{
|
|
159
|
+
label: string;
|
|
160
|
+
value: string;
|
|
161
|
+
}>;
|
|
162
|
+
defaultValue?: string | string[];
|
|
163
|
+
placeholder?: string;
|
|
164
|
+
}
|
|
165
|
+
export interface SortConfig {
|
|
166
|
+
sortBy?: string;
|
|
167
|
+
sortDir?: 'asc' | 'desc';
|
|
168
|
+
multiSorting?: boolean;
|
|
169
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MRT_ColumnDef } from 'mantine-react-table';
|
|
2
|
+
import type { IconType } from 'react-icons';
|
|
3
|
+
interface ActionsColumnProps<T> {
|
|
4
|
+
buttonTitle: string;
|
|
5
|
+
icon?: IconType;
|
|
6
|
+
label: string;
|
|
7
|
+
showIconButton?: boolean;
|
|
8
|
+
renderContent?: (data: T) => JSX.Element;
|
|
9
|
+
handleOnclickButton?: (data: T) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const createTableActionsColumn: <T extends Record<string, any>>({ buttonTitle, icon, label, showIconButton, renderContent, handleOnclickButton, }: ActionsColumnProps<T>) => MRT_ColumnDef<T>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, IconButton } from '../../components';
|
|
3
|
+
export const createTableActionsColumn = ({ buttonTitle, icon, label, showIconButton = true, renderContent, handleOnclickButton, }) => {
|
|
4
|
+
return {
|
|
5
|
+
header: '',
|
|
6
|
+
id: 'actions',
|
|
7
|
+
accessorKey: 'action',
|
|
8
|
+
enableSorting: false,
|
|
9
|
+
enableColumnFilter: false,
|
|
10
|
+
enableColumnActions: false,
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
+
Cell: ({ row }) => {
|
|
13
|
+
return (_jsx(_Fragment, { children: showIconButton ? (icon &&
|
|
14
|
+
handleOnclickButton && (_jsx(IconButton, { className: "font-semibold", icon: icon, label: label, onClick: () => handleOnclickButton(row.original), children: buttonTitle }))) : (_jsx(_Fragment, { children: renderContent ? (renderContent(row.original)) : (_jsx(_Fragment, { children: handleOnclickButton && (_jsx(Button, { className: "font-semibold", onClick: () => handleOnclickButton(row.original), children: buttonTitle })) })) })) }));
|
|
15
|
+
},
|
|
16
|
+
mantineTableHeadCellProps: () => ({
|
|
17
|
+
sx: {
|
|
18
|
+
svg: {
|
|
19
|
+
display: 'none',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './functionHelper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './functionHelper';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RBACUser } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook wrapper for hasPermission
|
|
4
|
+
* @param user - The user object to check permissions for
|
|
5
|
+
* @param permission - The permission to check
|
|
6
|
+
* @returns boolean indicating if the user has the permission
|
|
7
|
+
*/
|
|
8
|
+
export declare const useHasPermission: <P, U extends RBACUser = RBACUser>(user: U | null, permission: P) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Hook wrapper for hasRole
|
|
11
|
+
* @param user - The user object to check role for
|
|
12
|
+
* @param roleName - The role name to check against
|
|
13
|
+
* @returns boolean indicating if the user has the specified role
|
|
14
|
+
*/
|
|
15
|
+
export declare const useHasRole: <U extends RBACUser = RBACUser>(user: U | null, roleName: string) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Hook wrapper for hasAnyPermission
|
|
18
|
+
* @param user - The user object to check permissions for
|
|
19
|
+
* @param permissions - Array of permissions to check
|
|
20
|
+
* @returns boolean indicating if the user has any of the permissions
|
|
21
|
+
*/
|
|
22
|
+
export declare const useHasAnyPermission: <P, U extends RBACUser = RBACUser>(user: U | null, permissions: P[]) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Hook wrapper for hasAllPermissions
|
|
25
|
+
* @param user - The user object to check permissions for
|
|
26
|
+
* @param permissions - Array of permissions to check
|
|
27
|
+
* @returns boolean indicating if the user has all of the permissions
|
|
28
|
+
*/
|
|
29
|
+
export declare const useHasAllPermissions: <P, U extends RBACUser = RBACUser>(user: U | null, permissions: P[]) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Hook wrapper for getUserPermissions
|
|
32
|
+
* @param user - The user object to get permissions for
|
|
33
|
+
* @returns Array of permissions the user has
|
|
34
|
+
*/
|
|
35
|
+
export declare const useGetUserPermissions: <P, U extends RBACUser = RBACUser>(user: U | null) => P[];
|
|
36
|
+
/**
|
|
37
|
+
* Hook wrapper for IQ Retail access
|
|
38
|
+
*/
|
|
39
|
+
export declare const useHasIQRetailAccess: <P, U extends RBACUser = RBACUser>(user: U | null) => boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getUserPermissions, hasAllPermissions, hasAnyPermission, hasIQRetailAccess, hasPermission, hasRole, } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* Hook wrapper for hasPermission
|
|
4
|
+
* @param user - The user object to check permissions for
|
|
5
|
+
* @param permission - The permission to check
|
|
6
|
+
* @returns boolean indicating if the user has the permission
|
|
7
|
+
*/
|
|
8
|
+
export const useHasPermission = (user, permission) => {
|
|
9
|
+
return hasPermission(user, permission);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Hook wrapper for hasRole
|
|
13
|
+
* @param user - The user object to check role for
|
|
14
|
+
* @param roleName - The role name to check against
|
|
15
|
+
* @returns boolean indicating if the user has the specified role
|
|
16
|
+
*/
|
|
17
|
+
export const useHasRole = (user, roleName) => {
|
|
18
|
+
return hasRole(user, roleName);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hook wrapper for hasAnyPermission
|
|
22
|
+
* @param user - The user object to check permissions for
|
|
23
|
+
* @param permissions - Array of permissions to check
|
|
24
|
+
* @returns boolean indicating if the user has any of the permissions
|
|
25
|
+
*/
|
|
26
|
+
export const useHasAnyPermission = (user, permissions) => {
|
|
27
|
+
return hasAnyPermission(user, permissions);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Hook wrapper for hasAllPermissions
|
|
31
|
+
* @param user - The user object to check permissions for
|
|
32
|
+
* @param permissions - Array of permissions to check
|
|
33
|
+
* @returns boolean indicating if the user has all of the permissions
|
|
34
|
+
*/
|
|
35
|
+
export const useHasAllPermissions = (user, permissions) => {
|
|
36
|
+
return hasAllPermissions(user, permissions);
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Hook wrapper for getUserPermissions
|
|
40
|
+
* @param user - The user object to get permissions for
|
|
41
|
+
* @returns Array of permissions the user has
|
|
42
|
+
*/
|
|
43
|
+
export const useGetUserPermissions = (user) => {
|
|
44
|
+
return getUserPermissions(user);
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Hook wrapper for IQ Retail access
|
|
48
|
+
*/
|
|
49
|
+
export const useHasIQRetailAccess = (user) => {
|
|
50
|
+
return hasIQRetailAccess(user);
|
|
51
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-Based Access Control (RBAC) module
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for implementing role-based access control in applications.
|
|
5
|
+
*/
|
|
6
|
+
// Export types
|
|
7
|
+
export * from './types';
|
|
8
|
+
// Export core utilities
|
|
9
|
+
export * from './utils';
|
|
10
|
+
// Export React hooks
|
|
11
|
+
export * from './hooks';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RBACOptions, RBACUser } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton store for RBAC configuration
|
|
4
|
+
* This allows the RBAC system to be initialized once and used throughout the application
|
|
5
|
+
*/
|
|
6
|
+
export declare class RBACConfigStore<P, U extends RBACUser = RBACUser> {
|
|
7
|
+
private static instance;
|
|
8
|
+
private _options;
|
|
9
|
+
private constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Get the singleton instance of the RBAC config store
|
|
12
|
+
*/
|
|
13
|
+
static getInstance<P, U extends RBACUser = RBACUser>(): RBACConfigStore<P, U>;
|
|
14
|
+
/**
|
|
15
|
+
* Initialize the RBAC configuration
|
|
16
|
+
* @param options - RBAC configuration options
|
|
17
|
+
*/
|
|
18
|
+
initialize(options: RBACOptions<P, U>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the RBAC configuration options
|
|
21
|
+
* @throws Error if RBAC has not been initialized
|
|
22
|
+
*/
|
|
23
|
+
get options(): RBACOptions<P, U>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Singleton store for RBAC configuration
|
|
3
|
+
* This allows the RBAC system to be initialized once and used throughout the application
|
|
4
|
+
*/
|
|
5
|
+
export class RBACConfigStore {
|
|
6
|
+
// Use a more generic type for the static instance to avoid type conflicts
|
|
7
|
+
static instance;
|
|
8
|
+
_options = null;
|
|
9
|
+
constructor() { }
|
|
10
|
+
/**
|
|
11
|
+
* Get the singleton instance of the RBAC config store
|
|
12
|
+
*/
|
|
13
|
+
static getInstance() {
|
|
14
|
+
// Use nullish coalescing assignment for cleaner code
|
|
15
|
+
RBACConfigStore.instance ??= new RBACConfigStore();
|
|
16
|
+
// Using type assertion here as we know the instance will be compatible
|
|
17
|
+
// with the requested generic types
|
|
18
|
+
return RBACConfigStore.instance;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Initialize the RBAC configuration
|
|
22
|
+
* @param options - RBAC configuration options
|
|
23
|
+
*/
|
|
24
|
+
initialize(options) {
|
|
25
|
+
this._options = options;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get the RBAC configuration options
|
|
29
|
+
* @throws Error if RBAC has not been initialized
|
|
30
|
+
*/
|
|
31
|
+
get options() {
|
|
32
|
+
if (!this._options) {
|
|
33
|
+
throw new Error('RBAC has not been initialized. Call initializeRBAC first.');
|
|
34
|
+
}
|
|
35
|
+
return this._options;
|
|
36
|
+
}
|
|
37
|
+
}
|