@askrjs/themes 0.0.9 → 0.0.11
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/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 +103 -210
- 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 -225
- 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 +50 -8
- 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 +3661 -3945
- package/package.json +235 -69
- package/src/components/_internal/block-layout.ts +354 -0
- 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 +103 -265
- 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 +146 -336
- 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 +83 -9
- 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/badge.css +8 -9
- 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 +37 -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 +27 -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 -454
- 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/badge.css +8 -9
- 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 +37 -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 +27 -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 -454
- 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 -142
- 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 -141
- 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 -202
- 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 -262
- 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
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { For } from "@askrjs/askr/control";
|
|
2
|
-
import { resource } from "@askrjs/askr/resources";
|
|
3
|
-
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
4
|
-
import { isJsxElement, toChildArray } from "../_internal/jsx";
|
|
5
|
-
|
|
6
|
-
export type ShellResponsivePanelProps = {
|
|
7
|
-
active: boolean;
|
|
8
|
-
collapseLabel: string;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
open: boolean;
|
|
11
|
-
panelId?: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
let shellScrollLockCount = 0;
|
|
15
|
-
let shellScrollLockPreviousValue: string | null = null;
|
|
16
|
-
|
|
17
|
-
function acquireShellScrollLock(): void {
|
|
18
|
-
if (typeof document === "undefined") return;
|
|
19
|
-
|
|
20
|
-
const body = document.body;
|
|
21
|
-
if (shellScrollLockCount === 0) {
|
|
22
|
-
shellScrollLockPreviousValue = body.getAttribute("data-shell-scroll-lock");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
shellScrollLockCount += 1;
|
|
26
|
-
body.setAttribute("data-shell-scroll-lock", "true");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function releaseShellScrollLock(): void {
|
|
30
|
-
if (typeof document === "undefined" || shellScrollLockCount === 0) return;
|
|
31
|
-
|
|
32
|
-
shellScrollLockCount -= 1;
|
|
33
|
-
if (shellScrollLockCount > 0) return;
|
|
34
|
-
|
|
35
|
-
const body = document.body;
|
|
36
|
-
if (shellScrollLockPreviousValue === null) {
|
|
37
|
-
body.removeAttribute("data-shell-scroll-lock");
|
|
38
|
-
} else {
|
|
39
|
-
body.setAttribute("data-shell-scroll-lock", shellScrollLockPreviousValue);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
shellScrollLockPreviousValue = null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function isShellPanelChild(child: unknown, panelComponent: unknown): child is JSXElement {
|
|
46
|
-
return isJsxElement(child) && child.type === panelComponent;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function renderShellChildKey(child: unknown, index: number, keyPrefix: string): string {
|
|
50
|
-
return isJsxElement(child) && child.key != null ? String(child.key) : `${keyPrefix}-${index}`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function keyMissingShellChildren(children: unknown[], keyPrefix: string): unknown[] {
|
|
54
|
-
let keyedChildren: unknown[] | undefined;
|
|
55
|
-
|
|
56
|
-
for (let index = 0; index < children.length; index += 1) {
|
|
57
|
-
const child = children[index];
|
|
58
|
-
|
|
59
|
-
if (isJsxElement(child) && child.key == null) {
|
|
60
|
-
keyedChildren ??= children.slice(0, index);
|
|
61
|
-
keyedChildren.push({
|
|
62
|
-
...child,
|
|
63
|
-
key: `${keyPrefix}-${index}`,
|
|
64
|
-
});
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
keyedChildren?.push(child);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return keyedChildren ?? children;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function hasPanelProps(
|
|
75
|
-
props: Record<string, unknown> | undefined,
|
|
76
|
-
panelProps: ShellResponsivePanelProps,
|
|
77
|
-
): boolean {
|
|
78
|
-
return (
|
|
79
|
-
props?.active === panelProps.active &&
|
|
80
|
-
props?.collapseLabel === panelProps.collapseLabel &&
|
|
81
|
-
props?.onClose === panelProps.onClose &&
|
|
82
|
-
props?.open === panelProps.open &&
|
|
83
|
-
props?.panelId === panelProps.panelId
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function applyShellPanelProps(
|
|
88
|
-
children: unknown[],
|
|
89
|
-
keyPrefix: string,
|
|
90
|
-
panelProps: ShellResponsivePanelProps,
|
|
91
|
-
): unknown[] {
|
|
92
|
-
let panelChildren: unknown[] | undefined;
|
|
93
|
-
|
|
94
|
-
for (let index = 0; index < children.length; index += 1) {
|
|
95
|
-
const child = children[index];
|
|
96
|
-
|
|
97
|
-
if (!isJsxElement(child)) {
|
|
98
|
-
panelChildren?.push(child);
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const props = child.props as Record<string, unknown> | undefined;
|
|
103
|
-
|
|
104
|
-
if (hasPanelProps(props, panelProps)) {
|
|
105
|
-
panelChildren?.push(child);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
panelChildren ??= children.slice(0, index);
|
|
110
|
-
panelChildren.push({
|
|
111
|
-
...child,
|
|
112
|
-
key: child.key != null ? child.key : `${keyPrefix}-${index}`,
|
|
113
|
-
props: {
|
|
114
|
-
...props,
|
|
115
|
-
active: panelProps.active,
|
|
116
|
-
collapseLabel: panelProps.collapseLabel,
|
|
117
|
-
onClose: panelProps.onClose,
|
|
118
|
-
open: panelProps.open,
|
|
119
|
-
panelId: panelProps.panelId,
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return panelChildren ?? children;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function renderKeyedShellChildren(children: unknown, keyPrefix: string): JSX.Element {
|
|
128
|
-
const childList = toChildArray(children);
|
|
129
|
-
const keyedChildren = keyMissingShellChildren(childList, keyPrefix);
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<For
|
|
133
|
-
each={() => keyedChildren}
|
|
134
|
-
by={(child, index) => renderShellChildKey(child, index, keyPrefix)}
|
|
135
|
-
>
|
|
136
|
-
{(child) => child as never}
|
|
137
|
-
</For>
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function renderKeyedShellPanelChildren(
|
|
142
|
-
children: unknown,
|
|
143
|
-
keyPrefix: string,
|
|
144
|
-
panelProps: ShellResponsivePanelProps,
|
|
145
|
-
): JSX.Element {
|
|
146
|
-
const childList = toChildArray(children);
|
|
147
|
-
const keyedChildren = applyShellPanelProps(childList, keyPrefix, panelProps);
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<For
|
|
151
|
-
each={() => keyedChildren}
|
|
152
|
-
by={(child, index) => renderShellChildKey(child, index, keyPrefix)}
|
|
153
|
-
>
|
|
154
|
-
{(child) => child as never}
|
|
155
|
-
</For>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function ShellResponsiveWatcher<TBreakpoint extends string>(props: {
|
|
160
|
-
breakpoint: TBreakpoint;
|
|
161
|
-
isCollapsed: (breakpoint: TBreakpoint) => boolean;
|
|
162
|
-
onExpand: () => void;
|
|
163
|
-
onResize: (nextCollapsed: boolean) => void;
|
|
164
|
-
}): JSX.Element | null {
|
|
165
|
-
const { breakpoint, isCollapsed, onExpand, onResize } = props;
|
|
166
|
-
|
|
167
|
-
resource(
|
|
168
|
-
({ signal }: { signal: AbortSignal }) => {
|
|
169
|
-
const updateCollapsedState = () => {
|
|
170
|
-
const nextCollapsed = isCollapsed(breakpoint);
|
|
171
|
-
onResize(nextCollapsed);
|
|
172
|
-
|
|
173
|
-
if (!nextCollapsed) {
|
|
174
|
-
onExpand();
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
updateCollapsedState();
|
|
179
|
-
|
|
180
|
-
if (typeof window === "undefined") {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
window.addEventListener("resize", updateCollapsedState);
|
|
185
|
-
signal.addEventListener(
|
|
186
|
-
"abort",
|
|
187
|
-
() => {
|
|
188
|
-
window.removeEventListener("resize", updateCollapsedState);
|
|
189
|
-
},
|
|
190
|
-
{ once: true },
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
return null;
|
|
194
|
-
},
|
|
195
|
-
[breakpoint],
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export function ShellPanelWatcher(props: {
|
|
202
|
-
contentId?: string;
|
|
203
|
-
onClose: () => void;
|
|
204
|
-
open: boolean;
|
|
205
|
-
panelSlot: string;
|
|
206
|
-
}): JSX.Element | null {
|
|
207
|
-
const { contentId, onClose, open, panelSlot } = props;
|
|
208
|
-
|
|
209
|
-
resource(
|
|
210
|
-
({ signal }: { signal: AbortSignal }) => {
|
|
211
|
-
if (!open || typeof window === "undefined") {
|
|
212
|
-
releaseShellScrollLock();
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
217
|
-
if (event.key !== "Escape") {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
event.preventDefault();
|
|
222
|
-
onClose();
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
window.addEventListener("keydown", onKeyDown);
|
|
226
|
-
|
|
227
|
-
const focusFrame =
|
|
228
|
-
typeof window.requestAnimationFrame === "function"
|
|
229
|
-
? window.requestAnimationFrame(() => {
|
|
230
|
-
const content =
|
|
231
|
-
(typeof contentId === "string" ? document.getElementById(contentId) : null) ??
|
|
232
|
-
document.querySelector<HTMLElement>(
|
|
233
|
-
`[data-slot="${panelSlot}"][data-state="open"]`,
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
content?.focus({ preventScroll: true });
|
|
237
|
-
})
|
|
238
|
-
: undefined;
|
|
239
|
-
|
|
240
|
-
acquireShellScrollLock();
|
|
241
|
-
|
|
242
|
-
signal.addEventListener(
|
|
243
|
-
"abort",
|
|
244
|
-
() => {
|
|
245
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
246
|
-
|
|
247
|
-
if (focusFrame !== undefined && typeof window.cancelAnimationFrame === "function") {
|
|
248
|
-
window.cancelAnimationFrame(focusFrame);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
releaseShellScrollLock();
|
|
252
|
-
},
|
|
253
|
-
{ once: true },
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
return null;
|
|
257
|
-
},
|
|
258
|
-
[open],
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
return null;
|
|
262
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const SHELL_A11Y_CONTRACT = {
|
|
2
|
-
DATA_ATTRIBUTES: {
|
|
3
|
-
slot: "data-slot" as const,
|
|
4
|
-
layout: "data-ak-layout" as const,
|
|
5
|
-
variant: "data-variant" as const,
|
|
6
|
-
gap: "data-gap" as const,
|
|
7
|
-
},
|
|
8
|
-
SLOT_VALUES: {
|
|
9
|
-
root: "shell" as const,
|
|
10
|
-
nav: "shell-nav" as const,
|
|
11
|
-
main: "shell-main" as const,
|
|
12
|
-
},
|
|
13
|
-
VARIANT_VALUES: {
|
|
14
|
-
sidebar: "sidebar" as const,
|
|
15
|
-
topbar: "topbar" as const,
|
|
16
|
-
rail: "rail" as const,
|
|
17
|
-
},
|
|
18
|
-
} as const;
|
|
19
|
-
|
|
20
|
-
export type ShellA11yContract = typeof SHELL_A11Y_CONTRACT;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
-
import { classes } from "../_internal/classes";
|
|
3
|
-
import { mergeProps } from "../_internal/merge-props";
|
|
4
|
-
import type {
|
|
5
|
-
ShellAsChildProps,
|
|
6
|
-
ShellDivProps,
|
|
7
|
-
ShellMainAsChildProps,
|
|
8
|
-
ShellMainDivProps,
|
|
9
|
-
ShellMainMainProps,
|
|
10
|
-
ShellNavAsChildProps,
|
|
11
|
-
ShellNavDivProps,
|
|
12
|
-
} from "./shell.types";
|
|
13
|
-
|
|
14
|
-
export function Shell(props: ShellDivProps): JSX.Element;
|
|
15
|
-
export function Shell(props: ShellAsChildProps): JSX.Element;
|
|
16
|
-
export function Shell(props: ShellDivProps | ShellAsChildProps) {
|
|
17
|
-
const { asChild, children, class: className, variant = "sidebar", ref, ...rest } = props;
|
|
18
|
-
|
|
19
|
-
const finalProps = mergeProps(rest, {
|
|
20
|
-
ref,
|
|
21
|
-
class: classes("shell", className),
|
|
22
|
-
"data-slot": "shell",
|
|
23
|
-
"data-ak-layout": "true",
|
|
24
|
-
"data-variant": variant,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (asChild) {
|
|
28
|
-
return <Slot asChild {...finalProps} children={children as JSX.Element} />;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return <div {...finalProps}>{children}</div>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function ShellNav(props: ShellNavDivProps): JSX.Element;
|
|
35
|
-
export function ShellNav(props: ShellNavAsChildProps): JSX.Element;
|
|
36
|
-
export function ShellNav(props: ShellNavDivProps | ShellNavAsChildProps) {
|
|
37
|
-
const { asChild, children, class: className, ref, ...rest } = props;
|
|
38
|
-
const finalProps = mergeProps(rest, {
|
|
39
|
-
ref,
|
|
40
|
-
class: classes("shell-nav", className),
|
|
41
|
-
"data-slot": "shell-nav",
|
|
42
|
-
"data-ak-layout": "true",
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
if (asChild) {
|
|
46
|
-
return <Slot asChild {...finalProps} children={children as JSX.Element} />;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return <div {...finalProps}>{children}</div>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function ShellMain(props: ShellMainMainProps): JSX.Element;
|
|
53
|
-
export function ShellMain(props: ShellMainDivProps): JSX.Element;
|
|
54
|
-
export function ShellMain(props: ShellMainAsChildProps): JSX.Element;
|
|
55
|
-
export function ShellMain(props: ShellMainMainProps | ShellMainDivProps | ShellMainAsChildProps) {
|
|
56
|
-
const as = "as" in props ? props.as : "main";
|
|
57
|
-
const { asChild, children, class: className, ref, ...rest } = props;
|
|
58
|
-
const finalProps = mergeProps(rest, {
|
|
59
|
-
ref,
|
|
60
|
-
class: classes("shell-main", className),
|
|
61
|
-
"data-slot": "shell-main",
|
|
62
|
-
"data-ak-layout": "true",
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
if (asChild) {
|
|
66
|
-
return <Slot asChild {...finalProps} children={children as JSX.Element} />;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (as === "div") {
|
|
70
|
-
return <div {...finalProps}>{children}</div>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return <main {...finalProps}>{children}</main>;
|
|
74
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
2
|
-
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
|
-
|
|
4
|
-
export type ShellVariant = "sidebar" | "topbar" | "rail";
|
|
5
|
-
|
|
6
|
-
export type ShellOwnProps = {
|
|
7
|
-
variant?: ShellVariant;
|
|
8
|
-
class?: string;
|
|
9
|
-
children?: unknown;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type ShellDivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
13
|
-
ShellOwnProps & {
|
|
14
|
-
asChild?: false;
|
|
15
|
-
ref?: Ref<HTMLDivElement>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type ShellAsChildProps = Omit<ShellOwnProps, "as"> & {
|
|
19
|
-
asChild: true;
|
|
20
|
-
children: JSXElement;
|
|
21
|
-
ref?: Ref<unknown>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type ShellProps = ShellDivProps | ShellAsChildProps;
|
|
25
|
-
|
|
26
|
-
export type ShellNavOwnProps = {
|
|
27
|
-
class?: string;
|
|
28
|
-
children?: unknown;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type ShellNavDivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
32
|
-
ShellNavOwnProps & {
|
|
33
|
-
asChild?: false;
|
|
34
|
-
ref?: Ref<HTMLDivElement>;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type ShellNavAsChildProps = Omit<ShellNavOwnProps, "as"> & {
|
|
38
|
-
asChild: true;
|
|
39
|
-
children: JSXElement;
|
|
40
|
-
ref?: Ref<unknown>;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type ShellNavProps = ShellNavDivProps | ShellNavAsChildProps;
|
|
44
|
-
|
|
45
|
-
export type ShellMainOwnProps = {
|
|
46
|
-
as?: "main" | "div";
|
|
47
|
-
class?: string;
|
|
48
|
-
children?: unknown;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type ShellMainMainProps = Omit<JSX.IntrinsicElements["main"], "children" | "ref"> &
|
|
52
|
-
ShellMainOwnProps & {
|
|
53
|
-
as?: "main";
|
|
54
|
-
asChild?: false;
|
|
55
|
-
ref?: Ref<HTMLElement>;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type ShellMainDivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
59
|
-
ShellMainOwnProps & {
|
|
60
|
-
as: "div";
|
|
61
|
-
asChild?: false;
|
|
62
|
-
ref?: Ref<HTMLDivElement>;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export type ShellMainAsChildProps = Omit<ShellMainOwnProps, "as"> & {
|
|
66
|
-
asChild: true;
|
|
67
|
-
children: JSXElement;
|
|
68
|
-
ref?: Ref<unknown>;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export type ShellMainProps = ShellMainMainProps | ShellMainDivProps | ShellMainAsChildProps;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { readContext } from "@askrjs/askr";
|
|
2
|
-
import { renderShellPanel } from "../shell/shell-panel";
|
|
3
|
-
import { SidebarResponsiveContext } from "./sidebar.context";
|
|
4
|
-
import type { SidebarPanelProps } from "./sidebar.types";
|
|
5
|
-
|
|
6
|
-
const DEFAULT_SIDEBAR_RESPONSIVE_CONTEXT = {
|
|
7
|
-
active: () => false,
|
|
8
|
-
collapseLabel: () => "Menu",
|
|
9
|
-
closePanel: () => undefined,
|
|
10
|
-
iconCollapsed: () => false,
|
|
11
|
-
isRailCollapsible: () => false,
|
|
12
|
-
orientation: () => "vertical" as const,
|
|
13
|
-
panelId: () => undefined,
|
|
14
|
-
panelOpen: () => false,
|
|
15
|
-
togglePanel: () => undefined,
|
|
16
|
-
toggleRail: () => undefined,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function SidebarPanel(props: SidebarPanelProps): JSX.Element | null {
|
|
20
|
-
const {
|
|
21
|
-
active: activeProp,
|
|
22
|
-
brand,
|
|
23
|
-
children,
|
|
24
|
-
class: className,
|
|
25
|
-
collapseLabel: collapseLabelProp,
|
|
26
|
-
onClose,
|
|
27
|
-
open: openProp,
|
|
28
|
-
panelId: panelIdProp,
|
|
29
|
-
ref,
|
|
30
|
-
...rest
|
|
31
|
-
} = props;
|
|
32
|
-
const needsResponsiveContext =
|
|
33
|
-
activeProp === undefined ||
|
|
34
|
-
collapseLabelProp === undefined ||
|
|
35
|
-
onClose === undefined ||
|
|
36
|
-
openProp === undefined ||
|
|
37
|
-
panelIdProp === undefined;
|
|
38
|
-
const responsive = needsResponsiveContext
|
|
39
|
-
? (() => {
|
|
40
|
-
try {
|
|
41
|
-
return readContext(SidebarResponsiveContext);
|
|
42
|
-
} catch {
|
|
43
|
-
return DEFAULT_SIDEBAR_RESPONSIVE_CONTEXT;
|
|
44
|
-
}
|
|
45
|
-
})()
|
|
46
|
-
: DEFAULT_SIDEBAR_RESPONSIVE_CONTEXT;
|
|
47
|
-
const active = activeProp ?? responsive.active();
|
|
48
|
-
const open = openProp ?? responsive.panelOpen();
|
|
49
|
-
const panelId = panelIdProp ?? responsive.panelId();
|
|
50
|
-
const collapseLabel = collapseLabelProp ?? responsive.collapseLabel();
|
|
51
|
-
const closePanel = onClose ?? responsive.closePanel;
|
|
52
|
-
|
|
53
|
-
return renderShellPanel({
|
|
54
|
-
active,
|
|
55
|
-
brand,
|
|
56
|
-
children,
|
|
57
|
-
className,
|
|
58
|
-
collapseLabel,
|
|
59
|
-
dataOrientation: responsive.orientation(),
|
|
60
|
-
onClose: closePanel,
|
|
61
|
-
open,
|
|
62
|
-
panelId,
|
|
63
|
-
prefix: "sidebar",
|
|
64
|
-
ref,
|
|
65
|
-
rest,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { defineContext } from "@askrjs/askr";
|
|
2
|
-
|
|
3
|
-
export type SidebarContextValue = {
|
|
4
|
-
orientation: () => "vertical";
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type SidebarResponsiveContextValue = {
|
|
8
|
-
active: () => boolean;
|
|
9
|
-
collapseLabel: () => string;
|
|
10
|
-
closePanel: () => void;
|
|
11
|
-
iconCollapsed: () => boolean;
|
|
12
|
-
isRailCollapsible: () => boolean;
|
|
13
|
-
orientation: () => "vertical";
|
|
14
|
-
panelId: () => string | undefined;
|
|
15
|
-
panelOpen: () => boolean;
|
|
16
|
-
togglePanel: () => void;
|
|
17
|
-
toggleRail: () => void;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultOrientation = () => "vertical" as const;
|
|
21
|
-
|
|
22
|
-
const defaultResponsiveContext: SidebarResponsiveContextValue = {
|
|
23
|
-
active: () => false,
|
|
24
|
-
collapseLabel: () => "Menu",
|
|
25
|
-
closePanel: () => undefined,
|
|
26
|
-
iconCollapsed: () => false,
|
|
27
|
-
isRailCollapsible: () => false,
|
|
28
|
-
orientation: defaultOrientation,
|
|
29
|
-
panelId: () => undefined,
|
|
30
|
-
panelOpen: () => false,
|
|
31
|
-
togglePanel: () => undefined,
|
|
32
|
-
toggleRail: () => undefined,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const SidebarContext = defineContext<SidebarContextValue>({
|
|
36
|
-
orientation: defaultOrientation,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const SidebarResponsiveContext =
|
|
40
|
-
defineContext<SidebarResponsiveContextValue>(defaultResponsiveContext);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NAVBAR_COLLAPSE_BREAKPOINTS, isNavbarCollapsed } from "../navbar/navbar.shared";
|
|
2
|
-
import type { CollapseBreakpoint, Collapsible } from "../shell/shell-nav.types";
|
|
3
|
-
|
|
4
|
-
export { NAVBAR_COLLAPSE_BREAKPOINTS, isNavbarCollapsed };
|
|
5
|
-
|
|
6
|
-
export function resolveSidebarCollapsible(collapsible: Collapsible | undefined): Collapsible {
|
|
7
|
-
return collapsible ?? "none";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function isSidebarCollapsed(breakpoint: CollapseBreakpoint): boolean {
|
|
11
|
-
return isNavbarCollapsed(breakpoint);
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const SPACER_A11Y_CONTRACT = {
|
|
2
|
-
DATA_ATTRIBUTES: {
|
|
3
|
-
slot: "data-slot" as const,
|
|
4
|
-
axis: "data-axis" as const,
|
|
5
|
-
grow: "data-grow" as const,
|
|
6
|
-
shrink: "data-shrink" as const,
|
|
7
|
-
basis: "data-basis" as const,
|
|
8
|
-
},
|
|
9
|
-
SLOT_VALUES: {
|
|
10
|
-
root: "spacer" as const,
|
|
11
|
-
},
|
|
12
|
-
} as const;
|
|
13
|
-
|
|
14
|
-
export type SpacerA11yContract = typeof SPACER_A11Y_CONTRACT;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
-
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
-
import { isCssLength, mergeLayoutStyles } from "../_internal/layout";
|
|
4
|
-
import { styleDeclarationsToClass } from "../_internal/style";
|
|
5
|
-
import { isJsxElement, toChildArray } from "../_internal/jsx";
|
|
6
|
-
import type { SpacerAsChildProps, SpacerNativeProps } from "./spacer.types";
|
|
7
|
-
|
|
8
|
-
export function Spacer(props: SpacerNativeProps): JSX.Element;
|
|
9
|
-
export function Spacer(props: SpacerAsChildProps): JSX.Element;
|
|
10
|
-
export function Spacer(props: SpacerNativeProps | SpacerAsChildProps) {
|
|
11
|
-
const { asChild, children, grow, shrink, basis, axis, ref, style: userStyle, ...rest } = props;
|
|
12
|
-
|
|
13
|
-
const layoutStyle: Record<string, string | number> = {};
|
|
14
|
-
|
|
15
|
-
if (axis === "inline") {
|
|
16
|
-
if (shrink !== undefined && shrink !== 0) {
|
|
17
|
-
layoutStyle.flexShrink = shrink;
|
|
18
|
-
}
|
|
19
|
-
if (isCssLength(basis)) layoutStyle.width = basis!;
|
|
20
|
-
} else if (axis === "block") {
|
|
21
|
-
if (shrink !== undefined && shrink !== 0) {
|
|
22
|
-
layoutStyle.flexShrink = shrink;
|
|
23
|
-
}
|
|
24
|
-
if (isCssLength(basis)) layoutStyle.height = basis!;
|
|
25
|
-
} else {
|
|
26
|
-
if (grow !== undefined && grow !== 1) {
|
|
27
|
-
layoutStyle.flexGrow = grow;
|
|
28
|
-
}
|
|
29
|
-
if (shrink !== undefined && shrink !== 1) {
|
|
30
|
-
layoutStyle.flexShrink = shrink;
|
|
31
|
-
}
|
|
32
|
-
if (isCssLength(basis)) {
|
|
33
|
-
layoutStyle.flexBasis = basis!;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const layoutClass = styleDeclarationsToClass(mergeLayoutStyles(layoutStyle, userStyle));
|
|
38
|
-
|
|
39
|
-
const finalProps = mergeProps(rest, {
|
|
40
|
-
ref,
|
|
41
|
-
"data-slot": "spacer",
|
|
42
|
-
"data-axis": axis,
|
|
43
|
-
...(layoutClass ? { class: layoutClass } : {}),
|
|
44
|
-
});
|
|
45
|
-
const keyedChildren = toChildArray(children).map((child, index) => {
|
|
46
|
-
if (!isJsxElement(child) || child.key != null) {
|
|
47
|
-
return child;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
...child,
|
|
52
|
-
key: `spacer-${index}`,
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (asChild) {
|
|
57
|
-
return <Slot asChild {...finalProps} children={children} />;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return <div {...finalProps}>{keyedChildren}</div>;
|
|
61
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
2
|
-
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
|
-
|
|
4
|
-
export type SpacerAxis = "inline" | "block";
|
|
5
|
-
|
|
6
|
-
export type SpacerOwnProps = {
|
|
7
|
-
/** flex-grow factor (default 1 when no axis is set). */
|
|
8
|
-
grow?: number;
|
|
9
|
-
/** flex-shrink factor (default 1 when no axis is set, 0 when axis is set). */
|
|
10
|
-
shrink?: number;
|
|
11
|
-
/** CSS flex-basis / width (axis=inline) / height (axis=block) value. */
|
|
12
|
-
basis?: string;
|
|
13
|
-
/** When set, renders a fixed space along the given axis instead of a flex-grow spacer. */
|
|
14
|
-
axis?: SpacerAxis;
|
|
15
|
-
children?: unknown;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type SpacerNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
19
|
-
SpacerOwnProps & {
|
|
20
|
-
asChild?: false;
|
|
21
|
-
ref?: Ref<HTMLDivElement>;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type SpacerAsChildProps = SpacerOwnProps & {
|
|
25
|
-
asChild: true;
|
|
26
|
-
children: JSXElement;
|
|
27
|
-
ref?: Ref<unknown>;
|
|
28
|
-
style?: JSX.IntrinsicElements["div"]["style"];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type SpacerProps = SpacerNativeProps | SpacerAsChildProps;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const STACK_A11Y_CONTRACT = {
|
|
2
|
-
DATA_ATTRIBUTES: {
|
|
3
|
-
slot: "data-slot" as const,
|
|
4
|
-
layout: "data-ak-layout" as const,
|
|
5
|
-
gap: "data-gap" as const,
|
|
6
|
-
align: "data-align" as const,
|
|
7
|
-
justify: "data-justify" as const,
|
|
8
|
-
wrap: "data-wrap" as const,
|
|
9
|
-
},
|
|
10
|
-
SLOT_VALUES: {
|
|
11
|
-
root: "stack" as const,
|
|
12
|
-
},
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
export type StackA11yContract = typeof STACK_A11Y_CONTRACT;
|