@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 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","names":[],"sources":["../../src/components/container/container.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport {\n applyBoxLayoutStyles,\n splitBoxLayoutProps,\n withBoxLayoutStyle,\n} from \"../_internal/box-layout\";\nimport {\n isResponsiveValue,\n resolveContainerSizeValue,\n resolveInlineAlignValue,\n resolveSpaceValue,\n serializeResponsiveValueIf,\n setResponsiveStyleVar,\n} from \"../_internal/layout\";\nimport type { ContainerAsChildProps, ContainerNativeProps } from \"./container.types\";\n\nconst CONTAINER_WIDTH_TOKENS = new Set([\"1\", \"2\", \"3\", \"4\", \"sm\", \"md\", \"lg\", \"xl\"]);\n\nfunction isContainerWidthToken(value: unknown): value is string {\n return typeof value === \"string\" && CONTAINER_WIDTH_TOKENS.has(value.trim());\n}\n\nfunction isContainerAlignToken(value: unknown): value is \"left\" | \"center\" | \"right\" {\n return typeof value === \"string\" && [\"left\", \"center\", \"right\"].includes(value.trim());\n}\n\nfunction hasStyleValue(value: unknown): boolean {\n if (typeof value === \"string\") return value.trim().length > 0;\n if (value && typeof value === \"object\") {\n return Object.keys(value as Record<string, unknown>).length > 0;\n }\n\n return false;\n}\n\nfunction isStaticValue(value: unknown): boolean {\n return !isResponsiveValue(value as Record<string, unknown> | undefined);\n}\n\nexport function Container(props: ContainerNativeProps): JSX.Element;\nexport function Container(props: ContainerAsChildProps): JSX.Element;\nexport function Container(props: ContainerNativeProps | ContainerAsChildProps) {\n const {\n asChild,\n children,\n variant,\n fluid = false,\n maxWidth,\n padding,\n size,\n align = \"center\",\n ref,\n style: userStyle,\n ...rest\n } = props;\n\n const responsiveVariant =\n fluid || (size === undefined && maxWidth === undefined)\n ? fluid\n ? \"fluid\"\n : (variant ?? \"default\")\n : undefined;\n\n const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);\n const layoutStyle: Record<string, string | number> = {\n boxSizing: \"border-box\",\n width: \"100%\",\n };\n applyBoxLayoutStyles(layoutStyle, boxProps);\n\n const widthValue = fluid ? undefined : (maxWidth ?? size);\n const usesInlineMaxWidth =\n boxProps.maxWidth === undefined &&\n widthValue !== undefined &&\n (isResponsiveValue(widthValue) || !isContainerWidthToken(widthValue));\n\n if (usesInlineMaxWidth) {\n setResponsiveStyleVar(layoutStyle, \"max-width\", widthValue, (value) =>\n typeof value === \"string\" && isContainerWidthToken(value)\n ? resolveContainerSizeValue(value)\n : value,\n );\n }\n\n if (\n padding !== undefined &&\n boxProps.px === undefined &&\n boxProps.pl === undefined &&\n boxProps.pr === undefined\n ) {\n setResponsiveStyleVar(layoutStyle, \"px\", padding, resolveSpaceValue);\n }\n\n const applyAlign = (side: \"marginLeft\" | \"marginRight\", value: typeof align) => {\n setResponsiveStyleVar(layoutStyle, side === \"marginLeft\" ? \"ml\" : \"mr\", value, (input) => {\n const margins = resolveInlineAlignValue(input);\n return side === \"marginLeft\" ? margins.marginLeft : margins.marginRight;\n });\n };\n\n if (boxProps.ml === undefined && boxProps.mr === undefined && isResponsiveValue(align)) {\n applyAlign(\"marginLeft\", align);\n applyAlign(\"marginRight\", align);\n }\n\n const mergedStyle =\n Object.keys(layoutStyle).length > 2 || hasStyleValue(userStyle)\n ? withBoxLayoutStyle(layoutStyle, userStyle)\n : undefined;\n\n const finalProps = mergeProps(passthroughProps, {\n ref,\n \"data-slot\": \"container\",\n \"data-ak-layout\": \"true\",\n \"data-variant\": responsiveVariant,\n \"data-fluid\": fluid ? \"true\" : undefined,\n \"data-size\": fluid\n ? undefined\n : isStaticValue(size)\n ? serializeResponsiveValueIf(size, isContainerWidthToken)\n : undefined,\n \"data-align\": isStaticValue(align)\n ? serializeResponsiveValueIf(align, isContainerAlignToken)\n : undefined,\n \"data-max-width\": fluid\n ? undefined\n : isStaticValue(maxWidth)\n ? serializeResponsiveValueIf(maxWidth, isContainerWidthToken)\n : undefined,\n style: mergedStyle,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children} />;\n }\n\n return <div {...finalProps}>{children}</div>;\n}\n"],"mappings":";;;;;;AAiBA,MAAM,yBAAyB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAK;CAAM;CAAM;CAAM;CAAK,CAAC;AAEpF,SAAS,sBAAsB,OAAiC;AAC9D,QAAO,OAAO,UAAU,YAAY,uBAAuB,IAAI,MAAM,MAAM,CAAC;;AAG9E,SAAS,sBAAsB,OAAsD;AACnF,QAAO,OAAO,UAAU,YAAY;EAAC;EAAQ;EAAU;EAAQ,CAAC,SAAS,MAAM,MAAM,CAAC;;AAGxF,SAAS,cAAc,OAAyB;AAC9C,KAAI,OAAO,UAAU,SAAU,QAAO,MAAM,MAAM,CAAC,SAAS;AAC5D,KAAI,SAAS,OAAO,UAAU,SAC5B,QAAO,OAAO,KAAK,MAAiC,CAAC,SAAS;AAGhE,QAAO;;AAGT,SAAS,cAAc,OAAyB;AAC9C,QAAO,CAAC,kBAAkB,MAA6C;;AAKzE,SAAgB,UAAU,OAAqD;CAC7E,MAAM,EACJ,SACA,UACA,SACA,QAAQ,OACR,UACA,SACA,MACA,QAAQ,UACR,KACA,OAAO,WACP,GAAG,SACD;CAEJ,MAAM,oBACJ,SAAU,SAAS,KAAA,KAAa,aAAa,KAAA,IACzC,QACE,UACC,WAAW,YACd,KAAA;CAEN,MAAM,EAAE,UAAU,MAAM,qBAAqB,oBAAoB,KAAK;CACtE,MAAM,cAA+C;EACnD,WAAW;EACX,OAAO;EACR;AACD,sBAAqB,aAAa,SAAS;CAE3C,MAAM,aAAa,QAAQ,KAAA,IAAa,YAAY;AAMpD,KAJE,SAAS,aAAa,KAAA,KACtB,eAAe,KAAA,MACd,kBAAkB,WAAW,IAAI,CAAC,sBAAsB,WAAW,EAGpE,uBAAsB,aAAa,aAAa,aAAa,UAC3D,OAAO,UAAU,YAAY,sBAAsB,MAAM,GACrD,0BAA0B,MAAM,GAChC,MACL;AAGH,KACE,YAAY,KAAA,KACZ,SAAS,OAAO,KAAA,KAChB,SAAS,OAAO,KAAA,KAChB,SAAS,OAAO,KAAA,EAEhB,uBAAsB,aAAa,MAAM,SAAS,kBAAkB;CAGtE,MAAM,cAAc,MAAoC,UAAwB;AAC9E,wBAAsB,aAAa,SAAS,eAAe,OAAO,MAAM,QAAQ,UAAU;GACxF,MAAM,UAAU,wBAAwB,MAAM;AAC9C,UAAO,SAAS,eAAe,QAAQ,aAAa,QAAQ;IAC5D;;AAGJ,KAAI,SAAS,OAAO,KAAA,KAAa,SAAS,OAAO,KAAA,KAAa,kBAAkB,MAAM,EAAE;AACtF,aAAW,cAAc,MAAM;AAC/B,aAAW,eAAe,MAAM;;CAGlC,MAAM,cACJ,OAAO,KAAK,YAAY,CAAC,SAAS,KAAK,cAAc,UAAU,GAC3D,mBAAmB,aAAa,UAAU,GAC1C,KAAA;CAEN,MAAM,aAAa,WAAW,kBAAkB;EAC9C;EACA,aAAa;EACb,kBAAkB;EAClB,gBAAgB;EAChB,cAAc,QAAQ,SAAS,KAAA;EAC/B,aAAa,QACT,KAAA,IACA,cAAc,KAAK,GACjB,2BAA2B,MAAM,sBAAsB,GACvD,KAAA;EACN,cAAc,cAAc,MAAM,GAC9B,2BAA2B,OAAO,sBAAsB,GACxD,KAAA;EACJ,kBAAkB,QACd,KAAA,IACA,cAAc,SAAS,GACrB,2BAA2B,UAAU,sBAAsB,GAC3D,KAAA;EACN,OAAO;EACR,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,28 @@
|
|
|
1
|
+
import { BoxLayoutOwnProps, LayoutResponsive } from "../box/box.types.js";
|
|
2
|
+
import { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
3
|
+
|
|
4
|
+
//#region src/components/container/container.types.d.ts
|
|
5
|
+
type ContainerVariant = "default" | "sm" | "md" | "lg" | "xl" | "xxl" | "fluid";
|
|
6
|
+
type ContainerOwnProps = BoxLayoutOwnProps & {
|
|
7
|
+
/** Bootstrap-like responsive container variant. */variant?: ContainerVariant; /** Makes the container span the full available width while preserving gutters. */
|
|
8
|
+
fluid?: boolean; /** Radix-style container size token. */
|
|
9
|
+
size?: LayoutResponsive<"1" | "2" | "3" | "4" | "sm" | "md" | "lg" | "xl">; /** Horizontal alignment of the constrained container. */
|
|
10
|
+
align?: LayoutResponsive<"left" | "center" | "right">; /** Compatibility max-width override. */
|
|
11
|
+
maxWidth?: LayoutResponsive<string>; /** Compatibility horizontal padding override. */
|
|
12
|
+
padding?: LayoutResponsive<string | number>;
|
|
13
|
+
children?: unknown;
|
|
14
|
+
};
|
|
15
|
+
type ContainerNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & ContainerOwnProps & {
|
|
16
|
+
asChild?: false;
|
|
17
|
+
ref?: Ref<HTMLDivElement>;
|
|
18
|
+
};
|
|
19
|
+
type ContainerAsChildProps = ContainerOwnProps & {
|
|
20
|
+
asChild: true;
|
|
21
|
+
children: JSXElement;
|
|
22
|
+
ref?: Ref<unknown>;
|
|
23
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
24
|
+
};
|
|
25
|
+
type ContainerProps = ContainerNativeProps | ContainerAsChildProps;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ContainerAsChildProps, ContainerNativeProps, ContainerOwnProps, ContainerProps, ContainerVariant };
|
|
28
|
+
//# sourceMappingURL=container.types.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { classes } from "../_internal/classes.js";
|
|
2
|
+
import { jsx, jsxs } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/empty-state/empty-state.tsx
|
|
4
|
+
function EmptyState(props) {
|
|
5
|
+
const { icon, title, titleAs: TitleTag = "h2", description, actions, children, ref, class: className, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7
|
+
...rest,
|
|
8
|
+
ref,
|
|
9
|
+
class: classes("empty-state", className),
|
|
10
|
+
"data-slot": "empty-state",
|
|
11
|
+
children: [
|
|
12
|
+
icon !== void 0 ? /* @__PURE__ */ jsx("div", {
|
|
13
|
+
class: "empty-state-icon",
|
|
14
|
+
"data-slot": "empty-state-icon",
|
|
15
|
+
children: icon
|
|
16
|
+
}) : null,
|
|
17
|
+
title !== void 0 ? /* @__PURE__ */ jsx(TitleTag, {
|
|
18
|
+
class: "empty-state-title",
|
|
19
|
+
"data-slot": "empty-state-title",
|
|
20
|
+
children: title
|
|
21
|
+
}) : null,
|
|
22
|
+
description !== void 0 ? /* @__PURE__ */ jsx("p", {
|
|
23
|
+
class: "empty-state-description",
|
|
24
|
+
"data-slot": "empty-state-description",
|
|
25
|
+
children: description
|
|
26
|
+
}) : null,
|
|
27
|
+
children,
|
|
28
|
+
actions !== void 0 ? /* @__PURE__ */ jsx("div", {
|
|
29
|
+
class: "empty-state-actions",
|
|
30
|
+
"data-slot": "empty-state-actions",
|
|
31
|
+
children: actions
|
|
32
|
+
}) : null
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { EmptyState };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty-state.js","names":[],"sources":["../../src/components/empty-state/empty-state.tsx"],"sourcesContent":["import { classes } from \"../_internal/classes\";\nimport type { EmptyStateProps } from \"./empty-state.types\";\n\nexport function EmptyState(props: EmptyStateProps): JSX.Element {\n const {\n icon,\n title,\n titleAs: TitleTag = \"h2\",\n description,\n actions,\n children,\n ref,\n class: className,\n ...rest\n } = props;\n\n return (\n <div {...rest} ref={ref} class={classes(\"empty-state\", className)} data-slot=\"empty-state\">\n {icon !== undefined ? (\n <div class=\"empty-state-icon\" data-slot=\"empty-state-icon\">\n {icon}\n </div>\n ) : null}\n {title !== undefined ? (\n <TitleTag class=\"empty-state-title\" data-slot=\"empty-state-title\">\n {title}\n </TitleTag>\n ) : null}\n {description !== undefined ? (\n <p class=\"empty-state-description\" data-slot=\"empty-state-description\">\n {description}\n </p>\n ) : null}\n {children}\n {actions !== undefined ? (\n <div class=\"empty-state-actions\" data-slot=\"empty-state-actions\">\n {actions}\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,WAAW,OAAqC;CAC9D,MAAM,EACJ,MACA,OACA,SAAS,WAAW,MACpB,aACA,SACA,UACA,KACA,OAAO,WACP,GAAG,SACD;AAEJ,QACE,qBAAC,OAAD;EAAK,GAAI;EAAW;EAAK,OAAO,QAAQ,eAAe,UAAU;EAAE,aAAU;YAA7E;GACG,SAAS,KAAA,IACR,oBAAC,OAAD;IAAK,OAAM;IAAmB,aAAU;cACrC;IACG,CAAA,GACJ;GACH,UAAU,KAAA,IACT,oBAAC,UAAD;IAAU,OAAM;IAAoB,aAAU;cAC3C;IACQ,CAAA,GACT;GACH,gBAAgB,KAAA,IACf,oBAAC,KAAD;IAAG,OAAM;IAA0B,aAAU;cAC1C;IACC,CAAA,GACF;GACH;GACA,YAAY,KAAA,IACX,oBAAC,OAAD;IAAK,OAAM;IAAsB,aAAU;cACxC;IACG,CAAA,GACJ;GACA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/components/empty-state/empty-state.types.d.ts
|
|
2
|
+
type EmptyStateHeadingTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
3
|
+
type EmptyStateProps = Omit<JSX.IntrinsicElements["div"], "children"> & {
|
|
4
|
+
icon?: unknown;
|
|
5
|
+
title?: unknown;
|
|
6
|
+
titleAs?: EmptyStateHeadingTag;
|
|
7
|
+
description?: unknown;
|
|
8
|
+
actions?: unknown;
|
|
9
|
+
children?: unknown;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { EmptyStateHeadingTag, EmptyStateProps };
|
|
13
|
+
//# sourceMappingURL=empty-state.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FlexAsChildProps, FlexDivProps, FlexSpanProps } from "./flex.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/flex/flex.d.ts
|
|
4
|
+
declare function Flex(props: FlexDivProps): JSX.Element;
|
|
5
|
+
declare function Flex(props: FlexSpanProps): JSX.Element;
|
|
6
|
+
declare function Flex(props: FlexAsChildProps): JSX.Element;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Flex };
|
|
9
|
+
//# sourceMappingURL=flex.d.ts.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { mergeProps } from "../_internal/merge-props.js";
|
|
2
|
+
import { isResponsiveValue, resolveAlignValue, resolveJustifyValue, resolveSpaceValue, serializeResponsiveValueIf, setResponsiveStyleVar } from "../_internal/layout.js";
|
|
3
|
+
import { applyBoxLayoutStyles, splitBoxLayoutProps, withBoxLayoutStyle } from "../_internal/box-layout.js";
|
|
4
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
5
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
6
|
+
//#region src/components/flex/flex.tsx
|
|
7
|
+
const SPACE_TOKENS = new Set([
|
|
8
|
+
"1",
|
|
9
|
+
"2",
|
|
10
|
+
"3",
|
|
11
|
+
"4",
|
|
12
|
+
"5",
|
|
13
|
+
"6",
|
|
14
|
+
"7",
|
|
15
|
+
"8",
|
|
16
|
+
"9",
|
|
17
|
+
"xs",
|
|
18
|
+
"sm",
|
|
19
|
+
"md",
|
|
20
|
+
"lg",
|
|
21
|
+
"xl",
|
|
22
|
+
"2xl",
|
|
23
|
+
"3xl"
|
|
24
|
+
]);
|
|
25
|
+
function isResponsiveObject(value) {
|
|
26
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
function isCssCoveredSpaceValue(value) {
|
|
29
|
+
return typeof value === "string" && SPACE_TOKENS.has(value.trim());
|
|
30
|
+
}
|
|
31
|
+
function isCssCoveredDirectionValue(value) {
|
|
32
|
+
return typeof value === "string" && [
|
|
33
|
+
"row",
|
|
34
|
+
"column",
|
|
35
|
+
"row-reverse",
|
|
36
|
+
"column-reverse"
|
|
37
|
+
].includes(value.trim());
|
|
38
|
+
}
|
|
39
|
+
function isCssCoveredAlignValue(value) {
|
|
40
|
+
return typeof value === "string" && [
|
|
41
|
+
"start",
|
|
42
|
+
"end",
|
|
43
|
+
"center",
|
|
44
|
+
"stretch",
|
|
45
|
+
"baseline"
|
|
46
|
+
].includes(value.trim());
|
|
47
|
+
}
|
|
48
|
+
function isCssCoveredJustifyValue(value) {
|
|
49
|
+
return typeof value === "string" && [
|
|
50
|
+
"start",
|
|
51
|
+
"end",
|
|
52
|
+
"center",
|
|
53
|
+
"between"
|
|
54
|
+
].includes(value.trim());
|
|
55
|
+
}
|
|
56
|
+
function isCssCoveredWrapValue(value) {
|
|
57
|
+
return typeof value === "string" && [
|
|
58
|
+
"wrap",
|
|
59
|
+
"nowrap",
|
|
60
|
+
"wrap-reverse"
|
|
61
|
+
].includes(value.trim());
|
|
62
|
+
}
|
|
63
|
+
function serializeStaticThemeValue(value, predicate) {
|
|
64
|
+
if (isResponsiveValue(value)) return void 0;
|
|
65
|
+
return serializeResponsiveValueIf(value, predicate);
|
|
66
|
+
}
|
|
67
|
+
const SLOTS = { root: "flex" };
|
|
68
|
+
function Flex(props) {
|
|
69
|
+
const as = "as" in props ? props.as : "div";
|
|
70
|
+
const { asChild, children, direction = "row", gap, gapX, gapY, align, justify, wrap, collapseBelow, ref, style: userStyle, ...rest } = props;
|
|
71
|
+
const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);
|
|
72
|
+
const rootSlot = typeof passthroughProps["data-slot"] === "string" ? String(passthroughProps["data-slot"]) : SLOTS.root;
|
|
73
|
+
const layoutStyle = {};
|
|
74
|
+
applyBoxLayoutStyles(layoutStyle, boxProps);
|
|
75
|
+
if (boxProps.display !== void 0) setResponsiveStyleVar(layoutStyle, "display", boxProps.display, (value) => value);
|
|
76
|
+
if (direction !== "row" && (!isCssCoveredDirectionValue(direction) || isResponsiveObject(direction))) setResponsiveStyleVar(layoutStyle, "flex-direction", direction, (value) => value);
|
|
77
|
+
if (!isCssCoveredSpaceValue(gap) || isResponsiveObject(gap)) setResponsiveStyleVar(layoutStyle, "gap", gap, resolveSpaceValue);
|
|
78
|
+
if (!isCssCoveredSpaceValue(gapX) || isResponsiveObject(gapX)) setResponsiveStyleVar(layoutStyle, "column-gap", gapX, resolveSpaceValue);
|
|
79
|
+
if (!isCssCoveredSpaceValue(gapY) || isResponsiveObject(gapY)) setResponsiveStyleVar(layoutStyle, "row-gap", gapY, resolveSpaceValue);
|
|
80
|
+
if (!isCssCoveredAlignValue(align) || isResponsiveObject(align)) setResponsiveStyleVar(layoutStyle, "align-items", align, resolveAlignValue);
|
|
81
|
+
if (!isCssCoveredJustifyValue(justify) || isResponsiveObject(justify)) setResponsiveStyleVar(layoutStyle, "justify-content", justify, resolveJustifyValue);
|
|
82
|
+
if (!isCssCoveredWrapValue(wrap) || isResponsiveObject(wrap)) setResponsiveStyleVar(layoutStyle, "flex-wrap", wrap, (value) => value);
|
|
83
|
+
const finalProps = mergeProps(passthroughProps, {
|
|
84
|
+
ref,
|
|
85
|
+
"data-slot": rootSlot,
|
|
86
|
+
"data-ak-layout": "true",
|
|
87
|
+
"data-direction": serializeStaticThemeValue(direction, isCssCoveredDirectionValue),
|
|
88
|
+
"data-gap": serializeStaticThemeValue(gap, isCssCoveredSpaceValue),
|
|
89
|
+
"data-gap-x": serializeStaticThemeValue(gapX, isCssCoveredSpaceValue),
|
|
90
|
+
"data-gap-y": serializeStaticThemeValue(gapY, isCssCoveredSpaceValue),
|
|
91
|
+
"data-align": serializeStaticThemeValue(align, isCssCoveredAlignValue),
|
|
92
|
+
"data-justify": serializeStaticThemeValue(justify, isCssCoveredJustifyValue),
|
|
93
|
+
"data-wrap": serializeStaticThemeValue(wrap, isCssCoveredWrapValue),
|
|
94
|
+
"data-collapse-below": collapseBelow,
|
|
95
|
+
style: withBoxLayoutStyle(layoutStyle, userStyle)
|
|
96
|
+
});
|
|
97
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
98
|
+
asChild: true,
|
|
99
|
+
...finalProps,
|
|
100
|
+
children
|
|
101
|
+
});
|
|
102
|
+
if (as === "span") return /* @__PURE__ */ jsx("span", {
|
|
103
|
+
...finalProps,
|
|
104
|
+
children
|
|
105
|
+
});
|
|
106
|
+
return /* @__PURE__ */ jsx("div", {
|
|
107
|
+
...finalProps,
|
|
108
|
+
children
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { Flex };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=flex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flex.js","names":[],"sources":["../../src/components/flex/flex.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport {\n applyBoxLayoutStyles,\n splitBoxLayoutProps,\n withBoxLayoutStyle,\n} from \"../_internal/box-layout\";\nimport {\n isResponsiveValue,\n resolveAlignValue,\n resolveJustifyValue,\n resolveSpaceValue,\n serializeResponsiveValueIf,\n setResponsiveStyleVar,\n} from \"../_internal/layout\";\nimport type { FlexAsChildProps, FlexDivProps, FlexSpanProps } from \"./flex.types\";\n\nconst SPACE_TOKENS = new Set([\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"xs\",\n \"sm\",\n \"md\",\n \"lg\",\n \"xl\",\n \"2xl\",\n \"3xl\",\n]);\n\nfunction isResponsiveObject(value: unknown): boolean {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction isCssCoveredSpaceValue(value: unknown): value is string {\n return typeof value === \"string\" && SPACE_TOKENS.has(value.trim());\n}\n\nfunction isCssCoveredDirectionValue(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n [\"row\", \"column\", \"row-reverse\", \"column-reverse\"].includes(value.trim())\n );\n}\n\nfunction isCssCoveredAlignValue(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n [\"start\", \"end\", \"center\", \"stretch\", \"baseline\"].includes(value.trim())\n );\n}\n\nfunction isCssCoveredJustifyValue(value: unknown): value is string {\n return typeof value === \"string\" && [\"start\", \"end\", \"center\", \"between\"].includes(value.trim());\n}\n\nfunction isCssCoveredWrapValue(value: unknown): value is string {\n return typeof value === \"string\" && [\"wrap\", \"nowrap\", \"wrap-reverse\"].includes(value.trim());\n}\n\nfunction serializeStaticThemeValue<T>(\n value: T | Partial<Record<\"initial\" | \"sm\" | \"md\" | \"lg\" | \"xl\", T>> | undefined,\n predicate: (value: T) => boolean,\n): string | undefined {\n if (isResponsiveValue(value)) return undefined;\n return serializeResponsiveValueIf(value, predicate);\n}\n\nconst SLOTS = {\n root: \"flex\",\n} as const;\n\nexport function Flex(props: FlexDivProps): JSX.Element;\nexport function Flex(props: FlexSpanProps): JSX.Element;\nexport function Flex(props: FlexAsChildProps): JSX.Element;\nexport function Flex(props: FlexDivProps | FlexSpanProps | FlexAsChildProps) {\n const as = \"as\" in props ? props.as : \"div\";\n const {\n asChild,\n children,\n direction = \"row\",\n gap,\n gapX,\n gapY,\n align,\n justify,\n wrap,\n collapseBelow,\n ref,\n style: userStyle,\n ...rest\n } = props;\n\n const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);\n const rootSlot =\n typeof (passthroughProps as Record<string, unknown>)[\"data-slot\"] === \"string\"\n ? String((passthroughProps as Record<string, unknown>)[\"data-slot\"])\n : SLOTS.root;\n const layoutStyle: Record<string, string | number> = {};\n applyBoxLayoutStyles(layoutStyle, boxProps);\n\n if (boxProps.display !== undefined) {\n setResponsiveStyleVar(layoutStyle, \"display\", boxProps.display, (value) => value);\n }\n if (\n direction !== \"row\" &&\n (!isCssCoveredDirectionValue(direction) || isResponsiveObject(direction))\n ) {\n setResponsiveStyleVar(layoutStyle, \"flex-direction\", direction, (value) => value);\n }\n if (!isCssCoveredSpaceValue(gap) || isResponsiveObject(gap)) {\n setResponsiveStyleVar(layoutStyle, \"gap\", gap, resolveSpaceValue);\n }\n if (!isCssCoveredSpaceValue(gapX) || isResponsiveObject(gapX)) {\n setResponsiveStyleVar(layoutStyle, \"column-gap\", gapX, resolveSpaceValue);\n }\n if (!isCssCoveredSpaceValue(gapY) || isResponsiveObject(gapY)) {\n setResponsiveStyleVar(layoutStyle, \"row-gap\", gapY, resolveSpaceValue);\n }\n if (!isCssCoveredAlignValue(align) || isResponsiveObject(align)) {\n setResponsiveStyleVar(layoutStyle, \"align-items\", align, resolveAlignValue);\n }\n if (!isCssCoveredJustifyValue(justify) || isResponsiveObject(justify)) {\n setResponsiveStyleVar(layoutStyle, \"justify-content\", justify, resolveJustifyValue);\n }\n if (!isCssCoveredWrapValue(wrap) || isResponsiveObject(wrap)) {\n setResponsiveStyleVar(layoutStyle, \"flex-wrap\", wrap, (value) => value);\n }\n\n const finalProps = mergeProps(passthroughProps, {\n ref,\n \"data-slot\": rootSlot,\n \"data-ak-layout\": \"true\",\n \"data-direction\": serializeStaticThemeValue(direction, isCssCoveredDirectionValue),\n \"data-gap\": serializeStaticThemeValue(gap, isCssCoveredSpaceValue),\n \"data-gap-x\": serializeStaticThemeValue(gapX, isCssCoveredSpaceValue),\n \"data-gap-y\": serializeStaticThemeValue(gapY, isCssCoveredSpaceValue),\n \"data-align\": serializeStaticThemeValue(align, isCssCoveredAlignValue),\n \"data-justify\": serializeStaticThemeValue(justify, isCssCoveredJustifyValue),\n \"data-wrap\": serializeStaticThemeValue(wrap, isCssCoveredWrapValue),\n \"data-collapse-below\": collapseBelow,\n style: withBoxLayoutStyle(layoutStyle, userStyle),\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n if (as === \"span\") {\n return <span {...finalProps}>{children}</span>;\n }\n\n return <div {...finalProps}>{children}</div>;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BoxLayoutOwnProps, LayoutResponsive } from "../box/box.types.js";
|
|
2
|
+
import { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
3
|
+
|
|
4
|
+
//#region src/components/flex/flex.types.d.ts
|
|
5
|
+
type FlexOwnProps = BoxLayoutOwnProps & {
|
|
6
|
+
direction?: LayoutResponsive<"row" | "column" | "row-reverse" | "column-reverse">;
|
|
7
|
+
gap?: LayoutResponsive<string | number>;
|
|
8
|
+
gapX?: LayoutResponsive<string | number>;
|
|
9
|
+
gapY?: LayoutResponsive<string | number>;
|
|
10
|
+
align?: LayoutResponsive<string>;
|
|
11
|
+
justify?: LayoutResponsive<string>;
|
|
12
|
+
wrap?: LayoutResponsive<"wrap" | "nowrap" | "wrap-reverse">;
|
|
13
|
+
/**
|
|
14
|
+
* Compatibility breakpoint helper. Prefer responsive `direction` instead.
|
|
15
|
+
*/
|
|
16
|
+
collapseBelow?: string;
|
|
17
|
+
as?: "div" | "span";
|
|
18
|
+
children?: unknown;
|
|
19
|
+
};
|
|
20
|
+
type FlexNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & FlexOwnProps & {
|
|
21
|
+
as?: "div";
|
|
22
|
+
asChild?: false;
|
|
23
|
+
ref?: Ref<HTMLDivElement>;
|
|
24
|
+
};
|
|
25
|
+
type FlexSpanProps = Omit<JSX.IntrinsicElements["span"], "children" | "ref"> & FlexOwnProps & {
|
|
26
|
+
as: "span";
|
|
27
|
+
asChild?: false;
|
|
28
|
+
ref?: Ref<HTMLSpanElement>;
|
|
29
|
+
};
|
|
30
|
+
type FlexAsChildProps = Omit<FlexOwnProps, "as"> & {
|
|
31
|
+
asChild: true;
|
|
32
|
+
children: JSXElement;
|
|
33
|
+
ref?: Ref<unknown>;
|
|
34
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
35
|
+
};
|
|
36
|
+
type FlexDivProps = FlexNativeProps;
|
|
37
|
+
type FlexProps = FlexDivProps | FlexSpanProps | FlexAsChildProps;
|
|
38
|
+
type InlineProps = FlexProps;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { FlexAsChildProps, FlexDivProps, FlexNativeProps, FlexOwnProps, FlexProps, FlexSpanProps, InlineProps };
|
|
41
|
+
//# sourceMappingURL=flex.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GridAsChildProps, GridDivProps, GridSpanProps } from "./grid.types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/grid/grid.d.ts
|
|
4
|
+
declare function Grid(props: GridDivProps): JSX.Element;
|
|
5
|
+
declare function Grid(props: GridSpanProps): JSX.Element;
|
|
6
|
+
declare function Grid(props: GridAsChildProps): JSX.Element;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Grid };
|
|
9
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { mergeProps } from "../_internal/merge-props.js";
|
|
2
|
+
import { isResponsiveValue, resolveAlignValue, resolveGridTrackValue, resolveJustifyValue, resolveSpaceValue, serializeResponsiveValueIf, serializeValueIf, setResponsiveStyleVar } from "../_internal/layout.js";
|
|
3
|
+
import { applyBoxLayoutStyles, splitBoxLayoutProps, withBoxLayoutStyle } from "../_internal/box-layout.js";
|
|
4
|
+
import { isJsxElement, toChildArray } from "../_internal/jsx.js";
|
|
5
|
+
import { For } from "@askrjs/askr";
|
|
6
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
7
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
8
|
+
//#region src/components/grid/grid.tsx
|
|
9
|
+
const SPACE_TOKENS = new Set([
|
|
10
|
+
"1",
|
|
11
|
+
"2",
|
|
12
|
+
"3",
|
|
13
|
+
"4",
|
|
14
|
+
"5",
|
|
15
|
+
"6",
|
|
16
|
+
"7",
|
|
17
|
+
"8",
|
|
18
|
+
"9",
|
|
19
|
+
"xs",
|
|
20
|
+
"sm",
|
|
21
|
+
"md",
|
|
22
|
+
"lg",
|
|
23
|
+
"xl",
|
|
24
|
+
"2xl",
|
|
25
|
+
"3xl"
|
|
26
|
+
]);
|
|
27
|
+
function isResponsiveObject(value) {
|
|
28
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
29
|
+
}
|
|
30
|
+
function isCssCoveredSpaceValue(value) {
|
|
31
|
+
return typeof value === "string" && SPACE_TOKENS.has(value.trim());
|
|
32
|
+
}
|
|
33
|
+
function isCssCoveredAlignValue(value) {
|
|
34
|
+
return typeof value === "string" && [
|
|
35
|
+
"start",
|
|
36
|
+
"end",
|
|
37
|
+
"center",
|
|
38
|
+
"stretch",
|
|
39
|
+
"baseline"
|
|
40
|
+
].includes(value.trim());
|
|
41
|
+
}
|
|
42
|
+
function isCssCoveredJustifyValue(value) {
|
|
43
|
+
return typeof value === "string" && [
|
|
44
|
+
"start",
|
|
45
|
+
"end",
|
|
46
|
+
"center",
|
|
47
|
+
"between"
|
|
48
|
+
].includes(value.trim());
|
|
49
|
+
}
|
|
50
|
+
function isCssCoveredGridColumnValue(value) {
|
|
51
|
+
return typeof value === "number" || typeof value === "string" && /^\d+$/.test(value.trim());
|
|
52
|
+
}
|
|
53
|
+
function isCssCoveredAutoFitValue(value) {
|
|
54
|
+
return typeof value === "boolean";
|
|
55
|
+
}
|
|
56
|
+
function serializeStaticThemeValue(value, predicate) {
|
|
57
|
+
if (isResponsiveValue(value)) return void 0;
|
|
58
|
+
return serializeResponsiveValueIf(value, predicate);
|
|
59
|
+
}
|
|
60
|
+
function resolveCompatibilityGridTemplate(minItemWidth, autoFit) {
|
|
61
|
+
if (!minItemWidth) return void 0;
|
|
62
|
+
return `repeat(${autoFit === false ? "auto-fill" : "auto-fit"}, minmax(${minItemWidth}, 1fr))`;
|
|
63
|
+
}
|
|
64
|
+
function Grid(props) {
|
|
65
|
+
const as = "as" in props ? props.as : "div";
|
|
66
|
+
const { asChild, children, areas, columns, rows, flow, gap, gapX, gapY, align, justify, minItemWidth, autoFit, ref, style: userStyle, ...rest } = props;
|
|
67
|
+
const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);
|
|
68
|
+
const layoutStyle = {};
|
|
69
|
+
applyBoxLayoutStyles(layoutStyle, boxProps);
|
|
70
|
+
if (boxProps.display !== void 0) setResponsiveStyleVar(layoutStyle, "display", boxProps.display, (value) => value);
|
|
71
|
+
setResponsiveStyleVar(layoutStyle, "grid-template-areas", areas, (value) => value);
|
|
72
|
+
setResponsiveStyleVar(layoutStyle, "grid-template-columns", columns ?? resolveCompatibilityGridTemplate(minItemWidth, autoFit), resolveGridTrackValue);
|
|
73
|
+
setResponsiveStyleVar(layoutStyle, "grid-template-rows", rows, resolveGridTrackValue);
|
|
74
|
+
setResponsiveStyleVar(layoutStyle, "grid-auto-flow", flow, (value) => value);
|
|
75
|
+
if (!isCssCoveredSpaceValue(gap) || isResponsiveObject(gap)) setResponsiveStyleVar(layoutStyle, "gap", gap, resolveSpaceValue);
|
|
76
|
+
if (!isCssCoveredSpaceValue(gapX) || isResponsiveObject(gapX)) setResponsiveStyleVar(layoutStyle, "column-gap", gapX, resolveSpaceValue);
|
|
77
|
+
if (!isCssCoveredSpaceValue(gapY) || isResponsiveObject(gapY)) setResponsiveStyleVar(layoutStyle, "row-gap", gapY, resolveSpaceValue);
|
|
78
|
+
if (!isCssCoveredAlignValue(align) || isResponsiveObject(align)) setResponsiveStyleVar(layoutStyle, "align-items", align, resolveAlignValue);
|
|
79
|
+
if (!isCssCoveredJustifyValue(justify) || isResponsiveObject(justify)) setResponsiveStyleVar(layoutStyle, "justify-content", justify, resolveJustifyValue);
|
|
80
|
+
const finalProps = mergeProps(passthroughProps, {
|
|
81
|
+
ref,
|
|
82
|
+
"data-slot": "grid",
|
|
83
|
+
"data-ak-layout": "true",
|
|
84
|
+
"data-columns": serializeStaticThemeValue(columns, isCssCoveredGridColumnValue),
|
|
85
|
+
"data-gap": serializeStaticThemeValue(gap, isCssCoveredSpaceValue),
|
|
86
|
+
"data-gap-x": serializeStaticThemeValue(gapX, isCssCoveredSpaceValue),
|
|
87
|
+
"data-gap-y": serializeStaticThemeValue(gapY, isCssCoveredSpaceValue),
|
|
88
|
+
"data-align": serializeStaticThemeValue(align, isCssCoveredAlignValue),
|
|
89
|
+
"data-justify": serializeStaticThemeValue(justify, isCssCoveredJustifyValue),
|
|
90
|
+
"data-auto-fit": serializeValueIf(autoFit, isCssCoveredAutoFitValue),
|
|
91
|
+
style: withBoxLayoutStyle(layoutStyle, userStyle)
|
|
92
|
+
});
|
|
93
|
+
const keyedChildren = /* @__PURE__ */ jsx(For, {
|
|
94
|
+
each: () => toChildArray(children),
|
|
95
|
+
by: (child, index) => isJsxElement(child) && child.key != null ? child.key : index,
|
|
96
|
+
children: (child) => child
|
|
97
|
+
});
|
|
98
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
99
|
+
asChild: true,
|
|
100
|
+
...finalProps,
|
|
101
|
+
children
|
|
102
|
+
});
|
|
103
|
+
if (as === "span") return /* @__PURE__ */ jsx("span", {
|
|
104
|
+
...finalProps,
|
|
105
|
+
children: keyedChildren
|
|
106
|
+
});
|
|
107
|
+
return /* @__PURE__ */ jsx("div", {
|
|
108
|
+
...finalProps,
|
|
109
|
+
children: keyedChildren
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { Grid };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","names":[],"sources":["../../src/components/grid/grid.tsx"],"sourcesContent":["import { For } from \"@askrjs/askr\";\nimport { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport {\n applyBoxLayoutStyles,\n splitBoxLayoutProps,\n withBoxLayoutStyle,\n} from \"../_internal/box-layout\";\nimport { isJsxElement, toChildArray } from \"../_internal/jsx\";\nimport {\n isResponsiveValue,\n resolveAlignValue,\n resolveGridTrackValue,\n resolveJustifyValue,\n resolveSpaceValue,\n serializeResponsiveValueIf,\n serializeValueIf,\n setResponsiveStyleVar,\n} from \"../_internal/layout\";\nimport type { GridAsChildProps, GridDivProps, GridSpanProps } from \"./grid.types\";\n\nconst SPACE_TOKENS = new Set([\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"xs\",\n \"sm\",\n \"md\",\n \"lg\",\n \"xl\",\n \"2xl\",\n \"3xl\",\n]);\n\nfunction isResponsiveObject(value: unknown): boolean {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction isCssCoveredSpaceValue(value: unknown): value is string {\n return typeof value === \"string\" && SPACE_TOKENS.has(value.trim());\n}\n\nfunction isCssCoveredAlignValue(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n [\"start\", \"end\", \"center\", \"stretch\", \"baseline\"].includes(value.trim())\n );\n}\n\nfunction isCssCoveredJustifyValue(value: unknown): value is string {\n return typeof value === \"string\" && [\"start\", \"end\", \"center\", \"between\"].includes(value.trim());\n}\n\nfunction isCssCoveredGridColumnValue(value: unknown): boolean {\n return typeof value === \"number\" || (typeof value === \"string\" && /^\\d+$/.test(value.trim()));\n}\n\nfunction isCssCoveredAutoFitValue(value: unknown): value is boolean {\n return typeof value === \"boolean\";\n}\n\nfunction serializeStaticThemeValue<T>(\n value: T | Partial<Record<\"initial\" | \"sm\" | \"md\" | \"lg\" | \"xl\", T>> | undefined,\n predicate: (value: T) => boolean,\n): string | undefined {\n if (isResponsiveValue(value)) return undefined;\n return serializeResponsiveValueIf(value, predicate);\n}\n\nfunction resolveCompatibilityGridTemplate(\n minItemWidth: string | undefined,\n autoFit: boolean | undefined,\n): string | undefined {\n if (!minItemWidth) return undefined;\n const fitKeyword = autoFit === false ? \"auto-fill\" : \"auto-fit\";\n return `repeat(${fitKeyword}, minmax(${minItemWidth}, 1fr))`;\n}\n\nexport function Grid(props: GridDivProps): JSX.Element;\nexport function Grid(props: GridSpanProps): JSX.Element;\nexport function Grid(props: GridAsChildProps): JSX.Element;\nexport function Grid(props: GridDivProps | GridSpanProps | GridAsChildProps) {\n const as = \"as\" in props ? props.as : \"div\";\n const {\n asChild,\n children,\n areas,\n columns,\n rows,\n flow,\n gap,\n gapX,\n gapY,\n align,\n justify,\n minItemWidth,\n autoFit,\n ref,\n style: userStyle,\n ...rest\n } = props;\n\n const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);\n const layoutStyle: Record<string, string | number> = {};\n applyBoxLayoutStyles(layoutStyle, boxProps);\n\n if (boxProps.display !== undefined) {\n setResponsiveStyleVar(layoutStyle, \"display\", boxProps.display, (value) => value);\n }\n setResponsiveStyleVar(layoutStyle, \"grid-template-areas\", areas, (value) => value);\n setResponsiveStyleVar(\n layoutStyle,\n \"grid-template-columns\",\n columns ?? resolveCompatibilityGridTemplate(minItemWidth, autoFit),\n resolveGridTrackValue,\n );\n setResponsiveStyleVar(layoutStyle, \"grid-template-rows\", rows, resolveGridTrackValue);\n setResponsiveStyleVar(layoutStyle, \"grid-auto-flow\", flow, (value) => value);\n if (!isCssCoveredSpaceValue(gap) || isResponsiveObject(gap)) {\n setResponsiveStyleVar(layoutStyle, \"gap\", gap, resolveSpaceValue);\n }\n if (!isCssCoveredSpaceValue(gapX) || isResponsiveObject(gapX)) {\n setResponsiveStyleVar(layoutStyle, \"column-gap\", gapX, resolveSpaceValue);\n }\n if (!isCssCoveredSpaceValue(gapY) || isResponsiveObject(gapY)) {\n setResponsiveStyleVar(layoutStyle, \"row-gap\", gapY, resolveSpaceValue);\n }\n if (!isCssCoveredAlignValue(align) || isResponsiveObject(align)) {\n setResponsiveStyleVar(layoutStyle, \"align-items\", align, resolveAlignValue);\n }\n if (!isCssCoveredJustifyValue(justify) || isResponsiveObject(justify)) {\n setResponsiveStyleVar(layoutStyle, \"justify-content\", justify, resolveJustifyValue);\n }\n\n const finalProps = mergeProps(passthroughProps, {\n ref,\n \"data-slot\": \"grid\",\n \"data-ak-layout\": \"true\",\n \"data-columns\": serializeStaticThemeValue(columns, isCssCoveredGridColumnValue),\n \"data-gap\": serializeStaticThemeValue(gap, isCssCoveredSpaceValue),\n \"data-gap-x\": serializeStaticThemeValue(gapX, isCssCoveredSpaceValue),\n \"data-gap-y\": serializeStaticThemeValue(gapY, isCssCoveredSpaceValue),\n \"data-align\": serializeStaticThemeValue(align, isCssCoveredAlignValue),\n \"data-justify\": serializeStaticThemeValue(justify, isCssCoveredJustifyValue),\n \"data-auto-fit\": serializeValueIf(autoFit, isCssCoveredAutoFitValue),\n style: withBoxLayoutStyle(layoutStyle, userStyle),\n });\n const keyedChildren = (\n <For\n each={() => toChildArray(children)}\n by={(child, index) => (isJsxElement(child) && child.key != null ? child.key : index)}\n >\n {(child) => child as never}\n </For>\n );\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n if (as === \"span\") {\n return <span {...finalProps}>{keyedChildren}</span>;\n }\n\n return <div {...finalProps}>{keyedChildren}</div>;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BoxLayoutOwnProps, LayoutResponsive } from "../box/box.types.js";
|
|
2
|
+
import { JSXElement, Ref } from "@askrjs/askr/foundations";
|
|
3
|
+
|
|
4
|
+
//#region src/components/grid/grid.types.d.ts
|
|
5
|
+
type GridOwnProps = BoxLayoutOwnProps & {
|
|
6
|
+
areas?: LayoutResponsive<string>;
|
|
7
|
+
columns?: LayoutResponsive<number | string>;
|
|
8
|
+
rows?: LayoutResponsive<number | string>;
|
|
9
|
+
flow?: LayoutResponsive<string>;
|
|
10
|
+
gap?: LayoutResponsive<string | number>;
|
|
11
|
+
gapX?: LayoutResponsive<string | number>;
|
|
12
|
+
gapY?: LayoutResponsive<string | number>;
|
|
13
|
+
align?: LayoutResponsive<string>;
|
|
14
|
+
justify?: LayoutResponsive<string>; /** Compatibility helper for auto-fit grids. */
|
|
15
|
+
minItemWidth?: string; /** Compatibility helper for auto-fit grids. */
|
|
16
|
+
autoFit?: boolean;
|
|
17
|
+
as?: "div" | "span";
|
|
18
|
+
children?: unknown;
|
|
19
|
+
};
|
|
20
|
+
type GridNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & GridOwnProps & {
|
|
21
|
+
as?: "div";
|
|
22
|
+
asChild?: false;
|
|
23
|
+
ref?: Ref<HTMLDivElement>;
|
|
24
|
+
};
|
|
25
|
+
type GridSpanProps = Omit<JSX.IntrinsicElements["span"], "children" | "ref"> & GridOwnProps & {
|
|
26
|
+
as: "span";
|
|
27
|
+
asChild?: false;
|
|
28
|
+
ref?: Ref<HTMLSpanElement>;
|
|
29
|
+
};
|
|
30
|
+
type GridAsChildProps = Omit<GridOwnProps, "as"> & {
|
|
31
|
+
asChild: true;
|
|
32
|
+
children: JSXElement;
|
|
33
|
+
ref?: Ref<unknown>;
|
|
34
|
+
style?: JSX.IntrinsicElements["div"]["style"];
|
|
35
|
+
};
|
|
36
|
+
type GridDivProps = GridNativeProps;
|
|
37
|
+
type GridProps = GridDivProps | GridSpanProps | GridAsChildProps;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { GridAsChildProps, GridDivProps, GridNativeProps, GridOwnProps, GridProps, GridSpanProps };
|
|
40
|
+
//# sourceMappingURL=grid.types.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { classes } from "../_internal/classes.js";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/header/header.tsx
|
|
4
|
+
function Header(props) {
|
|
5
|
+
const { children, position = "static", ref, class: className, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx("header", {
|
|
7
|
+
...rest,
|
|
8
|
+
ref,
|
|
9
|
+
class: classes("header", className),
|
|
10
|
+
"data-slot": "header",
|
|
11
|
+
"data-position": position,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Header };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","names":[],"sources":["../../src/components/header/header.tsx"],"sourcesContent":["import { classes } from \"../_internal/classes\";\nimport type { HeaderProps } from \"./header.types\";\n\nexport function Header(props: HeaderProps): JSX.Element {\n const { children, position = \"static\", ref, class: className, ...rest } = props;\n\n return (\n <header\n {...rest}\n ref={ref}\n class={classes(\"header\", className)}\n data-slot=\"header\"\n data-position={position}\n >\n {children}\n </header>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,OAAO,OAAiC;CACtD,MAAM,EAAE,UAAU,WAAW,UAAU,KAAK,OAAO,WAAW,GAAG,SAAS;AAE1E,QACE,oBAAC,UAAD;EACE,GAAI;EACC;EACL,OAAO,QAAQ,UAAU,UAAU;EACnC,aAAU;EACV,iBAAe;EAEd;EACM,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/components/header/header.types.d.ts
|
|
2
|
+
type HeaderPosition = "static" | "relative" | "sticky" | "absolute" | "fixed";
|
|
3
|
+
type HeaderProps = Omit<JSX.IntrinsicElements["header"], "children"> & {
|
|
4
|
+
position?: HeaderPosition;
|
|
5
|
+
children?: unknown;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { HeaderPosition, HeaderProps };
|
|
9
|
+
//# sourceMappingURL=header.types.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FlexAsChildProps, FlexDivProps, FlexNativeProps, FlexOwnProps, FlexProps, FlexSpanProps, InlineProps } from "../flex/flex.types.js";
|
|
2
|
+
import { Flex } from "../flex/flex.js";
|
|
3
|
+
//#region src/components/inline/index.d.ts
|
|
4
|
+
declare function Inline(props: InlineProps): JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Inline };
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Flex } from "../flex/flex.js";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/inline/index.tsx
|
|
4
|
+
function Inline(props) {
|
|
5
|
+
return /* @__PURE__ */ jsx(Flex, {
|
|
6
|
+
...props,
|
|
7
|
+
"data-slot": "inline"
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Inline };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/inline/index.tsx"],"sourcesContent":["import { Flex } from \"../flex\";\nimport type { InlineProps } from \"../flex\";\n\nexport function Inline(props: InlineProps): JSX.Element {\n return <Flex {...(props as Record<string, unknown>)} data-slot=\"inline\" />;\n}\n\nexport { Flex };\nexport {\n FLEX_A11Y_CONTRACT,\n FLEX_A11Y_CONTRACT as INLINE_A11Y_CONTRACT,\n type FlexA11yContract,\n type FlexA11yContract as InlineA11yContract,\n} from \"../flex/flex.a11y\";\nexport type {\n FlexProps,\n FlexOwnProps,\n FlexNativeProps,\n FlexDivProps,\n FlexSpanProps,\n FlexAsChildProps,\n FlexProps as InlineProps,\n FlexOwnProps as InlineOwnProps,\n FlexNativeProps as InlineNativeProps,\n FlexDivProps as InlineDivProps,\n FlexSpanProps as InlineSpanProps,\n FlexAsChildProps as InlineAsChildProps,\n} from \"../flex/flex.types\";\n"],"mappings":";;;AAGA,SAAgB,OAAO,OAAiC;AACtD,QAAO,oBAAC,MAAD;EAAM,GAAK;EAAmC,aAAU;EAAW,CAAA"}
|