@askrjs/themes 0.0.8 → 0.0.10
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 +19 -13
- package/THEMING.md +24 -18
- package/dist/components/_internal/block-layout.d.ts +49 -0
- package/dist/components/_internal/block-layout.js +210 -0
- package/dist/components/_internal/block-layout.js.map +1 -0
- package/dist/components/_internal/jsx.js.map +1 -1
- package/dist/components/_internal/style.js +25 -1
- package/dist/components/_internal/style.js.map +1 -1
- package/dist/components/alert/alert.js +2 -2
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/alert.types.d.ts +0 -1
- package/dist/components/aside/aside.d.ts +7 -0
- package/dist/components/aside/aside.js +16 -0
- package/dist/components/aside/aside.js.map +1 -0
- package/dist/components/aside/aside.types.d.ts +6 -0
- package/dist/components/aside/index.d.ts +2 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/badge/index.d.ts +1 -2
- package/dist/components/block/block.d.ts +2 -3
- package/dist/components/block/block.js +16 -46
- package/dist/components/block/block.js.map +1 -1
- package/dist/components/block/block.types.d.ts +13 -23
- package/dist/components/block/index.d.ts +3 -3
- package/dist/components/brand/brand.d.ts +9 -0
- package/dist/components/brand/brand.js +49 -0
- package/dist/components/brand/brand.js.map +1 -0
- package/dist/components/brand/brand.types.d.ts +31 -0
- package/dist/components/brand/index.d.ts +2 -0
- package/dist/components/card/card.d.ts +3 -3
- package/dist/components/card/card.js +6 -11
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/card.types.d.ts +10 -12
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/catalog.d.ts +156 -0
- package/dist/components/catalog.js +723 -0
- package/dist/components/catalog.js.map +1 -0
- package/dist/components/container/container.d.ts +2 -3
- package/dist/components/container/container.js +8 -71
- package/dist/components/container/container.js.map +1 -1
- package/dist/components/container/container.types.d.ts +5 -24
- package/dist/components/container/index.d.ts +2 -3
- package/dist/components/empty-state/empty-state.js +34 -28
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/empty-state/empty-state.types.d.ts +3 -6
- package/dist/components/field/field.js +4 -2
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/field.types.d.ts +1 -0
- package/dist/components/footer/footer.d.ts +13 -0
- package/dist/components/footer/footer.js +86 -0
- package/dist/components/footer/footer.js.map +1 -0
- package/dist/components/footer/footer.types.d.ts +37 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/grid/grid.d.ts +7 -0
- package/dist/components/grid/grid.js +76 -0
- package/dist/components/grid/grid.js.map +1 -0
- package/dist/components/grid/grid.types.d.ts +19 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/header/header.js +9 -6
- package/dist/components/header/header.js.map +1 -1
- package/dist/components/header/header.types.d.ts +5 -5
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/main/index.d.ts +2 -0
- package/dist/components/main/main.d.ts +7 -0
- package/dist/components/main/main.js +17 -0
- package/dist/components/main/main.js.map +1 -0
- package/dist/components/main/main.types.d.ts +6 -0
- package/dist/components/nav/index.d.ts +2 -2
- package/dist/components/nav/nav.d.ts +8 -6
- package/dist/components/nav/nav.js +93 -58
- package/dist/components/nav/nav.js.map +1 -1
- package/dist/components/nav/nav.types.d.ts +16 -20
- package/dist/components/navbar/index.d.ts +4 -5
- package/dist/components/navbar/navbar.d.ts +3 -38
- package/dist/components/navbar/navbar.js +102 -198
- package/dist/components/navbar/navbar.js.map +1 -1
- package/dist/components/navbar/navbar.types.d.ts +14 -24
- package/dist/components/page/index.d.ts +2 -0
- package/dist/components/page/page.d.ts +7 -0
- package/dist/components/page/page.js +22 -0
- package/dist/components/page/page.js.map +1 -0
- package/dist/components/page/page.types.d.ts +6 -0
- package/dist/components/page-header/index.d.ts +2 -0
- package/dist/components/page-header/page-header.d.ts +7 -0
- package/dist/components/page-header/page-header.js +37 -0
- package/dist/components/page-header/page-header.js.map +1 -0
- package/dist/components/page-header/page-header.types.d.ts +10 -0
- package/dist/components/section/index.d.ts +2 -3
- package/dist/components/section/section.d.ts +2 -3
- package/dist/components/section/section.js +7 -30
- package/dist/components/section/section.js.map +1 -1
- package/dist/components/section/section.types.d.ts +3 -20
- package/dist/components/separator/index.d.ts +1 -2
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/sidebar.d.ts +17 -2
- package/dist/components/sidebar/sidebar.js +115 -211
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/sidebar/sidebar.types.d.ts +21 -23
- package/dist/components/skeleton/index.d.ts +1 -2
- package/dist/components/skeleton/skeleton.js +12 -1
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/skeleton/skeleton.types.d.ts +2 -0
- package/dist/components/spinner/index.d.ts +1 -1
- package/dist/components/spinner/spinner.js +6 -3
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/spinner/spinner.types.d.ts +3 -1
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/stat.d.ts +10 -0
- package/dist/components/stat/stat.js +52 -0
- package/dist/components/stat/stat.js.map +1 -0
- package/dist/components/stat/stat.types.d.ts +24 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/text.d.ts +7 -0
- package/dist/components/text/text.js +28 -0
- package/dist/components/text/text.js.map +1 -0
- package/dist/components/text/text.types.d.ts +26 -0
- package/dist/components/theme/theme.js +97 -18
- package/dist/components/theme/theme.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/toolbar.d.ts +7 -0
- package/dist/components/toolbar/toolbar.js +30 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/toolbar/toolbar.types.d.ts +9 -0
- package/dist/components.d.ts +60 -0
- package/dist/components.js +35 -0
- package/dist/controls.d.ts +2 -2
- package/dist/controls.js +3 -3
- package/dist/core.d.ts +36 -0
- package/dist/core.js +19 -0
- package/dist/navs.d.ts +3 -15
- package/dist/navs.js +2 -8
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +2 -2
- package/dist/surfaces.d.ts +10 -8
- package/dist/surfaces.js +6 -4
- package/dist/themes/default/index.css +3691 -3959
- package/package.json +239 -73
- package/src/components/_internal/block-layout.ts +354 -0
- package/src/components/_internal/jsx.ts +18 -6
- package/src/components/_internal/style.ts +42 -4
- package/src/components/alert/alert.tsx +1 -2
- package/src/components/alert/alert.types.ts +0 -1
- package/src/components/aside/aside.tsx +12 -0
- package/src/components/aside/aside.types.ts +3 -0
- package/src/components/aside/index.ts +2 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +1 -1
- package/src/components/badge/index.ts +0 -1
- package/src/components/block/block.a11y.ts +0 -6
- package/src/components/block/block.tsx +40 -56
- package/src/components/block/block.types.ts +59 -41
- package/src/components/block/index.ts +1 -10
- package/src/components/brand/brand.tsx +61 -0
- package/src/components/brand/brand.types.ts +39 -0
- package/src/components/brand/index.ts +2 -0
- package/src/components/card/card.tsx +6 -18
- package/src/components/card/card.types.ts +9 -11
- package/src/components/card/index.ts +2 -3
- package/src/components/catalog.tsx +713 -0
- package/src/components/container/container.a11y.ts +0 -5
- package/src/components/container/container.tsx +18 -128
- package/src/components/container/container.types.ts +3 -32
- package/src/components/container/index.ts +1 -8
- package/src/components/empty-state/empty-state.tsx +17 -35
- package/src/components/empty-state/empty-state.types.ts +3 -5
- package/src/components/field/field.tsx +3 -1
- package/src/components/field/field.types.ts +1 -0
- package/src/components/footer/footer.tsx +88 -0
- package/src/components/footer/footer.types.ts +40 -0
- package/src/components/footer/index.ts +10 -0
- package/src/components/grid/grid.tsx +113 -0
- package/src/components/grid/grid.types.ts +20 -0
- package/src/components/grid/index.ts +2 -0
- package/src/components/header/header.tsx +10 -7
- package/src/components/header/header.types.ts +4 -4
- package/src/components/header/index.ts +1 -2
- package/src/components/main/index.ts +2 -0
- package/src/components/main/main.tsx +12 -0
- package/src/components/main/main.types.ts +3 -0
- package/src/components/nav/index.ts +7 -9
- package/src/components/nav/nav.tsx +153 -110
- package/src/components/nav/nav.types.ts +26 -27
- package/src/components/navbar/index.ts +4 -11
- package/src/components/navbar/navbar.tsx +104 -251
- package/src/components/navbar/navbar.types.ts +16 -42
- package/src/components/page/index.ts +2 -0
- package/src/components/page/page.tsx +17 -0
- package/src/components/page/page.types.ts +3 -0
- package/src/components/page-header/index.ts +2 -0
- package/src/components/page-header/page-header.tsx +29 -0
- package/src/components/page-header/page-header.types.ts +7 -0
- package/src/components/section/index.ts +1 -7
- package/src/components/section/section.a11y.ts +0 -1
- package/src/components/section/section.tsx +9 -35
- package/src/components/section/section.types.ts +2 -22
- package/src/components/separator/index.ts +4 -9
- package/src/components/sidebar/index.ts +27 -5
- package/src/components/sidebar/sidebar.tsx +145 -317
- package/src/components/sidebar/sidebar.types.ts +21 -28
- package/src/components/skeleton/index.ts +1 -2
- package/src/components/skeleton/skeleton.tsx +33 -1
- package/src/components/skeleton/skeleton.types.ts +2 -0
- package/src/components/spinner/index.ts +1 -1
- package/src/components/spinner/spinner.tsx +7 -2
- package/src/components/spinner/spinner.types.ts +3 -0
- package/src/components/stat/index.ts +2 -0
- package/src/components/stat/stat.tsx +47 -0
- package/src/components/stat/stat.types.ts +24 -0
- package/src/components/text/index.ts +2 -0
- package/src/components/text/text.tsx +39 -0
- package/src/components/text/text.types.ts +35 -0
- package/src/components/theme/theme.tsx +163 -21
- package/src/components/toolbar/index.ts +2 -0
- package/src/components/toolbar/toolbar.tsx +24 -0
- package/src/components/toolbar/toolbar.types.ts +6 -0
- package/src/components.ts +289 -0
- package/src/controls.ts +69 -2
- package/src/core.ts +42 -0
- package/src/navs.ts +9 -24
- package/src/overlays.ts +101 -59
- package/src/parity.ts +125 -0
- package/src/surfaces.ts +60 -13
- package/src/themes/default/index.css +11 -14
- package/src/themes/default/styles/actions/button-group.css +6 -6
- package/src/themes/default/styles/actions/button.css +98 -60
- package/src/themes/default/styles/actions/toggle-group.css +61 -25
- package/src/themes/default/styles/base/text.css +87 -0
- package/src/themes/default/styles/base/typography.css +24 -117
- package/src/themes/default/styles/base/utilities.css +0 -250
- package/src/themes/default/styles/disclosure/accordion.css +35 -28
- package/src/themes/default/styles/display/alert.css +7 -7
- package/src/themes/default/styles/display/avatar.css +7 -1
- package/src/themes/default/styles/display/badge.css +10 -10
- package/src/themes/default/styles/display/card.css +10 -47
- package/src/themes/default/styles/display/catalog.css +753 -0
- package/src/themes/default/styles/display/coverage.css +30 -305
- package/src/themes/default/styles/display/progress-circle.css +2 -0
- package/src/themes/default/styles/display/scroll-area.css +29 -24
- package/src/themes/default/styles/display/spinner.css +38 -1
- package/src/themes/default/styles/display/stat.css +21 -0
- package/src/themes/default/styles/display/table.css +39 -12
- package/src/themes/default/styles/display/virtual-list.css +24 -13
- package/src/themes/default/styles/display/virtual-table.css +58 -36
- package/src/themes/default/styles/forms/checkbox.css +12 -21
- package/src/themes/default/styles/forms/input-group.css +2 -1
- package/src/themes/default/styles/forms/input.css +11 -12
- package/src/themes/default/styles/forms/radio-group.css +44 -27
- package/src/themes/default/styles/forms/select.css +33 -35
- package/src/themes/default/styles/forms/slider.css +61 -47
- package/src/themes/default/styles/forms/switch.css +18 -23
- package/src/themes/default/styles/forms/textarea.css +12 -12
- package/src/themes/default/styles/layout/block.css +96 -12
- package/src/themes/default/styles/layout/grid.css +78 -0
- package/src/themes/default/styles/layout/layout.css +502 -772
- package/src/themes/default/styles/layout/patterns.css +0 -155
- package/src/themes/default/styles/navigation/nav.css +104 -154
- package/src/themes/default/styles/overlays/alert-dialog.css +2 -2
- package/src/themes/default/styles/overlays/dialog.css +76 -22
- package/src/themes/default/styles/overlays/dropdown.css +108 -31
- package/src/themes/default/styles/overlays/hover-card.css +39 -17
- package/src/themes/default/styles/overlays/menubar.css +223 -0
- package/src/themes/default/styles/overlays/popover.css +69 -23
- package/src/themes/default/styles/overlays/toast.css +91 -33
- package/src/themes/default/styles/overlays/tooltip.css +88 -14
- package/src/themes/default/styles/shell/brand.css +48 -0
- package/src/themes/default/styles/shell/footer.css +72 -0
- package/src/themes/default/styles/shell/header.css +7 -50
- package/src/themes/default/styles/shell/navbar.css +226 -453
- package/src/themes/default/styles/shell/sidebar.css +243 -829
- package/src/themes/default/tokens.css +145 -98
- package/templates/theme/index.css +11 -14
- package/templates/theme/styles/actions/button-group.css +6 -6
- package/templates/theme/styles/actions/button.css +98 -60
- package/templates/theme/styles/actions/toggle-group.css +61 -25
- package/templates/theme/styles/base/text.css +87 -0
- package/templates/theme/styles/base/typography.css +24 -117
- package/templates/theme/styles/disclosure/accordion.css +35 -28
- package/templates/theme/styles/display/alert.css +7 -7
- package/templates/theme/styles/display/avatar.css +7 -1
- package/templates/theme/styles/display/badge.css +10 -10
- package/templates/theme/styles/display/card.css +10 -47
- package/templates/theme/styles/display/catalog.css +753 -0
- package/templates/theme/styles/display/coverage.css +30 -305
- package/templates/theme/styles/display/scroll-area.css +29 -24
- package/templates/theme/styles/display/spinner.css +38 -1
- package/templates/theme/styles/display/stat.css +21 -0
- package/templates/theme/styles/display/table.css +39 -12
- package/templates/theme/styles/display/virtual-list.css +24 -13
- package/templates/theme/styles/display/virtual-table.css +58 -36
- package/templates/theme/styles/forms/checkbox.css +12 -21
- package/templates/theme/styles/forms/input.css +11 -12
- package/templates/theme/styles/forms/radio-group.css +44 -27
- package/templates/theme/styles/forms/select.css +33 -35
- package/templates/theme/styles/forms/slider.css +61 -47
- package/templates/theme/styles/forms/switch.css +18 -23
- package/templates/theme/styles/forms/textarea.css +12 -12
- package/templates/theme/styles/layout/block.css +96 -12
- package/templates/theme/styles/layout/grid.css +78 -0
- package/templates/theme/styles/layout/layout.css +676 -1
- package/templates/theme/styles/layout/patterns.css +0 -155
- package/templates/theme/styles/navigation/nav.css +104 -154
- package/templates/theme/styles/overlays/alert-dialog.css +2 -2
- package/templates/theme/styles/overlays/dialog.css +76 -22
- package/templates/theme/styles/overlays/dropdown.css +108 -31
- package/templates/theme/styles/overlays/hover-card.css +39 -17
- package/templates/theme/styles/overlays/menubar.css +223 -0
- package/templates/theme/styles/overlays/popover.css +69 -23
- package/templates/theme/styles/overlays/toast.css +80 -33
- package/templates/theme/styles/overlays/tooltip.css +88 -14
- package/templates/theme/styles/shell/brand.css +48 -0
- package/templates/theme/styles/shell/footer.css +72 -0
- package/templates/theme/styles/shell/header.css +7 -50
- package/templates/theme/styles/shell/navbar.css +226 -453
- package/templates/theme/styles/shell/sidebar.css +197 -779
- package/templates/theme/tokens.css +145 -98
- package/dist/components/_internal/box-layout.js +0 -116
- package/dist/components/_internal/box-layout.js.map +0 -1
- package/dist/components/_internal/layout.d.ts +0 -9
- package/dist/components/_internal/layout.js +0 -147
- package/dist/components/_internal/layout.js.map +0 -1
- package/dist/components/badge/badge.a11y.d.ts +0 -17
- package/dist/components/block/block.a11y.d.ts +0 -20
- package/dist/components/box/box.a11y.d.ts +0 -14
- package/dist/components/box/box.d.ts +0 -9
- package/dist/components/box/box.js +0 -36
- package/dist/components/box/box.js.map +0 -1
- package/dist/components/box/box.types.d.ts +0 -72
- package/dist/components/box/index.d.ts +0 -3
- package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +0 -17
- package/dist/components/breadcrumb/breadcrumb.a11y.js +0 -15
- package/dist/components/breadcrumb/breadcrumb.a11y.js.map +0 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +0 -18
- package/dist/components/breadcrumb/breadcrumb.js +0 -113
- package/dist/components/breadcrumb/breadcrumb.js.map +0 -1
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +0 -65
- package/dist/components/breadcrumb/index.d.ts +0 -3
- package/dist/components/container/container.a11y.d.ts +0 -19
- package/dist/components/flex/flex.a11y.d.ts +0 -22
- package/dist/components/flex/flex.d.ts +0 -9
- package/dist/components/flex/flex.js +0 -115
- package/dist/components/flex/flex.js.map +0 -1
- package/dist/components/flex/flex.types.d.ts +0 -42
- package/dist/components/flex/index.d.ts +0 -3
- package/dist/components/header/header.a11y.d.ts +0 -14
- package/dist/components/header/header.a11y.js +0 -12
- package/dist/components/header/header.a11y.js.map +0 -1
- package/dist/components/inline/index.d.ts +0 -8
- package/dist/components/inline/index.js +0 -13
- package/dist/components/inline/index.js.map +0 -1
- package/dist/components/list-group/index.d.ts +0 -2
- package/dist/components/list-group/list-group.d.ts +0 -9
- package/dist/components/list-group/list-group.js +0 -43
- package/dist/components/list-group/list-group.js.map +0 -1
- package/dist/components/list-group/list-group.types.d.ts +0 -32
- package/dist/components/navbar/navbar-panel.js +0 -42
- package/dist/components/navbar/navbar-panel.js.map +0 -1
- package/dist/components/navbar/navbar.context.js +0 -13
- package/dist/components/navbar/navbar.context.js.map +0 -1
- package/dist/components/navbar/navbar.render.js +0 -26
- package/dist/components/navbar/navbar.render.js.map +0 -1
- package/dist/components/navbar/navbar.shared.js +0 -18
- package/dist/components/navbar/navbar.shared.js.map +0 -1
- package/dist/components/pagination/index.d.ts +0 -2
- package/dist/components/pagination/pagination.d.ts +0 -11
- package/dist/components/pagination/pagination.js +0 -95
- package/dist/components/pagination/pagination.js.map +0 -1
- package/dist/components/pagination/pagination.types.d.ts +0 -40
- package/dist/components/section/section.a11y.d.ts +0 -15
- package/dist/components/separator/separator.a11y.d.ts +0 -17
- package/dist/components/separator/separator.a11y.js +0 -15
- package/dist/components/separator/separator.a11y.js.map +0 -1
- package/dist/components/shell/index.d.ts +0 -3
- package/dist/components/shell/shell-nav.types.d.ts +0 -7
- package/dist/components/shell/shell-panel.js +0 -54
- package/dist/components/shell/shell-panel.js.map +0 -1
- package/dist/components/shell/shell-responsive.js +0 -118
- package/dist/components/shell/shell-responsive.js.map +0 -1
- package/dist/components/shell/shell.a11y.d.ts +0 -23
- package/dist/components/shell/shell.a11y.js +0 -23
- package/dist/components/shell/shell.a11y.js.map +0 -1
- package/dist/components/shell/shell.d.ts +0 -13
- package/dist/components/shell/shell.js +0 -69
- package/dist/components/shell/shell.js.map +0 -1
- package/dist/components/shell/shell.types.d.ts +0 -58
- package/dist/components/sidebar/sidebar-panel.d.ts +0 -7
- package/dist/components/sidebar/sidebar-panel.js +0 -49
- package/dist/components/sidebar/sidebar-panel.js.map +0 -1
- package/dist/components/sidebar/sidebar-toggle.d.ts +0 -7
- package/dist/components/sidebar/sidebar-toggle.js +0 -8
- package/dist/components/sidebar/sidebar-toggle.js.map +0 -1
- package/dist/components/sidebar/sidebar.context.js +0 -21
- package/dist/components/sidebar/sidebar.context.js.map +0 -1
- package/dist/components/sidebar/sidebar.shared.js +0 -12
- package/dist/components/sidebar/sidebar.shared.js.map +0 -1
- package/dist/components/skeleton/skeleton.a11y.d.ts +0 -16
- package/dist/components/spacer/index.d.ts +0 -3
- package/dist/components/spacer/spacer.a11y.d.ts +0 -17
- package/dist/components/spacer/spacer.d.ts +0 -8
- package/dist/components/spacer/spacer.js +0 -49
- package/dist/components/spacer/spacer.js.map +0 -1
- package/dist/components/spacer/spacer.types.d.ts +0 -26
- package/dist/components/stack/index.d.ts +0 -3
- package/dist/components/stack/stack.a11y.d.ts +0 -18
- package/dist/components/stack/stack.d.ts +0 -8
- package/dist/components/stack/stack.js +0 -16
- package/dist/components/stack/stack.js.map +0 -1
- package/dist/components/stack/stack.types.d.ts +0 -22
- package/dist/feedback.d.ts +0 -5
- package/dist/feedback.js +0 -4
- package/dist/layouts.d.ts +0 -25
- package/dist/layouts.js +0 -11
- package/dist/shells.d.ts +0 -16
- package/dist/shells.js +0 -11
- package/src/components/_internal/box-layout.ts +0 -164
- package/src/components/_internal/layout.ts +0 -211
- package/src/components/box/box.a11y.ts +0 -11
- package/src/components/box/box.tsx +0 -38
- package/src/components/box/box.types.ts +0 -76
- package/src/components/box/index.ts +0 -11
- package/src/components/breadcrumb/breadcrumb.a11y.ts +0 -15
- package/src/components/breadcrumb/breadcrumb.tsx +0 -123
- package/src/components/breadcrumb/breadcrumb.types.ts +0 -74
- package/src/components/breadcrumb/index.ts +0 -24
- package/src/components/flex/flex.a11y.ts +0 -19
- package/src/components/flex/flex.tsx +0 -162
- package/src/components/flex/flex.types.ts +0 -51
- package/src/components/flex/index.ts +0 -16
- package/src/components/inline/index.tsx +0 -28
- package/src/components/list-group/index.ts +0 -7
- package/src/components/list-group/list-group.tsx +0 -74
- package/src/components/list-group/list-group.types.ts +0 -32
- package/src/components/navbar/navbar-panel.tsx +0 -62
- package/src/components/navbar/navbar.context.ts +0 -22
- package/src/components/navbar/navbar.render.tsx +0 -32
- package/src/components/navbar/navbar.shared.ts +0 -21
- package/src/components/pagination/index.ts +0 -8
- package/src/components/pagination/pagination.tsx +0 -158
- package/src/components/pagination/pagination.types.ts +0 -41
- package/src/components/shell/index.ts +0 -16
- package/src/components/shell/shell-nav.types.ts +0 -3
- package/src/components/shell/shell-panel.tsx +0 -85
- package/src/components/shell/shell-responsive.tsx +0 -246
- package/src/components/shell/shell.a11y.ts +0 -20
- package/src/components/shell/shell.tsx +0 -74
- package/src/components/shell/shell.types.ts +0 -71
- package/src/components/sidebar/sidebar-panel.tsx +0 -67
- package/src/components/sidebar/sidebar-toggle.tsx +0 -5
- package/src/components/sidebar/sidebar.context.ts +0 -40
- package/src/components/sidebar/sidebar.shared.ts +0 -12
- package/src/components/spacer/index.ts +0 -9
- package/src/components/spacer/spacer.a11y.ts +0 -14
- package/src/components/spacer/spacer.tsx +0 -61
- package/src/components/spacer/spacer.types.ts +0 -31
- package/src/components/stack/index.ts +0 -3
- package/src/components/stack/stack.a11y.ts +0 -15
- package/src/components/stack/stack.tsx +0 -13
- package/src/components/stack/stack.types.ts +0 -22
- package/src/feedback.ts +0 -6
- package/src/layouts.ts +0 -19
- package/src/shells.ts +0 -13
- package/src/themes/default/styles/actions/toggle.css +0 -50
- package/src/themes/default/styles/disclosure/collapsible.css +0 -58
- package/src/themes/default/styles/display/list-group.css +0 -84
- package/src/themes/default/styles/forms/form.css +0 -5
- package/src/themes/default/styles/layout/responsive-layout.css +0 -230
- package/src/themes/default/styles/navigation/breadcrumb.css +0 -45
- package/src/themes/default/styles/navigation/menu.css +0 -203
- package/src/themes/default/styles/navigation/menubar.css +0 -255
- package/src/themes/default/styles/navigation/pagination.css +0 -91
- package/src/themes/default/styles/shell/theme.css +0 -37
- package/templates/theme/styles/actions/toggle.css +0 -50
- package/templates/theme/styles/disclosure/collapsible.css +0 -58
- package/templates/theme/styles/display/list-group.css +0 -84
- package/templates/theme/styles/forms/form.css +0 -5
- package/templates/theme/styles/layout/responsive-layout.css +0 -230
- package/templates/theme/styles/navigation/breadcrumb.css +0 -45
- package/templates/theme/styles/navigation/menu.css +0 -203
- package/templates/theme/styles/navigation/menubar.css +0 -255
- package/templates/theme/styles/navigation/pagination.css +0 -91
- package/templates/theme/styles/shell/theme.css +0 -37
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { classes } from "../_internal/classes.js";
|
|
2
|
+
import { mergeProps } from "../_internal/merge-props.js";
|
|
3
|
+
import { styleDeclarationsToClass } from "../_internal/style.js";
|
|
4
|
+
import { mergeLayoutStyles } from "../_internal/block-layout.js";
|
|
5
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
6
|
+
//#region src/components/grid/grid.tsx
|
|
7
|
+
const DEFAULT_ELEMENT = "div";
|
|
8
|
+
const BREAKPOINTS = [
|
|
9
|
+
"base",
|
|
10
|
+
"sm",
|
|
11
|
+
"md",
|
|
12
|
+
"lg",
|
|
13
|
+
"xl"
|
|
14
|
+
];
|
|
15
|
+
const SPACE_TOKEN_MAP = {
|
|
16
|
+
"0": "0",
|
|
17
|
+
xs: "var(--ak-space-xs)",
|
|
18
|
+
sm: "var(--ak-space-sm)",
|
|
19
|
+
md: "var(--ak-space-md)",
|
|
20
|
+
lg: "var(--ak-space-lg)",
|
|
21
|
+
xl: "var(--ak-space-xl)",
|
|
22
|
+
"2xl": "var(--ak-space-2xl)",
|
|
23
|
+
"3xl": "var(--ak-space-3xl)",
|
|
24
|
+
page: "var(--ak-layout-page-gutter)"
|
|
25
|
+
};
|
|
26
|
+
function isResponsiveValue(value) {
|
|
27
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value) && BREAKPOINTS.some((breakpoint) => breakpoint in value));
|
|
28
|
+
}
|
|
29
|
+
function normalizeResponsiveValue(value) {
|
|
30
|
+
if (value === void 0) return void 0;
|
|
31
|
+
if (isResponsiveValue(value)) return value;
|
|
32
|
+
return { base: value };
|
|
33
|
+
}
|
|
34
|
+
function resolveColumns(value) {
|
|
35
|
+
if (typeof value === "number") return `repeat(${value}, minmax(0, 1fr))`;
|
|
36
|
+
return value.trim() || "minmax(0, 1fr)";
|
|
37
|
+
}
|
|
38
|
+
function resolveGap(value) {
|
|
39
|
+
return SPACE_TOKEN_MAP[value] ?? value;
|
|
40
|
+
}
|
|
41
|
+
function resolveAlign(value) {
|
|
42
|
+
if (value === "start") return "start";
|
|
43
|
+
if (value === "end") return "end";
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function setResponsiveVar(styles, property, value, resolve) {
|
|
47
|
+
const normalized = normalizeResponsiveValue(value);
|
|
48
|
+
if (!normalized) return;
|
|
49
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
50
|
+
const breakpointValue = normalized[breakpoint];
|
|
51
|
+
if (breakpointValue === void 0) continue;
|
|
52
|
+
const resolved = resolve(breakpointValue);
|
|
53
|
+
if (resolved === void 0 || resolved === "") continue;
|
|
54
|
+
styles[`--ak-grid-${property}-${breakpoint}`] = resolved;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function Grid(props) {
|
|
58
|
+
const { as, columns, gap, align, children, class: classProp, className, ref, style: userStyle, ...rest } = props;
|
|
59
|
+
const styles = {};
|
|
60
|
+
setResponsiveVar(styles, "columns", columns, resolveColumns);
|
|
61
|
+
setResponsiveVar(styles, "gap", gap, resolveGap);
|
|
62
|
+
setResponsiveVar(styles, "align", align, resolveAlign);
|
|
63
|
+
const finalProps = mergeProps(rest, {
|
|
64
|
+
ref,
|
|
65
|
+
class: classes("grid", classProp, className, styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle))),
|
|
66
|
+
"data-slot": "grid"
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsx(as ?? DEFAULT_ELEMENT, {
|
|
69
|
+
...finalProps,
|
|
70
|
+
children
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { Grid };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","names":[],"sources":["../../../src/components/grid/grid.tsx"],"sourcesContent":["import { classes } from \"../_internal/classes\";\nimport { mergeLayoutStyles } from \"../_internal/block-layout\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { styleDeclarationsToClass } from \"../_internal/style\";\nimport type { BlockSpace, LayoutBreakpoint, ResponsiveValue } from \"../_internal/block-layout\";\nimport type { GridAlign, GridColumns, GridElement, GridProps } from \"./grid.types\";\n\nconst DEFAULT_ELEMENT = \"div\";\nconst BREAKPOINTS: readonly LayoutBreakpoint[] = [\"base\", \"sm\", \"md\", \"lg\", \"xl\"];\n\nconst SPACE_TOKEN_MAP: Record<BlockSpace, string> = {\n \"0\": \"0\",\n xs: \"var(--ak-space-xs)\",\n sm: \"var(--ak-space-sm)\",\n md: \"var(--ak-space-md)\",\n lg: \"var(--ak-space-lg)\",\n xl: \"var(--ak-space-xl)\",\n \"2xl\": \"var(--ak-space-2xl)\",\n \"3xl\": \"var(--ak-space-3xl)\",\n page: \"var(--ak-layout-page-gutter)\",\n};\n\nfunction isResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): value is Partial<Record<LayoutBreakpoint, T>> {\n return Boolean(\n value &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n BREAKPOINTS.some((breakpoint) => breakpoint in value),\n );\n}\n\nfunction normalizeResponsiveValue<T>(\n value: ResponsiveValue<T> | undefined,\n): Partial<Record<LayoutBreakpoint, T>> | undefined {\n if (value === undefined) return undefined;\n if (isResponsiveValue(value)) return value;\n return { base: value };\n}\n\nfunction resolveColumns(value: GridColumns): string {\n if (typeof value === \"number\") {\n return `repeat(${value}, minmax(0, 1fr))`;\n }\n\n const trimmed = value.trim();\n return trimmed || \"minmax(0, 1fr)\";\n}\n\nfunction resolveGap(value: BlockSpace): string {\n return SPACE_TOKEN_MAP[value] ?? value;\n}\n\nfunction resolveAlign(value: GridAlign): string {\n if (value === \"start\") return \"start\";\n if (value === \"end\") return \"end\";\n return value;\n}\n\nfunction setResponsiveVar<T>(\n styles: Record<string, string | number>,\n property: string,\n value: ResponsiveValue<T> | undefined,\n resolve: (value: T) => string | number | undefined,\n) {\n const normalized = normalizeResponsiveValue(value);\n if (!normalized) return;\n\n for (const breakpoint of BREAKPOINTS) {\n const breakpointValue = normalized[breakpoint];\n if (breakpointValue === undefined) continue;\n const resolved = resolve(breakpointValue);\n if (resolved === undefined || resolved === \"\") continue;\n styles[`--ak-grid-${property}-${breakpoint}`] = resolved;\n }\n}\n\nexport function Grid<TElement extends GridElement = \"div\">(\n props: GridProps<TElement>,\n): JSX.Element {\n const {\n as,\n columns,\n gap,\n align,\n children,\n class: classProp,\n className,\n ref,\n style: userStyle,\n ...rest\n } = props as GridProps<GridElement> & {\n class?: unknown;\n className?: unknown;\n style?: unknown;\n };\n\n const styles: Record<string, string | number> = {};\n setResponsiveVar(styles, \"columns\", columns, resolveColumns);\n setResponsiveVar(styles, \"gap\", gap, resolveGap);\n setResponsiveVar(styles, \"align\", align, resolveAlign);\n\n const generatedClass = styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(\"grid\", classProp, className, generatedClass),\n \"data-slot\": \"grid\",\n });\n\n const Element = (as ?? DEFAULT_ELEMENT) as keyof JSX.IntrinsicElements;\n return <Element {...finalProps}>{children}</Element>;\n}\n"],"mappings":";;;;;;AAOA,MAAM,kBAAkB;AACxB,MAAM,cAA2C;CAAC;CAAQ;CAAM;CAAM;CAAM;AAAI;AAEhF,MAAM,kBAA8C;CAClD,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;AACR;AAEA,SAAS,kBACP,OAC+C;CAC/C,OAAO,QACL,SACA,OAAO,UAAU,YACjB,CAAC,MAAM,QAAQ,KAAK,KACpB,YAAY,MAAM,eAAe,cAAc,KAAK,CACtD;AACF;AAEA,SAAS,yBACP,OACkD;CAClD,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,IAAI,kBAAkB,KAAK,GAAG,OAAO;CACrC,OAAO,EAAE,MAAM,MAAM;AACvB;AAEA,SAAS,eAAe,OAA4B;CAClD,IAAI,OAAO,UAAU,UACnB,OAAO,UAAU,MAAM;CAIzB,OADgB,MAAM,KACT,KAAK;AACpB;AAEA,SAAS,WAAW,OAA2B;CAC7C,OAAO,gBAAgB,UAAU;AACnC;AAEA,SAAS,aAAa,OAA0B;CAC9C,IAAI,UAAU,SAAS,OAAO;CAC9B,IAAI,UAAU,OAAO,OAAO;CAC5B,OAAO;AACT;AAEA,SAAS,iBACP,QACA,UACA,OACA,SACA;CACA,MAAM,aAAa,yBAAyB,KAAK;CACjD,IAAI,CAAC,YAAY;CAEjB,KAAK,MAAM,cAAc,aAAa;EACpC,MAAM,kBAAkB,WAAW;EACnC,IAAI,oBAAoB,KAAA,GAAW;EACnC,MAAM,WAAW,QAAQ,eAAe;EACxC,IAAI,aAAa,KAAA,KAAa,aAAa,IAAI;EAC/C,OAAO,aAAa,SAAS,GAAG,gBAAgB;CAClD;AACF;AAEA,SAAgB,KACd,OACa;CACb,MAAM,EACJ,IACA,SACA,KACA,OACA,UACA,OAAO,WACP,WACA,KACA,OAAO,WACP,GAAG,SACD;CAMJ,MAAM,SAA0C,CAAC;CACjD,iBAAiB,QAAQ,WAAW,SAAS,cAAc;CAC3D,iBAAiB,QAAQ,OAAO,KAAK,UAAU;CAC/C,iBAAiB,QAAQ,SAAS,OAAO,YAAY;CAGrD,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,QAAQ,WAAW,WAHb,yBAAyB,kBAAkB,QAAQ,SAAS,CAGvB,CAAC;EAC3D,aAAa;CACf,CAAC;CAGD,OAAO,oBADU,MAAM,iBAChB;EAAS,GAAI;EAAa;CAAkB,CAAA;AACrD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BlockSpace, ResponsiveValue } from "../_internal/block-layout.js";
|
|
2
|
+
import { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
|
+
|
|
4
|
+
//#region src/components/grid/grid.types.d.ts
|
|
5
|
+
type GridElement = "div" | "section" | "ul";
|
|
6
|
+
type GridColumns = number | string;
|
|
7
|
+
type GridAlign = "start" | "center" | "end" | "stretch";
|
|
8
|
+
type GridIntrinsicProps<TElement extends GridElement> = Omit<JSX.IntrinsicElements[TElement], "children" | "ref">;
|
|
9
|
+
type GridProps<TElement extends GridElement = "div"> = GridIntrinsicProps<TElement> & {
|
|
10
|
+
as?: TElement;
|
|
11
|
+
columns?: ResponsiveValue<GridColumns>;
|
|
12
|
+
gap?: ResponsiveValue<BlockSpace>;
|
|
13
|
+
align?: ResponsiveValue<GridAlign>;
|
|
14
|
+
children?: unknown;
|
|
15
|
+
ref?: Ref<HTMLElement>;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GridAlign, GridColumns, GridElement, GridProps };
|
|
19
|
+
//# sourceMappingURL=grid.types.d.ts.map
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Block } from "../block/block.js";
|
|
2
2
|
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
3
|
//#region src/components/header/header.tsx
|
|
4
4
|
function Header(props) {
|
|
5
|
-
const { children, position = "
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
5
|
+
const { children, position, sticky = position === "sticky", ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(Block, {
|
|
7
|
+
as: "header",
|
|
8
|
+
sticky,
|
|
9
|
+
top: sticky ? "0" : void 0,
|
|
10
|
+
zIndex: sticky ? "header" : void 0,
|
|
11
|
+
background: "surface",
|
|
12
|
+
borderBottom: true,
|
|
7
13
|
...rest,
|
|
8
|
-
ref,
|
|
9
|
-
class: classes("header", className),
|
|
10
14
|
"data-slot": "header",
|
|
11
|
-
"data-position": position,
|
|
12
15
|
children
|
|
13
16
|
});
|
|
14
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","names":[],"sources":["../../../src/components/header/header.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"header.js","names":[],"sources":["../../../src/components/header/header.tsx"],"sourcesContent":["import { Block } from \"../block\";\nimport type { HeaderProps } from \"./header.types\";\n\nexport function Header(props: HeaderProps): JSX.Element {\n const { children, position, sticky = position === \"sticky\", ...rest } = props;\n\n return (\n <Block\n as=\"header\"\n sticky={sticky}\n top={sticky ? \"0\" : undefined}\n zIndex={sticky ? \"header\" : undefined}\n background=\"surface\"\n borderBottom\n {...rest}\n data-slot=\"header\"\n >\n {children}\n </Block>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,OAAO,OAAiC;CACtD,MAAM,EAAE,UAAU,UAAU,SAAS,aAAa,UAAU,GAAG,SAAS;CAExE,OACE,oBAAC,OAAD;EACE,IAAG;EACK;EACR,KAAK,SAAS,MAAM,KAAA;EACpB,QAAQ,SAAS,WAAW,KAAA;EAC5B,YAAW;EACX,cAAA;EACA,GAAI;EACJ,aAAU;EAET;CACI,CAAA;AAEX"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { BlockElementProps } from "../block/block.types.js";
|
|
1
2
|
//#region src/components/header/header.types.d.ts
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
children?: unknown;
|
|
3
|
+
type HeaderProps = Omit<BlockElementProps<"header">, "as" | "sticky"> & {
|
|
4
|
+
position?: "sticky" | "static";
|
|
5
|
+
sticky?: boolean;
|
|
6
6
|
};
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { HeaderProps };
|
|
9
9
|
//# sourceMappingURL=header.types.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Block } from "../block/block.js";
|
|
2
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
|
+
//#region src/components/main/main.tsx
|
|
4
|
+
function Main(props) {
|
|
5
|
+
const { children, ...rest } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(Block, {
|
|
7
|
+
as: "main",
|
|
8
|
+
grow: true,
|
|
9
|
+
...rest,
|
|
10
|
+
"data-slot": "main",
|
|
11
|
+
children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Main };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","names":[],"sources":["../../../src/components/main/main.tsx"],"sourcesContent":["import { Block } from \"../block\";\nimport type { MainProps } from \"./main.types\";\n\nexport function Main(props: MainProps): JSX.Element {\n const { children, ...rest } = props;\n\n return (\n <Block as=\"main\" grow {...rest} data-slot=\"main\">\n {children}\n </Block>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,KAAK,OAA+B;CAClD,MAAM,EAAE,UAAU,GAAG,SAAS;CAE9B,OACE,oBAAC,OAAD;EAAO,IAAG;EAAO,MAAA;EAAK,GAAI;EAAM,aAAU;EACvC;CACI,CAAA;AAEX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { NavItemAsChildProps, NavItemProps, NavLinkProps, PillProps, PillsAsChildProps, PillsProps, TabProps, TabsAsChildProps, TabsProps } from "./nav.types.js";
|
|
2
|
+
import { NavItem, NavLink, Pill, Pills, Tab, Tabs } from "./nav.js";
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavItemAsChildProps, NavItemProps, NavLinkProps, PillProps, PillsAsChildProps, PillsProps, TabProps, TabsAsChildProps, TabsProps } from "./nav.types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/components/nav/nav.d.ts
|
|
4
|
-
declare function
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
declare function
|
|
4
|
+
declare function Tabs(props: TabsProps): JSX.Element;
|
|
5
|
+
declare function Tabs(props: TabsAsChildProps): JSX.Element;
|
|
6
|
+
declare function Pills(props: PillsProps): JSX.Element;
|
|
7
|
+
declare function Pills(props: PillsAsChildProps): JSX.Element;
|
|
8
|
+
declare function Tab(props: TabProps): JSX.Element;
|
|
9
|
+
declare function Pill(props: PillProps): JSX.Element;
|
|
8
10
|
declare function NavItem(props: NavItemProps): JSX.Element;
|
|
9
11
|
declare function NavItem(props: NavItemAsChildProps): JSX.Element;
|
|
10
12
|
declare function NavLink(props: NavLinkProps): JSX.Element;
|
|
11
13
|
//#endregion
|
|
12
|
-
export {
|
|
14
|
+
export { NavItem, NavLink, Pill, Pills, Tab, Tabs };
|
|
13
15
|
//# sourceMappingURL=nav.d.ts.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { classes } from "../_internal/classes.js";
|
|
2
2
|
import { mergeProps } from "../_internal/merge-props.js";
|
|
3
|
+
import { Block } from "../block/block.js";
|
|
3
4
|
import { resolvePathname } from "../_internal/pathname.js";
|
|
4
5
|
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
5
6
|
import { Slot } from "@askrjs/askr/foundations";
|
|
6
|
-
import { currentRoute, navigate } from "@askrjs/askr/router";
|
|
7
|
+
import { Link, currentRoute, navigate } from "@askrjs/askr/router";
|
|
7
8
|
//#region src/components/nav/nav.tsx
|
|
8
|
-
function navItemClasses(variant, className) {
|
|
9
|
-
return classes("nav-item", "navbar-item", variant === "icon" && "nav-item-icon", variant === "icon" && "navbar-item-icon", className);
|
|
10
|
-
}
|
|
11
9
|
function normalizePathname(pathname) {
|
|
12
10
|
return pathname.endsWith("/") && pathname !== "/" ? pathname.slice(0, -1) : pathname;
|
|
13
11
|
}
|
|
@@ -22,92 +20,129 @@ function getReactiveCurrentPathname() {
|
|
|
22
20
|
return getCurrentPathname();
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
|
-
function shouldHandleClientNavigation(event, target, targetPathname) {
|
|
26
|
-
if (targetPathname === null || target) return false;
|
|
27
|
-
return !event.defaultPrevented && (event.button ?? 0) === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
28
|
-
}
|
|
29
23
|
function isActiveNavLink(currentPathname, targetPathname, match = "prefix") {
|
|
30
24
|
if (targetPathname === "/") return currentPathname === "/";
|
|
31
25
|
if (match === "exact") return currentPathname === targetPathname;
|
|
32
26
|
return currentPathname === targetPathname || currentPathname.startsWith(`${targetPathname}/`);
|
|
33
27
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
28
|
+
function shouldHandleClientNavigation(event, target, targetPathname) {
|
|
29
|
+
if (targetPathname === null || target) return false;
|
|
30
|
+
return !event.defaultPrevented && (event.button ?? 0) === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey;
|
|
31
|
+
}
|
|
32
|
+
function renderNavSet(props, slot) {
|
|
36
33
|
const className = "class" in props ? props.class : void 0;
|
|
37
|
-
const { asChild, children,
|
|
34
|
+
const { asChild, children, ref, ...rest } = props;
|
|
38
35
|
const finalProps = mergeProps(rest, {
|
|
39
36
|
ref,
|
|
40
|
-
class: classes(
|
|
41
|
-
"data-slot":
|
|
42
|
-
"data-orientation": orientation,
|
|
43
|
-
"data-variant": variant
|
|
37
|
+
class: classes(slot, className),
|
|
38
|
+
"data-slot": slot
|
|
44
39
|
});
|
|
45
40
|
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
46
41
|
asChild: true,
|
|
47
42
|
...finalProps,
|
|
48
43
|
children
|
|
49
44
|
});
|
|
50
|
-
if (as === "div") return /* @__PURE__ */ jsx("div", {
|
|
51
|
-
...finalProps,
|
|
52
|
-
children
|
|
53
|
-
});
|
|
54
|
-
if (as === "ul") return /* @__PURE__ */ jsx("ul", {
|
|
55
|
-
...finalProps,
|
|
56
|
-
children
|
|
57
|
-
});
|
|
58
45
|
return /* @__PURE__ */ jsx("nav", {
|
|
59
46
|
...finalProps,
|
|
60
47
|
children
|
|
61
48
|
});
|
|
62
49
|
}
|
|
63
|
-
function
|
|
64
|
-
const {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"data-slot": "nav-item",
|
|
69
|
-
"data-variant": variant
|
|
70
|
-
});
|
|
71
|
-
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
72
|
-
asChild: true,
|
|
73
|
-
...finalProps,
|
|
74
|
-
children
|
|
75
|
-
});
|
|
76
|
-
return /* @__PURE__ */ jsx("a", {
|
|
77
|
-
...finalProps,
|
|
78
|
-
children
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function NavLink(props) {
|
|
82
|
-
const { children, href, onClick, ref, class: className, match = "prefix", target, variant = "default", ...rest } = props;
|
|
50
|
+
function renderRoutedLink(props, slot, options = {}) {
|
|
51
|
+
const { active, children, href, onClick, ref, class: className, match = "prefix", target, ...rest } = props;
|
|
52
|
+
const resolvedSlot = (options.inheritSlot && typeof rest["data-slot"] === "string" ? String(rest["data-slot"]) : void 0) ?? slot;
|
|
53
|
+
const inheritedNavClass = slot === "nav-item" && resolvedSlot !== "nav-item" ? "nav-item" : void 0;
|
|
54
|
+
const { "data-slot": _dataSlot, ...childRest } = rest;
|
|
83
55
|
const currentPathname = getReactiveCurrentPathname();
|
|
84
56
|
const targetPathname = resolvePathname(href);
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
target,
|
|
89
|
-
ref,
|
|
90
|
-
class: navItemClasses(variant, className),
|
|
91
|
-
"data-slot": "nav-link",
|
|
92
|
-
"data-variant": variant
|
|
93
|
-
});
|
|
94
|
-
const finalProps = isActive ? mergeProps({
|
|
57
|
+
const routeActive = currentPathname !== null && targetPathname !== null && isActiveNavLink(currentPathname, targetPathname, match);
|
|
58
|
+
const isActive = active ?? routeActive;
|
|
59
|
+
const activeProps = isActive ? {
|
|
95
60
|
"aria-current": "page",
|
|
96
61
|
"data-active": "true"
|
|
97
|
-
}
|
|
62
|
+
} : { "data-active": void 0 };
|
|
63
|
+
const useRouterLink = targetPathname !== null && !target && typeof onClick !== "function";
|
|
64
|
+
const childProps = {
|
|
65
|
+
...childRest,
|
|
66
|
+
href,
|
|
67
|
+
target
|
|
68
|
+
};
|
|
98
69
|
const handleClick = (event) => {
|
|
99
70
|
onClick?.(event);
|
|
100
71
|
if (!shouldHandleClientNavigation(event, target, targetPathname)) return;
|
|
101
72
|
event.preventDefault();
|
|
102
73
|
navigate(href);
|
|
103
74
|
};
|
|
104
|
-
return /* @__PURE__ */ jsx(
|
|
105
|
-
|
|
106
|
-
|
|
75
|
+
return /* @__PURE__ */ jsx(Block, {
|
|
76
|
+
asChild: true,
|
|
77
|
+
paddingX: "sm",
|
|
78
|
+
paddingY: "xs",
|
|
79
|
+
radius: resolvedSlot === "pill" ? "round" : "md",
|
|
80
|
+
background: isActive && options.activeBackground ? "selected" : void 0,
|
|
81
|
+
ref,
|
|
82
|
+
class: classes(options.className, inheritedNavClass, className),
|
|
83
|
+
"data-slot": resolvedSlot,
|
|
84
|
+
...activeProps,
|
|
85
|
+
children: useRouterLink ? /* @__PURE__ */ jsx(Link, {
|
|
86
|
+
...childProps,
|
|
87
|
+
children
|
|
88
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
89
|
+
...childProps,
|
|
90
|
+
onClick: handleClick,
|
|
91
|
+
children
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function Tabs(props) {
|
|
96
|
+
return renderNavSet(props, "tabs");
|
|
97
|
+
}
|
|
98
|
+
function Pills(props) {
|
|
99
|
+
return renderNavSet(props, "pills");
|
|
100
|
+
}
|
|
101
|
+
function Tab(props) {
|
|
102
|
+
return renderRoutedLink(props, "tab", { className: "tab" });
|
|
103
|
+
}
|
|
104
|
+
function Pill(props) {
|
|
105
|
+
return renderRoutedLink(props, "pill", {
|
|
106
|
+
activeBackground: true,
|
|
107
|
+
className: "pill"
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function NavItem(props) {
|
|
111
|
+
const { asChild, active = false, children, ref, class: className, match: _match, ...rest } = props;
|
|
112
|
+
if (asChild) return /* @__PURE__ */ jsx(Block, {
|
|
113
|
+
asChild: true,
|
|
114
|
+
paddingX: "sm",
|
|
115
|
+
paddingY: "xs",
|
|
116
|
+
radius: "md",
|
|
117
|
+
background: active ? "selected" : void 0,
|
|
118
|
+
...rest,
|
|
119
|
+
ref,
|
|
120
|
+
class: className,
|
|
121
|
+
"data-active": active ? "true" : void 0,
|
|
122
|
+
"data-slot": "nav-item",
|
|
107
123
|
children
|
|
108
124
|
});
|
|
125
|
+
return /* @__PURE__ */ jsx(Block, {
|
|
126
|
+
as: "a",
|
|
127
|
+
paddingX: "sm",
|
|
128
|
+
paddingY: "xs",
|
|
129
|
+
radius: "md",
|
|
130
|
+
background: active ? "selected" : void 0,
|
|
131
|
+
...rest,
|
|
132
|
+
ref,
|
|
133
|
+
class: className,
|
|
134
|
+
"data-active": active ? "true" : void 0,
|
|
135
|
+
"data-slot": "nav-item",
|
|
136
|
+
children
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function NavLink(props) {
|
|
140
|
+
return renderRoutedLink(props, "nav-item", {
|
|
141
|
+
activeBackground: true,
|
|
142
|
+
inheritSlot: true
|
|
143
|
+
});
|
|
109
144
|
}
|
|
110
145
|
//#endregion
|
|
111
|
-
export {
|
|
146
|
+
export { NavItem, NavLink, Pill, Pills, Tab, Tabs };
|
|
112
147
|
|
|
113
148
|
//# sourceMappingURL=nav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.js","names":[],"sources":["../../../src/components/nav/nav.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { currentRoute, navigate } from \"@askrjs/askr/router\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { resolvePathname } from \"../_internal/pathname\";\nimport type {\n
|
|
1
|
+
{"version":3,"file":"nav.js","names":[],"sources":["../../../src/components/nav/nav.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { currentRoute, Link, navigate } from \"@askrjs/askr/router\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { resolvePathname } from \"../_internal/pathname\";\nimport type {\n NavItemAsChildProps,\n NavItemProps,\n NavLinkProps,\n PillProps,\n PillsAsChildProps,\n PillsProps,\n TabProps,\n TabsAsChildProps,\n TabsProps,\n} from \"./nav.types\";\n\nfunction normalizePathname(pathname: string): string {\n return pathname.endsWith(\"/\") && pathname !== \"/\" ? pathname.slice(0, -1) : pathname;\n}\n\nfunction getCurrentPathname(): string | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n return normalizePathname(window.location.pathname || \"/\");\n}\n\nfunction getReactiveCurrentPathname(): string | null {\n try {\n return normalizePathname(currentRoute().path || \"/\");\n } catch {\n return getCurrentPathname();\n }\n}\n\nfunction isActiveNavLink(\n currentPathname: string,\n targetPathname: string,\n match: NavLinkProps[\"match\"] = \"prefix\",\n): boolean {\n if (targetPathname === \"/\") {\n return currentPathname === \"/\";\n }\n\n if (match === \"exact\") {\n return currentPathname === targetPathname;\n }\n\n return currentPathname === targetPathname || currentPathname.startsWith(`${targetPathname}/`);\n}\n\nfunction shouldHandleClientNavigation(\n event: MouseEvent,\n target: string | undefined,\n targetPathname: string | null,\n): boolean {\n if (targetPathname === null || target) {\n return false;\n }\n\n return (\n !event.defaultPrevented &&\n (event.button ?? 0) === 0 &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.shiftKey\n );\n}\n\nfunction renderNavSet(\n props: TabsProps | TabsAsChildProps | PillsProps | PillsAsChildProps,\n slot: \"tabs\" | \"pills\",\n): JSX.Element {\n const className = \"class\" in props ? props.class : undefined;\n const { asChild, children, ref, ...rest } = props;\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(slot, className),\n \"data-slot\": slot,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return <nav {...finalProps}>{children}</nav>;\n}\n\nfunction renderRoutedLink(\n props: NavLinkProps | TabProps | PillProps,\n slot: \"nav-item\" | \"tab\" | \"pill\",\n options: { activeBackground?: boolean; className?: string; inheritSlot?: boolean } = {},\n): JSX.Element {\n const {\n active,\n children,\n href,\n onClick,\n ref,\n class: className,\n match = \"prefix\",\n target,\n ...rest\n } = props as NavLinkProps & { onClick?: (event: MouseEvent) => void };\n const inheritedSlot =\n options.inheritSlot && typeof (rest as Record<string, unknown>)[\"data-slot\"] === \"string\"\n ? String((rest as Record<string, unknown>)[\"data-slot\"])\n : undefined;\n const resolvedSlot = (inheritedSlot ?? slot) as \"nav-item\" | \"tab\" | \"pill\";\n const inheritedNavClass =\n slot === \"nav-item\" && resolvedSlot !== \"nav-item\" ? \"nav-item\" : undefined;\n const { \"data-slot\": _dataSlot, ...childRest } = rest as Record<string, unknown>;\n void _dataSlot;\n const currentPathname = getReactiveCurrentPathname();\n const targetPathname = resolvePathname(href);\n const routeActive =\n currentPathname !== null &&\n targetPathname !== null &&\n isActiveNavLink(currentPathname, targetPathname, match);\n const isActive = active ?? routeActive;\n const activeProps = isActive\n ? {\n \"aria-current\": \"page\" as const,\n \"data-active\": \"true\" as const,\n }\n : {\n \"data-active\": undefined,\n };\n const useRouterLink = targetPathname !== null && !target && typeof onClick !== \"function\";\n const childProps = {\n ...childRest,\n href,\n target,\n };\n const handleClick = (event: MouseEvent) => {\n onClick?.(event);\n\n if (!shouldHandleClientNavigation(event, target, targetPathname)) {\n return;\n }\n\n event.preventDefault();\n navigate(href);\n };\n\n return (\n <Block\n asChild\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius={resolvedSlot === \"pill\" ? \"round\" : \"md\"}\n background={isActive && options.activeBackground ? \"selected\" : undefined}\n ref={ref}\n class={classes(options.className, inheritedNavClass, className)}\n data-slot={resolvedSlot}\n {...activeProps}\n >\n {useRouterLink ? (\n <Link {...childProps}>{children}</Link>\n ) : (\n <a {...childProps} onClick={handleClick}>\n {children}\n </a>\n )}\n </Block>\n );\n}\n\nexport function Tabs(props: TabsProps): JSX.Element;\nexport function Tabs(props: TabsAsChildProps): JSX.Element;\nexport function Tabs(props: TabsProps | TabsAsChildProps): JSX.Element {\n return renderNavSet(props, \"tabs\");\n}\n\nexport function Pills(props: PillsProps): JSX.Element;\nexport function Pills(props: PillsAsChildProps): JSX.Element;\nexport function Pills(props: PillsProps | PillsAsChildProps): JSX.Element {\n return renderNavSet(props, \"pills\");\n}\n\nexport function Tab(props: TabProps): JSX.Element {\n return renderRoutedLink(props, \"tab\", { className: \"tab\" });\n}\n\nexport function Pill(props: PillProps): JSX.Element {\n return renderRoutedLink(props, \"pill\", { activeBackground: true, className: \"pill\" });\n}\n\nexport function NavItem(props: NavItemProps): JSX.Element;\nexport function NavItem(props: NavItemAsChildProps): JSX.Element;\nexport function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element {\n const {\n asChild,\n active = false,\n children,\n ref,\n class: className,\n match: _match,\n ...rest\n } = props as (NavItemProps | NavItemAsChildProps) & { match?: unknown };\n void _match;\n\n if (asChild) {\n return (\n <Block\n asChild\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius=\"md\"\n background={active ? \"selected\" : undefined}\n {...rest}\n ref={ref}\n class={className}\n data-active={active ? \"true\" : undefined}\n data-slot=\"nav-item\"\n >\n {children}\n </Block>\n );\n }\n\n return (\n <Block\n as=\"a\"\n paddingX=\"sm\"\n paddingY=\"xs\"\n radius=\"md\"\n background={active ? \"selected\" : undefined}\n {...rest}\n ref={ref}\n class={className}\n data-active={active ? \"true\" : undefined}\n data-slot=\"nav-item\"\n >\n {children}\n </Block>\n );\n}\n\nexport function NavLink(props: NavLinkProps): JSX.Element {\n return renderRoutedLink(props, \"nav-item\", { activeBackground: true, inheritSlot: true });\n}\n"],"mappings":"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"}
|
|
@@ -3,40 +3,34 @@ import { Ref } from "@askrjs/askr/foundations/utilities";
|
|
|
3
3
|
import { LinkProps } from "@askrjs/askr/router";
|
|
4
4
|
|
|
5
5
|
//#region src/components/nav/nav.types.d.ts
|
|
6
|
-
type NavOrientation = "horizontal" | "vertical";
|
|
7
|
-
type NavVariant = "default" | "tabs" | "pills";
|
|
8
|
-
type NavItemVariant = "default" | "icon";
|
|
9
6
|
type NavLinkMatch = "prefix" | "exact";
|
|
10
|
-
type
|
|
7
|
+
type TabsOwnProps = {
|
|
11
8
|
children?: unknown;
|
|
12
|
-
orientation?: NavOrientation;
|
|
13
|
-
variant?: NavVariant;
|
|
14
|
-
as?: "nav" | "div" | "ul";
|
|
15
9
|
};
|
|
16
|
-
type
|
|
17
|
-
as?: "nav";
|
|
10
|
+
type TabsProps = Omit<JSX.IntrinsicElements["nav"], "children" | "ref"> & TabsOwnProps & {
|
|
18
11
|
asChild?: false;
|
|
19
12
|
ref?: Ref<HTMLElement>;
|
|
20
13
|
};
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ref?: Ref<
|
|
14
|
+
type TabsAsChildProps = Omit<JSX.IntrinsicElements["nav"], "children" | "ref"> & TabsOwnProps & {
|
|
15
|
+
asChild: true;
|
|
16
|
+
children: JSXElement;
|
|
17
|
+
ref?: Ref<unknown>;
|
|
25
18
|
};
|
|
26
|
-
type
|
|
27
|
-
|
|
19
|
+
type PillsOwnProps = {
|
|
20
|
+
children?: unknown;
|
|
21
|
+
};
|
|
22
|
+
type PillsProps = Omit<JSX.IntrinsicElements["nav"], "children" | "ref"> & PillsOwnProps & {
|
|
28
23
|
asChild?: false;
|
|
29
|
-
ref?: Ref<
|
|
24
|
+
ref?: Ref<HTMLElement>;
|
|
30
25
|
};
|
|
31
|
-
type
|
|
26
|
+
type PillsAsChildProps = Omit<JSX.IntrinsicElements["nav"], "children" | "ref"> & PillsOwnProps & {
|
|
32
27
|
asChild: true;
|
|
33
28
|
children: JSXElement;
|
|
34
29
|
ref?: Ref<unknown>;
|
|
35
30
|
};
|
|
36
|
-
type NavProps = NavNavProps | NavDivProps | NavListProps | NavAsChildProps;
|
|
37
31
|
type NavItemOwnProps = {
|
|
32
|
+
active?: boolean;
|
|
38
33
|
children?: unknown;
|
|
39
|
-
variant?: NavItemVariant;
|
|
40
34
|
};
|
|
41
35
|
type NavItemProps = Omit<JSX.IntrinsicElements["a"], "children" | "ref"> & NavItemOwnProps & {
|
|
42
36
|
asChild?: false;
|
|
@@ -51,6 +45,8 @@ type NavLinkOwnProps = NavItemOwnProps & {
|
|
|
51
45
|
match?: NavLinkMatch;
|
|
52
46
|
};
|
|
53
47
|
type NavLinkProps = LinkProps & NavLinkOwnProps;
|
|
48
|
+
type TabProps = LinkProps & NavLinkOwnProps;
|
|
49
|
+
type PillProps = LinkProps & NavLinkOwnProps;
|
|
54
50
|
//#endregion
|
|
55
|
-
export {
|
|
51
|
+
export { NavItemAsChildProps, NavItemProps, NavLinkProps, PillProps, PillsAsChildProps, PillsProps, TabProps, TabsAsChildProps, TabsProps };
|
|
56
52
|
//# sourceMappingURL=nav.types.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { NavBrand, NavGroup, NavToggle, Navbar } from "./navbar.js";
|
|
1
|
+
import { NavBrandProps, NavDropdownProps, NavGroupProps, NavbarCollapseBreakpoint, NavbarProps } from "./navbar.types.js";
|
|
2
|
+
import { NavBrand, NavDropdown, NavGroup, Navbar } from "./navbar.js";
|
|
3
|
+
import { NavItemAsChildProps, NavItemProps, NavLinkProps } from "../nav/nav.types.js";
|
|
4
|
+
import { NavItem, NavLink } from "../nav/nav.js";
|
|
@@ -1,45 +1,10 @@
|
|
|
1
|
-
import { NavBrandProps,
|
|
1
|
+
import { NavBrandProps, NavDropdownProps, NavGroupProps, NavbarProps } from "./navbar.types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/components/navbar/navbar.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Responsive mobile-first navbar component.
|
|
6
|
-
*
|
|
7
|
-
* Composition: Navbar should contain NavBrand (extracted to mobile panel), NavGroup items with optional align,
|
|
8
|
-
* and NavLink children. Brand must be first child to appear in mobile menu.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* <Navbar breakpoint="md" aria-label="Main navigation">
|
|
12
|
-
* <NavBrand><a href="/">Logo</a></NavBrand>
|
|
13
|
-
* <NavGroup align="center">
|
|
14
|
-
* <NavLink href="/docs">Docs</NavLink>
|
|
15
|
-
* </NavGroup>
|
|
16
|
-
* <NavGroup align="end">
|
|
17
|
-
* <NavLink href="/settings">Settings</NavLink>
|
|
18
|
-
* </NavGroup>
|
|
19
|
-
* </Navbar>
|
|
20
|
-
*/
|
|
21
4
|
declare function Navbar(props: NavbarProps): JSX.Element;
|
|
22
|
-
/**
|
|
23
|
-
* Menu toggle button for responsive navbar collapse.
|
|
24
|
-
* Auto-renders when navbar is responsive (collapseBelow set).
|
|
25
|
-
*/
|
|
26
|
-
declare function NavToggle(props: NavToggleProps): JSX.Element | null;
|
|
27
|
-
/**
|
|
28
|
-
* Brand/logo container displayed in navbar and mobile panel header.
|
|
29
|
-
*/
|
|
30
5
|
declare function NavBrand(props: NavBrandProps): JSX.Element;
|
|
31
|
-
/**
|
|
32
|
-
* Navigation group for organizing related nav items.
|
|
33
|
-
*
|
|
34
|
-
* @param align - Alignment: "start" (default), "center", or "end". Using align="end" automatically right-aligns the group.
|
|
35
|
-
* @param label - Optional accessible label for grouped items.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* <NavGroup align="center">
|
|
39
|
-
* <NavLink href="/docs">Docs</NavLink>
|
|
40
|
-
* </NavGroup>
|
|
41
|
-
*/
|
|
42
6
|
declare function NavGroup(props: NavGroupProps): JSX.Element;
|
|
7
|
+
declare function NavDropdown(props: NavDropdownProps): JSX.Element;
|
|
43
8
|
//#endregion
|
|
44
|
-
export { NavBrand,
|
|
9
|
+
export { NavBrand, NavDropdown, NavGroup, Navbar };
|
|
45
10
|
//# sourceMappingURL=navbar.d.ts.map
|