@askrjs/themes 0.0.1
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 +201 -0
- package/THEMING.md +930 -0
- package/dist/_internal/box-layout.js +115 -0
- package/dist/_internal/box-layout.js.map +1 -0
- package/dist/_internal/classes.js +8 -0
- package/dist/_internal/classes.js.map +1 -0
- package/dist/_internal/jsx.js +12 -0
- package/dist/_internal/jsx.js.map +1 -0
- package/dist/_internal/layout.d.ts +9 -0
- package/dist/_internal/layout.js +156 -0
- package/dist/_internal/layout.js.map +1 -0
- package/dist/_internal/merge-props.js +50 -0
- package/dist/_internal/merge-props.js.map +1 -0
- package/dist/accessible-icon/accessible-icon.d.ts +7 -0
- package/dist/accessible-icon/accessible-icon.js +20 -0
- package/dist/accessible-icon/accessible-icon.js.map +1 -0
- package/dist/accessible-icon/accessible-icon.types.d.ts +9 -0
- package/dist/askr/dist/common/jsx.d.ts +16 -0
- package/dist/askr/dist/common/props.d.ts +22 -0
- package/dist/askr-themes/src/themes/default/index.css +3736 -0
- package/dist/aspect-ratio/aspect-ratio.d.ts +8 -0
- package/dist/aspect-ratio/aspect-ratio.js +36 -0
- package/dist/aspect-ratio/aspect-ratio.js.map +1 -0
- package/dist/aspect-ratio/aspect-ratio.types.d.ts +20 -0
- package/dist/aspect-ratio/index.d.ts +2 -0
- package/dist/badge/badge.d.ts +8 -0
- package/dist/badge/badge.js +26 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/badge/badge.types.d.ts +20 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/box/box.d.ts +9 -0
- package/dist/box/box.js +35 -0
- package/dist/box/box.js.map +1 -0
- package/dist/box/box.types.d.ts +71 -0
- package/dist/box/index.d.ts +2 -0
- package/dist/breadcrumb/breadcrumb.d.ts +18 -0
- package/dist/breadcrumb/breadcrumb.js +113 -0
- package/dist/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/breadcrumb/breadcrumb.types.d.ts +64 -0
- package/dist/breadcrumb/index.d.ts +2 -0
- package/dist/card/card.d.ts +12 -0
- package/dist/card/card.js +68 -0
- package/dist/card/card.js.map +1 -0
- package/dist/card/card.types.d.ts +37 -0
- package/dist/card/index.d.ts +2 -0
- package/dist/components/_internal/box-layout.d.ts +7 -0
- package/dist/components/_internal/classes.d.ts +1 -0
- package/dist/components/_internal/jsx.d.ts +8 -0
- package/dist/components/_internal/layout.d.ts +31 -0
- package/dist/components/_internal/merge-props.d.ts +1 -0
- package/dist/components/_internal/style.d.ts +1 -0
- package/dist/components/accessible-icon/accessible-icon.d.ts +2 -0
- package/dist/components/accessible-icon/accessible-icon.types.d.ts +5 -0
- package/dist/components/accessible-icon/index.d.ts +2 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +3 -0
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +15 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/badge/badge.a11y.d.ts +13 -0
- package/dist/components/badge/badge.d.ts +3 -0
- package/dist/components/badge/badge.types.d.ts +15 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/box/box.a11y.d.ts +10 -0
- package/dist/components/box/box.d.ts +4 -0
- package/dist/components/box/box.types.d.ts +66 -0
- package/dist/components/box/index.d.ts +3 -0
- package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +13 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +13 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +59 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/card/card.d.ts +7 -0
- package/dist/components/card/card.types.d.ts +33 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/container/container.a11y.d.ts +16 -0
- package/dist/components/container/container.d.ts +3 -0
- package/dist/components/container/container.types.d.ts +29 -0
- package/dist/components/container/index.d.ts +3 -0
- package/dist/components/empty-state/empty-state.d.ts +2 -0
- package/dist/components/empty-state/empty-state.types.d.ts +9 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/flex/flex.a11y.d.ts +18 -0
- package/dist/components/flex/flex.d.ts +4 -0
- package/dist/components/flex/flex.types.d.ts +41 -0
- package/dist/components/flex/index.d.ts +3 -0
- package/dist/components/grid/grid.a11y.d.ts +21 -0
- package/dist/components/grid/grid.d.ts +4 -0
- package/dist/components/grid/grid.types.d.ts +37 -0
- package/dist/components/grid/index.d.ts +3 -0
- package/dist/components/header/header.a11y.d.ts +10 -0
- package/dist/components/header/header.d.ts +2 -0
- package/dist/components/header/header.types.d.ts +5 -0
- package/dist/components/header/index.d.ts +3 -0
- package/dist/components/index.d.ts +49 -0
- package/dist/components/index.js +28 -0
- package/dist/components/inline/index.d.ts +6 -0
- package/dist/components/logos/create-logo.d.ts +5 -0
- package/dist/components/logos/github-logo.d.ts +4 -0
- package/dist/components/logos/google-logo.d.ts +4 -0
- package/dist/components/logos/index.d.ts +5 -0
- package/dist/components/logos/microsoft-logo.d.ts +4 -0
- package/dist/components/logos/types.d.ts +14 -0
- package/dist/components/navbar/index.d.ts +2 -0
- package/dist/components/navbar/navbar.d.ts +6 -0
- package/dist/components/navbar/navbar.types.d.ts +24 -0
- package/dist/components/section/index.d.ts +3 -0
- package/dist/components/section/section.a11y.d.ts +11 -0
- package/dist/components/section/section.d.ts +3 -0
- package/dist/components/section/section.types.d.ts +17 -0
- package/dist/components/separator/index.d.ts +3 -0
- package/dist/components/separator/separator.a11y.d.ts +13 -0
- package/dist/components/separator/separator.d.ts +3 -0
- package/dist/components/separator/separator.types.d.ts +16 -0
- package/dist/components/sidebar-layout/index.d.ts +3 -0
- package/dist/components/sidebar-layout/sidebar-layout.a11y.d.ts +15 -0
- package/dist/components/sidebar-layout/sidebar-layout.d.ts +2 -0
- package/dist/components/sidebar-layout/sidebar-layout.types.d.ts +20 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/skeleton.a11y.d.ts +12 -0
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.types.d.ts +13 -0
- package/dist/components/spacer/index.d.ts +3 -0
- package/dist/components/spacer/spacer.a11y.d.ts +13 -0
- package/dist/components/spacer/spacer.d.ts +3 -0
- package/dist/components/spacer/spacer.types.d.ts +24 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/spinner.d.ts +2 -0
- package/dist/components/spinner/spinner.types.d.ts +5 -0
- package/dist/components/stack/index.d.ts +3 -0
- package/dist/components/stack/stack.a11y.d.ts +14 -0
- package/dist/components/stack/stack.d.ts +3 -0
- package/dist/components/stack/stack.types.d.ts +16 -0
- package/dist/components/theme/index.d.ts +2 -0
- package/dist/components/theme/theme.d.ts +40 -0
- package/dist/components/topbar-layout/index.d.ts +3 -0
- package/dist/components/topbar-layout/topbar-layout.a11y.d.ts +13 -0
- package/dist/components/topbar-layout/topbar-layout.d.ts +2 -0
- package/dist/components/topbar-layout/topbar-layout.types.d.ts +12 -0
- package/dist/container/container.d.ts +8 -0
- package/dist/container/container.js +82 -0
- package/dist/container/container.js.map +1 -0
- package/dist/container/container.types.d.ts +28 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/empty-state/empty-state.d.ts +7 -0
- package/dist/empty-state/empty-state.js +39 -0
- package/dist/empty-state/empty-state.js.map +1 -0
- package/dist/empty-state/empty-state.types.d.ts +13 -0
- package/dist/flex/flex.d.ts +9 -0
- package/dist/flex/flex.js +114 -0
- package/dist/flex/flex.js.map +1 -0
- package/dist/flex/flex.types.d.ts +41 -0
- package/dist/flex/index.d.ts +2 -0
- package/dist/grid/grid.d.ts +9 -0
- package/dist/grid/grid.js +115 -0
- package/dist/grid/grid.js.map +1 -0
- package/dist/grid/grid.types.d.ts +40 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/header/header.d.ts +7 -0
- package/dist/header/header.js +18 -0
- package/dist/header/header.js.map +1 -0
- package/dist/header/header.types.d.ts +9 -0
- package/dist/inline/index.d.ts +7 -0
- package/dist/inline/index.js +13 -0
- package/dist/inline/index.js.map +1 -0
- package/dist/logos/create-logo.js +75 -0
- package/dist/logos/create-logo.js.map +1 -0
- package/dist/logos/github-logo.d.ts +18 -0
- package/dist/logos/github-logo.js +9 -0
- package/dist/logos/github-logo.js.map +1 -0
- package/dist/logos/google-logo.d.ts +18 -0
- package/dist/logos/google-logo.js +23 -0
- package/dist/logos/google-logo.js.map +1 -0
- package/dist/logos/microsoft-logo.d.ts +18 -0
- package/dist/logos/microsoft-logo.js +35 -0
- package/dist/logos/microsoft-logo.js.map +1 -0
- package/dist/logos/types.d.ts +16 -0
- package/dist/navbar/index.d.ts +2 -0
- package/dist/navbar/navbar.d.ts +11 -0
- package/dist/navbar/navbar.js +57 -0
- package/dist/navbar/navbar.js.map +1 -0
- package/dist/navbar/navbar.types.d.ts +29 -0
- package/dist/section/index.d.ts +2 -0
- package/dist/section/section.d.ts +8 -0
- package/dist/section/section.js +40 -0
- package/dist/section/section.js.map +1 -0
- package/dist/section/section.types.d.ts +22 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/separator.d.ts +8 -0
- package/dist/separator/separator.js +27 -0
- package/dist/separator/separator.js.map +1 -0
- package/dist/separator/separator.types.d.ts +21 -0
- package/dist/sidebar-layout/index.d.ts +2 -0
- package/dist/sidebar-layout/sidebar-layout.d.ts +7 -0
- package/dist/sidebar-layout/sidebar-layout.js +51 -0
- package/dist/sidebar-layout/sidebar-layout.js.map +1 -0
- package/dist/sidebar-layout/sidebar-layout.types.d.ts +20 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/skeleton.d.ts +8 -0
- package/dist/skeleton/skeleton.js +26 -0
- package/dist/skeleton/skeleton.js.map +1 -0
- package/dist/skeleton/skeleton.types.d.ts +18 -0
- package/dist/spacer/index.d.ts +2 -0
- package/dist/spacer/spacer.d.ts +8 -0
- package/dist/spacer/spacer.js +47 -0
- package/dist/spacer/spacer.js.map +1 -0
- package/dist/spacer/spacer.types.d.ts +25 -0
- package/dist/spinner/index.d.ts +2 -0
- package/dist/spinner/spinner.d.ts +7 -0
- package/dist/spinner/spinner.js +16 -0
- package/dist/spinner/spinner.js.map +1 -0
- package/dist/spinner/spinner.types.d.ts +10 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/stack.d.ts +8 -0
- package/dist/stack/stack.js +16 -0
- package/dist/stack/stack.js.map +1 -0
- package/dist/stack/stack.types.d.ts +21 -0
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/theme.d.ts +44 -0
- package/dist/theme/theme.js +159 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/topbar-layout/index.d.ts +2 -0
- package/dist/topbar-layout/topbar-layout.d.ts +7 -0
- package/dist/topbar-layout/topbar-layout.js +37 -0
- package/dist/topbar-layout/topbar-layout.js.map +1 -0
- package/dist/topbar-layout/topbar-layout.types.d.ts +13 -0
- package/package.json +122 -0
- package/scripts/new-theme.js +87 -0
- package/src/askr-compat.d.ts +110 -0
- package/src/components/_internal/box-layout.ts +156 -0
- package/src/components/_internal/classes.ts +5 -0
- package/src/components/_internal/jsx.ts +141 -0
- package/src/components/_internal/layout.ts +223 -0
- package/src/components/_internal/merge-props.ts +89 -0
- package/src/components/_internal/style.ts +18 -0
- package/src/components/accessible-icon/accessible-icon.tsx +18 -0
- package/src/components/accessible-icon/accessible-icon.types.ts +5 -0
- package/src/components/accessible-icon/index.ts +2 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +48 -0
- package/src/components/aspect-ratio/aspect-ratio.types.ts +19 -0
- package/src/components/aspect-ratio/index.ts +2 -0
- package/src/components/badge/badge.a11y.ts +15 -0
- package/src/components/badge/badge.tsx +21 -0
- package/src/components/badge/badge.types.ts +27 -0
- package/src/components/badge/index.ts +3 -0
- package/src/components/box/box.a11y.ts +11 -0
- package/src/components/box/box.tsx +37 -0
- package/src/components/box/box.types.ts +75 -0
- package/src/components/box/index.ts +11 -0
- package/src/components/breadcrumb/breadcrumb.a11y.ts +15 -0
- package/src/components/breadcrumb/breadcrumb.tsx +123 -0
- package/src/components/breadcrumb/breadcrumb.types.ts +73 -0
- package/src/components/breadcrumb/index.ts +24 -0
- package/src/components/card/card.tsx +79 -0
- package/src/components/card/card.types.ts +40 -0
- package/src/components/card/index.ts +12 -0
- package/src/components/container/container.a11y.ts +17 -0
- package/src/components/container/container.tsx +139 -0
- package/src/components/container/container.types.ts +35 -0
- package/src/components/container/index.ts +9 -0
- package/src/components/empty-state/empty-state.tsx +42 -0
- package/src/components/empty-state/empty-state.types.ts +10 -0
- package/src/components/empty-state/index.ts +2 -0
- package/src/components/flex/flex.a11y.ts +19 -0
- package/src/components/flex/flex.tsx +160 -0
- package/src/components/flex/flex.types.ts +50 -0
- package/src/components/flex/index.ts +16 -0
- package/src/components/grid/grid.a11y.ts +22 -0
- package/src/components/grid/grid.tsx +172 -0
- package/src/components/grid/grid.types.ts +45 -0
- package/src/components/grid/index.ts +10 -0
- package/src/components/header/header.a11y.ts +11 -0
- package/src/components/header/header.tsx +18 -0
- package/src/components/header/header.types.ts +6 -0
- package/src/components/header/index.ts +3 -0
- package/src/components/index.ts +107 -0
- package/src/components/inline/index.tsx +28 -0
- package/src/components/logos/create-logo.tsx +103 -0
- package/src/components/logos/github-logo.tsx +13 -0
- package/src/components/logos/google-logo.tsx +34 -0
- package/src/components/logos/index.ts +5 -0
- package/src/components/logos/microsoft-logo.tsx +10 -0
- package/src/components/logos/types.ts +24 -0
- package/src/components/navbar/index.ts +9 -0
- package/src/components/navbar/navbar.tsx +59 -0
- package/src/components/navbar/navbar.types.ts +33 -0
- package/src/components/section/index.ts +8 -0
- package/src/components/section/section.a11y.ts +12 -0
- package/src/components/section/section.tsx +37 -0
- package/src/components/section/section.types.ts +22 -0
- package/src/components/separator/index.ts +12 -0
- package/src/components/separator/separator.a11y.ts +15 -0
- package/src/components/separator/separator.tsx +23 -0
- package/src/components/separator/separator.types.ts +21 -0
- package/src/components/sidebar-layout/index.ts +6 -0
- package/src/components/sidebar-layout/sidebar-layout.a11y.ts +16 -0
- package/src/components/sidebar-layout/sidebar-layout.tsx +59 -0
- package/src/components/sidebar-layout/sidebar-layout.types.ts +22 -0
- package/src/components/skeleton/index.ts +3 -0
- package/src/components/skeleton/skeleton.a11y.ts +14 -0
- package/src/components/skeleton/skeleton.tsx +21 -0
- package/src/components/skeleton/skeleton.types.ts +17 -0
- package/src/components/spacer/index.ts +9 -0
- package/src/components/spacer/spacer.a11y.ts +14 -0
- package/src/components/spacer/spacer.tsx +58 -0
- package/src/components/spacer/spacer.types.ts +30 -0
- package/src/components/spinner/index.ts +2 -0
- package/src/components/spinner/spinner.tsx +21 -0
- package/src/components/spinner/spinner.types.ts +7 -0
- package/src/components/stack/index.ts +3 -0
- package/src/components/stack/stack.a11y.ts +15 -0
- package/src/components/stack/stack.tsx +13 -0
- package/src/components/stack/stack.types.ts +21 -0
- package/src/components/theme/index.ts +10 -0
- package/src/components/theme/theme.tsx +260 -0
- package/src/components/topbar-layout/index.ts +3 -0
- package/src/components/topbar-layout/topbar-layout.a11y.ts +14 -0
- package/src/components/topbar-layout/topbar-layout.tsx +39 -0
- package/src/components/topbar-layout/topbar-layout.types.ts +13 -0
- package/src/css.d.ts +1 -0
- package/src/index.css +1 -0
- package/src/jsx.d.ts +23 -0
- package/src/themes/default/index.css +48 -0
- package/src/themes/default/styles/actions/button.css +196 -0
- package/src/themes/default/styles/actions/toggle-group.css +52 -0
- package/src/themes/default/styles/actions/toggle.css +44 -0
- package/src/themes/default/styles/base/icon.css +10 -0
- package/src/themes/default/styles/base/typography.css +208 -0
- package/src/themes/default/styles/base/utilities.css +223 -0
- package/src/themes/default/styles/disclosure/accordion.css +62 -0
- package/src/themes/default/styles/disclosure/collapsible.css +47 -0
- package/src/themes/default/styles/display/avatar.css +25 -0
- package/src/themes/default/styles/display/badge.css +51 -0
- package/src/themes/default/styles/display/card.css +53 -0
- package/src/themes/default/styles/display/coverage.css +248 -0
- package/src/themes/default/styles/display/progress-circle.css +18 -0
- package/src/themes/default/styles/display/progress.css +18 -0
- package/src/themes/default/styles/display/scroll-area.css +34 -0
- package/src/themes/default/styles/display/separator.css +15 -0
- package/src/themes/default/styles/display/skeleton.css +6 -0
- package/src/themes/default/styles/display/spinner.css +9 -0
- package/src/themes/default/styles/display/table.css +63 -0
- package/src/themes/default/styles/forms/checkbox.css +64 -0
- package/src/themes/default/styles/forms/form.css +5 -0
- package/src/themes/default/styles/forms/input.css +49 -0
- package/src/themes/default/styles/forms/label.css +6 -0
- package/src/themes/default/styles/forms/radio-group.css +53 -0
- package/src/themes/default/styles/forms/select.css +143 -0
- package/src/themes/default/styles/forms/slider.css +75 -0
- package/src/themes/default/styles/forms/switch.css +70 -0
- package/src/themes/default/styles/forms/textarea.css +37 -0
- package/src/themes/default/styles/layout/aspect-ratio.css +5 -0
- package/src/themes/default/styles/layout/dashboard-layout.css +15 -0
- package/src/themes/default/styles/layout/docs-layout.css +10 -0
- package/src/themes/default/styles/layout/layout.css +946 -0
- package/src/themes/default/styles/layout/patterns.css +43 -0
- package/src/themes/default/styles/layout/responsive-layout.css +209 -0
- package/src/themes/default/styles/layout/sidebar.css +10 -0
- package/src/themes/default/styles/navigation/breadcrumb.css +39 -0
- package/src/themes/default/styles/navigation/menu.css +60 -0
- package/src/themes/default/styles/navigation/menubar.css +89 -0
- package/src/themes/default/styles/navigation/navigation-menu.css +90 -0
- package/src/themes/default/styles/navigation/tabs.css +61 -0
- package/src/themes/default/styles/overlays/alert-dialog.css +9 -0
- package/src/themes/default/styles/overlays/dialog.css +116 -0
- package/src/themes/default/styles/overlays/dropdown-menu.css +109 -0
- package/src/themes/default/styles/overlays/hover-card.css +46 -0
- package/src/themes/default/styles/overlays/popover.css +72 -0
- package/src/themes/default/styles/overlays/toast.css +123 -0
- package/src/themes/default/styles/overlays/tooltip.css +83 -0
- package/src/themes/default/styles/shell/header.css +36 -0
- package/src/themes/default/styles/shell/navbar.css +158 -0
- package/src/themes/default/styles/shell/theme.css +35 -0
- package/src/themes/default/tokens.css +316 -0
- package/templates/theme/index.css +48 -0
- package/templates/theme/styles/actions/button.css +196 -0
- package/templates/theme/styles/actions/toggle-group.css +52 -0
- package/templates/theme/styles/actions/toggle.css +44 -0
- package/templates/theme/styles/base/icon.css +10 -0
- package/templates/theme/styles/base/typography.css +208 -0
- package/templates/theme/styles/base/utilities.css +19 -0
- package/templates/theme/styles/disclosure/accordion.css +62 -0
- package/templates/theme/styles/disclosure/collapsible.css +47 -0
- package/templates/theme/styles/display/avatar.css +25 -0
- package/templates/theme/styles/display/badge.css +51 -0
- package/templates/theme/styles/display/card.css +53 -0
- package/templates/theme/styles/display/coverage.css +146 -0
- package/templates/theme/styles/display/progress-circle.css +18 -0
- package/templates/theme/styles/display/progress.css +18 -0
- package/templates/theme/styles/display/scroll-area.css +34 -0
- package/templates/theme/styles/display/separator.css +15 -0
- package/templates/theme/styles/display/skeleton.css +6 -0
- package/templates/theme/styles/display/spinner.css +9 -0
- package/templates/theme/styles/display/table.css +63 -0
- package/templates/theme/styles/forms/checkbox.css +64 -0
- package/templates/theme/styles/forms/form.css +5 -0
- package/templates/theme/styles/forms/input.css +49 -0
- package/templates/theme/styles/forms/label.css +6 -0
- package/templates/theme/styles/forms/radio-group.css +53 -0
- package/templates/theme/styles/forms/select.css +143 -0
- package/templates/theme/styles/forms/slider.css +75 -0
- package/templates/theme/styles/forms/switch.css +70 -0
- package/templates/theme/styles/forms/textarea.css +37 -0
- package/templates/theme/styles/layout/aspect-ratio.css +5 -0
- package/templates/theme/styles/layout/dashboard-layout.css +16 -0
- package/templates/theme/styles/layout/docs-layout.css +11 -0
- package/templates/theme/styles/layout/layout.css +1 -0
- package/templates/theme/styles/layout/patterns.css +43 -0
- package/templates/theme/styles/layout/responsive-layout.css +209 -0
- package/templates/theme/styles/layout/sidebar.css +11 -0
- package/templates/theme/styles/navigation/breadcrumb.css +31 -0
- package/templates/theme/styles/navigation/menu.css +60 -0
- package/templates/theme/styles/navigation/menubar.css +89 -0
- package/templates/theme/styles/navigation/navigation-menu.css +90 -0
- package/templates/theme/styles/navigation/tabs.css +61 -0
- package/templates/theme/styles/overlays/alert-dialog.css +9 -0
- package/templates/theme/styles/overlays/dialog.css +116 -0
- package/templates/theme/styles/overlays/dropdown-menu.css +109 -0
- package/templates/theme/styles/overlays/hover-card.css +46 -0
- package/templates/theme/styles/overlays/popover.css +72 -0
- package/templates/theme/styles/overlays/toast.css +123 -0
- package/templates/theme/styles/overlays/tooltip.css +83 -0
- package/templates/theme/styles/shell/header.css +36 -0
- package/templates/theme/styles/shell/navbar.css +158 -0
- package/templates/theme/styles/shell/theme.css +35 -0
- package/templates/theme/tokens.css +316 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as createSvgNode, jsxs as createSvgNodes } from "@askrjs/askr/jsx-runtime";
|
|
2
|
+
import type { IconSizeToken, LogoNode, LogoProps, LogoStyleObject } from "./types";
|
|
3
|
+
|
|
4
|
+
const ICON_SIZE_TOKENS: readonly IconSizeToken[] = ["sm", "md", "lg", "xl"];
|
|
5
|
+
|
|
6
|
+
function isIconSizeToken(value: unknown): value is IconSizeToken {
|
|
7
|
+
return typeof value === "string" && ICON_SIZE_TOKENS.includes(value as IconSizeToken);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function normalizeIconSizeValue(size: number | string): string {
|
|
11
|
+
if (typeof size === "number") return `${size}px`;
|
|
12
|
+
return size;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function resolveIconSizeVariable(size: number | string): string {
|
|
16
|
+
if (isIconSizeToken(size)) {
|
|
17
|
+
return `var(--ak-icon-size-${size}, var(--ak-icon-size-md, 1.25rem))`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return normalizeIconSizeValue(size);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function camelToKebab(key: string): string {
|
|
24
|
+
return key.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function serializeLogoStyle(style: string | LogoStyleObject | undefined): string {
|
|
28
|
+
if (!style) return "";
|
|
29
|
+
if (typeof style === "string") return style.trim();
|
|
30
|
+
|
|
31
|
+
return Object.entries(style)
|
|
32
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
33
|
+
.map(([key, value]) => `${camelToKebab(key)}:${String(value)}`)
|
|
34
|
+
.join(";");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function joinLogoStyle(...styles: Array<string | undefined>): string | undefined {
|
|
38
|
+
const merged = styles.map((style) => style?.trim()).filter(Boolean);
|
|
39
|
+
return merged.length > 0 ? merged.join(";") : undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getLogoContractProps({
|
|
43
|
+
size = 20,
|
|
44
|
+
title,
|
|
45
|
+
style,
|
|
46
|
+
iconName,
|
|
47
|
+
}: Pick<LogoProps, "iconName" | "size" | "style" | "title">) {
|
|
48
|
+
const sizeToken = isIconSizeToken(size) ? size : undefined;
|
|
49
|
+
const decorative = title ? undefined : "true";
|
|
50
|
+
const resolvedSize = resolveIconSizeVariable(size);
|
|
51
|
+
const logoStyle = joinLogoStyle(
|
|
52
|
+
`--ak-icon-size:${resolvedSize}`,
|
|
53
|
+
"display:inline-block",
|
|
54
|
+
"flex-shrink:0",
|
|
55
|
+
"width:var(--ak-icon-size)",
|
|
56
|
+
"height:var(--ak-icon-size)",
|
|
57
|
+
serializeLogoStyle(style),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
attrs: {
|
|
62
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
63
|
+
width: "24",
|
|
64
|
+
height: "24",
|
|
65
|
+
role: "img",
|
|
66
|
+
"aria-hidden": title ? undefined : "true",
|
|
67
|
+
style: logoStyle,
|
|
68
|
+
"data-slot": "icon",
|
|
69
|
+
"data-icon": iconName,
|
|
70
|
+
"data-size": sizeToken,
|
|
71
|
+
"data-decorative": decorative,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function createLogo(displayName: string, viewBox: string, logoNode: LogoNode) {
|
|
77
|
+
function Logo({ size = 20, title, class: className, style, ref, ...rest }: LogoProps) {
|
|
78
|
+
const { attrs } = getLogoContractProps({
|
|
79
|
+
size,
|
|
80
|
+
title,
|
|
81
|
+
style,
|
|
82
|
+
iconName: displayName,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const children = logoNode.map(([tag, nodeAttrs], index) =>
|
|
86
|
+
createSvgNode(tag, nodeAttrs as Record<string, unknown>, index),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return createSvgNodes("svg", {
|
|
90
|
+
...rest,
|
|
91
|
+
...attrs,
|
|
92
|
+
viewBox,
|
|
93
|
+
fill: "none",
|
|
94
|
+
stroke: "none",
|
|
95
|
+
class: className,
|
|
96
|
+
ref,
|
|
97
|
+
children: title ? [createSvgNode("title", { children: title }), ...children] : children,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
Logo.displayName = displayName;
|
|
102
|
+
return Logo;
|
|
103
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createLogo } from "./create-logo";
|
|
2
|
+
|
|
3
|
+
const GITHUB_LOGO_NODE = [
|
|
4
|
+
[
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
fill: "#181717",
|
|
8
|
+
d: "M12 1C5.923 1 1 5.924 1 12.002c0 4.862 3.151 8.987 7.521 10.443.55.102.751-.239.751-.53 0-.262-.01-.956-.015-1.876-3.059.665-3.706-1.475-3.706-1.475-.5-1.271-1.22-1.609-1.22-1.609-.998-.682.076-.668.076-.668 1.104.078 1.685 1.134 1.685 1.134.981 1.682 2.575 1.196 3.203.915.1-.711.384-1.196.698-1.471-2.442-.278-5.01-1.221-5.01-5.436 0-1.201.429-2.184 1.133-2.954-.114-.278-.491-1.397.107-2.913 0 0 .924-.296 3.026 1.128A10.52 10.52 0 0 1 12 6.32c.935.004 1.876.127 2.755.373 2.1-1.424 3.023-1.128 3.023-1.128.6 1.516.223 2.635.109 2.913.706.77 1.131 1.753 1.131 2.954 0 4.225-2.572 5.155-5.02 5.427.395.34.746 1.011.746 2.038 0 1.472-.013 2.659-.013 3.021 0 .294.198.637.757.529C19.851 20.985 23 16.862 23 12.002 23 5.924 18.075 1 12 1Z",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
] as const;
|
|
12
|
+
|
|
13
|
+
export const GitHubLogo = createLogo("GitHubLogo", "0 0 24 24", GITHUB_LOGO_NODE);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createLogo } from "./create-logo";
|
|
2
|
+
|
|
3
|
+
const GOOGLE_LOGO_NODE = [
|
|
4
|
+
[
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
fill: "#4285F4",
|
|
8
|
+
d: "M23.49 12.276c0-.816-.073-1.6-.209-2.351H12v4.451h6.437a5.505 5.505 0 0 1-2.387 3.613v2.997h3.861c2.259-2.079 3.579-5.142 3.579-8.71Z",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
[
|
|
12
|
+
"path",
|
|
13
|
+
{
|
|
14
|
+
fill: "#34A853",
|
|
15
|
+
d: "M12 24c3.24 0 5.957-1.074 7.943-2.914l-3.861-2.997c-1.074.72-2.448 1.146-4.082 1.146-3.136 0-5.793-2.118-6.741-4.965H1.267v3.092A11.997 11.997 0 0 0 12 24Z",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"path",
|
|
20
|
+
{
|
|
21
|
+
fill: "#FBBC05",
|
|
22
|
+
d: "M5.259 14.27A7.192 7.192 0 0 1 4.882 12c0-.788.135-1.553.377-2.27V6.638H1.267A11.997 11.997 0 0 0 0 12c0 1.937.464 3.771 1.267 5.362L5.259 14.27Z",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
"path",
|
|
27
|
+
{
|
|
28
|
+
fill: "#EA4335",
|
|
29
|
+
d: "M12 4.765c1.762 0 3.344.606 4.589 1.795l3.44-3.44C17.952 1.181 15.236 0 12 0 7.307 0 3.267 2.691 1.267 6.638L5.259 9.73c.948-2.847 3.605-4.965 6.741-4.965Z",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
export const GoogleLogo = createLogo("GoogleLogo", "0 0 24 24", GOOGLE_LOGO_NODE);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createLogo } from "./create-logo";
|
|
2
|
+
|
|
3
|
+
const MICROSOFT_LOGO_NODE = [
|
|
4
|
+
["rect", { x: "2", y: "2", width: "9", height: "9", fill: "#F25022" }],
|
|
5
|
+
["rect", { x: "13", y: "2", width: "9", height: "9", fill: "#7FBA00" }],
|
|
6
|
+
["rect", { x: "2", y: "13", width: "9", height: "9", fill: "#00A4EF" }],
|
|
7
|
+
["rect", { x: "13", y: "13", width: "9", height: "9", fill: "#FFB900" }],
|
|
8
|
+
] as const;
|
|
9
|
+
|
|
10
|
+
export const MicrosoftLogo = createLogo("MicrosoftLogo", "0 0 24 24", MICROSOFT_LOGO_NODE);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type IconSizeToken = "sm" | "md" | "lg" | "xl";
|
|
2
|
+
|
|
3
|
+
export type LogoStyleObject = Record<string, unknown>;
|
|
4
|
+
|
|
5
|
+
export type LogoOwnProps = {
|
|
6
|
+
size?: number | string;
|
|
7
|
+
title?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
style?: string | LogoStyleObject;
|
|
10
|
+
iconName?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type LogoProps = Omit<
|
|
14
|
+
JSX.IntrinsicElements["svg"],
|
|
15
|
+
"children" | "class" | "height" | "ref" | "role" | "stroke" | "style" | "title" | "width"
|
|
16
|
+
> &
|
|
17
|
+
LogoOwnProps & {
|
|
18
|
+
children?: unknown;
|
|
19
|
+
ref?: unknown;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type LogoNode = ReadonlyArray<
|
|
23
|
+
readonly [tag: string, attrs: Readonly<Record<string, string>>]
|
|
24
|
+
>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import type {
|
|
4
|
+
NavBrandProps,
|
|
5
|
+
NavGroupProps,
|
|
6
|
+
NavItemAsChildProps,
|
|
7
|
+
NavItemProps,
|
|
8
|
+
NavbarProps,
|
|
9
|
+
} from "./navbar.types";
|
|
10
|
+
import { classes } from "../_internal/classes";
|
|
11
|
+
|
|
12
|
+
export function Navbar(props: NavbarProps): JSX.Element {
|
|
13
|
+
const { children, ref, class: className, ...rest } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<nav {...rest} ref={ref} class={classes("navbar", className)} data-slot="navbar">
|
|
17
|
+
{children}
|
|
18
|
+
</nav>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function NavBrand(props: NavBrandProps): JSX.Element {
|
|
23
|
+
const { children, ref, class: className, ...rest } = props;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div {...rest} ref={ref} class={classes("navbar-brand", className)} data-slot="navbar-brand">
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function NavGroup(props: NavGroupProps): JSX.Element {
|
|
33
|
+
const { children, ref, class: className, ...rest } = props;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div {...rest} ref={ref} class={classes("navbar-group", className)} data-slot="navbar-group">
|
|
37
|
+
{children}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function NavItem(props: NavItemProps): JSX.Element;
|
|
43
|
+
export function NavItem(props: NavItemAsChildProps): JSX.Element;
|
|
44
|
+
export function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element {
|
|
45
|
+
const { asChild, children, ref, class: className, variant = "default", ...rest } = props;
|
|
46
|
+
|
|
47
|
+
const finalProps = mergeProps(rest, {
|
|
48
|
+
ref,
|
|
49
|
+
class: classes("navbar-item", variant === "icon" && "navbar-item-icon", className),
|
|
50
|
+
"data-slot": "nav-item",
|
|
51
|
+
"data-variant": variant,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (asChild) {
|
|
55
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return <a {...finalProps}>{children}</a>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type NavbarProps = Omit<JSX.IntrinsicElements["nav"], "children"> & {
|
|
2
|
+
children?: unknown;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type NavBrandProps = Omit<JSX.IntrinsicElements["div"], "children"> & {
|
|
6
|
+
children?: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type NavGroupProps = Omit<JSX.IntrinsicElements["div"], "children"> & {
|
|
10
|
+
children?: unknown;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
14
|
+
|
|
15
|
+
export type NavItemVariant = "default" | "icon";
|
|
16
|
+
|
|
17
|
+
export type NavItemOwnProps = {
|
|
18
|
+
children?: unknown;
|
|
19
|
+
variant?: NavItemVariant;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type NavItemProps = Omit<JSX.IntrinsicElements["a"], "children" | "ref"> &
|
|
23
|
+
NavItemOwnProps & {
|
|
24
|
+
asChild?: false;
|
|
25
|
+
ref?: Ref<HTMLAnchorElement>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type NavItemAsChildProps = Omit<JSX.IntrinsicElements["a"], "children" | "ref"> &
|
|
29
|
+
NavItemOwnProps & {
|
|
30
|
+
asChild: true;
|
|
31
|
+
children: JSXElement;
|
|
32
|
+
ref?: Ref<unknown>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const SECTION_A11Y_CONTRACT = {
|
|
2
|
+
DATA_ATTRIBUTES: {
|
|
3
|
+
slot: "data-slot" as const,
|
|
4
|
+
layout: "data-ak-layout" as const,
|
|
5
|
+
size: "data-size" as const,
|
|
6
|
+
},
|
|
7
|
+
SLOT_VALUES: {
|
|
8
|
+
root: "section" as const,
|
|
9
|
+
},
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
export type SectionA11yContract = typeof SECTION_A11Y_CONTRACT;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import {
|
|
4
|
+
applyBoxLayoutStyles,
|
|
5
|
+
splitBoxLayoutProps,
|
|
6
|
+
withBoxLayoutStyle,
|
|
7
|
+
} from "../_internal/box-layout";
|
|
8
|
+
import { serializeResponsiveValueIf } from "../_internal/layout";
|
|
9
|
+
import type { SectionAsChildProps, SectionElementProps } from "./section.types";
|
|
10
|
+
|
|
11
|
+
function isSectionSizeToken(value: unknown): value is string {
|
|
12
|
+
return typeof value === "string" && ["1", "2", "3", "4"].includes(value.trim());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Section(props: SectionElementProps): JSX.Element;
|
|
16
|
+
export function Section(props: SectionAsChildProps): JSX.Element;
|
|
17
|
+
export function Section(props: SectionElementProps | SectionAsChildProps) {
|
|
18
|
+
const { asChild, children, size = "3", ref, style: userStyle, ...rest } = props;
|
|
19
|
+
|
|
20
|
+
const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);
|
|
21
|
+
const layoutStyle: Record<string, string | number> = {};
|
|
22
|
+
applyBoxLayoutStyles(layoutStyle, boxProps);
|
|
23
|
+
|
|
24
|
+
const finalProps = mergeProps(passthroughProps, {
|
|
25
|
+
ref,
|
|
26
|
+
"data-slot": "section",
|
|
27
|
+
"data-ak-layout": "true",
|
|
28
|
+
"data-size": serializeResponsiveValueIf(size, isSectionSizeToken),
|
|
29
|
+
style: withBoxLayoutStyle(layoutStyle, userStyle),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (asChild) {
|
|
33
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return <section {...finalProps}>{children}</section>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
import type { BoxLayoutOwnProps, LayoutResponsive } from "../box/box.types";
|
|
3
|
+
|
|
4
|
+
export type SectionOwnProps = BoxLayoutOwnProps & {
|
|
5
|
+
size?: LayoutResponsive<"1" | "2" | "3" | "4">;
|
|
6
|
+
children?: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type SectionElementProps = Omit<JSX.IntrinsicElements["section"], "children" | "ref"> &
|
|
10
|
+
SectionOwnProps & {
|
|
11
|
+
asChild?: false;
|
|
12
|
+
ref?: Ref<HTMLElement>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type SectionAsChildProps = SectionOwnProps & {
|
|
16
|
+
asChild: true;
|
|
17
|
+
children: JSXElement;
|
|
18
|
+
ref?: Ref<unknown>;
|
|
19
|
+
style?: JSX.IntrinsicElements["section"]["style"];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type SectionProps = SectionElementProps | SectionAsChildProps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { Separator, Separator as Divider } from "./separator";
|
|
2
|
+
export { SEPARATOR_A11Y_CONTRACT, type SeparatorA11yContract } from "./separator.a11y";
|
|
3
|
+
export type {
|
|
4
|
+
SeparatorProps,
|
|
5
|
+
SeparatorProps as DividerProps,
|
|
6
|
+
SeparatorOwnProps,
|
|
7
|
+
SeparatorOwnProps as DividerOwnProps,
|
|
8
|
+
SeparatorNativeProps,
|
|
9
|
+
SeparatorNativeProps as DividerNativeProps,
|
|
10
|
+
SeparatorAsChildProps,
|
|
11
|
+
SeparatorAsChildProps as DividerAsChildProps,
|
|
12
|
+
} from "./separator.types";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WAI-ARIA Separator Pattern.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const SEPARATOR_A11Y_CONTRACT = {
|
|
6
|
+
ROLE: "separator" as const,
|
|
7
|
+
DECORATIVE_ROLE: "presentation" as const,
|
|
8
|
+
ORIENTATION_ATTRIBUTE: "aria-orientation" as const,
|
|
9
|
+
DATA_ATTRIBUTES: {
|
|
10
|
+
orientation: "data-orientation" as const,
|
|
11
|
+
},
|
|
12
|
+
DEFAULT_ORIENTATION: "horizontal" as const,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type SeparatorA11yContract = typeof SEPARATOR_A11Y_CONTRACT;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import type { SeparatorAsChildProps, SeparatorNativeProps } from "./separator.types";
|
|
4
|
+
|
|
5
|
+
export function Separator(props: SeparatorNativeProps): JSX.Element;
|
|
6
|
+
export function Separator(props: SeparatorAsChildProps): JSX.Element;
|
|
7
|
+
export function Separator(props: SeparatorNativeProps | SeparatorAsChildProps) {
|
|
8
|
+
const { asChild, children, decorative = false, orientation = "horizontal", ref, ...rest } = props;
|
|
9
|
+
|
|
10
|
+
const finalProps = mergeProps(rest, {
|
|
11
|
+
ref,
|
|
12
|
+
"data-slot": "separator",
|
|
13
|
+
"data-orientation": orientation,
|
|
14
|
+
role: decorative ? "presentation" : "separator",
|
|
15
|
+
"aria-orientation": decorative ? undefined : orientation,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (asChild) {
|
|
19
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return <div {...finalProps}>{children}</div>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type SeparatorOwnProps = {
|
|
4
|
+
decorative?: boolean;
|
|
5
|
+
orientation?: "horizontal" | "vertical";
|
|
6
|
+
children?: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type SeparatorNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
10
|
+
SeparatorOwnProps & {
|
|
11
|
+
asChild?: false;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type SeparatorAsChildProps = SeparatorOwnProps & {
|
|
16
|
+
asChild: true;
|
|
17
|
+
children: JSXElement;
|
|
18
|
+
ref?: Ref<unknown>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type SeparatorProps = SeparatorNativeProps | SeparatorAsChildProps;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const SIDEBAR_LAYOUT_A11Y_CONTRACT = {
|
|
2
|
+
DATA_ATTRIBUTES: {
|
|
3
|
+
slot: "data-slot" as const,
|
|
4
|
+
sidebarPosition: "data-sidebar-position" as const,
|
|
5
|
+
sidebarWidth: "data-sidebar-width" as const,
|
|
6
|
+
gap: "data-gap" as const,
|
|
7
|
+
collapseBelow: "data-collapse-below" as const,
|
|
8
|
+
},
|
|
9
|
+
SLOT_VALUES: {
|
|
10
|
+
root: "sidebar-layout" as const,
|
|
11
|
+
sidebar: "sidebar" as const,
|
|
12
|
+
main: "main" as const,
|
|
13
|
+
},
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type SidebarLayoutA11yContract = typeof SIDEBAR_LAYOUT_A11Y_CONTRACT;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isCssLength, mergeLayoutStyles, serializeValueIf } from "../_internal/layout";
|
|
2
|
+
import type { SidebarLayoutProps } from "./sidebar-layout.types";
|
|
3
|
+
|
|
4
|
+
function isThemeGapToken(value: unknown): value is string {
|
|
5
|
+
return typeof value === "string" && ["sm", "md", "lg", "xl"].includes(value.trim());
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function isThemeSidebarWidthToken(value: unknown): value is string {
|
|
9
|
+
return typeof value === "string" && ["sm", "md", "lg", "xl"].includes(value.trim());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function SidebarLayout(props: SidebarLayoutProps): JSX.Element {
|
|
13
|
+
const {
|
|
14
|
+
sidebar,
|
|
15
|
+
children,
|
|
16
|
+
sidebarPosition = "start",
|
|
17
|
+
sidebarWidth,
|
|
18
|
+
gap,
|
|
19
|
+
collapseBelow,
|
|
20
|
+
ref,
|
|
21
|
+
style: userStyle,
|
|
22
|
+
...rest
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
const wrapperStyle: Record<string, string | number> = {};
|
|
26
|
+
if (isCssLength(gap)) wrapperStyle.gap = gap!;
|
|
27
|
+
|
|
28
|
+
const sidebarStyle: Record<string, string | number> = {};
|
|
29
|
+
if (isCssLength(sidebarWidth)) {
|
|
30
|
+
sidebarStyle.width = sidebarWidth!;
|
|
31
|
+
sidebarStyle.flexBasis = sidebarWidth!;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
{...rest}
|
|
37
|
+
ref={ref}
|
|
38
|
+
data-slot="sidebar-layout"
|
|
39
|
+
data-sidebar-position={sidebarPosition}
|
|
40
|
+
data-sidebar-width={serializeValueIf(sidebarWidth, isThemeSidebarWidthToken)}
|
|
41
|
+
data-gap={serializeValueIf(gap, isThemeGapToken)}
|
|
42
|
+
data-collapse-below={collapseBelow}
|
|
43
|
+
style={mergeLayoutStyles(wrapperStyle, userStyle)}
|
|
44
|
+
>
|
|
45
|
+
{[
|
|
46
|
+
<aside
|
|
47
|
+
key="sidebar-layout-sidebar"
|
|
48
|
+
data-slot="sidebar"
|
|
49
|
+
style={mergeLayoutStyles(sidebarStyle, undefined)}
|
|
50
|
+
>
|
|
51
|
+
{sidebar}
|
|
52
|
+
</aside>,
|
|
53
|
+
<main key="sidebar-layout-main" data-slot="main">
|
|
54
|
+
{children}
|
|
55
|
+
</main>,
|
|
56
|
+
]}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type SidebarPosition = "start" | "end";
|
|
4
|
+
|
|
5
|
+
export type SidebarLayoutProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & {
|
|
6
|
+
/** Content rendered into the sidebar slot (aside). */
|
|
7
|
+
sidebar?: unknown;
|
|
8
|
+
/** Content rendered into the main slot. */
|
|
9
|
+
children?: unknown;
|
|
10
|
+
/** Which side the sidebar appears on. Defaults to 'start'. */
|
|
11
|
+
sidebarPosition?: SidebarPosition;
|
|
12
|
+
/** CSS width for the sidebar. Applied as inline style only when it is a real CSS length. */
|
|
13
|
+
sidebarWidth?: string;
|
|
14
|
+
/** CSS gap between sidebar and main. Applied as inline style only when it is a real CSS length. */
|
|
15
|
+
gap?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Named breakpoint below which the layout collapses to a single column.
|
|
18
|
+
* Official themes recognize `sm`, `md`, `lg`, and `xl`.
|
|
19
|
+
*/
|
|
20
|
+
collapseBelow?: string;
|
|
21
|
+
ref?: Ref<HTMLDivElement>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility contract for Skeleton.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const SKELETON_A11Y_CONTRACT = {
|
|
6
|
+
DATA_ATTRIBUTES: {
|
|
7
|
+
slot: "data-slot" as const,
|
|
8
|
+
},
|
|
9
|
+
MARKER: "data-skeleton" as const,
|
|
10
|
+
DECORATIVE_ATTRIBUTE: "aria-hidden" as const,
|
|
11
|
+
DECORATIVE_VALUE: "true" as const,
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type SkeletonA11yContract = typeof SKELETON_A11Y_CONTRACT;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import type { SkeletonAsChildProps, SkeletonProps } from "./skeleton.types";
|
|
4
|
+
|
|
5
|
+
export function Skeleton(props: SkeletonProps): JSX.Element;
|
|
6
|
+
export function Skeleton(props: SkeletonAsChildProps): JSX.Element;
|
|
7
|
+
export function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {
|
|
8
|
+
const { asChild, children, ref, ...rest } = props;
|
|
9
|
+
const finalProps = mergeProps(rest, {
|
|
10
|
+
ref,
|
|
11
|
+
"data-slot": "skeleton",
|
|
12
|
+
"data-skeleton": "true",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (asChild) {
|
|
17
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <div {...finalProps}>{children}</div>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type SkeletonOwnProps = {
|
|
4
|
+
children?: unknown;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type SkeletonProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
8
|
+
SkeletonOwnProps & {
|
|
9
|
+
asChild?: false;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type SkeletonAsChildProps = SkeletonOwnProps & {
|
|
14
|
+
asChild: true;
|
|
15
|
+
children: JSXElement;
|
|
16
|
+
ref?: Ref<unknown>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const SPACER_A11Y_CONTRACT = {
|
|
2
|
+
DATA_ATTRIBUTES: {
|
|
3
|
+
slot: "data-slot" as const,
|
|
4
|
+
axis: "data-axis" as const,
|
|
5
|
+
grow: "data-grow" as const,
|
|
6
|
+
shrink: "data-shrink" as const,
|
|
7
|
+
basis: "data-basis" as const,
|
|
8
|
+
},
|
|
9
|
+
SLOT_VALUES: {
|
|
10
|
+
root: "spacer" as const,
|
|
11
|
+
},
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type SpacerA11yContract = typeof SPACER_A11Y_CONTRACT;
|