@askrjs/themes 0.0.2 → 0.0.4
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/README.md +78 -0
- package/THEMING.md +50 -8
- package/dist/{_internal → components/_internal}/box-layout.js +4 -3
- package/dist/components/_internal/box-layout.js.map +1 -0
- package/dist/components/_internal/classes.js.map +1 -0
- package/dist/components/_internal/jsx.js.map +1 -0
- package/dist/components/_internal/layout.d.ts +6 -28
- package/dist/{_internal → components/_internal}/layout.js +5 -15
- package/dist/components/_internal/layout.js.map +1 -0
- package/dist/{_internal → components/_internal}/merge-props.js +5 -0
- package/dist/components/_internal/merge-props.js.map +1 -0
- package/dist/components/_internal/pathname.js +39 -0
- package/dist/components/_internal/pathname.js.map +1 -0
- package/dist/components/_internal/style.js +41 -0
- package/dist/components/_internal/style.js.map +1 -0
- package/dist/components/alert/alert.d.ts +7 -0
- package/dist/components/alert/alert.js +65 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert/alert.types.d.ts +22 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +8 -3
- package/dist/components/aspect-ratio/aspect-ratio.js +33 -0
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +18 -12
- package/dist/components/aspect-ratio/index.d.ts +2 -2
- package/dist/components/badge/badge.a11y.d.ts +13 -9
- package/dist/components/badge/badge.d.ts +8 -3
- package/dist/{badge → components/badge}/badge.js +5 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/badge.types.d.ts +18 -12
- package/dist/components/badge/index.d.ts +3 -3
- package/dist/components/block/block.a11y.d.ts +20 -0
- package/dist/components/block/block.d.ts +9 -0
- package/dist/components/block/block.js +66 -0
- package/dist/components/block/block.js.map +1 -0
- package/dist/components/block/block.types.d.ts +38 -0
- package/dist/components/block/index.d.ts +3 -0
- package/dist/components/box/box.a11y.d.ts +13 -9
- package/dist/components/box/box.d.ts +9 -4
- package/dist/{box → components/box}/box.js +3 -2
- package/dist/components/box/box.js.map +1 -0
- package/dist/components/box/box.types.d.ts +67 -61
- package/dist/components/box/index.d.ts +3 -3
- package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +13 -9
- package/dist/components/breadcrumb/breadcrumb.a11y.js +15 -0
- package/dist/components/breadcrumb/breadcrumb.a11y.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +18 -13
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +64 -58
- package/dist/components/breadcrumb/index.d.ts +3 -3
- package/dist/components/button-group/button-group.d.ts +7 -0
- package/dist/components/button-group/button-group.js +20 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/button-group/button-group.types.d.ts +14 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/card/card.d.ts +13 -7
- package/dist/components/card/card.js +95 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/card/card.types.d.ts +32 -24
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/close/close.d.ts +7 -0
- package/dist/components/close/close.js +22 -0
- package/dist/components/close/close.js.map +1 -0
- package/dist/components/close/close.types.d.ts +10 -0
- package/dist/components/close/index.d.ts +2 -0
- package/dist/components/container/container.a11y.d.ts +19 -15
- package/dist/components/container/container.d.ts +8 -3
- package/dist/{container → components/container}/container.js +3 -3
- package/dist/components/container/container.js.map +1 -0
- package/dist/components/container/container.types.d.ts +26 -26
- package/dist/components/container/index.d.ts +3 -3
- package/dist/components/empty-state/empty-state.d.ts +7 -2
- package/dist/components/empty-state/empty-state.js.map +1 -0
- package/dist/components/empty-state/empty-state.types.d.ts +15 -8
- package/dist/components/empty-state/index.d.ts +2 -2
- package/dist/components/field/field.d.ts +9 -0
- package/dist/components/field/field.js +41 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/field/field.types.d.ts +20 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/flex/flex.a11y.d.ts +21 -17
- package/dist/components/flex/flex.d.ts +9 -4
- package/dist/{flex → components/flex}/flex.js +3 -2
- package/dist/components/flex/flex.js.map +1 -0
- package/dist/components/flex/flex.types.d.ts +38 -37
- package/dist/components/flex/index.d.ts +3 -3
- package/dist/components/header/header.a11y.d.ts +13 -9
- package/dist/components/header/header.a11y.js +12 -0
- package/dist/components/header/header.a11y.js.map +1 -0
- package/dist/components/header/header.d.ts +7 -2
- package/dist/components/header/header.js.map +1 -0
- package/dist/components/header/header.types.d.ts +8 -4
- package/dist/components/inline/index.d.ts +8 -6
- package/dist/components/inline/index.js.map +1 -0
- package/dist/components/input-group/index.d.ts +2 -0
- package/dist/components/input-group/input-group.d.ts +9 -0
- package/dist/components/input-group/input-group.js +39 -0
- package/dist/components/input-group/input-group.js.map +1 -0
- package/dist/components/input-group/input-group.types.d.ts +26 -0
- package/dist/components/list-group/index.d.ts +2 -0
- package/dist/components/list-group/list-group.d.ts +9 -0
- package/dist/components/list-group/list-group.js +43 -0
- package/dist/components/list-group/list-group.js.map +1 -0
- package/dist/components/list-group/list-group.types.d.ts +32 -0
- package/dist/components/nav/index.d.ts +2 -0
- package/dist/components/nav/nav.d.ts +13 -0
- package/dist/components/nav/nav.js +113 -0
- package/dist/components/nav/nav.js.map +1 -0
- package/dist/components/nav/nav.types.d.ts +56 -0
- package/dist/components/navbar/index.d.ts +5 -2
- package/dist/components/navbar/navbar-panel.js +48 -0
- package/dist/components/navbar/navbar-panel.js.map +1 -0
- package/dist/components/navbar/navbar.context.js +13 -0
- package/dist/components/navbar/navbar.context.js.map +1 -0
- package/dist/components/navbar/navbar.d.ts +45 -7
- package/dist/components/navbar/navbar.js +221 -0
- package/dist/components/navbar/navbar.js.map +1 -0
- package/dist/components/navbar/navbar.render.js +26 -0
- package/dist/components/navbar/navbar.render.js.map +1 -0
- package/dist/components/navbar/navbar.shared.js +18 -0
- package/dist/components/navbar/navbar.shared.js.map +1 -0
- package/dist/components/navbar/navbar.types.d.ts +29 -22
- package/dist/components/overlays/dropdown-content.d.ts +8 -0
- package/dist/components/overlays/dropdown-content.js +18 -0
- package/dist/components/overlays/dropdown-content.js.map +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/pagination.d.ts +11 -0
- package/dist/components/pagination/pagination.js +95 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/pagination/pagination.types.d.ts +40 -0
- package/dist/components/section/index.d.ts +3 -3
- package/dist/components/section/section.a11y.d.ts +14 -10
- package/dist/components/section/section.d.ts +8 -3
- package/dist/{section → components/section}/section.js +3 -2
- package/dist/components/section/section.js.map +1 -0
- package/dist/components/section/section.types.d.ts +20 -14
- package/dist/components/separator/index.d.ts +3 -3
- package/dist/components/separator/separator.a11y.d.ts +13 -9
- package/dist/components/separator/separator.a11y.js +15 -0
- package/dist/components/separator/separator.a11y.js.map +1 -0
- package/dist/components/separator/separator.d.ts +8 -3
- package/dist/components/separator/separator.js.map +1 -0
- package/dist/components/separator/separator.types.d.ts +19 -13
- package/dist/components/shell/index.d.ts +3 -0
- package/dist/components/shell/shell-nav.types.d.ts +7 -0
- package/dist/components/shell/shell-panel.js +54 -0
- package/dist/components/shell/shell-panel.js.map +1 -0
- package/dist/components/shell/shell-responsive.js +110 -0
- package/dist/components/shell/shell-responsive.js.map +1 -0
- package/dist/components/shell/shell.a11y.d.ts +23 -0
- package/dist/components/shell/shell.a11y.js +23 -0
- package/dist/components/shell/shell.a11y.js.map +1 -0
- package/dist/components/shell/shell.d.ts +13 -0
- package/dist/components/shell/shell.js +69 -0
- package/dist/components/shell/shell.js.map +1 -0
- package/dist/components/shell/shell.types.d.ts +58 -0
- package/dist/components/sidebar/sidebar-panel.d.ts +7 -0
- package/dist/components/sidebar/sidebar-panel.js +59 -0
- package/dist/components/sidebar/sidebar-panel.js.map +1 -0
- package/dist/components/sidebar/sidebar-toggle.d.ts +7 -0
- package/dist/components/sidebar/sidebar-toggle.js +8 -0
- package/dist/components/sidebar/sidebar-toggle.js.map +1 -0
- package/dist/components/sidebar/sidebar.context.js +21 -0
- package/dist/components/sidebar/sidebar.context.js.map +1 -0
- package/dist/components/sidebar/sidebar.d.ts +7 -0
- package/dist/components/sidebar/sidebar.js +228 -0
- package/dist/components/sidebar/sidebar.js.map +1 -0
- package/dist/components/sidebar/sidebar.shared.js +12 -0
- package/dist/components/sidebar/sidebar.shared.js.map +1 -0
- package/dist/components/sidebar/sidebar.types.d.ts +30 -0
- package/dist/components/skeleton/index.d.ts +3 -3
- package/dist/components/skeleton/skeleton.a11y.d.ts +12 -8
- package/dist/components/skeleton/skeleton.d.ts +8 -3
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/skeleton/skeleton.types.d.ts +16 -10
- package/dist/components/spacer/index.d.ts +3 -3
- package/dist/components/spacer/spacer.a11y.d.ts +16 -12
- package/dist/components/spacer/spacer.d.ts +8 -3
- package/dist/{spacer → components/spacer}/spacer.js +3 -1
- package/dist/components/spacer/spacer.js.map +1 -0
- package/dist/components/spacer/spacer.types.d.ts +23 -21
- package/dist/components/spinner/index.d.ts +2 -2
- package/dist/components/spinner/spinner.d.ts +7 -2
- package/dist/components/spinner/spinner.js.map +1 -0
- package/dist/components/spinner/spinner.types.d.ts +9 -4
- package/dist/components/stack/index.d.ts +3 -3
- package/dist/components/stack/stack.a11y.d.ts +17 -13
- package/dist/components/stack/stack.d.ts +8 -3
- package/dist/components/stack/stack.js.map +1 -0
- package/dist/components/stack/stack.types.d.ts +19 -13
- package/dist/components/theme/index.d.ts +1 -2
- package/dist/components/theme/theme.d.ts +41 -34
- package/dist/{theme → components/theme}/theme.js +33 -4
- package/dist/components/theme/theme.js.map +1 -0
- package/dist/controls.d.ts +10 -0
- package/dist/controls.js +7 -0
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.js +4 -0
- package/dist/layouts.d.ts +25 -0
- package/dist/layouts.js +11 -0
- package/dist/navs.d.ts +15 -0
- package/dist/navs.js +9 -0
- package/dist/overlays.d.ts +3 -0
- package/dist/overlays.js +4 -0
- package/dist/shells.d.ts +16 -0
- package/dist/shells.js +11 -0
- package/dist/surfaces.d.ts +16 -0
- package/dist/surfaces.js +9 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +3 -0
- package/dist/themes/default/index.css +3132 -832
- package/package.json +65 -25
- package/src/components/_internal/box-layout.ts +8 -0
- package/src/components/_internal/jsx.ts +91 -16
- package/src/components/_internal/layout.ts +4 -17
- package/src/components/_internal/merge-props.ts +9 -0
- package/src/components/_internal/pathname.ts +67 -0
- package/src/components/_internal/style.ts +51 -0
- package/src/components/alert/alert.tsx +84 -0
- package/src/components/alert/alert.types.ts +20 -0
- package/src/components/alert/index.ts +2 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +10 -24
- package/src/components/aspect-ratio/aspect-ratio.types.ts +2 -1
- package/src/components/badge/badge.tsx +6 -0
- package/src/components/badge/badge.types.ts +2 -1
- package/src/components/block/block.a11y.ts +17 -0
- package/src/components/block/block.tsx +71 -0
- package/src/components/block/block.types.ts +60 -0
- package/src/components/block/index.ts +11 -0
- package/src/components/box/box.tsx +3 -2
- package/src/components/box/box.types.ts +2 -1
- package/src/components/breadcrumb/breadcrumb.types.ts +2 -1
- package/src/components/button-group/button-group.tsx +32 -0
- package/src/components/button-group/button-group.types.ts +12 -0
- package/src/components/button-group/index.ts +2 -0
- package/src/components/card/card.tsx +72 -43
- package/src/components/card/card.types.ts +6 -1
- package/src/components/card/index.ts +10 -1
- package/src/components/close/close.tsx +19 -0
- package/src/components/close/close.types.ts +7 -0
- package/src/components/close/index.ts +2 -0
- package/src/components/container/container.tsx +4 -4
- package/src/components/container/container.types.ts +2 -1
- package/src/components/empty-state/empty-state.types.ts +3 -0
- package/src/components/field/field.tsx +36 -0
- package/src/components/field/field.types.ts +19 -0
- package/src/components/field/index.ts +2 -0
- package/src/components/flex/flex.tsx +4 -2
- package/src/components/flex/flex.types.ts +2 -1
- package/src/components/input-group/index.ts +7 -0
- package/src/components/input-group/input-group.tsx +57 -0
- package/src/components/input-group/input-group.types.ts +26 -0
- package/src/components/list-group/index.ts +7 -0
- package/src/components/list-group/list-group.tsx +74 -0
- package/src/components/list-group/list-group.types.ts +32 -0
- package/src/components/nav/index.ts +14 -0
- package/src/components/nav/nav.tsx +203 -0
- package/src/components/nav/nav.types.ts +68 -0
- package/src/components/navbar/index.ts +9 -2
- package/src/components/navbar/navbar-panel.tsx +67 -0
- package/src/components/navbar/navbar.context.ts +22 -0
- package/src/components/navbar/navbar.render.tsx +32 -0
- package/src/components/navbar/navbar.shared.ts +21 -0
- package/src/components/navbar/navbar.tsx +262 -53
- package/src/components/navbar/navbar.types.ts +36 -22
- package/src/components/overlays/dropdown-content.tsx +28 -0
- package/src/components/pagination/index.ts +8 -0
- package/src/components/pagination/pagination.tsx +158 -0
- package/src/components/pagination/pagination.types.ts +41 -0
- package/src/components/section/section.tsx +3 -2
- package/src/components/section/section.types.ts +2 -1
- package/src/components/separator/separator.types.ts +2 -1
- package/src/components/shell/index.ts +16 -0
- package/src/components/shell/shell-nav.types.ts +3 -0
- package/src/components/shell/shell-panel.tsx +85 -0
- package/src/components/shell/shell-responsive.tsx +212 -0
- package/src/components/shell/shell.a11y.ts +20 -0
- package/src/components/shell/shell.tsx +74 -0
- package/src/components/shell/shell.types.ts +71 -0
- package/src/components/sidebar/index.ts +5 -0
- package/src/components/sidebar/sidebar-panel.tsx +76 -0
- package/src/components/sidebar/sidebar-toggle.tsx +5 -0
- package/src/components/sidebar/sidebar.context.ts +40 -0
- package/src/components/sidebar/sidebar.shared.ts +12 -0
- package/src/components/sidebar/sidebar.tsx +355 -0
- package/src/components/sidebar/sidebar.types.ts +35 -0
- package/src/components/skeleton/skeleton.types.ts +2 -1
- package/src/components/spacer/spacer.tsx +4 -1
- package/src/components/spacer/spacer.types.ts +3 -2
- package/src/components/stack/stack.types.ts +2 -1
- package/src/components/theme/index.ts +10 -1
- package/src/components/theme/theme.tsx +15 -4
- package/src/controls.ts +18 -0
- package/src/feedback.ts +6 -0
- package/src/layouts.ts +19 -0
- package/src/navs.ts +26 -0
- package/src/overlays.ts +90 -0
- package/src/shells.ts +13 -0
- package/src/surfaces.ts +23 -0
- package/src/theme.ts +21 -0
- package/src/themes/default/index.css +13 -3
- package/src/themes/default/styles/actions/button-group.css +74 -0
- package/src/themes/default/styles/actions/button.css +48 -8
- package/src/themes/default/styles/actions/toggle-group.css +19 -12
- package/src/themes/default/styles/actions/toggle.css +16 -10
- package/src/themes/default/styles/base/icon.css +2 -0
- package/src/themes/default/styles/base/reset.css +28 -0
- package/src/themes/default/styles/base/typography.css +37 -17
- package/src/themes/default/styles/base/utilities.css +56 -39
- package/src/themes/default/styles/disclosure/accordion.css +22 -14
- package/src/themes/default/styles/disclosure/collapsible.css +22 -11
- package/src/themes/default/styles/display/alert.css +109 -0
- package/src/themes/default/styles/display/avatar.css +9 -4
- package/src/themes/default/styles/display/badge.css +12 -3
- package/src/themes/default/styles/display/card.css +16 -4
- package/src/themes/default/styles/display/coverage.css +2 -14
- package/src/themes/default/styles/display/list-group.css +84 -0
- package/src/themes/default/styles/display/progress-circle.css +3 -2
- package/src/themes/default/styles/display/progress.css +8 -5
- package/src/themes/default/styles/display/scroll-area.css +15 -0
- package/src/themes/default/styles/display/separator.css +4 -4
- package/src/themes/default/styles/display/skeleton.css +25 -2
- package/src/themes/default/styles/display/spinner.css +1 -1
- package/src/themes/default/styles/display/table.css +7 -4
- package/src/themes/default/styles/display/virtual-list.css +29 -0
- package/src/themes/default/styles/display/virtual-table.css +68 -0
- package/src/themes/default/styles/forms/checkbox.css +2 -1
- package/src/themes/default/styles/forms/field.css +22 -0
- package/src/themes/default/styles/forms/form.css +1 -1
- package/src/themes/default/styles/forms/input-group.css +202 -0
- package/src/themes/default/styles/forms/input.css +22 -6
- package/src/themes/default/styles/forms/label.css +2 -0
- package/src/themes/default/styles/forms/radio-group.css +22 -13
- package/src/themes/default/styles/forms/select.css +71 -26
- package/src/themes/default/styles/forms/slider.css +32 -16
- package/src/themes/default/styles/forms/switch.css +2 -1
- package/src/themes/default/styles/forms/textarea.css +35 -6
- package/src/themes/default/styles/layout/aspect-ratio.css +3 -1
- package/src/themes/default/styles/layout/block.css +23 -0
- package/src/themes/default/styles/layout/patterns.css +155 -3
- package/src/themes/default/styles/layout/responsive-layout.css +140 -121
- package/src/themes/default/styles/navigation/breadcrumb.css +7 -1
- package/src/themes/default/styles/navigation/menu.css +150 -7
- package/src/themes/default/styles/navigation/menubar.css +194 -28
- package/src/themes/default/styles/navigation/nav.css +231 -0
- package/src/themes/default/styles/navigation/pagination.css +91 -0
- package/src/themes/default/styles/overlays/alert-dialog.css +1 -1
- package/src/themes/default/styles/overlays/dialog.css +42 -10
- package/src/themes/default/styles/overlays/dropdown.css +160 -0
- package/src/themes/default/styles/overlays/hover-card.css +28 -3
- package/src/themes/default/styles/overlays/popover.css +50 -6
- package/src/themes/default/styles/overlays/toast.css +66 -17
- package/src/themes/default/styles/overlays/tooltip.css +45 -18
- package/src/themes/default/styles/shell/header.css +18 -3
- package/src/themes/default/styles/shell/navbar.css +434 -73
- package/src/themes/default/styles/shell/sidebar.css +809 -0
- package/src/themes/default/styles/shell/theme.css +7 -5
- package/src/themes/default/tokens.css +186 -123
- package/src/themes/presets/calico.css +46 -0
- package/src/themes/presets/ginger.css +46 -0
- package/src/themes/presets/index.css +5 -0
- package/src/themes/presets/tabby.css +46 -0
- package/src/themes/presets/torty.css +49 -0
- package/src/themes/presets/tuxedo.css +49 -0
- package/templates/theme/index.css +14 -4
- package/templates/theme/styles/actions/button-group.css +74 -0
- package/templates/theme/styles/actions/button.css +48 -8
- package/templates/theme/styles/actions/toggle-group.css +19 -12
- package/templates/theme/styles/actions/toggle.css +16 -10
- package/templates/theme/styles/base/icon.css +2 -0
- package/templates/theme/styles/base/reset.css +28 -0
- package/templates/theme/styles/base/typography.css +37 -17
- package/templates/theme/styles/disclosure/accordion.css +22 -14
- package/templates/theme/styles/disclosure/collapsible.css +22 -11
- package/templates/theme/styles/display/alert.css +109 -0
- package/templates/theme/styles/display/avatar.css +9 -4
- package/templates/theme/styles/display/badge.css +12 -3
- package/templates/theme/styles/display/card.css +16 -4
- package/templates/theme/styles/display/coverage.css +105 -15
- package/templates/theme/styles/display/list-group.css +84 -0
- package/templates/theme/styles/display/progress-circle.css +3 -2
- package/templates/theme/styles/display/progress.css +8 -5
- package/templates/theme/styles/display/scroll-area.css +15 -0
- package/templates/theme/styles/display/separator.css +4 -4
- package/templates/theme/styles/display/skeleton.css +25 -2
- package/templates/theme/styles/display/spinner.css +1 -1
- package/templates/theme/styles/display/table.css +7 -4
- package/templates/theme/styles/display/virtual-list.css +29 -0
- package/templates/theme/styles/display/virtual-table.css +68 -0
- package/templates/theme/styles/forms/checkbox.css +2 -1
- package/templates/theme/styles/forms/field.css +22 -0
- package/templates/theme/styles/forms/form.css +1 -1
- package/templates/theme/styles/forms/input-group.css +202 -0
- package/templates/theme/styles/forms/input.css +22 -6
- package/templates/theme/styles/forms/label.css +2 -0
- package/templates/theme/styles/forms/radio-group.css +22 -13
- package/templates/theme/styles/forms/select.css +71 -26
- package/templates/theme/styles/forms/slider.css +32 -16
- package/templates/theme/styles/forms/switch.css +2 -1
- package/templates/theme/styles/forms/textarea.css +35 -6
- package/templates/theme/styles/layout/aspect-ratio.css +3 -1
- package/templates/theme/styles/layout/block.css +23 -0
- package/templates/theme/styles/layout/patterns.css +155 -3
- package/templates/theme/styles/layout/responsive-layout.css +140 -121
- package/templates/theme/styles/navigation/breadcrumb.css +22 -8
- package/templates/theme/styles/navigation/menu.css +150 -7
- package/templates/theme/styles/navigation/menubar.css +194 -28
- package/templates/theme/styles/navigation/nav.css +231 -0
- package/templates/theme/styles/navigation/pagination.css +91 -0
- package/templates/theme/styles/overlays/alert-dialog.css +1 -1
- package/templates/theme/styles/overlays/dialog.css +42 -10
- package/templates/theme/styles/overlays/dropdown.css +160 -0
- package/templates/theme/styles/overlays/hover-card.css +28 -3
- package/templates/theme/styles/overlays/popover.css +50 -6
- package/templates/theme/styles/overlays/toast.css +66 -17
- package/templates/theme/styles/overlays/tooltip.css +45 -18
- package/templates/theme/styles/shell/header.css +18 -3
- package/templates/theme/styles/shell/navbar.css +434 -73
- package/templates/theme/styles/shell/sidebar.css +809 -0
- package/templates/theme/styles/shell/theme.css +7 -5
- package/templates/theme/tokens.css +186 -123
- package/dist/_internal/box-layout.js.map +0 -1
- package/dist/_internal/classes.js.map +0 -1
- package/dist/_internal/jsx.js.map +0 -1
- package/dist/_internal/layout.d.ts +0 -9
- package/dist/_internal/layout.js.map +0 -1
- package/dist/_internal/merge-props.js.map +0 -1
- package/dist/accessible-icon/accessible-icon.d.ts +0 -7
- package/dist/accessible-icon/accessible-icon.js +0 -20
- package/dist/accessible-icon/accessible-icon.js.map +0 -1
- package/dist/accessible-icon/accessible-icon.types.d.ts +0 -9
- package/dist/aspect-ratio/aspect-ratio.d.ts +0 -8
- package/dist/aspect-ratio/aspect-ratio.js +0 -36
- package/dist/aspect-ratio/aspect-ratio.js.map +0 -1
- package/dist/aspect-ratio/aspect-ratio.types.d.ts +0 -20
- package/dist/aspect-ratio/index.d.ts +0 -2
- package/dist/badge/badge.d.ts +0 -8
- package/dist/badge/badge.js.map +0 -1
- package/dist/badge/badge.types.d.ts +0 -20
- package/dist/badge/index.d.ts +0 -2
- package/dist/box/box.d.ts +0 -9
- package/dist/box/box.js.map +0 -1
- package/dist/box/box.types.d.ts +0 -71
- package/dist/box/index.d.ts +0 -2
- package/dist/breadcrumb/breadcrumb.d.ts +0 -18
- package/dist/breadcrumb/breadcrumb.js.map +0 -1
- package/dist/breadcrumb/breadcrumb.types.d.ts +0 -64
- package/dist/breadcrumb/index.d.ts +0 -2
- package/dist/card/card.d.ts +0 -12
- package/dist/card/card.js +0 -68
- package/dist/card/card.js.map +0 -1
- package/dist/card/card.types.d.ts +0 -37
- package/dist/card/index.d.ts +0 -2
- package/dist/components/_internal/box-layout.d.ts +0 -7
- package/dist/components/_internal/classes.d.ts +0 -1
- package/dist/components/_internal/jsx.d.ts +0 -8
- package/dist/components/_internal/merge-props.d.ts +0 -1
- package/dist/components/_internal/style.d.ts +0 -1
- package/dist/components/accessible-icon/accessible-icon.d.ts +0 -2
- package/dist/components/accessible-icon/accessible-icon.types.d.ts +0 -5
- package/dist/components/accessible-icon/index.d.ts +0 -2
- package/dist/components/grid/grid.a11y.d.ts +0 -21
- package/dist/components/grid/grid.d.ts +0 -4
- package/dist/components/grid/grid.types.d.ts +0 -37
- package/dist/components/grid/index.d.ts +0 -3
- package/dist/components/header/index.d.ts +0 -3
- package/dist/components/index.d.ts +0 -49
- package/dist/components/index.js +0 -28
- package/dist/components/logos/create-logo.d.ts +0 -5
- package/dist/components/logos/github-logo.d.ts +0 -4
- package/dist/components/logos/google-logo.d.ts +0 -4
- package/dist/components/logos/index.d.ts +0 -5
- package/dist/components/logos/microsoft-logo.d.ts +0 -4
- package/dist/components/logos/types.d.ts +0 -14
- package/dist/components/sidebar-layout/index.d.ts +0 -3
- package/dist/components/sidebar-layout/sidebar-layout.a11y.d.ts +0 -15
- package/dist/components/sidebar-layout/sidebar-layout.d.ts +0 -2
- package/dist/components/sidebar-layout/sidebar-layout.types.d.ts +0 -20
- package/dist/components/topbar-layout/index.d.ts +0 -3
- package/dist/components/topbar-layout/topbar-layout.a11y.d.ts +0 -13
- package/dist/components/topbar-layout/topbar-layout.d.ts +0 -2
- package/dist/components/topbar-layout/topbar-layout.types.d.ts +0 -12
- package/dist/container/container.d.ts +0 -8
- package/dist/container/container.js.map +0 -1
- package/dist/container/container.types.d.ts +0 -28
- package/dist/container/index.d.ts +0 -2
- package/dist/empty-state/empty-state.d.ts +0 -7
- package/dist/empty-state/empty-state.js.map +0 -1
- package/dist/empty-state/empty-state.types.d.ts +0 -13
- package/dist/flex/flex.d.ts +0 -9
- package/dist/flex/flex.js.map +0 -1
- package/dist/flex/flex.types.d.ts +0 -41
- package/dist/flex/index.d.ts +0 -2
- package/dist/grid/grid.d.ts +0 -9
- package/dist/grid/grid.js +0 -115
- package/dist/grid/grid.js.map +0 -1
- package/dist/grid/grid.types.d.ts +0 -40
- package/dist/grid/index.d.ts +0 -2
- package/dist/header/header.d.ts +0 -7
- package/dist/header/header.js.map +0 -1
- package/dist/header/header.types.d.ts +0 -9
- package/dist/inline/index.d.ts +0 -7
- package/dist/inline/index.js.map +0 -1
- package/dist/logos/create-logo.d.ts +0 -1
- package/dist/logos/create-logo.js +0 -75
- package/dist/logos/create-logo.js.map +0 -1
- package/dist/logos/github-logo.d.ts +0 -18
- package/dist/logos/github-logo.js +0 -9
- package/dist/logos/github-logo.js.map +0 -1
- package/dist/logos/google-logo.d.ts +0 -18
- package/dist/logos/google-logo.js +0 -23
- package/dist/logos/google-logo.js.map +0 -1
- package/dist/logos/index.d.ts +0 -4
- package/dist/logos/microsoft-logo.d.ts +0 -18
- package/dist/logos/microsoft-logo.js +0 -35
- package/dist/logos/microsoft-logo.js.map +0 -1
- package/dist/logos/types.d.ts +0 -16
- package/dist/navbar/index.d.ts +0 -2
- package/dist/navbar/navbar.d.ts +0 -12
- package/dist/navbar/navbar.js +0 -73
- package/dist/navbar/navbar.js.map +0 -1
- package/dist/navbar/navbar.types.d.ts +0 -31
- package/dist/section/index.d.ts +0 -2
- package/dist/section/section.d.ts +0 -8
- package/dist/section/section.js.map +0 -1
- package/dist/section/section.types.d.ts +0 -22
- package/dist/separator/index.d.ts +0 -2
- package/dist/separator/separator.d.ts +0 -8
- package/dist/separator/separator.js.map +0 -1
- package/dist/separator/separator.types.d.ts +0 -21
- package/dist/sidebar-layout/index.d.ts +0 -2
- package/dist/sidebar-layout/sidebar-layout.d.ts +0 -7
- package/dist/sidebar-layout/sidebar-layout.js +0 -51
- package/dist/sidebar-layout/sidebar-layout.js.map +0 -1
- package/dist/sidebar-layout/sidebar-layout.types.d.ts +0 -20
- package/dist/skeleton/index.d.ts +0 -2
- package/dist/skeleton/skeleton.d.ts +0 -8
- package/dist/skeleton/skeleton.js.map +0 -1
- package/dist/skeleton/skeleton.types.d.ts +0 -18
- package/dist/spacer/index.d.ts +0 -2
- package/dist/spacer/spacer.d.ts +0 -8
- package/dist/spacer/spacer.js.map +0 -1
- package/dist/spacer/spacer.types.d.ts +0 -25
- package/dist/spinner/index.d.ts +0 -2
- package/dist/spinner/spinner.d.ts +0 -7
- package/dist/spinner/spinner.js.map +0 -1
- package/dist/spinner/spinner.types.d.ts +0 -10
- package/dist/stack/index.d.ts +0 -2
- package/dist/stack/stack.d.ts +0 -8
- package/dist/stack/stack.js.map +0 -1
- package/dist/stack/stack.types.d.ts +0 -21
- package/dist/theme/index.d.ts +0 -1
- package/dist/theme/theme.d.ts +0 -44
- package/dist/theme/theme.js.map +0 -1
- package/dist/topbar-layout/index.d.ts +0 -2
- package/dist/topbar-layout/topbar-layout.d.ts +0 -7
- package/dist/topbar-layout/topbar-layout.js +0 -37
- package/dist/topbar-layout/topbar-layout.js.map +0 -1
- package/dist/topbar-layout/topbar-layout.types.d.ts +0 -13
- package/src/askr-compat.d.ts +0 -110
- package/src/askr-router.d.ts +0 -16
- package/src/components/accessible-icon/accessible-icon.tsx +0 -18
- package/src/components/accessible-icon/accessible-icon.types.ts +0 -5
- package/src/components/accessible-icon/index.ts +0 -2
- package/src/components/grid/grid.a11y.ts +0 -22
- package/src/components/grid/grid.tsx +0 -172
- package/src/components/grid/grid.types.ts +0 -45
- package/src/components/grid/index.ts +0 -10
- package/src/components/index.ts +0 -108
- package/src/components/logos/create-logo.tsx +0 -103
- package/src/components/logos/github-logo.tsx +0 -13
- package/src/components/logos/google-logo.tsx +0 -34
- package/src/components/logos/index.ts +0 -5
- package/src/components/logos/microsoft-logo.tsx +0 -10
- package/src/components/logos/types.ts +0 -24
- package/src/components/sidebar-layout/index.ts +0 -6
- package/src/components/sidebar-layout/sidebar-layout.a11y.ts +0 -16
- package/src/components/sidebar-layout/sidebar-layout.tsx +0 -59
- package/src/components/sidebar-layout/sidebar-layout.types.ts +0 -22
- package/src/components/topbar-layout/index.ts +0 -3
- package/src/components/topbar-layout/topbar-layout.a11y.ts +0 -14
- package/src/components/topbar-layout/topbar-layout.tsx +0 -39
- package/src/components/topbar-layout/topbar-layout.types.ts +0 -13
- package/src/themes/default/styles/layout/dashboard-layout.css +0 -15
- package/src/themes/default/styles/layout/docs-layout.css +0 -10
- package/src/themes/default/styles/layout/sidebar.css +0 -10
- package/src/themes/default/styles/navigation/navigation-menu.css +0 -90
- package/src/themes/default/styles/navigation/tabs.css +0 -61
- package/src/themes/default/styles/overlays/dropdown-menu.css +0 -109
- package/templates/theme/styles/layout/dashboard-layout.css +0 -16
- package/templates/theme/styles/layout/docs-layout.css +0 -11
- package/templates/theme/styles/layout/sidebar.css +0 -11
- package/templates/theme/styles/navigation/navigation-menu.css +0 -90
- package/templates/theme/styles/navigation/tabs.css +0 -61
- package/templates/theme/styles/overlays/dropdown-menu.css +0 -109
- /package/dist/{_internal → components/_internal}/classes.js +0 -0
- /package/dist/{_internal → components/_internal}/jsx.js +0 -0
- /package/dist/{breadcrumb → components/breadcrumb}/breadcrumb.js +0 -0
- /package/dist/{empty-state → components/empty-state}/empty-state.js +0 -0
- /package/dist/{header → components/header}/header.js +0 -0
- /package/dist/{inline → components/inline}/index.js +0 -0
- /package/dist/{separator → components/separator}/separator.js +0 -0
- /package/dist/{skeleton → components/skeleton}/skeleton.js +0 -0
- /package/dist/{spinner → components/spinner}/spinner.js +0 -0
- /package/dist/{stack → components/stack}/stack.js +0 -0
|
@@ -1,31 +1,230 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Slot } from "@askrjs/askr/foundations";
|
|
3
|
-
import { mergeProps } from "../_internal/merge-props";
|
|
4
|
-
import type {
|
|
5
|
-
NavBrandProps,
|
|
6
|
-
NavGroupProps,
|
|
7
|
-
NavItemAsChildProps,
|
|
8
|
-
NavItemProps,
|
|
9
|
-
NavItemVariant,
|
|
10
|
-
NavLinkProps,
|
|
11
|
-
NavbarProps,
|
|
12
|
-
} from "./navbar.types";
|
|
1
|
+
import { state } from "@askrjs/askr";
|
|
13
2
|
import { classes } from "../_internal/classes";
|
|
3
|
+
import { isJsxElement, toChildArray } from "../_internal/jsx";
|
|
4
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
5
|
+
import {
|
|
6
|
+
renderKeyedShellChildren,
|
|
7
|
+
ShellPanelWatcher,
|
|
8
|
+
ShellResponsiveWatcher,
|
|
9
|
+
} from "../shell/shell-responsive";
|
|
10
|
+
import { renderNavbarCollapseContents } from "./navbar.render";
|
|
11
|
+
import { NavbarPanel } from "./navbar-panel";
|
|
12
|
+
import { NavbarResponsiveContext } from "./navbar.context";
|
|
13
|
+
import { isNavbarCollapsed, resolveNavGroupAlign } from "./navbar.shared";
|
|
14
|
+
import type { NavBrandProps, NavGroupProps, NavToggleProps, NavbarProps } from "./navbar.types";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Extracts the first NavBrand child to display in the mobile panel.
|
|
18
|
+
* NavBrand should be the first child of Navbar for it to appear in the mobile menu.
|
|
19
|
+
*/
|
|
20
|
+
function findNavbarBrand(children: unknown): unknown {
|
|
21
|
+
return toChildArray(children).find((child) => isJsxElement(child) && child.type === NavBrand);
|
|
17
22
|
}
|
|
18
23
|
|
|
24
|
+
function withoutNavbarBrand(children: unknown): unknown[] {
|
|
25
|
+
return toChildArray(children).filter(
|
|
26
|
+
(child) => !(isJsxElement(child) && child.type === NavBrand),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Responsive mobile-first navbar component.
|
|
32
|
+
*
|
|
33
|
+
* Composition: Navbar should contain NavBrand (extracted to mobile panel), NavGroup items with optional align,
|
|
34
|
+
* and NavLink children. Brand must be first child to appear in mobile menu.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <Navbar breakpoint="md" aria-label="Main navigation">
|
|
38
|
+
* <NavBrand><a href="/">Logo</a></NavBrand>
|
|
39
|
+
* <NavGroup align="center">
|
|
40
|
+
* <NavLink href="/docs">Docs</NavLink>
|
|
41
|
+
* </NavGroup>
|
|
42
|
+
* <NavGroup align="end">
|
|
43
|
+
* <NavLink href="/settings">Settings</NavLink>
|
|
44
|
+
* </NavGroup>
|
|
45
|
+
* </Navbar>
|
|
46
|
+
*/
|
|
19
47
|
export function Navbar(props: NavbarProps): JSX.Element {
|
|
20
|
-
const {
|
|
48
|
+
const {
|
|
49
|
+
children,
|
|
50
|
+
breakpoint,
|
|
51
|
+
collapseIcon,
|
|
52
|
+
collapseIconPlacement = "start",
|
|
53
|
+
collapseLabel,
|
|
54
|
+
ref,
|
|
55
|
+
class: className,
|
|
56
|
+
id,
|
|
57
|
+
"aria-label": ariaLabel,
|
|
58
|
+
...rest
|
|
59
|
+
} = props;
|
|
60
|
+
const effectiveCollapseLabel = collapseLabel ?? "Menu";
|
|
61
|
+
const responsiveChildren = toChildArray(children);
|
|
62
|
+
const desktopChildren = renderKeyedShellChildren(responsiveChildren, "navbar-desktop");
|
|
63
|
+
const panelChildren = renderKeyedShellChildren(
|
|
64
|
+
withoutNavbarBrand(responsiveChildren),
|
|
65
|
+
"navbar-panel",
|
|
66
|
+
);
|
|
67
|
+
// Extract brand to display in mobile panel header
|
|
68
|
+
const responsiveCollapsedState =
|
|
69
|
+
breakpoint !== undefined ? state(isNavbarCollapsed(breakpoint)) : undefined;
|
|
70
|
+
const mobileMenuState = state(false);
|
|
71
|
+
const mobileMenuOpen = mobileMenuState();
|
|
72
|
+
const panelId = typeof id === "string" ? `${id}-panel` : undefined;
|
|
73
|
+
const responsiveCollapsed = breakpoint !== undefined ? responsiveCollapsedState?.() : false;
|
|
74
|
+
const panelOpen = Boolean(responsiveCollapsed && mobileMenuOpen);
|
|
75
|
+
const closePanel = () => mobileMenuState.set(false);
|
|
76
|
+
const closePanelOnNavActivation = (event: MouseEvent) => {
|
|
77
|
+
const target = event.target;
|
|
78
|
+
|
|
79
|
+
if (!(target instanceof Element)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (target.closest('a[data-slot="nav-link"], a[data-slot="nav-item"], a.navbar-item')) {
|
|
84
|
+
closePanel();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const togglePanel = () => {
|
|
88
|
+
mobileMenuState.set(!mobileMenuState());
|
|
89
|
+
};
|
|
90
|
+
const contextValue = {
|
|
91
|
+
active: () => breakpoint !== undefined,
|
|
92
|
+
collapseLabel: () => effectiveCollapseLabel,
|
|
93
|
+
closePanel,
|
|
94
|
+
panelId: () => panelId,
|
|
95
|
+
panelOpen: () => Boolean(responsiveCollapsedState?.() && mobileMenuOpen),
|
|
96
|
+
togglePanel,
|
|
97
|
+
};
|
|
98
|
+
const panelBrand = findNavbarBrand(responsiveChildren);
|
|
99
|
+
const finalProps = mergeProps(rest, {
|
|
100
|
+
"aria-label": ariaLabel,
|
|
101
|
+
ref,
|
|
102
|
+
class: classes("navbar", className),
|
|
103
|
+
"data-collapse-below": breakpoint,
|
|
104
|
+
"data-responsive-collapsed": responsiveCollapsed ? "true" : "false",
|
|
105
|
+
"data-slot": "navbar",
|
|
106
|
+
});
|
|
21
107
|
|
|
22
108
|
return (
|
|
23
|
-
<
|
|
24
|
-
{
|
|
25
|
-
|
|
109
|
+
<NavbarResponsiveContext.Scope value={contextValue}>
|
|
110
|
+
<nav {...finalProps}>
|
|
111
|
+
{breakpoint !== undefined ? (
|
|
112
|
+
<div class="navbar-mobile" data-slot="navbar-mobile">
|
|
113
|
+
<NavToggle
|
|
114
|
+
active={breakpoint !== undefined}
|
|
115
|
+
aria-controls={panelId}
|
|
116
|
+
aria-label={effectiveCollapseLabel}
|
|
117
|
+
icon={collapseIcon}
|
|
118
|
+
iconPlacement={collapseIconPlacement}
|
|
119
|
+
label={effectiveCollapseLabel}
|
|
120
|
+
onToggle={togglePanel}
|
|
121
|
+
open={panelOpen}
|
|
122
|
+
panelId={panelId}
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
) : null}
|
|
126
|
+
|
|
127
|
+
<div class="navbar-shell" data-slot="navbar-shell">
|
|
128
|
+
{desktopChildren}
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{breakpoint !== undefined ? (
|
|
132
|
+
<NavbarPanel
|
|
133
|
+
active={breakpoint !== undefined}
|
|
134
|
+
brand={panelBrand}
|
|
135
|
+
collapseLabel={effectiveCollapseLabel}
|
|
136
|
+
onClose={closePanel}
|
|
137
|
+
onClick={closePanelOnNavActivation}
|
|
138
|
+
open={panelOpen}
|
|
139
|
+
panelId={panelId}
|
|
140
|
+
>
|
|
141
|
+
{panelChildren}
|
|
142
|
+
</NavbarPanel>
|
|
143
|
+
) : null}
|
|
144
|
+
|
|
145
|
+
{responsiveCollapsed && mobileMenuOpen ? (
|
|
146
|
+
<button
|
|
147
|
+
aria-label={`Close ${effectiveCollapseLabel}`}
|
|
148
|
+
class="navbar-backdrop"
|
|
149
|
+
data-slot="navbar-backdrop"
|
|
150
|
+
data-state="open"
|
|
151
|
+
tabIndex={-1}
|
|
152
|
+
type="button"
|
|
153
|
+
onClick={closePanel}
|
|
154
|
+
/>
|
|
155
|
+
) : null}
|
|
156
|
+
|
|
157
|
+
{breakpoint !== undefined ? (
|
|
158
|
+
<ShellResponsiveWatcher
|
|
159
|
+
breakpoint={breakpoint}
|
|
160
|
+
isCollapsed={isNavbarCollapsed}
|
|
161
|
+
onResize={(nextCollapsed) => {
|
|
162
|
+
responsiveCollapsedState?.set(nextCollapsed);
|
|
163
|
+
}}
|
|
164
|
+
onExpand={() => {
|
|
165
|
+
mobileMenuState?.set(false);
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
) : null}
|
|
169
|
+
|
|
170
|
+
<ShellPanelWatcher
|
|
171
|
+
contentId={panelId}
|
|
172
|
+
open={panelOpen}
|
|
173
|
+
panelSlot="navbar-panel"
|
|
174
|
+
onClose={closePanel}
|
|
175
|
+
/>
|
|
176
|
+
</nav>
|
|
177
|
+
</NavbarResponsiveContext.Scope>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Menu toggle button for responsive navbar collapse.
|
|
183
|
+
* Auto-renders when navbar is responsive (collapseBelow set).
|
|
184
|
+
*/
|
|
185
|
+
export function NavToggle(props: NavToggleProps): JSX.Element | null {
|
|
186
|
+
const {
|
|
187
|
+
children,
|
|
188
|
+
class: className,
|
|
189
|
+
active,
|
|
190
|
+
icon,
|
|
191
|
+
iconPlacement = "start",
|
|
192
|
+
label = "Menu",
|
|
193
|
+
ref,
|
|
194
|
+
onToggle,
|
|
195
|
+
open,
|
|
196
|
+
panelId,
|
|
197
|
+
...rest
|
|
198
|
+
} = props;
|
|
199
|
+
|
|
200
|
+
if (active === false) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const isOpen = open === true;
|
|
205
|
+
|
|
206
|
+
const finalProps = mergeProps(rest, {
|
|
207
|
+
ref,
|
|
208
|
+
class: classes("navbar-toggle", className),
|
|
209
|
+
"aria-controls": panelId,
|
|
210
|
+
"aria-expanded": isOpen ? "true" : "false",
|
|
211
|
+
"aria-label": label,
|
|
212
|
+
"data-slot": "navbar-toggle",
|
|
213
|
+
"data-state": isOpen ? "open" : "closed",
|
|
214
|
+
type: "button",
|
|
215
|
+
onClick: () => onToggle?.(),
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<button {...finalProps}>
|
|
220
|
+
{children ?? renderNavbarCollapseContents(label, icon, iconPlacement)}
|
|
221
|
+
</button>
|
|
26
222
|
);
|
|
27
223
|
}
|
|
28
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Brand/logo container displayed in navbar and mobile panel header.
|
|
227
|
+
*/
|
|
29
228
|
export function NavBrand(props: NavBrandProps): JSX.Element {
|
|
30
229
|
const { children, ref, class: className, ...rest } = props;
|
|
31
230
|
|
|
@@ -36,44 +235,54 @@ export function NavBrand(props: NavBrandProps): JSX.Element {
|
|
|
36
235
|
);
|
|
37
236
|
}
|
|
38
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Navigation group for organizing related nav items.
|
|
240
|
+
*
|
|
241
|
+
* @param align - Alignment: "start" (default), "center", or "end". Using align="end" automatically right-aligns the group.
|
|
242
|
+
* @param label - Optional accessible label for grouped items.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* <NavGroup align="center">
|
|
246
|
+
* <NavLink href="/docs">Docs</NavLink>
|
|
247
|
+
* </NavGroup>
|
|
248
|
+
*/
|
|
39
249
|
export function NavGroup(props: NavGroupProps): JSX.Element {
|
|
40
|
-
const { children, ref, class: className, ...rest } = props;
|
|
250
|
+
const { children, id, ref, class: className, label, ...rest } = props;
|
|
251
|
+
const rawAlign = (rest as Record<string, unknown>)["data-align"];
|
|
252
|
+
const align =
|
|
253
|
+
props.align ??
|
|
254
|
+
(rawAlign === "start" || rawAlign === "center" || rawAlign === "end"
|
|
255
|
+
? (rawAlign as NavGroupProps["align"])
|
|
256
|
+
: undefined);
|
|
257
|
+
const hasLabel = label !== undefined && label !== null;
|
|
258
|
+
const labelId = hasLabel && id ? `${id}-label` : undefined;
|
|
259
|
+
const accessibleLabel = typeof label === "string" ? label : undefined;
|
|
41
260
|
|
|
42
261
|
return (
|
|
43
|
-
<div
|
|
44
|
-
{
|
|
262
|
+
<div
|
|
263
|
+
{...rest}
|
|
264
|
+
id={id}
|
|
265
|
+
ref={ref}
|
|
266
|
+
class={classes("navbar-group", className)}
|
|
267
|
+
aria-label={labelId ? undefined : accessibleLabel}
|
|
268
|
+
aria-labelledby={labelId}
|
|
269
|
+
role={hasLabel ? "group" : rest.role}
|
|
270
|
+
data-align={resolveNavGroupAlign(align)}
|
|
271
|
+
data-has-label={hasLabel ? "true" : undefined}
|
|
272
|
+
data-slot="navbar-group"
|
|
273
|
+
>
|
|
274
|
+
{hasLabel ? (
|
|
275
|
+
<>
|
|
276
|
+
<div id={labelId} class="navbar-group-label" data-slot="navbar-group-label">
|
|
277
|
+
{label}
|
|
278
|
+
</div>
|
|
279
|
+
<div class="navbar-group-body" data-slot="navbar-group-body">
|
|
280
|
+
{children}
|
|
281
|
+
</div>
|
|
282
|
+
</>
|
|
283
|
+
) : (
|
|
284
|
+
children
|
|
285
|
+
)}
|
|
45
286
|
</div>
|
|
46
287
|
);
|
|
47
288
|
}
|
|
48
|
-
|
|
49
|
-
export function NavItem(props: NavItemProps): JSX.Element;
|
|
50
|
-
export function NavItem(props: NavItemAsChildProps): JSX.Element;
|
|
51
|
-
export function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element {
|
|
52
|
-
const { asChild, children, ref, class: className, variant = "default", ...rest } = props;
|
|
53
|
-
|
|
54
|
-
const finalProps = mergeProps(rest, {
|
|
55
|
-
ref,
|
|
56
|
-
class: navItemClasses(variant, className),
|
|
57
|
-
"data-slot": "nav-item",
|
|
58
|
-
"data-variant": variant,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (asChild) {
|
|
62
|
-
return <Slot asChild {...finalProps} children={children} />;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return <a {...finalProps}>{children}</a>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function NavLink(props: NavLinkProps): JSX.Element {
|
|
69
|
-
const { children, ref, class: className, variant = "default", ...rest } = props;
|
|
70
|
-
|
|
71
|
-
const finalProps = mergeProps(rest, {
|
|
72
|
-
ref,
|
|
73
|
-
class: navItemClasses(variant, className),
|
|
74
|
-
"data-slot": "nav-link",
|
|
75
|
-
"data-variant": variant,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return <Link {...finalProps}>{children}</Link>;
|
|
79
|
-
}
|
|
@@ -1,36 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type {
|
|
2
|
+
NavItemAsChildProps,
|
|
3
|
+
NavItemProps,
|
|
4
|
+
NavItemVariant,
|
|
5
|
+
NavLinkProps,
|
|
6
|
+
} from "../nav/nav.types";
|
|
7
|
+
import type { CollapseBreakpoint, CollapseIconPlacement } from "../shell/shell-nav.types";
|
|
8
|
+
|
|
9
|
+
export type NavGroupAlign = "start" | "center" | "end";
|
|
3
10
|
|
|
4
11
|
export type NavbarProps = Omit<JSX.IntrinsicElements["nav"], "children"> & {
|
|
5
12
|
children?: unknown;
|
|
13
|
+
breakpoint?: CollapseBreakpoint;
|
|
14
|
+
collapseIcon?: unknown;
|
|
15
|
+
collapseIconPlacement?: CollapseIconPlacement;
|
|
16
|
+
collapseLabel?: string;
|
|
6
17
|
};
|
|
7
|
-
|
|
8
18
|
export type NavBrandProps = Omit<JSX.IntrinsicElements["div"], "children"> & {
|
|
9
19
|
children?: unknown;
|
|
10
20
|
};
|
|
11
21
|
|
|
12
|
-
export type
|
|
22
|
+
export type NavToggleProps = Omit<
|
|
23
|
+
JSX.IntrinsicElements["button"],
|
|
24
|
+
"children" | "type" | "onClick"
|
|
25
|
+
> & {
|
|
13
26
|
children?: unknown;
|
|
27
|
+
active?: boolean;
|
|
28
|
+
icon?: unknown;
|
|
29
|
+
iconPlacement?: CollapseIconPlacement;
|
|
30
|
+
label?: string;
|
|
31
|
+
onToggle?: () => void;
|
|
32
|
+
open?: boolean;
|
|
33
|
+
panelId?: string;
|
|
14
34
|
};
|
|
15
35
|
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
export type NavbarPanelProps = Omit<JSX.IntrinsicElements["div"], "children"> & {
|
|
37
|
+
active?: boolean;
|
|
38
|
+
brand?: unknown;
|
|
19
39
|
children?: unknown;
|
|
20
|
-
|
|
40
|
+
collapseLabel?: string;
|
|
41
|
+
onClose?: () => void;
|
|
42
|
+
open?: boolean;
|
|
43
|
+
panelId?: string;
|
|
21
44
|
};
|
|
22
45
|
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export type NavItemAsChildProps = Omit<JSX.IntrinsicElements["a"], "children" | "ref"> &
|
|
30
|
-
NavItemOwnProps & {
|
|
31
|
-
asChild: true;
|
|
32
|
-
children: JSXElement;
|
|
33
|
-
ref?: Ref<unknown>;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type NavLinkProps = LinkProps & NavItemOwnProps;
|
|
46
|
+
export type NavGroupProps = Omit<JSX.IntrinsicElements["div"], "children"> & {
|
|
47
|
+
align?: NavGroupAlign;
|
|
48
|
+
children?: unknown;
|
|
49
|
+
label?: unknown;
|
|
50
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DropdownContent as UiDropdownContent } from "@askrjs/ui";
|
|
2
|
+
import type { DropdownContentAsChildProps, DropdownContentProps } from "@askrjs/ui";
|
|
3
|
+
|
|
4
|
+
type DropdownContentBodyProps = {
|
|
5
|
+
render: () => unknown;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function DropdownContentBody(props: DropdownContentBodyProps): JSX.Element {
|
|
9
|
+
return <>{props.render()}</>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function DropdownContent(props: DropdownContentProps): JSX.Element | null;
|
|
13
|
+
export function DropdownContent(props: DropdownContentAsChildProps): JSX.Element | null;
|
|
14
|
+
export function DropdownContent(
|
|
15
|
+
props: DropdownContentProps | DropdownContentAsChildProps,
|
|
16
|
+
): JSX.Element | null {
|
|
17
|
+
if ("asChild" in props && props.asChild) {
|
|
18
|
+
return <UiDropdownContent {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { children, ...rest } = props as DropdownContentProps;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<UiDropdownContent {...rest}>
|
|
25
|
+
<DropdownContentBody render={() => children} />
|
|
26
|
+
</UiDropdownContent>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { navigate } from "@askrjs/askr/router";
|
|
2
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
3
|
+
import { mergeProps } from "@askrjs/askr/foundations/utilities";
|
|
4
|
+
import { classes } from "../_internal/classes";
|
|
5
|
+
import { resolvePathname } from "../_internal/pathname";
|
|
6
|
+
import type {
|
|
7
|
+
PaginationEllipsisProps,
|
|
8
|
+
PaginationItemAsChildProps,
|
|
9
|
+
PaginationItemProps,
|
|
10
|
+
PaginationLinkProps,
|
|
11
|
+
PaginationProps,
|
|
12
|
+
} from "./pagination.types";
|
|
13
|
+
|
|
14
|
+
function shouldHandleClientNavigation(
|
|
15
|
+
event: MouseEvent,
|
|
16
|
+
target: string | undefined,
|
|
17
|
+
targetPathname: string | null,
|
|
18
|
+
): boolean {
|
|
19
|
+
if (targetPathname === null || target) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
!event.defaultPrevented &&
|
|
25
|
+
(event.button ?? 0) === 0 &&
|
|
26
|
+
!event.altKey &&
|
|
27
|
+
!event.ctrlKey &&
|
|
28
|
+
!event.metaKey &&
|
|
29
|
+
!event.shiftKey
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function Pagination(props: PaginationProps): JSX.Element {
|
|
34
|
+
const { children, class: className, label = "Pagination", ref, ...rest } = props;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<nav
|
|
38
|
+
{...rest}
|
|
39
|
+
ref={ref}
|
|
40
|
+
class={classes("pagination", className)}
|
|
41
|
+
aria-label={label}
|
|
42
|
+
data-slot="pagination"
|
|
43
|
+
>
|
|
44
|
+
<ul class="pagination-list" data-slot="pagination-list">
|
|
45
|
+
{children}
|
|
46
|
+
</ul>
|
|
47
|
+
</nav>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function PaginationItem(props: PaginationItemProps): JSX.Element;
|
|
52
|
+
export function PaginationItem(props: PaginationItemAsChildProps): JSX.Element;
|
|
53
|
+
export function PaginationItem(
|
|
54
|
+
props: PaginationItemProps | PaginationItemAsChildProps,
|
|
55
|
+
): JSX.Element {
|
|
56
|
+
const {
|
|
57
|
+
active = false,
|
|
58
|
+
asChild,
|
|
59
|
+
children,
|
|
60
|
+
disabled = false,
|
|
61
|
+
ref,
|
|
62
|
+
class: className,
|
|
63
|
+
...rest
|
|
64
|
+
} = props;
|
|
65
|
+
const finalProps = mergeProps(rest, {
|
|
66
|
+
class: classes(
|
|
67
|
+
"page-item",
|
|
68
|
+
active ? "active" : undefined,
|
|
69
|
+
disabled ? "disabled" : undefined,
|
|
70
|
+
className,
|
|
71
|
+
),
|
|
72
|
+
ref,
|
|
73
|
+
"aria-current": active ? "page" : undefined,
|
|
74
|
+
"aria-disabled": disabled ? "true" : undefined,
|
|
75
|
+
"data-active": active ? "true" : undefined,
|
|
76
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
77
|
+
"data-slot": "pagination-item",
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (asChild) {
|
|
81
|
+
return <Slot asChild {...finalProps} children={children} />;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return <li {...finalProps}>{children}</li>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function PaginationLink(props: PaginationLinkProps): JSX.Element {
|
|
88
|
+
const {
|
|
89
|
+
active = false,
|
|
90
|
+
children,
|
|
91
|
+
class: className,
|
|
92
|
+
disabled = false,
|
|
93
|
+
href,
|
|
94
|
+
onClick,
|
|
95
|
+
ref,
|
|
96
|
+
target,
|
|
97
|
+
...rest
|
|
98
|
+
} = props as PaginationLinkProps & { onClick?: (event: MouseEvent) => void };
|
|
99
|
+
const hrefValue = href as string;
|
|
100
|
+
const targetValue = target as string | undefined;
|
|
101
|
+
const targetPathname = resolvePathname(hrefValue);
|
|
102
|
+
const isActive = active;
|
|
103
|
+
|
|
104
|
+
const linkProps = mergeProps(rest, {
|
|
105
|
+
href,
|
|
106
|
+
target: targetValue,
|
|
107
|
+
ref,
|
|
108
|
+
class: classes(
|
|
109
|
+
"page-link",
|
|
110
|
+
active ? "active" : undefined,
|
|
111
|
+
disabled ? "disabled" : undefined,
|
|
112
|
+
className,
|
|
113
|
+
),
|
|
114
|
+
"aria-current": isActive ? "page" : undefined,
|
|
115
|
+
"aria-disabled": disabled ? "true" : undefined,
|
|
116
|
+
"data-active": isActive ? "true" : undefined,
|
|
117
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
118
|
+
"data-slot": "pagination-link",
|
|
119
|
+
tabIndex: disabled ? -1 : undefined,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const handleClick = (event: MouseEvent) => {
|
|
123
|
+
onClick?.(event);
|
|
124
|
+
|
|
125
|
+
if (disabled || !shouldHandleClientNavigation(event, targetValue, targetPathname)) {
|
|
126
|
+
if (disabled) {
|
|
127
|
+
event.preventDefault();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
navigate(hrefValue);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<a {...linkProps} onClick={handleClick}>
|
|
139
|
+
{children}
|
|
140
|
+
</a>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function PaginationEllipsis(props: PaginationEllipsisProps): JSX.Element {
|
|
145
|
+
const { children, class: className, ref, ...rest } = props;
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<span
|
|
149
|
+
{...rest}
|
|
150
|
+
ref={ref}
|
|
151
|
+
class={classes("pagination-ellipsis", className)}
|
|
152
|
+
aria-hidden="true"
|
|
153
|
+
data-slot="pagination-ellipsis"
|
|
154
|
+
>
|
|
155
|
+
{children ?? "..."}
|
|
156
|
+
</span>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
2
|
+
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
|
+
|
|
4
|
+
type NavProps = Omit<JSX.IntrinsicElements["nav"], "children" | "ref" | "aria-label">;
|
|
5
|
+
type LiProps = Omit<JSX.IntrinsicElements["li"], "children" | "ref">;
|
|
6
|
+
type AnchorProps = Omit<JSX.IntrinsicElements["a"], "children" | "ref">;
|
|
7
|
+
|
|
8
|
+
export type PaginationProps = NavProps & {
|
|
9
|
+
children?: unknown;
|
|
10
|
+
label?: string;
|
|
11
|
+
ref?: Ref<HTMLElement>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type PaginationItemProps = LiProps & {
|
|
15
|
+
active?: boolean;
|
|
16
|
+
asChild?: false;
|
|
17
|
+
children?: unknown;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
ref?: Ref<HTMLLIElement>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type PaginationItemAsChildProps = LiProps & {
|
|
23
|
+
active?: boolean;
|
|
24
|
+
asChild: true;
|
|
25
|
+
children: JSXElement;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
ref?: Ref<unknown>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type PaginationLinkProps = AnchorProps & {
|
|
31
|
+
active?: boolean;
|
|
32
|
+
children?: unknown;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
href: string;
|
|
35
|
+
ref?: Ref<HTMLAnchorElement>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type PaginationEllipsisProps = Omit<JSX.IntrinsicElements["span"], "children" | "ref"> & {
|
|
39
|
+
children?: unknown;
|
|
40
|
+
ref?: Ref<HTMLSpanElement>;
|
|
41
|
+
};
|
|
@@ -3,7 +3,7 @@ import { mergeProps } from "../_internal/merge-props";
|
|
|
3
3
|
import {
|
|
4
4
|
applyBoxLayoutStyles,
|
|
5
5
|
splitBoxLayoutProps,
|
|
6
|
-
|
|
6
|
+
withBoxLayoutClass,
|
|
7
7
|
} from "../_internal/box-layout";
|
|
8
8
|
import { serializeResponsiveValueIf } from "../_internal/layout";
|
|
9
9
|
import type { SectionAsChildProps, SectionElementProps } from "./section.types";
|
|
@@ -20,13 +20,14 @@ export function Section(props: SectionElementProps | SectionAsChildProps) {
|
|
|
20
20
|
const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);
|
|
21
21
|
const layoutStyle: Record<string, string | number> = {};
|
|
22
22
|
applyBoxLayoutStyles(layoutStyle, boxProps);
|
|
23
|
+
const layoutClass = withBoxLayoutClass(layoutStyle, userStyle);
|
|
23
24
|
|
|
24
25
|
const finalProps = mergeProps(passthroughProps, {
|
|
25
26
|
ref,
|
|
26
27
|
"data-slot": "section",
|
|
27
28
|
"data-ak-layout": "true",
|
|
28
29
|
"data-size": serializeResponsiveValueIf(size, isSectionSizeToken),
|
|
29
|
-
|
|
30
|
+
...(layoutClass ? { class: layoutClass } : {}),
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
if (asChild) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { JSXElement
|
|
1
|
+
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
2
|
+
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
2
3
|
import type { BoxLayoutOwnProps, LayoutResponsive } from "../box/box.types";
|
|
3
4
|
|
|
4
5
|
export type SectionOwnProps = BoxLayoutOwnProps & {
|