@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,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useForm } from 'react-hook-form';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
import { Button, SheetRoot, SheetTrigger } from '../components';
|
|
6
|
+
import { cn } from '../helpers';
|
|
7
|
+
import FieldWrapper from './components/FieldWrapper';
|
|
8
|
+
import { useFormPersistence } from './hooks/useFormPersistence';
|
|
9
|
+
const CancelButton = ({ isSubmitting, onCancel, isNotTrigger, onClearData }) => {
|
|
10
|
+
const handleCancel = () => {
|
|
11
|
+
if (onClearData) {
|
|
12
|
+
onClearData();
|
|
13
|
+
}
|
|
14
|
+
onCancel();
|
|
15
|
+
};
|
|
16
|
+
const sharedClasses = 'bg-white border-primary-500 text-primary-500 hover:bg-primary-600 hover:text-white w-full mr-3';
|
|
17
|
+
return isNotTrigger ? (_jsx(Button, { className: sharedClasses, disabled: isSubmitting, onClick: handleCancel, children: "Cancel" })) : (_jsx(SheetRoot, { children: _jsx(SheetTrigger, { asChild: true, children: _jsx(Button, { className: sharedClasses, disabled: isSubmitting, onClick: handleCancel, children: "Cancel" }) }) }));
|
|
18
|
+
};
|
|
19
|
+
const FormEngine = ({ fields, onSubmit, initialValues, layout = 'vertical', isNotTrigger, showCancelButton = true, submitButtonText = 'Save', showSubmittingText = true, submitButtonClass, onCancel, getFieldValues, formRef, className, persistenceKey, }) => {
|
|
20
|
+
const { saveFormData, restoreFormData, clearPersistedData, hasPersistedData } = useFormPersistence(persistenceKey);
|
|
21
|
+
// Determine initial values: persisted data takes precedence over provided initialValues
|
|
22
|
+
const getEffectiveInitialValues = () => {
|
|
23
|
+
if (persistenceKey && hasPersistedData()) {
|
|
24
|
+
const persistedData = restoreFormData();
|
|
25
|
+
if (persistedData) {
|
|
26
|
+
return { ...initialValues, ...persistedData };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return initialValues;
|
|
30
|
+
};
|
|
31
|
+
const { control, handleSubmit, watch, formState: { errors, isSubmitting }, reset, setValue, trigger, } = useForm({ mode: 'onBlur', defaultValues: getEffectiveInitialValues() });
|
|
32
|
+
const allFields = watch();
|
|
33
|
+
const password = watch('password');
|
|
34
|
+
const confirmPassword = watch('confirmPassword');
|
|
35
|
+
//re-validate confirmPassword when password changes
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (password && confirmPassword) {
|
|
38
|
+
trigger('confirmPassword');
|
|
39
|
+
}
|
|
40
|
+
}, [password, trigger, confirmPassword]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (getFieldValues) {
|
|
43
|
+
getFieldValues(allFields);
|
|
44
|
+
}
|
|
45
|
+
}, [allFields, getFieldValues]);
|
|
46
|
+
// Save form data when fields change (for persistence)
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (persistenceKey && allFields && Object.keys(allFields).length > 0) {
|
|
49
|
+
// Only save if there are actual field values (not just empty object)
|
|
50
|
+
const hasValues = Object.values(allFields).some((value) => value !== undefined && value !== null && value !== '');
|
|
51
|
+
if (hasValues) {
|
|
52
|
+
saveFormData(allFields, true);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, [allFields, persistenceKey, saveFormData]);
|
|
56
|
+
// Expose form control methods via ref
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (formRef) {
|
|
59
|
+
formRef.current = {
|
|
60
|
+
reset: () => reset(getEffectiveInitialValues()),
|
|
61
|
+
setValue: (name, value) => setValue(name, value),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}, [formRef, reset, setValue, getEffectiveInitialValues]);
|
|
65
|
+
const [submitError, setSubmitError] = useState(null);
|
|
66
|
+
const handleFormSubmit = async (data) => {
|
|
67
|
+
setSubmitError(null);
|
|
68
|
+
try {
|
|
69
|
+
await onSubmit(data);
|
|
70
|
+
// Clear persisted data on successful submission
|
|
71
|
+
if (persistenceKey) {
|
|
72
|
+
clearPersistedData();
|
|
73
|
+
}
|
|
74
|
+
if (!formRef) {
|
|
75
|
+
reset(initialValues);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
setSubmitError(error instanceof Error ? error.message : 'An error occurred');
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
// Enhanced validation functions
|
|
83
|
+
const validatePassword = (value) => {
|
|
84
|
+
if (!value)
|
|
85
|
+
return 'Password is required';
|
|
86
|
+
if (value.length < 8)
|
|
87
|
+
return 'Password must be at least 8 characters';
|
|
88
|
+
return true;
|
|
89
|
+
};
|
|
90
|
+
const validateConfirmPassword = (value) => {
|
|
91
|
+
if (!value)
|
|
92
|
+
return 'Please confirm your password';
|
|
93
|
+
if (!password)
|
|
94
|
+
return 'Please enter a password first';
|
|
95
|
+
if (password.length < 8)
|
|
96
|
+
return 'Please enter a valid password first (minimum 8 characters)';
|
|
97
|
+
if (value !== password)
|
|
98
|
+
return 'Passwords do not match';
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
|
+
return (_jsxs("form", { className: cn(`${layout === 'horizontal' ? 'flex flex-wrap -mx-4' : ''} mb-6 border-gray-400 p-3`, className), onSubmit: handleSubmit(handleFormSubmit), children: [_jsx("div", { className: `${layout === 'vertical' ? 'grid grid-cols-12 gap-2 align-middle' : 'w-full flex flex-wrap'}`, children: fields?.map((field) => {
|
|
102
|
+
// Extract validation logic
|
|
103
|
+
const getFieldValidation = () => {
|
|
104
|
+
if (field.name === 'password') {
|
|
105
|
+
return validatePassword;
|
|
106
|
+
}
|
|
107
|
+
if (field.name === 'confirmPassword') {
|
|
108
|
+
return validateConfirmPassword;
|
|
109
|
+
}
|
|
110
|
+
return field.validation?.validate;
|
|
111
|
+
};
|
|
112
|
+
return (_jsx(FieldWrapper, { field: {
|
|
113
|
+
...field,
|
|
114
|
+
validation: {
|
|
115
|
+
...field.validation,
|
|
116
|
+
validate: getFieldValidation(),
|
|
117
|
+
},
|
|
118
|
+
}, control: control, errors: errors, layout: layout }, field.name));
|
|
119
|
+
}) }), _jsxs("div", { className: clsx('flex col-span-2 mt-4 w-full', showCancelButton ? 'space-x-4' : 'justify-end'), children: [showCancelButton && (_jsx(CancelButton, { isSubmitting: isSubmitting, onCancel: onCancel, isNotTrigger: isNotTrigger, onClearData: persistenceKey ? clearPersistedData : undefined })), _jsx(Button, { type: "submit", className: clsx(showCancelButton ? 'w-full ml-3' : 'w-[20%]', submitButtonClass), disabled: isSubmitting, children: submitButtonText }), isSubmitting && showSubmittingText && _jsx("span", { children: "Submitting..." })] }), submitError && _jsx("p", { className: "text-red-500", children: submitError })] }));
|
|
120
|
+
};
|
|
121
|
+
export default FormEngine;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DependentFieldUpdate, Field, FieldWrapperProps, SelectOption } from '../types';
|
|
3
|
+
interface ExtendedFieldWrapperProps extends FieldWrapperProps {
|
|
4
|
+
onFieldUpdate?: Record<string, DependentFieldUpdate[]>;
|
|
5
|
+
onFieldChange?: (fieldName: string, value: any) => void;
|
|
6
|
+
setValue?: (field: string, value: any) => void;
|
|
7
|
+
clearErrors?: (field: string) => void;
|
|
8
|
+
updateFieldOptions?: (field: string, options: Array<SelectOption | string>) => void;
|
|
9
|
+
updateFieldLabel?: (fieldName: string, newLabelName: string) => void;
|
|
10
|
+
setFieldHidden?: (fieldName: string, hidden: boolean) => void;
|
|
11
|
+
addField?: (fields: Field) => void;
|
|
12
|
+
pendingUpdatesRef?: React.MutableRefObject<Map<string, any>>;
|
|
13
|
+
processingDependencyRef?: React.MutableRefObject<boolean>;
|
|
14
|
+
fieldChangeRef?: React.MutableRefObject<Set<string>>;
|
|
15
|
+
notifyPendingUpdate?: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare const FieldWrapper: React.FC<ExtendedFieldWrapperProps>;
|
|
18
|
+
export default FieldWrapper;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Controller } from 'react-hook-form';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { getInputComponent } from '../registry';
|
|
5
|
+
const FieldWrapper = ({ field, control, errors, layout, onFieldUpdate, onFieldChange, pendingUpdatesRef, fieldChangeRef, notifyPendingUpdate, }) => {
|
|
6
|
+
const InputComponent = getInputComponent(field.type);
|
|
7
|
+
const wrapperClass = useMemo(() => {
|
|
8
|
+
if (layout === 'horizontal') {
|
|
9
|
+
return 'w-1/2 px-4';
|
|
10
|
+
}
|
|
11
|
+
return `col-span-${field?.gridSpan ?? '12'}`;
|
|
12
|
+
}, [layout, field?.gridSpan]);
|
|
13
|
+
if (!InputComponent) {
|
|
14
|
+
console.error(`No component registered for type: ${field.type}`);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const handleFieldChange = (value, onChange, onChangeField) => {
|
|
18
|
+
// Extract actual value from event if needed
|
|
19
|
+
let actualValue = value;
|
|
20
|
+
if (value && typeof value === 'object' && value.target !== undefined) {
|
|
21
|
+
// This is a SyntheticEvent, extract the value
|
|
22
|
+
actualValue = value.target.value;
|
|
23
|
+
}
|
|
24
|
+
// Call the provided onChange function with the actual value
|
|
25
|
+
onChange(actualValue);
|
|
26
|
+
// Call any custom onChange handler if provided
|
|
27
|
+
if (onChangeField) {
|
|
28
|
+
onChangeField(actualValue);
|
|
29
|
+
}
|
|
30
|
+
// Call the onFieldChange callback if provided
|
|
31
|
+
if (onFieldChange) {
|
|
32
|
+
onFieldChange(field.name, actualValue);
|
|
33
|
+
}
|
|
34
|
+
// Only queue field updates if this field has dependencies
|
|
35
|
+
if (onFieldUpdate?.[field.name]) {
|
|
36
|
+
if (fieldChangeRef && !fieldChangeRef.current.has(field.name)) {
|
|
37
|
+
fieldChangeRef.current.add(field.name);
|
|
38
|
+
}
|
|
39
|
+
// Add the update to the pending queue
|
|
40
|
+
if (pendingUpdatesRef) {
|
|
41
|
+
pendingUpdatesRef.current.set(field.name, actualValue);
|
|
42
|
+
if (notifyPendingUpdate) {
|
|
43
|
+
notifyPendingUpdate(); // Notify parent component about update
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
if (field.name === 'email') {
|
|
49
|
+
field.validation = {
|
|
50
|
+
...field.validation,
|
|
51
|
+
pattern: {
|
|
52
|
+
value: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
|
|
53
|
+
message: 'Please enter a valid email address',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Skip rendering if field is hidden
|
|
58
|
+
if (field.isHidden) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return (_jsx("div", { className: `${wrapperClass} mb-2`, children: _jsx(Controller, { name: field.name, control: control, rules: field.validation, render: ({ field: inputProps }) => (_jsx("div", { className: "flex flex-col", children: _jsx(InputComponent, { ...inputProps, field: field, error: errors[field.name], onChange: (value) => handleFieldChange(value, inputProps.onChange, field?.onChange), options: field.options ?? [] }) })) }) }));
|
|
62
|
+
};
|
|
63
|
+
export default FieldWrapper;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CardExpiryInputProps {
|
|
3
|
+
field: {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
};
|
|
9
|
+
error?: {
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const CardExpiryInput: React.ForwardRefExoticComponent<CardExpiryInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export default CardExpiryInput;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { forwardRef, useCallback, useState } from 'react';
|
|
3
|
+
import { Input } from '../../../../components';
|
|
4
|
+
const CardExpiryInput = forwardRef(({ field, error, value, onChange, ...props }, ref) => {
|
|
5
|
+
const [formattedValue, setFormattedValue] = useState('');
|
|
6
|
+
// Format expiry date with slash
|
|
7
|
+
const formatExpiry = useCallback((input) => {
|
|
8
|
+
const numbers = input.replace(/\D/g, '');
|
|
9
|
+
if (numbers.length >= 2) {
|
|
10
|
+
return `${numbers.slice(0, 2)}/${numbers.slice(2, 4)}`;
|
|
11
|
+
}
|
|
12
|
+
return numbers;
|
|
13
|
+
}, []);
|
|
14
|
+
// Validate month value
|
|
15
|
+
const isValidMonth = useCallback((month) => {
|
|
16
|
+
const monthNum = parseInt(month, 10);
|
|
17
|
+
return monthNum >= 1 && monthNum <= 12;
|
|
18
|
+
}, []);
|
|
19
|
+
// Handle input change
|
|
20
|
+
const handleChange = useCallback((e) => {
|
|
21
|
+
const input = e.target.value;
|
|
22
|
+
const numbers = input.replace(/\D/g, '');
|
|
23
|
+
// Prevent more than 4 digits
|
|
24
|
+
if (numbers.length > 4)
|
|
25
|
+
return;
|
|
26
|
+
// Validate month when 2 digits are entered
|
|
27
|
+
if (numbers.length >= 2) {
|
|
28
|
+
const month = numbers.slice(0, 2);
|
|
29
|
+
if (!isValidMonth(month))
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const formatted = formatExpiry(numbers);
|
|
33
|
+
setFormattedValue(formatted);
|
|
34
|
+
// Call parent onChange with raw numeric value
|
|
35
|
+
if (onChange) {
|
|
36
|
+
onChange(numbers);
|
|
37
|
+
}
|
|
38
|
+
}, [formatExpiry, isValidMonth, onChange]);
|
|
39
|
+
// Handle initial value formatting
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (value) {
|
|
42
|
+
setFormattedValue(formatExpiry(value));
|
|
43
|
+
}
|
|
44
|
+
}, [value, formatExpiry]);
|
|
45
|
+
return (_jsxs("div", { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(Input, { ...props, id: field.name, ref: ref, value: formattedValue, onChange: handleChange, disabled: field.disabled, placeholder: field.placeholder || 'MM/YY', maxLength: 5, inputMode: "numeric", pattern: "\\d*", 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 })] }));
|
|
46
|
+
});
|
|
47
|
+
CardExpiryInput.displayName = 'CardExpiryInput';
|
|
48
|
+
export default CardExpiryInput;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox, Label } from 'flowbite-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
const CheckboxInput = React.forwardRef(({ field, error, onChange, ...props }, ref) => (_jsxs("div", { className: "flex flex-row items-start space-x-3 space-y-0", children: [_jsx("div", { className: "flex items-center h-4 mt-1", children: _jsx(Checkbox, { id: field.name, disabled: field.disabled, onChange: (e) => onChange(e.target.checked), ref: ref, ...props, color: error ? 'failure' : 'primary' }) }), _jsxs("div", { className: "space-y-1 leading-none", children: [field.label && (_jsx(Label, { htmlFor: field.name, className: "text-sm font-medium text-gray-700 cursor-pointer", children: field.label })), error && _jsx("p", { className: "text-xs text-red-500", children: error.message })] })] })));
|
|
5
|
+
export default CheckboxInput;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { Input } from '../../../../components';
|
|
4
|
+
const CARD_PATTERNS = {
|
|
5
|
+
visa: '4',
|
|
6
|
+
mastercard: {
|
|
7
|
+
twoDigitPrefixes: ['51', '52', '53', '54', '55'],
|
|
8
|
+
fourDigitPrefixStart: '2',
|
|
9
|
+
fourDigitSecondMin: 2,
|
|
10
|
+
fourDigitSecondMax: 7,
|
|
11
|
+
fourDigitThirdMin: 2,
|
|
12
|
+
fourDigitThirdMax: 9,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
// SVG icons for card types
|
|
16
|
+
const CardIcons = {
|
|
17
|
+
visa: (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", width: "24px", height: "24px", children: [_jsx("path", { fill: "#1565C0", d: "M45,35c0,2.209-1.791,4-4,4H7c-2.209,0-4-1.791-4-4V13c0-2.209,1.791-4,4-4h34c2.209,0,4,1.791,4,4V35z" }), _jsx("path", { fill: "#FFF", d: "M15.186 19l-2.626 7.832c0 0-.667-3.313-.733-3.729-1.495-3.411-3.701-3.221-3.701-3.221L10.726 30v-.002h3.161L18.258 19H15.186zM17.689 30L20.56 30 22.296 19 19.389 19zM38.008 19h-3.021l-4.71 11h2.852l.588-1.571h3.596L37.619 30h2.613L38.008 19zM34.513 26.328l1.563-4.157.818 4.157H34.513zM26.369 22.206c0-.606.498-1.057 1.926-1.057.928 0 1.991.674 1.991.674l.466-2.309c0 0-1.358-.515-2.691-.515-3.019 0-4.576 1.444-4.576 3.272 0 3.306 3.979 2.853 3.979 4.551 0 .291-.231.964-1.888.964-1.662 0-2.759-.609-2.759-.609l-.495 2.216c0 0 1.063.606 3.117.606 2.059 0 4.915-1.54 4.915-3.752C30.354 23.586 26.369 23.394 26.369 22.206z" }), _jsx("path", { fill: "#FFC107", d: "M12.212,24.945l-0.966-4.748c0,0-0.437-1.029-1.573-1.029c-1.136,0-4.44,0-4.44,0S10.894,20.84,12.212,24.945z" })] })),
|
|
18
|
+
mastercard: (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", width: "35px", height: "35px", children: [_jsx("path", { fill: "#ff9800", d: "M32 10A14 14 0 1 0 32 38A14 14 0 1 0 32 10Z" }), _jsx("path", { fill: "#d50000", d: "M16 10A14 14 0 1 0 16 38A14 14 0 1 0 16 10Z" }), _jsx("path", { fill: "#ff3d00", d: "M18,24c0,4.755,2.376,8.95,6,11.48c3.624-2.53,6-6.725,6-11.48s-2.376-8.95-6-11.48 C20.376,15.05,18,19.245,18,24z" })] })),
|
|
19
|
+
};
|
|
20
|
+
const CreditCardInput = forwardRef(({ field, error, onChange, value, ...props }, ref) => {
|
|
21
|
+
const [cardType, setCardType] = useState(null);
|
|
22
|
+
const [formattedValue, setFormattedValue] = useState('');
|
|
23
|
+
// Format card number with spaces
|
|
24
|
+
const formatCardNumber = useCallback((input) => {
|
|
25
|
+
const numbers = input.replace(/\D/g, '');
|
|
26
|
+
const groups = numbers.match(/.{1,4}/g) || [];
|
|
27
|
+
return groups.join(' ');
|
|
28
|
+
}, []);
|
|
29
|
+
// Detect card type
|
|
30
|
+
const detectCardType = useCallback((input) => {
|
|
31
|
+
const numbers = input.replace(/\D/g, '');
|
|
32
|
+
// Check Visa (starts with 4)
|
|
33
|
+
if (numbers.startsWith(CARD_PATTERNS.visa))
|
|
34
|
+
return 'visa';
|
|
35
|
+
// Check Mastercard
|
|
36
|
+
if (
|
|
37
|
+
// Check 51-55 prefixes
|
|
38
|
+
CARD_PATTERNS.mastercard.twoDigitPrefixes.some((prefix) => numbers.startsWith(prefix)) ||
|
|
39
|
+
// Check 222x-279x prefixes
|
|
40
|
+
(numbers.length >= 4 &&
|
|
41
|
+
numbers.startsWith(CARD_PATTERNS.mastercard.fourDigitPrefixStart) &&
|
|
42
|
+
Number(numbers[1]) >= CARD_PATTERNS.mastercard.fourDigitSecondMin &&
|
|
43
|
+
Number(numbers[1]) <= CARD_PATTERNS.mastercard.fourDigitSecondMax &&
|
|
44
|
+
Number(numbers[2]) >= CARD_PATTERNS.mastercard.fourDigitThirdMin &&
|
|
45
|
+
Number(numbers[2]) <= CARD_PATTERNS.mastercard.fourDigitThirdMax)) {
|
|
46
|
+
return 'mastercard';
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}, []);
|
|
50
|
+
// Handle input change
|
|
51
|
+
const handleChange = useCallback((e) => {
|
|
52
|
+
const input = e.target.value;
|
|
53
|
+
const numbers = input.replace(/\D/g, '');
|
|
54
|
+
if (numbers.length > 16)
|
|
55
|
+
return;
|
|
56
|
+
const formatted = formatCardNumber(numbers);
|
|
57
|
+
const type = detectCardType(numbers);
|
|
58
|
+
setFormattedValue(formatted);
|
|
59
|
+
setCardType(type);
|
|
60
|
+
// Call parent onChange with raw numeric value
|
|
61
|
+
if (onChange) {
|
|
62
|
+
const event = {
|
|
63
|
+
...e,
|
|
64
|
+
target: {
|
|
65
|
+
...e.target,
|
|
66
|
+
value: numbers,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
onChange(event);
|
|
70
|
+
}
|
|
71
|
+
}, [formatCardNumber, detectCardType, onChange]);
|
|
72
|
+
// Initialize formatted value when value prop changes
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (value) {
|
|
75
|
+
setFormattedValue(formatCardNumber(value.toString()));
|
|
76
|
+
setCardType(detectCardType(value.toString()));
|
|
77
|
+
}
|
|
78
|
+
}, [value, formatCardNumber, detectCardType]);
|
|
79
|
+
return (_jsxs("div", { className: "relative", children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsxs("div", { className: "relative", children: [_jsx(Input, { ...props, id: field.name, ref: ref, type: "creditCard", value: formattedValue, onChange: handleChange, disabled: field.disabled, placeholder: field.placeholder ?? '4242 4242 4242 4242', 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 pr-12` }), _jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: cardType && CardIcons[cardType] })] }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] }));
|
|
80
|
+
});
|
|
81
|
+
CreditCardInput.displayName = 'CreditCardInput';
|
|
82
|
+
export default CreditCardInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DatePicker } from '../../../../components';
|
|
4
|
+
const DateInput = React.forwardRef(({ field, error, ...props }, ref) => {
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "mb-1 block text-sm font-medium text-gray-700", children: field.label }), _jsx(DatePicker, { ...props, ref: ref, id: field.name, disabled: field.disabled, placeholder: field.placeholder, className: `mt-1 block w-full p-2 ${error ? 'border-red-500' : 'border-gray-300'} rounded-md shadow-sm disabled:text-gray-400 disabled:bg-gray-50 disabled:cursor-not-allowed` }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] }));
|
|
6
|
+
});
|
|
7
|
+
export default DateInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DateInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DateInput';
|
|
@@ -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 EmailInput = 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: "email", ...props, ref: ref, id: field.name, disabled: field.disabled, placeholder: field.placeholder, 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 EmailInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './EmailInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './EmailInput';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as DateInput } from './date-input';
|
|
2
|
+
export { default as EmailInput } from './email-input';
|
|
3
|
+
export { default as LabelInput } from './label-input';
|
|
4
|
+
export { default as NumberInput } from './number-input';
|
|
5
|
+
export { default as PasswordInput } from './password-input';
|
|
6
|
+
export { default as RadioInput } from './radio-button';
|
|
7
|
+
export { default as SelectInput } from './select';
|
|
8
|
+
export { default as TextareaInput } from './textarea-input';
|
|
9
|
+
export { default as TimeInput } from './time-input';
|
|
10
|
+
export { default as ToggleSwitchInput } from './toggle-switch-input';
|
|
11
|
+
export { default as UploadFieldForm } from './upload-field';
|
|
12
|
+
export { default as CreditCardInput } from './credit-card-input/CreditCardInput';
|
|
13
|
+
export { default as ExpiryInput } from './card-expiry-input/CardExpiryInput';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as DateInput } from './date-input';
|
|
2
|
+
export { default as EmailInput } from './email-input';
|
|
3
|
+
export { default as LabelInput } from './label-input';
|
|
4
|
+
export { default as NumberInput } from './number-input';
|
|
5
|
+
export { default as PasswordInput } from './password-input';
|
|
6
|
+
export { default as RadioInput } from './radio-button';
|
|
7
|
+
export { default as SelectInput } from './select';
|
|
8
|
+
export { default as TextareaInput } from './textarea-input';
|
|
9
|
+
export { default as TimeInput } from './time-input';
|
|
10
|
+
export { default as ToggleSwitchInput } from './toggle-switch-input';
|
|
11
|
+
export { default as UploadFieldForm } from './upload-field';
|
|
12
|
+
export { default as CreditCardInput } from './credit-card-input/CreditCardInput';
|
|
13
|
+
export { default as ExpiryInput } from './card-expiry-input/CardExpiryInput';
|
|
@@ -0,0 +1,7 @@
|
|
|
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 LabelInput = React.forwardRef(({ field, error, ...props }, ref) => {
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(Input, { ...props, id: field.name, ref: ref, disabled: field.disabled, placeholder: field.placeholder, 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 })] }));
|
|
6
|
+
});
|
|
7
|
+
export default LabelInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './LabelInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './LabelInput';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputSelectProps } from '../../../types';
|
|
3
|
+
declare const MultiSelectInputComponent: React.ForwardRefExoticComponent<Omit<InputSelectProps, "ref"> & React.RefAttributes<HTMLSelectElement>>;
|
|
4
|
+
export default MultiSelectInputComponent;
|
|
@@ -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 { MultiSelect } from '../../../../components';
|
|
4
|
+
const MultiSelectInputComponent = React.forwardRef(({ field, error, options, ...props }, ref) => (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(MultiSelect, { className: "w-full border-gray-300 pb-5 disabled:text-gray-400 disabled:bg-gray-50 disabled:cursor-not-allowed", options: (options ?? []), value: props.value, defaultValue: props.value, disabled: field.disabled, onChange: props.onChange, tagPosition: "bottom" }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] })));
|
|
5
|
+
export default MultiSelectInputComponent;
|
|
@@ -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 NumberInput = 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: "number", ...props, ref: ref, id: field.name, disabled: field.disabled, placeholder: field.placeholder, 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 NumberInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './NumberInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './NumberInput';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Icon, Input } from '../../../../components';
|
|
4
|
+
const PasswordInput = React.forwardRef(({ field, error, ...props }, ref) => {
|
|
5
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
6
|
+
const handleShowPassword = () => setShowPassword(!showPassword);
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsxs("div", { className: "relative", children: [_jsx(Input, { type: showPassword ? 'text' : 'password', ...props, ref: ref, id: field.name, placeholder: field.placeholder, className: `mt-1 block w-full p-2 border ${error ? 'border-red-500' : 'border-gray-300'} rounded-md shadow-sm` }), _jsx("button", { className: "absolute inset-y-0 right-2 pr-3 flex items-center", type: "button", onClick: handleShowPassword, children: showPassword ? _jsx(Icon, { name: 'FaEye', size: 20 }) : _jsx(Icon, { name: 'FaEyeSlash', size: 20 }) })] }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] }));
|
|
8
|
+
});
|
|
9
|
+
export default PasswordInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PasswordInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PasswordInput';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Controller } from 'react-hook-form';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Label, RadioGroup, RadioGroupItem } from '../../../../components';
|
|
5
|
+
const RadioInput = React.forwardRef(({ field, error, control }, ref) => (_jsxs("div", { ref: ref, children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(Controller, { name: field.name, control: control, rules: field.validation, render: ({ field: { onChange, value } }) => (_jsx(RadioGroup, { onValueChange: onChange, value: value, disabled: field.disabled, className: "space-y-2 disabled:bg-gray-50", children: field.options.map((option, index) => (_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: option, id: `${field.name}-${index}`, disabled: field.disabled }), _jsx(Label, { htmlFor: `${field.name}-${index}`, children: option })] }, index))) })) }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] })));
|
|
6
|
+
export default RadioInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RadioInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './RadioInput';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from '../../../../components';
|
|
4
|
+
const SelectInput = React.forwardRef(({ field, error, options, ...props }, ref) => (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsxs(Select, { onValueChange: props.onChange, value: props.value, disabled: field.disabled, children: [_jsx(SelectTrigger, { className: "w-full border-gray-300 disabled:text-gray-400 disabled:bg-gray-50", children: _jsx(SelectValue, { placeholder: field.label }) }), _jsx(SelectContent, { children: _jsx(SelectGroup, { children: options &&
|
|
5
|
+
options.map((item) => (_jsx(SelectItem, { value: item.value, children: item.label }, item.value))) }) })] }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] })));
|
|
6
|
+
export default SelectInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SelectInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SelectInput';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Textarea } from '../../../../components';
|
|
4
|
+
const TextareaInputFW = React.forwardRef(({ field, error, ...props }, ref) => (_jsxs("div", { ref: ref, children: [_jsx("label", { htmlFor: field.name, className: "block text-sm font-medium text-gray-700", children: field.label }), _jsx(Textarea, { 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`, ...props, placeholder: field?.placeholder ?? ' ', disabled: field.disabled }), error && _jsx("p", { className: "mt-2 text-sm text-red-500", children: error.message })] })));
|
|
5
|
+
export default TextareaInputFW;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextareaInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TextareaInput';
|