@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,26 @@
|
|
|
1
|
+
import { mergeProps } from "../_internal/merge-props.js";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
4
|
+
//#region src/components/skeleton/skeleton.tsx
|
|
5
|
+
function Skeleton(props) {
|
|
6
|
+
const { asChild, children, ref, ...rest } = props;
|
|
7
|
+
const finalProps = mergeProps(rest, {
|
|
8
|
+
ref,
|
|
9
|
+
"data-slot": "skeleton",
|
|
10
|
+
"data-skeleton": "true",
|
|
11
|
+
"aria-hidden": "true"
|
|
12
|
+
});
|
|
13
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
14
|
+
asChild: true,
|
|
15
|
+
...finalProps,
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
...finalProps,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Skeleton };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.js","names":[],"sources":["../../src/components/skeleton/skeleton.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type { SkeletonAsChildProps, SkeletonProps } from \"./skeleton.types\";\n\nexport function Skeleton(props: SkeletonProps): JSX.Element;\nexport function Skeleton(props: SkeletonAsChildProps): JSX.Element;\nexport function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {\n const { asChild, children, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n \"data-slot\": \"skeleton\",\n \"data-skeleton\": \"true\",\n \"aria-hidden\": \"true\",\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children} />;\n }\n\n return <div {...finalProps}>{children}</div>;\n}\n"],"mappings":";;;;AAMA,SAAgB,SAAS,OAA6C;CACpE,MAAM,EAAE,SAAS,UAAU,KAAK,GAAG,SAAS;CAC5C,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,aAAa;EACb,iBAAiB;EACjB,eAAe;EAChB,CAAC;AAEF,KAAI,QACF,QAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;EAAY,CAAA;AAG7D,QAAO,oBAAC,OAAD;EAAK,GAAI;EAAa;EAAe,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
//#region src/components/skeleton/skeleton.types.d.ts
|
|
4
|
+
type SkeletonOwnProps = {
|
|
5
|
+
children?: unknown;
|
|
6
|
+
};
|
|
7
|
+
type SkeletonProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & SkeletonOwnProps & {
|
|
8
|
+
asChild?: false;
|
|
9
|
+
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
};
|
|
11
|
+
type SkeletonAsChildProps = SkeletonOwnProps & {
|
|
12
|
+
asChild: true;
|
|
13
|
+
children: JSXElement;
|
|
14
|
+
ref?: Ref<unknown>;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { SkeletonAsChildProps, SkeletonOwnProps, SkeletonProps };
|
|
18
|
+
//# sourceMappingURL=skeleton.types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SpacerAsChildProps, SpacerNativeProps } from "./spacer.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/spacer/spacer.d.ts
|
|
4
|
+
declare function Spacer(props: SpacerNativeProps): JSX.Element;
|
|
5
|
+
declare function Spacer(props: SpacerAsChildProps): JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Spacer };
|
|
8
|
+
//# sourceMappingURL=spacer.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { mergeProps } from "../_internal/merge-props.js";
|
|
2
|
+
import { isCssLength, mergeLayoutStyles } from "../_internal/layout.js";
|
|
3
|
+
import { isJsxElement, toChildArray } from "../_internal/jsx.js";
|
|
4
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
5
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
6
|
+
//#region src/components/spacer/spacer.tsx
|
|
7
|
+
function Spacer(props) {
|
|
8
|
+
const { asChild, children, grow, shrink, basis, axis, ref, style: userStyle, ...rest } = props;
|
|
9
|
+
const layoutStyle = {};
|
|
10
|
+
if (axis === "inline") {
|
|
11
|
+
if (shrink !== void 0 && shrink !== 0) layoutStyle.flexShrink = shrink;
|
|
12
|
+
if (isCssLength(basis)) layoutStyle.width = basis;
|
|
13
|
+
} else if (axis === "block") {
|
|
14
|
+
if (shrink !== void 0 && shrink !== 0) layoutStyle.flexShrink = shrink;
|
|
15
|
+
if (isCssLength(basis)) layoutStyle.height = basis;
|
|
16
|
+
} else {
|
|
17
|
+
if (grow !== void 0 && grow !== 1) layoutStyle.flexGrow = grow;
|
|
18
|
+
if (shrink !== void 0 && shrink !== 1) layoutStyle.flexShrink = shrink;
|
|
19
|
+
if (isCssLength(basis)) layoutStyle.flexBasis = basis;
|
|
20
|
+
}
|
|
21
|
+
const finalProps = mergeProps(rest, {
|
|
22
|
+
ref,
|
|
23
|
+
"data-slot": "spacer",
|
|
24
|
+
"data-axis": axis,
|
|
25
|
+
style: mergeLayoutStyles(layoutStyle, userStyle)
|
|
26
|
+
});
|
|
27
|
+
const keyedChildren = toChildArray(children).map((child, index) => {
|
|
28
|
+
if (!isJsxElement(child) || child.key != null) return child;
|
|
29
|
+
return {
|
|
30
|
+
...child,
|
|
31
|
+
key: `spacer-${index}`
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
35
|
+
asChild: true,
|
|
36
|
+
...finalProps,
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
...finalProps,
|
|
41
|
+
children: keyedChildren
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Spacer };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=spacer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spacer.js","names":[],"sources":["../../src/components/spacer/spacer.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { isCssLength, mergeLayoutStyles } from \"../_internal/layout\";\nimport { isJsxElement, toChildArray } from \"../_internal/jsx\";\nimport type { SpacerAsChildProps, SpacerNativeProps } from \"./spacer.types\";\n\nexport function Spacer(props: SpacerNativeProps): JSX.Element;\nexport function Spacer(props: SpacerAsChildProps): JSX.Element;\nexport function Spacer(props: SpacerNativeProps | SpacerAsChildProps) {\n const { asChild, children, grow, shrink, basis, axis, ref, style: userStyle, ...rest } = props;\n\n const layoutStyle: Record<string, string | number> = {};\n\n if (axis === \"inline\") {\n if (shrink !== undefined && shrink !== 0) {\n layoutStyle.flexShrink = shrink;\n }\n if (isCssLength(basis)) layoutStyle.width = basis!;\n } else if (axis === \"block\") {\n if (shrink !== undefined && shrink !== 0) {\n layoutStyle.flexShrink = shrink;\n }\n if (isCssLength(basis)) layoutStyle.height = basis!;\n } else {\n if (grow !== undefined && grow !== 1) {\n layoutStyle.flexGrow = grow;\n }\n if (shrink !== undefined && shrink !== 1) {\n layoutStyle.flexShrink = shrink;\n }\n if (isCssLength(basis)) {\n layoutStyle.flexBasis = basis!;\n }\n }\n\n const finalProps = mergeProps(rest, {\n ref,\n \"data-slot\": \"spacer\",\n \"data-axis\": axis,\n style: mergeLayoutStyles(layoutStyle, userStyle),\n });\n const keyedChildren = toChildArray(children).map((child, index) => {\n if (!isJsxElement(child) || child.key != null) {\n return child;\n }\n\n return {\n ...child,\n key: `spacer-${index}`,\n };\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children} />;\n }\n\n return <div {...finalProps}>{keyedChildren}</div>;\n}\n"],"mappings":";;;;;;AAQA,SAAgB,OAAO,OAA+C;CACpE,MAAM,EAAE,SAAS,UAAU,MAAM,QAAQ,OAAO,MAAM,KAAK,OAAO,WAAW,GAAG,SAAS;CAEzF,MAAM,cAA+C,EAAE;AAEvD,KAAI,SAAS,UAAU;AACrB,MAAI,WAAW,KAAA,KAAa,WAAW,EACrC,aAAY,aAAa;AAE3B,MAAI,YAAY,MAAM,CAAE,aAAY,QAAQ;YACnC,SAAS,SAAS;AAC3B,MAAI,WAAW,KAAA,KAAa,WAAW,EACrC,aAAY,aAAa;AAE3B,MAAI,YAAY,MAAM,CAAE,aAAY,SAAS;QACxC;AACL,MAAI,SAAS,KAAA,KAAa,SAAS,EACjC,aAAY,WAAW;AAEzB,MAAI,WAAW,KAAA,KAAa,WAAW,EACrC,aAAY,aAAa;AAE3B,MAAI,YAAY,MAAM,CACpB,aAAY,YAAY;;CAI5B,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,aAAa;EACb,aAAa;EACb,OAAO,kBAAkB,aAAa,UAAU;EACjD,CAAC;CACF,MAAM,gBAAgB,aAAa,SAAS,CAAC,KAAK,OAAO,UAAU;AACjE,MAAI,CAAC,aAAa,MAAM,IAAI,MAAM,OAAO,KACvC,QAAO;AAGT,SAAO;GACL,GAAG;GACH,KAAK,UAAU;GAChB;GACD;AAEF,KAAI,QACF,QAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;EAAY,CAAA;AAG7D,QAAO,oBAAC,OAAD;EAAK,GAAI;YAAa;EAAoB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
//#region src/components/spacer/spacer.types.d.ts
|
|
4
|
+
type SpacerAxis = "inline" | "block";
|
|
5
|
+
type SpacerOwnProps = {
|
|
6
|
+
/** flex-grow factor (default 1 when no axis is set). */grow?: number; /** flex-shrink factor (default 1 when no axis is set, 0 when axis is set). */
|
|
7
|
+
shrink?: number; /** CSS flex-basis / width (axis=inline) / height (axis=block) value. Applied as inline style only when it is a real CSS length. */
|
|
8
|
+
basis?: string; /** When set, renders a fixed space along the given axis instead of a flex-grow spacer. */
|
|
9
|
+
axis?: SpacerAxis;
|
|
10
|
+
children?: unknown;
|
|
11
|
+
};
|
|
12
|
+
type SpacerNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & SpacerOwnProps & {
|
|
13
|
+
asChild?: false;
|
|
14
|
+
ref?: Ref<HTMLDivElement>;
|
|
15
|
+
};
|
|
16
|
+
type SpacerAsChildProps = SpacerOwnProps & {
|
|
17
|
+
asChild: true;
|
|
18
|
+
children: JSXElement;
|
|
19
|
+
ref?: Ref<unknown>;
|
|
20
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
21
|
+
};
|
|
22
|
+
type SpacerProps = SpacerNativeProps | SpacerAsChildProps;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { SpacerAsChildProps, SpacerAxis, SpacerNativeProps, SpacerOwnProps, SpacerProps };
|
|
25
|
+
//# sourceMappingURL=spacer.types.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ProgressCircle } from "@askrjs/ui";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/spinner/spinner.tsx
|
|
4
|
+
function Spinner(props) {
|
|
5
|
+
const { label, "aria-label": ariaLabel, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(ProgressCircle, {
|
|
7
|
+
...rest,
|
|
8
|
+
"aria-label": ariaLabel ?? label ?? "Loading",
|
|
9
|
+
value: null,
|
|
10
|
+
getValueLabel: () => label ?? "Loading"
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Spinner };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","names":[],"sources":["../../src/components/spinner/spinner.tsx"],"sourcesContent":["import { ProgressCircle } from \"@askrjs/ui\";\nimport type { SpinnerProps } from \"./spinner.types\";\n\nexport function Spinner(props: SpinnerProps): JSX.Element {\n const {\n label,\n \"aria-label\": ariaLabel,\n ...rest\n } = props as SpinnerProps & {\n \"aria-label\"?: string;\n };\n\n return (\n <ProgressCircle\n {...rest}\n aria-label={ariaLabel ?? label ?? \"Loading\"}\n value={null}\n getValueLabel={() => label ?? \"Loading\"}\n />\n );\n}\n"],"mappings":";;;AAGA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EACJ,OACA,cAAc,WACd,GAAG,SACD;AAIJ,QACE,oBAAC,gBAAD;EACE,GAAI;EACJ,cAAY,aAAa,SAAS;EAClC,OAAO;EACP,qBAAqB,SAAS;EAC9B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProgressCircleProps } from "@askrjs/ui";
|
|
2
|
+
|
|
3
|
+
//#region src/components/spinner/spinner.types.d.ts
|
|
4
|
+
type SpinnerOwnProps = Omit<ProgressCircleProps, "value" | "getValueLabel"> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
type SpinnerProps = SpinnerOwnProps;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { SpinnerOwnProps, SpinnerProps };
|
|
10
|
+
//# sourceMappingURL=spinner.types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StackAsChildProps, StackDivProps } from "./stack.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/stack/stack.d.ts
|
|
4
|
+
declare function Stack(props: StackDivProps): JSX.Element;
|
|
5
|
+
declare function Stack(props: StackAsChildProps): JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Stack };
|
|
8
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Flex } from "../flex/flex.js";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/stack/stack.tsx
|
|
4
|
+
function Stack(props) {
|
|
5
|
+
const { children, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(Flex, {
|
|
7
|
+
...rest,
|
|
8
|
+
"data-slot": "stack",
|
|
9
|
+
direction: "column",
|
|
10
|
+
children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Stack };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.js","names":[],"sources":["../../src/components/stack/stack.tsx"],"sourcesContent":["import { Flex } from \"../flex\";\nimport type { StackAsChildProps, StackDivProps } from \"./stack.types\";\n\nexport function Stack(props: StackDivProps): JSX.Element;\nexport function Stack(props: StackAsChildProps): JSX.Element;\nexport function Stack(props: StackDivProps | StackAsChildProps) {\n const { children, ...rest } = props;\n return (\n <Flex {...(rest as Record<string, unknown>)} data-slot=\"stack\" direction=\"column\">\n {children}\n </Flex>\n );\n}\n"],"mappings":";;;AAKA,SAAgB,MAAM,OAA0C;CAC9D,MAAM,EAAE,UAAU,GAAG,SAAS;AAC9B,QACE,oBAAC,MAAD;EAAM,GAAK;EAAkC,aAAU;EAAQ,WAAU;EACtE;EACI,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FlexOwnProps } from "../flex/flex.types.js";
|
|
2
|
+
import { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
3
|
+
|
|
4
|
+
//#region src/components/stack/stack.types.d.ts
|
|
5
|
+
type StackOwnProps = Omit<FlexOwnProps, "direction" | "as"> & {
|
|
6
|
+
children?: unknown;
|
|
7
|
+
};
|
|
8
|
+
type StackDivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & StackOwnProps & {
|
|
9
|
+
asChild?: false;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
};
|
|
12
|
+
type StackAsChildProps = StackOwnProps & {
|
|
13
|
+
asChild: true;
|
|
14
|
+
children: JSXElement;
|
|
15
|
+
ref?: Ref<unknown>;
|
|
16
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
17
|
+
};
|
|
18
|
+
type StackProps = StackDivProps | StackAsChildProps;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { StackAsChildProps, StackDivProps, StackOwnProps, StackProps };
|
|
21
|
+
//# sourceMappingURL=stack.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DEFAULT_THEME_OPTIONS, ThemeContextValue, ThemeName, ThemeOption, ThemePicker, ThemePickerProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ThemeToggleProps, ThemeToggleRenderContext, useTheme } from "./theme.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ButtonNativeProps, PressEvent } from "@askrjs/ui";
|
|
2
|
+
|
|
3
|
+
//#region src/components/theme/theme.d.ts
|
|
4
|
+
type ThemeName = "light" | "dark" | "system" | (string & {});
|
|
5
|
+
type ThemeOption = {
|
|
6
|
+
value: ThemeName;
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
type ThemeContextValue = {
|
|
10
|
+
theme: () => ThemeName;
|
|
11
|
+
setTheme: (theme: ThemeName) => void;
|
|
12
|
+
themes: readonly ThemeOption[];
|
|
13
|
+
storageKey: string;
|
|
14
|
+
};
|
|
15
|
+
type ThemeProviderProps = {
|
|
16
|
+
children?: unknown;
|
|
17
|
+
defaultTheme?: ThemeName;
|
|
18
|
+
themes?: readonly ThemeOption[];
|
|
19
|
+
storageKey?: string;
|
|
20
|
+
};
|
|
21
|
+
type ThemePickerProps = Omit<JSX.IntrinsicElements["select"], "children" | "value" | "defaultValue" | "onChange"> & {
|
|
22
|
+
themes?: readonly ThemeOption[];
|
|
23
|
+
label?: string;
|
|
24
|
+
};
|
|
25
|
+
type ThemeToggleRenderContext = {
|
|
26
|
+
theme: ThemeName;
|
|
27
|
+
nextTheme: ThemeName;
|
|
28
|
+
};
|
|
29
|
+
type ThemeToggleProps = Omit<ButtonNativeProps, "children" | "onPress"> & {
|
|
30
|
+
children?: unknown | ((context: ThemeToggleRenderContext) => unknown);
|
|
31
|
+
lightIcon?: unknown;
|
|
32
|
+
darkIcon?: unknown;
|
|
33
|
+
systemIcon?: unknown;
|
|
34
|
+
toggleThemes?: readonly ThemeName[];
|
|
35
|
+
onPress?: (event: PressEvent) => void;
|
|
36
|
+
};
|
|
37
|
+
declare const DEFAULT_THEME_OPTIONS: readonly ThemeOption[];
|
|
38
|
+
declare function useTheme(): ThemeContextValue;
|
|
39
|
+
declare function ThemeProvider(props: ThemeProviderProps): JSX.Element;
|
|
40
|
+
declare function ThemePicker(props: ThemePickerProps): JSX.Element;
|
|
41
|
+
declare function ThemeToggle(props: ThemeToggleProps): JSX.Element;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { DEFAULT_THEME_OPTIONS, ThemeContextValue, ThemeName, ThemeOption, ThemePicker, ThemePickerProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ThemeToggleProps, ThemeToggleRenderContext, useTheme };
|
|
44
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { Button } from "@askrjs/ui";
|
|
2
|
+
import { defineContext, readContext, state } from "@askrjs/askr";
|
|
3
|
+
import { resource } from "@askrjs/askr/resources";
|
|
4
|
+
import { jsx, jsxs } from "@askrjs/askr/jsx-runtime";
|
|
5
|
+
//#region src/components/theme/theme.tsx
|
|
6
|
+
const DEFAULT_THEME_OPTIONS = [
|
|
7
|
+
{
|
|
8
|
+
value: "system",
|
|
9
|
+
label: "System"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: "light",
|
|
13
|
+
label: "Light"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: "dark",
|
|
17
|
+
label: "Dark"
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
const DEFAULT_STORAGE_KEY = "askr-theme";
|
|
21
|
+
const ThemeContext = defineContext({
|
|
22
|
+
theme: () => "system",
|
|
23
|
+
setTheme: () => void 0,
|
|
24
|
+
themes: DEFAULT_THEME_OPTIONS,
|
|
25
|
+
storageKey: DEFAULT_STORAGE_KEY
|
|
26
|
+
});
|
|
27
|
+
function useTheme() {
|
|
28
|
+
return readContext(ThemeContext);
|
|
29
|
+
}
|
|
30
|
+
function ThemeProvider(props) {
|
|
31
|
+
const { children, defaultTheme = "system", themes = DEFAULT_THEME_OPTIONS, storageKey = DEFAULT_STORAGE_KEY } = props;
|
|
32
|
+
const themeState = state(readStoredTheme(storageKey) ?? defaultTheme);
|
|
33
|
+
const setTheme = (nextTheme) => {
|
|
34
|
+
themeState.set(nextTheme);
|
|
35
|
+
writeStoredTheme(storageKey, nextTheme);
|
|
36
|
+
syncThemeRoot(nextTheme);
|
|
37
|
+
};
|
|
38
|
+
const value = {
|
|
39
|
+
theme: themeState,
|
|
40
|
+
setTheme,
|
|
41
|
+
themes,
|
|
42
|
+
storageKey
|
|
43
|
+
};
|
|
44
|
+
const currentTheme = themeState();
|
|
45
|
+
return /* @__PURE__ */ jsxs(ThemeContext.Scope, {
|
|
46
|
+
value,
|
|
47
|
+
children: [/* @__PURE__ */ jsx(ThemeRootSync, { theme: currentTheme }), /* @__PURE__ */ jsx("div", {
|
|
48
|
+
"data-slot": "theme-provider",
|
|
49
|
+
children
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function ThemeRootSync(props) {
|
|
54
|
+
const { theme } = props;
|
|
55
|
+
resource(({ signal }) => {
|
|
56
|
+
if (typeof window === "undefined") {
|
|
57
|
+
syncThemeRoot(theme);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const timeoutId = window.setTimeout(() => {
|
|
61
|
+
if (!signal.aborted) syncThemeRoot(theme);
|
|
62
|
+
}, 0);
|
|
63
|
+
signal.addEventListener("abort", () => {
|
|
64
|
+
window.clearTimeout(timeoutId);
|
|
65
|
+
}, { once: true });
|
|
66
|
+
return null;
|
|
67
|
+
}, [theme]);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function ThemePicker(props) {
|
|
71
|
+
const theme = useTheme();
|
|
72
|
+
const { themes = theme.themes, label = "Theme", ...rest } = props;
|
|
73
|
+
return /* @__PURE__ */ jsx("select", {
|
|
74
|
+
...rest,
|
|
75
|
+
"aria-label": rest["aria-label"] ?? label,
|
|
76
|
+
"data-slot": "theme-picker",
|
|
77
|
+
value: theme.theme(),
|
|
78
|
+
onChange: (event) => {
|
|
79
|
+
const target = event.currentTarget;
|
|
80
|
+
theme.setTheme(target.value);
|
|
81
|
+
},
|
|
82
|
+
children: themes.map((option) => /* @__PURE__ */ jsx("option", {
|
|
83
|
+
value: option.value,
|
|
84
|
+
children: option.label
|
|
85
|
+
}, option.value))
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function ThemeToggle(props) {
|
|
89
|
+
const theme = useTheme();
|
|
90
|
+
const { children, lightIcon, darkIcon, systemIcon, toggleThemes = ["light", "dark"], onPress, ...rest } = props;
|
|
91
|
+
const currentTheme = theme.theme();
|
|
92
|
+
const nextTheme = getNextTheme(currentTheme, toggleThemes);
|
|
93
|
+
const renderContext = {
|
|
94
|
+
theme: currentTheme,
|
|
95
|
+
nextTheme
|
|
96
|
+
};
|
|
97
|
+
const ariaLabel = rest["aria-label"];
|
|
98
|
+
const themedIcon = resolveThemeToggleIcon(currentTheme, nextTheme, {
|
|
99
|
+
lightIcon,
|
|
100
|
+
darkIcon,
|
|
101
|
+
systemIcon
|
|
102
|
+
});
|
|
103
|
+
const content = typeof children === "function" ? children(renderContext) : children ?? themedIcon;
|
|
104
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
105
|
+
...rest,
|
|
106
|
+
"aria-label": typeof ariaLabel === "string" ? ariaLabel : `Switch to ${nextTheme} theme`,
|
|
107
|
+
"data-theme-control": "toggle",
|
|
108
|
+
"data-theme-choice": currentTheme,
|
|
109
|
+
"data-next-theme": nextTheme,
|
|
110
|
+
onPress: (event) => {
|
|
111
|
+
onPress?.(event);
|
|
112
|
+
if (!event.defaultPrevented) theme.setTheme(nextTheme);
|
|
113
|
+
},
|
|
114
|
+
children: content
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function getNextTheme(currentTheme, themes) {
|
|
118
|
+
if (themes.length === 0) return currentTheme;
|
|
119
|
+
const index = themes.indexOf(currentTheme);
|
|
120
|
+
return themes[index >= 0 && index < themes.length - 1 ? index + 1 : 0];
|
|
121
|
+
}
|
|
122
|
+
function getThemeIcon(theme, icons) {
|
|
123
|
+
if (theme === "light") return icons.lightIcon;
|
|
124
|
+
if (theme === "dark") return icons.darkIcon;
|
|
125
|
+
if (theme === "system") return icons.systemIcon;
|
|
126
|
+
}
|
|
127
|
+
function resolveThemeToggleIcon(theme, nextTheme, icons) {
|
|
128
|
+
return getThemeIcon(theme, icons) ?? getThemeIcon(nextTheme, icons);
|
|
129
|
+
}
|
|
130
|
+
function syncThemeRoot(themeChoice) {
|
|
131
|
+
if (typeof document === "undefined") return;
|
|
132
|
+
const html = document.documentElement;
|
|
133
|
+
if (themeChoice == null) {
|
|
134
|
+
html.removeAttribute("data-theme");
|
|
135
|
+
html.removeAttribute("data-theme-choice");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
html.setAttribute("data-theme-choice", themeChoice);
|
|
139
|
+
if (themeChoice === "system") html.removeAttribute("data-theme");
|
|
140
|
+
else html.setAttribute("data-theme", themeChoice);
|
|
141
|
+
}
|
|
142
|
+
function readStoredTheme(storageKey) {
|
|
143
|
+
if (typeof window === "undefined") return void 0;
|
|
144
|
+
try {
|
|
145
|
+
return window.localStorage.getItem(storageKey) ?? void 0;
|
|
146
|
+
} catch {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function writeStoredTheme(storageKey, theme) {
|
|
151
|
+
if (typeof window === "undefined") return;
|
|
152
|
+
try {
|
|
153
|
+
window.localStorage.setItem(storageKey, theme);
|
|
154
|
+
} catch {}
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
export { DEFAULT_THEME_OPTIONS, ThemePicker, ThemeProvider, ThemeToggle, useTheme };
|
|
158
|
+
|
|
159
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../../src/components/theme/theme.tsx"],"sourcesContent":["import { defineContext, readContext, state } from \"@askrjs/askr\";\nimport { resource } from \"@askrjs/askr/resources\";\nimport { Button } from \"@askrjs/ui\";\nimport type { ButtonNativeProps, PressEvent } from \"@askrjs/ui\";\n\nexport type ThemeName = \"light\" | \"dark\" | \"system\" | (string & {});\n\nexport type ThemeOption = {\n value: ThemeName;\n label: string;\n};\n\nexport type ThemeContextValue = {\n theme: () => ThemeName;\n setTheme: (theme: ThemeName) => void;\n themes: readonly ThemeOption[];\n storageKey: string;\n};\n\nexport type ThemeProviderProps = {\n children?: unknown;\n defaultTheme?: ThemeName;\n themes?: readonly ThemeOption[];\n storageKey?: string;\n};\n\nexport type ThemePickerProps = Omit<\n JSX.IntrinsicElements[\"select\"],\n \"children\" | \"value\" | \"defaultValue\" | \"onChange\"\n> & {\n themes?: readonly ThemeOption[];\n label?: string;\n};\n\nexport type ThemeToggleRenderContext = {\n theme: ThemeName;\n nextTheme: ThemeName;\n};\n\nexport type ThemeToggleProps = Omit<ButtonNativeProps, \"children\" | \"onPress\"> & {\n children?: unknown | ((context: ThemeToggleRenderContext) => unknown);\n lightIcon?: unknown;\n darkIcon?: unknown;\n systemIcon?: unknown;\n toggleThemes?: readonly ThemeName[];\n onPress?: (event: PressEvent) => void;\n};\n\nexport const DEFAULT_THEME_OPTIONS: readonly ThemeOption[] = [\n { value: \"system\", label: \"System\" },\n { value: \"light\", label: \"Light\" },\n { value: \"dark\", label: \"Dark\" },\n];\n\nconst DEFAULT_STORAGE_KEY = \"askr-theme\";\n\nconst ThemeContext = defineContext<ThemeContextValue>({\n theme: () => \"system\",\n setTheme: () => undefined,\n themes: DEFAULT_THEME_OPTIONS,\n storageKey: DEFAULT_STORAGE_KEY,\n});\n\nexport function useTheme(): ThemeContextValue {\n return readContext(ThemeContext);\n}\n\nexport function ThemeProvider(props: ThemeProviderProps): JSX.Element {\n const {\n children,\n defaultTheme = \"system\",\n themes = DEFAULT_THEME_OPTIONS,\n storageKey = DEFAULT_STORAGE_KEY,\n } = props;\n\n const themeState = state<ThemeName>(readStoredTheme(storageKey) ?? defaultTheme);\n\n const setTheme = (nextTheme: ThemeName) => {\n themeState.set(nextTheme);\n writeStoredTheme(storageKey, nextTheme);\n syncThemeRoot(nextTheme);\n };\n\n const value: ThemeContextValue = {\n theme: themeState,\n setTheme,\n themes,\n storageKey,\n };\n\n const currentTheme = themeState();\n\n return (\n <ThemeContext.Scope value={value}>\n <ThemeRootSync theme={currentTheme} />\n <div data-slot=\"theme-provider\">{children}</div>\n </ThemeContext.Scope>\n );\n}\n\nfunction ThemeRootSync(props: { theme: ThemeName }): JSX.Element | null {\n const { theme } = props;\n\n resource(\n ({ signal }: { signal: AbortSignal }) => {\n if (typeof window === \"undefined\") {\n syncThemeRoot(theme);\n return null;\n }\n\n const timeoutId = window.setTimeout(() => {\n if (!signal.aborted) {\n syncThemeRoot(theme);\n }\n }, 0);\n\n signal.addEventListener(\n \"abort\",\n () => {\n window.clearTimeout(timeoutId);\n },\n { once: true },\n );\n\n return null;\n },\n [theme],\n );\n\n return null;\n}\n\nexport function ThemePicker(props: ThemePickerProps): JSX.Element {\n const theme = useTheme();\n const { themes = theme.themes, label = \"Theme\", ...rest } = props;\n\n return (\n <select\n {...rest}\n aria-label={rest[\"aria-label\"] ?? label}\n data-slot=\"theme-picker\"\n value={theme.theme()}\n onChange={(event: Event) => {\n const target = event.currentTarget as HTMLSelectElement;\n theme.setTheme(target.value as ThemeName);\n }}\n >\n {themes.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n );\n}\n\nexport function ThemeToggle(props: ThemeToggleProps): JSX.Element {\n const theme = useTheme();\n const {\n children,\n lightIcon,\n darkIcon,\n systemIcon,\n toggleThemes = [\"light\", \"dark\"],\n onPress,\n ...rest\n } = props;\n\n const currentTheme = theme.theme();\n const nextTheme = getNextTheme(currentTheme, toggleThemes);\n const renderContext = { theme: currentTheme, nextTheme };\n const ariaLabel = (rest as Record<string, unknown>)[\"aria-label\"];\n const themedIcon = resolveThemeToggleIcon(currentTheme, nextTheme, {\n lightIcon,\n darkIcon,\n systemIcon,\n });\n const content =\n typeof children === \"function\" ? children(renderContext) : (children ?? themedIcon);\n\n return (\n <Button\n {...(rest as ButtonNativeProps)}\n aria-label={typeof ariaLabel === \"string\" ? ariaLabel : `Switch to ${nextTheme} theme`}\n data-theme-control=\"toggle\"\n data-theme-choice={currentTheme}\n data-next-theme={nextTheme}\n onPress={(event) => {\n onPress?.(event);\n if (!event.defaultPrevented) theme.setTheme(nextTheme);\n }}\n >\n {content}\n </Button>\n );\n}\n\nfunction getNextTheme(currentTheme: ThemeName, themes: readonly ThemeName[]): ThemeName {\n if (themes.length === 0) return currentTheme;\n const index = themes.indexOf(currentTheme);\n return themes[index >= 0 && index < themes.length - 1 ? index + 1 : 0]!;\n}\n\nfunction getThemeIcon(\n theme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n if (theme === \"light\") return icons.lightIcon;\n if (theme === \"dark\") return icons.darkIcon;\n if (theme === \"system\") return icons.systemIcon;\n return undefined;\n}\n\nexport function resolveThemeToggleIcon(\n theme: ThemeName,\n nextTheme: ThemeName,\n icons: Pick<ThemeToggleProps, \"lightIcon\" | \"darkIcon\" | \"systemIcon\">,\n): unknown {\n return getThemeIcon(theme, icons) ?? getThemeIcon(nextTheme, icons);\n}\n\nfunction syncThemeRoot(themeChoice: ThemeName | null | undefined): void {\n if (typeof document === \"undefined\") {\n return;\n }\n\n const html = document.documentElement;\n\n if (themeChoice == null) {\n html.removeAttribute(\"data-theme\");\n html.removeAttribute(\"data-theme-choice\");\n return;\n }\n\n html.setAttribute(\"data-theme-choice\", themeChoice);\n\n if (themeChoice === \"system\") {\n html.removeAttribute(\"data-theme\");\n } else {\n html.setAttribute(\"data-theme\", themeChoice);\n }\n}\n\nfunction readStoredTheme(storageKey: string): ThemeName | undefined {\n if (typeof window === \"undefined\") return undefined;\n try {\n return (window.localStorage.getItem(storageKey) as ThemeName | null) ?? undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction writeStoredTheme(storageKey: string, theme: ThemeName): void {\n if (typeof window === \"undefined\") return;\n try {\n window.localStorage.setItem(storageKey, theme);\n } catch {\n // Storage can be unavailable in private or locked-down browser contexts.\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TopbarLayoutProps } from "./topbar-layout.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/topbar-layout/topbar-layout.d.ts
|
|
4
|
+
declare function TopbarLayout(props: TopbarLayoutProps): JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { TopbarLayout };
|
|
7
|
+
//# sourceMappingURL=topbar-layout.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isCssLength, mergeLayoutStyles, serializeValueIf } from "../_internal/layout.js";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/topbar-layout/topbar-layout.tsx
|
|
4
|
+
function isThemeGapToken(value) {
|
|
5
|
+
return typeof value === "string" && [
|
|
6
|
+
"sm",
|
|
7
|
+
"md",
|
|
8
|
+
"lg",
|
|
9
|
+
"xl"
|
|
10
|
+
].includes(value.trim());
|
|
11
|
+
}
|
|
12
|
+
function TopbarLayout(props) {
|
|
13
|
+
const { topbar, children, topbarHeight, gap, ref, style: userStyle, ...rest } = props;
|
|
14
|
+
const wrapperStyle = {};
|
|
15
|
+
if (isCssLength(gap)) wrapperStyle.gap = gap;
|
|
16
|
+
const navbarStyle = {};
|
|
17
|
+
if (isCssLength(topbarHeight)) navbarStyle.height = topbarHeight;
|
|
18
|
+
return /* @__PURE__ */ jsx("div", {
|
|
19
|
+
...rest,
|
|
20
|
+
ref,
|
|
21
|
+
"data-slot": "topbar-layout",
|
|
22
|
+
"data-gap": serializeValueIf(gap, isThemeGapToken),
|
|
23
|
+
style: mergeLayoutStyles(wrapperStyle, userStyle),
|
|
24
|
+
children: [/* @__PURE__ */ jsx("header", {
|
|
25
|
+
"data-slot": "navbar",
|
|
26
|
+
style: mergeLayoutStyles(navbarStyle, void 0),
|
|
27
|
+
children: topbar
|
|
28
|
+
}, "topbar-layout-navbar"), /* @__PURE__ */ jsx("main", {
|
|
29
|
+
"data-slot": "main",
|
|
30
|
+
children
|
|
31
|
+
}, "topbar-layout-main")]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { TopbarLayout };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=topbar-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topbar-layout.js","names":[],"sources":["../../src/components/topbar-layout/topbar-layout.tsx"],"sourcesContent":["import { isCssLength, mergeLayoutStyles, serializeValueIf } from \"../_internal/layout\";\nimport type { TopbarLayoutProps } from \"./topbar-layout.types\";\n\nfunction isThemeGapToken(value: unknown): value is string {\n return typeof value === \"string\" && [\"sm\", \"md\", \"lg\", \"xl\"].includes(value.trim());\n}\n\nexport function TopbarLayout(props: TopbarLayoutProps): JSX.Element {\n const { topbar, children, topbarHeight, gap, ref, style: userStyle, ...rest } = props;\n\n const wrapperStyle: Record<string, string | number> = {};\n if (isCssLength(gap)) wrapperStyle.gap = gap!;\n\n const navbarStyle: Record<string, string | number> = {};\n if (isCssLength(topbarHeight)) navbarStyle.height = topbarHeight!;\n\n return (\n <div\n {...rest}\n ref={ref}\n data-slot=\"topbar-layout\"\n data-gap={serializeValueIf(gap, isThemeGapToken)}\n style={mergeLayoutStyles(wrapperStyle, userStyle)}\n >\n {[\n <header\n key=\"topbar-layout-navbar\"\n data-slot=\"navbar\"\n style={mergeLayoutStyles(navbarStyle, undefined)}\n >\n {topbar}\n </header>,\n <main key=\"topbar-layout-main\" data-slot=\"main\">\n {children}\n </main>,\n ]}\n </div>\n );\n}\n"],"mappings":";;;AAGA,SAAS,gBAAgB,OAAiC;AACxD,QAAO,OAAO,UAAU,YAAY;EAAC;EAAM;EAAM;EAAM;EAAK,CAAC,SAAS,MAAM,MAAM,CAAC;;AAGrF,SAAgB,aAAa,OAAuC;CAClE,MAAM,EAAE,QAAQ,UAAU,cAAc,KAAK,KAAK,OAAO,WAAW,GAAG,SAAS;CAEhF,MAAM,eAAgD,EAAE;AACxD,KAAI,YAAY,IAAI,CAAE,cAAa,MAAM;CAEzC,MAAM,cAA+C,EAAE;AACvD,KAAI,YAAY,aAAa,CAAE,aAAY,SAAS;AAEpD,QACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,aAAU;EACV,YAAU,iBAAiB,KAAK,gBAAgB;EAChD,OAAO,kBAAkB,cAAc,UAAU;YAEhD,CACC,oBAAC,UAAD;GAEE,aAAU;GACV,OAAO,kBAAkB,aAAa,KAAA,EAAU;aAE/C;GACM,EALH,uBAKG,EACT,oBAAC,QAAD;GAA+B,aAAU;GACtC;GACI,EAFG,qBAEH,CACR;EACG,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref } from "@askrjs/askr/foundations";
|
|
2
|
+
|
|
3
|
+
//#region src/components/topbar-layout/topbar-layout.types.d.ts
|
|
4
|
+
type TopbarLayoutProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & {
|
|
5
|
+
/** Content rendered into the topbar/navbar slot (header). */topbar?: unknown; /** Content rendered into the main slot. */
|
|
6
|
+
children?: unknown; /** CSS height for the topbar. Applied as inline style only when it is a real CSS length. */
|
|
7
|
+
topbarHeight?: string; /** CSS gap between topbar and main. Applied as inline style only when it is a real CSS length. */
|
|
8
|
+
gap?: string;
|
|
9
|
+
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { TopbarLayoutProps };
|
|
13
|
+
//# sourceMappingURL=topbar-layout.types.d.ts.map
|