@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,58 @@
|
|
|
1
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import { isCssLength, mergeLayoutStyles } from "../_internal/layout";
|
|
4
|
+
import { isJsxElement, toChildArray } from "../_internal/jsx";
|
|
5
|
+
import type { SpacerAsChildProps, SpacerNativeProps } from "./spacer.types";
|
|
6
|
+
|
|
7
|
+
export function Spacer(props: SpacerNativeProps): JSX.Element;
|
|
8
|
+
export function Spacer(props: SpacerAsChildProps): JSX.Element;
|
|
9
|
+
export function Spacer(props: SpacerNativeProps | SpacerAsChildProps) {
|
|
10
|
+
const { asChild, children, grow, shrink, basis, axis, ref, style: userStyle, ...rest } = props;
|
|
11
|
+
|
|
12
|
+
const layoutStyle: Record<string, string | number> = {};
|
|
13
|
+
|
|
14
|
+
if (axis === "inline") {
|
|
15
|
+
if (shrink !== undefined && shrink !== 0) {
|
|
16
|
+
layoutStyle.flexShrink = shrink;
|
|
17
|
+
}
|
|
18
|
+
if (isCssLength(basis)) layoutStyle.width = basis!;
|
|
19
|
+
} else if (axis === "block") {
|
|
20
|
+
if (shrink !== undefined && shrink !== 0) {
|
|
21
|
+
layoutStyle.flexShrink = shrink;
|
|
22
|
+
}
|
|
23
|
+
if (isCssLength(basis)) layoutStyle.height = basis!;
|
|
24
|
+
} else {
|
|
25
|
+
if (grow !== undefined && grow !== 1) {
|
|
26
|
+
layoutStyle.flexGrow = grow;
|
|
27
|
+
}
|
|
28
|
+
if (shrink !== undefined && shrink !== 1) {
|
|
29
|
+
layoutStyle.flexShrink = shrink;
|
|
30
|
+
}
|
|
31
|
+
if (isCssLength(basis)) {
|
|
32
|
+
layoutStyle.flexBasis = basis!;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const finalProps = mergeProps(rest, {
|
|
37
|
+
ref,
|
|
38
|
+
"data-slot": "spacer",
|
|
39
|
+
"data-axis": axis,
|
|
40
|
+
style: mergeLayoutStyles(layoutStyle, userStyle),
|
|
41
|
+
});
|
|
42
|
+
const keyedChildren = toChildArray(children).map((child, index) => {
|
|
43
|
+
if (!isJsxElement(child) || child.key != null) {
|
|
44
|
+
return child;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
...child,
|
|
49
|
+
key: `spacer-${index}`,
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (asChild) {
|
|
54
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return <div {...finalProps}>{keyedChildren}</div>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type SpacerAxis = "inline" | "block";
|
|
4
|
+
|
|
5
|
+
export type SpacerOwnProps = {
|
|
6
|
+
/** flex-grow factor (default 1 when no axis is set). */
|
|
7
|
+
grow?: number;
|
|
8
|
+
/** flex-shrink factor (default 1 when no axis is set, 0 when axis is set). */
|
|
9
|
+
shrink?: number;
|
|
10
|
+
/** CSS flex-basis / width (axis=inline) / height (axis=block) value. Applied as inline style only when it is a real CSS length. */
|
|
11
|
+
basis?: string;
|
|
12
|
+
/** When set, renders a fixed space along the given axis instead of a flex-grow spacer. */
|
|
13
|
+
axis?: SpacerAxis;
|
|
14
|
+
children?: unknown;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type SpacerNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
18
|
+
SpacerOwnProps & {
|
|
19
|
+
asChild?: false;
|
|
20
|
+
ref?: Ref<HTMLDivElement>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type SpacerAsChildProps = SpacerOwnProps & {
|
|
24
|
+
asChild: true;
|
|
25
|
+
children: JSXElement;
|
|
26
|
+
ref?: Ref<unknown>;
|
|
27
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type SpacerProps = SpacerNativeProps | SpacerAsChildProps;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ProgressCircle } from "@askrjs/ui";
|
|
2
|
+
import type { SpinnerProps } from "./spinner.types";
|
|
3
|
+
|
|
4
|
+
export function Spinner(props: SpinnerProps): JSX.Element {
|
|
5
|
+
const {
|
|
6
|
+
label,
|
|
7
|
+
"aria-label": ariaLabel,
|
|
8
|
+
...rest
|
|
9
|
+
} = props as SpinnerProps & {
|
|
10
|
+
"aria-label"?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<ProgressCircle
|
|
15
|
+
{...rest}
|
|
16
|
+
aria-label={ariaLabel ?? label ?? "Loading"}
|
|
17
|
+
value={null}
|
|
18
|
+
getValueLabel={() => label ?? "Loading"}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const STACK_A11Y_CONTRACT = {
|
|
2
|
+
DATA_ATTRIBUTES: {
|
|
3
|
+
slot: "data-slot" as const,
|
|
4
|
+
layout: "data-ak-layout" as const,
|
|
5
|
+
gap: "data-gap" as const,
|
|
6
|
+
align: "data-align" as const,
|
|
7
|
+
justify: "data-justify" as const,
|
|
8
|
+
wrap: "data-wrap" as const,
|
|
9
|
+
},
|
|
10
|
+
SLOT_VALUES: {
|
|
11
|
+
root: "stack" as const,
|
|
12
|
+
},
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type StackA11yContract = typeof STACK_A11Y_CONTRACT;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Flex } from "../flex";
|
|
2
|
+
import type { StackAsChildProps, StackDivProps } from "./stack.types";
|
|
3
|
+
|
|
4
|
+
export function Stack(props: StackDivProps): JSX.Element;
|
|
5
|
+
export function Stack(props: StackAsChildProps): JSX.Element;
|
|
6
|
+
export function Stack(props: StackDivProps | StackAsChildProps) {
|
|
7
|
+
const { children, ...rest } = props;
|
|
8
|
+
return (
|
|
9
|
+
<Flex {...(rest as Record<string, unknown>)} data-slot="stack" direction="column">
|
|
10
|
+
{children}
|
|
11
|
+
</Flex>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
import type { FlexOwnProps } from "../flex/flex.types";
|
|
3
|
+
|
|
4
|
+
export type StackOwnProps = Omit<FlexOwnProps, "direction" | "as"> & {
|
|
5
|
+
children?: unknown;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type StackDivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
9
|
+
StackOwnProps & {
|
|
10
|
+
asChild?: false;
|
|
11
|
+
ref?: Ref<HTMLDivElement>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type StackAsChildProps = StackOwnProps & {
|
|
15
|
+
asChild: true;
|
|
16
|
+
children: JSXElement;
|
|
17
|
+
ref?: Ref<unknown>;
|
|
18
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type StackProps = StackDivProps | StackAsChildProps;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DEFAULT_THEME_OPTIONS, ThemePicker, ThemeProvider, ThemeToggle, useTheme } from "./theme";
|
|
2
|
+
export type {
|
|
3
|
+
ThemeContextValue,
|
|
4
|
+
ThemeName,
|
|
5
|
+
ThemeOption,
|
|
6
|
+
ThemePickerProps,
|
|
7
|
+
ThemeProviderProps,
|
|
8
|
+
ThemeToggleProps,
|
|
9
|
+
ThemeToggleRenderContext,
|
|
10
|
+
} from "./theme";
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { defineContext, readContext, state } from "@askrjs/askr";
|
|
2
|
+
import { resource } from "@askrjs/askr/resources";
|
|
3
|
+
import { Button } from "@askrjs/ui";
|
|
4
|
+
import type { ButtonNativeProps, PressEvent } from "@askrjs/ui";
|
|
5
|
+
|
|
6
|
+
export type ThemeName = "light" | "dark" | "system" | (string & {});
|
|
7
|
+
|
|
8
|
+
export type ThemeOption = {
|
|
9
|
+
value: ThemeName;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ThemeContextValue = {
|
|
14
|
+
theme: () => ThemeName;
|
|
15
|
+
setTheme: (theme: ThemeName) => void;
|
|
16
|
+
themes: readonly ThemeOption[];
|
|
17
|
+
storageKey: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ThemeProviderProps = {
|
|
21
|
+
children?: unknown;
|
|
22
|
+
defaultTheme?: ThemeName;
|
|
23
|
+
themes?: readonly ThemeOption[];
|
|
24
|
+
storageKey?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ThemePickerProps = Omit<
|
|
28
|
+
JSX.IntrinsicElements["select"],
|
|
29
|
+
"children" | "value" | "defaultValue" | "onChange"
|
|
30
|
+
> & {
|
|
31
|
+
themes?: readonly ThemeOption[];
|
|
32
|
+
label?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type ThemeToggleRenderContext = {
|
|
36
|
+
theme: ThemeName;
|
|
37
|
+
nextTheme: ThemeName;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type ThemeToggleProps = Omit<ButtonNativeProps, "children" | "onPress"> & {
|
|
41
|
+
children?: unknown | ((context: ThemeToggleRenderContext) => unknown);
|
|
42
|
+
lightIcon?: unknown;
|
|
43
|
+
darkIcon?: unknown;
|
|
44
|
+
systemIcon?: unknown;
|
|
45
|
+
toggleThemes?: readonly ThemeName[];
|
|
46
|
+
onPress?: (event: PressEvent) => void;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const DEFAULT_THEME_OPTIONS: readonly ThemeOption[] = [
|
|
50
|
+
{ value: "system", label: "System" },
|
|
51
|
+
{ value: "light", label: "Light" },
|
|
52
|
+
{ value: "dark", label: "Dark" },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
const DEFAULT_STORAGE_KEY = "askr-theme";
|
|
56
|
+
|
|
57
|
+
const ThemeContext = defineContext<ThemeContextValue>({
|
|
58
|
+
theme: () => "system",
|
|
59
|
+
setTheme: () => undefined,
|
|
60
|
+
themes: DEFAULT_THEME_OPTIONS,
|
|
61
|
+
storageKey: DEFAULT_STORAGE_KEY,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export function useTheme(): ThemeContextValue {
|
|
65
|
+
return readContext(ThemeContext);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function ThemeProvider(props: ThemeProviderProps): JSX.Element {
|
|
69
|
+
const {
|
|
70
|
+
children,
|
|
71
|
+
defaultTheme = "system",
|
|
72
|
+
themes = DEFAULT_THEME_OPTIONS,
|
|
73
|
+
storageKey = DEFAULT_STORAGE_KEY,
|
|
74
|
+
} = props;
|
|
75
|
+
|
|
76
|
+
const themeState = state<ThemeName>(readStoredTheme(storageKey) ?? defaultTheme);
|
|
77
|
+
|
|
78
|
+
const setTheme = (nextTheme: ThemeName) => {
|
|
79
|
+
themeState.set(nextTheme);
|
|
80
|
+
writeStoredTheme(storageKey, nextTheme);
|
|
81
|
+
syncThemeRoot(nextTheme);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const value: ThemeContextValue = {
|
|
85
|
+
theme: themeState,
|
|
86
|
+
setTheme,
|
|
87
|
+
themes,
|
|
88
|
+
storageKey,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const currentTheme = themeState();
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<ThemeContext.Scope value={value}>
|
|
95
|
+
<ThemeRootSync theme={currentTheme} />
|
|
96
|
+
<div data-slot="theme-provider">{children}</div>
|
|
97
|
+
</ThemeContext.Scope>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function ThemeRootSync(props: { theme: ThemeName }): JSX.Element | null {
|
|
102
|
+
const { theme } = props;
|
|
103
|
+
|
|
104
|
+
resource(
|
|
105
|
+
({ signal }: { signal: AbortSignal }) => {
|
|
106
|
+
if (typeof window === "undefined") {
|
|
107
|
+
syncThemeRoot(theme);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const timeoutId = window.setTimeout(() => {
|
|
112
|
+
if (!signal.aborted) {
|
|
113
|
+
syncThemeRoot(theme);
|
|
114
|
+
}
|
|
115
|
+
}, 0);
|
|
116
|
+
|
|
117
|
+
signal.addEventListener(
|
|
118
|
+
"abort",
|
|
119
|
+
() => {
|
|
120
|
+
window.clearTimeout(timeoutId);
|
|
121
|
+
},
|
|
122
|
+
{ once: true },
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
return null;
|
|
126
|
+
},
|
|
127
|
+
[theme],
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function ThemePicker(props: ThemePickerProps): JSX.Element {
|
|
134
|
+
const theme = useTheme();
|
|
135
|
+
const { themes = theme.themes, label = "Theme", ...rest } = props;
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<select
|
|
139
|
+
{...rest}
|
|
140
|
+
aria-label={rest["aria-label"] ?? label}
|
|
141
|
+
data-slot="theme-picker"
|
|
142
|
+
value={theme.theme()}
|
|
143
|
+
onChange={(event: Event) => {
|
|
144
|
+
const target = event.currentTarget as HTMLSelectElement;
|
|
145
|
+
theme.setTheme(target.value as ThemeName);
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
{themes.map((option) => (
|
|
149
|
+
<option key={option.value} value={option.value}>
|
|
150
|
+
{option.label}
|
|
151
|
+
</option>
|
|
152
|
+
))}
|
|
153
|
+
</select>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function ThemeToggle(props: ThemeToggleProps): JSX.Element {
|
|
158
|
+
const theme = useTheme();
|
|
159
|
+
const {
|
|
160
|
+
children,
|
|
161
|
+
lightIcon,
|
|
162
|
+
darkIcon,
|
|
163
|
+
systemIcon,
|
|
164
|
+
toggleThemes = ["light", "dark"],
|
|
165
|
+
onPress,
|
|
166
|
+
...rest
|
|
167
|
+
} = props;
|
|
168
|
+
|
|
169
|
+
const currentTheme = theme.theme();
|
|
170
|
+
const nextTheme = getNextTheme(currentTheme, toggleThemes);
|
|
171
|
+
const renderContext = { theme: currentTheme, nextTheme };
|
|
172
|
+
const ariaLabel = (rest as Record<string, unknown>)["aria-label"];
|
|
173
|
+
const themedIcon = resolveThemeToggleIcon(currentTheme, nextTheme, {
|
|
174
|
+
lightIcon,
|
|
175
|
+
darkIcon,
|
|
176
|
+
systemIcon,
|
|
177
|
+
});
|
|
178
|
+
const content =
|
|
179
|
+
typeof children === "function" ? children(renderContext) : (children ?? themedIcon);
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<Button
|
|
183
|
+
{...(rest as ButtonNativeProps)}
|
|
184
|
+
aria-label={typeof ariaLabel === "string" ? ariaLabel : `Switch to ${nextTheme} theme`}
|
|
185
|
+
data-theme-control="toggle"
|
|
186
|
+
data-theme-choice={currentTheme}
|
|
187
|
+
data-next-theme={nextTheme}
|
|
188
|
+
onPress={(event) => {
|
|
189
|
+
onPress?.(event);
|
|
190
|
+
if (!event.defaultPrevented) theme.setTheme(nextTheme);
|
|
191
|
+
}}
|
|
192
|
+
>
|
|
193
|
+
{content}
|
|
194
|
+
</Button>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function getNextTheme(currentTheme: ThemeName, themes: readonly ThemeName[]): ThemeName {
|
|
199
|
+
if (themes.length === 0) return currentTheme;
|
|
200
|
+
const index = themes.indexOf(currentTheme);
|
|
201
|
+
return themes[index >= 0 && index < themes.length - 1 ? index + 1 : 0]!;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function getThemeIcon(
|
|
205
|
+
theme: ThemeName,
|
|
206
|
+
icons: Pick<ThemeToggleProps, "lightIcon" | "darkIcon" | "systemIcon">,
|
|
207
|
+
): unknown {
|
|
208
|
+
if (theme === "light") return icons.lightIcon;
|
|
209
|
+
if (theme === "dark") return icons.darkIcon;
|
|
210
|
+
if (theme === "system") return icons.systemIcon;
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export function resolveThemeToggleIcon(
|
|
215
|
+
theme: ThemeName,
|
|
216
|
+
nextTheme: ThemeName,
|
|
217
|
+
icons: Pick<ThemeToggleProps, "lightIcon" | "darkIcon" | "systemIcon">,
|
|
218
|
+
): unknown {
|
|
219
|
+
return getThemeIcon(theme, icons) ?? getThemeIcon(nextTheme, icons);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function syncThemeRoot(themeChoice: ThemeName | null | undefined): void {
|
|
223
|
+
if (typeof document === "undefined") {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const html = document.documentElement;
|
|
228
|
+
|
|
229
|
+
if (themeChoice == null) {
|
|
230
|
+
html.removeAttribute("data-theme");
|
|
231
|
+
html.removeAttribute("data-theme-choice");
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
html.setAttribute("data-theme-choice", themeChoice);
|
|
236
|
+
|
|
237
|
+
if (themeChoice === "system") {
|
|
238
|
+
html.removeAttribute("data-theme");
|
|
239
|
+
} else {
|
|
240
|
+
html.setAttribute("data-theme", themeChoice);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function readStoredTheme(storageKey: string): ThemeName | undefined {
|
|
245
|
+
if (typeof window === "undefined") return undefined;
|
|
246
|
+
try {
|
|
247
|
+
return (window.localStorage.getItem(storageKey) as ThemeName | null) ?? undefined;
|
|
248
|
+
} catch {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function writeStoredTheme(storageKey: string, theme: ThemeName): void {
|
|
254
|
+
if (typeof window === "undefined") return;
|
|
255
|
+
try {
|
|
256
|
+
window.localStorage.setItem(storageKey, theme);
|
|
257
|
+
} catch {
|
|
258
|
+
// Storage can be unavailable in private or locked-down browser contexts.
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const TOPBAR_LAYOUT_A11Y_CONTRACT = {
|
|
2
|
+
DATA_ATTRIBUTES: {
|
|
3
|
+
slot: "data-slot" as const,
|
|
4
|
+
topbarHeight: "data-topbar-height" as const,
|
|
5
|
+
gap: "data-gap" as const,
|
|
6
|
+
},
|
|
7
|
+
SLOT_VALUES: {
|
|
8
|
+
root: "topbar-layout" as const,
|
|
9
|
+
navbar: "navbar" as const,
|
|
10
|
+
main: "main" as const,
|
|
11
|
+
},
|
|
12
|
+
} as const;
|
|
13
|
+
|
|
14
|
+
export type TopbarLayoutA11yContract = typeof TOPBAR_LAYOUT_A11Y_CONTRACT;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isCssLength, mergeLayoutStyles, serializeValueIf } from "../_internal/layout";
|
|
2
|
+
import type { TopbarLayoutProps } from "./topbar-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
|
+
export function TopbarLayout(props: TopbarLayoutProps): JSX.Element {
|
|
9
|
+
const { topbar, children, topbarHeight, gap, ref, style: userStyle, ...rest } = props;
|
|
10
|
+
|
|
11
|
+
const wrapperStyle: Record<string, string | number> = {};
|
|
12
|
+
if (isCssLength(gap)) wrapperStyle.gap = gap!;
|
|
13
|
+
|
|
14
|
+
const navbarStyle: Record<string, string | number> = {};
|
|
15
|
+
if (isCssLength(topbarHeight)) navbarStyle.height = topbarHeight!;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
{...rest}
|
|
20
|
+
ref={ref}
|
|
21
|
+
data-slot="topbar-layout"
|
|
22
|
+
data-gap={serializeValueIf(gap, isThemeGapToken)}
|
|
23
|
+
style={mergeLayoutStyles(wrapperStyle, userStyle)}
|
|
24
|
+
>
|
|
25
|
+
{[
|
|
26
|
+
<header
|
|
27
|
+
key="topbar-layout-navbar"
|
|
28
|
+
data-slot="navbar"
|
|
29
|
+
style={mergeLayoutStyles(navbarStyle, undefined)}
|
|
30
|
+
>
|
|
31
|
+
{topbar}
|
|
32
|
+
</header>,
|
|
33
|
+
<main key="topbar-layout-main" data-slot="main">
|
|
34
|
+
{children}
|
|
35
|
+
</main>,
|
|
36
|
+
]}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
export type TopbarLayoutProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & {
|
|
4
|
+
/** Content rendered into the topbar/navbar slot (header). */
|
|
5
|
+
topbar?: unknown;
|
|
6
|
+
/** Content rendered into the main slot. */
|
|
7
|
+
children?: unknown;
|
|
8
|
+
/** CSS height for the topbar. Applied as inline style only when it is a real CSS length. */
|
|
9
|
+
topbarHeight?: string;
|
|
10
|
+
/** CSS gap between topbar and main. Applied as inline style only when it is a real CSS length. */
|
|
11
|
+
gap?: string;
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
};
|
package/src/css.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "*.css";
|
package/src/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./themes/default/index.css";
|
package/src/jsx.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
interface Element extends JSXElement {
|
|
6
|
+
readonly __askrThemesJsxElementBrand?: never;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
[elem: string]: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ElementAttributesProperty {
|
|
14
|
+
props: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ElementChildrenAttribute {
|
|
18
|
+
children: unknown;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import "./tokens.css";
|
|
2
|
+
@import "./styles/base/typography.css";
|
|
3
|
+
@import "./styles/base/icon.css";
|
|
4
|
+
@import "./styles/base/utilities.css";
|
|
5
|
+
@import "./styles/layout/layout.css";
|
|
6
|
+
@import "./styles/layout/responsive-layout.css";
|
|
7
|
+
@import "./styles/layout/patterns.css";
|
|
8
|
+
@import "./styles/layout/aspect-ratio.css";
|
|
9
|
+
@import "./styles/shell/theme.css";
|
|
10
|
+
@import "./styles/shell/header.css";
|
|
11
|
+
@import "./styles/shell/navbar.css";
|
|
12
|
+
@import "./styles/actions/button.css";
|
|
13
|
+
@import "./styles/actions/toggle.css";
|
|
14
|
+
@import "./styles/actions/toggle-group.css";
|
|
15
|
+
@import "./styles/forms/input.css";
|
|
16
|
+
@import "./styles/forms/textarea.css";
|
|
17
|
+
@import "./styles/forms/form.css";
|
|
18
|
+
@import "./styles/forms/checkbox.css";
|
|
19
|
+
@import "./styles/forms/switch.css";
|
|
20
|
+
@import "./styles/forms/radio-group.css";
|
|
21
|
+
@import "./styles/forms/select.css";
|
|
22
|
+
@import "./styles/forms/slider.css";
|
|
23
|
+
@import "./styles/forms/label.css";
|
|
24
|
+
@import "./styles/display/card.css";
|
|
25
|
+
@import "./styles/display/progress.css";
|
|
26
|
+
@import "./styles/display/progress-circle.css";
|
|
27
|
+
@import "./styles/display/badge.css";
|
|
28
|
+
@import "./styles/display/skeleton.css";
|
|
29
|
+
@import "./styles/display/avatar.css";
|
|
30
|
+
@import "./styles/display/separator.css";
|
|
31
|
+
@import "./styles/display/table.css";
|
|
32
|
+
@import "./styles/display/scroll-area.css";
|
|
33
|
+
@import "./styles/display/spinner.css";
|
|
34
|
+
@import "./styles/display/coverage.css";
|
|
35
|
+
@import "./styles/navigation/breadcrumb.css";
|
|
36
|
+
@import "./styles/navigation/tabs.css";
|
|
37
|
+
@import "./styles/navigation/menu.css";
|
|
38
|
+
@import "./styles/navigation/menubar.css";
|
|
39
|
+
@import "./styles/navigation/navigation-menu.css";
|
|
40
|
+
@import "./styles/disclosure/accordion.css";
|
|
41
|
+
@import "./styles/disclosure/collapsible.css";
|
|
42
|
+
@import "./styles/overlays/alert-dialog.css";
|
|
43
|
+
@import "./styles/overlays/dropdown-menu.css";
|
|
44
|
+
@import "./styles/overlays/toast.css";
|
|
45
|
+
@import "./styles/overlays/dialog.css";
|
|
46
|
+
@import "./styles/overlays/popover.css";
|
|
47
|
+
@import "./styles/overlays/hover-card.css";
|
|
48
|
+
@import "./styles/overlays/tooltip.css";
|