@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,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout helpers shared by headless layout primitives.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type LayoutBreakpoint = "initial" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
export type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;
|
|
7
|
+
|
|
8
|
+
const BREAKPOINTS: readonly LayoutBreakpoint[] = ["initial", "sm", "md", "lg", "xl"];
|
|
9
|
+
|
|
10
|
+
/** Units and patterns that identify a concrete CSS length value. */
|
|
11
|
+
const CSS_UNIT_RE =
|
|
12
|
+
/^-?[\d.]+(%|px|em|rem|ex|ch|ic|lh|rlh|vw|vh|vmin|vmax|svw|svh|dvw|dvh|cqw|cqh|cqi|cqb|fr|cm|mm|in|pt|pc|Q)$/;
|
|
13
|
+
|
|
14
|
+
const SPACE_TOKEN_MAP: Record<string, string> = {
|
|
15
|
+
"1": "var(--ak-space-1)",
|
|
16
|
+
"2": "var(--ak-space-2)",
|
|
17
|
+
"3": "var(--ak-space-3)",
|
|
18
|
+
"4": "var(--ak-space-4)",
|
|
19
|
+
"5": "var(--ak-space-5)",
|
|
20
|
+
"6": "var(--ak-space-6)",
|
|
21
|
+
"7": "var(--ak-space-7)",
|
|
22
|
+
"8": "var(--ak-space-8)",
|
|
23
|
+
"9": "var(--ak-space-9)",
|
|
24
|
+
xs: "var(--ak-space-xs)",
|
|
25
|
+
sm: "var(--ak-space-sm)",
|
|
26
|
+
md: "var(--ak-space-md)",
|
|
27
|
+
lg: "var(--ak-space-lg)",
|
|
28
|
+
xl: "var(--ak-space-xl)",
|
|
29
|
+
"2xl": "var(--ak-space-2xl)",
|
|
30
|
+
"3xl": "var(--ak-space-3xl)",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const CONTAINER_SIZE_MAP: Record<string, string> = {
|
|
34
|
+
"1": "var(--ak-container-1)",
|
|
35
|
+
"2": "var(--ak-container-2)",
|
|
36
|
+
"3": "var(--ak-container-3)",
|
|
37
|
+
"4": "var(--ak-container-4)",
|
|
38
|
+
sm: "var(--ak-container-1)",
|
|
39
|
+
md: "var(--ak-container-2)",
|
|
40
|
+
lg: "var(--ak-container-3)",
|
|
41
|
+
xl: "var(--ak-container-4)",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const SECTION_SIZE_MAP: Record<string, string> = {
|
|
45
|
+
"1": "var(--ak-section-1)",
|
|
46
|
+
"2": "var(--ak-section-2)",
|
|
47
|
+
"3": "var(--ak-section-3)",
|
|
48
|
+
"4": "var(--ak-section-4)",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns true when `value` is a concrete CSS length/size that can be applied
|
|
53
|
+
* directly as an inline style.
|
|
54
|
+
*/
|
|
55
|
+
export function isCssLength(value: unknown): value is string {
|
|
56
|
+
if (typeof value !== "string") return false;
|
|
57
|
+
const v = value.trim();
|
|
58
|
+
if (v === "0") return true;
|
|
59
|
+
if (CSS_UNIT_RE.test(v)) return true;
|
|
60
|
+
// CSS functions: calc(), min(), max(), clamp(), fit-content(), env(), var()
|
|
61
|
+
if (/^[a-z][a-z-]*\(/.test(v)) return true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function isResponsiveValue<T>(
|
|
66
|
+
value: ResponsiveValue<T> | undefined,
|
|
67
|
+
): value is Partial<Record<LayoutBreakpoint, T>> {
|
|
68
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
69
|
+
return BREAKPOINTS.some((breakpoint) => breakpoint in value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function normalizeResponsiveValue<T>(
|
|
73
|
+
value: ResponsiveValue<T> | undefined,
|
|
74
|
+
): Partial<Record<LayoutBreakpoint, T>> | undefined {
|
|
75
|
+
if (value === undefined) return undefined;
|
|
76
|
+
if (isResponsiveValue(value)) return value;
|
|
77
|
+
return { initial: value };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function serializeResponsiveValue<T>(
|
|
81
|
+
value: ResponsiveValue<T> | undefined,
|
|
82
|
+
): string | undefined {
|
|
83
|
+
const normalized = normalizeResponsiveValue(value);
|
|
84
|
+
if (!normalized) return undefined;
|
|
85
|
+
|
|
86
|
+
return BREAKPOINTS.map((breakpoint) => {
|
|
87
|
+
const breakpointValue = normalized[breakpoint];
|
|
88
|
+
if (breakpointValue === undefined) return "";
|
|
89
|
+
return `${breakpoint}:${String(breakpointValue)}`;
|
|
90
|
+
})
|
|
91
|
+
.filter(Boolean)
|
|
92
|
+
.join("|");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function serializeResponsiveValueIf<T>(
|
|
96
|
+
value: ResponsiveValue<T> | undefined,
|
|
97
|
+
predicate: (value: T) => boolean,
|
|
98
|
+
): string | undefined {
|
|
99
|
+
const normalized = normalizeResponsiveValue(value);
|
|
100
|
+
if (!normalized) return undefined;
|
|
101
|
+
|
|
102
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
103
|
+
const breakpointValue = normalized[breakpoint];
|
|
104
|
+
if (breakpointValue === undefined) continue;
|
|
105
|
+
if (!predicate(breakpointValue)) return undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return serializeResponsiveValue(value);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function serializeValueIf<T>(
|
|
112
|
+
value: T | undefined,
|
|
113
|
+
predicate: (value: T) => boolean,
|
|
114
|
+
): string | undefined {
|
|
115
|
+
if (value === undefined || !predicate(value)) return undefined;
|
|
116
|
+
return String(value);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function setResponsiveStyleVar<T>(
|
|
120
|
+
styles: Record<string, string | number>,
|
|
121
|
+
variable: string,
|
|
122
|
+
value: ResponsiveValue<T> | undefined,
|
|
123
|
+
resolve: (value: T) => string | number | undefined = (input) =>
|
|
124
|
+
input as string | number | undefined,
|
|
125
|
+
) {
|
|
126
|
+
const normalized = normalizeResponsiveValue(value);
|
|
127
|
+
if (!normalized) return;
|
|
128
|
+
|
|
129
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
130
|
+
const breakpointValue = normalized[breakpoint];
|
|
131
|
+
if (breakpointValue === undefined) continue;
|
|
132
|
+
const resolved = resolve(breakpointValue);
|
|
133
|
+
if (resolved === undefined || resolved === null || resolved === "") continue;
|
|
134
|
+
styles[`--ak-${variable}-${breakpoint}`] = resolved;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function resolveSpaceValue(value: string | number): string | number {
|
|
139
|
+
if (typeof value === "number") return String(value);
|
|
140
|
+
const trimmed = value.trim();
|
|
141
|
+
return SPACE_TOKEN_MAP[trimmed] ?? trimmed;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function resolveContainerSizeValue(value: string): string {
|
|
145
|
+
const trimmed = value.trim();
|
|
146
|
+
return CONTAINER_SIZE_MAP[trimmed] ?? trimmed;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function resolveSectionSizeValue(value: string): string {
|
|
150
|
+
const trimmed = value.trim();
|
|
151
|
+
return SECTION_SIZE_MAP[trimmed] ?? trimmed;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function resolveGridTrackValue(value: string | number): string {
|
|
155
|
+
if (typeof value === "number") {
|
|
156
|
+
return `repeat(${value}, minmax(0, 1fr))`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const trimmed = value.trim();
|
|
160
|
+
if (/^\d+$/.test(trimmed)) {
|
|
161
|
+
return `repeat(${trimmed}, minmax(0, 1fr))`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return trimmed;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function resolveJustifyValue(value: string): string {
|
|
168
|
+
const trimmed = value.trim();
|
|
169
|
+
if (trimmed === "between") return "space-between";
|
|
170
|
+
if (trimmed === "start") return "flex-start";
|
|
171
|
+
if (trimmed === "end") return "flex-end";
|
|
172
|
+
return trimmed;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function resolveAlignValue(value: string): string {
|
|
176
|
+
const trimmed = value.trim();
|
|
177
|
+
if (trimmed === "start") return "flex-start";
|
|
178
|
+
if (trimmed === "end") return "flex-end";
|
|
179
|
+
return trimmed;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function resolveInlineAlignValue(value: "left" | "center" | "right"): {
|
|
183
|
+
marginLeft?: string;
|
|
184
|
+
marginRight?: string;
|
|
185
|
+
} {
|
|
186
|
+
if (value === "left") return { marginLeft: "0", marginRight: "auto" };
|
|
187
|
+
if (value === "right") return { marginLeft: "auto", marginRight: "0" };
|
|
188
|
+
return { marginLeft: "auto", marginRight: "auto" };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Merges a record of computed layout styles with a user-supplied `style` prop.
|
|
193
|
+
* The user's styles take precedence for conflicting keys.
|
|
194
|
+
*/
|
|
195
|
+
export function mergeLayoutStyles(
|
|
196
|
+
layout: Record<string, string | number>,
|
|
197
|
+
user: unknown,
|
|
198
|
+
): string | undefined {
|
|
199
|
+
const merged: Record<string, unknown> = { ...layout };
|
|
200
|
+
|
|
201
|
+
if (user !== null && user !== undefined && typeof user === "object") {
|
|
202
|
+
Object.assign(merged, user as Record<string, unknown>);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const mergedString = objectToCssString(merged);
|
|
206
|
+
|
|
207
|
+
if (typeof user === "string" && user.trim()) {
|
|
208
|
+
return mergedString ? `${mergedString};${user.trim()}` : user.trim();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return mergedString || undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function camelToKebab(s: string): string {
|
|
215
|
+
return s.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function objectToCssString(styles: Record<string, unknown>): string {
|
|
219
|
+
return Object.entries(styles)
|
|
220
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
221
|
+
.map(([key, value]) => `${camelToKebab(key)}:${String(value)}`)
|
|
222
|
+
.join(";");
|
|
223
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
type Handler = (...args: readonly unknown[]) => void;
|
|
2
|
+
type Ref<T> = { current: T | null } | ((value: T | null) => void) | null | undefined;
|
|
3
|
+
|
|
4
|
+
function isEventHandlerKey(key: string): boolean {
|
|
5
|
+
return key.startsWith("on");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function isDefaultPrevented(value: unknown): value is { defaultPrevented: true } {
|
|
9
|
+
return (
|
|
10
|
+
typeof value === "object" &&
|
|
11
|
+
value !== null &&
|
|
12
|
+
"defaultPrevented" in value &&
|
|
13
|
+
(value as { defaultPrevented?: boolean }).defaultPrevented === true
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function composeHandlers(first: Handler, second: Handler): Handler {
|
|
18
|
+
return (...args) => {
|
|
19
|
+
first(...args);
|
|
20
|
+
|
|
21
|
+
if (isDefaultPrevented(args[0])) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
second(...args);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function setRef<T>(ref: Ref<T>, value: T | null): void {
|
|
30
|
+
if (!ref) return;
|
|
31
|
+
|
|
32
|
+
if (typeof ref === "function") {
|
|
33
|
+
ref(value);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (Object.isExtensible(ref)) {
|
|
38
|
+
(ref as { current: T | null }).current = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function composeRefs<T>(...refs: Array<Ref<T>>): (value: T | null) => void {
|
|
43
|
+
return (value: T | null) => {
|
|
44
|
+
for (const ref of refs) {
|
|
45
|
+
setRef(ref, value);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function mergeProps<TBase extends object, TInjected extends object>(
|
|
51
|
+
base: TBase,
|
|
52
|
+
injected: TInjected,
|
|
53
|
+
): TInjected & TBase {
|
|
54
|
+
const baseKeys = Object.keys(base);
|
|
55
|
+
if (baseKeys.length === 0) {
|
|
56
|
+
return injected as TInjected & TBase;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const out = { ...(injected as object) } as TInjected & TBase;
|
|
60
|
+
|
|
61
|
+
for (const key of baseKeys as Array<Extract<keyof TBase, string>>) {
|
|
62
|
+
const baseValue = (base as Record<string, unknown>)[key];
|
|
63
|
+
const injectedValue = (injected as Record<string, unknown>)[key];
|
|
64
|
+
|
|
65
|
+
if (key === "ref") {
|
|
66
|
+
(out as Record<string, unknown>)[key] = composeRefs(
|
|
67
|
+
injectedValue as Ref<unknown>,
|
|
68
|
+
baseValue as Ref<unknown>,
|
|
69
|
+
);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
isEventHandlerKey(key) &&
|
|
75
|
+
typeof baseValue === "function" &&
|
|
76
|
+
typeof injectedValue === "function"
|
|
77
|
+
) {
|
|
78
|
+
(out as Record<string, unknown>)[key] = composeHandlers(
|
|
79
|
+
injectedValue as Handler,
|
|
80
|
+
baseValue as Handler,
|
|
81
|
+
);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
(out as Record<string, unknown>)[key] = baseValue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function mergeCssVar(style: unknown, name: string, value: string): string {
|
|
2
|
+
const decl = `${name}:${value}`;
|
|
3
|
+
|
|
4
|
+
if (typeof style === "string") {
|
|
5
|
+
const trimmed = style.trim();
|
|
6
|
+
return trimmed ? `${trimmed};${decl}` : decl;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (style && typeof style === "object") {
|
|
10
|
+
const entries = Object.entries(style as Record<string, unknown>)
|
|
11
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
12
|
+
.map(([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${String(v)}`)
|
|
13
|
+
.join(";");
|
|
14
|
+
return entries ? `${entries};${decl}` : decl;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return decl;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AccessibleIconProps } from "./accessible-icon.types";
|
|
2
|
+
|
|
3
|
+
export function AccessibleIcon(props: AccessibleIconProps): JSX.Element {
|
|
4
|
+
const { children, label, decorative = label ? false : true } = props;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<span
|
|
8
|
+
data-slot="accessible-icon"
|
|
9
|
+
data-decorative={decorative ? "true" : undefined}
|
|
10
|
+
role={decorative ? undefined : "img"}
|
|
11
|
+
aria-hidden={decorative ? "true" : undefined}
|
|
12
|
+
aria-label={decorative ? undefined : label}
|
|
13
|
+
>
|
|
14
|
+
{children}
|
|
15
|
+
{!decorative && label ? <span class="sr-only">{label}</span> : null}
|
|
16
|
+
</span>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import type { AspectRatioAsChildProps, AspectRatioProps } from "./aspect-ratio.types";
|
|
4
|
+
|
|
5
|
+
function serializeStyle(base: Record<string, string | number>, user: unknown): string {
|
|
6
|
+
const merged: Record<string, unknown> = { ...base };
|
|
7
|
+
|
|
8
|
+
if (user && typeof user === "object") {
|
|
9
|
+
Object.assign(merged, user as Record<string, unknown>);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (typeof user === "string" && user.trim()) {
|
|
13
|
+
return `${Object.entries(merged)
|
|
14
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
15
|
+
.map(([key, value]) => key.replace(/([A-Z])/g, "-$1").toLowerCase() + ":" + String(value))
|
|
16
|
+
.join(";")};${user.trim()}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return Object.entries(merged)
|
|
20
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
21
|
+
.map(([key, value]) => key.replace(/([A-Z])/g, "-$1").toLowerCase() + ":" + String(value))
|
|
22
|
+
.join(";");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function AspectRatio(props: AspectRatioProps): JSX.Element;
|
|
26
|
+
export function AspectRatio(props: AspectRatioAsChildProps): JSX.Element;
|
|
27
|
+
export function AspectRatio(props: AspectRatioProps | AspectRatioAsChildProps) {
|
|
28
|
+
const { asChild, children, ratio = 1, ref, style, ...rest } = props;
|
|
29
|
+
const finalProps = mergeProps(rest, {
|
|
30
|
+
ref,
|
|
31
|
+
"data-slot": "aspect-ratio",
|
|
32
|
+
style: serializeStyle(
|
|
33
|
+
{
|
|
34
|
+
display: "block",
|
|
35
|
+
width: "100%",
|
|
36
|
+
aspectRatio: String(ratio),
|
|
37
|
+
overflow: "hidden",
|
|
38
|
+
},
|
|
39
|
+
style,
|
|
40
|
+
),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (asChild) {
|
|
44
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return <div {...finalProps}>{children}</div>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type AspectRatioOwnProps = {
|
|
4
|
+
children?: unknown;
|
|
5
|
+
ratio?: number | string;
|
|
6
|
+
style?: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type AspectRatioProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
10
|
+
AspectRatioOwnProps & {
|
|
11
|
+
asChild?: false;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type AspectRatioAsChildProps = AspectRatioOwnProps & {
|
|
16
|
+
asChild: true;
|
|
17
|
+
children: JSXElement;
|
|
18
|
+
ref?: Ref<unknown>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility contract for Badge.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const BADGE_A11Y_CONTRACT = {
|
|
6
|
+
DATA_ATTRIBUTES: {
|
|
7
|
+
slot: "data-slot" as const,
|
|
8
|
+
},
|
|
9
|
+
MARKER: "data-badge" as const,
|
|
10
|
+
CONTENT: {
|
|
11
|
+
textAllowed: true,
|
|
12
|
+
},
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type BadgeA11yContract = typeof BADGE_A11Y_CONTRACT;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import type { BadgeAsChildProps, BadgeProps } from "./badge.types";
|
|
4
|
+
|
|
5
|
+
export function Badge(props: BadgeProps): JSX.Element;
|
|
6
|
+
export function Badge(props: BadgeAsChildProps): JSX.Element;
|
|
7
|
+
export function Badge(props: BadgeProps | BadgeAsChildProps) {
|
|
8
|
+
const { asChild, children, variant, ref, ...rest } = props;
|
|
9
|
+
const finalProps = mergeProps(rest, {
|
|
10
|
+
ref,
|
|
11
|
+
"data-slot": "badge",
|
|
12
|
+
"data-badge": "true",
|
|
13
|
+
"data-variant": variant && variant !== "default" ? variant : undefined,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (asChild) {
|
|
17
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <span {...finalProps}>{children}</span>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type BadgeVariant =
|
|
4
|
+
| "default"
|
|
5
|
+
| "secondary"
|
|
6
|
+
| "outline"
|
|
7
|
+
| "success"
|
|
8
|
+
| "warning"
|
|
9
|
+
| "danger"
|
|
10
|
+
| "info";
|
|
11
|
+
|
|
12
|
+
export type BadgeOwnProps = {
|
|
13
|
+
children?: unknown;
|
|
14
|
+
variant?: BadgeVariant;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type BadgeProps = Omit<JSX.IntrinsicElements["span"], "children" | "ref"> &
|
|
18
|
+
BadgeOwnProps & {
|
|
19
|
+
asChild?: false;
|
|
20
|
+
ref?: Ref<HTMLSpanElement>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type BadgeAsChildProps = BadgeOwnProps & {
|
|
24
|
+
asChild: true;
|
|
25
|
+
children: JSXElement;
|
|
26
|
+
ref?: Ref<unknown>;
|
|
27
|
+
};
|
|
@@ -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 type { BoxAsChildProps, BoxDivProps, BoxSpanProps } from "./box.types";
|
|
9
|
+
|
|
10
|
+
export function Box(props: BoxDivProps): JSX.Element;
|
|
11
|
+
export function Box(props: BoxSpanProps): JSX.Element;
|
|
12
|
+
export function Box(props: BoxAsChildProps): JSX.Element;
|
|
13
|
+
export function Box(props: BoxDivProps | BoxSpanProps | BoxAsChildProps) {
|
|
14
|
+
const as = "as" in props ? props.as : "div";
|
|
15
|
+
const { asChild, children, ref, style: userStyle, ...rest } = props;
|
|
16
|
+
|
|
17
|
+
const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);
|
|
18
|
+
const layoutStyle: Record<string, string | number> = {};
|
|
19
|
+
applyBoxLayoutStyles(layoutStyle, boxProps);
|
|
20
|
+
|
|
21
|
+
const finalProps = mergeProps(passthroughProps, {
|
|
22
|
+
ref,
|
|
23
|
+
"data-slot": "box",
|
|
24
|
+
"data-ak-layout": "true",
|
|
25
|
+
style: withBoxLayoutStyle(layoutStyle, userStyle),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (asChild) {
|
|
29
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (as === "span") {
|
|
33
|
+
return <span {...finalProps}>{children}</span>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return <div {...finalProps}>{children}</div>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
import type { ResponsiveValue } from "../_internal/layout";
|
|
3
|
+
|
|
4
|
+
export type LayoutResponsive<T> = ResponsiveValue<T>;
|
|
5
|
+
|
|
6
|
+
export type BoxLayoutOwnProps = {
|
|
7
|
+
display?: ResponsiveValue<string>;
|
|
8
|
+
m?: ResponsiveValue<string | number>;
|
|
9
|
+
mx?: ResponsiveValue<string | number>;
|
|
10
|
+
my?: ResponsiveValue<string | number>;
|
|
11
|
+
mt?: ResponsiveValue<string | number>;
|
|
12
|
+
mr?: ResponsiveValue<string | number>;
|
|
13
|
+
mb?: ResponsiveValue<string | number>;
|
|
14
|
+
ml?: ResponsiveValue<string | number>;
|
|
15
|
+
p?: ResponsiveValue<string | number>;
|
|
16
|
+
px?: ResponsiveValue<string | number>;
|
|
17
|
+
py?: ResponsiveValue<string | number>;
|
|
18
|
+
pt?: ResponsiveValue<string | number>;
|
|
19
|
+
pr?: ResponsiveValue<string | number>;
|
|
20
|
+
pb?: ResponsiveValue<string | number>;
|
|
21
|
+
pl?: ResponsiveValue<string | number>;
|
|
22
|
+
width?: ResponsiveValue<string>;
|
|
23
|
+
minWidth?: ResponsiveValue<string>;
|
|
24
|
+
maxWidth?: ResponsiveValue<string>;
|
|
25
|
+
height?: ResponsiveValue<string>;
|
|
26
|
+
minHeight?: ResponsiveValue<string>;
|
|
27
|
+
maxHeight?: ResponsiveValue<string>;
|
|
28
|
+
position?: ResponsiveValue<string>;
|
|
29
|
+
inset?: ResponsiveValue<string | number>;
|
|
30
|
+
top?: ResponsiveValue<string | number>;
|
|
31
|
+
right?: ResponsiveValue<string | number>;
|
|
32
|
+
bottom?: ResponsiveValue<string | number>;
|
|
33
|
+
left?: ResponsiveValue<string | number>;
|
|
34
|
+
overflow?: ResponsiveValue<string>;
|
|
35
|
+
overflowX?: ResponsiveValue<string>;
|
|
36
|
+
overflowY?: ResponsiveValue<string>;
|
|
37
|
+
flexBasis?: ResponsiveValue<string>;
|
|
38
|
+
flexGrow?: ResponsiveValue<string | number>;
|
|
39
|
+
flexShrink?: ResponsiveValue<string | number>;
|
|
40
|
+
gridArea?: ResponsiveValue<string>;
|
|
41
|
+
gridColumn?: ResponsiveValue<string>;
|
|
42
|
+
gridColumnStart?: ResponsiveValue<string>;
|
|
43
|
+
gridColumnEnd?: ResponsiveValue<string>;
|
|
44
|
+
gridRow?: ResponsiveValue<string>;
|
|
45
|
+
gridRowStart?: ResponsiveValue<string>;
|
|
46
|
+
gridRowEnd?: ResponsiveValue<string>;
|
|
47
|
+
children?: unknown;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type BoxOwnProps = BoxLayoutOwnProps & {
|
|
51
|
+
as?: "div" | "span";
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type BoxDivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
55
|
+
BoxOwnProps & {
|
|
56
|
+
as?: "div";
|
|
57
|
+
asChild?: false;
|
|
58
|
+
ref?: Ref<HTMLDivElement>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type BoxSpanProps = Omit<JSX.IntrinsicElements["span"], "children" | "ref"> &
|
|
62
|
+
BoxOwnProps & {
|
|
63
|
+
as: "span";
|
|
64
|
+
asChild?: false;
|
|
65
|
+
ref?: Ref<HTMLSpanElement>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type BoxAsChildProps = Omit<BoxOwnProps, "as"> & {
|
|
69
|
+
asChild: true;
|
|
70
|
+
children: JSXElement;
|
|
71
|
+
ref?: Ref<unknown>;
|
|
72
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type BoxProps = BoxDivProps | BoxSpanProps | BoxAsChildProps;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Box } from "./box";
|
|
2
|
+
export { BOX_A11Y_CONTRACT, type BoxA11yContract } from "./box.a11y";
|
|
3
|
+
export type {
|
|
4
|
+
BoxProps,
|
|
5
|
+
BoxOwnProps,
|
|
6
|
+
BoxLayoutOwnProps,
|
|
7
|
+
BoxDivProps,
|
|
8
|
+
BoxSpanProps,
|
|
9
|
+
BoxAsChildProps,
|
|
10
|
+
LayoutResponsive,
|
|
11
|
+
} from "./box.types";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breadcrumb accessibility contract.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const BREADCRUMB_A11Y_CONTRACT = {
|
|
6
|
+
DATA_ATTRIBUTES: {
|
|
7
|
+
slot: "data-slot" as const,
|
|
8
|
+
},
|
|
9
|
+
NAV_ROLE: "navigation" as const,
|
|
10
|
+
CURRENT_PAGE_ATTRIBUTE: "aria-current" as const,
|
|
11
|
+
CURRENT_PAGE_VALUE: "page" as const,
|
|
12
|
+
SEPARATOR_MARKER: "data-breadcrumb-separator" as const,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type BreadcrumbA11yContract = typeof BREADCRUMB_A11Y_CONTRACT;
|