@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
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
import { Theme, ColorTheme, SpacingTheme, CustomThemeColors } from './theme-context.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Initial theme settings and browser storage keys; see ThemeProvider for usage.
|
|
4
|
+
* @see ThemeProvider for the canonical usage example.
|
|
5
|
+
*/
|
|
2
6
|
export type ThemeProviderProps = {
|
|
7
|
+
/** Descendants that consume theme state. */
|
|
3
8
|
children: React.ReactNode;
|
|
9
|
+
/** Initial mode when storage is empty; defaults to 'system'. */
|
|
4
10
|
defaultTheme?: Theme;
|
|
11
|
+
/** Initial palette when storage is empty; defaults to 'default'. */
|
|
5
12
|
defaultColorTheme?: ColorTheme;
|
|
13
|
+
/** Initial density when storage is empty; defaults to 'normal'. */
|
|
6
14
|
defaultSpacingTheme?: SpacingTheme;
|
|
15
|
+
/** Initial custom CSS variable values; subsequent prop changes do not replace state. */
|
|
7
16
|
customColors?: CustomThemeColors;
|
|
17
|
+
/** Mode localStorage key; defaults to 'vite-ui-theme'. */
|
|
8
18
|
storageKey?: string;
|
|
19
|
+
/** Palette localStorage key; defaults to 'vite-ui-color-theme'. */
|
|
9
20
|
colorThemeStorageKey?: string;
|
|
21
|
+
/** Density localStorage key; defaults to 'vite-ui-spacing-theme'. */
|
|
10
22
|
spacingThemeStorageKey?: string;
|
|
11
23
|
};
|
|
12
24
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* ダークモード、カラーテーマ、スペーシングテーマを管理。
|
|
16
|
-
* アプリケーションのルートで使用。
|
|
25
|
+
* Provides browser theme state and applies mode, palette and density to documentElement.
|
|
17
26
|
*
|
|
18
|
-
* @
|
|
19
|
-
* ```tsx
|
|
20
|
-
* import { ThemeProvider } from "../../index.cjs";
|
|
27
|
+
* @param props - Children, initial settings, custom CSS variables and storage keys.
|
|
21
28
|
*
|
|
22
|
-
*
|
|
23
|
-
* <App />
|
|
24
|
-
* </ThemeProvider>
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function ThemeProvider({ children, defaultTheme, defaultColorTheme, defaultSpacingTheme, customColors: initialCustomColors, storageKey, colorThemeStorageKey, spacingThemeStorageKey, ...props }: ThemeProviderProps): import('react').JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* テーマコンテキストを取得するフック
|
|
29
|
+
* @returns Theme context for descendants.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* 取得と変更が可能。
|
|
31
|
+
* @throws Browser localStorage access failures during initialization or setter calls propagate.
|
|
33
32
|
*
|
|
34
|
-
* @
|
|
33
|
+
* @remarks Import @alneas/appkit-react/styles in the host for Appkit theme styling.
|
|
34
|
+
* No query/auth provider is required. Stored values override defaults on the client;
|
|
35
|
+
* server rendering uses defaults, so stored preferences can differ at hydration.
|
|
36
|
+
* Effects update root classes and custom CSS variables after mount. System mode listens
|
|
37
|
+
* for media-query changes and removes that listener on cleanup. Custom CSS variables
|
|
38
|
+
* are removed on cleanup; root theme classes remain. Mode/palette/density setters persist
|
|
39
|
+
* to localStorage; custom colors are in-memory state. Coordinate multiple providers
|
|
40
|
+
* because they write the same document root. Stored values are cast without validation.
|
|
35
41
|
*
|
|
36
42
|
* @example
|
|
37
43
|
* ```tsx
|
|
38
|
-
*
|
|
44
|
+
* import type { ReactNode } from 'react';
|
|
45
|
+
* import '@alneas/appkit-react/styles';
|
|
46
|
+
* import { ThemeProvider } from '@alneas/appkit-react/ui/theme';
|
|
47
|
+
* export function ThemeRoot({ children }: { children: ReactNode }) {
|
|
48
|
+
* return <ThemeProvider defaultTheme="system" defaultColorTheme="blue">{children}</ThemeProvider>;
|
|
49
|
+
* }
|
|
39
50
|
* ```
|
|
40
51
|
*/
|
|
52
|
+
export declare function ThemeProvider({ children, defaultTheme, defaultColorTheme, defaultSpacingTheme, customColors: initialCustomColors, storageKey, colorThemeStorageKey, spacingThemeStorageKey, ...props }: ThemeProviderProps): import('react').JSX.Element;
|
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
import { Theme, ColorTheme, SpacingTheme, CustomThemeColors } from './theme-context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Initial theme settings and browser storage keys; see ThemeProvider for usage.
|
|
4
|
+
* @see ThemeProvider for the canonical usage example.
|
|
5
|
+
*/
|
|
2
6
|
export type ThemeProviderProps = {
|
|
7
|
+
/** Descendants that consume theme state. */
|
|
3
8
|
children: React.ReactNode;
|
|
9
|
+
/** Initial mode when storage is empty; defaults to 'system'. */
|
|
4
10
|
defaultTheme?: Theme;
|
|
11
|
+
/** Initial palette when storage is empty; defaults to 'default'. */
|
|
5
12
|
defaultColorTheme?: ColorTheme;
|
|
13
|
+
/** Initial density when storage is empty; defaults to 'normal'. */
|
|
6
14
|
defaultSpacingTheme?: SpacingTheme;
|
|
15
|
+
/** Initial custom CSS variable values; subsequent prop changes do not replace state. */
|
|
7
16
|
customColors?: CustomThemeColors;
|
|
17
|
+
/** Mode localStorage key; defaults to 'vite-ui-theme'. */
|
|
8
18
|
storageKey?: string;
|
|
19
|
+
/** Palette localStorage key; defaults to 'vite-ui-color-theme'. */
|
|
9
20
|
colorThemeStorageKey?: string;
|
|
21
|
+
/** Density localStorage key; defaults to 'vite-ui-spacing-theme'. */
|
|
10
22
|
spacingThemeStorageKey?: string;
|
|
11
23
|
};
|
|
12
24
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* ダークモード、カラーテーマ、スペーシングテーマを管理。
|
|
16
|
-
* アプリケーションのルートで使用。
|
|
25
|
+
* Provides browser theme state and applies mode, palette and density to documentElement.
|
|
17
26
|
*
|
|
18
|
-
* @
|
|
19
|
-
* ```tsx
|
|
20
|
-
* import { ThemeProvider } from "../../index.js";
|
|
27
|
+
* @param props - Children, initial settings, custom CSS variables and storage keys.
|
|
21
28
|
*
|
|
22
|
-
*
|
|
23
|
-
* <App />
|
|
24
|
-
* </ThemeProvider>
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function ThemeProvider({ children, defaultTheme, defaultColorTheme, defaultSpacingTheme, customColors: initialCustomColors, storageKey, colorThemeStorageKey, spacingThemeStorageKey, ...props }: ThemeProviderProps): import('react').JSX.Element;
|
|
28
|
-
/**
|
|
29
|
-
* テーマコンテキストを取得するフック
|
|
29
|
+
* @returns Theme context for descendants.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* 取得と変更が可能。
|
|
31
|
+
* @throws Browser localStorage access failures during initialization or setter calls propagate.
|
|
33
32
|
*
|
|
34
|
-
* @
|
|
33
|
+
* @remarks Import @alneas/appkit-react/styles in the host for Appkit theme styling.
|
|
34
|
+
* No query/auth provider is required. Stored values override defaults on the client;
|
|
35
|
+
* server rendering uses defaults, so stored preferences can differ at hydration.
|
|
36
|
+
* Effects update root classes and custom CSS variables after mount. System mode listens
|
|
37
|
+
* for media-query changes and removes that listener on cleanup. Custom CSS variables
|
|
38
|
+
* are removed on cleanup; root theme classes remain. Mode/palette/density setters persist
|
|
39
|
+
* to localStorage; custom colors are in-memory state. Coordinate multiple providers
|
|
40
|
+
* because they write the same document root. Stored values are cast without validation.
|
|
35
41
|
*
|
|
36
42
|
* @example
|
|
37
43
|
* ```tsx
|
|
38
|
-
*
|
|
44
|
+
* import type { ReactNode } from 'react';
|
|
45
|
+
* import '@alneas/appkit-react/styles';
|
|
46
|
+
* import { ThemeProvider } from '@alneas/appkit-react/ui/theme';
|
|
47
|
+
* export function ThemeRoot({ children }: { children: ReactNode }) {
|
|
48
|
+
* return <ThemeProvider defaultTheme="system" defaultColorTheme="blue">{children}</ThemeProvider>;
|
|
49
|
+
* }
|
|
39
50
|
* ```
|
|
40
51
|
*/
|
|
52
|
+
export declare function ThemeProvider({ children, defaultTheme, defaultColorTheme, defaultSpacingTheme, customColors: initialCustomColors, storageKey, colorThemeStorageKey, spacingThemeStorageKey, ...props }: ThemeProviderProps): import('react').JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.js","names":["ThemeProvider","initialCustomColors","props","theme","setTheme","useState","defaultTheme","storageKey","colorTheme","setColorTheme","defaultColorTheme","colorThemeStorageKey","spacingTheme","setSpacingTheme","defaultSpacingTheme","spacingThemeStorageKey","resolvedTheme","setResolvedTheme","customColors","setCustomColors","useEffect","root","applyTheme","systemTheme","mediaQuery","handleChange","key","value","ThemeProviderContext"],"sources":["../../../../src/ui/components/theme/theme-provider.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport {\n type Theme,\n type ColorTheme,\n type SpacingTheme,\n type CustomThemeColors,\n ThemeProviderContext,\n} from './theme-context';\n\nexport type ThemeProviderProps = {\n children: React.ReactNode;\n defaultTheme?: Theme;\n defaultColorTheme?: ColorTheme;\n defaultSpacingTheme?: SpacingTheme;\n customColors?: CustomThemeColors;\n storageKey?: string;\n colorThemeStorageKey?: string;\n spacingThemeStorageKey?: string;\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"theme-provider.js","names":["ThemeProvider","initialCustomColors","props","theme","setTheme","useState","defaultTheme","storageKey","colorTheme","setColorTheme","defaultColorTheme","colorThemeStorageKey","spacingTheme","setSpacingTheme","defaultSpacingTheme","spacingThemeStorageKey","resolvedTheme","setResolvedTheme","customColors","setCustomColors","useEffect","root","applyTheme","systemTheme","mediaQuery","handleChange","key","value","ThemeProviderContext"],"sources":["../../../../src/ui/components/theme/theme-provider.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport {\n type Theme,\n type ColorTheme,\n type SpacingTheme,\n type CustomThemeColors,\n ThemeProviderContext,\n} from './theme-context';\n\n/**\n * Initial theme settings and browser storage keys; see ThemeProvider for usage.\n * @see ThemeProvider for the canonical usage example.\n */\nexport type ThemeProviderProps = {\n /** Descendants that consume theme state. */\n children: React.ReactNode;\n /** Initial mode when storage is empty; defaults to 'system'. */\n defaultTheme?: Theme;\n /** Initial palette when storage is empty; defaults to 'default'. */\n defaultColorTheme?: ColorTheme;\n /** Initial density when storage is empty; defaults to 'normal'. */\n defaultSpacingTheme?: SpacingTheme;\n /** Initial custom CSS variable values; subsequent prop changes do not replace state. */\n customColors?: CustomThemeColors;\n /** Mode localStorage key; defaults to 'vite-ui-theme'. */\n storageKey?: string;\n /** Palette localStorage key; defaults to 'vite-ui-color-theme'. */\n colorThemeStorageKey?: string;\n /** Density localStorage key; defaults to 'vite-ui-spacing-theme'. */\n spacingThemeStorageKey?: string;\n};\n\n/**\n * Provides browser theme state and applies mode, palette and density to documentElement.\n *\n * @param props - Children, initial settings, custom CSS variables and storage keys.\n *\n * @returns Theme context for descendants.\n *\n * @throws Browser localStorage access failures during initialization or setter calls propagate.\n *\n * @remarks Import @alneas/appkit-react/styles in the host for Appkit theme styling.\n * No query/auth provider is required. Stored values override defaults on the client;\n * server rendering uses defaults, so stored preferences can differ at hydration.\n * Effects update root classes and custom CSS variables after mount. System mode listens\n * for media-query changes and removes that listener on cleanup. Custom CSS variables\n * are removed on cleanup; root theme classes remain. Mode/palette/density setters persist\n * to localStorage; custom colors are in-memory state. Coordinate multiple providers\n * because they write the same document root. Stored values are cast without validation.\n *\n * @example\n * ```tsx\n * import type { ReactNode } from 'react';\n * import '@alneas/appkit-react/styles';\n * import { ThemeProvider } from '@alneas/appkit-react/ui/theme';\n * export function ThemeRoot({ children }: { children: ReactNode }) {\n * return <ThemeProvider defaultTheme=\"system\" defaultColorTheme=\"blue\">{children}</ThemeProvider>;\n * }\n * ```\n */\nexport function ThemeProvider({\n children,\n defaultTheme = 'system',\n defaultColorTheme = 'default',\n defaultSpacingTheme = 'normal',\n customColors: initialCustomColors,\n storageKey = 'vite-ui-theme',\n colorThemeStorageKey = 'vite-ui-color-theme',\n spacingThemeStorageKey = 'vite-ui-spacing-theme',\n ...props\n}: ThemeProviderProps) {\n // Initialize with defaults to avoid SSR ReferenceError and Hydration Mismatch\n const [theme, setTheme] = useState<Theme>(() => {\n if (typeof window === 'undefined') return defaultTheme;\n return (localStorage.getItem(storageKey) as Theme) || defaultTheme;\n });\n const [colorTheme, setColorTheme] = useState<ColorTheme>(() => {\n if (typeof window === 'undefined') return defaultColorTheme;\n return (localStorage.getItem(colorThemeStorageKey) as ColorTheme) || defaultColorTheme;\n });\n const [spacingTheme, setSpacingTheme] = useState<SpacingTheme>(() => {\n if (typeof window === 'undefined') return defaultSpacingTheme;\n return (localStorage.getItem(spacingThemeStorageKey) as SpacingTheme) || defaultSpacingTheme;\n });\n\n const [resolvedTheme, setResolvedTheme] = useState<'light' | 'dark'>('light');\n\n const [customColors, setCustomColors] = useState<CustomThemeColors | undefined>(\n initialCustomColors,\n );\n\n useEffect(() => {\n const root = window.document.documentElement;\n\n const applyTheme = (t: Theme) => {\n root.classList.remove('light', 'dark');\n\n if (t === 'system') {\n const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches\n ? 'dark'\n : 'light';\n\n root.classList.add(systemTheme);\n setResolvedTheme(systemTheme);\n return;\n }\n\n root.classList.add(t);\n setResolvedTheme(t as 'light' | 'dark');\n };\n\n applyTheme(theme);\n\n // Listen for system changes if set to system\n if (theme === 'system') {\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n const handleChange = () => applyTheme('system');\n\n mediaQuery.addEventListener('change', handleChange);\n return () => mediaQuery.removeEventListener('change', handleChange);\n }\n }, [theme]);\n\n useEffect(() => {\n const root = window.document.documentElement;\n\n // 既存のカラーテーマクラスを削除\n root.classList.remove('theme-blue', 'theme-green', 'theme-rose', 'theme-orange', 'theme-future');\n\n // デフォルト以外の場合はクラスを追加\n if (colorTheme !== 'default') {\n root.classList.add(`theme-${colorTheme}`);\n }\n }, [colorTheme]);\n\n // スペーシングテーマを適用\n useEffect(() => {\n const root = window.document.documentElement;\n\n // 既存のスペーシングクラスを削除\n root.classList.remove('spacing-compact', 'spacing-normal', 'spacing-comfortable');\n\n // スペーシングテーマクラスを追加\n root.classList.add(`spacing-${spacingTheme}`);\n }, [spacingTheme]);\n\n // カスタムカラーをCSS変数として適用\n useEffect(() => {\n const root = window.document.documentElement;\n\n if (customColors) {\n // CSS変数を設定\n Object.entries(customColors).forEach(([key, value]) => {\n if (value) {\n root.style.setProperty(`--${key}`, value);\n }\n });\n }\n\n // クリーンアップ: カスタムカラーが削除された場合は元に戻す\n return () => {\n if (customColors) {\n Object.keys(customColors).forEach((key) => {\n root.style.removeProperty(`--${key}`);\n });\n }\n };\n }, [customColors]);\n\n const value = {\n theme,\n resolvedTheme,\n setTheme: (theme: Theme) => {\n localStorage.setItem(storageKey, theme);\n setTheme(theme);\n },\n colorTheme,\n setColorTheme: (colorTheme: ColorTheme) => {\n localStorage.setItem(colorThemeStorageKey, colorTheme);\n setColorTheme(colorTheme);\n },\n spacingTheme,\n setSpacingTheme: (spacingTheme: SpacingTheme) => {\n localStorage.setItem(spacingThemeStorageKey, spacingTheme);\n setSpacingTheme(spacingTheme);\n },\n customColors,\n setCustomColors,\n };\n\n return (\n <ThemeProviderContext.Provider {...props} value={value}>\n {children}\n </ThemeProviderContext.Provider>\n );\n}\n"],"mappings":";;;;;AA4DA,SAAgBA,EAAc,EAC5B,aACA,kBAAe,UACf,uBAAoB,WACpB,yBAAsB,UACtB,cAAcC,GACd,gBAAa,iBACb,0BAAuB,uBACvB,4BAAyB,yBACzB,GAAGC,KACkB;CAErB,IAAM,CAACC,GAAOC,KAAYC,QACpB,OAAO,SAAW,MAAoBC,IAClC,aAAa,QAAQC,CAAU,KAAeD,CACvD,GACK,CAACE,GAAYC,KAAiBJ,QAC9B,OAAO,SAAW,MAAoBK,IAClC,aAAa,QAAQC,CAAoB,KAAoBD,CACtE,GACK,CAACE,GAAcC,KAAmBR,QAClC,OAAO,SAAW,MAAoBS,IAClC,aAAa,QAAQC,CAAsB,KAAsBD,CAC1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KACF,OAAO,KAAKA,CAAY,CAAC,CAAC,SAAS,MAAQ;IACzC,EAAK,MAAM,eAAe,KAAKQ,GAAK;GACtC,CAAC;EAEL;CACF,GAAG,CAACR,CAAY,CAAC;CAEjB,IAAMS,IAAQ;EACZ;EACA;EACA,WAAW,MAAiB;GAE1B,AADA,aAAa,QAAQpB,GAAYJ,CAAK,GACtCC,EAASD,CAAK;EAChB;EACA;EACA,gBAAgB,MAA2B;GAEzC,AADA,aAAa,QAAQQ,GAAsBH,CAAU,GACrDC,EAAcD,CAAU;EAC1B;EACA;EACA,kBAAkB,MAA+B;GAE/C,AADA,aAAa,QAAQO,GAAwBH,CAAY,GACzDC,EAAgBD,CAAY;EAC9B;EACA;EACA;CACF;CAEA,OACE,kBAACgB,EAAqB,UAAtB;EAA+B,GAAI1B;EAAc;EAC9C;CAC4B,CAAA;AAEnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-script.cjs","names":["react_jsx_runtime","ThemeScript"],"sources":["../../../../src/ui/components/theme/theme-script.tsx"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"theme-script.cjs","names":["react_jsx_runtime","ThemeScript"],"sources":["../../../../src/ui/components/theme/theme-script.tsx"],"sourcesContent":["/**\n * Emits an inline script that applies stored theme classes before client rendering.\n *\n * @returns Script element whose contents read localStorage and prefers-color-scheme.\n *\n * @remarks Uses only the fixed default vite-ui-theme, vite-ui-color-theme and\n * vite-ui-spacing-theme keys, even if ThemeProvider uses custom keys. It adds root\n * classes without first removing existing classes; failures are swallowed. It does not\n * apply custom colors. Place early in server HTML and allow this script under the host\n * CSP; no nonce prop is accepted. Import Appkit styles in the host.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { ThemeScript } from '@alneas/appkit-react/ui/theme';\n * export function DocumentHead() { return <head><ThemeScript /></head>; }\n * ```\n */\nexport function ThemeScript() {\n const script = `\n (function() {\n try {\n var storageKey = \"vite-ui-theme\";\n var colorKey = \"vite-ui-color-theme\";\n var spacingKey = \"vite-ui-spacing-theme\";\n \n var theme = localStorage.getItem(storageKey);\n var colorTheme = localStorage.getItem(colorKey);\n var spacingTheme = localStorage.getItem(spacingKey);\n \n var supportDarkMode = window.matchMedia(\"(prefers-color-scheme: dark)\").matches === true;\n \n if (!theme || theme === \"system\") {\n if (supportDarkMode) {\n document.documentElement.classList.add(\"dark\");\n } else {\n document.documentElement.classList.add(\"light\");\n }\n } else {\n document.documentElement.classList.add(theme);\n }\n \n if (colorTheme && colorTheme !== \"default\") {\n document.documentElement.classList.add(\"theme-\" + colorTheme);\n }\n \n if (spacingTheme) {\n document.documentElement.classList.add(\"spacing-\" + spacingTheme);\n } else {\n document.documentElement.classList.add(\"spacing-normal\");\n }\n } catch (e) {}\n })();\n `;\n\n return (\n <script\n dangerouslySetInnerHTML={{\n __html: script,\n }}\n />\n );\n}\n"],"mappings":"A,mHAkBA,SAAgBC,GAAc,CAqC5B,OACE,EAAAD,EAAA,IAAA,CAAC,SAAD,CACE,wBAAyB,CACvB,OAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACV,CACD,CAAA,CAEL,C"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Emits an inline script that applies stored theme classes before client rendering.
|
|
3
|
+
*
|
|
4
|
+
* @returns Script element whose contents read localStorage and prefers-color-scheme.
|
|
5
|
+
*
|
|
6
|
+
* @remarks Uses only the fixed default vite-ui-theme, vite-ui-color-theme and
|
|
7
|
+
* vite-ui-spacing-theme keys, even if ThemeProvider uses custom keys. It adds root
|
|
8
|
+
* classes without first removing existing classes; failures are swallowed. It does not
|
|
9
|
+
* apply custom colors. Place early in server HTML and allow this script under the host
|
|
10
|
+
* CSP; no nonce prop is accepted. Import Appkit styles in the host.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import '@alneas/appkit-react/styles';
|
|
15
|
+
* import { ThemeScript } from '@alneas/appkit-react/ui/theme';
|
|
16
|
+
* export function DocumentHead() { return <head><ThemeScript /></head>; }
|
|
17
|
+
* ```
|
|
3
18
|
*/
|
|
4
19
|
export declare function ThemeScript(): import('react').JSX.Element;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Emits an inline script that applies stored theme classes before client rendering.
|
|
3
|
+
*
|
|
4
|
+
* @returns Script element whose contents read localStorage and prefers-color-scheme.
|
|
5
|
+
*
|
|
6
|
+
* @remarks Uses only the fixed default vite-ui-theme, vite-ui-color-theme and
|
|
7
|
+
* vite-ui-spacing-theme keys, even if ThemeProvider uses custom keys. It adds root
|
|
8
|
+
* classes without first removing existing classes; failures are swallowed. It does not
|
|
9
|
+
* apply custom colors. Place early in server HTML and allow this script under the host
|
|
10
|
+
* CSP; no nonce prop is accepted. Import Appkit styles in the host.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import '@alneas/appkit-react/styles';
|
|
15
|
+
* import { ThemeScript } from '@alneas/appkit-react/ui/theme';
|
|
16
|
+
* export function DocumentHead() { return <head><ThemeScript /></head>; }
|
|
17
|
+
* ```
|
|
3
18
|
*/
|
|
4
19
|
export declare function ThemeScript(): import('react').JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-script.js","names":["ThemeScript"],"sources":["../../../../src/ui/components/theme/theme-script.tsx"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"theme-script.js","names":["ThemeScript"],"sources":["../../../../src/ui/components/theme/theme-script.tsx"],"sourcesContent":["/**\n * Emits an inline script that applies stored theme classes before client rendering.\n *\n * @returns Script element whose contents read localStorage and prefers-color-scheme.\n *\n * @remarks Uses only the fixed default vite-ui-theme, vite-ui-color-theme and\n * vite-ui-spacing-theme keys, even if ThemeProvider uses custom keys. It adds root\n * classes without first removing existing classes; failures are swallowed. It does not\n * apply custom colors. Place early in server HTML and allow this script under the host\n * CSP; no nonce prop is accepted. Import Appkit styles in the host.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { ThemeScript } from '@alneas/appkit-react/ui/theme';\n * export function DocumentHead() { return <head><ThemeScript /></head>; }\n * ```\n */\nexport function ThemeScript() {\n const script = `\n (function() {\n try {\n var storageKey = \"vite-ui-theme\";\n var colorKey = \"vite-ui-color-theme\";\n var spacingKey = \"vite-ui-spacing-theme\";\n \n var theme = localStorage.getItem(storageKey);\n var colorTheme = localStorage.getItem(colorKey);\n var spacingTheme = localStorage.getItem(spacingKey);\n \n var supportDarkMode = window.matchMedia(\"(prefers-color-scheme: dark)\").matches === true;\n \n if (!theme || theme === \"system\") {\n if (supportDarkMode) {\n document.documentElement.classList.add(\"dark\");\n } else {\n document.documentElement.classList.add(\"light\");\n }\n } else {\n document.documentElement.classList.add(theme);\n }\n \n if (colorTheme && colorTheme !== \"default\") {\n document.documentElement.classList.add(\"theme-\" + colorTheme);\n }\n \n if (spacingTheme) {\n document.documentElement.classList.add(\"spacing-\" + spacingTheme);\n } else {\n document.documentElement.classList.add(\"spacing-normal\");\n }\n } catch (e) {}\n })();\n `;\n\n return (\n <script\n dangerouslySetInnerHTML={{\n __html: script,\n }}\n />\n );\n}\n"],"mappings":";;;AAkBA,SAAgBA,IAAc;CAqC5B,OACE,kBAAC,UAAD,EACE,yBAAyB,EACvB,QAAQ,8sCACV,EACD,CAAA;AAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../lib/utils.cjs"),t=require("../ui/button-components.cjs"),n=require("./theme-context.cjs"),r=require("../../lib/hooks/use-is-client.cjs");let i=require("react/jsx-runtime"),a=require("lucide-react");function o({className:o,variant:s=`select`,withBackground:c=!1}){let{theme:l,setTheme:u,resolvedTheme:d}=n.useTheme(),f=r.useIsClient(),p=[{value:`light`,label:`Light`,icon:a.Sun},{value:`dark`,label:`Dark`,icon:a.Moon},{value:`system`,label:`System`,icon:a.Monitor}],m=()=>{let e=(p.findIndex(e=>e.value===l)+1)%p.length;u(p[e].value)},h=c?`text-foreground`:``;if(s===`toggle`||s===`cycle`){let n=f?d===`dark`:!1;return(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:e.cn(o,c&&`bg-background/80 hover:bg-background`),onClick:m,title:f?`Current theme: ${l} (${d})`:`Toggle theme`,children:[(0,i.jsxs)(`div`,{className:`relative h-5 w-5 flex items-center justify-center`,children:[(0,i.jsx)(a.Sun,{className:e.cn(`h-5 w-5 transition-all`,h,n?`rotate-90 scale-0 opacity-0`:`rotate-0 scale-100 opacity-100`)}),(0,i.jsx)(a.Moon,{className:e.cn(`absolute h-5 w-5 transition-all`,h,n?`rotate-0 scale-100 opacity-100`:`-rotate-90 scale-0 opacity-0`)})]}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Toggle theme`})]})}if(s===`icon-group`){let n=f?l:`system`;return(0,i.jsx)(`div`,{className:e.cn(`flex items-center gap-1 border rounded-md p-1`,c?`bg-background`:`bg-transparent border-0`,o),children:p.map(e=>(0,i.jsxs)(t.Button,{variant:n===e.value?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(e.value),title:e.label,children:[(0,i.jsx)(e.icon,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`sr-only`,children:e.label})]},e.value))})}let g=f?l:`system`;return(0,i.jsxs)(`select`,{className:e.cn(`h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,o),value:g,onChange:e=>u(e.target.value),children:[(0,i.jsx)(`option`,{value:`light`,children:`Light`}),(0,i.jsx)(`option`,{value:`dark`,children:`Dark`}),(0,i.jsx)(`option`,{value:`system`,children:`System`})]})}function s({className:o,variant:s=`select`,withBackground:c=!1}){let{colorTheme:l,setColorTheme:u}=n.useTheme(),d=r.useIsClient(),f=[{value:`default`,label:`Default`,color:`bg-zinc-600`},{value:`blue`,label:`Blue`,color:`bg-blue-500`},{value:`green`,label:`Green`,color:`bg-green-500`},{value:`rose`,label:`Rose`,color:`bg-rose-500`},{value:`orange`,label:`Orange`,color:`bg-orange-500`}],p=d?l:`default`,m=()=>{let e=(f.findIndex(e=>e.value===l)+1)%f.length;u(f[e].value)},h=f.find(e=>e.value===p)||f[0];return s===`toggle`||s===`cycle`?c?(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:e.cn(`ring-2 ring-inset ring-white/80 hover:ring-white`,h.color,`hover:opacity-90`,o),onClick:m,title:`Color: ${h.label} (Click to cycle)`,"aria-label":`Current color: ${h.label}. Click to cycle.`,children:[(0,i.jsx)(a.Palette,{className:`h-5 w-5 text-white`}),(0,i.jsx)(`span`,{className:`sr-only`,children:h.label})]}):(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:o,onClick:m,title:`Color: ${h.label} (Click to cycle)`,"aria-label":`Current color: ${h.label}. Click to cycle.`,children:[(0,i.jsx)(a.Palette,{className:e.cn(`h-5 w-5`,h.color.replace(`bg-`,`text-`))}),(0,i.jsx)(`span`,{className:`sr-only`,children:h.label})]}):s===`icon-group`?(0,i.jsx)(`div`,{className:e.cn(`flex items-center gap-2 flex-wrap`,c?`bg-background p-1 rounded-md border`:``,o),children:f.map(t=>(0,i.jsx)(`button`,{className:e.cn(`h-6 w-6 rounded-full border border-input ring-offset-background hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,t.color,p===t.value&&`ring-2 ring-ring ring-offset-2`),onClick:()=>u(t.value),title:t.label,"aria-label":t.label,children:p===t.value&&(0,i.jsx)(a.Check,{className:`h-3 w-3 text-white mx-auto`,strokeWidth:3})},t.value))}):(0,i.jsx)(`select`,{className:o,value:p,onChange:e=>u(e.target.value),children:f.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function c({className:o,variant:s=`select`,withBackground:c=!1}){let{spacingTheme:l,setSpacingTheme:u}=n.useTheme(),d=r.useIsClient()?l:`normal`,f=[{value:`compact`,label:`Compact`,icon:a.Rows4},{value:`normal`,label:`Normal`,icon:a.Rows3},{value:`comfortable`,label:`Comfortable`,icon:a.Rows2}],p=()=>{let e=(f.findIndex(e=>e.value===l)+1)%f.length;u(f[e].value)},m=c?`text-foreground`:``;if(s===`toggle`||s===`cycle`){let n=f.find(e=>e.value===d)||f[1],r=n.icon;return(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:e.cn(o,c&&`bg-background/80 hover:bg-background`),onClick:p,title:`Spacing: ${n.label} (Click to cycle)`,"aria-label":`Current spacing: ${n.label}. Click to cycle.`,children:[(0,i.jsx)(r,{className:e.cn(`h-5 w-5`,m)}),(0,i.jsx)(`span`,{className:`sr-only`,children:n.label})]})}return s===`icon-group`?(0,i.jsx)(`div`,{className:e.cn(`flex items-center gap-1 border rounded-md p-1`,c?`bg-background`:`bg-transparent border-0`,o),children:f.map(e=>(0,i.jsxs)(t.Button,{variant:d===e.value?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(e.value),title:e.label,children:[(0,i.jsx)(e.icon,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`sr-only`,children:e.label})]},e.value))}):(0,i.jsxs)(`select`,{className:o,value:d,onChange:e=>u(e.target.value),children:[(0,i.jsx)(`option`,{value:`compact`,children:`Compact`}),(0,i.jsx)(`option`,{value:`normal`,children:`Normal`}),(0,i.jsx)(`option`,{value:`comfortable`,children:`Comfortable`})]})}function l({className:t,selectClassName:n=`h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,showThemeMode:r=!0,showColorTheme:a=!0,showSpacingTheme:l=!0,modeVariant:u=`select`,colorVariant:d=`select`,spacingVariant:f=`select`}){return(0,i.jsxs)(`div`,{className:e.cn(t,`flex flex-col gap-3`),children:[r&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Mode`}),(0,i.jsx)(o,{className:u===`select`?n:void 0,variant:u})]}),a&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Color`}),(0,i.jsx)(s,{className:d===`select`?n:void 0,variant:d})]}),l&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Density`}),(0,i.jsx)(c,{className:f===`select`?n:void 0,variant:f})]})]})}exports.ColorThemeSwitcher=s,exports.SpacingThemeSwitcher=c,exports.ThemeModeSwitcher=o,exports.ThemeSwitcherGroup=l;
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../lib/utils.cjs"),t=require("../ui/button-components.cjs"),n=require("./theme-context.cjs"),r=require("../../lib/hooks/use-is-client.cjs");let i=require("react/jsx-runtime"),a=require("lucide-react");function o({className:o,variant:s=`select`,withBackground:c=!1}){let{theme:l,setTheme:u,resolvedTheme:d}=n.useTheme(),f=r.useIsClient(),p=[{value:`light`,label:`Light`,icon:a.Sun},{value:`dark`,label:`Dark`,icon:a.Moon},{value:`system`,label:`System`,icon:a.Monitor}],m=()=>{let e=(p.findIndex(e=>e.value===l)+1)%p.length;u(p[e].value)},h=c?`text-foreground`:``;if(s===`toggle`||s===`cycle`){let n=f?d===`dark`:!1;return(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:e.cn(o,c&&`bg-background/80 hover:bg-background`),onClick:m,title:f?`Current theme: ${l} (${d})`:`Toggle theme`,children:[(0,i.jsxs)(`div`,{className:`relative h-5 w-5 flex items-center justify-center`,children:[(0,i.jsx)(a.Sun,{className:e.cn(`h-5 w-5 transition-all`,h,n?`rotate-90 scale-0 opacity-0`:`rotate-0 scale-100 opacity-100`)}),(0,i.jsx)(a.Moon,{className:e.cn(`absolute h-5 w-5 transition-all`,h,n?`rotate-0 scale-100 opacity-100`:`-rotate-90 scale-0 opacity-0`)})]}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Toggle theme`})]})}if(s===`icon-group`){let n=f?l:`system`;return(0,i.jsx)(`div`,{className:e.cn(`flex items-center gap-1 border rounded-md p-1`,c?`bg-background`:`bg-transparent border-0`,o),children:p.map(e=>(0,i.jsxs)(t.Button,{variant:n===e.value?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(e.value),title:e.label,children:[(0,i.jsx)(e.icon,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`sr-only`,children:e.label})]},e.value))})}let g=f?l:`system`;return(0,i.jsxs)(`select`,{"aria-label":`Mode`,className:e.cn(`h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,o),value:g,onChange:e=>u(e.target.value),children:[(0,i.jsx)(`option`,{value:`light`,children:`Light`}),(0,i.jsx)(`option`,{value:`dark`,children:`Dark`}),(0,i.jsx)(`option`,{value:`system`,children:`System`})]})}function s({className:o,variant:s=`select`,withBackground:c=!1}){let{colorTheme:l,setColorTheme:u}=n.useTheme(),d=r.useIsClient(),f=[{value:`default`,label:`Default`,color:`bg-zinc-600`},{value:`blue`,label:`Blue`,color:`bg-blue-500`},{value:`green`,label:`Green`,color:`bg-green-500`},{value:`rose`,label:`Rose`,color:`bg-rose-500`},{value:`orange`,label:`Orange`,color:`bg-orange-500`},{value:`future`,label:`Future`,color:`bg-cyan-500`}],p=d?l:`default`,m=()=>{let e=(f.findIndex(e=>e.value===l)+1)%f.length;u(f[e].value)},h=f.find(e=>e.value===p)||f[0];return s===`toggle`||s===`cycle`?c?(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:e.cn(`ring-2 ring-inset ring-white/80 hover:ring-white`,h.color,`hover:opacity-90`,o),onClick:m,title:`Color: ${h.label} (Click to cycle)`,"aria-label":`Current color: ${h.label}. Click to cycle.`,children:[(0,i.jsx)(a.Palette,{className:`h-5 w-5 text-white`}),(0,i.jsx)(`span`,{className:`sr-only`,children:h.label})]}):(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:o,onClick:m,title:`Color: ${h.label} (Click to cycle)`,"aria-label":`Current color: ${h.label}. Click to cycle.`,children:[(0,i.jsx)(a.Palette,{className:e.cn(`h-5 w-5`,h.color.replace(`bg-`,`text-`))}),(0,i.jsx)(`span`,{className:`sr-only`,children:h.label})]}):s===`icon-group`?(0,i.jsx)(`div`,{className:e.cn(`flex items-center gap-2 flex-wrap`,c?`bg-background p-1 rounded-md border`:``,o),children:f.map(t=>(0,i.jsx)(`button`,{className:e.cn(`h-6 w-6 rounded-full border border-input ring-offset-background hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,t.color,p===t.value&&`ring-2 ring-ring ring-offset-2`),onClick:()=>u(t.value),title:t.label,"aria-label":t.label,children:p===t.value&&(0,i.jsx)(a.Check,{className:`h-3 w-3 text-white mx-auto`,strokeWidth:3})},t.value))}):(0,i.jsx)(`select`,{"aria-label":`Color`,className:o,value:p,onChange:e=>u(e.target.value),children:f.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function c({className:o,variant:s=`select`,withBackground:c=!1}){let{spacingTheme:l,setSpacingTheme:u}=n.useTheme(),d=r.useIsClient()?l:`normal`,f=[{value:`compact`,label:`Compact`,icon:a.Rows4},{value:`normal`,label:`Normal`,icon:a.Rows3},{value:`comfortable`,label:`Comfortable`,icon:a.Rows2}],p=()=>{let e=(f.findIndex(e=>e.value===l)+1)%f.length;u(f[e].value)},m=c?`text-foreground`:``;if(s===`toggle`||s===`cycle`){let n=f.find(e=>e.value===d)||f[1],r=n.icon;return(0,i.jsxs)(t.Button,{variant:`ghost`,size:`icon`,className:e.cn(o,c&&`bg-background/80 hover:bg-background`),onClick:p,title:`Spacing: ${n.label} (Click to cycle)`,"aria-label":`Current spacing: ${n.label}. Click to cycle.`,children:[(0,i.jsx)(r,{className:e.cn(`h-5 w-5`,m)}),(0,i.jsx)(`span`,{className:`sr-only`,children:n.label})]})}return s===`icon-group`?(0,i.jsx)(`div`,{className:e.cn(`flex items-center gap-1 border rounded-md p-1`,c?`bg-background`:`bg-transparent border-0`,o),children:f.map(e=>(0,i.jsxs)(t.Button,{variant:d===e.value?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>u(e.value),title:e.label,children:[(0,i.jsx)(e.icon,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`sr-only`,children:e.label})]},e.value))}):(0,i.jsxs)(`select`,{"aria-label":`Density`,className:o,value:d,onChange:e=>u(e.target.value),children:[(0,i.jsx)(`option`,{value:`compact`,children:`Compact`}),(0,i.jsx)(`option`,{value:`normal`,children:`Normal`}),(0,i.jsx)(`option`,{value:`comfortable`,children:`Comfortable`})]})}function l({className:t,selectClassName:n=`h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,showThemeMode:r=!0,showColorTheme:a=!0,showSpacingTheme:l=!0,modeVariant:u=`select`,colorVariant:d=`select`,spacingVariant:f=`select`}){return(0,i.jsxs)(`div`,{className:e.cn(t,`flex flex-col gap-3`),children:[r&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Mode`}),(0,i.jsx)(o,{className:u===`select`?n:void 0,variant:u})]}),a&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Color`}),(0,i.jsx)(s,{className:d===`select`?n:void 0,variant:d})]}),l&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Density`}),(0,i.jsx)(c,{className:f===`select`?n:void 0,variant:f})]})]})}exports.ColorThemeSwitcher=s,exports.SpacingThemeSwitcher=c,exports.ThemeModeSwitcher=o,exports.ThemeSwitcherGroup=l;
|
|
2
2
|
//# sourceMappingURL=theme-switcher.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-switcher.cjs","names":["useTheme","useIsClient","Sun","Moon","Monitor","Button","cn","Palette","Check","Rows4","Rows3","Rows2","require_ui_lib_utils","require_ui_components_ui_button_components","require_ui_components_theme_theme_context","require_ui_lib_hooks_use_is_client","react_jsx_runtime","lucide_react","ThemeModeSwitcher","isClient","modes","handleCycle","nextIndex","m","theme","setTheme","iconColorClass","withBackground","variant","isDark","resolvedTheme","className","activeTheme","selectValue","ColorThemeSwitcher","colors","activeColorTheme","colorTheme","c","setColorTheme","currentColor","SpacingThemeSwitcher","activeSpacingTheme","spacingTheme","spacings","s","setSpacingTheme","currentSpacing","IconComponent","ThemeSwitcherGroup","showThemeMode","modeVariant","selectClassName","showColorTheme","colorVariant","showSpacingTheme","spacingVariant"],"sources":["../../../../src/ui/components/theme/theme-switcher.tsx"],"sourcesContent":["import { Moon, Sun, Monitor, Check, Rows2, Rows3, Rows4, Palette } from 'lucide-react';\nimport { useTheme } from './theme-context';\nimport { Button } from '../ui/button';\nimport { cn } from \"../../lib/utils\";\nimport { useIsClient } from \"../../lib/hooks/use-is-client\";\n\n/**\n * テーマスイッチャーのプロップス\n */\nexport interface ThemeSwitcherProps {\n /** 追加CSS */\n className?: string;\n /** 表示形式 */\n variant?: 'select' | 'toggle' | 'icon-group' | 'cycle';\n /**\n * アイコンに背景を表示するか\n * 暗い背景に配置する場合、trueにすると視認性が向上します\n */\n withBackground?: boolean;\n}\n\n/**\n * テーマモードスイッチャー\n *\n * ライト/ダーク/システムを切り替えるUI。\n *\n * @example\n * ```tsx\n * import { ThemeModeSwitcher } from \"../..\";\n *\n * <ThemeModeSwitcher variant=\"toggle\" />\n * ```\n */\nexport function ThemeModeSwitcher({\n className,\n variant = 'select',\n withBackground = false,\n}: ThemeSwitcherProps) {\n const { theme, setTheme, resolvedTheme } = useTheme();\n const isClient = useIsClient();\n\n const modes: Array<{\n value: 'light' | 'dark' | 'system';\n label: string;\n icon: typeof Sun;\n }> = [\n { value: 'light', label: 'Light', icon: Sun },\n { value: 'dark', label: 'Dark', icon: Moon },\n { value: 'system', label: 'System', icon: Monitor },\n ];\n\n const handleCycle = () => {\n const currentIndex = modes.findIndex((m) => m.value === theme);\n const nextIndex = (currentIndex + 1) % modes.length;\n setTheme(modes[nextIndex].value);\n };\n\n // Icon color: use explicit foreground when withBackground, otherwise inherit from parent\n const iconColorClass = withBackground ? 'text-foreground' : '';\n\n if (variant === 'toggle' || variant === 'cycle') {\n // SSR-safe: Use a consistent default for initial render\n // After mount, use actual resolvedTheme\n const isDark = isClient ? resolvedTheme === 'dark' : false;\n\n return (\n <Button\n variant='ghost'\n size='icon'\n className={cn(className, withBackground && 'bg-background/80 hover:bg-background')}\n onClick={handleCycle}\n title={isClient ? `Current theme: ${theme} (${resolvedTheme})` : 'Toggle theme'}\n >\n <div className='relative h-5 w-5 flex items-center justify-center'>\n <Sun\n className={cn(\n 'h-5 w-5 transition-all',\n iconColorClass,\n isDark ? 'rotate-90 scale-0 opacity-0' : 'rotate-0 scale-100 opacity-100',\n )}\n />\n <Moon\n className={cn(\n 'absolute h-5 w-5 transition-all',\n iconColorClass,\n isDark ? 'rotate-0 scale-100 opacity-100' : '-rotate-90 scale-0 opacity-0',\n )}\n />\n </div>\n <span className='sr-only'>Toggle theme</span>\n </Button>\n );\n }\n\n if (variant === 'icon-group') {\n // SSR-safe: Use defaultTheme for initial render, actual theme after mount\n const activeTheme = isClient ? theme : 'system';\n return (\n <div\n className={cn(\n 'flex items-center gap-1 border rounded-md p-1',\n withBackground ? 'bg-background' : 'bg-transparent border-0',\n className,\n )}\n >\n {modes.map((m) => (\n <Button\n key={m.value}\n variant={activeTheme === m.value ? 'secondary' : 'ghost'}\n size='icon'\n className='h-7 w-7'\n onClick={() => setTheme(m.value)}\n title={m.label}\n >\n <m.icon className='h-4 w-4' />\n <span className='sr-only'>{m.label}</span>\n </Button>\n ))}\n </div>\n );\n }\n\n // SSR-safe: Use defaultTheme for initial render\n const selectValue = isClient ? theme : 'system';\n return (\n <select\n className={cn(\n 'h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n className,\n )}\n value={selectValue}\n onChange={(e) => setTheme(e.target.value as 'light' | 'dark' | 'system')}\n >\n <option value='light'>Light</option>\n <option value='dark'>Dark</option>\n <option value='system'>System</option>\n </select>\n );\n}\n\n/**\n * カラーテーマ(プライマリ色)を切り替えるUIコンポーネント\n */\nexport function ColorThemeSwitcher({\n className,\n variant = 'select',\n withBackground = false,\n}: ThemeSwitcherProps) {\n const { colorTheme, setColorTheme } = useTheme();\n const isClient = useIsClient();\n\n const colors = [\n { value: 'default', label: 'Default', color: 'bg-zinc-600' },\n { value: 'blue', label: 'Blue', color: 'bg-blue-500' },\n { value: 'green', label: 'Green', color: 'bg-green-500' },\n { value: 'rose', label: 'Rose', color: 'bg-rose-500' },\n { value: 'orange', label: 'Orange', color: 'bg-orange-500' },\n ];\n\n // SSR-safe: Use default for initial render\n const activeColorTheme = isClient ? colorTheme : 'default';\n\n const handleCycle = () => {\n const currentIndex = colors.findIndex((c) => c.value === colorTheme);\n const nextIndex = (currentIndex + 1) % colors.length;\n setColorTheme(colors[nextIndex].value);\n };\n\n const currentColor = colors.find((c) => c.value === activeColorTheme) || colors[0];\n\n if (variant === 'toggle' || variant === 'cycle') {\n // withBackground: colored background, white inset ring, white icon\n // no background: just colored palette icon\n if (withBackground) {\n return (\n <Button\n variant='ghost'\n size='icon'\n className={cn(\n 'ring-2 ring-inset ring-white/80 hover:ring-white',\n currentColor.color,\n 'hover:opacity-90',\n className,\n )}\n onClick={handleCycle}\n title={`Color: ${currentColor.label} (Click to cycle)`}\n aria-label={`Current color: ${currentColor.label}. Click to cycle.`}\n >\n <Palette className='h-5 w-5 text-white' />\n <span className='sr-only'>{currentColor.label}</span>\n </Button>\n );\n }\n\n // No background: just colored icon\n return (\n <Button\n variant='ghost'\n size='icon'\n className={className}\n onClick={handleCycle}\n title={`Color: ${currentColor.label} (Click to cycle)`}\n aria-label={`Current color: ${currentColor.label}. Click to cycle.`}\n >\n <Palette className={cn('h-5 w-5', currentColor.color.replace('bg-', 'text-'))} />\n <span className='sr-only'>{currentColor.label}</span>\n </Button>\n );\n }\n\n if (variant === 'icon-group') {\n return (\n <div\n className={cn(\n 'flex items-center gap-2 flex-wrap',\n withBackground ? 'bg-background p-1 rounded-md border' : '',\n className,\n )}\n >\n {colors.map((c) => (\n <button\n key={c.value}\n className={cn(\n 'h-6 w-6 rounded-full border border-input ring-offset-background hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n c.color,\n activeColorTheme === c.value && 'ring-2 ring-ring ring-offset-2',\n )}\n onClick={() => setColorTheme(c.value)}\n title={c.label}\n aria-label={c.label}\n >\n {activeColorTheme === c.value && (\n <Check className='h-3 w-3 text-white mx-auto' strokeWidth={3} />\n )}\n </button>\n ))}\n </div>\n );\n }\n\n return (\n <select\n className={className}\n value={activeColorTheme}\n onChange={(e) => setColorTheme(e.target.value)}\n >\n {colors.map((c) => (\n <option key={c.value} value={c.value}>\n {c.label}\n </option>\n ))}\n </select>\n );\n}\n\n/**\n * 表示の密度(余白など)をコンパクト、ノーマル、コンフォタブルに切り替えるUIコンポーネント\n */\nexport function SpacingThemeSwitcher({\n className,\n variant = 'select',\n withBackground = false,\n}: ThemeSwitcherProps) {\n const { spacingTheme, setSpacingTheme } = useTheme();\n const isClient = useIsClient();\n\n // SSR-safe: Use default for initial render\n const activeSpacingTheme = isClient ? spacingTheme : 'normal';\n\n const spacings: Array<{\n value: 'compact' | 'normal' | 'comfortable';\n label: string;\n icon: typeof Rows2;\n }> = [\n { value: 'compact', label: 'Compact', icon: Rows4 }, // More rows = tighter spacing\n { value: 'normal', label: 'Normal', icon: Rows3 }, // Medium\n { value: 'comfortable', label: 'Comfortable', icon: Rows2 }, // Fewer rows = more spacing\n ];\n\n const handleCycle = () => {\n const currentIndex = spacings.findIndex((s) => s.value === spacingTheme);\n const nextIndex = (currentIndex + 1) % spacings.length;\n setSpacingTheme(spacings[nextIndex].value);\n };\n\n // Icon color: use explicit foreground when withBackground, otherwise inherit from parent\n const iconColorClass = withBackground ? 'text-foreground' : '';\n\n if (variant === 'toggle' || variant === 'cycle') {\n const currentSpacing = spacings.find((s) => s.value === activeSpacingTheme) || spacings[1];\n const IconComponent = currentSpacing.icon;\n\n return (\n <Button\n variant='ghost'\n size='icon'\n className={cn(className, withBackground && 'bg-background/80 hover:bg-background')}\n onClick={handleCycle}\n title={`Spacing: ${currentSpacing.label} (Click to cycle)`}\n aria-label={`Current spacing: ${currentSpacing.label}. Click to cycle.`}\n >\n <IconComponent className={cn('h-5 w-5', iconColorClass)} />\n <span className='sr-only'>{currentSpacing.label}</span>\n </Button>\n );\n }\n\n if (variant === 'icon-group') {\n return (\n <div\n className={cn(\n 'flex items-center gap-1 border rounded-md p-1',\n withBackground ? 'bg-background' : 'bg-transparent border-0',\n className,\n )}\n >\n {spacings.map((s) => (\n <Button\n key={s.value}\n variant={activeSpacingTheme === s.value ? 'secondary' : 'ghost'}\n size='icon'\n className='h-7 w-7'\n onClick={() => setSpacingTheme(s.value)}\n title={s.label}\n >\n <s.icon className='h-4 w-4' />\n <span className='sr-only'>{s.label}</span>\n </Button>\n ))}\n </div>\n );\n }\n\n return (\n <select\n className={className}\n value={activeSpacingTheme}\n onChange={(e) => setSpacingTheme(e.target.value as 'compact' | 'normal' | 'comfortable')}\n >\n <option value='compact'>Compact</option>\n <option value='normal'>Normal</option>\n <option value='comfortable'>Comfortable</option>\n </select>\n );\n}\n\nexport interface ThemeSwitcherGroupProps {\n className?: string;\n selectClassName?: string;\n showThemeMode?: boolean;\n showColorTheme?: boolean;\n showSpacingTheme?: boolean;\n modeVariant?: 'select' | 'toggle' | 'icon-group';\n colorVariant?: 'select' | 'toggle' | 'icon-group';\n spacingVariant?: 'select' | 'toggle' | 'icon-group';\n}\n\n/**\n * モード、カラー、表示密度の複数のテーマ設定をまとめて変更できるグループコンポーネント\n */\nexport function ThemeSwitcherGroup({\n className,\n selectClassName = 'h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n showThemeMode = true,\n showColorTheme = true,\n showSpacingTheme = true,\n modeVariant = 'select',\n colorVariant = 'select',\n spacingVariant = 'select',\n}: ThemeSwitcherGroupProps) {\n return (\n <div className={cn(className, 'flex flex-col gap-3')}>\n {showThemeMode && (\n <div className='flex items-center justify-between gap-2'>\n <span className='text-xs text-muted-foreground'>Mode</span>\n <ThemeModeSwitcher\n className={modeVariant === 'select' ? selectClassName : undefined}\n variant={modeVariant}\n />\n </div>\n )}\n {showColorTheme && (\n <div className='flex items-center justify-between gap-2'>\n <span className='text-xs text-muted-foreground'>Color</span>\n <ColorThemeSwitcher\n className={colorVariant === 'select' ? selectClassName : undefined}\n variant={colorVariant}\n />\n </div>\n )}\n {showSpacingTheme && (\n <div className='flex items-center justify-between gap-2'>\n <span className='text-xs text-muted-foreground'>Density</span>\n <SpacingThemeSwitcher\n className={spacingVariant === 'select' ? selectClassName : undefined}\n variant={spacingVariant}\n />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"A,6SAiCA,SAAgBkB,EAAkB,CAChC,YACA,UAAU,SACV,iBAAiB,IACI,CACrB,GAAM,CAAE,QAAO,WAAU,iBAAkBlB,EAAAA,SAAS,EAC9CmB,EAAWlB,EAAAA,YAAY,EAEvBmB,EAID,C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C,YACA,kBAAkB,0KAClB,gBAAgB,GAChB,iBAAiB,GACjB,mBAAmB,GACnB,cAAc,SACd,eAAe,SACf,iBAAiB,UACS,CAC1B,OACE,EAAAjC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAWV,EAAAA,GAAGyB,EAAW,qBAAqB,EAAnD,SAAA,CACGmB,IACC,EAAAlC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,SAAA,MAAU,CAAA,GAC1D,EAAAA,EAAA,IAAA,CAACE,EAAD,CACE,UAAWiC,IAAgB,SAAWC,EAAkB,IAAA,GACxD,QAASD,CACV,CAAA,CACE,C,GAENE,IACC,EAAArC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,SAAA,OAAW,CAAA,GAC3D,EAAAA,EAAA,IAAA,CAACkB,EAAD,CACE,UAAWoB,IAAiB,SAAWF,EAAkB,IAAA,GACzD,QAASE,CACV,CAAA,CACE,C,GAENC,IACC,EAAAvC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,SAAA,SAAa,CAAA,GAC7D,EAAAA,EAAA,IAAA,CAACyB,EAAD,CACE,UAAWe,IAAmB,SAAWJ,EAAkB,IAAA,GAC3D,QAASI,CACV,CAAA,CACE,C,EAEJ,C,EAET,C"}
|
|
1
|
+
{"version":3,"file":"theme-switcher.cjs","names":["useTheme","useIsClient","Sun","Moon","Monitor","Button","cn","Palette","Check","Rows4","Rows3","Rows2","require_ui_lib_utils","require_ui_components_ui_button_components","require_ui_components_theme_theme_context","require_ui_lib_hooks_use_is_client","react_jsx_runtime","lucide_react","ThemeModeSwitcher","isClient","modes","handleCycle","nextIndex","m","theme","setTheme","iconColorClass","withBackground","variant","isDark","resolvedTheme","className","activeTheme","selectValue","ColorThemeSwitcher","colors","activeColorTheme","colorTheme","c","setColorTheme","currentColor","SpacingThemeSwitcher","activeSpacingTheme","spacingTheme","spacings","s","setSpacingTheme","currentSpacing","IconComponent","ThemeSwitcherGroup","showThemeMode","modeVariant","selectClassName","showColorTheme","colorVariant","showSpacingTheme","spacingVariant"],"sources":["../../../../src/ui/components/theme/theme-switcher.tsx"],"sourcesContent":["import { Moon, Sun, Monitor, Check, Rows2, Rows3, Rows4, Palette } from 'lucide-react';\nimport { useTheme } from './theme-context';\nimport { Button } from '../ui/button';\nimport { cn } from \"../../lib/utils\";\nimport { useIsClient } from \"../../lib/hooks/use-is-client\";\n\n/**\n * Display settings shared by the theme switchers; see ThemeModeSwitcher for setup.\n *\n * @see ThemeModeSwitcher for the canonical usage example.\n */\nexport interface ThemeSwitcherProps {\n /** Additional classes on the rendered control. */\n className?: string;\n /** Presentation style; defaults to 'select'. Both 'toggle' and 'cycle' cycle values. */\n variant?: 'select' | 'toggle' | 'icon-group' | 'cycle';\n /**\n * Add a background to icon controls; defaults to false.\n * Select controls ignore this setting.\n */\n withBackground?: boolean;\n}\n\n/**\n * Switches between light, dark and system modes from theme context.\n *\n * @param props - Control classes, presentation variant and optional icon background.\n *\n * @returns A select, cycling button or group of mode buttons.\n *\n * @remarks Use inside ThemeProvider and import @alneas/appkit-react/styles. Defaults to\n * select with no background; toggle/cycle advances light, dark, system. Before mount,\n * controls use stable system/light placeholders, then reflect the provider state.\n * The provider's storage setter may throw when browser storage is unavailable.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { ThemeProvider, ThemeModeSwitcher } from '@alneas/appkit-react/ui/theme';\n * export function ThemeControl() {\n * return <ThemeProvider><ThemeModeSwitcher variant=\"toggle\" /></ThemeProvider>;\n * }\n * ```\n */\nexport function ThemeModeSwitcher({\n className,\n variant = 'select',\n withBackground = false,\n}: ThemeSwitcherProps) {\n const { theme, setTheme, resolvedTheme } = useTheme();\n const isClient = useIsClient();\n\n const modes: Array<{\n value: 'light' | 'dark' | 'system';\n label: string;\n icon: typeof Sun;\n }> = [\n { value: 'light', label: 'Light', icon: Sun },\n { value: 'dark', label: 'Dark', icon: Moon },\n { value: 'system', label: 'System', icon: Monitor },\n ];\n\n const handleCycle = () => {\n const currentIndex = modes.findIndex((m) => m.value === theme);\n const nextIndex = (currentIndex + 1) % modes.length;\n setTheme(modes[nextIndex].value);\n };\n\n // Icon color: use explicit foreground when withBackground, otherwise inherit from parent\n const iconColorClass = withBackground ? 'text-foreground' : '';\n\n if (variant === 'toggle' || variant === 'cycle') {\n // SSR-safe: Use a consistent default for initial render\n // After mount, use actual resolvedTheme\n const isDark = isClient ? resolvedTheme === 'dark' : false;\n\n return (\n <Button\n variant='ghost'\n size='icon'\n className={cn(className, withBackground && 'bg-background/80 hover:bg-background')}\n onClick={handleCycle}\n title={isClient ? `Current theme: ${theme} (${resolvedTheme})` : 'Toggle theme'}\n >\n <div className='relative h-5 w-5 flex items-center justify-center'>\n <Sun\n className={cn(\n 'h-5 w-5 transition-all',\n iconColorClass,\n isDark ? 'rotate-90 scale-0 opacity-0' : 'rotate-0 scale-100 opacity-100',\n )}\n />\n <Moon\n className={cn(\n 'absolute h-5 w-5 transition-all',\n iconColorClass,\n isDark ? 'rotate-0 scale-100 opacity-100' : '-rotate-90 scale-0 opacity-0',\n )}\n />\n </div>\n <span className='sr-only'>Toggle theme</span>\n </Button>\n );\n }\n\n if (variant === 'icon-group') {\n // SSR-safe: Use defaultTheme for initial render, actual theme after mount\n const activeTheme = isClient ? theme : 'system';\n return (\n <div\n className={cn(\n 'flex items-center gap-1 border rounded-md p-1',\n withBackground ? 'bg-background' : 'bg-transparent border-0',\n className,\n )}\n >\n {modes.map((m) => (\n <Button\n key={m.value}\n variant={activeTheme === m.value ? 'secondary' : 'ghost'}\n size='icon'\n className='h-7 w-7'\n onClick={() => setTheme(m.value)}\n title={m.label}\n >\n <m.icon className='h-4 w-4' />\n <span className='sr-only'>{m.label}</span>\n </Button>\n ))}\n </div>\n );\n }\n\n // SSR-safe: Use defaultTheme for initial render\n const selectValue = isClient ? theme : 'system';\n return (\n <select\n aria-label='Mode'\n className={cn(\n 'h-9 rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n className,\n )}\n value={selectValue}\n onChange={(e) => setTheme(e.target.value as 'light' | 'dark' | 'system')}\n >\n <option value='light'>Light</option>\n <option value='dark'>Dark</option>\n <option value='system'>System</option>\n </select>\n );\n}\n\n/**\n * Switches the provider palette among default, blue, green, rose, orange and future.\n *\n * @param props - Control classes, variant (default select) and icon background (default false).\n *\n * @returns A palette select, cycling button or group of color buttons.\n *\n * @remarks Requires ThemeProvider and @alneas/appkit-react/styles. Toggle/cycle advances\n * through the available values. Custom palette names are not listed. An unknown current\n * palette displays Default in toggle/cycle, highlights no icon-group swatch and remains\n * an unmatched select value.\n * Provider localStorage setter errors propagate from interactions.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { ThemeProvider, ColorThemeSwitcher } from '@alneas/appkit-react/ui/theme';\n * export function Control() { return <ThemeProvider><ColorThemeSwitcher /></ThemeProvider>; }\n * ```\n */\nexport function ColorThemeSwitcher({\n className,\n variant = 'select',\n withBackground = false,\n}: ThemeSwitcherProps) {\n const { colorTheme, setColorTheme } = useTheme();\n const isClient = useIsClient();\n\n const colors = [\n { value: 'default', label: 'Default', color: 'bg-zinc-600' },\n { value: 'blue', label: 'Blue', color: 'bg-blue-500' },\n { value: 'green', label: 'Green', color: 'bg-green-500' },\n { value: 'rose', label: 'Rose', color: 'bg-rose-500' },\n { value: 'orange', label: 'Orange', color: 'bg-orange-500' },\n { value: 'future', label: 'Future', color: 'bg-cyan-500' },\n ];\n\n // SSR-safe: Use default for initial render\n const activeColorTheme = isClient ? colorTheme : 'default';\n\n const handleCycle = () => {\n const currentIndex = colors.findIndex((c) => c.value === colorTheme);\n const nextIndex = (currentIndex + 1) % colors.length;\n setColorTheme(colors[nextIndex].value);\n };\n\n const currentColor = colors.find((c) => c.value === activeColorTheme) || colors[0];\n\n if (variant === 'toggle' || variant === 'cycle') {\n // withBackground: colored background, white inset ring, white icon\n // no background: just colored palette icon\n if (withBackground) {\n return (\n <Button\n variant='ghost'\n size='icon'\n className={cn(\n 'ring-2 ring-inset ring-white/80 hover:ring-white',\n currentColor.color,\n 'hover:opacity-90',\n className,\n )}\n onClick={handleCycle}\n title={`Color: ${currentColor.label} (Click to cycle)`}\n aria-label={`Current color: ${currentColor.label}. Click to cycle.`}\n >\n <Palette className='h-5 w-5 text-white' />\n <span className='sr-only'>{currentColor.label}</span>\n </Button>\n );\n }\n\n // No background: just colored icon\n return (\n <Button\n variant='ghost'\n size='icon'\n className={className}\n onClick={handleCycle}\n title={`Color: ${currentColor.label} (Click to cycle)`}\n aria-label={`Current color: ${currentColor.label}. Click to cycle.`}\n >\n <Palette className={cn('h-5 w-5', currentColor.color.replace('bg-', 'text-'))} />\n <span className='sr-only'>{currentColor.label}</span>\n </Button>\n );\n }\n\n if (variant === 'icon-group') {\n return (\n <div\n className={cn(\n 'flex items-center gap-2 flex-wrap',\n withBackground ? 'bg-background p-1 rounded-md border' : '',\n className,\n )}\n >\n {colors.map((c) => (\n <button\n key={c.value}\n className={cn(\n 'h-6 w-6 rounded-full border border-input ring-offset-background hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n c.color,\n activeColorTheme === c.value && 'ring-2 ring-ring ring-offset-2',\n )}\n onClick={() => setColorTheme(c.value)}\n title={c.label}\n aria-label={c.label}\n >\n {activeColorTheme === c.value && (\n <Check className='h-3 w-3 text-white mx-auto' strokeWidth={3} />\n )}\n </button>\n ))}\n </div>\n );\n }\n\n return (\n <select\n aria-label='Color'\n className={className}\n value={activeColorTheme}\n onChange={(e) => setColorTheme(e.target.value)}\n >\n {colors.map((c) => (\n <option key={c.value} value={c.value}>\n {c.label}\n </option>\n ))}\n </select>\n );\n}\n\n/**\n * Switches provider density among compact, normal and comfortable.\n *\n * @param props - Control classes, variant (default select) and icon background (default false).\n *\n * @returns A density select, cycling button or group of density buttons.\n *\n * @remarks Requires ThemeProvider and @alneas/appkit-react/styles. Toggle/cycle advances\n * through the available values. Before mount the displayed density is normal.\n * Provider localStorage setter errors propagate from interactions.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { ThemeProvider, SpacingThemeSwitcher } from '@alneas/appkit-react/ui/theme';\n * export function Control() { return <ThemeProvider><SpacingThemeSwitcher /></ThemeProvider>; }\n * ```\n */\nexport function SpacingThemeSwitcher({\n className,\n variant = 'select',\n withBackground = false,\n}: ThemeSwitcherProps) {\n const { spacingTheme, setSpacingTheme } = useTheme();\n const isClient = useIsClient();\n\n // SSR-safe: Use default for initial render\n const activeSpacingTheme = isClient ? spacingTheme : 'normal';\n\n const spacings: Array<{\n value: 'compact' | 'normal' | 'comfortable';\n label: string;\n icon: typeof Rows2;\n }> = [\n { value: 'compact', label: 'Compact', icon: Rows4 }, // More rows = tighter spacing\n { value: 'normal', label: 'Normal', icon: Rows3 }, // Medium\n { value: 'comfortable', label: 'Comfortable', icon: Rows2 }, // Fewer rows = more spacing\n ];\n\n const handleCycle = () => {\n const currentIndex = spacings.findIndex((s) => s.value === spacingTheme);\n const nextIndex = (currentIndex + 1) % spacings.length;\n setSpacingTheme(spacings[nextIndex].value);\n };\n\n // Icon color: use explicit foreground when withBackground, otherwise inherit from parent\n const iconColorClass = withBackground ? 'text-foreground' : '';\n\n if (variant === 'toggle' || variant === 'cycle') {\n const currentSpacing = spacings.find((s) => s.value === activeSpacingTheme) || spacings[1];\n const IconComponent = currentSpacing.icon;\n\n return (\n <Button\n variant='ghost'\n size='icon'\n className={cn(className, withBackground && 'bg-background/80 hover:bg-background')}\n onClick={handleCycle}\n title={`Spacing: ${currentSpacing.label} (Click to cycle)`}\n aria-label={`Current spacing: ${currentSpacing.label}. Click to cycle.`}\n >\n <IconComponent className={cn('h-5 w-5', iconColorClass)} />\n <span className='sr-only'>{currentSpacing.label}</span>\n </Button>\n );\n }\n\n if (variant === 'icon-group') {\n return (\n <div\n className={cn(\n 'flex items-center gap-1 border rounded-md p-1',\n withBackground ? 'bg-background' : 'bg-transparent border-0',\n className,\n )}\n >\n {spacings.map((s) => (\n <Button\n key={s.value}\n variant={activeSpacingTheme === s.value ? 'secondary' : 'ghost'}\n size='icon'\n className='h-7 w-7'\n onClick={() => setSpacingTheme(s.value)}\n title={s.label}\n >\n <s.icon className='h-4 w-4' />\n <span className='sr-only'>{s.label}</span>\n </Button>\n ))}\n </div>\n );\n }\n\n return (\n <select\n aria-label='Density'\n className={className}\n value={activeSpacingTheme}\n onChange={(e) => setSpacingTheme(e.target.value as 'compact' | 'normal' | 'comfortable')}\n >\n <option value='compact'>Compact</option>\n <option value='normal'>Normal</option>\n <option value='comfortable'>Comfortable</option>\n </select>\n );\n}\n\n/**\n * Visibility and presentation for ThemeSwitcherGroup; see its usage example.\n * @see ThemeSwitcherGroup for the canonical usage example.\n */\nexport interface ThemeSwitcherGroupProps {\n /** Classes on the outer group. */\n className?: string;\n /** Classes passed to select controls; defaults to the styled input classes. */\n selectClassName?: string;\n /** Show the mode control; defaults to true. */\n showThemeMode?: boolean;\n /** Show the palette control; defaults to true. */\n showColorTheme?: boolean;\n /** Show the density control; defaults to true. */\n showSpacingTheme?: boolean;\n /** Mode presentation; defaults to select. */\n modeVariant?: 'select' | 'toggle' | 'icon-group';\n /** Palette presentation; defaults to select. */\n colorVariant?: 'select' | 'toggle' | 'icon-group';\n /** Density presentation; defaults to select. */\n spacingVariant?: 'select' | 'toggle' | 'icon-group';\n}\n\n/**\n * Groups optional mode, palette and density controls with visible labels.\n *\n * @param props - Group/select classes, visibility flags and per-control variants.\n *\n * @returns A vertical group; all three controls are visible as selects by default.\n *\n * @remarks Requires ThemeProvider and @alneas/appkit-react/styles. Each control persists\n * through the provider; browser storage errors can propagate from interactions.\n *\n * @example\n * ```tsx\n * import '@alneas/appkit-react/styles';\n * import { ThemeProvider, ThemeSwitcherGroup } from '@alneas/appkit-react/ui/theme';\n * export function ThemeSettings() { return <ThemeProvider><ThemeSwitcherGroup /></ThemeProvider>; }\n * ```\n */\nexport function ThemeSwitcherGroup({\n className,\n selectClassName = 'h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n showThemeMode = true,\n showColorTheme = true,\n showSpacingTheme = true,\n modeVariant = 'select',\n colorVariant = 'select',\n spacingVariant = 'select',\n}: ThemeSwitcherGroupProps) {\n return (\n <div className={cn(className, 'flex flex-col gap-3')}>\n {showThemeMode && (\n <div className='flex items-center justify-between gap-2'>\n <span className='text-xs text-muted-foreground'>Mode</span>\n <ThemeModeSwitcher\n className={modeVariant === 'select' ? selectClassName : undefined}\n variant={modeVariant}\n />\n </div>\n )}\n {showColorTheme && (\n <div className='flex items-center justify-between gap-2'>\n <span className='text-xs text-muted-foreground'>Color</span>\n <ColorThemeSwitcher\n className={colorVariant === 'select' ? selectClassName : undefined}\n variant={colorVariant}\n />\n </div>\n )}\n {showSpacingTheme && (\n <div className='flex items-center justify-between gap-2'>\n <span className='text-xs text-muted-foreground'>Density</span>\n <SpacingThemeSwitcher\n className={spacingVariant === 'select' ? selectClassName : undefined}\n variant={spacingVariant}\n />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"A,6SA4CA,SAAgBkB,EAAkB,CAChC,YACA,UAAU,SACV,iBAAiB,IACI,CACrB,GAAM,CAAE,QAAO,WAAU,iBAAkBlB,EAAAA,SAAS,EAC9CmB,EAAWlB,EAAAA,YAAY,EAEvBmB,EAID,CACH,CAAE,MAAO,QAAS,MAAO,QAAS,KAAMlB,EAAAA,GAAI,EAC5C,CAAE,MAAO,OAAQ,MAAO,OAAQ,KAAMC,EAAAA,IAAK,EAC3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iBAAiB,GACjB,mBAAmB,GACnB,cAAc,SACd,eAAe,SACf,iBAAiB,UACS,CAC1B,OACE,EAAAjC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAWV,EAAAA,GAAGyB,EAAW,qBAAqB,EAAnD,SAAA,CACGmB,IACC,EAAAlC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,SAAA,MAAU,CAAA,GAC1D,EAAAA,EAAA,IAAA,CAACE,EAAD,CACE,UAAWiC,IAAgB,SAAWC,EAAkB,IAAA,GACxD,QAASD,CACV,CAAA,CACE,C,GAENE,IACC,EAAArC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,SAAA,OAAW,CAAA,GAC3D,EAAAA,EAAA,IAAA,CAACkB,EAAD,CACE,UAAWoB,IAAiB,SAAWF,EAAkB,IAAA,GACzD,QAASE,CACV,CAAA,CACE,C,GAENC,IACC,EAAAvC,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAgC,SAAA,SAAa,CAAA,GAC7D,EAAAA,EAAA,IAAA,CAACyB,EAAD,CACE,UAAWe,IAAmB,SAAWJ,EAAkB,IAAA,GAC3D,QAASI,CACV,CAAA,CACE,C,EAEJ,C,EAET,C"}
|
|
@@ -1,49 +1,118 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Display settings shared by the theme switchers; see ThemeModeSwitcher for setup.
|
|
3
|
+
*
|
|
4
|
+
* @see ThemeModeSwitcher for the canonical usage example.
|
|
3
5
|
*/
|
|
4
6
|
export interface ThemeSwitcherProps {
|
|
5
|
-
/**
|
|
7
|
+
/** Additional classes on the rendered control. */
|
|
6
8
|
className?: string;
|
|
7
|
-
/**
|
|
9
|
+
/** Presentation style; defaults to 'select'. Both 'toggle' and 'cycle' cycle values. */
|
|
8
10
|
variant?: 'select' | 'toggle' | 'icon-group' | 'cycle';
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Add a background to icon controls; defaults to false.
|
|
13
|
+
* Select controls ignore this setting.
|
|
12
14
|
*/
|
|
13
15
|
withBackground?: boolean;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* Switches between light, dark and system modes from theme context.
|
|
19
|
+
*
|
|
20
|
+
* @param props - Control classes, presentation variant and optional icon background.
|
|
17
21
|
*
|
|
18
|
-
*
|
|
22
|
+
* @returns A select, cycling button or group of mode buttons.
|
|
23
|
+
*
|
|
24
|
+
* @remarks Use inside ThemeProvider and import @alneas/appkit-react/styles. Defaults to
|
|
25
|
+
* select with no background; toggle/cycle advances light, dark, system. Before mount,
|
|
26
|
+
* controls use stable system/light placeholders, then reflect the provider state.
|
|
27
|
+
* The provider's storage setter may throw when browser storage is unavailable.
|
|
19
28
|
*
|
|
20
29
|
* @example
|
|
21
30
|
* ```tsx
|
|
22
|
-
* import
|
|
23
|
-
*
|
|
24
|
-
*
|
|
31
|
+
* import '@alneas/appkit-react/styles';
|
|
32
|
+
* import { ThemeProvider, ThemeModeSwitcher } from '@alneas/appkit-react/ui/theme';
|
|
33
|
+
* export function ThemeControl() {
|
|
34
|
+
* return <ThemeProvider><ThemeModeSwitcher variant="toggle" /></ThemeProvider>;
|
|
35
|
+
* }
|
|
25
36
|
* ```
|
|
26
37
|
*/
|
|
27
38
|
export declare function ThemeModeSwitcher({ className, variant, withBackground, }: ThemeSwitcherProps): import('react').JSX.Element;
|
|
28
39
|
/**
|
|
29
|
-
*
|
|
40
|
+
* Switches the provider palette among default, blue, green, rose, orange and future.
|
|
41
|
+
*
|
|
42
|
+
* @param props - Control classes, variant (default select) and icon background (default false).
|
|
43
|
+
*
|
|
44
|
+
* @returns A palette select, cycling button or group of color buttons.
|
|
45
|
+
*
|
|
46
|
+
* @remarks Requires ThemeProvider and @alneas/appkit-react/styles. Toggle/cycle advances
|
|
47
|
+
* through the available values. Custom palette names are not listed. An unknown current
|
|
48
|
+
* palette displays Default in toggle/cycle, highlights no icon-group swatch and remains
|
|
49
|
+
* an unmatched select value.
|
|
50
|
+
* Provider localStorage setter errors propagate from interactions.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* import '@alneas/appkit-react/styles';
|
|
55
|
+
* import { ThemeProvider, ColorThemeSwitcher } from '@alneas/appkit-react/ui/theme';
|
|
56
|
+
* export function Control() { return <ThemeProvider><ColorThemeSwitcher /></ThemeProvider>; }
|
|
57
|
+
* ```
|
|
30
58
|
*/
|
|
31
59
|
export declare function ColorThemeSwitcher({ className, variant, withBackground, }: ThemeSwitcherProps): import('react').JSX.Element;
|
|
32
60
|
/**
|
|
33
|
-
*
|
|
61
|
+
* Switches provider density among compact, normal and comfortable.
|
|
62
|
+
*
|
|
63
|
+
* @param props - Control classes, variant (default select) and icon background (default false).
|
|
64
|
+
*
|
|
65
|
+
* @returns A density select, cycling button or group of density buttons.
|
|
66
|
+
*
|
|
67
|
+
* @remarks Requires ThemeProvider and @alneas/appkit-react/styles. Toggle/cycle advances
|
|
68
|
+
* through the available values. Before mount the displayed density is normal.
|
|
69
|
+
* Provider localStorage setter errors propagate from interactions.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* import '@alneas/appkit-react/styles';
|
|
74
|
+
* import { ThemeProvider, SpacingThemeSwitcher } from '@alneas/appkit-react/ui/theme';
|
|
75
|
+
* export function Control() { return <ThemeProvider><SpacingThemeSwitcher /></ThemeProvider>; }
|
|
76
|
+
* ```
|
|
34
77
|
*/
|
|
35
78
|
export declare function SpacingThemeSwitcher({ className, variant, withBackground, }: ThemeSwitcherProps): import('react').JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* Visibility and presentation for ThemeSwitcherGroup; see its usage example.
|
|
81
|
+
* @see ThemeSwitcherGroup for the canonical usage example.
|
|
82
|
+
*/
|
|
36
83
|
export interface ThemeSwitcherGroupProps {
|
|
84
|
+
/** Classes on the outer group. */
|
|
37
85
|
className?: string;
|
|
86
|
+
/** Classes passed to select controls; defaults to the styled input classes. */
|
|
38
87
|
selectClassName?: string;
|
|
88
|
+
/** Show the mode control; defaults to true. */
|
|
39
89
|
showThemeMode?: boolean;
|
|
90
|
+
/** Show the palette control; defaults to true. */
|
|
40
91
|
showColorTheme?: boolean;
|
|
92
|
+
/** Show the density control; defaults to true. */
|
|
41
93
|
showSpacingTheme?: boolean;
|
|
94
|
+
/** Mode presentation; defaults to select. */
|
|
42
95
|
modeVariant?: 'select' | 'toggle' | 'icon-group';
|
|
96
|
+
/** Palette presentation; defaults to select. */
|
|
43
97
|
colorVariant?: 'select' | 'toggle' | 'icon-group';
|
|
98
|
+
/** Density presentation; defaults to select. */
|
|
44
99
|
spacingVariant?: 'select' | 'toggle' | 'icon-group';
|
|
45
100
|
}
|
|
46
101
|
/**
|
|
47
|
-
*
|
|
102
|
+
* Groups optional mode, palette and density controls with visible labels.
|
|
103
|
+
*
|
|
104
|
+
* @param props - Group/select classes, visibility flags and per-control variants.
|
|
105
|
+
*
|
|
106
|
+
* @returns A vertical group; all three controls are visible as selects by default.
|
|
107
|
+
*
|
|
108
|
+
* @remarks Requires ThemeProvider and @alneas/appkit-react/styles. Each control persists
|
|
109
|
+
* through the provider; browser storage errors can propagate from interactions.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* import '@alneas/appkit-react/styles';
|
|
114
|
+
* import { ThemeProvider, ThemeSwitcherGroup } from '@alneas/appkit-react/ui/theme';
|
|
115
|
+
* export function ThemeSettings() { return <ThemeProvider><ThemeSwitcherGroup /></ThemeProvider>; }
|
|
116
|
+
* ```
|
|
48
117
|
*/
|
|
49
118
|
export declare function ThemeSwitcherGroup({ className, selectClassName, showThemeMode, showColorTheme, showSpacingTheme, modeVariant, colorVariant, spacingVariant, }: ThemeSwitcherGroupProps): import('react').JSX.Element;
|