@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,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for FilterSection component
|
|
4
|
+
*/
|
|
5
|
+
interface FilterSectionProps {
|
|
6
|
+
/** Title of the filter section */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Whether the section is expanded or collapsed */
|
|
9
|
+
expanded: boolean;
|
|
10
|
+
/** Function to toggle expand/collapse state */
|
|
11
|
+
toggleExpand: () => void;
|
|
12
|
+
/** Child elements to render inside the section when expanded */
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* FilterSection component for creating expandable/collapsible sections in a filter sidebar
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <FilterSection
|
|
21
|
+
* title="Category"
|
|
22
|
+
* expanded={expandedSections.categories}
|
|
23
|
+
* toggleExpand={() => toggleSection("categories")}
|
|
24
|
+
* >
|
|
25
|
+
* <FilterList ... />
|
|
26
|
+
* </FilterSection>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const FilterSection: React.FC<FilterSectionProps>;
|
|
30
|
+
export default FilterSection;
|
|
31
|
+
export type { FilterSectionProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { RiArrowDownSLine, RiArrowUpSLine } from 'react-icons/ri';
|
|
4
|
+
/**
|
|
5
|
+
* FilterSection component for creating expandable/collapsible sections in a filter sidebar
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <FilterSection
|
|
10
|
+
* title="Category"
|
|
11
|
+
* expanded={expandedSections.categories}
|
|
12
|
+
* toggleExpand={() => toggleSection("categories")}
|
|
13
|
+
* >
|
|
14
|
+
* <FilterList ... />
|
|
15
|
+
* </FilterSection>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const FilterSection = ({ title, expanded, toggleExpand, children }) => {
|
|
19
|
+
return (_jsxs("div", { className: "border-b border-gray-200 py-4", children: [_jsxs("button", { className: "flex w-full items-center justify-between text-lg font-medium hover:text-primary-700", onClick: toggleExpand, "aria-expanded": expanded, "aria-controls": `filter-section-${title.toLowerCase().replace(/\s+/g, '-')}`, children: [title, expanded ? _jsx(RiArrowUpSLine, { size: 20, "aria-hidden": "true" }) : _jsx(RiArrowDownSLine, { size: 20, "aria-hidden": "true" })] }), expanded && (_jsx("div", { className: "mt-3", id: `filter-section-${title.toLowerCase().replace(/\s+/g, '-')}`, children: children }))] }));
|
|
20
|
+
};
|
|
21
|
+
export default FilterSection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const FilterWrapper = ({ isNarrow, children }) => {
|
|
3
|
+
return (_jsx("div", { className: "bg-gray-50 shadow-xl rounded-lg p-4 mb-2", children: _jsx("div", { className: isNarrow
|
|
4
|
+
? 'flex flex-col w-full space-y-4'
|
|
5
|
+
: 'flex flex-row justify-between items-start w-full space-y-0 space-x-0 sm:space-x-4', children: children }) }));
|
|
6
|
+
};
|
|
7
|
+
export default FilterWrapper;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
+
import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const useFormField: () => {
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
isDirty: boolean;
|
|
9
|
+
isTouched: boolean;
|
|
10
|
+
isValidating: boolean;
|
|
11
|
+
error?: import("react-hook-form").FieldError;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
formItemId: string;
|
|
15
|
+
formDescriptionId: string;
|
|
16
|
+
formMessageId: string;
|
|
17
|
+
};
|
|
18
|
+
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
20
|
+
declare const FormControl: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
21
|
+
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
22
|
+
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
23
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { Controller, FormProvider, useFormContext, } from 'react-hook-form';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '../../helpers';
|
|
6
|
+
import { Label } from '../ui';
|
|
7
|
+
const Form = FormProvider;
|
|
8
|
+
const FormFieldContext = React.createContext({});
|
|
9
|
+
const FormField = ({ ...props }) => {
|
|
10
|
+
const value = React.useMemo(() => ({ name: props.name }), [props.name]);
|
|
11
|
+
return (_jsx(FormFieldContext.Provider, { value: value, children: _jsx(Controller, { ...props }) }));
|
|
12
|
+
};
|
|
13
|
+
const useFormField = () => {
|
|
14
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
15
|
+
const itemContext = React.useContext(FormItemContext);
|
|
16
|
+
const { getFieldState, formState } = useFormContext();
|
|
17
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
18
|
+
if (!fieldContext) {
|
|
19
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
20
|
+
}
|
|
21
|
+
const { id } = itemContext;
|
|
22
|
+
return {
|
|
23
|
+
id,
|
|
24
|
+
name: fieldContext.name,
|
|
25
|
+
formItemId: `${id}-form-item`,
|
|
26
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
27
|
+
formMessageId: `${id}-form-item-message`,
|
|
28
|
+
...fieldState,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const FormItemContext = React.createContext({});
|
|
32
|
+
const FormItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
33
|
+
const id = React.useId();
|
|
34
|
+
const value = React.useMemo(() => ({ id }), [id]);
|
|
35
|
+
return (_jsx(FormItemContext.Provider, { value: value, children: _jsx("div", { ref: ref, className: cn('space-y-2', className), ...props }) }));
|
|
36
|
+
});
|
|
37
|
+
FormItem.displayName = 'FormItem';
|
|
38
|
+
const FormLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
39
|
+
const { error, formItemId } = useFormField();
|
|
40
|
+
return _jsx(Label, { ref: ref, className: cn(error && 'text-destructive', className), htmlFor: formItemId, ...props });
|
|
41
|
+
});
|
|
42
|
+
FormLabel.displayName = 'FormLabel';
|
|
43
|
+
const FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
44
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
45
|
+
return (_jsx(Slot, { ref: ref, id: formItemId, "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error, ...props }));
|
|
46
|
+
});
|
|
47
|
+
FormControl.displayName = 'FormControl';
|
|
48
|
+
const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
49
|
+
const { formDescriptionId } = useFormField();
|
|
50
|
+
return (_jsx("p", { ref: ref, id: formDescriptionId, className: cn('text-[0.8rem] text-muted-foreground', className), ...props }));
|
|
51
|
+
});
|
|
52
|
+
FormDescription.displayName = 'FormDescription';
|
|
53
|
+
const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
54
|
+
const { error, formMessageId } = useFormField();
|
|
55
|
+
const body = error ? String(error?.message) : children;
|
|
56
|
+
if (!body) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (_jsx("p", { ref: ref, id: formMessageId, className: cn('text-[0.8rem] font-medium text-destructive', className), ...props, children: body }));
|
|
60
|
+
});
|
|
61
|
+
FormMessage.displayName = 'FormMessage';
|
|
62
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { HiClipboardCopy } from 'react-icons/hi';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
const HoverableValue = ({ value, truncatedValue }) => {
|
|
5
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
6
|
+
return (_jsxs("button", { "aria-label": "Copy to clipboard", className: "relative flex cursor-pointer items-center", onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => navigator.clipboard.writeText(value), children: [_jsx("span", { title: value, children: truncatedValue }), isHovered && _jsx(HiClipboardCopy, { className: "ml-2 text-gray-500 hover:text-gray-800", title: "Copy to clipboard" })] }));
|
|
7
|
+
};
|
|
8
|
+
export default HoverableValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IconType } from 'react-icons';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type ButtonProps } from './Button';
|
|
4
|
+
interface IconButtonProps extends ButtonProps {
|
|
5
|
+
icon: IconType;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export default IconButton;
|
|
10
|
+
export type { IconButtonProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../../helpers';
|
|
4
|
+
import Button from './Button';
|
|
5
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
6
|
+
const IconButton = React.forwardRef(({ icon: Icon, label, size = 'default', variant = 'primary', className, children, ...props }, ref) => {
|
|
7
|
+
return (_jsxs(Button, { variant: variant, ref: ref, "aria-label": label, size: size, className: cn('flex flex-row flex-nowrap text-nowrap items-center', className), ...props, children: [_jsx(Icon, { size: 20, "aria-hidden": "true", className: children ? 'mr-2' : '' }), children] }));
|
|
8
|
+
});
|
|
9
|
+
IconButton.displayName = 'IconButton';
|
|
10
|
+
export default IconButton;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ImageUploaderProps {
|
|
3
|
+
project: 'vas' | 'stocklink' | 'events';
|
|
4
|
+
env: 'dev' | 'uat' | 'prod';
|
|
5
|
+
onUploadSuccess?: (url: string) => void;
|
|
6
|
+
onError?: (error: Error) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
maxFileSize?: number;
|
|
10
|
+
acceptedFileTypes?: string[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
showPreview?: boolean;
|
|
13
|
+
value?: string;
|
|
14
|
+
onChange?: (url: string | null) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const ImageUploader: React.FC<ImageUploaderProps>;
|
|
17
|
+
export default ImageUploader;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Image as ImageIcon, Loader2, Upload, X } from 'lucide-react';
|
|
4
|
+
import { useDropzone } from 'react-dropzone';
|
|
5
|
+
import { useCallback, useState } from 'react';
|
|
6
|
+
import { Button, cn, useToast } from '../..';
|
|
7
|
+
import { generateSecureRandomString } from '../../shared';
|
|
8
|
+
import { uploadFileWithXHR } from '../../shared/utils/functionHelper';
|
|
9
|
+
import { Progress } from './Progress';
|
|
10
|
+
const ImageUploader = ({ project, env, onUploadSuccess, onError, className, disabled = false, maxFileSize = 5 * 1024 * 1024, // 5MB default
|
|
11
|
+
acceptedFileTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'], placeholder = 'Click to upload or drag and drop an image', showPreview = true, value, onChange, }) => {
|
|
12
|
+
const [previewUrl, setPreviewUrl] = useState(value || null);
|
|
13
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
14
|
+
const [uploadProgress, setUploadProgress] = useState(0);
|
|
15
|
+
const [error, setError] = useState(null);
|
|
16
|
+
const { addToast } = useToast();
|
|
17
|
+
const generateFileName = (originalName) => {
|
|
18
|
+
const timestamp = Date.now();
|
|
19
|
+
const randomString = generateSecureRandomString();
|
|
20
|
+
const extension = originalName.split('.').pop() || 'jpg';
|
|
21
|
+
return `${timestamp}_${randomString}.${extension}`;
|
|
22
|
+
};
|
|
23
|
+
const getPresignedUrl = async (fileName, contentType) => {
|
|
24
|
+
// This should be configurable or injected, but for now using a default endpoint
|
|
25
|
+
const endpoint = process.env.NEXT_PUBLIC_UPLOAD_URL_ENDPOINT ||
|
|
26
|
+
'https://faas-ams3-2a2df116.doserverless.co/api/v1/web/fn-2c9f1cfc-1296-4367-89d8-12409763dae6/default/upload-url';
|
|
27
|
+
const response = await fetch(endpoint, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify({
|
|
33
|
+
project,
|
|
34
|
+
env,
|
|
35
|
+
fileName,
|
|
36
|
+
contentType,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`Failed to get upload URL: ${response.statusText}`);
|
|
41
|
+
}
|
|
42
|
+
// --- FIX: unwrap .data if present ---
|
|
43
|
+
const json = await response.json();
|
|
44
|
+
const data = json.data || json;
|
|
45
|
+
return {
|
|
46
|
+
uploadURL: data.uploadURL,
|
|
47
|
+
publicURL: data.publicURL,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const uploadFile = async (file) => {
|
|
51
|
+
const fileName = generateFileName(file.name);
|
|
52
|
+
try {
|
|
53
|
+
// Get pre-signed URL
|
|
54
|
+
const { uploadURL, publicURL } = await getPresignedUrl(fileName, file.type);
|
|
55
|
+
// Upload file using XMLHttpRequest
|
|
56
|
+
await uploadFileWithXHR(uploadURL, file);
|
|
57
|
+
return publicURL;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error('Upload error:', error);
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const handleFileUpload = async (file) => {
|
|
65
|
+
if (disabled)
|
|
66
|
+
return;
|
|
67
|
+
setError(null);
|
|
68
|
+
setIsUploading(true);
|
|
69
|
+
setUploadProgress(0);
|
|
70
|
+
try {
|
|
71
|
+
// Validate file type
|
|
72
|
+
if (!acceptedFileTypes.includes(file.type)) {
|
|
73
|
+
throw new Error(`File type not supported. Accepted types: ${acceptedFileTypes.join(', ')}`);
|
|
74
|
+
}
|
|
75
|
+
// Validate file size
|
|
76
|
+
if (file.size > maxFileSize) {
|
|
77
|
+
throw new Error(`File size exceeds ${Math.round(maxFileSize / 1024 / 1024)}MB limit`);
|
|
78
|
+
}
|
|
79
|
+
// Show preview immediately
|
|
80
|
+
if (showPreview) {
|
|
81
|
+
const reader = new FileReader();
|
|
82
|
+
reader.onload = (e) => {
|
|
83
|
+
setPreviewUrl(e.target?.result);
|
|
84
|
+
};
|
|
85
|
+
reader.readAsDataURL(file);
|
|
86
|
+
}
|
|
87
|
+
// Simulate progress (since we can't track actual upload progress with fetch)
|
|
88
|
+
const progressInterval = setInterval(() => {
|
|
89
|
+
setUploadProgress((prev) => {
|
|
90
|
+
if (prev < 90)
|
|
91
|
+
return prev + 10;
|
|
92
|
+
return prev;
|
|
93
|
+
});
|
|
94
|
+
}, 200);
|
|
95
|
+
const publicURL = await uploadFile(file);
|
|
96
|
+
clearInterval(progressInterval);
|
|
97
|
+
setUploadProgress(100);
|
|
98
|
+
// Update state
|
|
99
|
+
onChange?.(publicURL);
|
|
100
|
+
onUploadSuccess?.(publicURL);
|
|
101
|
+
addToast({
|
|
102
|
+
message: 'Image uploaded successfully!',
|
|
103
|
+
variant: 'success',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
const errorMessage = error instanceof Error ? error.message : 'Upload failed';
|
|
108
|
+
setError(errorMessage);
|
|
109
|
+
setPreviewUrl(null);
|
|
110
|
+
onChange?.(null);
|
|
111
|
+
onError?.(error instanceof Error ? error : new Error(errorMessage));
|
|
112
|
+
addToast({
|
|
113
|
+
message: errorMessage,
|
|
114
|
+
variant: 'error',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
setIsUploading(false);
|
|
119
|
+
setUploadProgress(0);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const onDrop = useCallback((acceptedFiles) => {
|
|
123
|
+
const file = acceptedFiles[0];
|
|
124
|
+
if (file) {
|
|
125
|
+
handleFileUpload(file);
|
|
126
|
+
}
|
|
127
|
+
}, [disabled, acceptedFileTypes, maxFileSize]);
|
|
128
|
+
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
129
|
+
onDrop,
|
|
130
|
+
accept: acceptedFileTypes.reduce((acc, type) => {
|
|
131
|
+
acc[type] = [];
|
|
132
|
+
return acc;
|
|
133
|
+
}, {}),
|
|
134
|
+
maxFiles: 1,
|
|
135
|
+
disabled: disabled || isUploading,
|
|
136
|
+
});
|
|
137
|
+
const handleRemove = () => {
|
|
138
|
+
setPreviewUrl(null);
|
|
139
|
+
setError(null);
|
|
140
|
+
onChange?.(null);
|
|
141
|
+
};
|
|
142
|
+
return (_jsxs("div", { className: cn('w-full', className), children: [previewUrl && showPreview ? (_jsxs("div", { className: "relative mb-4", children: [_jsx("img", { src: previewUrl, alt: "Preview", className: "max-h-64 w-full rounded-lg object-contain border border-gray-200" }), !isUploading && (_jsx(Button, { type: "button", variant: "destructive", size: "sm", className: "absolute top-2 right-2", onClick: handleRemove, children: _jsx(X, { className: "h-4 w-4" }) }))] })) : (_jsxs("div", { ...getRootProps(), className: cn('border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer transition-colors hover:border-gray-400', isDragActive && 'border-blue-500 bg-blue-50', disabled && 'cursor-not-allowed opacity-50', error && 'border-red-500 bg-red-50'), children: [_jsx("input", { ...getInputProps() }), isUploading ? (_jsxs("div", { className: "flex flex-col items-center space-y-2", children: [_jsx(Loader2, { className: "h-8 w-8 animate-spin text-blue-500" }), _jsx("p", { className: "text-sm text-gray-600", children: "Uploading image..." }), _jsx(Progress, { value: uploadProgress, className: "w-full max-w-xs" })] })) : (_jsxs("div", { className: "flex flex-col items-center space-y-2", children: [isDragActive ? (_jsx(Upload, { className: "h-8 w-8 text-blue-500" })) : (_jsx(ImageIcon, { className: "h-8 w-8 text-gray-400" })), _jsx("p", { className: "text-sm text-gray-600", children: isDragActive ? 'Drop the image here' : placeholder }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Supported formats: ", acceptedFileTypes.map((type) => type.split('/')[1]).join(', ')] }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Max size: ", Math.round(maxFileSize / 1024 / 1024), "MB"] })] }))] })), error && _jsx("p", { className: "mt-2 text-sm text-red-600", children: error })] }));
|
|
143
|
+
};
|
|
144
|
+
export default ImageUploader;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../../helpers';
|
|
4
|
+
const Input = React.forwardRef(({ className, type, id, placeholder, ...props }, ref) => {
|
|
5
|
+
return (_jsx("input", { id: id, type: type, className: cn('h-9 w-full rounded-md border-gray-300 bg-transparent px-3 py-2 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', className), placeholder: placeholder, ref: ref, ...props }));
|
|
6
|
+
});
|
|
7
|
+
Input.displayName = 'Input';
|
|
8
|
+
export default Input;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
|
|
5
|
+
export default Label;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { cn } from '../../helpers';
|
|
6
|
+
const labelVariants = cva('text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70');
|
|
7
|
+
const Label = React.forwardRef(({ className, ...props }, ref) => (_jsx(LabelPrimitive.Root, { ref: ref, className: cn(labelVariants(), className), ...props })));
|
|
8
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
9
|
+
export default Label;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LoaderProps {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
colorClassName?: string;
|
|
5
|
+
variant?: 'bars' | 'dots';
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const LoaderComponent: React.FC<LoaderProps>;
|
|
9
|
+
export default LoaderComponent;
|
|
10
|
+
export type { LoaderProps };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Loader as MantineLoader } from '@mantine/core';
|
|
3
|
+
import { cn } from '../../helpers';
|
|
4
|
+
const LoaderComponent = ({ size = 'xl', colorClassName = 'text-primary-500', variant = 'bars', className = '', }) => {
|
|
5
|
+
return (_jsx("div", { className: cn('inline-block', className), children: _jsx("div", { className: colorClassName.startsWith('text-') ? colorClassName : 'text-' + colorClassName, children: _jsx(MantineLoader, { color: "currentColor", variant: variant, size: size }) }) }));
|
|
6
|
+
};
|
|
7
|
+
export default LoaderComponent;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ModalProps as FlowbiteModalProps } from 'flowbite-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type ButtonVariant } from './Button';
|
|
4
|
+
export interface ModalProps extends Omit<FlowbiteModalProps, 'theme' | 'title'> {
|
|
5
|
+
/** Title of the modal */
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
/** Modal content */
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/** Whether the modal is open */
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
/** Callback when modal is closed */
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
/** Specify the size of the modal */
|
|
14
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl';
|
|
15
|
+
/** Button for the primary action */
|
|
16
|
+
primaryButton?: {
|
|
17
|
+
/** Text to display on the button */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Click handler for the button */
|
|
20
|
+
onClick: () => void;
|
|
21
|
+
/** Button is in loading state */
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
/** Button is disabled */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Custom variant for the button */
|
|
26
|
+
variant?: ButtonVariant;
|
|
27
|
+
};
|
|
28
|
+
/** Button for the secondary/cancel action */
|
|
29
|
+
secondaryButton?: {
|
|
30
|
+
/** Text to display on the button */
|
|
31
|
+
label: string;
|
|
32
|
+
/** Click handler for the button */
|
|
33
|
+
onClick: () => void;
|
|
34
|
+
/** Button is in loading state */
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
/** Button is disabled */
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/** Custom variant for the button */
|
|
39
|
+
variant?: ButtonVariant;
|
|
40
|
+
};
|
|
41
|
+
/** Custom header content */
|
|
42
|
+
headerContent?: React.ReactNode;
|
|
43
|
+
/** Custom footer content (will override primary/secondary buttons) */
|
|
44
|
+
footerContent?: React.ReactNode;
|
|
45
|
+
/** Additional class name for the modal */
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Reusable Modal component that wraps Flowbite's Modal with Pagamio styling and structure
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Modal
|
|
54
|
+
* isOpen={isOpen}
|
|
55
|
+
* onClose={handleClose}
|
|
56
|
+
* title="Confirmation"
|
|
57
|
+
* primaryButton={{
|
|
58
|
+
* label: "Confirm",
|
|
59
|
+
* onClick: handleConfirm,
|
|
60
|
+
* }}
|
|
61
|
+
* secondaryButton={{
|
|
62
|
+
* label: "Cancel",
|
|
63
|
+
* onClick: handleClose,
|
|
64
|
+
* variant: "outline-primary"
|
|
65
|
+
* }}
|
|
66
|
+
* >
|
|
67
|
+
* <p>Are you sure you want to perform this action?</p>
|
|
68
|
+
* </Modal>
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare const Modal: React.FC<ModalProps>;
|
|
72
|
+
export default Modal;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as FlowbiteModal } from 'flowbite-react';
|
|
3
|
+
import { cn } from '../../helpers';
|
|
4
|
+
import Button from './Button';
|
|
5
|
+
/**
|
|
6
|
+
* Reusable Modal component that wraps Flowbite's Modal with Pagamio styling and structure
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Modal
|
|
11
|
+
* isOpen={isOpen}
|
|
12
|
+
* onClose={handleClose}
|
|
13
|
+
* title="Confirmation"
|
|
14
|
+
* primaryButton={{
|
|
15
|
+
* label: "Confirm",
|
|
16
|
+
* onClick: handleConfirm,
|
|
17
|
+
* }}
|
|
18
|
+
* secondaryButton={{
|
|
19
|
+
* label: "Cancel",
|
|
20
|
+
* onClick: handleClose,
|
|
21
|
+
* variant: "outline-primary"
|
|
22
|
+
* }}
|
|
23
|
+
* >
|
|
24
|
+
* <p>Are you sure you want to perform this action?</p>
|
|
25
|
+
* </Modal>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
const Modal = ({ title, children, isOpen, onClose, size = 'md', primaryButton, secondaryButton, headerContent, footerContent, className, ...rest }) => {
|
|
29
|
+
return (_jsxs(FlowbiteModal, { show: isOpen, onClose: onClose, size: size, className: cn('max-h-[90vh] mt-16 md:mt-0 md:max-h-full', className), ...rest, children: [(title ?? headerContent) && _jsx(FlowbiteModal.Header, { children: headerContent ?? title }), _jsx(FlowbiteModal.Body, { children: _jsx("div", { className: "space-y-4", children: children }) }), (primaryButton || secondaryButton || footerContent) && (_jsx(FlowbiteModal.Footer, { children: footerContent ?? (_jsxs("div", { className: "flex w-full justify-end gap-2", children: [secondaryButton && (_jsx(Button, { onClick: secondaryButton.onClick, variant: secondaryButton.variant ?? 'outline-primary', disabled: secondaryButton.loading ?? secondaryButton.disabled, className: secondaryButton.variant, children: secondaryButton.label })), primaryButton && (_jsx(Button, { onClick: primaryButton.onClick, variant: primaryButton.variant ?? 'primary', disabled: primaryButton.loading ?? primaryButton.disabled, className: primaryButton.variant, children: primaryButton.label }))] })) }))] }));
|
|
30
|
+
};
|
|
31
|
+
export default Modal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Field, SelectOption } from '../../form-engine';
|
|
3
|
+
export interface MultiSelectProps {
|
|
4
|
+
options: SelectOption[];
|
|
5
|
+
value?: string[];
|
|
6
|
+
defaultValue?: string[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onChange?: (selected: string[]) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
onSearch?: (value: string) => void;
|
|
12
|
+
field?: Field;
|
|
13
|
+
tagPosition?: 'inside' | 'bottom';
|
|
14
|
+
}
|
|
15
|
+
declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default MultiSelect;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as Checkbox from '@radix-ui/react-checkbox';
|
|
3
|
+
import { CheckIcon, ChevronDownIcon, Cross2Icon } from '@radix-ui/react-icons';
|
|
4
|
+
import * as Popover from '@radix-ui/react-popover';
|
|
5
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
6
|
+
import { cn } from '../../helpers';
|
|
7
|
+
const TagsList = ({ selectedOptions, placeholder, removeTag }) => {
|
|
8
|
+
if (selectedOptions.length === 0) {
|
|
9
|
+
return _jsx("span", { className: "truncate", children: placeholder ?? 'Select options' });
|
|
10
|
+
}
|
|
11
|
+
return (_jsx("div", { className: "flex flex-wrap gap-2", children: selectedOptions.map((option) => (_jsxs("div", { className: "flex items-center gap-1 px-2 py-1 text-sm bg-gray-100 rounded-md", children: [option.label, _jsx("button", { type: "button", onClick: (e) => removeTag(option.value, e), className: "p-0.5 hover:bg-gray-200 rounded-full", children: _jsx(Cross2Icon, { className: "w-3 h-3" }) })] }, option.value))) }));
|
|
12
|
+
};
|
|
13
|
+
const MultiSelect = forwardRef(({ options, value, defaultValue = [], disabled, onChange, placeholder, className, onSearch, field, tagPosition = 'inside', }, ref) => {
|
|
14
|
+
const [selectedValues, setSelectedValues] = useState(defaultValue);
|
|
15
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
16
|
+
const [filteredOptions, setFilteredOptions] = useState(options);
|
|
17
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (onSearch) {
|
|
20
|
+
onSearch(searchTerm);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
setFilteredOptions(options.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase())));
|
|
24
|
+
}
|
|
25
|
+
}, [searchTerm, options, onSearch]);
|
|
26
|
+
const internalValues = value || selectedValues;
|
|
27
|
+
const handleToggle = (option) => {
|
|
28
|
+
const updatedValues = internalValues.includes(option)
|
|
29
|
+
? internalValues.filter((val) => val !== option)
|
|
30
|
+
: [...internalValues, option];
|
|
31
|
+
if (!value) {
|
|
32
|
+
setSelectedValues(updatedValues);
|
|
33
|
+
}
|
|
34
|
+
onChange?.(updatedValues);
|
|
35
|
+
};
|
|
36
|
+
const removeTag = (optionValue, e) => {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
handleToggle(optionValue);
|
|
39
|
+
};
|
|
40
|
+
const selectedOptions = options.filter((option) => internalValues.includes(option.value));
|
|
41
|
+
return (_jsx("div", { ref: ref, className: cn('relative w-full', className), children: _jsxs(Popover.Root, { open: isOpen, onOpenChange: setIsOpen, children: [_jsx(Popover.Trigger, { asChild: true, children: _jsxs("button", { type: "button", disabled: disabled, className: "w-full cursor-pointer disabled:text-gray-400 disabled:bg-gray-50 disabled:cursor-not-allowed", onClick: (e) => {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
setIsOpen(!isOpen);
|
|
44
|
+
}, onKeyDown: (e) => {
|
|
45
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
setIsOpen(!isOpen);
|
|
48
|
+
}
|
|
49
|
+
}, children: [_jsxs("div", { id: field?.name, className: "flex items-center w-full px-4 py-2 border rounded-md", style: { minHeight: '41px' }, children: [_jsx("div", { className: "flex-1 text-left", children: tagPosition === 'inside' ? (_jsx(TagsList, { selectedOptions: selectedOptions, removeTag: removeTag, placeholder: field?.placeholder })) : (_jsx("span", { className: "truncate", children: selectedOptions.length === 0
|
|
50
|
+
? (field?.placeholder ?? placeholder ?? 'Select options')
|
|
51
|
+
: `${selectedOptions.length} selected` })) }), _jsx(ChevronDownIcon, { className: "ml-2 flex-shrink-0" })] }), tagPosition === 'bottom' && selectedOptions.length > 0 && (_jsx("div", { className: "mt-2", children: _jsx(TagsList, { selectedOptions: selectedOptions, removeTag: removeTag, placeholder: field?.placeholder }) }))] }) }), _jsxs(Popover.Content, { className: "p-2 bg-white border rounded shadow-md w-full z-50", align: "start", sideOffset: 5, onOpenAutoFocus: (e) => e.preventDefault(), children: [_jsx("input", { type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), className: "w-full px-2 py-1 mb-2 border rounded", onClick: (e) => e.stopPropagation() }), _jsx("div", { className: "max-h-60 overflow-auto", children: filteredOptions.length > 0 ? (filteredOptions.map((option) => (_jsxs("div", { className: "flex items-center gap-2 px-2 py-1 cursor-pointer hover:bg-gray-100", children: [_jsx(Checkbox.Root, { type: "button", checked: internalValues.includes(option.value), onCheckedChange: () => handleToggle(option.value), className: "w-4 h-4 border rounded", children: _jsx(Checkbox.Indicator, { children: _jsx(CheckIcon, { className: "w-4 h-4 text-blue-500" }) }) }), _jsx("button", { type: "button", onClick: () => handleToggle(option.value), onKeyDown: (e) => {
|
|
52
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
handleToggle(option.value);
|
|
55
|
+
}
|
|
56
|
+
}, className: "text-left w-full", children: option.label })] }, option.value)))) : (_jsx("div", { className: "px-2 py-1 text-gray-500", children: "No options found" })) })] })] }) }));
|
|
57
|
+
});
|
|
58
|
+
MultiSelect.displayName = 'MultiSelect';
|
|
59
|
+
export default MultiSelect;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface NotificationModalProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onConfirm?: () => void;
|
|
6
|
+
title?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
variant?: 'success' | 'error' | 'warning' | 'info';
|
|
9
|
+
confirmText?: string;
|
|
10
|
+
cancelText?: string;
|
|
11
|
+
showConfirmButton?: boolean;
|
|
12
|
+
showCancelButton?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare const NotificationModal: React.FC<NotificationModalProps>;
|
|
18
|
+
export default NotificationModal;
|