@alneas/appkit-react 0.1.0 → 0.2.0
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/CHANGELOG.md +53 -0
- package/README.md +85 -15
- package/consumer-ai/SKILL.md +12 -0
- package/consumer-ai/api-index.json +103754 -0
- package/consumer-ai/package-context.json +409 -0
- package/dist/ai/action/ExecutionHistory.cjs.map +1 -1
- package/dist/ai/action/ExecutionHistory.d.cts +32 -2
- package/dist/ai/action/ExecutionHistory.d.ts +32 -2
- package/dist/ai/action/ExecutionHistory.js.map +1 -1
- package/dist/ai/action/ScreenActionContext.cjs.map +1 -1
- package/dist/ai/action/ScreenActionContext.d.cts +15 -2
- package/dist/ai/action/ScreenActionContext.d.ts +15 -2
- package/dist/ai/action/ScreenActionContext.js.map +1 -1
- package/dist/ai/action/context.cjs.map +1 -1
- package/dist/ai/action/context.d.cts +19 -3
- package/dist/ai/action/context.d.ts +19 -3
- package/dist/ai/action/context.js.map +1 -1
- package/dist/ai/action/types.d.cts +35 -3
- package/dist/ai/action/types.d.ts +35 -3
- package/dist/ai/action/use-execution-session.cjs.map +1 -1
- package/dist/ai/action/use-execution-session.d.cts +17 -1
- package/dist/ai/action/use-execution-session.d.ts +17 -1
- package/dist/ai/action/use-execution-session.js.map +1 -1
- package/dist/ai/action/use-screen-action-registry.cjs.map +1 -1
- package/dist/ai/action/use-screen-action-registry.d.cts +77 -8
- package/dist/ai/action/use-screen-action-registry.d.ts +77 -8
- package/dist/ai/action/use-screen-action-registry.js.map +1 -1
- package/dist/ai/action/use-screen-action.cjs.map +1 -1
- package/dist/ai/action/use-screen-action.d.cts +23 -6
- package/dist/ai/action/use-screen-action.d.ts +23 -6
- package/dist/ai/action/use-screen-action.js.map +1 -1
- package/dist/ai/action/use-screen-context.cjs.map +1 -1
- package/dist/ai/action/use-screen-context.d.cts +42 -5
- package/dist/ai/action/use-screen-context.d.ts +42 -5
- package/dist/ai/action/use-screen-context.js.map +1 -1
- package/dist/ai/ai-chat/transport.cjs.map +1 -1
- package/dist/ai/ai-chat/transport.d.cts +35 -8
- package/dist/ai/ai-chat/transport.d.ts +35 -8
- package/dist/ai/ai-chat/transport.js.map +1 -1
- package/dist/ai/generative-ui/GenerativeUIRenderer.cjs.map +1 -1
- package/dist/ai/generative-ui/GenerativeUIRenderer.d.cts +21 -3
- package/dist/ai/generative-ui/GenerativeUIRenderer.d.ts +21 -3
- package/dist/ai/generative-ui/GenerativeUIRenderer.js.map +1 -1
- package/dist/ai/generative-ui/error-boundary.cjs.map +1 -1
- package/dist/ai/generative-ui/error-boundary.d.cts +98 -2
- package/dist/ai/generative-ui/error-boundary.d.ts +98 -2
- package/dist/ai/generative-ui/error-boundary.js.map +1 -1
- package/dist/ai/generative-ui/registry.cjs.map +1 -1
- package/dist/ai/generative-ui/registry.d.cts +96 -7
- package/dist/ai/generative-ui/registry.d.ts +96 -7
- package/dist/ai/generative-ui/registry.js.map +1 -1
- package/dist/ai/proposal/ProposalFieldReview.cjs.map +1 -1
- package/dist/ai/proposal/ProposalFieldReview.d.cts +170 -8
- package/dist/ai/proposal/ProposalFieldReview.d.ts +170 -8
- package/dist/ai/proposal/ProposalFieldReview.js.map +1 -1
- package/dist/ai/proposal/types.d.cts +97 -26
- package/dist/ai/proposal/types.d.ts +97 -26
- package/dist/ai/proposal/use-proposal-batch-review.cjs.map +1 -1
- package/dist/ai/proposal/use-proposal-batch-review.d.cts +133 -7
- package/dist/ai/proposal/use-proposal-batch-review.d.ts +133 -7
- package/dist/ai/proposal/use-proposal-batch-review.js.map +1 -1
- package/dist/ai/proposal/use-proposal-review.cjs.map +1 -1
- package/dist/ai/proposal/use-proposal-review.d.cts +47 -5
- package/dist/ai/proposal/use-proposal-review.d.ts +47 -5
- package/dist/ai/proposal/use-proposal-review.js.map +1 -1
- package/dist/avatar.svg +1 -0
- package/dist/consumer-ai/SKILL.md +6 -0
- package/dist/consumer-ai/api-index.json +103754 -0
- package/dist/consumer-ai/package-context.json +5 -3
- package/dist/mockServiceWorker.js +361 -0
- package/dist/styles.css +1 -1
- package/dist/tools/components/auth/AuthForms.cjs.map +1 -1
- package/dist/tools/components/auth/AuthForms.d.cts +131 -81
- package/dist/tools/components/auth/AuthForms.d.ts +131 -81
- package/dist/tools/components/auth/AuthForms.js.map +1 -1
- package/dist/tools/components/auth/AuthGuard.cjs.map +1 -1
- package/dist/tools/components/auth/AuthGuard.d.cts +31 -4
- package/dist/tools/components/auth/AuthGuard.d.ts +31 -4
- package/dist/tools/components/auth/AuthGuard.js.map +1 -1
- package/dist/tools/components/auth/AuthProvider.cjs.map +1 -1
- package/dist/tools/components/auth/AuthProvider.d.cts +39 -42
- package/dist/tools/components/auth/AuthProvider.d.ts +39 -42
- package/dist/tools/components/auth/AuthProvider.js.map +1 -1
- package/dist/tools/components/auth/ProtectedRoute.cjs.map +1 -1
- package/dist/tools/components/auth/ProtectedRoute.d.cts +75 -60
- package/dist/tools/components/auth/ProtectedRoute.d.ts +75 -60
- package/dist/tools/components/auth/ProtectedRoute.js.map +1 -1
- package/dist/tools/components/auth/SignInButton.cjs.map +1 -1
- package/dist/tools/components/auth/SignInButton.d.cts +26 -18
- package/dist/tools/components/auth/SignInButton.d.ts +26 -18
- package/dist/tools/components/auth/SignInButton.js.map +1 -1
- package/dist/tools/components/auth/UserProfileProvider.cjs.map +1 -1
- package/dist/tools/components/auth/UserProfileProvider.d.cts +48 -20
- package/dist/tools/components/auth/UserProfileProvider.d.ts +48 -20
- package/dist/tools/components/auth/UserProfileProvider.js.map +1 -1
- package/dist/tools/components/auth/adapters/better-auth-adapter.cjs.map +1 -1
- package/dist/tools/components/auth/adapters/better-auth-adapter.d.cts +371 -51
- package/dist/tools/components/auth/adapters/better-auth-adapter.d.ts +371 -51
- package/dist/tools/components/auth/adapters/better-auth-adapter.js.map +1 -1
- package/dist/tools/components/auth/adapters/mock-adapter.cjs.map +1 -1
- package/dist/tools/components/auth/adapters/mock-adapter.d.cts +149 -28
- package/dist/tools/components/auth/adapters/mock-adapter.d.ts +149 -28
- package/dist/tools/components/auth/adapters/mock-adapter.js.map +1 -1
- package/dist/tools/components/auth/auth-session.cjs.map +1 -1
- package/dist/tools/components/auth/auth-session.d.cts +147 -1
- package/dist/tools/components/auth/auth-session.d.ts +147 -1
- package/dist/tools/components/auth/auth-session.js.map +1 -1
- package/dist/tools/components/auth/session-cache.cjs.map +1 -1
- package/dist/tools/components/auth/session-cache.d.cts +88 -24
- package/dist/tools/components/auth/session-cache.d.ts +88 -24
- package/dist/tools/components/auth/session-cache.js.map +1 -1
- package/dist/tools/components/auth/types.cjs.map +1 -1
- package/dist/tools/components/auth/types.d.cts +329 -106
- package/dist/tools/components/auth/types.d.ts +329 -106
- package/dist/tools/components/auth/types.js.map +1 -1
- package/dist/tools/components/auth/useAuth.cjs.map +1 -1
- package/dist/tools/components/auth/useAuth.d.cts +110 -17
- package/dist/tools/components/auth/useAuth.d.ts +110 -17
- package/dist/tools/components/auth/useAuth.js.map +1 -1
- package/dist/tools/components/auth/useAuthGuard.cjs.map +1 -1
- package/dist/tools/components/auth/useAuthGuard.d.cts +49 -38
- package/dist/tools/components/auth/useAuthGuard.d.ts +49 -38
- package/dist/tools/components/auth/useAuthGuard.js.map +1 -1
- package/dist/tools/components/auth/useRoleCheck.cjs.map +1 -1
- package/dist/tools/components/auth/useRoleCheck.d.cts +48 -1
- package/dist/tools/components/auth/useRoleCheck.d.ts +48 -1
- package/dist/tools/components/auth/useRoleCheck.js.map +1 -1
- package/dist/tools/components/auth/useUserProfile.cjs.map +1 -1
- package/dist/tools/components/auth/useUserProfile.d.cts +66 -1
- package/dist/tools/components/auth/useUserProfile.d.ts +66 -1
- package/dist/tools/components/auth/useUserProfile.js.map +1 -1
- package/dist/tools/components/barcode/BarcodeGenerator.cjs.map +1 -1
- package/dist/tools/components/barcode/BarcodeGenerator.d.cts +32 -18
- package/dist/tools/components/barcode/BarcodeGenerator.d.ts +32 -18
- package/dist/tools/components/barcode/BarcodeGenerator.js.map +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.cjs +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.cjs.map +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.d.cts +20 -13
- package/dist/tools/components/barcode/QRCodeGenerator.d.ts +20 -13
- package/dist/tools/components/barcode/QRCodeGenerator.js +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.js.map +1 -1
- package/dist/tools/components/barcode/QRCodeScanner.cjs.map +1 -1
- package/dist/tools/components/barcode/QRCodeScanner.d.cts +32 -1
- package/dist/tools/components/barcode/QRCodeScanner.d.ts +32 -1
- package/dist/tools/components/barcode/QRCodeScanner.js.map +1 -1
- package/dist/tools/components/calendar/ResourceCalendar.cjs.map +1 -1
- package/dist/tools/components/calendar/ResourceCalendar.d.cts +17 -42
- package/dist/tools/components/calendar/ResourceCalendar.d.ts +17 -42
- package/dist/tools/components/calendar/ResourceCalendar.js.map +1 -1
- package/dist/tools/components/calendar/views/ResourceView.cjs +1 -1
- package/dist/tools/components/calendar/views/ResourceView.cjs.map +1 -1
- package/dist/tools/components/calendar/views/ResourceView.js +2 -2
- package/dist/tools/components/calendar/views/ResourceView.js.map +1 -1
- package/dist/tools/components/chart/ComposedChart.cjs.map +1 -1
- package/dist/tools/components/chart/ComposedChart.d.cts +54 -1
- package/dist/tools/components/chart/ComposedChart.d.ts +54 -1
- package/dist/tools/components/chart/ComposedChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleAreaChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleAreaChart.d.cts +41 -1
- package/dist/tools/components/chart/SimpleAreaChart.d.ts +41 -1
- package/dist/tools/components/chart/SimpleAreaChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleBarChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleBarChart.d.cts +34 -24
- package/dist/tools/components/chart/SimpleBarChart.d.ts +34 -24
- package/dist/tools/components/chart/SimpleBarChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleLineChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleLineChart.d.cts +31 -28
- package/dist/tools/components/chart/SimpleLineChart.d.ts +31 -28
- package/dist/tools/components/chart/SimpleLineChart.js.map +1 -1
- package/dist/tools/components/chart/SimplePieChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimplePieChart.d.cts +28 -22
- package/dist/tools/components/chart/SimplePieChart.d.ts +28 -22
- package/dist/tools/components/chart/SimplePieChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleRadarChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleRadarChart.d.cts +38 -1
- package/dist/tools/components/chart/SimpleRadarChart.d.ts +38 -1
- package/dist/tools/components/chart/SimpleRadarChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleScatterChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleScatterChart.d.cts +44 -1
- package/dist/tools/components/chart/SimpleScatterChart.d.ts +44 -1
- package/dist/tools/components/chart/SimpleScatterChart.js.map +1 -1
- package/dist/tools/components/chart/StackedBarChart.cjs.map +1 -1
- package/dist/tools/components/chart/StackedBarChart.d.cts +38 -1
- package/dist/tools/components/chart/StackedBarChart.d.ts +38 -1
- package/dist/tools/components/chart/StackedBarChart.js.map +1 -1
- package/dist/tools/components/data-table/data-table.cjs +1 -1
- package/dist/tools/components/data-table/data-table.cjs.map +1 -1
- package/dist/tools/components/data-table/data-table.js +286 -263
- package/dist/tools/components/data-table/data-table.js.map +1 -1
- package/dist/tools/components/data-table/table-utils.cjs.map +1 -1
- package/dist/tools/components/data-table/table-utils.d.cts +45 -35
- package/dist/tools/components/data-table/table-utils.d.ts +45 -35
- package/dist/tools/components/data-table/table-utils.js.map +1 -1
- package/dist/tools/components/editable-table/editable-table.cjs +1 -1
- package/dist/tools/components/editable-table/editable-table.cjs.map +1 -1
- package/dist/tools/components/editable-table/editable-table.js +15 -2
- package/dist/tools/components/editable-table/editable-table.js.map +1 -1
- package/dist/tools/components/error/ErrorDialog.cjs +1 -1
- package/dist/tools/components/error/ErrorDialog.cjs.map +1 -1
- package/dist/tools/components/error/ErrorDialog.js +1 -1
- package/dist/tools/components/error/ErrorDialog.js.map +1 -1
- package/dist/tools/components/error/ErrorInline.cjs +1 -1
- package/dist/tools/components/error/ErrorInline.cjs.map +1 -1
- package/dist/tools/components/error/ErrorInline.js +1 -1
- package/dist/tools/components/error/ErrorInline.js.map +1 -1
- package/dist/tools/components/error/ErrorNotification.cjs +1 -1
- package/dist/tools/components/error/ErrorNotification.cjs.map +1 -1
- package/dist/tools/components/error/ErrorNotification.js +10 -10
- package/dist/tools/components/error/ErrorNotification.js.map +1 -1
- package/dist/tools/components/file-browser/FilePreview.cjs +1 -1
- package/dist/tools/components/file-browser/FilePreview.cjs.map +1 -1
- package/dist/tools/components/file-browser/FilePreview.js +28 -26
- package/dist/tools/components/file-browser/FilePreview.js.map +1 -1
- package/dist/tools/components/filter/filter.cjs.map +1 -1
- package/dist/tools/components/filter/filter.d.cts +23 -34
- package/dist/tools/components/filter/filter.d.ts +23 -34
- package/dist/tools/components/filter/filter.js.map +1 -1
- package/dist/tools/components/form/EnhancedDetailPage.cjs.map +1 -1
- package/dist/tools/components/form/EnhancedDetailPage.d.cts +47 -42
- package/dist/tools/components/form/EnhancedDetailPage.d.ts +47 -42
- package/dist/tools/components/form/EnhancedDetailPage.js.map +1 -1
- package/dist/tools/components/form/form-grid.cjs.map +1 -1
- package/dist/tools/components/form/form-grid.d.cts +44 -22
- package/dist/tools/components/form/form-grid.d.ts +44 -22
- package/dist/tools/components/form/form-grid.js.map +1 -1
- package/dist/tools/components/gantt/GanttChart.cjs +1 -1
- package/dist/tools/components/gantt/GanttChart.cjs.map +1 -1
- package/dist/tools/components/gantt/GanttChart.d.cts +20 -1
- package/dist/tools/components/gantt/GanttChart.d.ts +20 -1
- package/dist/tools/components/gantt/GanttChart.js +3 -0
- package/dist/tools/components/gantt/GanttChart.js.map +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.cjs +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.cjs.map +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.js +2 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.js.map +1 -1
- package/dist/tools/components/header/header.cjs +1 -1
- package/dist/tools/components/header/header.cjs.map +1 -1
- package/dist/tools/components/header/header.d.cts +103 -40
- package/dist/tools/components/header/header.d.ts +103 -40
- package/dist/tools/components/header/header.js +1 -1
- package/dist/tools/components/header/header.js.map +1 -1
- package/dist/tools/components/i18n/LanguageSwitcher.cjs.map +1 -1
- package/dist/tools/components/i18n/LanguageSwitcher.d.cts +18 -14
- package/dist/tools/components/i18n/LanguageSwitcher.d.ts +18 -14
- package/dist/tools/components/i18n/LanguageSwitcher.js.map +1 -1
- package/dist/tools/components/kanban/KanbanBoard.cjs +1 -1
- package/dist/tools/components/kanban/KanbanBoard.cjs.map +1 -1
- package/dist/tools/components/kanban/KanbanBoard.d.cts +16 -34
- package/dist/tools/components/kanban/KanbanBoard.d.ts +16 -34
- package/dist/tools/components/kanban/KanbanBoard.js +3 -0
- package/dist/tools/components/kanban/KanbanBoard.js.map +1 -1
- package/dist/tools/components/kanban/KanbanColumn.cjs +1 -1
- package/dist/tools/components/kanban/KanbanColumn.cjs.map +1 -1
- package/dist/tools/components/kanban/KanbanColumn.js +1 -1
- package/dist/tools/components/kanban/KanbanColumn.js.map +1 -1
- package/dist/tools/components/kanban/kanban-compound.cjs +1 -1
- package/dist/tools/components/kanban/kanban-compound.cjs.map +1 -1
- package/dist/tools/components/kanban/kanban-compound.js +4 -1
- package/dist/tools/components/kanban/kanban-compound.js.map +1 -1
- package/dist/tools/components/kanban/kanban-primitives.cjs +1 -1
- package/dist/tools/components/kanban/kanban-primitives.cjs.map +1 -1
- package/dist/tools/components/kanban/kanban-primitives.js +0 -1
- package/dist/tools/components/kanban/kanban-primitives.js.map +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.cjs +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.cjs.map +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.js +3 -1
- package/dist/tools/components/priority-queue/PriorityCard.js.map +1 -1
- package/dist/tools/components/sidebar/SmartSidebar.cjs.map +1 -1
- package/dist/tools/components/sidebar/SmartSidebar.d.cts +41 -43
- package/dist/tools/components/sidebar/SmartSidebar.d.ts +41 -43
- package/dist/tools/components/sidebar/SmartSidebar.js.map +1 -1
- package/dist/tools/components/splash/SplashScreen.cjs.map +1 -1
- package/dist/tools/components/splash/SplashScreen.d.cts +43 -68
- package/dist/tools/components/splash/SplashScreen.d.ts +43 -68
- package/dist/tools/components/splash/SplashScreen.js.map +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.cjs +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.cjs.map +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.js +2 -2
- package/dist/tools/components/workflow/WorkflowStatusPanel.js.map +1 -1
- package/dist/tools/lib/data-access/data-access-context.cjs.map +1 -1
- package/dist/tools/lib/data-access/data-access-context.d.cts +15 -6
- package/dist/tools/lib/data-access/data-access-context.d.ts +15 -6
- package/dist/tools/lib/data-access/data-access-context.js.map +1 -1
- package/dist/tools/lib/data-access/react-query-provider.cjs.map +1 -1
- package/dist/tools/lib/data-access/react-query-provider.d.cts +19 -2
- package/dist/tools/lib/data-access/react-query-provider.d.ts +19 -2
- package/dist/tools/lib/data-access/react-query-provider.js.map +1 -1
- package/dist/tools/lib/data-access/react-query.cjs.map +1 -1
- package/dist/tools/lib/data-access/react-query.d.cts +365 -90
- package/dist/tools/lib/data-access/react-query.d.ts +365 -90
- package/dist/tools/lib/data-access/react-query.js.map +1 -1
- package/dist/tools/lib/error/AppError.cjs.map +1 -1
- package/dist/tools/lib/error/AppError.d.cts +157 -63
- package/dist/tools/lib/error/AppError.d.ts +157 -63
- package/dist/tools/lib/error/AppError.js.map +1 -1
- package/dist/tools/lib/hooks/useAsyncWithTimeout.cjs.map +1 -1
- package/dist/tools/lib/hooks/useAsyncWithTimeout.d.cts +79 -26
- package/dist/tools/lib/hooks/useAsyncWithTimeout.d.ts +79 -26
- package/dist/tools/lib/hooks/useAsyncWithTimeout.js.map +1 -1
- package/dist/tools/lib/hooks/useError.cjs.map +1 -1
- package/dist/tools/lib/hooks/useError.d.cts +51 -16
- package/dist/tools/lib/hooks/useError.d.ts +51 -16
- package/dist/tools/lib/hooks/useError.js.map +1 -1
- package/dist/tools/lib/schema/ajv.cjs +1 -1
- package/dist/tools/lib/schema/ajv.cjs.map +1 -1
- package/dist/tools/lib/schema/ajv.d.cts +19 -8
- package/dist/tools/lib/schema/ajv.d.ts +19 -8
- package/dist/tools/lib/schema/ajv.js +2 -1
- package/dist/tools/lib/schema/ajv.js.map +1 -1
- package/dist/tools/lib/state/error-store.cjs.map +1 -1
- package/dist/tools/lib/state/error-store.d.cts +61 -10
- package/dist/tools/lib/state/error-store.d.ts +61 -10
- package/dist/tools/lib/state/error-store.js.map +1 -1
- package/dist/tools/lib/state/store-factory.cjs.map +1 -1
- package/dist/tools/lib/state/store-factory.d.cts +25 -4
- package/dist/tools/lib/state/store-factory.d.ts +25 -4
- package/dist/tools/lib/state/store-factory.js.map +1 -1
- package/dist/tools/lib/state/ui-store.cjs.map +1 -1
- package/dist/tools/lib/state/ui-store.d.cts +39 -0
- package/dist/tools/lib/state/ui-store.d.ts +39 -0
- package/dist/tools/lib/state/ui-store.js.map +1 -1
- package/dist/ui/components/theme/theme-context.cjs.map +1 -1
- package/dist/ui/components/theme/theme-context.d.cts +171 -1
- package/dist/ui/components/theme/theme-context.d.ts +171 -1
- package/dist/ui/components/theme/theme-context.js.map +1 -1
- package/dist/ui/components/theme/theme-provider.cjs.map +1 -1
- package/dist/ui/components/theme/theme-provider.d.cts +31 -19
- package/dist/ui/components/theme/theme-provider.d.ts +31 -19
- package/dist/ui/components/theme/theme-provider.js.map +1 -1
- package/dist/ui/components/theme/theme-script.cjs.map +1 -1
- package/dist/ui/components/theme/theme-script.d.cts +16 -1
- package/dist/ui/components/theme/theme-script.d.ts +16 -1
- package/dist/ui/components/theme/theme-script.js.map +1 -1
- package/dist/ui/components/theme/theme-switcher.cjs +1 -1
- package/dist/ui/components/theme/theme-switcher.cjs.map +1 -1
- package/dist/ui/components/theme/theme-switcher.d.cts +82 -13
- package/dist/ui/components/theme/theme-switcher.d.ts +82 -13
- package/dist/ui/components/theme/theme-switcher.js +8 -0
- package/dist/ui/components/theme/theme-switcher.js.map +1 -1
- package/dist/ui/components/ui/accordion.cjs.map +1 -1
- package/dist/ui/components/ui/accordion.d.cts +60 -0
- package/dist/ui/components/ui/accordion.d.ts +60 -0
- package/dist/ui/components/ui/accordion.js.map +1 -1
- package/dist/ui/components/ui/adjustable-pane.cjs.map +1 -1
- package/dist/ui/components/ui/adjustable-pane.d.cts +44 -26
- package/dist/ui/components/ui/adjustable-pane.d.ts +44 -26
- package/dist/ui/components/ui/adjustable-pane.js.map +1 -1
- package/dist/ui/components/ui/alert-dialog.cjs.map +1 -1
- package/dist/ui/components/ui/alert-dialog.d.cts +179 -2
- package/dist/ui/components/ui/alert-dialog.d.ts +179 -2
- package/dist/ui/components/ui/alert-dialog.js.map +1 -1
- package/dist/ui/components/ui/alert.cjs.map +1 -1
- package/dist/ui/components/ui/alert.d.cts +52 -4
- package/dist/ui/components/ui/alert.d.ts +52 -4
- package/dist/ui/components/ui/alert.js.map +1 -1
- package/dist/ui/components/ui/aspect-ratio.cjs.map +1 -1
- package/dist/ui/components/ui/aspect-ratio.d.cts +16 -1
- package/dist/ui/components/ui/aspect-ratio.d.ts +16 -1
- package/dist/ui/components/ui/aspect-ratio.js.map +1 -1
- package/dist/ui/components/ui/avatar.cjs.map +1 -1
- package/dist/ui/components/ui/avatar.d.cts +87 -3
- package/dist/ui/components/ui/avatar.d.ts +87 -3
- package/dist/ui/components/ui/avatar.js.map +1 -1
- package/dist/ui/components/ui/badge-components.cjs.map +1 -1
- package/dist/ui/components/ui/badge-components.d.cts +13 -1
- package/dist/ui/components/ui/badge-components.d.ts +13 -1
- package/dist/ui/components/ui/badge-components.js.map +1 -1
- package/dist/ui/components/ui/badge-variants.cjs.map +1 -1
- package/dist/ui/components/ui/badge-variants.d.cts +15 -0
- package/dist/ui/components/ui/badge-variants.d.ts +15 -0
- package/dist/ui/components/ui/badge-variants.js.map +1 -1
- package/dist/ui/components/ui/breadcrumb.cjs.map +1 -1
- package/dist/ui/components/ui/breadcrumb.d.cts +91 -7
- package/dist/ui/components/ui/breadcrumb.d.ts +91 -7
- package/dist/ui/components/ui/breadcrumb.js.map +1 -1
- package/dist/ui/components/ui/button-components.cjs.map +1 -1
- package/dist/ui/components/ui/button-components.d.cts +18 -6
- package/dist/ui/components/ui/button-components.d.ts +18 -6
- package/dist/ui/components/ui/button-components.js.map +1 -1
- package/dist/ui/components/ui/button-group-components.cjs.map +1 -1
- package/dist/ui/components/ui/button-group-components.d.cts +39 -3
- package/dist/ui/components/ui/button-group-components.d.ts +39 -3
- package/dist/ui/components/ui/button-group-components.js.map +1 -1
- package/dist/ui/components/ui/button-group-variants.cjs.map +1 -1
- package/dist/ui/components/ui/button-group-variants.d.cts +15 -0
- package/dist/ui/components/ui/button-group-variants.d.ts +15 -0
- package/dist/ui/components/ui/button-group-variants.js.map +1 -1
- package/dist/ui/components/ui/button-variants.cjs.map +1 -1
- package/dist/ui/components/ui/button-variants.d.cts +13 -2
- package/dist/ui/components/ui/button-variants.d.ts +13 -2
- package/dist/ui/components/ui/button-variants.js.map +1 -1
- package/dist/ui/components/ui/card.cjs.map +1 -1
- package/dist/ui/components/ui/card.d.cts +106 -2
- package/dist/ui/components/ui/card.d.ts +106 -2
- package/dist/ui/components/ui/card.js.map +1 -1
- package/dist/ui/components/ui/checkbox-group.cjs.map +1 -1
- package/dist/ui/components/ui/checkbox-group.d.cts +13 -1
- package/dist/ui/components/ui/checkbox-group.d.ts +13 -1
- package/dist/ui/components/ui/checkbox-group.js.map +1 -1
- package/dist/ui/components/ui/checkbox.cjs.map +1 -1
- package/dist/ui/components/ui/checkbox.d.cts +17 -6
- package/dist/ui/components/ui/checkbox.d.ts +17 -6
- package/dist/ui/components/ui/checkbox.js.map +1 -1
- package/dist/ui/components/ui/collapsible.cjs.map +1 -1
- package/dist/ui/components/ui/collapsible.d.cts +39 -3
- package/dist/ui/components/ui/collapsible.d.ts +39 -3
- package/dist/ui/components/ui/collapsible.js.map +1 -1
- package/dist/ui/components/ui/combobox-components.cjs.map +1 -1
- package/dist/ui/components/ui/combobox-components.d.cts +209 -14
- package/dist/ui/components/ui/combobox-components.d.ts +209 -14
- package/dist/ui/components/ui/combobox-components.js.map +1 -1
- package/dist/ui/components/ui/combobox-hooks.cjs.map +1 -1
- package/dist/ui/components/ui/combobox-hooks.d.cts +13 -1
- package/dist/ui/components/ui/combobox-hooks.d.ts +13 -1
- package/dist/ui/components/ui/combobox-hooks.js.map +1 -1
- package/dist/ui/components/ui/command.cjs.map +1 -1
- package/dist/ui/components/ui/command.d.cts +132 -9
- package/dist/ui/components/ui/command.d.ts +132 -9
- package/dist/ui/components/ui/command.js.map +1 -1
- package/dist/ui/components/ui/context-menu.cjs.map +1 -1
- package/dist/ui/components/ui/context-menu.d.cts +233 -2
- package/dist/ui/components/ui/context-menu.d.ts +233 -2
- package/dist/ui/components/ui/context-menu.js.map +1 -1
- package/dist/ui/components/ui/dialog.cjs.map +1 -1
- package/dist/ui/components/ui/dialog.d.cts +157 -5
- package/dist/ui/components/ui/dialog.d.ts +157 -5
- package/dist/ui/components/ui/dialog.js.map +1 -1
- package/dist/ui/components/ui/drawer.cjs.map +1 -1
- package/dist/ui/components/ui/drawer.d.cts +130 -10
- package/dist/ui/components/ui/drawer.d.ts +130 -10
- package/dist/ui/components/ui/drawer.js.map +1 -1
- package/dist/ui/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/ui/components/ui/dropdown-menu.d.cts +225 -6
- package/dist/ui/components/ui/dropdown-menu.d.ts +225 -6
- package/dist/ui/components/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/components/ui/empty.cjs.map +1 -1
- package/dist/ui/components/ui/empty.d.cts +78 -6
- package/dist/ui/components/ui/empty.d.ts +78 -6
- package/dist/ui/components/ui/empty.js.map +1 -1
- package/dist/ui/components/ui/field.cjs.map +1 -1
- package/dist/ui/components/ui/field.d.cts +180 -6
- package/dist/ui/components/ui/field.d.ts +180 -6
- package/dist/ui/components/ui/field.js.map +1 -1
- package/dist/ui/components/ui/file-icon.cjs.map +1 -1
- package/dist/ui/components/ui/file-icon.d.cts +32 -4
- package/dist/ui/components/ui/file-icon.d.ts +32 -4
- package/dist/ui/components/ui/file-icon.js.map +1 -1
- package/dist/ui/components/ui/hover-card.cjs.map +1 -1
- package/dist/ui/components/ui/hover-card.d.cts +39 -3
- package/dist/ui/components/ui/hover-card.d.ts +39 -3
- package/dist/ui/components/ui/hover-card.js.map +1 -1
- package/dist/ui/components/ui/input-group.cjs.map +1 -1
- package/dist/ui/components/ui/input-group.d.cts +84 -6
- package/dist/ui/components/ui/input-group.d.ts +84 -6
- package/dist/ui/components/ui/input-group.js.map +1 -1
- package/dist/ui/components/ui/input-otp.cjs.map +1 -1
- package/dist/ui/components/ui/input-otp.d.cts +58 -4
- package/dist/ui/components/ui/input-otp.d.ts +58 -4
- package/dist/ui/components/ui/input-otp.js.map +1 -1
- package/dist/ui/components/ui/input.cjs.map +1 -1
- package/dist/ui/components/ui/input.d.cts +18 -10
- package/dist/ui/components/ui/input.d.ts +18 -10
- package/dist/ui/components/ui/input.js.map +1 -1
- package/dist/ui/components/ui/item.cjs.map +1 -1
- package/dist/ui/components/ui/item.d.cts +130 -10
- package/dist/ui/components/ui/item.d.ts +130 -10
- package/dist/ui/components/ui/item.js.map +1 -1
- package/dist/ui/components/ui/kbd.cjs.map +1 -1
- package/dist/ui/components/ui/kbd.d.cts +26 -2
- package/dist/ui/components/ui/kbd.d.ts +26 -2
- package/dist/ui/components/ui/kbd.js.map +1 -1
- package/dist/ui/components/ui/label.cjs.map +1 -1
- package/dist/ui/components/ui/label.d.cts +15 -0
- package/dist/ui/components/ui/label.d.ts +15 -0
- package/dist/ui/components/ui/label.js.map +1 -1
- package/dist/ui/components/ui/layout.cjs +1 -1
- package/dist/ui/components/ui/layout.cjs.map +1 -1
- package/dist/ui/components/ui/layout.d.cts +45 -11
- package/dist/ui/components/ui/layout.d.ts +45 -11
- package/dist/ui/components/ui/layout.js +22 -20
- package/dist/ui/components/ui/layout.js.map +1 -1
- package/dist/ui/components/ui/menubar.cjs.map +1 -1
- package/dist/ui/components/ui/menubar.d.cts +220 -16
- package/dist/ui/components/ui/menubar.d.ts +220 -16
- package/dist/ui/components/ui/menubar.js.map +1 -1
- package/dist/ui/components/ui/meter.cjs.map +1 -1
- package/dist/ui/components/ui/meter.d.cts +52 -4
- package/dist/ui/components/ui/meter.d.ts +52 -4
- package/dist/ui/components/ui/meter.js.map +1 -1
- package/dist/ui/components/ui/mobile-form-variants.cjs.map +1 -1
- package/dist/ui/components/ui/mobile-form-variants.d.cts +30 -0
- package/dist/ui/components/ui/mobile-form-variants.d.ts +30 -0
- package/dist/ui/components/ui/mobile-form-variants.js.map +1 -1
- package/dist/ui/components/ui/mobile-form.cjs.map +1 -1
- package/dist/ui/components/ui/mobile-form.d.cts +186 -9
- package/dist/ui/components/ui/mobile-form.d.ts +186 -9
- package/dist/ui/components/ui/mobile-form.js.map +1 -1
- package/dist/ui/components/ui/navigation-menu-components.cjs.map +1 -1
- package/dist/ui/components/ui/navigation-menu-components.d.cts +104 -8
- package/dist/ui/components/ui/navigation-menu-components.d.ts +104 -8
- package/dist/ui/components/ui/navigation-menu-components.js.map +1 -1
- package/dist/ui/components/ui/navigation-menu-variants.cjs.map +1 -1
- package/dist/ui/components/ui/navigation-menu-variants.d.cts +15 -0
- package/dist/ui/components/ui/navigation-menu-variants.d.ts +15 -0
- package/dist/ui/components/ui/navigation-menu-variants.js.map +1 -1
- package/dist/ui/components/ui/number-field.cjs.map +1 -1
- package/dist/ui/components/ui/number-field.d.cts +78 -6
- package/dist/ui/components/ui/number-field.d.ts +78 -6
- package/dist/ui/components/ui/number-field.js.map +1 -1
- package/dist/ui/components/ui/pagination.cjs.map +1 -1
- package/dist/ui/components/ui/pagination.d.cts +99 -7
- package/dist/ui/components/ui/pagination.d.ts +99 -7
- package/dist/ui/components/ui/pagination.js.map +1 -1
- package/dist/ui/components/ui/password-input.cjs.map +1 -1
- package/dist/ui/components/ui/password-input.d.cts +10 -7
- package/dist/ui/components/ui/password-input.d.ts +10 -7
- package/dist/ui/components/ui/password-input.js.map +1 -1
- package/dist/ui/components/ui/popover.cjs.map +1 -1
- package/dist/ui/components/ui/popover.d.cts +86 -2
- package/dist/ui/components/ui/popover.d.ts +86 -2
- package/dist/ui/components/ui/popover.js.map +1 -1
- package/dist/ui/components/ui/progress.cjs.map +1 -1
- package/dist/ui/components/ui/progress.d.cts +72 -2
- package/dist/ui/components/ui/progress.d.ts +72 -2
- package/dist/ui/components/ui/progress.js.map +1 -1
- package/dist/ui/components/ui/radio-card.cjs.map +1 -1
- package/dist/ui/components/ui/radio-card.d.cts +32 -4
- package/dist/ui/components/ui/radio-card.d.ts +32 -4
- package/dist/ui/components/ui/radio-card.js.map +1 -1
- package/dist/ui/components/ui/radio-group.cjs.map +1 -1
- package/dist/ui/components/ui/radio-group.d.cts +28 -2
- package/dist/ui/components/ui/radio-group.d.ts +28 -2
- package/dist/ui/components/ui/radio-group.js.map +1 -1
- package/dist/ui/components/ui/resizable.cjs.map +1 -1
- package/dist/ui/components/ui/resizable.d.cts +42 -3
- package/dist/ui/components/ui/resizable.d.ts +42 -3
- package/dist/ui/components/ui/resizable.js.map +1 -1
- package/dist/ui/components/ui/responsive-list.cjs.map +1 -1
- package/dist/ui/components/ui/responsive-list.d.cts +176 -13
- package/dist/ui/components/ui/responsive-list.d.ts +176 -13
- package/dist/ui/components/ui/responsive-list.js.map +1 -1
- package/dist/ui/components/ui/scroll-area.cjs.map +1 -1
- package/dist/ui/components/ui/scroll-area.d.cts +28 -1
- package/dist/ui/components/ui/scroll-area.d.ts +28 -1
- package/dist/ui/components/ui/scroll-area.js.map +1 -1
- package/dist/ui/components/ui/searchable-select-input.cjs.map +1 -1
- package/dist/ui/components/ui/searchable-select-input.d.cts +199 -49
- package/dist/ui/components/ui/searchable-select-input.d.ts +199 -49
- package/dist/ui/components/ui/searchable-select-input.js.map +1 -1
- package/dist/ui/components/ui/select.cjs.map +1 -1
- package/dist/ui/components/ui/select.d.cts +205 -40
- package/dist/ui/components/ui/select.d.ts +205 -40
- package/dist/ui/components/ui/select.js.map +1 -1
- package/dist/ui/components/ui/separator.cjs.map +1 -1
- package/dist/ui/components/ui/separator.d.cts +13 -2
- package/dist/ui/components/ui/separator.d.ts +13 -2
- package/dist/ui/components/ui/separator.js.map +1 -1
- package/dist/ui/components/ui/sheet.cjs.map +1 -1
- package/dist/ui/components/ui/sheet.d.cts +128 -3
- package/dist/ui/components/ui/sheet.d.ts +128 -3
- package/dist/ui/components/ui/sheet.js.map +1 -1
- package/dist/ui/components/ui/skeleton.cjs.map +1 -1
- package/dist/ui/components/ui/skeleton.d.cts +13 -1
- package/dist/ui/components/ui/skeleton.d.ts +13 -1
- package/dist/ui/components/ui/skeleton.js.map +1 -1
- package/dist/ui/components/ui/slider.cjs.map +1 -1
- package/dist/ui/components/ui/slider.d.cts +13 -7
- package/dist/ui/components/ui/slider.d.ts +13 -7
- package/dist/ui/components/ui/slider.js.map +1 -1
- package/dist/ui/components/ui/spinner.cjs.map +1 -1
- package/dist/ui/components/ui/spinner.d.cts +13 -1
- package/dist/ui/components/ui/spinner.d.ts +13 -1
- package/dist/ui/components/ui/spinner.js.map +1 -1
- package/dist/ui/components/ui/switch.cjs.map +1 -1
- package/dist/ui/components/ui/switch.d.cts +26 -0
- package/dist/ui/components/ui/switch.d.ts +26 -0
- package/dist/ui/components/ui/switch.js.map +1 -1
- package/dist/ui/components/ui/table.cjs.map +1 -1
- package/dist/ui/components/ui/table.d.cts +118 -2
- package/dist/ui/components/ui/table.d.ts +118 -2
- package/dist/ui/components/ui/table.js.map +1 -1
- package/dist/ui/components/ui/tabs-components.cjs.map +1 -1
- package/dist/ui/components/ui/tabs-components.d.cts +52 -5
- package/dist/ui/components/ui/tabs-components.d.ts +52 -5
- package/dist/ui/components/ui/tabs-components.js.map +1 -1
- package/dist/ui/components/ui/tabs-variants.cjs.map +1 -1
- package/dist/ui/components/ui/tabs-variants.d.cts +15 -0
- package/dist/ui/components/ui/tabs-variants.d.ts +15 -0
- package/dist/ui/components/ui/tabs-variants.js.map +1 -1
- package/dist/ui/components/ui/textarea.cjs.map +1 -1
- package/dist/ui/components/ui/textarea.d.cts +23 -0
- package/dist/ui/components/ui/textarea.d.ts +23 -0
- package/dist/ui/components/ui/textarea.js.map +1 -1
- package/dist/ui/components/ui/toast.cjs.map +1 -1
- package/dist/ui/components/ui/toast.d.cts +136 -0
- package/dist/ui/components/ui/toast.d.ts +136 -0
- package/dist/ui/components/ui/toast.js.map +1 -1
- package/dist/ui/components/ui/toaster.cjs.map +1 -1
- package/dist/ui/components/ui/toaster.d.cts +12 -3
- package/dist/ui/components/ui/toaster.d.ts +12 -3
- package/dist/ui/components/ui/toaster.js.map +1 -1
- package/dist/ui/components/ui/toggle-components.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-components.d.cts +15 -0
- package/dist/ui/components/ui/toggle-components.d.ts +15 -0
- package/dist/ui/components/ui/toggle-components.js.map +1 -1
- package/dist/ui/components/ui/toggle-group.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-group.d.cts +33 -0
- package/dist/ui/components/ui/toggle-group.d.ts +33 -0
- package/dist/ui/components/ui/toggle-group.js.map +1 -1
- package/dist/ui/components/ui/toggle-variants.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-variants.d.cts +15 -0
- package/dist/ui/components/ui/toggle-variants.d.ts +15 -0
- package/dist/ui/components/ui/toggle-variants.js.map +1 -1
- package/dist/ui/components/ui/toolbar.cjs.map +1 -1
- package/dist/ui/components/ui/toolbar.d.cts +94 -7
- package/dist/ui/components/ui/toolbar.d.ts +94 -7
- package/dist/ui/components/ui/toolbar.js.map +1 -1
- package/dist/ui/components/ui/tooltip.cjs.map +1 -1
- package/dist/ui/components/ui/tooltip.d.cts +54 -3
- package/dist/ui/components/ui/tooltip.d.ts +54 -3
- package/dist/ui/components/ui/tooltip.js.map +1 -1
- package/dist/ui/lib/hooks/use-gps.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-gps.d.cts +29 -4
- package/dist/ui/lib/hooks/use-gps.d.ts +29 -4
- package/dist/ui/lib/hooks/use-gps.js.map +1 -1
- package/dist/ui/lib/hooks/use-is-client.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-is-client.d.cts +11 -2
- package/dist/ui/lib/hooks/use-is-client.d.ts +11 -2
- package/dist/ui/lib/hooks/use-is-client.js.map +1 -1
- package/dist/ui/lib/hooks/use-keyboard-shortcut.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-keyboard-shortcut.d.cts +48 -18
- package/dist/ui/lib/hooks/use-keyboard-shortcut.d.ts +48 -18
- package/dist/ui/lib/hooks/use-keyboard-shortcut.js.map +1 -1
- package/dist/ui/lib/hooks/use-mobile.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-mobile.d.cts +11 -3
- package/dist/ui/lib/hooks/use-mobile.d.ts +11 -3
- package/dist/ui/lib/hooks/use-mobile.js.map +1 -1
- package/dist/ui/lib/hooks/use-toast.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-toast.d.cts +184 -15
- package/dist/ui/lib/hooks/use-toast.d.ts +184 -15
- package/dist/ui/lib/hooks/use-toast.js.map +1 -1
- package/dist/ui/lib/ime-utils.cjs.map +1 -1
- package/dist/ui/lib/ime-utils.d.cts +40 -13
- package/dist/ui/lib/ime-utils.d.ts +40 -13
- package/dist/ui/lib/ime-utils.js.map +1 -1
- package/dist/ui/lib/utils.cjs.map +1 -1
- package/dist/ui/lib/utils.d.cts +9 -6
- package/dist/ui/lib/utils.d.ts +9 -6
- package/dist/ui/lib/utils.js.map +1 -1
- package/docs/ai.md +34 -1
- package/docs/exports.md +5 -1
- package/docs/index.md +89 -16
- package/docs/migration.md +268 -0
- package/docs/request-form.md +4 -1
- package/docs/tools.md +4 -1
- package/docs/ui.md +4 -1
- package/llms-full.txt +499 -36
- package/llms.txt +4 -0
- package/package.json +35 -5
|
@@ -2,159 +2,209 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { OAuthProvider } from './types.js';
|
|
3
3
|
import * as z from 'zod';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* OAuth button configuration rendered by LoginForm.
|
|
6
6
|
*
|
|
7
|
-
* @
|
|
8
|
-
* ```tsx
|
|
9
|
-
* const providers: SocialProviderConfig[] = [
|
|
10
|
-
* { provider: 'google', label: 'Login with Google' },
|
|
11
|
-
* { provider: 'line-oidc', label: 'LINEでログイン', icon: <LineIcon /> },
|
|
12
|
-
* ];
|
|
13
|
-
* ```
|
|
7
|
+
* @see LoginForm for complete provider setup.
|
|
14
8
|
*/
|
|
15
9
|
export interface SocialProviderConfig {
|
|
16
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Identifier passed to adapter.loginWithProvider; actual support is host-configured.
|
|
12
|
+
*/
|
|
17
13
|
provider: OAuthProvider;
|
|
18
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Visible button text.
|
|
16
|
+
*/
|
|
19
17
|
label: string;
|
|
20
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Optional icon; omission uses Apple/Google artwork or a generic globe.
|
|
20
|
+
*/
|
|
21
21
|
icon?: React.ReactNode;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Renders email/password login and optional OAuth provider buttons.
|
|
25
25
|
*
|
|
26
|
-
* @param props -
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
29
|
-
*
|
|
30
|
-
* @
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
26
|
+
* @param props - Success/navigation callbacks, provider buttons and optional visibility settings.
|
|
27
|
+
*
|
|
28
|
+
* @returns Login form with validation, pending state and an error alert.
|
|
29
|
+
*
|
|
30
|
+
* @throws Error without AuthProvider; email/OAuth action failures are caught and shown as messages.
|
|
31
|
+
*
|
|
32
|
+
* @remarks Requires AuthProvider inside QueryClientProvider, React Hook Form, Zod and Appkit
|
|
33
|
+
* styles. Email must be valid and password at least six characters before submission.
|
|
34
|
+
* Email success invokes onSuccess; OAuth success does not. OAuth buttons exist only
|
|
35
|
+
* when the adapter supplies loginWithProvider. The host configures real authentication.
|
|
33
36
|
*
|
|
34
37
|
* @example
|
|
35
38
|
* ```tsx
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
39
|
+
* import '@alneas/appkit-react/styles';
|
|
40
|
+
* import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
41
|
+
* import { AuthProvider, LoginForm, type AuthAdapter } from '@alneas/appkit-react/tools/auth';
|
|
42
|
+
* export function FormExample({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {
|
|
43
|
+
* return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><LoginForm socialProviders={[{ provider: 'google', label: 'Google' }]} /></AuthProvider></QueryClientProvider>;
|
|
44
|
+
* }
|
|
40
45
|
* ```
|
|
41
46
|
*/
|
|
42
47
|
export declare function LoginForm({ onSuccess, socialProviders, showRegisterLink, showEmailLogin, redirectTo, onRegisterClick, }: {
|
|
48
|
+
/**
|
|
49
|
+
* Optional synchronous callback after successful email/password login; thrown errors become form error messages.
|
|
50
|
+
*/
|
|
43
51
|
onSuccess?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* OAuth button definitions; omission uses Apple and Google, empty array hides buttons.
|
|
54
|
+
*/
|
|
44
55
|
socialProviders?: SocialProviderConfig[];
|
|
56
|
+
/**
|
|
57
|
+
* Show the register action only when onRegisterClick also exists; defaults to true.
|
|
58
|
+
*/
|
|
45
59
|
showRegisterLink?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Show email/password fields and submit button; defaults to true.
|
|
62
|
+
*/
|
|
46
63
|
showEmailLogin?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* OAuth destination resolved against window.location.origin; defaults to /.
|
|
66
|
+
*/
|
|
47
67
|
redirectTo?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Optional synchronous click handler for the register action.
|
|
70
|
+
*/
|
|
48
71
|
onRegisterClick?: () => void;
|
|
49
72
|
}): React.JSX.Element;
|
|
50
73
|
/**
|
|
51
|
-
*
|
|
52
|
-
* 各フィールドの表示/非表示、ラベル、プレースホルダーを個別にカスタマイズできます。
|
|
74
|
+
* Visibility, label and placeholder overrides for the three built-in registration fields.
|
|
53
75
|
*
|
|
54
|
-
* @
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* ```
|
|
76
|
+
* @remarks All fields default to visible; labels/placeholders are localized. Hiding email
|
|
77
|
+
* or password does not remove their required schema validation.
|
|
78
|
+
*
|
|
79
|
+
* @see RegisterForm for usage.
|
|
59
80
|
*/
|
|
60
81
|
export interface RegisterFieldConfig {
|
|
61
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Overrides for optional display-name input.
|
|
84
|
+
*/
|
|
62
85
|
name?: {
|
|
86
|
+
/** Visibility override; defaults to true. */
|
|
63
87
|
show?: boolean;
|
|
88
|
+
/** Localized label override. */
|
|
64
89
|
label?: string;
|
|
90
|
+
/** Placeholder override. */
|
|
65
91
|
placeholder?: string;
|
|
66
92
|
};
|
|
67
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Overrides for required email input; hiding it does not skip validation.
|
|
95
|
+
*/
|
|
68
96
|
email?: {
|
|
97
|
+
/** Visibility override; defaults to true. */
|
|
69
98
|
show?: boolean;
|
|
99
|
+
/** Localized label override. */
|
|
70
100
|
label?: string;
|
|
101
|
+
/** Placeholder override. */
|
|
71
102
|
placeholder?: string;
|
|
72
103
|
};
|
|
73
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Overrides for required password input; hiding it does not skip validation.
|
|
106
|
+
*/
|
|
74
107
|
password?: {
|
|
108
|
+
/** Visibility override; defaults to true. */
|
|
75
109
|
show?: boolean;
|
|
110
|
+
/** Localized label override. */
|
|
76
111
|
label?: string;
|
|
112
|
+
/** Placeholder override. */
|
|
77
113
|
placeholder?: string;
|
|
78
114
|
};
|
|
79
115
|
}
|
|
80
116
|
/**
|
|
81
|
-
*
|
|
82
|
-
* `type` に応じて適切な入力 UI が自動選択され、`validation` で Zod スキーマを指定すると
|
|
83
|
-
* 自動生成のバリデーションを上書きできます。
|
|
117
|
+
* Additional registration input rendered and validated locally by RegisterForm.
|
|
84
118
|
*
|
|
85
|
-
* @
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* { name: 'phone', label: 'Phone', type: 'tel', required: true },
|
|
89
|
-
* { name: 'birthDate', label: 'Birth Date', type: 'date' },
|
|
90
|
-
* { name: 'company', label: 'Company', type: 'text' },
|
|
91
|
-
* { name: 'role', label: 'Role', type: 'select', required: true,
|
|
92
|
-
* options: [{ label: 'Admin', value: 'admin' }, { label: 'User', value: 'user' }] },
|
|
93
|
-
* { name: 'agreement', label: 'Agree to terms', type: 'checkbox', required: true },
|
|
94
|
-
* ];
|
|
95
|
-
* ```
|
|
119
|
+
* @remarks These values are not passed to AuthAdapter.register: the bundled form sends
|
|
120
|
+
* only email, password and name. Use host-owned persistence to save other fields.
|
|
121
|
+
* Custom validation overrides automatic type/required rules.
|
|
96
122
|
*
|
|
97
|
-
*
|
|
98
|
-
* ```tsx
|
|
99
|
-
* { name: 'phone', label: 'Phone', type: 'tel', required: true,
|
|
100
|
-
* validation: z.string().regex(/^0[0-9]{9,10}$/, 'Invalid phone number') }
|
|
101
|
-
* ```
|
|
123
|
+
* @see RegisterForm for complete usage.
|
|
102
124
|
*/
|
|
103
125
|
export interface RegisterExtraField {
|
|
104
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Unique form-data key; avoid built-in email/password/name collisions unless intentionally replacing their schema.
|
|
128
|
+
*/
|
|
105
129
|
name: string;
|
|
106
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Visible field label.
|
|
132
|
+
*/
|
|
107
133
|
label: string;
|
|
108
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Input presentation, default text. tel/url use text input modes, date uses schema date format.
|
|
136
|
+
*/
|
|
109
137
|
type?: 'text' | 'email' | 'tel' | 'date' | 'number' | 'url' | 'password' | 'textarea' | 'select' | 'checkbox';
|
|
110
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Optional input hint passed where supported by the rendered control.
|
|
140
|
+
*/
|
|
111
141
|
placeholder?: string;
|
|
112
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* Add required default validation; omission is optional except optional checkbox still expects a boolean.
|
|
144
|
+
*/
|
|
113
145
|
required?: boolean;
|
|
114
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Optional browser autocomplete hint where supported.
|
|
148
|
+
*/
|
|
115
149
|
autoComplete?: string;
|
|
116
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* Select choices; defaults to an empty list for a select without options.
|
|
152
|
+
*/
|
|
117
153
|
options?: {
|
|
154
|
+
/** Display text. */
|
|
118
155
|
label: string;
|
|
156
|
+
/** Submitted choice value. */
|
|
119
157
|
value: string;
|
|
120
158
|
}[];
|
|
121
159
|
/**
|
|
122
|
-
*
|
|
123
|
-
* 省略時は `type` と `required` から自動生成されます。
|
|
124
|
-
* @example z.string().regex(/^0[0-9]{9,10}$/)
|
|
160
|
+
* Optional Zod schema replacing generated validation for this field.
|
|
125
161
|
*/
|
|
126
162
|
validation?: z.ZodTypeAny;
|
|
127
163
|
}
|
|
128
164
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
165
|
+
* Renders account registration with built-in field overrides and optional local extra inputs.
|
|
166
|
+
*
|
|
167
|
+
* @param props - Registration success/navigation callbacks and field presentation settings.
|
|
168
|
+
*
|
|
169
|
+
* @returns Validated form, pending submit button and error feedback.
|
|
131
170
|
*
|
|
132
|
-
* @
|
|
133
|
-
*
|
|
134
|
-
* @
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
171
|
+
* @throws Error without AuthProvider; registration and onSuccess failures are shown as form errors.
|
|
172
|
+
*
|
|
173
|
+
* @remarks Requires AuthProvider inside QueryClientProvider, React Hook Form, Zod and Appkit
|
|
174
|
+
* styles. Email must be valid; password requires six characters; name is optional.
|
|
175
|
+
* Extra inputs are validated and rendered but not persisted by this component: only
|
|
176
|
+
* email, password and {name} reach adapter.register. Hidden built-in fields remain in
|
|
177
|
+
* validation. Custom extra schemas can override built-in names, so avoid collisions.
|
|
138
178
|
*
|
|
139
179
|
* @example
|
|
140
180
|
* ```tsx
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* <RegisterForm
|
|
146
|
-
*
|
|
147
|
-
* extraFields={[
|
|
148
|
-
* { name: 'phone', label: 'Phone', type: 'tel', required: true },
|
|
149
|
-
* { name: 'birthDate', label: 'Birth Date', type: 'date' },
|
|
150
|
-
* ]}
|
|
151
|
-
* />
|
|
181
|
+
* import '@alneas/appkit-react/styles';
|
|
182
|
+
* import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
183
|
+
* import { AuthProvider, RegisterForm, type AuthAdapter } from '@alneas/appkit-react/tools/auth';
|
|
184
|
+
* export function FormExample({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {
|
|
185
|
+
* return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><RegisterForm fields={{ name: { label: 'Display name' } }} /></AuthProvider></QueryClientProvider>;
|
|
186
|
+
* }
|
|
152
187
|
* ```
|
|
153
188
|
*/
|
|
154
189
|
export declare function RegisterForm({ onSuccess, fields, extraFields, showLoginLink, onLoginClick, }: {
|
|
190
|
+
/**
|
|
191
|
+
* Optional synchronous callback after registration; thrown errors become form errors.
|
|
192
|
+
*/
|
|
155
193
|
onSuccess?: () => void;
|
|
194
|
+
/**
|
|
195
|
+
* Optional visibility/label/placeholder overrides for name, email and password.
|
|
196
|
+
*/
|
|
156
197
|
fields?: RegisterFieldConfig;
|
|
198
|
+
/**
|
|
199
|
+
* Optional extra input definitions; validated locally but not forwarded to register.
|
|
200
|
+
*/
|
|
157
201
|
extraFields?: RegisterExtraField[];
|
|
202
|
+
/**
|
|
203
|
+
* Show login action when onLoginClick exists; defaults to true.
|
|
204
|
+
*/
|
|
158
205
|
showLoginLink?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Optional synchronous click handler for the login action.
|
|
208
|
+
*/
|
|
159
209
|
onLoginClick?: () => void;
|
|
160
210
|
}): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthForms.js","names":["z","m.auth_validation_invalidEmail","m.auth_validation_passwordLength","m.auth_loginWithApple","m.auth_loginWithGoogle","m.auth_failedToLogin","m.auth_socialLoginFailed","_Fragment","m.auth_orContinueWith","m.auth_email","m.auth_emailPlaceholder","m.auth_password","m.auth_loggingIn","m.signIn","m.auth_dontHaveAccount","m.signUp","m.auth_name","m.auth_namePlaceholder","m.auth_validation_invalidNumber","m.auth_validation_required","m.auth_failedToRegister","m.auth_registering","m.auth_alreadyHaveAccount","auth_alreadyhaveaccount2","auth_donthaveaccount2","auth_emailplaceholder1","auth_failedtologin2","auth_failedtoregister2","auth_loggingin1","auth_loginwithapple2","auth_loginwithgoogle2","auth_nameplaceholder1","auth_orcontinuewith2","auth_socialloginfailed2","auth_validation_invalidemail1","auth_validation_invalidnumber1","auth_validation_passwordlength1","signin1","signup1","React","z$1","loginSchema","registerSchema","AppleIcon","GoogleIcon","DefaultProviderIcon","builtInIcons","defaultSocialProviders","LoginForm","useAuth","error","setError","useState","isPending","setIsPending","useForm","zodResolver","onSubmit","login","values","onSuccess","err","handleSocialLogin","loginWithProvider","provider","redirectTo","providers","socialProviders","Form","handleSubmit","Alert","AlertCircle","AlertDescription","Fragment","Button","isSubmitting","config","showEmailLogin","FieldSeparator","AutoFormField","auth_email","auth_password","showRegisterLink","onRegisterClick","defaultFieldConfig","auth_name","resolveFieldConfig","cfg","fields","key","buildExtraFieldSchema","shape","field","auth_validation_required","renderExtraField","commonProps","inputProps","supportedType","RegisterForm","extraFieldSchema","extraFields","finalSchema","f","acc","register","nameCfg","emailCfg","passwordCfg","control","auth_registering","showLoginLink","onLoginClick"],"sources":["../../../../src/tools/components/auth/AuthForms.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport * as z from 'zod';\nimport { useAuth } from './useAuth';\nimport { Button } from '../ui/button';\nimport { Form, AutoFormField } from '../ui/form';\nimport { FieldSeparator } from '../ui/field';\nimport { Alert, AlertDescription } from '../ui/alert';\nimport { OAuthProvider } from './types';\nimport { AlertCircle } from 'lucide-react';\nimport * as m from '../../paraglide/messages.js';\n\nconst loginSchema = z.object({\n email: z.string().email({ message: m.auth_validation_invalidEmail() }),\n password: z.string().min(6, { message: m.auth_validation_passwordLength() }),\n});\n\nconst registerSchema = z.object({\n email: z.string().email({ message: m.auth_validation_invalidEmail() }),\n password: z.string().min(6, { message: m.auth_validation_passwordLength() }),\n name: z.string().optional(),\n});\n\n/**\n * ソーシャルログインプロバイダーの設定\n *\n * @example\n * ```tsx\n * const providers: SocialProviderConfig[] = [\n * { provider: 'google', label: 'Login with Google' },\n * { provider: 'line-oidc', label: 'LINEでログイン', icon: <LineIcon /> },\n * ];\n * ```\n */\nexport interface SocialProviderConfig {\n /** プロバイダー識別子(組み込みまたはカスタム OIDC プロバイダー名) */\n provider: OAuthProvider;\n /** ボタンに表示するラベル */\n label: string;\n /** アイコン(ReactNode)。省略時はデフォルトアイコンを使用 */\n icon?: React.ReactNode;\n}\n\n/** Apple のデフォルトアイコン */\nconst AppleIcon = () => (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' className='mr-2 h-4 w-4'>\n <path\n d='M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701'\n fill='currentColor'\n />\n </svg>\n);\n\n/** Google のデフォルトアイコン */\nconst GoogleIcon = () => (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' className='mr-2 h-4 w-4'>\n <path\n d='M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z'\n fill='currentColor'\n />\n </svg>\n);\n\n/** カスタムプロバイダー用のデフォルトアイコン(Globe) */\nconst DefaultProviderIcon = () => (\n <svg\n xmlns='http://www.w3.org/2000/svg'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='2'\n strokeLinecap='round'\n strokeLinejoin='round'\n className='mr-2 h-4 w-4'\n >\n <circle cx='12' cy='12' r='10' />\n <path d='M2 12h20' />\n <path d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z' />\n </svg>\n);\n\n/** 組み込みプロバイダーのデフォルトアイコンマップ */\nconst builtInIcons: Record<string, React.ReactNode> = {\n apple: <AppleIcon />,\n google: <GoogleIcon />,\n};\n\n/** デフォルトのソーシャルプロバイダー設定(後方互換用) */\nconst defaultSocialProviders: SocialProviderConfig[] = [\n { provider: 'apple', label: m.auth_loginWithApple() },\n { provider: 'google', label: m.auth_loginWithGoogle() },\n];\n\n/**\n * ログイン用のフォームコンポーネント。メールアドレスとパスワードによる認証、およびソーシャルログインに対応します。\n *\n * @param props - コンポーネントのプロパティ\n * @param props.onSuccess - ログイン成功時のコールバック\n * @param props.socialProviders - ソーシャルログインプロバイダーの設定(省略時は Apple + Google)\n * @param props.showRegisterLink - 新規登録リンクを表示するか(デフォルト: true)\n * @param props.showEmailLogin - メールアドレスとパスワードのログイン欄を表示するか(デフォルト: true)\n * @param props.redirectTo - ソーシャルログイン後の移動先(デフォルト: 現在のドメインの `/`)\n * @param props.onRegisterClick - 新規登録リンククリック時のコールバック(設定するとリンクが表示される)\n *\n * @example\n * ```tsx\n * <LoginForm\n * onSuccess={() => navigate('/dashboard')}\n * socialProviders={[{ provider: 'google', label: 'Googleでログイン' }]}\n * />\n * ```\n */\nexport function LoginForm({\n onSuccess,\n socialProviders,\n showRegisterLink = true,\n showEmailLogin = true,\n redirectTo = '/',\n onRegisterClick,\n}: {\n onSuccess?: () => void;\n socialProviders?: SocialProviderConfig[];\n showRegisterLink?: boolean;\n showEmailLogin?: boolean;\n redirectTo?: string;\n onRegisterClick?: () => void;\n}) {\n const { login, loginWithProvider } = useAuth();\n const [error, setError] = useState<string | null>(null);\n const [isPending, setIsPending] = useState(false);\n\n const form = useForm<z.infer<typeof loginSchema>>({\n resolver: zodResolver(loginSchema),\n defaultValues: {\n email: '',\n password: '',\n },\n });\n\n const {\n handleSubmit,\n control,\n formState: { isSubmitting },\n } = form;\n\n async function onSubmit(values: z.infer<typeof loginSchema>) {\n try {\n setIsPending(true);\n setError(null);\n await login(values.email, values.password);\n if (onSuccess) onSuccess();\n } catch (err) {\n setError(err instanceof Error ? err.message : m.auth_failedToLogin());\n } finally {\n setIsPending(false);\n }\n }\n\n const handleSocialLogin = async (provider: OAuthProvider) => {\n if (!loginWithProvider) return;\n\n try {\n setError(null);\n await loginWithProvider(provider, {\n redirectTo: new URL(redirectTo, window.location.origin).href,\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : m.auth_socialLoginFailed());\n }\n };\n\n const providers = socialProviders ?? defaultSocialProviders;\n\n return (\n <Form.Root onSubmit={handleSubmit(onSubmit)} className='space-y-4'>\n {error && (\n <Alert variant='destructive'>\n <AlertCircle className='h-4 w-4' />\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n )}\n\n {loginWithProvider && providers.length > 0 && (\n <>\n <div className='flex flex-col gap-2'>\n {providers.map((config) => (\n <Button\n key={config.provider}\n variant='outline'\n type='button'\n disabled={isPending || isSubmitting}\n onClick={() => handleSocialLogin(config.provider)}\n >\n {config.icon ?? builtInIcons[config.provider] ?? <DefaultProviderIcon />}\n {config.label}\n </Button>\n ))}\n </div>\n\n {showEmailLogin && (\n <FieldSeparator className='*:data-[slot=field-separator-content]:bg-card'>\n {m.auth_orContinueWith()}\n </FieldSeparator>\n )}\n </>\n )}\n\n {showEmailLogin && (\n <>\n <AutoFormField\n control={control}\n name='email'\n label={m.auth_email()}\n inputProps={{ placeholder: m.auth_emailPlaceholder() }}\n />\n\n <AutoFormField\n control={control}\n name='password'\n label={m.auth_password()}\n type='password'\n inputProps={{ autoComplete: 'current-password' }}\n />\n\n <Button type='submit' className='w-full' disabled={isPending || isSubmitting}>\n {isPending ? m.auth_loggingIn() : m.signIn()}\n </Button>\n </>\n )}\n\n {showRegisterLink && onRegisterClick && (\n <div className='text-center text-sm text-muted-foreground'>\n {m.auth_dontHaveAccount()}{' '}\n <Button type='button' variant='link' className='p-0 h-auto' onClick={onRegisterClick}>\n {m.signUp()}\n </Button>\n </div>\n )}\n </Form.Root>\n );\n}\n\n/**\n * ユーザー登録フォームの既存フィールド(name/email/password)の表示設定。\n * 各フィールドの表示/非表示、ラベル、プレースホルダーを個別にカスタマイズできます。\n *\n * @example\n * ```tsx\n * // name フィールドを非表示にして、email のラベルを変更\n * <RegisterForm fields={{ name: { show: false }, email: { label: 'Email Address' } }} />\n * ```\n */\nexport interface RegisterFieldConfig {\n /** 名前フィールドの設定 */\n name?: { show?: boolean; label?: string; placeholder?: string };\n /** メールアドレスフィールドの設定 */\n email?: { show?: boolean; label?: string; placeholder?: string };\n /** パスワードフィールドの設定 */\n password?: { show?: boolean; label?: string; placeholder?: string };\n}\n\n/**\n * 登録フォームに追加するカスタムフィールドの設定。\n * `type` に応じて適切な入力 UI が自動選択され、`validation` で Zod スキーマを指定すると\n * 自動生成のバリデーションを上書きできます。\n *\n * @example\n * ```tsx\n * const extraFields: RegisterExtraField[] = [\n * { name: 'phone', label: 'Phone', type: 'tel', required: true },\n * { name: 'birthDate', label: 'Birth Date', type: 'date' },\n * { name: 'company', label: 'Company', type: 'text' },\n * { name: 'role', label: 'Role', type: 'select', required: true,\n * options: [{ label: 'Admin', value: 'admin' }, { label: 'User', value: 'user' }] },\n * { name: 'agreement', label: 'Agree to terms', type: 'checkbox', required: true },\n * ];\n * ```\n *\n * カスタムバリデーション:\n * ```tsx\n * { name: 'phone', label: 'Phone', type: 'tel', required: true,\n * validation: z.string().regex(/^0[0-9]{9,10}$/, 'Invalid phone number') }\n * ```\n */\nexport interface RegisterExtraField {\n /** フィールドのキー名(フォームデータのプロパティ名) */\n name: string;\n /** ラベル */\n label: string;\n /** 入力 UI の種類。`date` はネイティブの日付ピッカー、`tel` はテンキー入力に対応 */\n type?: 'text' | 'email' | 'tel' | 'date' | 'number' | 'url' | 'password' | 'textarea' | 'select' | 'checkbox';\n /** プレースホルダー */\n placeholder?: string;\n /** 必須フィールドとするか */\n required?: boolean;\n /** autocomplete 属性 */\n autoComplete?: string;\n /** `type='select'` の場合の選択肢 */\n options?: { label: string; value: string }[];\n /**\n * カスタム Zod バリデーション。\n * 省略時は `type` と `required` から自動生成されます。\n * @example z.string().regex(/^0[0-9]{9,10}$/)\n */\n validation?: z.ZodTypeAny;\n}\n\nconst defaultFieldConfig = {\n name: { show: true, label: m.auth_name(), placeholder: m.auth_namePlaceholder() },\n email: { show: true, label: m.auth_email(), placeholder: m.auth_emailPlaceholder() },\n password: { show: true, label: m.auth_password(), placeholder: '' },\n};\n\nfunction resolveFieldConfig(\n fields: RegisterFieldConfig | undefined,\n key: keyof RegisterFieldConfig,\n) {\n const cfg = fields?.[key];\n if (!cfg) return defaultFieldConfig[key];\n return {\n show: cfg.show ?? defaultFieldConfig[key].show,\n label: cfg.label ?? defaultFieldConfig[key].label,\n placeholder: cfg.placeholder ?? defaultFieldConfig[key].placeholder,\n };\n}\n\nfunction buildExtraFieldSchema(fields: RegisterExtraField[]): z.ZodObject<any> {\n const shape: Record<string, z.ZodTypeAny> = {};\n for (const field of fields) {\n if (field.validation) {\n shape[field.name] = field.validation;\n } else if (field.type === 'email') {\n shape[field.name] = field.required\n ? z.string().email({ message: m.auth_validation_invalidEmail() })\n : z.string().email({ message: m.auth_validation_invalidEmail() }).optional().or(z.literal(''));\n } else if (field.type === 'number') {\n shape[field.name] = field.required\n ? z.coerce.number({ message: m.auth_validation_invalidNumber() })\n : z.coerce.number({ message: m.auth_validation_invalidNumber() }).optional();\n } else if (field.type === 'checkbox') {\n shape[field.name] = field.required\n ? z.literal(true, { message: m.auth_validation_required() })\n : z.boolean();\n } else {\n shape[field.name] = field.required\n ? z.string().min(1, m.auth_validation_required())\n : z.string().optional();\n }\n }\n return z.object(shape);\n}\n\nfunction renderExtraField(field: RegisterExtraField, control: any) {\n const commonProps = {\n control,\n name: field.name,\n label: field.label,\n required: field.required,\n };\n\n const inputProps: Record<string, any> = {};\n if (field.placeholder) inputProps.placeholder = field.placeholder;\n if (field.autoComplete) inputProps.autoComplete = field.autoComplete;\n\n if (field.type === 'date') {\n return (\n <AutoFormField\n {...commonProps}\n jsonSchema={{ type: 'string', format: 'date' }}\n />\n );\n }\n\n if (field.type === 'select') {\n return (\n <AutoFormField\n {...commonProps}\n type='select'\n options={field.options ?? []}\n />\n );\n }\n\n if (field.type === 'checkbox') {\n return <AutoFormField {...commonProps} type='checkbox' />;\n }\n\n if (field.type === 'textarea') {\n return (\n <AutoFormField\n {...commonProps}\n type='textarea'\n inputProps={inputProps}\n />\n );\n }\n\n if (field.type === 'tel') inputProps.inputMode = 'tel';\n if (field.type === 'url') inputProps.inputMode = 'url';\n\n const supportedType = ['text', 'number', 'email', 'password'].includes(field.type ?? 'text')\n ? (field.type as 'text' | 'number' | 'email' | 'password')\n : 'text';\n\n return (\n <AutoFormField\n {...commonProps}\n type={supportedType}\n inputProps={Object.keys(inputProps).length > 0 ? inputProps : undefined}\n />\n );\n}\n\n/**\n * ユーザー登録用のフォームコンポーネント。メールアドレス、パスワード、および任意の氏名の入力を受け付けます。\n * `fields` で既存フィールドの表示/非表示やラベルを、`extraFields` で任意の追加項目を設定できます。\n *\n * @param props - コンポーネントのプロパティ\n * @param props.onSuccess - 登録成功時のコールバック\n * @param props.fields - 既存フィールド(name/email/password)の表示カスタマイズ\n * @param props.extraFields - 追加フィールドの定義(電話番号、生年月日など任意の項目)\n * @param props.showLoginLink - ログインページへのリンクを表示するか(デフォルト: true)\n * @param props.onLoginClick - ログインリンククリック時のコールバック\n *\n * @example\n * ```tsx\n * // 基本\n * <RegisterForm onSuccess={() => navigate('/login')} />\n *\n * // name 非表示 + 追加フィールド\n * <RegisterForm\n * fields={{ name: { show: false } }}\n * extraFields={[\n * { name: 'phone', label: 'Phone', type: 'tel', required: true },\n * { name: 'birthDate', label: 'Birth Date', type: 'date' },\n * ]}\n * />\n * ```\n */\nexport function RegisterForm({\n onSuccess,\n fields,\n extraFields,\n showLoginLink = true,\n onLoginClick,\n}: {\n onSuccess?: () => void;\n fields?: RegisterFieldConfig;\n extraFields?: RegisterExtraField[];\n showLoginLink?: boolean;\n onLoginClick?: () => void;\n}) {\n const { register } = useAuth();\n const [error, setError] = useState<string | null>(null);\n const [isPending, setIsPending] = useState(false);\n\n const extraFieldSchema = extraFields?.length ? buildExtraFieldSchema(extraFields) : null;\n const finalSchema = extraFieldSchema ? registerSchema.extend(extraFieldSchema.shape) : registerSchema;\n\n const form = useForm<any>({\n resolver: zodResolver(finalSchema),\n defaultValues: {\n email: '',\n password: '',\n name: '',\n ...(extraFields?.reduce((acc, f) => {\n acc[f.name] = f.type === 'checkbox' ? false : '';\n return acc;\n }, {} as Record<string, any>)),\n },\n });\n\n const {\n handleSubmit,\n control,\n formState: { isSubmitting },\n } = form;\n\n async function onSubmit(values: any) {\n try {\n setIsPending(true);\n setError(null);\n await register(values.email, values.password, { name: values.name });\n if (onSuccess) onSuccess();\n } catch (err) {\n setError(err instanceof Error ? err.message : m.auth_failedToRegister());\n } finally {\n setIsPending(false);\n }\n }\n\n return (\n <Form.Root onSubmit={handleSubmit(onSubmit)} className='space-y-4'>\n {error && (\n <Alert variant='destructive'>\n <AlertCircle className='h-4 w-4' />\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n )}\n\n {(() => {\n const nameCfg = resolveFieldConfig(fields, 'name');\n const emailCfg = resolveFieldConfig(fields, 'email');\n const passwordCfg = resolveFieldConfig(fields, 'password');\n return (\n <>\n {nameCfg.show && (\n <AutoFormField\n control={control}\n name='name'\n label={nameCfg.label}\n inputProps={{ placeholder: nameCfg.placeholder }}\n />\n )}\n {emailCfg.show && (\n <AutoFormField\n control={control}\n name='email'\n label={emailCfg.label}\n inputProps={{ placeholder: emailCfg.placeholder }}\n />\n )}\n {passwordCfg.show && (\n <AutoFormField\n control={control}\n name='password'\n label={passwordCfg.label}\n type='password'\n inputProps={{ autoComplete: 'new-password', placeholder: passwordCfg.placeholder || undefined }}\n />\n )}\n </>\n );\n })()}\n\n {extraFields?.length ? (\n <div className='space-y-4'>\n {extraFields.map((field) => (\n <React.Fragment key={field.name}>\n {renderExtraField(field, control)}\n </React.Fragment>\n ))}\n </div>\n ) : null}\n\n <Button type='submit' className='w-full' disabled={isPending || isSubmitting}>\n {isPending ? m.auth_registering() : m.signUp()}\n </Button>\n\n {showLoginLink && onLoginClick && (\n <div className='text-center text-sm text-muted-foreground'>\n {m.auth_alreadyHaveAccount()}{' '}\n <Button type='button' variant='link' className='p-0 h-auto' onClick={onLoginClick}>\n {m.signIn()}\n </Button>\n </div>\n )}\n </Form.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMyC,IAAczC,EAAE,OAAO;CAC3B,OAAOA,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,SAASC,EAA+B,EAAE,CAAC;CACrE,UAAUD,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG,EAAE,SAASE,EAAiC,EAAE,CAAC;AAC7E,CAAC,GAEKwC,IAAiB1C,EAAE,OAAO;CAC9B,OAAOA,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,SAASC,EAA+B,EAAE,CAAC;CACrE,UAAUD,EAAE,OAAO,CAAC,CAAC,IAAI,GAAG,EAAE,SAASE,EAAiC,EAAE,CAAC;CAC3E,MAAMF,EAAE,OAAO,CAAC,CAAC,SAAS;AAC5B,CAAC,GAuBK2C,UACJ,kBAAC,OAAD;CAAK,OAAM;CAA6B,SAAQ;CAAY,WAAU;CACpE,UAAA,kBAAC,QAAD;EACE,GAAE;EACF,MAAK;CACN,CAAA;AACE,CAAA,GAIDC,UACJ,kBAAC,OAAD;CAAK,OAAM;CAA6B,SAAQ;CAAY,WAAU;CACpE,UAAA,kBAAC,QAAD;EACE,GAAE;EACF,MAAK;CACN,CAAA;AACE,CAAA,GAIDC,UACJ,kBAAC,OAAD;CACE,OAAM;CACN,SAAQ;CACR,MAAK;CACL,QAAO;CACP,aAAY;CACZ,eAAc;CACd,gBAAe;CACf,W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;MACT,MAAK;MACL,OAAO0B,EAAQ;MACf,YAAY,EAAE,aAAaA,EAAQ,YAAY;KAChD,CAAA;KAEFC,EAAS,QACR,kBAAC3B,GAAD;MACW;MACT,MAAK;MACL,OAAO2B,EAAS;MAChB,YAAY,EAAE,aAAaA,EAAS,YAAY;KACjD,CAAA;KAEFC,EAAY,QACX,kBAAC5B,GAAD;MACW;MACT,MAAK;MACL,OAAO4B,EAAY;MACnB,MAAK;MACL,YAAY;OAAE,cAAc;OAAgB,aAAaA,EAAY,eAAe,KAAA;MAAU;KAC/F,CAAA;IAEH,EAAA,CAAA;GAEN,EAAA,CAAG;GAEFP,GAAa,SACZ,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAAA,EAAY,KAAK,MAChB,kBAAC7D,EAAM,UAAP,EAAA,UACGuD,EAAiBF,GAAOgB,CAAO,EAClB,GAFKhB,EAAM,IAEX,CACjB;GACE,CAAA,IACH;GAEJ,kBAAClB,GAAD;IAAQ,MAAK;IAAS,WAAU;IAAS,UAAUrB,KAAasB;IAC7D,UAAAtB,IAAYhC,EAAmB,IAAIN,EAAS;GACvC,CAAA;GAEP+F,KAAiBC,KAChB,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACGzF,EAA0B;KAAG;KAC9B,kBAACoD,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAO,WAAU;MAAa,SAASqC;MAClE,UAAAlG,EAAS;KACJ,CAAA;IACL;;EAEE;;AAEf"}
|
|
1
|
+
{"version":3,"file":"AuthForms.js","names":["z","m.auth_validation_invalidEmail","m.auth_validation_passwordLength","m.auth_loginWithApple","m.auth_loginWithGoogle","m.auth_failedToLogin","m.auth_socialLoginFailed","_Fragment","m.auth_orContinueWith","m.auth_email","m.auth_emailPlaceholder","m.auth_password","m.auth_loggingIn","m.signIn","m.auth_dontHaveAccount","m.signUp","m.auth_name","m.auth_namePlaceholder","m.auth_validation_invalidNumber","m.auth_validation_required","m.auth_failedToRegister","m.auth_registering","m.auth_alreadyHaveAccount","auth_alreadyhaveaccount2","auth_donthaveaccount2","auth_emailplaceholder1","auth_failedtologin2","auth_failedtoregister2","auth_loggingin1","auth_loginwithapple2","auth_loginwithgoogle2","auth_nameplaceholder1","auth_orcontinuewith2","auth_socialloginfailed2","auth_validation_invalidemail1","auth_validation_invalidnumber1","auth_validation_passwordlength1","signin1","signup1","React","z$1","loginSchema","registerSchema","AppleIcon","GoogleIcon","DefaultProviderIcon","builtInIcons","defaultSocialProviders","LoginForm","useAuth","error","setError","useState","isPending","setIsPending","useForm","zodResolver","onSubmit","login","values","onSuccess","err","handleSocialLogin","loginWithProvider","provider","redirectTo","providers","socialProviders","Form","handleSubmit","Alert","AlertCircle","AlertDescription","Fragment","Button","isSubmitting","config","showEmailLogin","FieldSeparator","AutoFormField","auth_email","auth_password","showRegisterLink","onRegisterClick","defaultFieldConfig","auth_name","resolveFieldConfig","cfg","fields","key","buildExtraFieldSchema","shape","field","auth_validation_required","renderExtraField","commonProps","inputProps","supportedType","RegisterForm","extraFieldSchema","extraFields","finalSchema","f","acc","register","nameCfg","emailCfg","passwordCfg","control","auth_registering","showLoginLink","onLoginClick"],"sources":["../../../../src/tools/components/auth/AuthForms.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport * as z from 'zod';\nimport { useAuth } from './useAuth';\nimport { Button } from '../ui/button';\nimport { Form, AutoFormField } from '../ui/form';\nimport { FieldSeparator } from '../ui/field';\nimport { Alert, AlertDescription } from '../ui/alert';\nimport { OAuthProvider } from './types';\nimport { AlertCircle } from 'lucide-react';\nimport * as m from '../../paraglide/messages.js';\n\nconst loginSchema = z.object({\n email: z.string().email({ message: m.auth_validation_invalidEmail() }),\n password: z.string().min(6, { message: m.auth_validation_passwordLength() }),\n});\n\nconst registerSchema = z.object({\n email: z.string().email({ message: m.auth_validation_invalidEmail() }),\n password: z.string().min(6, { message: m.auth_validation_passwordLength() }),\n name: z.string().optional(),\n});\n\n/**\n * OAuth button configuration rendered by LoginForm.\n *\n * @see LoginForm for complete provider setup.\n */\nexport interface SocialProviderConfig {\n /**\n * Identifier passed to adapter.loginWithProvider; actual support is host-configured.\n */\n provider: OAuthProvider;\n /**\n * Visible button text.\n */\n label: string;\n /**\n * Optional icon; omission uses Apple/Google artwork or a generic globe.\n */\n icon?: React.ReactNode;\n}\n\n/** Default Apple icon. */\nconst AppleIcon = () => (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' className='mr-2 h-4 w-4'>\n <path\n d='M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701'\n fill='currentColor'\n />\n </svg>\n);\n\n/** Default Google icon. */\nconst GoogleIcon = () => (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' className='mr-2 h-4 w-4'>\n <path\n d='M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z'\n fill='currentColor'\n />\n </svg>\n);\n\n/** Generic globe for custom providers. */\nconst DefaultProviderIcon = () => (\n <svg\n xmlns='http://www.w3.org/2000/svg'\n viewBox='0 0 24 24'\n fill='none'\n stroke='currentColor'\n strokeWidth='2'\n strokeLinecap='round'\n strokeLinejoin='round'\n className='mr-2 h-4 w-4'\n >\n <circle cx='12' cy='12' r='10' />\n <path d='M2 12h20' />\n <path d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z' />\n </svg>\n);\n\n/** Default artwork for known provider names. */\nconst builtInIcons: Record<string, React.ReactNode> = {\n apple: <AppleIcon />,\n google: <GoogleIcon />,\n};\n\n/** Default Apple and Google button definitions. */\nconst defaultSocialProviders: SocialProviderConfig[] = [\n { provider: 'apple', label: m.auth_loginWithApple() },\n { provider: 'google', label: m.auth_loginWithGoogle() },\n];\n\n/**\n * Renders email/password login and optional OAuth provider buttons.\n *\n * @param props - Success/navigation callbacks, provider buttons and optional visibility settings.\n *\n * @returns Login form with validation, pending state and an error alert.\n *\n * @throws Error without AuthProvider; email/OAuth action failures are caught and shown as messages.\n *\n * @remarks Requires AuthProvider inside QueryClientProvider, React Hook Form, Zod and Appkit\n * styles. Email must be valid and password at least six characters before submission.\n * Email success invokes onSuccess; OAuth success does not. OAuth buttons exist only\n * when the adapter supplies loginWithProvider. The host configures real authentication.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n * import { AuthProvider, LoginForm, type AuthAdapter } from '@alneas/appkit-react/tools/auth';\n * export function FormExample({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {\n * return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><LoginForm socialProviders={[{ provider: 'google', label: 'Google' }]} /></AuthProvider></QueryClientProvider>;\n * }\n * ```\n */\nexport function LoginForm({\n onSuccess,\n socialProviders,\n showRegisterLink = true,\n showEmailLogin = true,\n redirectTo = '/',\n onRegisterClick,\n}: {\n /**\n * Optional synchronous callback after successful email/password login; thrown errors become form error messages.\n */\n onSuccess?: () => void;\n /**\n * OAuth button definitions; omission uses Apple and Google, empty array hides buttons.\n */\n socialProviders?: SocialProviderConfig[];\n /**\n * Show the register action only when onRegisterClick also exists; defaults to true.\n */\n showRegisterLink?: boolean;\n /**\n * Show email/password fields and submit button; defaults to true.\n */\n showEmailLogin?: boolean;\n /**\n * OAuth destination resolved against window.location.origin; defaults to /.\n */\n redirectTo?: string;\n /**\n * Optional synchronous click handler for the register action.\n */\n onRegisterClick?: () => void;\n}) {\n const { login, loginWithProvider } = useAuth();\n const [error, setError] = useState<string | null>(null);\n const [isPending, setIsPending] = useState(false);\n\n const form = useForm<z.infer<typeof loginSchema>>({\n resolver: zodResolver(loginSchema),\n defaultValues: {\n email: '',\n password: '',\n },\n });\n\n const {\n handleSubmit,\n control,\n formState: { isSubmitting },\n } = form;\n\n async function onSubmit(values: z.infer<typeof loginSchema>) {\n try {\n setIsPending(true);\n setError(null);\n await login(values.email, values.password);\n if (onSuccess) onSuccess();\n } catch (err) {\n setError(err instanceof Error ? err.message : m.auth_failedToLogin());\n } finally {\n setIsPending(false);\n }\n }\n\n const handleSocialLogin = async (provider: OAuthProvider) => {\n if (!loginWithProvider) return;\n\n try {\n setError(null);\n await loginWithProvider(provider, {\n redirectTo: new URL(redirectTo, window.location.origin).href,\n });\n } catch (err) {\n setError(err instanceof Error ? err.message : m.auth_socialLoginFailed());\n }\n };\n\n const providers = socialProviders ?? defaultSocialProviders;\n\n return (\n <Form.Root onSubmit={handleSubmit(onSubmit)} className='space-y-4'>\n {error && (\n <Alert variant='destructive'>\n <AlertCircle className='h-4 w-4' />\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n )}\n\n {loginWithProvider && providers.length > 0 && (\n <>\n <div className='flex flex-col gap-2'>\n {providers.map((config) => (\n <Button\n key={config.provider}\n variant='outline'\n type='button'\n disabled={isPending || isSubmitting}\n onClick={() => handleSocialLogin(config.provider)}\n >\n {config.icon ?? builtInIcons[config.provider] ?? <DefaultProviderIcon />}\n {config.label}\n </Button>\n ))}\n </div>\n\n {showEmailLogin && (\n <FieldSeparator className='*:data-[slot=field-separator-content]:bg-card'>\n {m.auth_orContinueWith()}\n </FieldSeparator>\n )}\n </>\n )}\n\n {showEmailLogin && (\n <>\n <AutoFormField\n control={control}\n name='email'\n label={m.auth_email()}\n inputProps={{ placeholder: m.auth_emailPlaceholder() }}\n />\n\n <AutoFormField\n control={control}\n name='password'\n label={m.auth_password()}\n type='password'\n inputProps={{ autoComplete: 'current-password' }}\n />\n\n <Button type='submit' className='w-full' disabled={isPending || isSubmitting}>\n {isPending ? m.auth_loggingIn() : m.signIn()}\n </Button>\n </>\n )}\n\n {showRegisterLink && onRegisterClick && (\n <div className='text-center text-sm text-muted-foreground'>\n {m.auth_dontHaveAccount()}{' '}\n <Button type='button' variant='link' className='p-0 h-auto' onClick={onRegisterClick}>\n {m.signUp()}\n </Button>\n </div>\n )}\n </Form.Root>\n );\n}\n\n/**\n * Visibility, label and placeholder overrides for the three built-in registration fields.\n *\n * @remarks All fields default to visible; labels/placeholders are localized. Hiding email\n * or password does not remove their required schema validation.\n *\n * @see RegisterForm for usage.\n */\nexport interface RegisterFieldConfig {\n /**\n * Overrides for optional display-name input.\n */\n name?: {\n /** Visibility override; defaults to true. */\n show?: boolean;\n /** Localized label override. */\n label?: string;\n /** Placeholder override. */\n placeholder?: string;\n };\n /**\n * Overrides for required email input; hiding it does not skip validation.\n */\n email?: {\n /** Visibility override; defaults to true. */\n show?: boolean;\n /** Localized label override. */\n label?: string;\n /** Placeholder override. */\n placeholder?: string;\n };\n /**\n * Overrides for required password input; hiding it does not skip validation.\n */\n password?: {\n /** Visibility override; defaults to true. */\n show?: boolean;\n /** Localized label override. */\n label?: string;\n /** Placeholder override. */\n placeholder?: string;\n };\n}\n\n/**\n * Additional registration input rendered and validated locally by RegisterForm.\n *\n * @remarks These values are not passed to AuthAdapter.register: the bundled form sends\n * only email, password and name. Use host-owned persistence to save other fields.\n * Custom validation overrides automatic type/required rules.\n *\n * @see RegisterForm for complete usage.\n */\nexport interface RegisterExtraField {\n /**\n * Unique form-data key; avoid built-in email/password/name collisions unless intentionally replacing their schema.\n */\n name: string;\n /**\n * Visible field label.\n */\n label: string;\n /**\n * Input presentation, default text. tel/url use text input modes, date uses schema date format.\n */\n type?: 'text' | 'email' | 'tel' | 'date' | 'number' | 'url' | 'password' | 'textarea' | 'select' | 'checkbox';\n /**\n * Optional input hint passed where supported by the rendered control.\n */\n placeholder?: string;\n /**\n * Add required default validation; omission is optional except optional checkbox still expects a boolean.\n */\n required?: boolean;\n /**\n * Optional browser autocomplete hint where supported.\n */\n autoComplete?: string;\n /**\n * Select choices; defaults to an empty list for a select without options.\n */\n options?: {\n /** Display text. */\n label: string;\n /** Submitted choice value. */\n value: string;\n }[];\n /**\n * Optional Zod schema replacing generated validation for this field.\n */\n validation?: z.ZodTypeAny;\n}\n\nconst defaultFieldConfig = {\n name: { show: true, label: m.auth_name(), placeholder: m.auth_namePlaceholder() },\n email: { show: true, label: m.auth_email(), placeholder: m.auth_emailPlaceholder() },\n password: { show: true, label: m.auth_password(), placeholder: '' },\n};\n\nfunction resolveFieldConfig(\n fields: RegisterFieldConfig | undefined,\n key: keyof RegisterFieldConfig,\n) {\n const cfg = fields?.[key];\n if (!cfg) return defaultFieldConfig[key];\n return {\n show: cfg.show ?? defaultFieldConfig[key].show,\n label: cfg.label ?? defaultFieldConfig[key].label,\n placeholder: cfg.placeholder ?? defaultFieldConfig[key].placeholder,\n };\n}\n\nfunction buildExtraFieldSchema(fields: RegisterExtraField[]): z.ZodObject<any> {\n const shape: Record<string, z.ZodTypeAny> = {};\n for (const field of fields) {\n if (field.validation) {\n shape[field.name] = field.validation;\n } else if (field.type === 'email') {\n shape[field.name] = field.required\n ? z.string().email({ message: m.auth_validation_invalidEmail() })\n : z.string().email({ message: m.auth_validation_invalidEmail() }).optional().or(z.literal(''));\n } else if (field.type === 'number') {\n shape[field.name] = field.required\n ? z.coerce.number({ message: m.auth_validation_invalidNumber() })\n : z.coerce.number({ message: m.auth_validation_invalidNumber() }).optional();\n } else if (field.type === 'checkbox') {\n shape[field.name] = field.required\n ? z.literal(true, { message: m.auth_validation_required() })\n : z.boolean();\n } else {\n shape[field.name] = field.required\n ? z.string().min(1, m.auth_validation_required())\n : z.string().optional();\n }\n }\n return z.object(shape);\n}\n\nfunction renderExtraField(field: RegisterExtraField, control: any) {\n const commonProps = {\n control,\n name: field.name,\n label: field.label,\n required: field.required,\n };\n\n const inputProps: Record<string, any> = {};\n if (field.placeholder) inputProps.placeholder = field.placeholder;\n if (field.autoComplete) inputProps.autoComplete = field.autoComplete;\n\n if (field.type === 'date') {\n return (\n <AutoFormField\n {...commonProps}\n jsonSchema={{ type: 'string', format: 'date' }}\n />\n );\n }\n\n if (field.type === 'select') {\n return (\n <AutoFormField\n {...commonProps}\n type='select'\n options={field.options ?? []}\n />\n );\n }\n\n if (field.type === 'checkbox') {\n return <AutoFormField {...commonProps} type='checkbox' />;\n }\n\n if (field.type === 'textarea') {\n return (\n <AutoFormField\n {...commonProps}\n type='textarea'\n inputProps={inputProps}\n />\n );\n }\n\n if (field.type === 'tel') inputProps.inputMode = 'tel';\n if (field.type === 'url') inputProps.inputMode = 'url';\n\n const supportedType = ['text', 'number', 'email', 'password'].includes(field.type ?? 'text')\n ? (field.type as 'text' | 'number' | 'email' | 'password')\n : 'text';\n\n return (\n <AutoFormField\n {...commonProps}\n type={supportedType}\n inputProps={Object.keys(inputProps).length > 0 ? inputProps : undefined}\n />\n );\n}\n\n/**\n * Renders account registration with built-in field overrides and optional local extra inputs.\n *\n * @param props - Registration success/navigation callbacks and field presentation settings.\n *\n * @returns Validated form, pending submit button and error feedback.\n *\n * @throws Error without AuthProvider; registration and onSuccess failures are shown as form errors.\n *\n * @remarks Requires AuthProvider inside QueryClientProvider, React Hook Form, Zod and Appkit\n * styles. Email must be valid; password requires six characters; name is optional.\n * Extra inputs are validated and rendered but not persisted by this component: only\n * email, password and {name} reach adapter.register. Hidden built-in fields remain in\n * validation. Custom extra schemas can override built-in names, so avoid collisions.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n * import { AuthProvider, RegisterForm, type AuthAdapter } from '@alneas/appkit-react/tools/auth';\n * export function FormExample({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {\n * return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><RegisterForm fields={{ name: { label: 'Display name' } }} /></AuthProvider></QueryClientProvider>;\n * }\n * ```\n */\nexport function RegisterForm({\n onSuccess,\n fields,\n extraFields,\n showLoginLink = true,\n onLoginClick,\n}: {\n /**\n * Optional synchronous callback after registration; thrown errors become form errors.\n */\n onSuccess?: () => void;\n /**\n * Optional visibility/label/placeholder overrides for name, email and password.\n */\n fields?: RegisterFieldConfig;\n /**\n * Optional extra input definitions; validated locally but not forwarded to register.\n */\n extraFields?: RegisterExtraField[];\n /**\n * Show login action when onLoginClick exists; defaults to true.\n */\n showLoginLink?: boolean;\n /**\n * Optional synchronous click handler for the login action.\n */\n onLoginClick?: () => void;\n}) {\n const { register } = useAuth();\n const [error, setError] = useState<string | null>(null);\n const [isPending, setIsPending] = useState(false);\n\n const extraFieldSchema = extraFields?.length ? buildExtraFieldSchema(extraFields) : null;\n const finalSchema = extraFieldSchema ? registerSchema.extend(extraFieldSchema.shape) : registerSchema;\n\n const form = useForm<any>({\n resolver: zodResolver(finalSchema),\n defaultValues: {\n email: '',\n password: '',\n name: '',\n ...(extraFields?.reduce((acc, f) => {\n acc[f.name] = f.type === 'checkbox' ? false : '';\n return acc;\n }, {} as Record<string, any>)),\n },\n });\n\n const {\n handleSubmit,\n control,\n formState: { isSubmitting },\n } = form;\n\n async function onSubmit(values: any) {\n try {\n setIsPending(true);\n setError(null);\n await register(values.email, values.password, { name: values.name });\n if (onSuccess) onSuccess();\n } catch (err) {\n setError(err instanceof Error ? err.message : m.auth_failedToRegister());\n } finally {\n setIsPending(false);\n }\n }\n\n return (\n <Form.Root onSubmit={handleSubmit(onSubmit)} className='space-y-4'>\n {error && (\n <Alert variant='destructive'>\n <AlertCircle className='h-4 w-4' />\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n )}\n\n {(() => {\n const nameCfg = resolveFieldConfig(fields, 'name');\n const emailCfg = resolveFieldConfig(fields, 'email');\n const passwordCfg = resolveFieldConfig(fields, 'password');\n return (\n <>\n {nameCfg.show && (\n <AutoFormField\n control={control}\n name='name'\n label={nameCfg.label}\n inputProps={{ placeholder: nameCfg.placeholder }}\n />\n )}\n {emailCfg.show && (\n <AutoFormField\n control={control}\n name='email'\n label={emailCfg.label}\n inputProps={{ placeholder: emailCfg.placeholder }}\n />\n )}\n {passwordCfg.show && (\n <AutoFormField\n control={control}\n name='password'\n label={passwordCfg.label}\n type='password'\n inputProps={{ autoComplete: 'new-password', placeholder: passwordCfg.placeholder || undefined }}\n />\n )}\n </>\n );\n })()}\n\n {extraFields?.length ? (\n <div className='space-y-4'>\n {extraFields.map((field) => (\n <React.Fragment key={field.name}>\n {renderExtraField(field, control)}\n </React.Fragment>\n ))}\n </div>\n ) : null}\n\n <Button type='submit' className='w-full' disabled={isPending || isSubmitting}>\n {isPending ? m.auth_registering() : m.signUp()}\n </Button>\n\n {showLoginLink && onLoginClick && (\n <div className='text-center text-sm text-muted-foreground'>\n {m.auth_alreadyHaveAccount()}{' '}\n <Button type='button' variant='link' className='p-0 h-auto' onClick={onLoginClick}>\n {m.signIn()}\n </Button>\n </div>\n )}\n </Form.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMyC,IAAczC,EAAE,OAAO;CAC3B,OAAOA,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,SAASC,EAA+B,EAAE,CAAC;CACrE,UAAUD,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,EAClB,GAFKhB,EAAM,IAEX,CACjB;GACE,CAAA,IACH;GAEJ,kBAAClB,GAAD;IAAQ,MAAK;IAAS,WAAU;IAAS,UAAUrB,KAAasB;IAC7D,UAAAtB,IAAYhC,EAAmB,IAAIN,EAAS;GACvC,CAAA;GAEP+F,KAAiBC,KAChB,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACGzF,EAA0B;KAAG;KAC9B,kBAACoD,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAO,WAAU;MAAa,SAASqC;MAClE,UAAAlG,EAAS;KACJ,CAAA;IACL;;EAEE;;AAEf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthGuard.cjs","names":["useAuthGuard","_Fragment","require_runtime","require_tools_components_auth_useAuthGuard","react_jsx_runtime","react","AuthGuard","options","isLoading","fallback","isAuthenticated"],"sources":["../../../../src/tools/components/auth/AuthGuard.tsx"],"sourcesContent":["import React from 'react';\nimport { useAuthGuard, type AuthGuardOptions } from './useAuthGuard';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"AuthGuard.cjs","names":["useAuthGuard","_Fragment","require_runtime","require_tools_components_auth_useAuthGuard","react_jsx_runtime","react","AuthGuard","options","isLoading","fallback","isAuthenticated"],"sources":["../../../../src/tools/components/auth/AuthGuard.tsx"],"sourcesContent":["import React from 'react';\nimport { useAuthGuard, type AuthGuardOptions } from './useAuthGuard';\n\n/**\n * Children and loading fallback with useAuthGuard scheduling options.\n *\n * @see AuthGuard for rendering behavior.\n */\nexport interface AuthGuardProps extends AuthGuardOptions {\n /**\n * Content displayed while the current context contains a user.\n */\n children: React.ReactNode;\n /**\n * Content during loading; defaults to null.\n */\n fallback?: React.ReactNode;\n}\n\n/**\n * Renders authenticated children and delegates scheduled expiry checks to useAuthGuard.\n *\n * @param props - Children, loading fallback and inherited check/navigation settings.\n *\n * @returns Fallback while loading, children for a current user, otherwise null.\n *\n * @throws Error when no AuthProvider exists.\n *\n * @remarks Requires AuthProvider inside QueryClientProvider; no CSS is required. There is\n * no immediate mount-only redirect: focus, visibility, optional timer or manual checks\n * trigger expiry handling. Current user state can be optimistic; enforce backend access.\n *\n * @example\n * ```tsx\n * import type { ReactNode } from 'react';\n * import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n * import { AuthProvider, AuthGuard, type AuthAdapter } from '@alneas/appkit-react/tools/auth';\n *\n * function Content() { return <AuthGuard><span>Account</span></AuthGuard>; }\n * export function Example({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {\n * return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><Content /></AuthProvider></QueryClientProvider>;\n * }\n * ```\n */\nexport function AuthGuard({ children, fallback = null, ...options }: AuthGuardProps) {\n const { isAuthenticated, isLoading } = useAuthGuard(options);\n\n if (isLoading) {\n return <>{fallback}</>;\n }\n\n if (!isAuthenticated) {\n // リダイレクト処理は useAuthGuard 内で行われる\n return null;\n }\n\n return <>{children}</>;\n}\n"],"mappings":"A,kPA4CA,SAAgBM,EAAU,CAAE,WAAU,WAAW,KAAM,GAAGC,GAA2B,CACnF,GAAM,CAAE,kBAAiB,aAAcP,EAAAA,aAAaO,CAAO,EAW3D,OATIC,GACK,EAAAJ,EAAA,IAAA,CAAAH,EAAAA,SAAA,CAAA,SAAGQ,CAAW,CAAA,EAGlBC,GAKE,EAAAN,EAAA,IAAA,CAAAH,EAAAA,SAAA,CAAG,UAAW,CAAA,EAHZ,IAIX,C"}
|
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { AuthGuardOptions } from './useAuthGuard.cjs';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Children and loading fallback with useAuthGuard scheduling options.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* @see AuthGuard for rendering behavior.
|
|
7
7
|
*/
|
|
8
8
|
export interface AuthGuardProps extends AuthGuardOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Content displayed while the current context contains a user.
|
|
11
|
+
*/
|
|
9
12
|
children: React.ReactNode;
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Content during loading; defaults to null.
|
|
15
|
+
*/
|
|
11
16
|
fallback?: React.ReactNode;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
19
|
+
* Renders authenticated children and delegates scheduled expiry checks to useAuthGuard.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Children, loading fallback and inherited check/navigation settings.
|
|
22
|
+
*
|
|
23
|
+
* @returns Fallback while loading, children for a current user, otherwise null.
|
|
24
|
+
*
|
|
25
|
+
* @throws Error when no AuthProvider exists.
|
|
26
|
+
*
|
|
27
|
+
* @remarks Requires AuthProvider inside QueryClientProvider; no CSS is required. There is
|
|
28
|
+
* no immediate mount-only redirect: focus, visibility, optional timer or manual checks
|
|
29
|
+
* trigger expiry handling. Current user state can be optimistic; enforce backend access.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import type { ReactNode } from 'react';
|
|
34
|
+
* import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
35
|
+
* import { AuthProvider, AuthGuard, type AuthAdapter } from '@alneas/appkit-react/tools/auth';
|
|
36
|
+
*
|
|
37
|
+
* function Content() { return <AuthGuard><span>Account</span></AuthGuard>; }
|
|
38
|
+
* export function Example({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {
|
|
39
|
+
* return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><Content /></AuthProvider></QueryClientProvider>;
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
15
42
|
*/
|
|
16
43
|
export declare function AuthGuard({ children, fallback, ...options }: AuthGuardProps): React.JSX.Element | null;
|
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { AuthGuardOptions } from './useAuthGuard.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Children and loading fallback with useAuthGuard scheduling options.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* @see AuthGuard for rendering behavior.
|
|
7
7
|
*/
|
|
8
8
|
export interface AuthGuardProps extends AuthGuardOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Content displayed while the current context contains a user.
|
|
11
|
+
*/
|
|
9
12
|
children: React.ReactNode;
|
|
10
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Content during loading; defaults to null.
|
|
15
|
+
*/
|
|
11
16
|
fallback?: React.ReactNode;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
19
|
+
* Renders authenticated children and delegates scheduled expiry checks to useAuthGuard.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Children, loading fallback and inherited check/navigation settings.
|
|
22
|
+
*
|
|
23
|
+
* @returns Fallback while loading, children for a current user, otherwise null.
|
|
24
|
+
*
|
|
25
|
+
* @throws Error when no AuthProvider exists.
|
|
26
|
+
*
|
|
27
|
+
* @remarks Requires AuthProvider inside QueryClientProvider; no CSS is required. There is
|
|
28
|
+
* no immediate mount-only redirect: focus, visibility, optional timer or manual checks
|
|
29
|
+
* trigger expiry handling. Current user state can be optimistic; enforce backend access.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import type { ReactNode } from 'react';
|
|
34
|
+
* import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
35
|
+
* import { AuthProvider, AuthGuard, type AuthAdapter } from '@alneas/appkit-react/tools/auth';
|
|
36
|
+
*
|
|
37
|
+
* function Content() { return <AuthGuard><span>Account</span></AuthGuard>; }
|
|
38
|
+
* export function Example({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {
|
|
39
|
+
* return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><Content /></AuthProvider></QueryClientProvider>;
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
15
42
|
*/
|
|
16
43
|
export declare function AuthGuard({ children, fallback, ...options }: AuthGuardProps): React.JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthGuard.js","names":["_Fragment","AuthGuard","options","useAuthGuard","isLoading","Fragment","fallback","isAuthenticated"],"sources":["../../../../src/tools/components/auth/AuthGuard.tsx"],"sourcesContent":["import React from 'react';\nimport { useAuthGuard, type AuthGuardOptions } from './useAuthGuard';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"AuthGuard.js","names":["_Fragment","AuthGuard","options","useAuthGuard","isLoading","Fragment","fallback","isAuthenticated"],"sources":["../../../../src/tools/components/auth/AuthGuard.tsx"],"sourcesContent":["import React from 'react';\nimport { useAuthGuard, type AuthGuardOptions } from './useAuthGuard';\n\n/**\n * Children and loading fallback with useAuthGuard scheduling options.\n *\n * @see AuthGuard for rendering behavior.\n */\nexport interface AuthGuardProps extends AuthGuardOptions {\n /**\n * Content displayed while the current context contains a user.\n */\n children: React.ReactNode;\n /**\n * Content during loading; defaults to null.\n */\n fallback?: React.ReactNode;\n}\n\n/**\n * Renders authenticated children and delegates scheduled expiry checks to useAuthGuard.\n *\n * @param props - Children, loading fallback and inherited check/navigation settings.\n *\n * @returns Fallback while loading, children for a current user, otherwise null.\n *\n * @throws Error when no AuthProvider exists.\n *\n * @remarks Requires AuthProvider inside QueryClientProvider; no CSS is required. There is\n * no immediate mount-only redirect: focus, visibility, optional timer or manual checks\n * trigger expiry handling. Current user state can be optimistic; enforce backend access.\n *\n * @example\n * ```tsx\n * import type { ReactNode } from 'react';\n * import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\n * import { AuthProvider, AuthGuard, type AuthAdapter } from '@alneas/appkit-react/tools/auth';\n *\n * function Content() { return <AuthGuard><span>Account</span></AuthGuard>; }\n * export function Example({ adapter, queryClient }: { adapter: AuthAdapter; queryClient: QueryClient }) {\n * return <QueryClientProvider client={queryClient}><AuthProvider adapter={adapter}><Content /></AuthProvider></QueryClientProvider>;\n * }\n * ```\n */\nexport function AuthGuard({ children, fallback = null, ...options }: AuthGuardProps) {\n const { isAuthenticated, isLoading } = useAuthGuard(options);\n\n if (isLoading) {\n return <>{fallback}</>;\n }\n\n if (!isAuthenticated) {\n // リダイレクト処理は useAuthGuard 内で行われる\n return null;\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;AA4CA,SAAgBC,EAAU,EAAE,aAAU,cAAW,MAAM,GAAGC,KAA2B;CACnF,IAAM,EAAE,oBAAiB,iBAAcC,EAAaD,CAAO;CAW3D,OATIE,IACK,kBAAAJ,GAAA,EAAA,UAAGM,EAAW,CAAA,IAGlBC,IAKE,kBAAAP,GAAA,EAAG,YAAW,CAAA,IAHZ;AAIX"}
|