@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
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JSXElement } from "@askrjs/askr/foundations";
|
|
3
|
-
import { Ref } from "@askrjs/askr/foundations/utilities";
|
|
4
|
-
|
|
1
|
+
import { BlockElementProps } from "../block/block.types.js";
|
|
5
2
|
//#region src/components/section/section.types.d.ts
|
|
6
|
-
type
|
|
7
|
-
size?: LayoutResponsive<"1" | "2" | "3" | "4">;
|
|
8
|
-
children?: unknown;
|
|
9
|
-
};
|
|
10
|
-
type SectionElementProps = Omit<JSX.IntrinsicElements["section"], "children" | "ref"> & SectionOwnProps & {
|
|
11
|
-
asChild?: false;
|
|
12
|
-
ref?: Ref<HTMLElement>;
|
|
13
|
-
};
|
|
14
|
-
type SectionAsChildProps = SectionOwnProps & {
|
|
15
|
-
asChild: true;
|
|
16
|
-
children: JSXElement;
|
|
17
|
-
ref?: Ref<unknown>;
|
|
18
|
-
style?: JSX.IntrinsicElements["section"]["style"];
|
|
19
|
-
};
|
|
20
|
-
type SectionProps = SectionElementProps | SectionAsChildProps;
|
|
3
|
+
type SectionProps = Omit<BlockElementProps<"section">, "as">;
|
|
21
4
|
//#endregion
|
|
22
|
-
export {
|
|
5
|
+
export { SectionProps };
|
|
23
6
|
//# sourceMappingURL=section.types.d.ts.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { SeparatorAsChildProps, SeparatorNativeProps, SeparatorOwnProps, SeparatorProps } from "./separator.types.js";
|
|
2
|
-
import { Separator } from "./separator.js";
|
|
3
|
-
import { SEPARATOR_A11Y_CONTRACT, SeparatorA11yContract } from "./separator.a11y.js";
|
|
2
|
+
import { Separator } from "./separator.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SidebarButtonProps, SidebarCollapsible, SidebarPartProps, SidebarProps, SidebarSide, SidebarTooltipSide, SidebarVariant } from "./sidebar.types.js";
|
|
2
|
+
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarRail, SidebarTrigger } from "./sidebar.js";
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
import { SidebarProps } from "./sidebar.types.js";
|
|
1
|
+
import { SidebarButtonProps, SidebarPartProps, SidebarProps } from "./sidebar.types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/components/sidebar/sidebar.d.ts
|
|
4
4
|
declare function Sidebar(props: SidebarProps): JSX.Element;
|
|
5
|
+
declare function SidebarProvider(props: SidebarPartProps): JSX.Element;
|
|
6
|
+
declare function SidebarInset(props: SidebarPartProps): JSX.Element;
|
|
7
|
+
declare function SidebarContent(props: SidebarPartProps): JSX.Element;
|
|
8
|
+
declare function SidebarHeader(props: SidebarPartProps): JSX.Element;
|
|
9
|
+
declare function SidebarFooter(props: SidebarPartProps): JSX.Element;
|
|
10
|
+
declare function SidebarGroup(props: SidebarPartProps): JSX.Element;
|
|
11
|
+
declare function SidebarGroupLabel(props: SidebarPartProps): JSX.Element;
|
|
12
|
+
declare function SidebarGroupContent(props: SidebarPartProps): JSX.Element;
|
|
13
|
+
declare function SidebarMenu(props: SidebarPartProps): JSX.Element;
|
|
14
|
+
declare function SidebarMenuItem(props: SidebarPartProps): JSX.Element;
|
|
15
|
+
declare function SidebarMenuButton(props: SidebarButtonProps): JSX.Element;
|
|
16
|
+
declare function SidebarMenuAction(props: SidebarButtonProps): JSX.Element;
|
|
17
|
+
declare function SidebarMenuBadge(props: SidebarPartProps): JSX.Element;
|
|
18
|
+
declare function SidebarRail(props: SidebarPartProps): JSX.Element;
|
|
19
|
+
declare function SidebarTrigger(props: SidebarButtonProps): JSX.Element;
|
|
5
20
|
//#endregion
|
|
6
|
-
export { Sidebar };
|
|
21
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarRail, SidebarTrigger };
|
|
7
22
|
//# sourceMappingURL=sidebar.d.ts.map
|
|
@@ -1,228 +1,132 @@
|
|
|
1
1
|
import { classes } from "../_internal/classes.js";
|
|
2
2
|
import { mergeProps } from "../_internal/merge-props.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { SidebarContext, SidebarResponsiveContext } from "./sidebar.context.js";
|
|
7
|
-
import { SidebarPanel } from "./sidebar-panel.js";
|
|
8
|
-
import { SidebarToggle } from "./sidebar-toggle.js";
|
|
9
|
-
import { isSidebarCollapsed, resolveSidebarCollapsible } from "./sidebar.shared.js";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "@askrjs/askr/jsx-runtime";
|
|
11
|
-
import { state } from "@askrjs/askr";
|
|
3
|
+
import { Block } from "../block/block.js";
|
|
4
|
+
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
5
|
+
import { Slot } from "@askrjs/askr/foundations";
|
|
12
6
|
//#region src/components/sidebar/sidebar.tsx
|
|
13
|
-
function
|
|
14
|
-
const brandIndex = children.findIndex((child) => isJsxElement(child) && child.type === NavBrand);
|
|
15
|
-
if (brandIndex === -1) return { items: children };
|
|
7
|
+
function sidebarTooltipProps(tooltip, tooltipSide) {
|
|
16
8
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
"data-tooltip": tooltip,
|
|
10
|
+
"data-tooltip-side": tooltip ? tooltipSide : void 0
|
|
19
11
|
};
|
|
20
12
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function renderSidebarMenuContents(label, icon, iconPlacement) {
|
|
34
|
-
const renderedIcon = /* @__PURE__ */ jsx("span", {
|
|
35
|
-
class: "sidebar-toggle-icon",
|
|
36
|
-
"data-slot": "sidebar-toggle-icon",
|
|
37
|
-
"aria-hidden": "true",
|
|
38
|
-
children: icon ?? /* @__PURE__ */ jsxs("span", {
|
|
39
|
-
class: "sidebar-toggle-glyph sidebar-toggle-glyph--menu",
|
|
40
|
-
children: [
|
|
41
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
42
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
43
|
-
/* @__PURE__ */ jsx("span", {})
|
|
44
|
-
]
|
|
45
|
-
})
|
|
13
|
+
function sidebarPart(props, slot, element = "div") {
|
|
14
|
+
const { as, asChild, children, class: className, ...rest } = props;
|
|
15
|
+
const Element = as ?? element;
|
|
16
|
+
const finalProps = mergeProps(rest, {
|
|
17
|
+
class: className,
|
|
18
|
+
"data-slot": slot
|
|
19
|
+
});
|
|
20
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
21
|
+
asChild: true,
|
|
22
|
+
...finalProps,
|
|
23
|
+
children
|
|
46
24
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children: label
|
|
25
|
+
return /* @__PURE__ */ jsx(Element, {
|
|
26
|
+
...finalProps,
|
|
27
|
+
children
|
|
51
28
|
});
|
|
52
|
-
if (iconPlacement === "end") return /* @__PURE__ */ jsxs(Fragment, { children: [renderedLabel, renderedIcon] });
|
|
53
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [renderedIcon, renderedLabel] });
|
|
54
|
-
}
|
|
55
|
-
function renderSidebarRailContents(label, collapsed, toggle) {
|
|
56
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
-
class: "sidebar-rail-toggle-icon",
|
|
58
|
-
"data-slot": "sidebar-rail-toggle-icon",
|
|
59
|
-
"aria-hidden": "true",
|
|
60
|
-
children: (collapsed ? toggle?.collapsedIcon : toggle?.expandedIcon) ?? /* @__PURE__ */ jsx("span", { class: classes("sidebar-toggle-glyph", "sidebar-toggle-glyph--rail", collapsed ? "is-collapsed" : "is-expanded") })
|
|
61
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
62
|
-
class: "sidebar-rail-toggle-label",
|
|
63
|
-
"data-slot": "sidebar-rail-toggle-label",
|
|
64
|
-
children: label
|
|
65
|
-
})] });
|
|
66
29
|
}
|
|
67
30
|
function Sidebar(props) {
|
|
68
|
-
const { children,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
togglePanel: toggleDrawer,
|
|
118
|
-
toggleRail
|
|
119
|
-
};
|
|
120
|
-
const panelContext = {
|
|
121
|
-
active: isResponsive,
|
|
122
|
-
collapseLabel: effectiveCollapseLabel,
|
|
123
|
-
onClose: closeDrawer,
|
|
124
|
-
open: isDrawerOpen,
|
|
125
|
-
panelId
|
|
126
|
-
};
|
|
127
|
-
const panels = explicitPanelItems.length > 0 ? renderKeyedShellPanelChildren(explicitPanelItems, "sidebar-panel", panelContext) : isResponsive ? /* @__PURE__ */ jsx(SidebarPanel, {
|
|
128
|
-
active: isResponsive,
|
|
129
|
-
brand: drawerBrand,
|
|
130
|
-
collapseLabel: effectiveCollapseLabel,
|
|
131
|
-
onClose: closeDrawer,
|
|
132
|
-
onClick: closeDrawerOnNavActivation,
|
|
133
|
-
open: isDrawerOpen,
|
|
134
|
-
panelId,
|
|
135
|
-
children: drawerChildren
|
|
136
|
-
}) : null;
|
|
31
|
+
const { children, collapsible = "offcanvas", side = "left", variant = "sidebar", width = "sidebar", shrink = false, ...rest } = props;
|
|
32
|
+
return /* @__PURE__ */ jsx(Block, {
|
|
33
|
+
as: "aside",
|
|
34
|
+
width,
|
|
35
|
+
shrink,
|
|
36
|
+
minHeight: "screen",
|
|
37
|
+
padding: "md",
|
|
38
|
+
gap: "lg",
|
|
39
|
+
borderRight: true,
|
|
40
|
+
...rest,
|
|
41
|
+
"data-collapsible": collapsible,
|
|
42
|
+
"data-side": side,
|
|
43
|
+
"data-slot": "sidebar",
|
|
44
|
+
"data-variant": variant,
|
|
45
|
+
children
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function SidebarProvider(props) {
|
|
49
|
+
return sidebarPart(props, "sidebar-provider");
|
|
50
|
+
}
|
|
51
|
+
function SidebarInset(props) {
|
|
52
|
+
return sidebarPart(props, "sidebar-inset", "main");
|
|
53
|
+
}
|
|
54
|
+
function SidebarContent(props) {
|
|
55
|
+
return sidebarPart(props, "sidebar-content");
|
|
56
|
+
}
|
|
57
|
+
function SidebarHeader(props) {
|
|
58
|
+
return sidebarPart(props, "sidebar-header");
|
|
59
|
+
}
|
|
60
|
+
function SidebarFooter(props) {
|
|
61
|
+
return sidebarPart(props, "sidebar-footer");
|
|
62
|
+
}
|
|
63
|
+
function SidebarGroup(props) {
|
|
64
|
+
return sidebarPart(props, "sidebar-group");
|
|
65
|
+
}
|
|
66
|
+
function SidebarGroupLabel(props) {
|
|
67
|
+
return sidebarPart(props, "sidebar-group-label");
|
|
68
|
+
}
|
|
69
|
+
function SidebarGroupContent(props) {
|
|
70
|
+
return sidebarPart(props, "sidebar-group-content");
|
|
71
|
+
}
|
|
72
|
+
function SidebarMenu(props) {
|
|
73
|
+
return sidebarPart(props, "sidebar-menu", "ul");
|
|
74
|
+
}
|
|
75
|
+
function SidebarMenuItem(props) {
|
|
76
|
+
return sidebarPart(props, "sidebar-menu-item", "li");
|
|
77
|
+
}
|
|
78
|
+
function SidebarMenuButton(props) {
|
|
79
|
+
const { active, asChild, children, class: className, size, tooltip, tooltipSide, type = "button", variant, ...rest } = props;
|
|
137
80
|
const finalProps = mergeProps(rest, {
|
|
138
|
-
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
"data-
|
|
142
|
-
|
|
143
|
-
"data-
|
|
144
|
-
"data-mobile-open": isResponsive ? drawerOpen ? "true" : "false" : void 0,
|
|
145
|
-
"data-orientation": "vertical",
|
|
146
|
-
"data-responsive-collapsed": isMobile ? "true" : "false",
|
|
147
|
-
"data-slot": "sidebar"
|
|
81
|
+
class: classes(className),
|
|
82
|
+
"data-active": active ? "true" : void 0,
|
|
83
|
+
"data-size": size && size !== "default" ? size : void 0,
|
|
84
|
+
"data-slot": "sidebar-menu-button",
|
|
85
|
+
...sidebarTooltipProps(tooltip, tooltipSide),
|
|
86
|
+
"data-variant": variant && variant !== "default" ? variant : void 0
|
|
148
87
|
});
|
|
149
|
-
return /* @__PURE__ */ jsx(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
children: renderSidebarRailContents(effectiveCollapseLabel, isRailCollapsed, railToggleConfig)
|
|
189
|
-
})
|
|
190
|
-
}) : null, desktopChildren]
|
|
191
|
-
}),
|
|
192
|
-
panels,
|
|
193
|
-
isResponsive && isDrawerOpen ? /* @__PURE__ */ jsx("button", {
|
|
194
|
-
"aria-label": `Close ${effectiveCollapseLabel}`,
|
|
195
|
-
class: "sidebar-backdrop",
|
|
196
|
-
"data-slot": "sidebar-backdrop",
|
|
197
|
-
"data-state": "open",
|
|
198
|
-
tabIndex: -1,
|
|
199
|
-
type: "button",
|
|
200
|
-
onClick: closeDrawer
|
|
201
|
-
}) : null,
|
|
202
|
-
isResponsive ? /* @__PURE__ */ jsx(ShellResponsiveWatcher, {
|
|
203
|
-
breakpoint,
|
|
204
|
-
isCollapsed: isSidebarCollapsed,
|
|
205
|
-
onResize: (nextCollapsed) => {
|
|
206
|
-
responsiveCollapsedState.set(nextCollapsed);
|
|
207
|
-
},
|
|
208
|
-
onExpand: () => {
|
|
209
|
-
drawerOpenState.set(false);
|
|
210
|
-
}
|
|
211
|
-
}) : null,
|
|
212
|
-
/* @__PURE__ */ jsx(ShellPanelWatcher, {
|
|
213
|
-
contentId: panelId,
|
|
214
|
-
open: isDrawerOpen,
|
|
215
|
-
panelSlot: "sidebar-panel",
|
|
216
|
-
onClose: () => {
|
|
217
|
-
closeDrawer();
|
|
218
|
-
}
|
|
219
|
-
})
|
|
220
|
-
]
|
|
221
|
-
})
|
|
222
|
-
})
|
|
88
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
89
|
+
asChild: true,
|
|
90
|
+
...finalProps,
|
|
91
|
+
children
|
|
92
|
+
});
|
|
93
|
+
return /* @__PURE__ */ jsx("button", {
|
|
94
|
+
type,
|
|
95
|
+
...finalProps,
|
|
96
|
+
children
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function SidebarMenuAction(props) {
|
|
100
|
+
const { children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
|
|
101
|
+
return /* @__PURE__ */ jsx("button", {
|
|
102
|
+
type,
|
|
103
|
+
...mergeProps(rest, {
|
|
104
|
+
class: classes(className),
|
|
105
|
+
"data-slot": "sidebar-menu-action",
|
|
106
|
+
...sidebarTooltipProps(tooltip, tooltipSide)
|
|
107
|
+
}),
|
|
108
|
+
children
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function SidebarMenuBadge(props) {
|
|
112
|
+
return sidebarPart(props, "sidebar-menu-badge", "span");
|
|
113
|
+
}
|
|
114
|
+
function SidebarRail(props) {
|
|
115
|
+
return sidebarPart(props, "sidebar-rail", "button");
|
|
116
|
+
}
|
|
117
|
+
function SidebarTrigger(props) {
|
|
118
|
+
const { children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
|
|
119
|
+
return /* @__PURE__ */ jsx("button", {
|
|
120
|
+
type,
|
|
121
|
+
...mergeProps(rest, {
|
|
122
|
+
class: classes("btn btn-ghost btn-icon", className),
|
|
123
|
+
"data-slot": "sidebar-trigger",
|
|
124
|
+
...sidebarTooltipProps(tooltip, tooltipSide)
|
|
125
|
+
}),
|
|
126
|
+
children
|
|
223
127
|
});
|
|
224
128
|
}
|
|
225
129
|
//#endregion
|
|
226
|
-
export { Sidebar };
|
|
130
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarRail, SidebarTrigger };
|
|
227
131
|
|
|
228
132
|
//# sourceMappingURL=sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","names":[],"sources":["../../../src/components/sidebar/sidebar.tsx"],"sourcesContent":["import { state } from \"@askrjs/askr\";\nimport { classes } from \"../_internal/classes\";\nimport { isJsxElement, toChildArray } from \"../_internal/jsx\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { NavBrand } from \"../navbar/navbar\";\nimport {\n isShellPanelChild,\n renderKeyedShellChildren,\n renderKeyedShellPanelChildren,\n ShellPanelWatcher,\n ShellResponsiveWatcher,\n} from \"../shell/shell-responsive\";\nimport { SidebarContext, SidebarResponsiveContext } from \"./sidebar.context\";\nimport { SidebarPanel } from \"./sidebar-panel\";\nimport { SidebarToggle } from \"./sidebar-toggle\";\nimport { isSidebarCollapsed, resolveSidebarCollapsible } from \"./sidebar.shared\";\nimport type { SidebarProps } from \"./sidebar.types\";\nimport type { CollapseIconPlacement } from \"../shell/shell-nav.types\";\n\ntype SidebarChildren = {\n brand?: unknown;\n items: unknown[];\n};\n\ntype SidebarToggleConfig = {\n collapsedIcon?: unknown;\n expandedIcon?: unknown;\n};\n\nfunction splitSidebarChildren(children: unknown[]): SidebarChildren {\n const brandIndex = children.findIndex((child) => isJsxElement(child) && child.type === NavBrand);\n\n if (brandIndex === -1) {\n return { items: children };\n }\n\n return {\n brand: children[brandIndex],\n items: children.filter((_, index) => index !== brandIndex),\n };\n}\n\nfunction isSidebarToggleChild(child: unknown): boolean {\n return isJsxElement(child) && child.type === SidebarToggle;\n}\n\nfunction splitSidebarToggle(children: unknown[]): {\n items: unknown[];\n toggle?: SidebarToggleConfig;\n} {\n const toggleIndex = children.findIndex((child) => isSidebarToggleChild(child));\n\n if (toggleIndex === -1) {\n return { items: children };\n }\n\n const toggleChild = children[toggleIndex] as { props?: SidebarToggleConfig } | undefined;\n\n return {\n items: children.filter((_, index) => index !== toggleIndex),\n toggle: toggleChild?.props,\n };\n}\n\nfunction renderSidebarMenuContents(\n label: string,\n icon: unknown,\n iconPlacement: CollapseIconPlacement,\n): JSX.Element {\n const renderedIcon = (\n <span class=\"sidebar-toggle-icon\" data-slot=\"sidebar-toggle-icon\" aria-hidden=\"true\">\n {icon ?? (\n <span class=\"sidebar-toggle-glyph sidebar-toggle-glyph--menu\">\n <span />\n <span />\n <span />\n </span>\n )}\n </span>\n );\n const renderedLabel = (\n <span class=\"sidebar-toggle-label\" data-slot=\"sidebar-toggle-label\">\n {label}\n </span>\n );\n\n if (iconPlacement === \"end\") {\n return (\n <>\n {renderedLabel}\n {renderedIcon}\n </>\n );\n }\n\n return (\n <>\n {renderedIcon}\n {renderedLabel}\n </>\n );\n}\n\nfunction renderSidebarRailContents(\n label: string,\n collapsed: boolean,\n toggle: SidebarToggleConfig | undefined,\n): JSX.Element {\n const icon = collapsed ? toggle?.collapsedIcon : toggle?.expandedIcon;\n\n return (\n <>\n <span\n class=\"sidebar-rail-toggle-icon\"\n data-slot=\"sidebar-rail-toggle-icon\"\n aria-hidden=\"true\"\n >\n {icon ?? (\n <span\n class={classes(\n \"sidebar-toggle-glyph\",\n \"sidebar-toggle-glyph--rail\",\n collapsed ? \"is-collapsed\" : \"is-expanded\",\n )}\n />\n )}\n </span>\n <span class=\"sidebar-rail-toggle-label\" data-slot=\"sidebar-rail-toggle-label\">\n {label}\n </span>\n </>\n );\n}\n\nexport function Sidebar(props: SidebarProps): JSX.Element {\n const {\n children,\n collapsed: controlledCollapsed,\n breakpoint,\n collapseIcon,\n collapseIconPlacement = \"start\",\n collapseLabel,\n collapsible,\n defaultCollapsed = false,\n id,\n \"aria-label\": ariaLabel,\n onCollapsedChange,\n class: className,\n ref,\n ...rest\n } = props;\n const effectiveCollapseLabel =\n collapseLabel ?? (typeof ariaLabel === \"string\" ? ariaLabel : undefined) ?? \"Menu\";\n const childItems = toChildArray(children);\n const explicitPanelItems = childItems.filter((child) => isShellPanelChild(child, SidebarPanel));\n const contentItems = childItems.filter((child) => !isShellPanelChild(child, SidebarPanel));\n const isResponsive = breakpoint !== undefined;\n const responsiveCollapsedState = state(isResponsive ? isSidebarCollapsed(breakpoint) : false);\n const drawerOpenState = state(false);\n const panelId = typeof id === \"string\" ? `${id}-panel` : undefined;\n const collapseBehavior = resolveSidebarCollapsible(collapsible);\n const isRailCollapsible = collapseBehavior === \"icon\";\n const railCollapsedState = state(defaultCollapsed);\n const responsiveCollapsed = responsiveCollapsedState();\n const drawerOpen = drawerOpenState();\n const internalRailCollapsed = railCollapsedState();\n const isMobile = isResponsive ? responsiveCollapsed : false;\n const isDrawerOpen = isResponsive && isMobile && drawerOpen;\n const isRailCollapsed = isRailCollapsible\n ? (controlledCollapsed ?? internalRailCollapsed ?? false)\n : false;\n const closeDrawer = () => drawerOpenState.set(false);\n const closeDrawerOnNavActivation = (event: MouseEvent) => {\n const target = event.target;\n\n if (!(target instanceof Element)) {\n return;\n }\n\n if (target.closest('a[data-slot=\"nav-link\"], a[data-slot=\"nav-item\"], a.navbar-item')) {\n closeDrawer();\n }\n };\n const toggleDrawer = () => {\n drawerOpenState.set(!drawerOpenState());\n };\n const setRailCollapsed = (nextCollapsed: boolean) => {\n if (!isRailCollapsible) {\n return;\n }\n\n if (controlledCollapsed === undefined) {\n railCollapsedState.set(nextCollapsed);\n }\n\n onCollapsedChange?.(nextCollapsed);\n };\n const toggleRail = () => {\n if (!isRailCollapsible) {\n return;\n }\n\n setRailCollapsed(!isRailCollapsed);\n };\n const { items: drawerSourceItems, toggle: railToggleConfig } = splitSidebarToggle(contentItems);\n const { brand: drawerBrand, items: drawerItems } = splitSidebarChildren(drawerSourceItems);\n const desktopChildren = renderKeyedShellChildren(drawerSourceItems, \"sidebar-desktop\");\n const drawerChildren = renderKeyedShellChildren(drawerItems, \"sidebar-drawer\");\n\n const contextValue = {\n active: () => isResponsive,\n collapseLabel: () => effectiveCollapseLabel,\n closePanel: closeDrawer,\n iconCollapsed: () => isRailCollapsed,\n isRailCollapsible: () => isRailCollapsible,\n orientation: () => \"vertical\" as const,\n panelId: () => panelId,\n panelOpen: () => isDrawerOpen,\n togglePanel: toggleDrawer,\n toggleRail,\n };\n const panelContext = {\n active: isResponsive,\n collapseLabel: effectiveCollapseLabel,\n onClose: closeDrawer,\n open: isDrawerOpen,\n panelId,\n };\n const panels =\n explicitPanelItems.length > 0 ? (\n renderKeyedShellPanelChildren(explicitPanelItems, \"sidebar-panel\", panelContext)\n ) : isResponsive ? (\n <SidebarPanel\n active={isResponsive}\n brand={drawerBrand}\n collapseLabel={effectiveCollapseLabel}\n onClose={closeDrawer}\n onClick={closeDrawerOnNavActivation}\n open={isDrawerOpen}\n panelId={panelId}\n >\n {drawerChildren}\n </SidebarPanel>\n ) : null;\n\n const finalProps = mergeProps(rest, {\n ref,\n \"aria-label\": ariaLabel,\n class: classes(\"sidebar\", className),\n \"data-collapse-below\": breakpoint,\n \"data-collapsible\": collapseBehavior === \"none\" ? undefined : collapseBehavior,\n \"data-icon-collapsed\": isRailCollapsible ? (isRailCollapsed ? \"true\" : \"false\") : undefined,\n \"data-mobile-open\": isResponsive ? (drawerOpen ? \"true\" : \"false\") : undefined,\n \"data-orientation\": \"vertical\",\n \"data-responsive-collapsed\": isMobile ? \"true\" : \"false\",\n \"data-slot\": \"sidebar\",\n });\n\n return (\n <SidebarContext.Scope value={{ orientation: () => \"vertical\" as const }}>\n <SidebarResponsiveContext.Scope value={contextValue}>\n <nav {...finalProps}>\n {isResponsive ? (\n <div class=\"sidebar-mobile\" data-slot=\"sidebar-mobile\">\n <button\n aria-controls={panelId}\n aria-expanded={isDrawerOpen ? \"true\" : \"false\"}\n aria-label={effectiveCollapseLabel}\n class=\"sidebar-toggle\"\n data-slot=\"sidebar-toggle\"\n data-state={isDrawerOpen ? \"open\" : \"closed\"}\n data-variant=\"mobile\"\n type=\"button\"\n onClick={toggleDrawer}\n >\n {renderSidebarMenuContents(\n effectiveCollapseLabel,\n collapseIcon,\n collapseIconPlacement,\n )}\n </button>\n </div>\n ) : null}\n\n <div class=\"sidebar-shell\" data-orientation=\"vertical\" data-slot=\"sidebar-shell\">\n {isRailCollapsible && !isMobile ? (\n <div\n class=\"sidebar-rail\"\n data-slot=\"sidebar-rail\"\n data-state={isRailCollapsed ? \"collapsed\" : \"expanded\"}\n >\n <button\n aria-expanded={isRailCollapsed ? \"false\" : \"true\"}\n aria-label={\n isRailCollapsed\n ? `Expand ${effectiveCollapseLabel}`\n : `Collapse ${effectiveCollapseLabel}`\n }\n class=\"sidebar-rail-toggle\"\n data-slot=\"sidebar-rail-toggle\"\n data-state={isRailCollapsed ? \"collapsed\" : \"expanded\"}\n type=\"button\"\n onClick={toggleRail}\n >\n {renderSidebarRailContents(\n effectiveCollapseLabel,\n isRailCollapsed,\n railToggleConfig,\n )}\n </button>\n </div>\n ) : null}\n {desktopChildren}\n </div>\n\n {panels}\n\n {isResponsive && isDrawerOpen ? (\n <button\n aria-label={`Close ${effectiveCollapseLabel}`}\n class=\"sidebar-backdrop\"\n data-slot=\"sidebar-backdrop\"\n data-state=\"open\"\n tabIndex={-1}\n type=\"button\"\n onClick={closeDrawer}\n />\n ) : null}\n\n {isResponsive ? (\n <ShellResponsiveWatcher\n breakpoint={breakpoint}\n isCollapsed={isSidebarCollapsed}\n onResize={(nextCollapsed) => {\n responsiveCollapsedState.set(nextCollapsed);\n }}\n onExpand={() => {\n drawerOpenState.set(false);\n }}\n />\n ) : null}\n\n <ShellPanelWatcher\n contentId={panelId}\n open={isDrawerOpen}\n panelSlot=\"sidebar-panel\"\n onClose={() => {\n closeDrawer();\n }}\n />\n </nav>\n </SidebarResponsiveContext.Scope>\n </SidebarContext.Scope>\n );\n}\n"],"mappings":";;;;;;;;;;;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pE,oBAAC,yBAAyB,OAA1B;GAAgC,OAAO;aACrC,qBAAC,OAAD;IAAK,GAAI;cAAT;KACG,eACC,oBAAC,OAAD;MAAK,OAAM;MAAiB,aAAU;gBACpC,oBAAC,UAAD;OACE,iBAAe;OACf,iBAAe,eAAe,SAAS;OACvC,cAAY;OACZ,OAAM;OACN,aAAU;OACV,cAAY,eAAe,SAAS;OACpC,gBAAa;OACb,MAAK;OACL,SAAS;iBAER,0BACC,wBACA,cACA,qBACF;MACM,CAAA;KACL,CAAA,IACH;KAEJ,qBAAC,OAAD;MAAK,OAAM;MAAgB,oBAAiB;MAAW,aAAU;gBAAjE,CACG,qBAAqB,CAAC,WACrB,oBAAC,OAAD;OACE,OAAM;OACN,aAAU;OACV,cAAY,kBAAkB,cAAc;iBAE5C,oBAAC,UAAD;QACE,iBAAe,kBAAkB,UAAU;QAC3C,cACE,kBACI,UAAU,2BACV,YAAY;QAElB,OAAM;QACN,aAAU;QACV,cAAY,kBAAkB,cAAc;QAC5C,MAAK;QACL,SAAS;kBAER,0BACC,wBACA,iBACA,gBACF;OACM,CAAA;MACL,CAAA,IACH,MACH,eACE;;KAEJ;KAEA,gBAAgB,eACf,oBAAC,UAAD;MACE,cAAY,SAAS;MACrB,OAAM;MACN,aAAU;MACV,cAAW;MACX,UAAU;MACV,MAAK;MACL,SAAS;KACV,CAAA,IACC;KAEH,eACC,oBAAC,wBAAD;MACc;MACZ,aAAa;MACb,WAAW,kBAAkB;OAC3B,yBAAyB,IAAI,aAAa;MAC5C;MACA,gBAAgB;OACd,gBAAgB,IAAI,KAAK;MAC3B;KACD,CAAA,IACC;KAEJ,oBAAC,mBAAD;MACE,WAAW;MACX,MAAM;MACN,WAAU;MACV,eAAe;OACb,YAAY;MACd;KACD,CAAA;IACE;;EACyB,CAAA;CACZ,CAAA;AAE1B"}
|
|
1
|
+
{"version":3,"file":"sidebar.js","names":[],"sources":["../../../src/components/sidebar/sidebar.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { Block } from \"../block\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type {\n SidebarButtonProps,\n SidebarPartProps,\n SidebarProps,\n SidebarTooltipSide,\n} from \"./sidebar.types\";\n\nfunction sidebarTooltipProps(\n tooltip: string | undefined,\n tooltipSide: SidebarTooltipSide | undefined,\n): Record<string, string | undefined> {\n return {\n \"data-tooltip\": tooltip,\n \"data-tooltip-side\": tooltip ? tooltipSide : undefined,\n };\n}\n\nfunction sidebarPart(\n props: SidebarPartProps,\n slot: string,\n element: keyof JSX.IntrinsicElements = \"div\",\n): JSX.Element {\n const { as, asChild, children, class: className, ...rest } = props;\n const Element = (as ?? element) as \"div\";\n const finalProps = mergeProps(rest, {\n class: className,\n \"data-slot\": slot,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return <Element {...finalProps}>{children}</Element>;\n}\n\nexport function Sidebar(props: SidebarProps): JSX.Element {\n const {\n children,\n collapsible = \"offcanvas\",\n side = \"left\",\n variant = \"sidebar\",\n width = \"sidebar\",\n shrink = false,\n ...rest\n } = props;\n\n return (\n <Block\n as=\"aside\"\n width={width}\n shrink={shrink}\n minHeight=\"screen\"\n padding=\"md\"\n gap=\"lg\"\n borderRight={true}\n {...rest}\n data-collapsible={collapsible}\n data-side={side}\n data-slot=\"sidebar\"\n data-variant={variant}\n >\n {children}\n </Block>\n );\n}\n\nexport function SidebarProvider(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-provider\");\n}\n\nexport function SidebarInset(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-inset\", \"main\");\n}\n\nexport function SidebarContent(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-content\");\n}\n\nexport function SidebarHeader(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-header\");\n}\n\nexport function SidebarFooter(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-footer\");\n}\n\nexport function SidebarGroup(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group\");\n}\n\nexport function SidebarGroupLabel(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group-label\");\n}\n\nexport function SidebarGroupContent(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-group-content\");\n}\n\nexport function SidebarMenu(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu\", \"ul\");\n}\n\nexport function SidebarMenuItem(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu-item\", \"li\");\n}\n\nexport function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {\n const {\n active,\n asChild,\n children,\n class: className,\n size,\n tooltip,\n tooltipSide,\n type = \"button\",\n variant,\n ...rest\n } = props;\n const finalProps = mergeProps(rest, {\n class: classes(className),\n \"data-active\": active ? \"true\" : undefined,\n \"data-size\": size && size !== \"default\" ? size : undefined,\n \"data-slot\": \"sidebar-menu-button\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n \"data-variant\": variant && variant !== \"default\" ? variant : undefined,\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children as JSX.Element} />;\n }\n\n return (\n <button type={type} {...finalProps}>\n {children}\n </button>\n );\n}\n\nexport function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {\n const { children, class: className, tooltip, tooltipSide, type = \"button\", ...rest } = props;\n return (\n <button\n type={type}\n {...mergeProps(rest, {\n class: classes(className),\n \"data-slot\": \"sidebar-menu-action\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n })}\n >\n {children}\n </button>\n );\n}\n\nexport function SidebarMenuBadge(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-menu-badge\", \"span\");\n}\n\nexport function SidebarRail(props: SidebarPartProps): JSX.Element {\n return sidebarPart(props, \"sidebar-rail\", \"button\");\n}\n\nexport function SidebarTrigger(props: SidebarButtonProps): JSX.Element {\n const { children, class: className, tooltip, tooltipSide, type = \"button\", ...rest } = props;\n return (\n <button\n type={type}\n {...mergeProps(rest, {\n class: classes(\"btn btn-ghost btn-icon\", className),\n \"data-slot\": \"sidebar-trigger\",\n ...sidebarTooltipProps(tooltip, tooltipSide),\n })}\n >\n {children}\n </button>\n );\n}\n"],"mappings":";;;;;;AAWA,SAAS,oBACP,SACA,aACoC;CACpC,OAAO;EACL,gBAAgB;EAChB,qBAAqB,UAAU,cAAc,KAAA;CAC/C;AACF;AAEA,SAAS,YACP,OACA,MACA,UAAuC,OAC1B;CACb,MAAM,EAAE,IAAI,SAAS,UAAU,OAAO,WAAW,GAAG,SAAS;CAC7D,MAAM,UAAW,MAAM;CACvB,MAAM,aAAa,WAAW,MAAM;EAClC,OAAO;EACP,aAAa;CACf,CAAC;CAED,IAAI,SACF,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAA0B,CAAA;CAG3E,OAAO,oBAAC,SAAD;EAAS,GAAI;EAAa;CAAkB,CAAA;AACrD;AAEA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EACJ,UACA,cAAc,aACd,OAAO,QACP,UAAU,WACV,QAAQ,WACR,SAAS,OACT,GAAG,SACD;CAEJ,OACE,oBAAC,OAAD;EACE,IAAG;EACI;EACC;EACR,WAAU;EACV,SAAQ;EACR,KAAI;EACJ,aAAa;EACb,GAAI;EACJ,oBAAkB;EAClB,aAAW;EACX,aAAU;EACV,gBAAc;EAEb;CACI,CAAA;AAEX;AAEA,SAAgB,gBAAgB,OAAsC;CACpE,OAAO,YAAY,OAAO,kBAAkB;AAC9C;AAEA,SAAgB,aAAa,OAAsC;CACjE,OAAO,YAAY,OAAO,iBAAiB,MAAM;AACnD;AAEA,SAAgB,eAAe,OAAsC;CACnE,OAAO,YAAY,OAAO,iBAAiB;AAC7C;AAEA,SAAgB,cAAc,OAAsC;CAClE,OAAO,YAAY,OAAO,gBAAgB;AAC5C;AAEA,SAAg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AgB,YAAY,OAAsC;CAChE,OAAO,YAAY,OAAO,gBAAgB,QAAQ;AACpD;AAEA,SAAgB,eAAe,OAAwC;CACrE,MAAM,EAAE,UAAU,OAAO,WAAW,SAAS,aAAa,OAAO,UAAU,GAAG,SAAS;CACvF,OACE,oBAAC,UAAD;EACQ;EACN,GAAI,WAAW,MAAM;GACnB,OAAO,QAAQ,0BAA0B,SAAS;GAClD,aAAa;GACb,GAAG,oBAAoB,SAAS,WAAW;EAC7C,CAAC;EAEA;CACK,CAAA;AAEZ"}
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { BlockElementProps } from "../block/block.types.js";
|
|
3
2
|
//#region src/components/sidebar/sidebar.types.d.ts
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
type SidebarCollapsible = "offcanvas" | "icon" | "none";
|
|
4
|
+
type SidebarSide = "left" | "right";
|
|
5
|
+
type SidebarTooltipSide = "top" | "bottom" | "left" | "right";
|
|
6
|
+
type SidebarVariant = "sidebar" | "floating" | "inset";
|
|
7
|
+
type SidebarProps = Omit<BlockElementProps<"aside">, "as" | "width" | "shrink"> & {
|
|
8
|
+
collapsible?: SidebarCollapsible;
|
|
9
|
+
side?: SidebarSide;
|
|
10
|
+
variant?: SidebarVariant;
|
|
11
|
+
width?: BlockElementProps<"aside">["width"];
|
|
12
|
+
shrink?: BlockElementProps<"aside">["shrink"];
|
|
14
13
|
};
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
type SidebarPartProps = JSX.IntrinsicElements["div"] & {
|
|
15
|
+
as?: keyof JSX.IntrinsicElements;
|
|
16
|
+
asChild?: boolean;
|
|
18
17
|
};
|
|
19
|
-
type
|
|
18
|
+
type SidebarButtonProps = JSX.IntrinsicElements["button"] & {
|
|
20
19
|
active?: boolean;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
panelId?: string;
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
size?: "default" | "sm" | "lg";
|
|
22
|
+
tooltip?: string;
|
|
23
|
+
tooltipSide?: SidebarTooltipSide;
|
|
24
|
+
variant?: "default" | "outline";
|
|
27
25
|
};
|
|
28
26
|
//#endregion
|
|
29
|
-
export {
|
|
27
|
+
export { SidebarButtonProps, SidebarCollapsible, SidebarPartProps, SidebarProps, SidebarSide, SidebarTooltipSide, SidebarVariant };
|
|
30
28
|
//# sourceMappingURL=sidebar.types.d.ts.map
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
import { classes } from "../_internal/classes.js";
|
|
1
2
|
import { mergeProps } from "../_internal/merge-props.js";
|
|
3
|
+
import { styleDeclarationsToClass } from "../_internal/style.js";
|
|
4
|
+
import { mergeLayoutStyles } from "../_internal/block-layout.js";
|
|
2
5
|
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
6
|
import { Slot } from "@askrjs/askr/foundations";
|
|
4
7
|
//#region src/components/skeleton/skeleton.tsx
|
|
8
|
+
function resolveSkeletonDimension(value) {
|
|
9
|
+
if (typeof value === "number") return `${value}px`;
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
5
12
|
function Skeleton(props) {
|
|
6
|
-
const { asChild, children, ref, ...rest } = props;
|
|
13
|
+
const { asChild, children, class: classProp, className, height, ref, style, width, ...rest } = props;
|
|
7
14
|
const finalProps = mergeProps(rest, {
|
|
8
15
|
ref,
|
|
16
|
+
class: classes(classProp, className, styleDeclarationsToClass(mergeLayoutStyles({
|
|
17
|
+
blockSize: resolveSkeletonDimension(height),
|
|
18
|
+
inlineSize: resolveSkeletonDimension(width)
|
|
19
|
+
}, style))),
|
|
9
20
|
"data-slot": "skeleton",
|
|
10
21
|
"data-skeleton": "true",
|
|
11
22
|
"aria-hidden": "true"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/skeleton/skeleton.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport type { SkeletonAsChildProps, SkeletonProps } from \"./skeleton.types\";\n\nexport function Skeleton(props: SkeletonProps): JSX.Element;\nexport function Skeleton(props: SkeletonAsChildProps): JSX.Element;\nexport function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {\n const {
|
|
1
|
+
{"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/skeleton/skeleton.tsx"],"sourcesContent":["import { Slot } from \"@askrjs/askr/foundations\";\nimport { mergeLayoutStyles } from \"../_internal/block-layout\";\nimport { classes } from \"../_internal/classes\";\nimport { mergeProps } from \"../_internal/merge-props\";\nimport { styleDeclarationsToClass } from \"../_internal/style\";\nimport type { SkeletonAsChildProps, SkeletonProps } from \"./skeleton.types\";\n\nfunction resolveSkeletonDimension(value: string | number | undefined): string | undefined {\n if (typeof value === \"number\") return `${value}px`;\n return value;\n}\n\nexport function Skeleton(props: SkeletonProps): JSX.Element;\nexport function Skeleton(props: SkeletonAsChildProps): JSX.Element;\nexport function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {\n const {\n asChild,\n children,\n class: classProp,\n className,\n height,\n ref,\n style,\n width,\n ...rest\n } = props as (SkeletonProps | SkeletonAsChildProps) & {\n class?: unknown;\n className?: unknown;\n style?: unknown;\n };\n const layoutClass = styleDeclarationsToClass(\n mergeLayoutStyles(\n {\n blockSize: resolveSkeletonDimension(height),\n inlineSize: resolveSkeletonDimension(width),\n },\n style,\n ),\n );\n const finalProps = mergeProps(rest, {\n ref,\n class: classes(classProp, className, layoutClass),\n \"data-slot\": \"skeleton\",\n \"data-skeleton\": \"true\",\n \"aria-hidden\": \"true\",\n });\n\n if (asChild) {\n return <Slot asChild {...finalProps} children={children} />;\n }\n\n return <div {...finalProps}>{children}</div>;\n}\n"],"mappings":";;;;;;;AAOA,SAAS,yBAAyB,OAAwD;CACxF,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,OAAO;AACT;AAIA,SAAgB,SAAS,OAA6C;CACpE,MAAM,EACJ,SACA,UACA,OAAO,WACP,WACA,QACA,KACA,OACA,OACA,GAAG,SACD;CAcJ,MAAM,aAAa,WAAW,MAAM;EAClC;EACA,OAAO,QAAQ,WAAW,WAXR,yBAClB,kBACE;GACE,WAAW,yBAAyB,MAAM;GAC1C,YAAY,yBAAyB,KAAK;EAC5C,GACA,KACF,CAI+C,CAAC;EAChD,aAAa;EACb,iBAAiB;EACjB,eAAe;CACjB,CAAC;CAED,IAAI,SACF,OAAO,oBAAC,MAAD;EAAM,SAAA;EAAQ,GAAI;EAAsB;CAAW,CAAA;CAG5D,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAa;CAAc,CAAA;AAC7C"}
|
|
@@ -4,6 +4,8 @@ import { Ref } from "@askrjs/askr/foundations/utilities";
|
|
|
4
4
|
//#region src/components/skeleton/skeleton.types.d.ts
|
|
5
5
|
type SkeletonOwnProps = {
|
|
6
6
|
children?: unknown;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
width?: string | number;
|
|
7
9
|
};
|
|
8
10
|
type SkeletonProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> & SkeletonOwnProps & {
|
|
9
11
|
asChild?: false;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SpinnerOwnProps, SpinnerProps } from "./spinner.types.js";
|
|
1
|
+
import { SpinnerOwnProps, SpinnerProps, SpinnerSize } from "./spinner.types.js";
|
|
2
2
|
import { Spinner } from "./spinner.js";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { ProgressCircle } from "@askrjs/ui";
|
|
1
|
+
import { ProgressCircle, ProgressCircleIndicator } from "@askrjs/ui";
|
|
2
2
|
import { jsx } from "@askrjs/askr/jsx-runtime";
|
|
3
3
|
//#region src/components/spinner/spinner.tsx
|
|
4
4
|
function Spinner(props) {
|
|
5
|
-
const { label, "aria-label": ariaLabel, ...rest } = props;
|
|
5
|
+
const { label, size, "aria-label": ariaLabel, ...rest } = props;
|
|
6
6
|
return /* @__PURE__ */ jsx(ProgressCircle, {
|
|
7
7
|
...rest,
|
|
8
8
|
"aria-label": ariaLabel ?? label ?? "Loading",
|
|
9
|
+
"data-spinner": "true",
|
|
10
|
+
"data-size": size && size !== "md" ? size : void 0,
|
|
9
11
|
value: null,
|
|
10
|
-
getValueLabel: () => label ?? "Loading"
|
|
12
|
+
getValueLabel: () => label ?? "Loading",
|
|
13
|
+
children: /* @__PURE__ */ jsx(ProgressCircleIndicator, {})
|
|
11
14
|
});
|
|
12
15
|
}
|
|
13
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import { ProgressCircle } from \"@askrjs/ui\";\nimport type { SpinnerProps } from \"./spinner.types\";\n\nexport function Spinner(props: SpinnerProps): JSX.Element {\n const {\n label,\n \"aria-label\": ariaLabel,\n ...rest\n } = props as SpinnerProps & {\n \"aria-label\"?: string;\n };\n\n return (\n <ProgressCircle\n {...rest}\n aria-label={ariaLabel ?? label ?? \"Loading\"}\n value={null}\n getValueLabel={() => label ?? \"Loading\"}\n />\n );\n}\n"],"mappings":";;;AAGA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EACJ,OACA,cAAc,WACd,GAAG,SACD;CAIJ,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,cAAY,aAAa,SAAS;EAClC,OAAO;EACP,qBAAqB,SAAS;
|
|
1
|
+
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import { ProgressCircle, ProgressCircleIndicator } from \"@askrjs/ui\";\nimport type { SpinnerProps } from \"./spinner.types\";\n\nexport function Spinner(props: SpinnerProps): JSX.Element {\n const {\n label,\n size,\n \"aria-label\": ariaLabel,\n ...rest\n } = props as SpinnerProps & {\n \"aria-label\"?: string;\n };\n\n return (\n <ProgressCircle\n {...rest}\n aria-label={ariaLabel ?? label ?? \"Loading\"}\n data-spinner=\"true\"\n data-size={size && size !== \"md\" ? size : undefined}\n value={null}\n getValueLabel={() => label ?? \"Loading\"}\n >\n <ProgressCircleIndicator />\n </ProgressCircle>\n );\n}\n"],"mappings":";;;AAGA,SAAgB,QAAQ,OAAkC;CACxD,MAAM,EACJ,OACA,MACA,cAAc,WACd,GAAG,SACD;CAIJ,OACE,oBAAC,gBAAD;EACE,GAAI;EACJ,cAAY,aAAa,SAAS;EAClC,gBAAa;EACb,aAAW,QAAQ,SAAS,OAAO,OAAO,KAAA;EAC1C,OAAO;EACP,qBAAqB,SAAS;YAE9B,oBAAC,yBAAD,CAA0B,CAAA;CACZ,CAAA;AAEpB"}
|