@nikala-ui/docs 0.12.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/README.md +22 -0
- package/dist/cli/commands/build.d.ts +5 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +27 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +7 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +32 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +308 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/preview.d.ts +7 -0
- package/dist/cli/commands/preview.d.ts.map +1 -0
- package/dist/cli/commands/preview.js +24 -0
- package/dist/cli/commands/preview.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +7 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +33 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +53 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/App.d.ts +5 -0
- package/dist/client/App.d.ts.map +1 -0
- package/dist/client/App.jsx +31 -0
- package/dist/client/App.jsx.map +1 -0
- package/dist/client/app-types.d.ts +14 -0
- package/dist/client/app-types.d.ts.map +1 -0
- package/dist/client/app-types.js +2 -0
- package/dist/client/app-types.js.map +1 -0
- package/dist/client/components/DocsLayoutShell.d.ts +21 -0
- package/dist/client/components/DocsLayoutShell.d.ts.map +1 -0
- package/dist/client/components/DocsLayoutShell.jsx +14 -0
- package/dist/client/components/DocsLayoutShell.jsx.map +1 -0
- package/dist/client/components/DocsPageContent.d.ts +9 -0
- package/dist/client/components/DocsPageContent.d.ts.map +1 -0
- package/dist/client/components/DocsPageContent.jsx +10 -0
- package/dist/client/components/DocsPageContent.jsx.map +1 -0
- package/dist/client/entry.d.ts +2 -0
- package/dist/client/entry.d.ts.map +1 -0
- package/dist/client/entry.jsx +28 -0
- package/dist/client/entry.jsx.map +1 -0
- package/dist/client/index.html +21 -0
- package/dist/client/navigation/page-navigation.d.ts +9 -0
- package/dist/client/navigation/page-navigation.d.ts.map +1 -0
- package/dist/client/navigation/page-navigation.js +51 -0
- package/dist/client/navigation/page-navigation.js.map +1 -0
- package/dist/client/routing/use-docs-router.d.ts +17 -0
- package/dist/client/routing/use-docs-router.d.ts.map +1 -0
- package/dist/client/routing/use-docs-router.js +71 -0
- package/dist/client/routing/use-docs-router.js.map +1 -0
- package/dist/client/ssr-entry.d.ts +3 -0
- package/dist/client/ssr-entry.d.ts.map +1 -0
- package/dist/client/ssr-entry.jsx +13 -0
- package/dist/client/ssr-entry.jsx.map +1 -0
- package/dist/client/style.css +183 -0
- package/dist/client/utils/sidebar.d.ts +2 -0
- package/dist/client/utils/sidebar.d.ts.map +1 -0
- package/dist/client/utils/sidebar.js +2 -0
- package/dist/client/utils/sidebar.js.map +1 -0
- package/dist/components/mdx-components.d.ts +34 -0
- package/dist/components/mdx-components.d.ts.map +1 -0
- package/dist/components/mdx-components.jsx +131 -0
- package/dist/components/mdx-components.jsx.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +105 -0
- package/dist/config.js.map +1 -0
- package/dist/core/content-scanner.d.ts +10 -0
- package/dist/core/content-scanner.d.ts.map +1 -0
- package/dist/core/content-scanner.js +153 -0
- package/dist/core/content-scanner.js.map +1 -0
- package/dist/core/route-tree.d.ts +19 -0
- package/dist/core/route-tree.d.ts.map +1 -0
- package/dist/core/route-tree.js +176 -0
- package/dist/core/route-tree.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +9 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/mdx/compiler.d.ts +13 -0
- package/dist/mdx/compiler.d.ts.map +1 -0
- package/dist/mdx/compiler.js +38 -0
- package/dist/mdx/compiler.js.map +1 -0
- package/dist/mdx/highlighter.d.ts +22 -0
- package/dist/mdx/highlighter.d.ts.map +1 -0
- package/dist/mdx/highlighter.js +139 -0
- package/dist/mdx/highlighter.js.map +1 -0
- package/dist/mdx/rehype-shiki.d.ts +3 -0
- package/dist/mdx/rehype-shiki.d.ts.map +1 -0
- package/dist/mdx/rehype-shiki.js +83 -0
- package/dist/mdx/rehype-shiki.js.map +1 -0
- package/dist/navigation/index.d.ts +2 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/sidebar-state.d.ts +6 -0
- package/dist/navigation/sidebar-state.d.ts.map +1 -0
- package/dist/navigation/sidebar-state.js +20 -0
- package/dist/navigation/sidebar-state.js.map +1 -0
- package/dist/navigation/sidebar-tree.d.ts +7 -0
- package/dist/navigation/sidebar-tree.d.ts.map +1 -0
- package/dist/navigation/sidebar-tree.js +11 -0
- package/dist/navigation/sidebar-tree.js.map +1 -0
- package/dist/registry/accordion.json +18 -0
- package/dist/registry/alert.json +18 -0
- package/dist/registry/api-table.json +21 -0
- package/dist/registry/aspect-ratio.json +17 -0
- package/dist/registry/avatar.json +17 -0
- package/dist/registry/badge.json +18 -0
- package/dist/registry/banner.json +19 -0
- package/dist/registry/breadcrumb.json +17 -0
- package/dist/registry/bubble.json +18 -0
- package/dist/registry/button-group.json +20 -0
- package/dist/registry/button.json +21 -0
- package/dist/registry/callout.json +19 -0
- package/dist/registry/card.json +17 -0
- package/dist/registry/checkbox.json +20 -0
- package/dist/registry/code-block.json +26 -0
- package/dist/registry/code-group.json +20 -0
- package/dist/registry/collapsible.json +18 -0
- package/dist/registry/combobox.json +21 -0
- package/dist/registry/command.json +27 -0
- package/dist/registry/component-viewer.json +25 -0
- package/dist/registry/container.json +18 -0
- package/dist/registry/context-menu.json +24 -0
- package/dist/registry/create-active-element.json +13 -0
- package/dist/registry/create-app-updater.json +13 -0
- package/dist/registry/create-audio.json +7 -0
- package/dist/registry/create-battery.json +13 -0
- package/dist/registry/create-chat-scroll.json +13 -0
- package/dist/registry/create-click-outside.json +13 -0
- package/dist/registry/create-clipboard.json +13 -0
- package/dist/registry/create-color-mode.json +13 -0
- package/dist/registry/create-controllable-signal.json +13 -0
- package/dist/registry/create-debounce.json +13 -0
- package/dist/registry/create-disclosure.json +13 -0
- package/dist/registry/create-document-tabs.json +13 -0
- package/dist/registry/create-document-title.json +13 -0
- package/dist/registry/create-drop-zone.json +13 -0
- package/dist/registry/create-event-source.json +13 -0
- package/dist/registry/create-favicon.json +13 -0
- package/dist/registry/create-fetch.json +13 -0
- package/dist/registry/create-focus-trap.json +13 -0
- package/dist/registry/create-form.json +13 -0
- package/dist/registry/create-fullscreen.json +13 -0
- package/dist/registry/create-geolocation.json +13 -0
- package/dist/registry/create-global-shortcut.json +13 -0
- package/dist/registry/create-hover.json +13 -0
- package/dist/registry/create-idle.json +13 -0
- package/dist/registry/create-infinite-scroll.json +13 -0
- package/dist/registry/create-input-mask.json +13 -0
- package/dist/registry/create-intersection-observer.json +13 -0
- package/dist/registry/create-keybindings.json +13 -0
- package/dist/registry/create-lock-scroll.json +13 -0
- package/dist/registry/create-long-press.json +13 -0
- package/dist/registry/create-media-query.json +13 -0
- package/dist/registry/create-mouse-position.json +13 -0
- package/dist/registry/create-network-status.json +13 -0
- package/dist/registry/create-orientation.json +13 -0
- package/dist/registry/create-pagination.json +13 -0
- package/dist/registry/create-permission.json +13 -0
- package/dist/registry/create-previous.json +13 -0
- package/dist/registry/create-resize-observer.json +13 -0
- package/dist/registry/create-scroll-into-view.json +13 -0
- package/dist/registry/create-scroll-position.json +13 -0
- package/dist/registry/create-storage.json +13 -0
- package/dist/registry/create-tauri-window.json +13 -0
- package/dist/registry/create-timer.json +13 -0
- package/dist/registry/create-tiptap-editor.json +34 -0
- package/dist/registry/create-undo-redo.json +13 -0
- package/dist/registry/create-web-notification.json +13 -0
- package/dist/registry/create-websocket.json +13 -0
- package/dist/registry/create-window-size.json +13 -0
- package/dist/registry/dialog.json +21 -0
- package/dist/registry/dropdown-menu.json +22 -0
- package/dist/registry/dropzone.json +21 -0
- package/dist/registry/empty.json +17 -0
- package/dist/registry/field.json +20 -0
- package/dist/registry/file-tree.json +21 -0
- package/dist/registry/footer.json +18 -0
- package/dist/registry/forgot-password-01.json +28 -0
- package/dist/registry/form-message.json +17 -0
- package/dist/registry/form.json +17 -0
- package/dist/registry/hero-01.json +22 -0
- package/dist/registry/hover-card.json +18 -0
- package/dist/registry/icon-button.json +20 -0
- package/dist/registry/index.json +1489 -0
- package/dist/registry/input-group.json +21 -0
- package/dist/registry/input.json +17 -0
- package/dist/registry/kbd.json +18 -0
- package/dist/registry/label.json +18 -0
- package/dist/registry/list.json +20 -0
- package/dist/registry/login-01.json +28 -0
- package/dist/registry/logo.json +17 -0
- package/dist/registry/marker.json +17 -0
- package/dist/registry/marquee.json +17 -0
- package/dist/registry/message.json +17 -0
- package/dist/registry/navbar.json +19 -0
- package/dist/registry/navigation-menu.json +22 -0
- package/dist/registry/number-input.json +24 -0
- package/dist/registry/otp-verification-01.json +26 -0
- package/dist/registry/package-manager-tabs.json +24 -0
- package/dist/registry/pager.json +21 -0
- package/dist/registry/pagination.json +22 -0
- package/dist/registry/pin-input.json +17 -0
- package/dist/registry/popover.json +22 -0
- package/dist/registry/progress.json +18 -0
- package/dist/registry/radio-group.json +18 -0
- package/dist/registry/rating.json +19 -0
- package/dist/registry/register-01.json +31 -0
- package/dist/registry/resizable.json +21 -0
- package/dist/registry/review-card.json +23 -0
- package/dist/registry/rich-text-editor.json +95 -0
- package/dist/registry/scroll-area.json +21 -0
- package/dist/registry/section-heading.json +21 -0
- package/dist/registry/select.json +22 -0
- package/dist/registry/separator.json +17 -0
- package/dist/registry/sheet.json +22 -0
- package/dist/registry/sidebar.json +24 -0
- package/dist/registry/skeleton.json +17 -0
- package/dist/registry/slider.json +18 -0
- package/dist/registry/spinner.json +18 -0
- package/dist/registry/stat.json +19 -0
- package/dist/registry/status.json +18 -0
- package/dist/registry/steps.json +20 -0
- package/dist/registry/switch.json +20 -0
- package/dist/registry/table-of-contents.json +23 -0
- package/dist/registry/table.json +17 -0
- package/dist/registry/tabs.json +20 -0
- package/dist/registry/textarea.json +17 -0
- package/dist/registry/theme-manager.json +39 -0
- package/dist/registry/timeline.json +18 -0
- package/dist/registry/titlebar-tabs.json +24 -0
- package/dist/registry/titlebar.json +26 -0
- package/dist/registry/toast.json +20 -0
- package/dist/registry/toggle-group.json +21 -0
- package/dist/registry/toggle.json +18 -0
- package/dist/registry/tooltip.json +18 -0
- package/dist/registry/updater-modal.json +26 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +526 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/plugin.d.ts +10 -0
- package/dist/server/plugin.d.ts.map +1 -0
- package/dist/server/plugin.js +271 -0
- package/dist/server/plugin.js.map +1 -0
- package/dist/themes/default/content/breadcrumbs.d.ts +4 -0
- package/dist/themes/default/content/breadcrumbs.d.ts.map +1 -0
- package/dist/themes/default/content/breadcrumbs.jsx +31 -0
- package/dist/themes/default/content/breadcrumbs.jsx.map +1 -0
- package/dist/themes/default/content/pager.d.ts +5 -0
- package/dist/themes/default/content/pager.d.ts.map +1 -0
- package/dist/themes/default/content/pager.jsx +9 -0
- package/dist/themes/default/content/pager.jsx.map +1 -0
- package/dist/themes/default/content/table-of-contents.d.ts +4 -0
- package/dist/themes/default/content/table-of-contents.d.ts.map +1 -0
- package/dist/themes/default/content/table-of-contents.jsx +19 -0
- package/dist/themes/default/content/table-of-contents.jsx.map +1 -0
- package/dist/themes/default/index.d.ts +11 -0
- package/dist/themes/default/index.d.ts.map +1 -0
- package/dist/themes/default/index.js +30 -0
- package/dist/themes/default/index.js.map +1 -0
- package/dist/themes/default/layout.d.ts +4 -0
- package/dist/themes/default/layout.d.ts.map +1 -0
- package/dist/themes/default/layout.jsx +75 -0
- package/dist/themes/default/layout.jsx.map +1 -0
- package/dist/themes/default/navbar.d.ts +4 -0
- package/dist/themes/default/navbar.d.ts.map +1 -0
- package/dist/themes/default/navbar.jsx +74 -0
- package/dist/themes/default/navbar.jsx.map +1 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.d.ts +4 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.d.ts.map +1 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.jsx +22 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.jsx.map +1 -0
- package/dist/themes/default/navigation/sidebar-tree.d.ts +8 -0
- package/dist/themes/default/navigation/sidebar-tree.d.ts.map +1 -0
- package/dist/themes/default/navigation/sidebar-tree.jsx +100 -0
- package/dist/themes/default/navigation/sidebar-tree.jsx.map +1 -0
- package/dist/themes/default/overlays/search-dialog.d.ts +4 -0
- package/dist/themes/default/overlays/search-dialog.d.ts.map +1 -0
- package/dist/themes/default/overlays/search-dialog.jsx +34 -0
- package/dist/themes/default/overlays/search-dialog.jsx.map +1 -0
- package/dist/themes/default/sidebar.d.ts +4 -0
- package/dist/themes/default/sidebar.d.ts.map +1 -0
- package/dist/themes/default/sidebar.jsx +60 -0
- package/dist/themes/default/sidebar.jsx.map +1 -0
- package/dist/themes/index.d.ts +4 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +5 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/themes/types.d.ts +83 -0
- package/dist/themes/types.d.ts.map +1 -0
- package/dist/themes/types.js +2 -0
- package/dist/themes/types.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/vendor/core-src/index.css +11 -0
- package/dist/vendor/core-src/index.ts +48 -0
- package/dist/vendor/core-src/lib/cn.ts +9 -0
- package/dist/vendor/core-src/registry/blocks/forgot-password-01.tsx +141 -0
- package/dist/vendor/core-src/registry/blocks/hero-01.tsx +28 -0
- package/dist/vendor/core-src/registry/blocks/login-01.tsx +231 -0
- package/dist/vendor/core-src/registry/blocks/otp-verification-01.tsx +170 -0
- package/dist/vendor/core-src/registry/blocks/register-01.tsx +318 -0
- package/dist/vendor/core-src/registry/components/ui/accordion.tsx +128 -0
- package/dist/vendor/core-src/registry/components/ui/alert.tsx +155 -0
- package/dist/vendor/core-src/registry/components/ui/api-table.tsx +117 -0
- package/dist/vendor/core-src/registry/components/ui/aspect-ratio.tsx +31 -0
- package/dist/vendor/core-src/registry/components/ui/avatar.tsx +114 -0
- package/dist/vendor/core-src/registry/components/ui/badge.tsx +56 -0
- package/dist/vendor/core-src/registry/components/ui/banner.tsx +187 -0
- package/dist/vendor/core-src/registry/components/ui/breadcrumb.tsx +136 -0
- package/dist/vendor/core-src/registry/components/ui/bubble.tsx +142 -0
- package/dist/vendor/core-src/registry/components/ui/button-group.tsx +42 -0
- package/dist/vendor/core-src/registry/components/ui/button.tsx +82 -0
- package/dist/vendor/core-src/registry/components/ui/callout.tsx +137 -0
- package/dist/vendor/core-src/registry/components/ui/card.tsx +113 -0
- package/dist/vendor/core-src/registry/components/ui/checkbox.tsx +74 -0
- package/dist/vendor/core-src/registry/components/ui/code-block.tsx +326 -0
- package/dist/vendor/core-src/registry/components/ui/code-group.tsx +105 -0
- package/dist/vendor/core-src/registry/components/ui/collapsible.tsx +73 -0
- package/dist/vendor/core-src/registry/components/ui/combobox.tsx +299 -0
- package/dist/vendor/core-src/registry/components/ui/command.tsx +378 -0
- package/dist/vendor/core-src/registry/components/ui/component-viewer.tsx +363 -0
- package/dist/vendor/core-src/registry/components/ui/container.tsx +45 -0
- package/dist/vendor/core-src/registry/components/ui/context-menu.tsx +237 -0
- package/dist/vendor/core-src/registry/components/ui/dialog.tsx +200 -0
- package/dist/vendor/core-src/registry/components/ui/dropdown-menu.tsx +298 -0
- package/dist/vendor/core-src/registry/components/ui/dropzone.tsx +189 -0
- package/dist/vendor/core-src/registry/components/ui/empty.tsx +83 -0
- package/dist/vendor/core-src/registry/components/ui/field.tsx +71 -0
- package/dist/vendor/core-src/registry/components/ui/file-tree.tsx +181 -0
- package/dist/vendor/core-src/registry/components/ui/footer.tsx +247 -0
- package/dist/vendor/core-src/registry/components/ui/form-message.tsx +36 -0
- package/dist/vendor/core-src/registry/components/ui/form.tsx +21 -0
- package/dist/vendor/core-src/registry/components/ui/hover-card.tsx +105 -0
- package/dist/vendor/core-src/registry/components/ui/icon-button.tsx +34 -0
- package/dist/vendor/core-src/registry/components/ui/input-group.tsx +80 -0
- package/dist/vendor/core-src/registry/components/ui/input.tsx +28 -0
- package/dist/vendor/core-src/registry/components/ui/kbd.tsx +73 -0
- package/dist/vendor/core-src/registry/components/ui/label.tsx +30 -0
- package/dist/vendor/core-src/registry/components/ui/list.tsx +222 -0
- package/dist/vendor/core-src/registry/components/ui/logo.tsx +68 -0
- package/dist/vendor/core-src/registry/components/ui/marker.tsx +102 -0
- package/dist/vendor/core-src/registry/components/ui/marquee.tsx +118 -0
- package/dist/vendor/core-src/registry/components/ui/message.tsx +168 -0
- package/dist/vendor/core-src/registry/components/ui/navbar.tsx +375 -0
- package/dist/vendor/core-src/registry/components/ui/navigation-menu.tsx +358 -0
- package/dist/vendor/core-src/registry/components/ui/number-input.tsx +150 -0
- package/dist/vendor/core-src/registry/components/ui/package-manager-tabs.tsx +226 -0
- package/dist/vendor/core-src/registry/components/ui/pager.tsx +102 -0
- package/dist/vendor/core-src/registry/components/ui/pagination.tsx +258 -0
- package/dist/vendor/core-src/registry/components/ui/pin-input.tsx +198 -0
- package/dist/vendor/core-src/registry/components/ui/popover.tsx +90 -0
- package/dist/vendor/core-src/registry/components/ui/progress.tsx +66 -0
- package/dist/vendor/core-src/registry/components/ui/radio-group.tsx +95 -0
- package/dist/vendor/core-src/registry/components/ui/rating.tsx +185 -0
- package/dist/vendor/core-src/registry/components/ui/resizable.tsx +195 -0
- package/dist/vendor/core-src/registry/components/ui/review-card.tsx +195 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/bubble-menu.tsx +236 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/editor.tsx +308 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/extensions.ts +116 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/footer.tsx +36 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/image-dialog.tsx +75 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/index.ts +11 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/link-dialog.tsx +48 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/markdown.ts +170 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/slash-command.tsx +301 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/table-controls.tsx +68 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/toolbar.tsx +465 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/use-editor.ts +231 -0
- package/dist/vendor/core-src/registry/components/ui/scroll-area.tsx +228 -0
- package/dist/vendor/core-src/registry/components/ui/section-heading.tsx +108 -0
- package/dist/vendor/core-src/registry/components/ui/select.tsx +156 -0
- package/dist/vendor/core-src/registry/components/ui/separator.tsx +37 -0
- package/dist/vendor/core-src/registry/components/ui/sheet.tsx +220 -0
- package/dist/vendor/core-src/registry/components/ui/sidebar.tsx +692 -0
- package/dist/vendor/core-src/registry/components/ui/skeleton.tsx +24 -0
- package/dist/vendor/core-src/registry/components/ui/slider.tsx +153 -0
- package/dist/vendor/core-src/registry/components/ui/spinner.tsx +41 -0
- package/dist/vendor/core-src/registry/components/ui/stat.tsx +245 -0
- package/dist/vendor/core-src/registry/components/ui/status.tsx +121 -0
- package/dist/vendor/core-src/registry/components/ui/steps.tsx +198 -0
- package/dist/vendor/core-src/registry/components/ui/switch.tsx +68 -0
- package/dist/vendor/core-src/registry/components/ui/table-of-contents.tsx +131 -0
- package/dist/vendor/core-src/registry/components/ui/table.tsx +160 -0
- package/dist/vendor/core-src/registry/components/ui/tabs.tsx +204 -0
- package/dist/vendor/core-src/registry/components/ui/textarea.tsx +82 -0
- package/dist/vendor/core-src/registry/components/ui/theme-toggle.tsx +238 -0
- package/dist/vendor/core-src/registry/components/ui/timeline.tsx +350 -0
- package/dist/vendor/core-src/registry/components/ui/titlebar-tabs.tsx +773 -0
- package/dist/vendor/core-src/registry/components/ui/titlebar.tsx +468 -0
- package/dist/vendor/core-src/registry/components/ui/toast.tsx +124 -0
- package/dist/vendor/core-src/registry/components/ui/toggle-group.tsx +203 -0
- package/dist/vendor/core-src/registry/components/ui/toggle.tsx +101 -0
- package/dist/vendor/core-src/registry/components/ui/tooltip.tsx +41 -0
- package/dist/vendor/core-src/registry/components/ui/updater-modal.tsx +254 -0
- package/dist/vendor/core-src/registry/index.ts +50 -0
- package/dist/vendor/core-src/registry/metadata.ts +742 -0
- package/dist/vendor/core-src/registry/providers/theme-provider.tsx +216 -0
- package/dist/vendor/core-src/registry/providers/theme-script.tsx +78 -0
- package/dist/vendor/core-src/registry/providers/theme-transitions.ts +139 -0
- package/dist/vendor/hooks-src/create-active-element.ts +51 -0
- package/dist/vendor/hooks-src/create-app-updater.ts +272 -0
- package/dist/vendor/hooks-src/create-audio-video.ts +444 -0
- package/dist/vendor/hooks-src/create-battery.ts +78 -0
- package/dist/vendor/hooks-src/create-chat-scroll.ts +113 -0
- package/dist/vendor/hooks-src/create-click-outside.ts +82 -0
- package/dist/vendor/hooks-src/create-clipboard.ts +69 -0
- package/dist/vendor/hooks-src/create-color-mode.ts +115 -0
- package/dist/vendor/hooks-src/create-controllable-signal.ts +56 -0
- package/dist/vendor/hooks-src/create-debounce.ts +90 -0
- package/dist/vendor/hooks-src/create-disclosure.ts +82 -0
- package/dist/vendor/hooks-src/create-document-tabs.ts +267 -0
- package/dist/vendor/hooks-src/create-document-title.ts +33 -0
- package/dist/vendor/hooks-src/create-drop-zone.ts +317 -0
- package/dist/vendor/hooks-src/create-event-source.ts +126 -0
- package/dist/vendor/hooks-src/create-favicon.ts +52 -0
- package/dist/vendor/hooks-src/create-fetch.ts +93 -0
- package/dist/vendor/hooks-src/create-focus-trap.ts +94 -0
- package/dist/vendor/hooks-src/create-form.ts +200 -0
- package/dist/vendor/hooks-src/create-fullscreen.ts +105 -0
- package/dist/vendor/hooks-src/create-geolocation.ts +140 -0
- package/dist/vendor/hooks-src/create-global-shortcut.ts +140 -0
- package/dist/vendor/hooks-src/create-hover.ts +88 -0
- package/dist/vendor/hooks-src/create-idle.ts +109 -0
- package/dist/vendor/hooks-src/create-infinite-scroll.ts +90 -0
- package/dist/vendor/hooks-src/create-input-mask.ts +109 -0
- package/dist/vendor/hooks-src/create-intersection-observer.ts +82 -0
- package/dist/vendor/hooks-src/create-keybindings.ts +148 -0
- package/dist/vendor/hooks-src/create-lock-scroll.ts +97 -0
- package/dist/vendor/hooks-src/create-long-press.ts +85 -0
- package/dist/vendor/hooks-src/create-media-query.ts +94 -0
- package/dist/vendor/hooks-src/create-mouse-position.ts +87 -0
- package/dist/vendor/hooks-src/create-network-status.ts +100 -0
- package/dist/vendor/hooks-src/create-orientation.ts +129 -0
- package/dist/vendor/hooks-src/create-pagination.ts +208 -0
- package/dist/vendor/hooks-src/create-permission.ts +91 -0
- package/dist/vendor/hooks-src/create-previous.ts +21 -0
- package/dist/vendor/hooks-src/create-resize-observer.ts +89 -0
- package/dist/vendor/hooks-src/create-scroll-into-view.ts +57 -0
- package/dist/vendor/hooks-src/create-scroll-position.ts +129 -0
- package/dist/vendor/hooks-src/create-storage.ts +106 -0
- package/dist/vendor/hooks-src/create-tauri-window.ts +628 -0
- package/dist/vendor/hooks-src/create-timer.ts +150 -0
- package/dist/vendor/hooks-src/create-tiptap-editor.ts +326 -0
- package/dist/vendor/hooks-src/create-undo-redo.ts +100 -0
- package/dist/vendor/hooks-src/create-web-notification.ts +111 -0
- package/dist/vendor/hooks-src/create-websocket.ts +179 -0
- package/dist/vendor/hooks-src/create-window-size.ts +41 -0
- package/dist/vendor/hooks-src/index.ts +48 -0
- package/package.json +87 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSignal,
|
|
3
|
+
createMemo,
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
type JSX,
|
|
7
|
+
} from "solid-js";
|
|
8
|
+
import { cn } from "@/lib/cn";
|
|
9
|
+
|
|
10
|
+
export type PinInputType = "numeric" | "alphanumeric";
|
|
11
|
+
|
|
12
|
+
export interface PinInputContextValue {
|
|
13
|
+
value: () => string;
|
|
14
|
+
setValue: (val: string) => void;
|
|
15
|
+
mask: () => boolean;
|
|
16
|
+
disabled: () => boolean;
|
|
17
|
+
length: () => number;
|
|
18
|
+
type: () => PinInputType;
|
|
19
|
+
containerRef: HTMLDivElement | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const PinInputContext = createContext<PinInputContextValue>();
|
|
23
|
+
|
|
24
|
+
export interface PinInputProps {
|
|
25
|
+
value?: string;
|
|
26
|
+
onValueChange?: (value: string) => void;
|
|
27
|
+
length?: number;
|
|
28
|
+
type?: PinInputType;
|
|
29
|
+
mask?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
class?: string;
|
|
32
|
+
children?: JSX.Element;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Root PinInput component for 4 or 6-digit OTP / verification PIN codes.
|
|
37
|
+
*/
|
|
38
|
+
export const PinInput = (props: PinInputProps) => {
|
|
39
|
+
let containerRef: HTMLDivElement | undefined;
|
|
40
|
+
const [internalValue, setInternalValue] = createSignal(props.value ?? "");
|
|
41
|
+
|
|
42
|
+
const value = () => props.value ?? internalValue();
|
|
43
|
+
const mask = () => props.mask ?? false;
|
|
44
|
+
const disabled = () => props.disabled ?? false;
|
|
45
|
+
const length = () => props.length ?? 6;
|
|
46
|
+
|
|
47
|
+
const inputType = (): PinInputType => {
|
|
48
|
+
const t = props.type ?? "numeric";
|
|
49
|
+
if (t !== "numeric" && t !== "alphanumeric") {
|
|
50
|
+
return "numeric";
|
|
51
|
+
}
|
|
52
|
+
return t;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleValueChange = (val: string) => {
|
|
56
|
+
setInternalValue(val);
|
|
57
|
+
props.onValueChange?.(val);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const contextValue: PinInputContextValue = {
|
|
61
|
+
value,
|
|
62
|
+
setValue: handleValueChange,
|
|
63
|
+
mask,
|
|
64
|
+
disabled,
|
|
65
|
+
length,
|
|
66
|
+
type: inputType,
|
|
67
|
+
get containerRef() {
|
|
68
|
+
return containerRef;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<PinInputContext.Provider value={contextValue}>
|
|
74
|
+
<div ref={containerRef} class={cn("flex items-center gap-2", props.class)}>
|
|
75
|
+
{props.children}
|
|
76
|
+
</div>
|
|
77
|
+
</PinInputContext.Provider>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export interface PinInputLabelProps {
|
|
82
|
+
class?: string;
|
|
83
|
+
children?: JSX.Element;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Accessible label for PinInput.
|
|
88
|
+
*/
|
|
89
|
+
export const PinInputLabel = (props: PinInputLabelProps) => {
|
|
90
|
+
return (
|
|
91
|
+
<label class={cn("text-sm font-medium leading-none text-foreground", props.class)}>
|
|
92
|
+
{props.children}
|
|
93
|
+
</label>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const focusIndex = (containerRef: HTMLDivElement | undefined, index: number) => {
|
|
98
|
+
const el = containerRef?.querySelector<HTMLInputElement>(
|
|
99
|
+
`[data-pin-input-index="${index}"]`
|
|
100
|
+
);
|
|
101
|
+
el?.focus();
|
|
102
|
+
el?.select();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export interface PinInputInputProps {
|
|
106
|
+
index: number;
|
|
107
|
+
class?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Individual input slot for a single OTP digit/character.
|
|
112
|
+
*/
|
|
113
|
+
export const PinInputInput = (props: PinInputInputProps) => {
|
|
114
|
+
const ctx = useContext(PinInputContext);
|
|
115
|
+
const digit = createMemo(() => ctx?.value()[props.index] ?? "");
|
|
116
|
+
|
|
117
|
+
const isCharAllowed = (char: string) => {
|
|
118
|
+
if (!ctx || char === "") return false;
|
|
119
|
+
return ctx.type() === "numeric"
|
|
120
|
+
? /^[0-9]$/.test(char)
|
|
121
|
+
: /^[a-zA-Z0-9]$/.test(char);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const commitChar = (char: string) => {
|
|
125
|
+
if (!ctx) return;
|
|
126
|
+
const currentArray = ctx.value().split("");
|
|
127
|
+
while (currentArray.length < props.index) currentArray.push("");
|
|
128
|
+
currentArray[props.index] = char;
|
|
129
|
+
ctx.setValue(currentArray.join(""));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const handleInput = (e: InputEvent & { currentTarget: HTMLInputElement }) => {
|
|
133
|
+
if (!ctx || ctx.disabled()) return;
|
|
134
|
+
const val = e.currentTarget.value;
|
|
135
|
+
const rawChar = val ? val[val.length - 1] : "";
|
|
136
|
+
|
|
137
|
+
// Clear digit if input is empty
|
|
138
|
+
if (rawChar === "") {
|
|
139
|
+
commitChar("");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!isCharAllowed(rawChar)) {
|
|
144
|
+
e.currentTarget.value = digit();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
commitChar(rawChar);
|
|
149
|
+
|
|
150
|
+
if (props.index < ctx.length() - 1) {
|
|
151
|
+
focusIndex(ctx.containerRef, props.index + 1);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
156
|
+
if (!ctx || ctx.disabled()) return;
|
|
157
|
+
if (e.key === "Backspace" && digit() === "" && props.index > 0) {
|
|
158
|
+
focusIndex(ctx.containerRef, props.index - 1);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const handlePaste = (e: ClipboardEvent & { currentTarget: HTMLInputElement }) => {
|
|
163
|
+
if (!ctx || ctx.disabled()) return;
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
const pasted = e.clipboardData?.getData("text") ?? "";
|
|
166
|
+
const chars = pasted.split("").filter(isCharAllowed);
|
|
167
|
+
if (chars.length === 0) return;
|
|
168
|
+
|
|
169
|
+
const currentArray = ctx.value().split("");
|
|
170
|
+
let lastFilled = props.index;
|
|
171
|
+
for (let i = 0; i < chars.length && props.index + i < ctx.length(); i++) {
|
|
172
|
+
while (currentArray.length < props.index + i) currentArray.push("");
|
|
173
|
+
currentArray[props.index + i] = chars[i];
|
|
174
|
+
lastFilled = props.index + i;
|
|
175
|
+
}
|
|
176
|
+
ctx.setValue(currentArray.join(""));
|
|
177
|
+
focusIndex(ctx.containerRef, Math.min(lastFilled + 1, ctx.length() - 1));
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<input
|
|
182
|
+
type={ctx?.mask() ? "password" : "text"}
|
|
183
|
+
inputMode={ctx?.type() === "numeric" ? "numeric" : "text"}
|
|
184
|
+
autocomplete="one-time-code"
|
|
185
|
+
maxLength={1}
|
|
186
|
+
disabled={ctx?.disabled()}
|
|
187
|
+
data-pin-input-index={props.index}
|
|
188
|
+
value={digit()}
|
|
189
|
+
onInput={handleInput}
|
|
190
|
+
onKeyDown={handleKeyDown}
|
|
191
|
+
onPaste={handlePaste}
|
|
192
|
+
class={cn(
|
|
193
|
+
"relative flex h-10 w-10 text-center text-sm font-semibold rounded-md border border-input bg-background shadow-xs transition-all focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-50",
|
|
194
|
+
props.class
|
|
195
|
+
)}
|
|
196
|
+
/>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { splitProps, type Component, type ComponentProps } from "solid-js";
|
|
2
|
+
import { Popover as KobaltePopover } from "@kobalte/core/popover";
|
|
3
|
+
import { createClickOutside } from "@/hooks/create-click-outside";
|
|
4
|
+
import { X } from "lucide-solid";
|
|
5
|
+
import { cn } from "@/lib/cn";
|
|
6
|
+
|
|
7
|
+
export const Popover = KobaltePopover;
|
|
8
|
+
|
|
9
|
+
export const PopoverTrigger = KobaltePopover.Trigger;
|
|
10
|
+
|
|
11
|
+
export const PopoverArrow: Component<ComponentProps<typeof KobaltePopover.Arrow>> = (props) => {
|
|
12
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<KobaltePopover.Arrow
|
|
16
|
+
class={cn("fill-popover stroke-border", local.class)}
|
|
17
|
+
{...rest}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const PopoverContent: Component<ComponentProps<typeof KobaltePopover.Content>> = (props) => {
|
|
23
|
+
const [local, rest] = splitProps(props, ["class", "children", "onInteractOutside"]);
|
|
24
|
+
let contentRef: HTMLElement | undefined;
|
|
25
|
+
|
|
26
|
+
createClickOutside({
|
|
27
|
+
target: () => contentRef,
|
|
28
|
+
onInteractOutside: (e) => {
|
|
29
|
+
if (typeof local.onInteractOutside === "function") {
|
|
30
|
+
local.onInteractOutside(e as any);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<KobaltePopover.Portal>
|
|
37
|
+
<KobaltePopover.Content
|
|
38
|
+
ref={(el) => {
|
|
39
|
+
contentRef = el;
|
|
40
|
+
if (typeof (props as any).ref === "function") (props as any).ref(el);
|
|
41
|
+
}}
|
|
42
|
+
class={cn(
|
|
43
|
+
"z-50 w-72 rounded-lg border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none data-expanded:animate-in data-closed:animate-out data-[closed]:fade-out-0 data-[expanded]:fade-in-0 data-closed:zoom-out-95 data-expanded:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
44
|
+
local.class
|
|
45
|
+
)}
|
|
46
|
+
{...rest}
|
|
47
|
+
>
|
|
48
|
+
{local.children}
|
|
49
|
+
</KobaltePopover.Content>
|
|
50
|
+
</KobaltePopover.Portal>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const PopoverTitle: Component<ComponentProps<typeof KobaltePopover.Title>> = (props) => {
|
|
55
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<KobaltePopover.Title
|
|
59
|
+
class={cn("text-sm font-semibold text-foreground", local.class)}
|
|
60
|
+
{...rest}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PopoverDescription: Component<ComponentProps<typeof KobaltePopover.Description>> = (props) => {
|
|
66
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<KobaltePopover.Description
|
|
70
|
+
class={cn("text-sm text-muted-foreground", local.class)}
|
|
71
|
+
{...rest}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const PopoverCloseButton: Component<ComponentProps<typeof KobaltePopover.CloseButton>> = (props) => {
|
|
77
|
+
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<KobaltePopover.CloseButton
|
|
81
|
+
class={cn(
|
|
82
|
+
"absolute right-2 top-2 rounded-md p-1 opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",
|
|
83
|
+
local.class
|
|
84
|
+
)}
|
|
85
|
+
{...rest}
|
|
86
|
+
>
|
|
87
|
+
{local.children || <X class="h-4 w-4 text-muted-foreground" />}
|
|
88
|
+
</KobaltePopover.CloseButton>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { splitProps, Show, type Component, type JSX } from "solid-js";
|
|
2
|
+
import { Progress as KobalteProgress } from "@kobalte/core/progress";
|
|
3
|
+
import { cn } from "@/lib/cn";
|
|
4
|
+
|
|
5
|
+
export interface ProgressProps
|
|
6
|
+
extends Omit<
|
|
7
|
+
JSX.HTMLAttributes<HTMLDivElement>,
|
|
8
|
+
"value" | "aria-valuenow" | "aria-valuemin" | "aria-valuemax"
|
|
9
|
+
> {
|
|
10
|
+
/** The current numeric progress value. */
|
|
11
|
+
value?: number;
|
|
12
|
+
/** Minimum progress value. Defaults to 0. */
|
|
13
|
+
minValue?: number;
|
|
14
|
+
/** Maximum progress value. Defaults to 100. */
|
|
15
|
+
maxValue?: number;
|
|
16
|
+
/** Label text for accessibility and screen readers. */
|
|
17
|
+
getValueLabel?: (params: { value: number; max: number }) => string;
|
|
18
|
+
/** Custom label element to display above or beside progress bar. */
|
|
19
|
+
label?: JSX.Element;
|
|
20
|
+
/** Optional custom class for root container. */
|
|
21
|
+
class?: string;
|
|
22
|
+
/** Optional custom class for indicator fill bar. */
|
|
23
|
+
indicatorClass?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Nikala UI Progress component for showing task completion status or media timeline positions.
|
|
28
|
+
*/
|
|
29
|
+
export const Progress: Component<ProgressProps> = (props) => {
|
|
30
|
+
const [local, rest] = splitProps(props, [
|
|
31
|
+
"value",
|
|
32
|
+
"minValue",
|
|
33
|
+
"maxValue",
|
|
34
|
+
"getValueLabel",
|
|
35
|
+
"label",
|
|
36
|
+
"class",
|
|
37
|
+
"indicatorClass",
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<KobalteProgress
|
|
42
|
+
value={local.value ?? 0}
|
|
43
|
+
minValue={local.minValue ?? 0}
|
|
44
|
+
maxValue={local.maxValue ?? 100}
|
|
45
|
+
getValueLabel={local.getValueLabel}
|
|
46
|
+
class={cn("flex w-full flex-col gap-1.5", local.class)}
|
|
47
|
+
{...rest}
|
|
48
|
+
>
|
|
49
|
+
<Show when={local.label}>
|
|
50
|
+
<div class="flex justify-between text-xs font-medium text-muted-foreground">
|
|
51
|
+
<KobalteProgress.Label>{local.label}</KobalteProgress.Label>
|
|
52
|
+
<KobalteProgress.ValueLabel class="font-mono text-foreground" />
|
|
53
|
+
</div>
|
|
54
|
+
</Show>
|
|
55
|
+
|
|
56
|
+
<KobalteProgress.Track class="relative h-2 w-full overflow-hidden rounded-lg bg-primary/20">
|
|
57
|
+
<KobalteProgress.Fill
|
|
58
|
+
class={cn(
|
|
59
|
+
"h-full w-(--kb-progress-fill-width) bg-primary transition-all duration-300 ease-in-out",
|
|
60
|
+
local.indicatorClass
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
</KobalteProgress.Track>
|
|
64
|
+
</KobalteProgress>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { splitProps, type JSX, type ValidComponent } from "solid-js";
|
|
2
|
+
import * as RadioGroupPrimitive from "@kobalte/core/radio-group";
|
|
3
|
+
import type { PolymorphicProps } from "@kobalte/core/polymorphic";
|
|
4
|
+
import { cn } from "@/lib/cn";
|
|
5
|
+
|
|
6
|
+
export type RadioGroupRootProps<T extends ValidComponent = "div"> =
|
|
7
|
+
RadioGroupPrimitive.RadioGroupRootProps<T> & {
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Root RadioGroup component built on top of Kobalte headless primitives.
|
|
13
|
+
* Supports both "vertical" (default) and "horizontal" layout orientations.
|
|
14
|
+
*/
|
|
15
|
+
export const RadioGroup = <T extends ValidComponent = "div">(
|
|
16
|
+
props: PolymorphicProps<T, RadioGroupRootProps<T>>
|
|
17
|
+
) => {
|
|
18
|
+
const [local, rest] = splitProps(props as RadioGroupRootProps, ["class", "orientation"]);
|
|
19
|
+
|
|
20
|
+
const isHorizontal = () => local.orientation === "horizontal";
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<RadioGroupPrimitive.Root
|
|
24
|
+
orientation={local.orientation || "vertical"}
|
|
25
|
+
class={cn(
|
|
26
|
+
isHorizontal()
|
|
27
|
+
? "flex flex-row items-center gap-4"
|
|
28
|
+
: "grid gap-2",
|
|
29
|
+
local.class
|
|
30
|
+
)}
|
|
31
|
+
{...(rest as any)}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type RadioGroupItemProps<T extends ValidComponent = "div"> =
|
|
37
|
+
RadioGroupPrimitive.RadioGroupItemProps<T> & {
|
|
38
|
+
class?: string;
|
|
39
|
+
children?: JSX.Element;
|
|
40
|
+
id?: string;
|
|
41
|
+
value: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Accessible RadioGroup item choice wrapping Kobalte primitives.
|
|
46
|
+
*/
|
|
47
|
+
export const RadioGroupItem = <T extends ValidComponent = "div">(
|
|
48
|
+
props: PolymorphicProps<T, RadioGroupItemProps<T>>
|
|
49
|
+
) => {
|
|
50
|
+
const [local, rest] = splitProps(props as RadioGroupItemProps, ["class", "children"]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<RadioGroupPrimitive.Item
|
|
54
|
+
class={cn("flex items-center space-x-2 cursor-pointer", local.class)}
|
|
55
|
+
{...rest}
|
|
56
|
+
>
|
|
57
|
+
<RadioGroupPrimitive.ItemInput />
|
|
58
|
+
<RadioGroupPrimitive.ItemControl
|
|
59
|
+
class={cn(
|
|
60
|
+
"aspect-square h-4 w-4 rounded-lg border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 flex items-center justify-center transition-colors data-[checked]:bg-primary data-[checked]:text-primary-foreground"
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
<RadioGroupPrimitive.ItemIndicator class="flex items-center justify-center">
|
|
64
|
+
<span class="h-2 w-2 rounded-lg bg-primary-foreground" />
|
|
65
|
+
</RadioGroupPrimitive.ItemIndicator>
|
|
66
|
+
</RadioGroupPrimitive.ItemControl>
|
|
67
|
+
{local.children}
|
|
68
|
+
</RadioGroupPrimitive.Item>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type RadioGroupItemLabelProps<T extends ValidComponent = "label"> =
|
|
73
|
+
RadioGroupPrimitive.RadioGroupItemLabelProps<T> & {
|
|
74
|
+
class?: string;
|
|
75
|
+
children?: JSX.Element;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Accessible text label for a RadioGroup item.
|
|
80
|
+
*/
|
|
81
|
+
export const RadioGroupItemLabel = <T extends ValidComponent = "label">(
|
|
82
|
+
props: PolymorphicProps<T, RadioGroupItemLabelProps<T>>
|
|
83
|
+
) => {
|
|
84
|
+
const [local, rest] = splitProps(props as RadioGroupItemLabelProps, ["class"]);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<RadioGroupPrimitive.ItemLabel
|
|
88
|
+
class={cn(
|
|
89
|
+
"text-sm font-medium leading-none select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-foreground",
|
|
90
|
+
local.class
|
|
91
|
+
)}
|
|
92
|
+
{...rest}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSignal,
|
|
3
|
+
splitProps,
|
|
4
|
+
For,
|
|
5
|
+
type JSX,
|
|
6
|
+
type Component,
|
|
7
|
+
} from "solid-js";
|
|
8
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
9
|
+
import { Star } from "lucide-solid";
|
|
10
|
+
import { cn } from "@/lib/cn";
|
|
11
|
+
|
|
12
|
+
export const ratingVariants = cva(
|
|
13
|
+
"inline-flex items-center select-none transition-colors",
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
sm: "gap-0.5",
|
|
18
|
+
default: "gap-1",
|
|
19
|
+
lg: "gap-1.5",
|
|
20
|
+
},
|
|
21
|
+
variant: {
|
|
22
|
+
yellow: "text-amber-500 dark:text-amber-400",
|
|
23
|
+
primary: "text-primary",
|
|
24
|
+
destructive: "text-destructive",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
size: "default",
|
|
29
|
+
variant: "yellow",
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export const ratingStarVariants = cva(
|
|
35
|
+
"transition-all duration-150 shrink-0",
|
|
36
|
+
{
|
|
37
|
+
variants: {
|
|
38
|
+
size: {
|
|
39
|
+
sm: "size-3.5",
|
|
40
|
+
default: "size-4.5",
|
|
41
|
+
lg: "size-6",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
size: "default",
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export interface RatingProps
|
|
51
|
+
extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "onChange">,
|
|
52
|
+
VariantProps<typeof ratingVariants> {
|
|
53
|
+
value?: number;
|
|
54
|
+
defaultValue?: number;
|
|
55
|
+
max?: number;
|
|
56
|
+
readOnly?: boolean;
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
class?: string;
|
|
59
|
+
starClass?: string;
|
|
60
|
+
onChange?: (value: number) => void;
|
|
61
|
+
onHover?: (value: number | null) => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Rating: Component<RatingProps> = (props) => {
|
|
65
|
+
const [local, rest] = splitProps(props, [
|
|
66
|
+
"value",
|
|
67
|
+
"defaultValue",
|
|
68
|
+
"max",
|
|
69
|
+
"readOnly",
|
|
70
|
+
"disabled",
|
|
71
|
+
"size",
|
|
72
|
+
"variant",
|
|
73
|
+
"class",
|
|
74
|
+
"starClass",
|
|
75
|
+
"onChange",
|
|
76
|
+
"onHover",
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
const [internalValue, setInternalValue] = createSignal(
|
|
80
|
+
local.defaultValue ?? 0
|
|
81
|
+
);
|
|
82
|
+
const [hoverValue, setHoverValue] = createSignal<number | null>(null);
|
|
83
|
+
|
|
84
|
+
const currentValue = () =>
|
|
85
|
+
local.value !== undefined ? local.value : internalValue();
|
|
86
|
+
|
|
87
|
+
const maxStars = () => local.max ?? 5;
|
|
88
|
+
const isInteractive = () => !local.readOnly && !local.disabled;
|
|
89
|
+
|
|
90
|
+
const stars = () => Array.from({ length: maxStars() }, (_, i) => i + 1);
|
|
91
|
+
|
|
92
|
+
const handleSelect = (starValue: number) => {
|
|
93
|
+
if (!isInteractive()) return;
|
|
94
|
+
if (local.value === undefined) {
|
|
95
|
+
setInternalValue(starValue);
|
|
96
|
+
}
|
|
97
|
+
local.onChange?.(starValue);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const handleMouseEnter = (starValue: number) => {
|
|
101
|
+
if (!isInteractive()) return;
|
|
102
|
+
setHoverValue(starValue);
|
|
103
|
+
local.onHover?.(starValue);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const handleMouseLeave = () => {
|
|
107
|
+
if (!isInteractive()) return;
|
|
108
|
+
setHoverValue(null);
|
|
109
|
+
local.onHover?.(null);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
113
|
+
if (!isInteractive()) return;
|
|
114
|
+
|
|
115
|
+
const val = currentValue();
|
|
116
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
const next = Math.min(maxStars(), val + 1);
|
|
119
|
+
handleSelect(next);
|
|
120
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
const prev = Math.max(1, val - 1);
|
|
123
|
+
handleSelect(prev);
|
|
124
|
+
} else if (e.key === "Home") {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
handleSelect(1);
|
|
127
|
+
} else if (e.key === "End") {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
handleSelect(maxStars());
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<div
|
|
135
|
+
role={isInteractive() ? "radiogroup" : "img"}
|
|
136
|
+
aria-label={`Rating: ${currentValue()} of ${maxStars()} stars`}
|
|
137
|
+
tabIndex={isInteractive() ? 0 : undefined}
|
|
138
|
+
onKeyDown={handleKeyDown}
|
|
139
|
+
onMouseLeave={handleMouseLeave}
|
|
140
|
+
class={cn(
|
|
141
|
+
ratingVariants({ size: local.size, variant: local.variant }),
|
|
142
|
+
local.disabled && "opacity-50 cursor-not-allowed",
|
|
143
|
+
isInteractive() && "cursor-pointer focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-md",
|
|
144
|
+
local.class
|
|
145
|
+
)}
|
|
146
|
+
{...rest}
|
|
147
|
+
>
|
|
148
|
+
<For each={stars()}>
|
|
149
|
+
{(star) => {
|
|
150
|
+
const isFilled = () => {
|
|
151
|
+
const active = hoverValue() !== null ? hoverValue()! : currentValue();
|
|
152
|
+
return star <= active;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<button
|
|
157
|
+
type="button"
|
|
158
|
+
disabled={local.disabled || local.readOnly}
|
|
159
|
+
tabIndex={-1}
|
|
160
|
+
aria-label={`${star} star${star > 1 ? "s" : ""}`}
|
|
161
|
+
onClick={() => handleSelect(star)}
|
|
162
|
+
onMouseEnter={() => handleMouseEnter(star)}
|
|
163
|
+
class={cn(
|
|
164
|
+
"p-0.5 border-0 bg-transparent transition-transform focus:outline-hidden",
|
|
165
|
+
isInteractive() && "hover:scale-115 active:scale-95 cursor-pointer",
|
|
166
|
+
local.readOnly && "cursor-default",
|
|
167
|
+
local.disabled && "cursor-not-allowed"
|
|
168
|
+
)}
|
|
169
|
+
>
|
|
170
|
+
<Star
|
|
171
|
+
class={cn(
|
|
172
|
+
ratingStarVariants({ size: local.size }),
|
|
173
|
+
isFilled()
|
|
174
|
+
? "fill-current"
|
|
175
|
+
: "text-muted-foreground/30 fill-transparent",
|
|
176
|
+
local.starClass
|
|
177
|
+
)}
|
|
178
|
+
/>
|
|
179
|
+
</button>
|
|
180
|
+
);
|
|
181
|
+
}}
|
|
182
|
+
</For>
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
};
|