@nikala-ui/folio 0.13.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/LICENSE +20 -0
- package/README.md +221 -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 +28 -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 +33 -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 +359 -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 +25 -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 +34 -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 +55 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/app-types.d.ts +18 -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/app.d.ts +5 -0
- package/dist/client/app.d.ts.map +1 -0
- package/dist/client/app.jsx +51 -0
- package/dist/client/app.jsx.map +1 -0
- package/dist/client/base.css +90 -0
- package/dist/client/components/docs-layout-shell.d.ts +23 -0
- package/dist/client/components/docs-layout-shell.d.ts.map +1 -0
- package/dist/client/components/docs-layout-shell.jsx +15 -0
- package/dist/client/components/docs-layout-shell.jsx.map +1 -0
- package/dist/client/components/docs-page-content.d.ts +9 -0
- package/dist/client/components/docs-page-content.d.ts.map +1 -0
- package/dist/client/components/docs-page-content.jsx +10 -0
- package/dist/client/components/docs-page-content.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 +32 -0
- package/dist/client/entry.jsx.map +1 -0
- package/dist/client/index.html +23 -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/page-actions.d.ts +10 -0
- package/dist/client/page-actions.d.ts.map +1 -0
- package/dist/client/page-actions.js +63 -0
- package/dist/client/page-actions.js.map +1 -0
- package/dist/client/public/favicon.ico +0 -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 +87 -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 +186 -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 +65 -0
- package/dist/components/mdx-components.d.ts.map +1 -0
- package/dist/components/mdx-components.jsx +133 -0
- package/dist/components/mdx-components.jsx.map +1 -0
- package/dist/components/ui/api-table.d.ts +29 -0
- package/dist/components/ui/api-table.d.ts.map +1 -0
- package/dist/components/ui/api-table.jsx +66 -0
- package/dist/components/ui/api-table.jsx.map +1 -0
- package/dist/components/ui/badge.d.ts +17 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.jsx +33 -0
- package/dist/components/ui/badge.jsx.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +51 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.jsx +62 -0
- package/dist/components/ui/breadcrumb.jsx.map +1 -0
- package/dist/components/ui/button.d.ts +19 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.jsx +54 -0
- package/dist/components/ui/button.jsx.map +1 -0
- package/dist/components/ui/callout.d.ts +21 -0
- package/dist/components/ui/callout.d.ts.map +1 -0
- package/dist/components/ui/callout.jsx +76 -0
- package/dist/components/ui/callout.jsx.map +1 -0
- package/dist/components/ui/card.d.ts +44 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.jsx +45 -0
- package/dist/components/ui/card.jsx.map +1 -0
- package/dist/components/ui/code-block.d.ts +23 -0
- package/dist/components/ui/code-block.d.ts.map +1 -0
- package/dist/components/ui/code-block.jsx +263 -0
- package/dist/components/ui/code-block.jsx.map +1 -0
- package/dist/components/ui/collapsible.d.ts +27 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.jsx +29 -0
- package/dist/components/ui/collapsible.jsx.map +1 -0
- package/dist/components/ui/command.d.ts +57 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.jsx +224 -0
- package/dist/components/ui/command.jsx.map +1 -0
- package/dist/components/ui/component-viewer.d.ts +33 -0
- package/dist/components/ui/component-viewer.d.ts.map +1 -0
- package/dist/components/ui/component-viewer.jsx +210 -0
- package/dist/components/ui/component-viewer.jsx.map +1 -0
- package/dist/components/ui/container.d.ts +13 -0
- package/dist/components/ui/container.d.ts.map +1 -0
- package/dist/components/ui/container.jsx +29 -0
- package/dist/components/ui/container.jsx.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +58 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.jsx +112 -0
- package/dist/components/ui/dropdown-menu.jsx.map +1 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.jsx +33 -0
- package/dist/components/ui/input-group.jsx.map +1 -0
- package/dist/components/ui/kbd.d.ts +15 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.jsx +42 -0
- package/dist/components/ui/kbd.jsx.map +1 -0
- package/dist/components/ui/list.d.ts +36 -0
- package/dist/components/ui/list.d.ts.map +1 -0
- package/dist/components/ui/list.jsx +131 -0
- package/dist/components/ui/list.jsx.map +1 -0
- package/dist/components/ui/logo.d.ts +9 -0
- package/dist/components/ui/logo.d.ts.map +1 -0
- package/dist/components/ui/logo.jsx +31 -0
- package/dist/components/ui/logo.jsx.map +1 -0
- package/dist/components/ui/navbar.d.ts +57 -0
- package/dist/components/ui/navbar.d.ts.map +1 -0
- package/dist/components/ui/navbar.jsx +174 -0
- package/dist/components/ui/navbar.jsx.map +1 -0
- package/dist/components/ui/package-manager-tabs.d.ts +21 -0
- package/dist/components/ui/package-manager-tabs.d.ts.map +1 -0
- package/dist/components/ui/package-manager-tabs.jsx +167 -0
- package/dist/components/ui/package-manager-tabs.jsx.map +1 -0
- package/dist/components/ui/pager.d.ts +27 -0
- package/dist/components/ui/pager.d.ts.map +1 -0
- package/dist/components/ui/pager.jsx +50 -0
- package/dist/components/ui/pager.jsx.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +9 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.jsx +160 -0
- package/dist/components/ui/scroll-area.jsx.map +1 -0
- package/dist/components/ui/section-heading.d.ts +23 -0
- package/dist/components/ui/section-heading.d.ts.map +1 -0
- package/dist/components/ui/section-heading.jsx +82 -0
- package/dist/components/ui/section-heading.jsx.map +1 -0
- package/dist/components/ui/separator.d.ts +13 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.jsx +16 -0
- package/dist/components/ui/separator.jsx.map +1 -0
- package/dist/components/ui/sidebar.d.ts +103 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.jsx +315 -0
- package/dist/components/ui/sidebar.jsx.map +1 -0
- package/dist/components/ui/skeleton.d.ts +9 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.jsx +11 -0
- package/dist/components/ui/skeleton.jsx.map +1 -0
- package/dist/components/ui/spinner.d.ts +11 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.jsx +21 -0
- package/dist/components/ui/spinner.jsx.map +1 -0
- package/dist/components/ui/table-of-contents.d.ts +20 -0
- package/dist/components/ui/table-of-contents.d.ts.map +1 -0
- package/dist/components/ui/table-of-contents.jsx +77 -0
- package/dist/components/ui/table-of-contents.jsx.map +1 -0
- package/dist/components/ui/table.d.ts +58 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.jsx +61 -0
- package/dist/components/ui/table.jsx.map +1 -0
- package/dist/components/ui/tabs.d.ts +42 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.jsx +93 -0
- package/dist/components/ui/tabs.jsx.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +19 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.jsx +142 -0
- package/dist/components/ui/theme-toggle.jsx.map +1 -0
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.jsx +18 -0
- package/dist/components/ui/tooltip.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 +218 -0
- package/dist/core/content-scanner.js.map +1 -0
- package/dist/core/route-tree.d.ts +24 -0
- package/dist/core/route-tree.d.ts.map +1 -0
- package/dist/core/route-tree.js +221 -0
- package/dist/core/route-tree.js.map +1 -0
- package/dist/hooks/create-click-outside.d.ts +18 -0
- package/dist/hooks/create-click-outside.d.ts.map +1 -0
- package/dist/hooks/create-click-outside.js +55 -0
- package/dist/hooks/create-click-outside.js.map +1 -0
- package/dist/hooks/create-clipboard.d.ts +20 -0
- package/dist/hooks/create-clipboard.d.ts.map +1 -0
- package/dist/hooks/create-clipboard.js +48 -0
- package/dist/hooks/create-clipboard.js.map +1 -0
- package/dist/hooks/create-color-mode.d.ts +27 -0
- package/dist/hooks/create-color-mode.d.ts.map +1 -0
- package/dist/hooks/create-color-mode.js +86 -0
- package/dist/hooks/create-color-mode.js.map +1 -0
- package/dist/hooks/create-controllable-signal.d.ts +17 -0
- package/dist/hooks/create-controllable-signal.d.ts.map +1 -0
- package/dist/hooks/create-controllable-signal.js +35 -0
- package/dist/hooks/create-controllable-signal.js.map +1 -0
- package/dist/hooks/create-focus-trap.d.ts +15 -0
- package/dist/hooks/create-focus-trap.d.ts.map +1 -0
- package/dist/hooks/create-focus-trap.js +72 -0
- package/dist/hooks/create-focus-trap.js.map +1 -0
- package/dist/hooks/create-keybindings.d.ts +34 -0
- package/dist/hooks/create-keybindings.d.ts.map +1 -0
- package/dist/hooks/create-keybindings.js +113 -0
- package/dist/hooks/create-keybindings.js.map +1 -0
- package/dist/hooks/create-lock-scroll.d.ts +20 -0
- package/dist/hooks/create-lock-scroll.d.ts.map +1 -0
- package/dist/hooks/create-lock-scroll.js +77 -0
- package/dist/hooks/create-lock-scroll.js.map +1 -0
- package/dist/hooks/create-resize-observer.d.ts +27 -0
- package/dist/hooks/create-resize-observer.d.ts.map +1 -0
- package/dist/hooks/create-resize-observer.js +59 -0
- package/dist/hooks/create-resize-observer.js.map +1 -0
- package/dist/hooks/create-scroll-position.d.ts +29 -0
- package/dist/hooks/create-scroll-position.d.ts.map +1 -0
- package/dist/hooks/create-scroll-position.js +101 -0
- package/dist/hooks/create-scroll-position.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 +190 -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 +3 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +3 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/repository-links.d.ts +3 -0
- package/dist/navigation/repository-links.d.ts.map +1 -0
- package/dist/navigation/repository-links.js +35 -0
- package/dist/navigation/repository-links.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/providers/theme-provider.d.ts +33 -0
- package/dist/providers/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider.jsx +158 -0
- package/dist/providers/theme-provider.jsx.map +1 -0
- package/dist/providers/theme-script.d.ts +16 -0
- package/dist/providers/theme-script.d.ts.map +1 -0
- package/dist/providers/theme-script.jsx +41 -0
- package/dist/providers/theme-script.jsx.map +1 -0
- package/dist/providers/theme-transitions.d.ts +12 -0
- package/dist/providers/theme-transitions.d.ts.map +1 -0
- package/dist/providers/theme-transitions.js +115 -0
- package/dist/providers/theme-transitions.js.map +1 -0
- package/dist/registry/api-table.json +21 -0
- package/dist/registry/badge.json +18 -0
- package/dist/registry/breadcrumb.json +17 -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/code-block.json +28 -0
- package/dist/registry/collapsible.json +18 -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/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-focus-trap.json +13 -0
- package/dist/registry/create-keybindings.json +13 -0
- package/dist/registry/create-lock-scroll.json +13 -0
- package/dist/registry/create-resize-observer.json +13 -0
- package/dist/registry/create-scroll-position.json +13 -0
- package/dist/registry/dropdown-menu.json +22 -0
- package/dist/registry/input-group.json +21 -0
- package/dist/registry/kbd.json +18 -0
- package/dist/registry/list.json +20 -0
- package/dist/registry/logo.json +17 -0
- package/dist/registry/navbar.json +19 -0
- package/dist/registry/package-manager-tabs.json +24 -0
- package/dist/registry/pager.json +21 -0
- package/dist/registry/scroll-area.json +21 -0
- package/dist/registry/section-heading.json +21 -0
- package/dist/registry/separator.json +17 -0
- package/dist/registry/sidebar.json +24 -0
- package/dist/registry/skeleton.json +17 -0
- package/dist/registry/spinner.json +18 -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/theme-manager.json +39 -0
- package/dist/registry/tooltip.json +18 -0
- package/dist/search/provider.d.ts +14 -0
- package/dist/search/provider.d.ts.map +1 -0
- package/dist/search/provider.js +14 -0
- package/dist/search/provider.js.map +1 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +565 -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 +522 -0
- package/dist/server/plugin.js.map +1 -0
- package/dist/theme-accent.d.ts +8 -0
- package/dist/theme-accent.d.ts.map +1 -0
- package/dist/theme-accent.js +18 -0
- package/dist/theme-accent.js.map +1 -0
- package/dist/theme-mode.d.ts +4 -0
- package/dist/theme-mode.d.ts.map +1 -0
- package/dist/theme-mode.js +5 -0
- package/dist/theme-mode.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/icons.d.ts +3 -0
- package/dist/themes/default/icons.d.ts.map +1 -0
- package/dist/themes/default/icons.js +15 -0
- package/dist/themes/default/icons.js.map +1 -0
- package/dist/themes/default/index.d.ts +12 -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 +194 -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 +83 -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 +38 -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 +124 -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 +52 -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 +92 -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 +91 -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 +132 -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/docs-src/components/mdx-components.tsx +144 -0
- package/dist/vendor/docs-src/components/ui/api-table.tsx +117 -0
- package/dist/vendor/docs-src/components/ui/badge.tsx +56 -0
- package/dist/vendor/docs-src/components/ui/breadcrumb.tsx +136 -0
- package/dist/vendor/docs-src/components/ui/button.tsx +82 -0
- package/dist/vendor/docs-src/components/ui/callout.tsx +137 -0
- package/dist/vendor/docs-src/components/ui/card.tsx +113 -0
- package/dist/vendor/docs-src/components/ui/code-block.tsx +347 -0
- package/dist/vendor/docs-src/components/ui/collapsible.tsx +73 -0
- package/dist/vendor/docs-src/components/ui/command.tsx +382 -0
- package/dist/vendor/docs-src/components/ui/component-viewer.tsx +363 -0
- package/dist/vendor/docs-src/components/ui/container.tsx +45 -0
- package/dist/vendor/docs-src/components/ui/dropdown-menu.tsx +298 -0
- package/dist/vendor/docs-src/components/ui/input-group.tsx +80 -0
- package/dist/vendor/docs-src/components/ui/kbd.tsx +73 -0
- package/dist/vendor/docs-src/components/ui/list.tsx +222 -0
- package/dist/vendor/docs-src/components/ui/logo.tsx +68 -0
- package/dist/vendor/docs-src/components/ui/navbar.tsx +375 -0
- package/dist/vendor/docs-src/components/ui/package-manager-tabs.tsx +226 -0
- package/dist/vendor/docs-src/components/ui/pager.tsx +102 -0
- package/dist/vendor/docs-src/components/ui/scroll-area.tsx +228 -0
- package/dist/vendor/docs-src/components/ui/section-heading.tsx +115 -0
- package/dist/vendor/docs-src/components/ui/separator.tsx +37 -0
- package/dist/vendor/docs-src/components/ui/sidebar.tsx +712 -0
- package/dist/vendor/docs-src/components/ui/skeleton.tsx +24 -0
- package/dist/vendor/docs-src/components/ui/spinner.tsx +41 -0
- package/dist/vendor/docs-src/components/ui/table-of-contents.tsx +131 -0
- package/dist/vendor/docs-src/components/ui/table.tsx +160 -0
- package/dist/vendor/docs-src/components/ui/tabs.tsx +204 -0
- package/dist/vendor/docs-src/components/ui/theme-toggle.tsx +238 -0
- package/dist/vendor/docs-src/components/ui/tooltip.tsx +41 -0
- package/dist/vendor/docs-src/hooks/create-click-outside.ts +82 -0
- package/dist/vendor/docs-src/hooks/create-clipboard.ts +69 -0
- package/dist/vendor/docs-src/hooks/create-color-mode.ts +115 -0
- package/dist/vendor/docs-src/hooks/create-controllable-signal.ts +56 -0
- package/dist/vendor/docs-src/hooks/create-focus-trap.ts +94 -0
- package/dist/vendor/docs-src/hooks/create-keybindings.ts +148 -0
- package/dist/vendor/docs-src/hooks/create-lock-scroll.ts +97 -0
- package/dist/vendor/docs-src/hooks/create-resize-observer.ts +89 -0
- package/dist/vendor/docs-src/hooks/create-scroll-position.ts +129 -0
- package/dist/vendor/docs-src/lib/cn.ts +9 -0
- package/dist/vendor/docs-src/providers/theme-provider.tsx +203 -0
- package/dist/vendor/docs-src/providers/theme-script.tsx +54 -0
- package/dist/vendor/docs-src/providers/theme-transitions.ts +139 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { splitProps, type Component, type JSX } from "solid-js";
|
|
2
|
+
import { cn } from "@/lib/cn";
|
|
3
|
+
|
|
4
|
+
export interface SkeletonProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Nikala UI Skeleton component for rendering animated pulse loading placeholders.
|
|
10
|
+
*/
|
|
11
|
+
export const Skeleton: Component<SkeletonProps> = (props) => {
|
|
12
|
+
// Use splitProps to preserve SolidJS reactivity
|
|
13
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
class={cn(
|
|
18
|
+
"animate-pulse rounded-md bg-accent",
|
|
19
|
+
local.class
|
|
20
|
+
)}
|
|
21
|
+
{...rest}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { splitProps, type Component, type JSX } from "solid-js";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { cn } from "@/lib/cn";
|
|
4
|
+
|
|
5
|
+
export const spinnerVariants = cva(
|
|
6
|
+
"inline-block animate-spin rounded-lg border-2 border-current border-r-transparent text-primary",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
sm: "size-3",
|
|
11
|
+
default: "size-4",
|
|
12
|
+
lg: "size-6",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: "default",
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export interface SpinnerProps
|
|
22
|
+
extends Omit<JSX.HTMLAttributes<HTMLSpanElement>, "role">,
|
|
23
|
+
VariantProps<typeof spinnerVariants> {
|
|
24
|
+
/** Accessible text announced while the spinner is active. */
|
|
25
|
+
label?: string;
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A compact, accessible loading indicator for async UI states. */
|
|
30
|
+
export const Spinner: Component<SpinnerProps> = (props) => {
|
|
31
|
+
const [local, rest] = splitProps(props, ["size", "label", "class"]);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<span
|
|
35
|
+
role="status"
|
|
36
|
+
aria-label={local.label || "Loading"}
|
|
37
|
+
class={cn(spinnerVariants({ size: local.size }), local.class)}
|
|
38
|
+
{...rest}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// src/components/ui/table-of-contents.tsx
|
|
2
|
+
import {
|
|
3
|
+
splitProps,
|
|
4
|
+
createSignal,
|
|
5
|
+
createEffect,
|
|
6
|
+
onMount,
|
|
7
|
+
onCleanup,
|
|
8
|
+
For,
|
|
9
|
+
Show,
|
|
10
|
+
type Component,
|
|
11
|
+
type JSX,
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
14
|
+
import { List, ListHeader, ListItem } from "@/components/ui/list";
|
|
15
|
+
import { cn } from "@/lib/cn";
|
|
16
|
+
import { createScrollPosition } from "@/hooks/create-scroll-position";
|
|
17
|
+
|
|
18
|
+
export interface TocItem {
|
|
19
|
+
id: string;
|
|
20
|
+
text: string;
|
|
21
|
+
depth: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TableOfContentsProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
25
|
+
items: TocItem[];
|
|
26
|
+
title?: string | false;
|
|
27
|
+
activeId?: string;
|
|
28
|
+
onItemClick?: (id: string) => void;
|
|
29
|
+
class?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Nikala UI TableOfContents Component.
|
|
34
|
+
* Pure composition of ScrollArea, ListHeader, List, and ListItem with active ScrollSpy tracking.
|
|
35
|
+
*/
|
|
36
|
+
export const TableOfContents: Component<TableOfContentsProps> = (props) => {
|
|
37
|
+
const [local, rest] = splitProps(props, [
|
|
38
|
+
"items",
|
|
39
|
+
"title",
|
|
40
|
+
"activeId",
|
|
41
|
+
"onItemClick",
|
|
42
|
+
"class",
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const [activeId, setActiveId] = createSignal<string>(local.activeId || "");
|
|
46
|
+
const scrollPosition = createScrollPosition();
|
|
47
|
+
|
|
48
|
+
onMount(() => {
|
|
49
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
50
|
+
|
|
51
|
+
const headings = (local.items || [])
|
|
52
|
+
.map((item) => document.getElementById(item.id))
|
|
53
|
+
.filter((element): element is HTMLElement => Boolean(element));
|
|
54
|
+
|
|
55
|
+
const updateActiveHeading = () => {
|
|
56
|
+
if (headings.length === 0) return;
|
|
57
|
+
|
|
58
|
+
const atPageBottom = scrollPosition.isAtBottom();
|
|
59
|
+
if (atPageBottom) {
|
|
60
|
+
setActiveId(headings[headings.length - 1].id);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const heading = [...headings]
|
|
65
|
+
.reverse()
|
|
66
|
+
.find((element) => element.getBoundingClientRect().top <= 120);
|
|
67
|
+
|
|
68
|
+
setActiveId(heading?.id || headings[0].id);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
createEffect(() => {
|
|
72
|
+
scrollPosition.y();
|
|
73
|
+
scrollPosition.isAtBottom();
|
|
74
|
+
updateActiveHeading();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
window.addEventListener("resize", updateActiveHeading);
|
|
78
|
+
onCleanup(() => window.removeEventListener("resize", updateActiveHeading));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const handleClick = (e: MouseEvent, id: string) => {
|
|
82
|
+
if (typeof document !== "undefined") {
|
|
83
|
+
const el = document.getElementById(id);
|
|
84
|
+
if (el) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
el.scrollIntoView({ behavior: "smooth" });
|
|
87
|
+
setActiveId(id);
|
|
88
|
+
if (typeof window !== "undefined") {
|
|
89
|
+
window.history.pushState(null, "", `#${id}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
local.onItemClick?.(id);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<ScrollArea class={cn("h-full py-2", local.class)} {...rest}>
|
|
98
|
+
<Show when={local.title !== false}>
|
|
99
|
+
<ListHeader
|
|
100
|
+
title={typeof local.title === "string" ? local.title : "On this page"}
|
|
101
|
+
class="px-3 pb-1"
|
|
102
|
+
/>
|
|
103
|
+
</Show>
|
|
104
|
+
|
|
105
|
+
<List class="gap-0.5 p-1">
|
|
106
|
+
<For each={local.items}>
|
|
107
|
+
{(item) => (
|
|
108
|
+
<ListItem
|
|
109
|
+
title={item.text}
|
|
110
|
+
href={`#${item.id}`}
|
|
111
|
+
active={activeId() === item.id}
|
|
112
|
+
size="sm"
|
|
113
|
+
hoverVariant="muted"
|
|
114
|
+
class={cn(
|
|
115
|
+
"text-xs transition-colors py-1 h-auto min-h-0",
|
|
116
|
+
item.depth === 3 && "pl-5 text-muted-foreground/80",
|
|
117
|
+
item.depth > 3 && "pl-7 text-muted-foreground/60",
|
|
118
|
+
activeId() === item.id
|
|
119
|
+
? "text-primary font-medium bg-primary/10"
|
|
120
|
+
: "text-muted-foreground hover:text-foreground"
|
|
121
|
+
)}
|
|
122
|
+
onClick={(e: MouseEvent) => handleClick(e, item.id)}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
</For>
|
|
126
|
+
</List>
|
|
127
|
+
</ScrollArea>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Toc = TableOfContents;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { splitProps, type Component, type JSX } from "solid-js";
|
|
2
|
+
import { cn } from "@/lib/cn";
|
|
3
|
+
|
|
4
|
+
export interface TableProps extends JSX.HTMLAttributes<HTMLTableElement> {
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Root Table container component wrapped in a responsive scroll container.
|
|
10
|
+
*/
|
|
11
|
+
export const Table: Component<TableProps> = (props) => {
|
|
12
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div class="relative w-full overflow-auto">
|
|
16
|
+
<table
|
|
17
|
+
class={cn("w-full caption-bottom text-sm", local.class)}
|
|
18
|
+
{...rest}
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface TableHeaderProps extends JSX.HTMLAttributes<HTMLTableSectionElement> {
|
|
25
|
+
class?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Header section wrapper for the Table component.
|
|
30
|
+
*/
|
|
31
|
+
export const TableHeader: Component<TableHeaderProps> = (props) => {
|
|
32
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<thead
|
|
36
|
+
class={cn("[&_tr]:border-b border-border", local.class)}
|
|
37
|
+
{...rest}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export interface TableBodyProps extends JSX.HTMLAttributes<HTMLTableSectionElement> {
|
|
43
|
+
class?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Main body section wrapper for the Table component.
|
|
48
|
+
*/
|
|
49
|
+
export const TableBody: Component<TableBodyProps> = (props) => {
|
|
50
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<tbody
|
|
54
|
+
class={cn("[&_tr:last-child]:border-0", local.class)}
|
|
55
|
+
{...rest}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export interface TableFooterProps extends JSX.HTMLAttributes<HTMLTableSectionElement> {
|
|
61
|
+
class?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Footer section wrapper for the Table component.
|
|
66
|
+
*/
|
|
67
|
+
export const TableFooter: Component<TableFooterProps> = (props) => {
|
|
68
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<tfoot
|
|
72
|
+
class={cn(
|
|
73
|
+
"border-t border-border bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
74
|
+
local.class
|
|
75
|
+
)}
|
|
76
|
+
{...rest}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export interface TableRowProps extends JSX.HTMLAttributes<HTMLTableRowElement> {
|
|
82
|
+
class?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Table row component with hover highlight states.
|
|
87
|
+
*/
|
|
88
|
+
export const TableRow: Component<TableRowProps> = (props) => {
|
|
89
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<tr
|
|
93
|
+
class={cn(
|
|
94
|
+
"border-b border-border transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
95
|
+
local.class
|
|
96
|
+
)}
|
|
97
|
+
{...rest}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export interface TableHeadProps extends JSX.ThHTMLAttributes<HTMLTableCellElement> {
|
|
103
|
+
class?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Header cell component for table columns.
|
|
108
|
+
*/
|
|
109
|
+
export const TableHead: Component<TableHeadProps> = (props) => {
|
|
110
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<th
|
|
114
|
+
class={cn(
|
|
115
|
+
"h-10 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
116
|
+
local.class
|
|
117
|
+
)}
|
|
118
|
+
{...rest}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export interface TableCellProps extends JSX.TdHTMLAttributes<HTMLTableCellElement> {
|
|
124
|
+
class?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Standard data cell component for table rows.
|
|
129
|
+
*/
|
|
130
|
+
export const TableCell: Component<TableCellProps> = (props) => {
|
|
131
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<td
|
|
135
|
+
class={cn(
|
|
136
|
+
"p-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
137
|
+
local.class
|
|
138
|
+
)}
|
|
139
|
+
{...rest}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export interface TableCaptionProps extends JSX.HTMLAttributes<HTMLTableCaptionElement> {
|
|
145
|
+
class?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Accessible table caption for describing table contents.
|
|
150
|
+
*/
|
|
151
|
+
export const TableCaption: Component<TableCaptionProps> = (props) => {
|
|
152
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<caption
|
|
156
|
+
class={cn("mt-4 text-xs text-muted-foreground pb-2", local.class)}
|
|
157
|
+
{...rest}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
splitProps,
|
|
5
|
+
Show,
|
|
6
|
+
type Component,
|
|
7
|
+
type JSX,
|
|
8
|
+
type Accessor,
|
|
9
|
+
} from "solid-js";
|
|
10
|
+
import { createControllableSignal } from "@/hooks/create-controllable-signal";
|
|
11
|
+
import { cn } from "@/lib/cn";
|
|
12
|
+
|
|
13
|
+
interface TabsContextValue {
|
|
14
|
+
value: Accessor<string | undefined>;
|
|
15
|
+
setValue: (value: string) => void;
|
|
16
|
+
orientation: Accessor<"horizontal" | "vertical">;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const TabsContext = createContext<TabsContextValue>();
|
|
20
|
+
|
|
21
|
+
export interface TabsProps
|
|
22
|
+
extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
23
|
+
/** Controlled active tab value */
|
|
24
|
+
value?: string;
|
|
25
|
+
/** Uncontrolled default active tab value */
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
/** Callback fired when active tab changes */
|
|
28
|
+
onChange?: (value: string) => void;
|
|
29
|
+
/** Layout orientation of tab triggers and content */
|
|
30
|
+
orientation?: "horizontal" | "vertical";
|
|
31
|
+
class?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Root Tabs container component managing active tab context state and orientation.
|
|
36
|
+
*/
|
|
37
|
+
export const Tabs: Component<TabsProps> = (props) => {
|
|
38
|
+
const [local, rest] = splitProps(props, [
|
|
39
|
+
"value",
|
|
40
|
+
"defaultValue",
|
|
41
|
+
"onChange",
|
|
42
|
+
"orientation",
|
|
43
|
+
"class",
|
|
44
|
+
"children",
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
const [currentValue, setCurrentValue] = createControllableSignal<string>({
|
|
48
|
+
value: () => local.value,
|
|
49
|
+
defaultValue: local.defaultValue,
|
|
50
|
+
onChange: (val) => local.onChange?.(val),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const orientation = () => local.orientation || "horizontal";
|
|
54
|
+
|
|
55
|
+
const contextValue: TabsContextValue = {
|
|
56
|
+
value: currentValue,
|
|
57
|
+
setValue: (val: string) => setCurrentValue(val),
|
|
58
|
+
orientation,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<TabsContext.Provider value={contextValue}>
|
|
63
|
+
<div
|
|
64
|
+
data-orientation={orientation()}
|
|
65
|
+
class={cn(
|
|
66
|
+
"w-full",
|
|
67
|
+
orientation() === "vertical" ? "flex flex-row gap-4" : "flex flex-col gap-2",
|
|
68
|
+
local.class
|
|
69
|
+
)}
|
|
70
|
+
{...rest}
|
|
71
|
+
>
|
|
72
|
+
{local.children}
|
|
73
|
+
</div>
|
|
74
|
+
</TabsContext.Provider>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export interface TabsListProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
79
|
+
class?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Container wrapper for Tab triggers.
|
|
84
|
+
*/
|
|
85
|
+
export const TabsList: Component<TabsListProps> = (props) => {
|
|
86
|
+
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
87
|
+
const context = useContext(TabsContext);
|
|
88
|
+
|
|
89
|
+
const isVertical = () => context?.orientation() === "vertical";
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
role="tablist"
|
|
94
|
+
aria-orientation={context?.orientation() || "horizontal"}
|
|
95
|
+
class={cn(
|
|
96
|
+
"inline-flex rounded-lg bg-muted p-1 text-muted-foreground",
|
|
97
|
+
isVertical()
|
|
98
|
+
? "flex-col h-auto w-auto items-stretch justify-start"
|
|
99
|
+
: "h-9 items-center justify-center",
|
|
100
|
+
local.class
|
|
101
|
+
)}
|
|
102
|
+
{...rest}
|
|
103
|
+
>
|
|
104
|
+
{local.children}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export interface TabsTriggerProps
|
|
110
|
+
extends Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> {
|
|
111
|
+
/** Unique value identifier for this tab */
|
|
112
|
+
value: string;
|
|
113
|
+
class?: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Tab button trigger to activate a specific tab panel.
|
|
118
|
+
*/
|
|
119
|
+
export const TabsTrigger: Component<TabsTriggerProps> = (props) => {
|
|
120
|
+
const [local, rest] = splitProps(props, [
|
|
121
|
+
"value",
|
|
122
|
+
"disabled",
|
|
123
|
+
"class",
|
|
124
|
+
"children",
|
|
125
|
+
"onClick",
|
|
126
|
+
]);
|
|
127
|
+
const context = useContext(TabsContext);
|
|
128
|
+
|
|
129
|
+
if (!context) {
|
|
130
|
+
throw new Error("TabsTrigger must be used within a Tabs component");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const isSelected = () => context.value() === local.value;
|
|
134
|
+
const isVertical = () => context.orientation() === "vertical";
|
|
135
|
+
|
|
136
|
+
const handleClick = (
|
|
137
|
+
e: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }
|
|
138
|
+
) => {
|
|
139
|
+
if (local.disabled) return;
|
|
140
|
+
context.setValue(local.value);
|
|
141
|
+
if (typeof local.onClick === "function") {
|
|
142
|
+
local.onClick(e);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
role="tab"
|
|
150
|
+
aria-selected={isSelected()}
|
|
151
|
+
data-state={isSelected() ? "active" : "inactive"}
|
|
152
|
+
data-orientation={context.orientation()}
|
|
153
|
+
disabled={local.disabled}
|
|
154
|
+
onClick={handleClick}
|
|
155
|
+
class={cn(
|
|
156
|
+
"inline-flex items-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-accent data-[state=active]:border data-[state=active]:border-border data-[state=active]:text-foreground data-[state=active]:shadow-sm cursor-pointer",
|
|
157
|
+
isVertical() ? "justify-start py-1.5" : "justify-center",
|
|
158
|
+
local.class
|
|
159
|
+
)}
|
|
160
|
+
{...rest}
|
|
161
|
+
>
|
|
162
|
+
{local.children}
|
|
163
|
+
</button>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export interface TabsContentProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
168
|
+
/** Value matching the corresponding tab trigger */
|
|
169
|
+
value: string;
|
|
170
|
+
class?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Content panel revealed when the associated tab is active.
|
|
175
|
+
*/
|
|
176
|
+
export const TabsContent: Component<TabsContentProps> = (props) => {
|
|
177
|
+
const [local, rest] = splitProps(props, ["value", "class", "children"]);
|
|
178
|
+
const context = useContext(TabsContext);
|
|
179
|
+
|
|
180
|
+
if (!context) {
|
|
181
|
+
throw new Error("TabsContent must be used within a Tabs component");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const isSelected = () => context.value() === local.value;
|
|
185
|
+
const isVertical = () => context.orientation() === "vertical";
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<Show when={isSelected()}>
|
|
189
|
+
<div
|
|
190
|
+
role="tabpanel"
|
|
191
|
+
data-state={isSelected() ? "active" : "inactive"}
|
|
192
|
+
data-orientation={context.orientation()}
|
|
193
|
+
class={cn(
|
|
194
|
+
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
195
|
+
isVertical() ? "flex-1 mt-0" : "mt-2",
|
|
196
|
+
local.class
|
|
197
|
+
)}
|
|
198
|
+
{...rest}
|
|
199
|
+
>
|
|
200
|
+
{local.children}
|
|
201
|
+
</div>
|
|
202
|
+
</Show>
|
|
203
|
+
);
|
|
204
|
+
};
|