@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 { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Input } from '../../../../components';
|
|
4
|
+
const TimeInput = React.forwardRef(({ field, error, ...props }, ref) => (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(Input, { type: "time", ...props, ref: ref, id: field.name, disabled: field.disabled, className: `mt-1 block w-full p-2 border ${error ? 'border-red-500' : 'border-gray-300'} rounded-md shadow-sm disabled:text-gray-400 disabled:bg-gray-50` }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] })));
|
|
5
|
+
export default TimeInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TimeInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TimeInput';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Switch } from '../../../../components';
|
|
4
|
+
const ToggleSwitchInput = React.forwardRef(({ field, error, value, onChange, ...props }, ref) => {
|
|
5
|
+
return (_jsxs("div", { ref: ref, className: "flex flex-row flex-nowrap items-center justify-between", children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(Switch, { ...props, checked: value || false, onChange: onChange, disabled: field.disabled, className: `react-switch ${error ? 'border-red-500' : 'border-gray-300'} disabled:text-gray-400 disabled:bg-gray-50`, id: field.name }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] }));
|
|
6
|
+
});
|
|
7
|
+
export default ToggleSwitchInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ToggleSwitchInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ToggleSwitchInput';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputProps } from '../../../types';
|
|
3
|
+
declare const UploadFieldForm: React.ForwardRefExoticComponent<Omit<InputProps & React.InputHTMLAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export default UploadFieldForm;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import ImageComponent from '../../../../components/ui/ImageComponent';
|
|
4
|
+
import UploadField from '../../../../components/ui/UploadField';
|
|
5
|
+
const UploadFieldForm = forwardRef(({ field, error, ...props }, ref) => {
|
|
6
|
+
const [preview, setPreview] = useState({
|
|
7
|
+
src: null,
|
|
8
|
+
type: null,
|
|
9
|
+
});
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (props.value && typeof props.value === 'string' && props.value.length > 0) {
|
|
12
|
+
const lower = props.value.toLowerCase();
|
|
13
|
+
const isPdf = lower.endsWith('.pdf');
|
|
14
|
+
setPreview({
|
|
15
|
+
src: props.value,
|
|
16
|
+
type: isPdf ? 'pdf' : 'image',
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}, [props.value]);
|
|
20
|
+
const handleFileChange = (file) => {
|
|
21
|
+
if (!file) {
|
|
22
|
+
setPreview({ src: null, type: null });
|
|
23
|
+
props.onChange('');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const isPdf = file.type === 'application/pdf';
|
|
27
|
+
const isImage = file.type.startsWith('image/');
|
|
28
|
+
if (isPdf || isImage) {
|
|
29
|
+
const reader = new FileReader();
|
|
30
|
+
reader.onloadend = () => {
|
|
31
|
+
setPreview({
|
|
32
|
+
src: reader.result,
|
|
33
|
+
type: isPdf ? 'pdf' : 'image',
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
// Same action for both PDFs and images
|
|
37
|
+
reader.readAsDataURL(file);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
setPreview({ src: null, type: null });
|
|
41
|
+
}
|
|
42
|
+
props.onChange(file);
|
|
43
|
+
};
|
|
44
|
+
const previewElement = useMemo(() => {
|
|
45
|
+
if (!preview.src)
|
|
46
|
+
return _jsx("span", { className: "text-gray-500", children: "No file uploaded." });
|
|
47
|
+
if (preview.type === 'image') {
|
|
48
|
+
return (_jsx(ImageComponent, { src: preview.src, alt: field.name, className: "w-24 h-24 object-cover rounded-md" }, `${field.name}-image`));
|
|
49
|
+
}
|
|
50
|
+
if (preview.type === 'pdf') {
|
|
51
|
+
return (_jsx("iframe", { title: `${field.name}-pdf-preview`, src: preview.src, className: "w-full h-64 border-0 rounded-md" }));
|
|
52
|
+
}
|
|
53
|
+
return _jsx("span", { className: "text-gray-500", children: "File uploaded." });
|
|
54
|
+
}, [preview, field.name]);
|
|
55
|
+
const previewLabel = preview.type === 'pdf' ? 'Uploaded PDF:' : 'Uploaded Image:';
|
|
56
|
+
return (_jsxs("div", { className: "flex flex-col space-y-4", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx("label", { htmlFor: field.name, className: "text-sm font-medium text-gray-700", children: field.label }), _jsx(UploadField, { ...props, id: field.name, ref: ref, value: props.value || null, onChange: handleFileChange, className: "w-full p-2 border border-gray-300 rounded-md", hideUploadButton: field.hideUploadButton, allowedFileTypes: field.allowedFileTypes, helperText: field.fileUploadHelperText }), error && _jsx("p", { className: "mt-1 text-sm text-red-500", children: error.message })] }), field.showFileUploadPreview && (_jsxs("div", { className: "mt-4", children: [_jsx("label", { htmlFor: `${field.name}-preview`, className: "text-sm font-medium text-gray-700", children: previewLabel }), _jsx("div", { className: "mt-2 flex flex-col items-center p-4 border border-gray-300 rounded-md", children: previewElement })] }))] }));
|
|
57
|
+
});
|
|
58
|
+
UploadFieldForm.displayName = 'UploadFieldForm';
|
|
59
|
+
export default UploadFieldForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './UploadFieldForm';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './UploadFieldForm';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for form persistence functionality
|
|
3
|
+
* Provides methods to save, restore, and clear form data
|
|
4
|
+
*/
|
|
5
|
+
export declare const useFormPersistence: (formKey?: string) => {
|
|
6
|
+
saveFormData: (data: Record<string, any>, isDirty?: boolean) => void;
|
|
7
|
+
restoreFormData: () => Record<string, any> | null;
|
|
8
|
+
clearPersistedData: () => void;
|
|
9
|
+
hasPersistedData: () => boolean;
|
|
10
|
+
getPersistedDataInfo: () => import("..").FormPersistenceData | null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useMultiFormEngineDrawer } from '../../context/MultiFormEngineDrawerProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for form persistence functionality
|
|
5
|
+
* Provides methods to save, restore, and clear form data
|
|
6
|
+
*/
|
|
7
|
+
export const useFormPersistence = (formKey) => {
|
|
8
|
+
const { getFormData, setFormData, clearFormData, hasFormData } = useMultiFormEngineDrawer();
|
|
9
|
+
const saveFormData = useCallback((data, isDirty = true) => {
|
|
10
|
+
if (!formKey)
|
|
11
|
+
return;
|
|
12
|
+
setFormData(formKey, {
|
|
13
|
+
values: data,
|
|
14
|
+
lastUpdated: Date.now(),
|
|
15
|
+
isDirty,
|
|
16
|
+
});
|
|
17
|
+
}, [formKey, setFormData]);
|
|
18
|
+
const restoreFormData = useCallback(() => {
|
|
19
|
+
if (!formKey)
|
|
20
|
+
return null;
|
|
21
|
+
const persistedData = getFormData(formKey);
|
|
22
|
+
return persistedData?.values || null;
|
|
23
|
+
}, [formKey, getFormData]);
|
|
24
|
+
const clearPersistedData = useCallback(() => {
|
|
25
|
+
if (!formKey)
|
|
26
|
+
return;
|
|
27
|
+
clearFormData(formKey);
|
|
28
|
+
}, [formKey, clearFormData]);
|
|
29
|
+
const hasPersistedData = useCallback(() => {
|
|
30
|
+
if (!formKey)
|
|
31
|
+
return false;
|
|
32
|
+
return hasFormData(formKey);
|
|
33
|
+
}, [formKey, hasFormData]);
|
|
34
|
+
const getPersistedDataInfo = useCallback(() => {
|
|
35
|
+
if (!formKey)
|
|
36
|
+
return null;
|
|
37
|
+
return getFormData(formKey);
|
|
38
|
+
}, [formKey, getFormData]);
|
|
39
|
+
return {
|
|
40
|
+
saveFormData,
|
|
41
|
+
restoreFormData,
|
|
42
|
+
clearPersistedData,
|
|
43
|
+
hasPersistedData,
|
|
44
|
+
getPersistedDataInfo,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setupInputRegistry: () => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PhoneInput } from '../../components';
|
|
2
|
+
import CardExpiryInput from '../components/inputs/card-expiry-input/CardExpiryInput';
|
|
3
|
+
import CheckboxInput from '../components/inputs/checkbox-input/CheckboxInput';
|
|
4
|
+
import CreditCardInput from '../components/inputs/credit-card-input/CreditCardInput';
|
|
5
|
+
import DateInput from '../components/inputs/date-input/DateInput';
|
|
6
|
+
import EmailInput from '../components/inputs/email-input/EmailInput';
|
|
7
|
+
import LabelInput from '../components/inputs/label-input/LabelInput';
|
|
8
|
+
import MultiSelectInputComponent from '../components/inputs/multi-select-input/MultiSelectInput';
|
|
9
|
+
import NumberInput from '../components/inputs/number-input/NumberInput';
|
|
10
|
+
import PasswordInput from '../components/inputs/password-input/PasswordInput';
|
|
11
|
+
import RadioInput from '../components/inputs/radio-button/RadioInput';
|
|
12
|
+
import SelectInput from '../components/inputs/select/SelectInput';
|
|
13
|
+
import TextareaInputFW from '../components/inputs/textarea-input/TextareaInput';
|
|
14
|
+
import TimeInput from '../components/inputs/time-input/TimeInput';
|
|
15
|
+
import ToggleSwitchInput from '../components/inputs/toggle-switch-input/ToggleSwitchInput';
|
|
16
|
+
import UploadFieldForm from '../components/inputs/upload-field/UploadFieldForm';
|
|
17
|
+
import { registerInput } from './Registry';
|
|
18
|
+
export const setupInputRegistry = () => {
|
|
19
|
+
registerInput('card-expiry-input', CardExpiryInput);
|
|
20
|
+
registerInput('checkbox', CheckboxInput);
|
|
21
|
+
registerInput('credit-card', CreditCardInput);
|
|
22
|
+
registerInput('date', DateInput);
|
|
23
|
+
registerInput('email', EmailInput);
|
|
24
|
+
registerInput('file', UploadFieldForm);
|
|
25
|
+
registerInput('multi-select', MultiSelectInputComponent);
|
|
26
|
+
registerInput('number', NumberInput);
|
|
27
|
+
registerInput('password', PasswordInput);
|
|
28
|
+
registerInput('radio', RadioInput);
|
|
29
|
+
registerInput('select', SelectInput);
|
|
30
|
+
registerInput('switch', ToggleSwitchInput);
|
|
31
|
+
registerInput('tel', PhoneInput);
|
|
32
|
+
registerInput('text', LabelInput);
|
|
33
|
+
registerInput('textarea', TextareaInputFW);
|
|
34
|
+
registerInput('time', TimeInput);
|
|
35
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { BaseInputProps } from '../types';
|
|
3
|
+
export type InputComponent = React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<any>>;
|
|
4
|
+
export declare const registerInput: (type: string, component: InputComponent) => InputComponent;
|
|
5
|
+
export declare const getInputComponent: (type: string) => InputComponent | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const InputRegistry = {};
|
|
2
|
+
// Register a new input component
|
|
3
|
+
export const registerInput = (type, component) => {
|
|
4
|
+
return (InputRegistry[type] = component);
|
|
5
|
+
};
|
|
6
|
+
// Retrieve an input component from the registry
|
|
7
|
+
export const getInputComponent = (type) => {
|
|
8
|
+
const component = InputRegistry[type];
|
|
9
|
+
if (!component) {
|
|
10
|
+
console.warn(`No input component found for type: ${type}`);
|
|
11
|
+
}
|
|
12
|
+
return component;
|
|
13
|
+
};
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import type { Control, FieldErrors, FieldValues, RegisterOptions } from 'react-hook-form';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
export interface ActionProps {
|
|
4
|
+
field: string;
|
|
5
|
+
options?: SelectOption[] | string[];
|
|
6
|
+
value?: any;
|
|
7
|
+
label?: string;
|
|
8
|
+
hideField?: boolean;
|
|
9
|
+
fieldInnitialData?: Field;
|
|
10
|
+
validation?: ValidationRule;
|
|
11
|
+
}
|
|
12
|
+
export interface SelectOption {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
id?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface BaseInputProps {
|
|
18
|
+
field: Field;
|
|
19
|
+
error?: {
|
|
20
|
+
message?: string;
|
|
21
|
+
};
|
|
22
|
+
value?: any;
|
|
23
|
+
options?: Array<SelectOption | string>;
|
|
24
|
+
onChange: (value: any) => void;
|
|
25
|
+
onBlur?: () => void;
|
|
26
|
+
name: string;
|
|
27
|
+
ref?: React.Ref<any>;
|
|
28
|
+
control?: Control<any>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents the state of a form, including validation errors and optional message
|
|
32
|
+
*/
|
|
33
|
+
export type FormState = {
|
|
34
|
+
errors?: {
|
|
35
|
+
name?: string[];
|
|
36
|
+
email?: string[];
|
|
37
|
+
password?: string[];
|
|
38
|
+
};
|
|
39
|
+
message?: string;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Defines the structure of control fields used in authentication forms
|
|
43
|
+
*/
|
|
44
|
+
export type ControlFields = {
|
|
45
|
+
username: string;
|
|
46
|
+
password: string;
|
|
47
|
+
emailAddress?: string;
|
|
48
|
+
profile?: string;
|
|
49
|
+
role?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Reference object exposing form control methods
|
|
53
|
+
*/
|
|
54
|
+
export interface FormRef {
|
|
55
|
+
reset: () => void;
|
|
56
|
+
setValue?: (name: string, value: any) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Props for the FormEngine component which handles form rendering and submission
|
|
60
|
+
*/
|
|
61
|
+
export interface FormEngineProps<T extends Record<string, any>> {
|
|
62
|
+
/** Array of field definitions that make up the form */
|
|
63
|
+
fields: Field[];
|
|
64
|
+
/** Callback function called when the form is submitted */
|
|
65
|
+
onSubmit: (data: any) => Promise<void>;
|
|
66
|
+
/** Layout direction of the form */
|
|
67
|
+
layout?: 'vertical' | 'horizontal';
|
|
68
|
+
/** Initial values for form fields */
|
|
69
|
+
initialValues?: any;
|
|
70
|
+
/** Custom tailwind class for the Form Engine */
|
|
71
|
+
className?: string;
|
|
72
|
+
/** Custom tailwind class for the submit button */
|
|
73
|
+
submitButtonClass?: string;
|
|
74
|
+
/** Flag to disable automatic form submission trigger */
|
|
75
|
+
isNotTrigger?: boolean;
|
|
76
|
+
/** Flag to show or hide the cancel button */
|
|
77
|
+
showCancelButton?: boolean;
|
|
78
|
+
/** Flag dynamic display submit button text */
|
|
79
|
+
submitButtonText?: string;
|
|
80
|
+
/** Show submitting indicator text */
|
|
81
|
+
showSubmittingText?: boolean;
|
|
82
|
+
/** Callback function called when form cancellation is requested */
|
|
83
|
+
onCancel: () => void;
|
|
84
|
+
/** Callback function called whenever a field value changes */
|
|
85
|
+
getFieldValues?: (fields: T) => void;
|
|
86
|
+
/** Optional persistence key for form data */
|
|
87
|
+
persistenceKey?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Optional ref to expose form control methods.
|
|
90
|
+
* When not provided, the form will automatically reset after successful submission.
|
|
91
|
+
* When provided, the parent component controls form reset behavior.
|
|
92
|
+
*/
|
|
93
|
+
formRef?: React.MutableRefObject<FormRef | undefined>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Defines validation rules that can be applied to form fields
|
|
97
|
+
*/
|
|
98
|
+
export type ValidationRule = {
|
|
99
|
+
/** Required field validation with optional custom message */
|
|
100
|
+
required?: string | {
|
|
101
|
+
value: boolean;
|
|
102
|
+
message: string;
|
|
103
|
+
};
|
|
104
|
+
/** Minimum value/length validation with message */
|
|
105
|
+
min?: {
|
|
106
|
+
value: string | number;
|
|
107
|
+
message: string;
|
|
108
|
+
};
|
|
109
|
+
/** Pattern validation with message */
|
|
110
|
+
pattern?: {
|
|
111
|
+
value: RegExp;
|
|
112
|
+
message: string;
|
|
113
|
+
};
|
|
114
|
+
/** Custom validation function */
|
|
115
|
+
validate?: (value: any) => boolean | string;
|
|
116
|
+
/** Dependency validation - applies validation based on another field's value */
|
|
117
|
+
dependency?: DependencyValidation | DependencyValidation[];
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Defines a dependency validation rule
|
|
121
|
+
*/
|
|
122
|
+
export interface DependencyValidation {
|
|
123
|
+
/** The field this validation depends on */
|
|
124
|
+
field: string;
|
|
125
|
+
/** Condition function that determines if validation should be applied */
|
|
126
|
+
condition: (value: any) => boolean;
|
|
127
|
+
/** Validation rules to apply when condition is true */
|
|
128
|
+
validationToApply: Omit<ValidationRule, 'dependency'>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Available field types supported by the form engine
|
|
132
|
+
*/
|
|
133
|
+
export type FieldType = 'card-expiry-input' | 'checkbox' | 'credit-card' | 'date' | 'email' | 'file' | 'multi-select' | 'number' | 'password' | 'radio' | 'searchable-multi-select' | 'select' | 'switch' | 'tel' | 'text' | 'textarea' | 'time';
|
|
134
|
+
/**
|
|
135
|
+
* Defines the structure of a form field
|
|
136
|
+
*/
|
|
137
|
+
export interface Field {
|
|
138
|
+
/** Field identifier */
|
|
139
|
+
name: string;
|
|
140
|
+
/** Display label for the field */
|
|
141
|
+
label: string;
|
|
142
|
+
/** Type of input field */
|
|
143
|
+
type: FieldType;
|
|
144
|
+
/** Placeholder text for the field */
|
|
145
|
+
placeholder?: string;
|
|
146
|
+
/** Number of grids a field will span */
|
|
147
|
+
gridSpan?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
148
|
+
/** Whether the field is checked (for checkbox/switch types) */
|
|
149
|
+
checked?: boolean;
|
|
150
|
+
/** To hide or show the upload button when the field is type file */
|
|
151
|
+
hideUploadButton?: boolean;
|
|
152
|
+
/** To validate file types say .png, .pdf etc */
|
|
153
|
+
allowedFileTypes?: string[];
|
|
154
|
+
/** To hide or show a preview of uploaded image */
|
|
155
|
+
showFileUploadPreview?: boolean;
|
|
156
|
+
/** To display file upload helper text */
|
|
157
|
+
fileUploadHelperText?: string;
|
|
158
|
+
/** Default country for phone input */
|
|
159
|
+
defaultCountry?: string;
|
|
160
|
+
/** Disables the field */
|
|
161
|
+
disabled?: boolean;
|
|
162
|
+
/** Validation rules for the field */
|
|
163
|
+
validation?: ValidationRule;
|
|
164
|
+
/** Options for select, multi-select, and radio fields */
|
|
165
|
+
options?: Array<SelectOption | string>;
|
|
166
|
+
/** callback for searchable select, multi-select */
|
|
167
|
+
onSearch?: (value: string) => void;
|
|
168
|
+
/** callback for onChange event */
|
|
169
|
+
onChange?: (value: string) => void;
|
|
170
|
+
isHidden?: boolean;
|
|
171
|
+
}
|
|
172
|
+
export interface DependentFieldUpdate {
|
|
173
|
+
field: string;
|
|
174
|
+
dependencies?: string[];
|
|
175
|
+
action: (value: any, isInitialLoad?: boolean) => Promise<ActionProps> | ActionProps;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Props for the Form component wrapper
|
|
179
|
+
*/
|
|
180
|
+
export interface FormProps {
|
|
181
|
+
/** Array of field definitions */
|
|
182
|
+
fieldDefinitions: Field[];
|
|
183
|
+
/** Form submission handler */
|
|
184
|
+
onFormSubmit: (data: any) => void;
|
|
185
|
+
/** Initial form values */
|
|
186
|
+
initialValues?: any;
|
|
187
|
+
/** Form layout direction */
|
|
188
|
+
layout?: 'vertical' | 'horizontal';
|
|
189
|
+
/** Flag to disable automatic form submission */
|
|
190
|
+
isNotTrigger?: boolean;
|
|
191
|
+
/** Flag to hide or show the cancel button */
|
|
192
|
+
showCancelButton?: boolean;
|
|
193
|
+
/** Form cancellation handler */
|
|
194
|
+
onFormCancel: () => void;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Props for the FieldWrapper component that provides layout and error handling
|
|
198
|
+
*/
|
|
199
|
+
export interface FieldWrapperProps {
|
|
200
|
+
/** Field definition */
|
|
201
|
+
field: Field;
|
|
202
|
+
/** React Hook Form control object */
|
|
203
|
+
control: Control;
|
|
204
|
+
/** Form validation errors */
|
|
205
|
+
errors: FieldErrors;
|
|
206
|
+
/** Layout direction */
|
|
207
|
+
layout: 'vertical' | 'horizontal';
|
|
208
|
+
/** All field values for dependency tracking */
|
|
209
|
+
allFieldValues?: Record<string, any>;
|
|
210
|
+
/** Field update callbacks */
|
|
211
|
+
onFieldUpdate?: Record<string, DependentFieldUpdate[]>;
|
|
212
|
+
/** Update field options callback */
|
|
213
|
+
updateFieldOptions?: (field: string, options: Array<SelectOption | string>) => void;
|
|
214
|
+
/** Update field label callback */
|
|
215
|
+
updateFieldLabel?: (fieldName: string, newLabelName: string) => void;
|
|
216
|
+
/** Hide field callback */
|
|
217
|
+
hideInputField?: (fieldName: string, hidden: boolean) => void;
|
|
218
|
+
/** Add new field callback */
|
|
219
|
+
addField?: (field: Field) => void;
|
|
220
|
+
/** Set value function from useForm */
|
|
221
|
+
setValue?: (name: string, value: any) => void;
|
|
222
|
+
/** Clear errors function from useForm */
|
|
223
|
+
clearErrors?: (field: string) => void;
|
|
224
|
+
/** Get values function from useForm */
|
|
225
|
+
getValues?: () => Record<string, any>;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Props for basic input components
|
|
229
|
+
*/
|
|
230
|
+
export interface InputProps extends BaseInputProps {
|
|
231
|
+
/** Field configuration */
|
|
232
|
+
field: Field;
|
|
233
|
+
/** Validation error if any */
|
|
234
|
+
error?: {
|
|
235
|
+
message: string;
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Props for input components with options (select, radio, etc.)
|
|
240
|
+
*/
|
|
241
|
+
export interface InputOptionsProps {
|
|
242
|
+
/** Field configuration including validation rules */
|
|
243
|
+
field: {
|
|
244
|
+
validation: Omit<RegisterOptions<FieldValues, string>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'> | undefined;
|
|
245
|
+
name: string;
|
|
246
|
+
label: string;
|
|
247
|
+
options: SelectOption[] | string[];
|
|
248
|
+
disabled?: boolean;
|
|
249
|
+
};
|
|
250
|
+
/** Validation error if any */
|
|
251
|
+
error?: {
|
|
252
|
+
message: string;
|
|
253
|
+
};
|
|
254
|
+
/** React Hook Form control object */
|
|
255
|
+
control: Control<any>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Props for select input components
|
|
259
|
+
*/
|
|
260
|
+
export interface InputSelectProps extends BaseInputProps {
|
|
261
|
+
/** Validation error if any */
|
|
262
|
+
error?: {
|
|
263
|
+
message: string;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Props for switch/toggle input components
|
|
268
|
+
*/
|
|
269
|
+
export interface InputSwitchProps {
|
|
270
|
+
/** Field configuration */
|
|
271
|
+
field: any;
|
|
272
|
+
/** Validation error if any */
|
|
273
|
+
error?: {
|
|
274
|
+
message: string;
|
|
275
|
+
};
|
|
276
|
+
value?: boolean;
|
|
277
|
+
onChange?: (checked: boolean) => void;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Option structure for the searchable multi-select
|
|
281
|
+
*/
|
|
282
|
+
export interface SearchableMultiSelectOption {
|
|
283
|
+
value: string;
|
|
284
|
+
label: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Form persistence context data structure
|
|
288
|
+
*/
|
|
289
|
+
export interface FormPersistenceData {
|
|
290
|
+
/** Form field values */
|
|
291
|
+
values: Record<string, any>;
|
|
292
|
+
/** Timestamp when the data was last updated */
|
|
293
|
+
lastUpdated: number;
|
|
294
|
+
/** Whether the form is dirty (has changes) */
|
|
295
|
+
isDirty: boolean;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Form persistence context type
|
|
299
|
+
*/
|
|
300
|
+
export interface FormPersistenceContextType {
|
|
301
|
+
/** Get persisted form data by key */
|
|
302
|
+
getFormData: (key: string) => FormPersistenceData | null;
|
|
303
|
+
/** Set persisted form data by key */
|
|
304
|
+
setFormData: (key: string, data: Partial<FormPersistenceData>) => void;
|
|
305
|
+
/** Clear persisted form data by key */
|
|
306
|
+
clearFormData: (key: string) => void;
|
|
307
|
+
/** Clear all persisted form data */
|
|
308
|
+
clearAllFormData: () => void;
|
|
309
|
+
/** Check if form has persisted data */
|
|
310
|
+
hasFormData: (key: string) => boolean;
|
|
311
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
/**
|
|
4
|
+
* Formats a number as currency using en-US locale standards.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} price - The numeric value to format as currency
|
|
7
|
+
* @param {string} [currency="ZAR"] - ISO 4217 currency code (default: "ZAR")
|
|
8
|
+
* @param {number} [minimumFractionDigits=2] - Minimum fraction digits (default: 2)
|
|
9
|
+
* @param {number} [maximumFractionDigits] - Optional maximum fraction digits
|
|
10
|
+
* @param {string} [displaySymbol] - Optional custom symbol to display instead of ISO code
|
|
11
|
+
* @returns {string} Formatted currency string
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage with ZAR (South African Rand)
|
|
15
|
+
* formatPrice(1234.56); // Returns "ZAR 1,234.56"
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // USD with 2 decimal places
|
|
19
|
+
* formatPrice(1234.56, "USD"); // Returns "$1,234.56"
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Euro with standard formatting
|
|
23
|
+
* formatPrice(1234.56, "EUR"); // Returns "€1,234.56"
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Custom display symbol for ZAR
|
|
27
|
+
* formatPrice(1234.56, "ZAR", 2, undefined, "R"); // Returns "R 1,234.56"
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Custom decimal places (clamping)
|
|
31
|
+
* formatPrice(1234.5678, "GBP", 2, 3); // Returns "£1,234.568"
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Fallback behavior with invalid currency
|
|
35
|
+
* formatPrice(1234.56, "XYZ"); // Returns "XYZ 1,234.56"
|
|
36
|
+
*/
|
|
37
|
+
export declare const formatPrice: (price: number, currency?: string, minimumFractionDigits?: number, maximumFractionDigits?: number, displaySymbol?: string) => string;
|