@askrjs/themes 0.0.9 → 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/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
|
@@ -2,11 +2,6 @@ export const CONTAINER_A11Y_CONTRACT = {
|
|
|
2
2
|
DATA_ATTRIBUTES: {
|
|
3
3
|
slot: "data-slot" as const,
|
|
4
4
|
layout: "data-ak-layout" as const,
|
|
5
|
-
variant: "data-variant" as const,
|
|
6
|
-
maxWidth: "data-max-width" as const,
|
|
7
|
-
padding: "data-padding" as const,
|
|
8
|
-
size: "data-size" as const,
|
|
9
|
-
align: "data-align" as const,
|
|
10
5
|
},
|
|
11
6
|
SLOT_VALUES: {
|
|
12
7
|
root: "container" as const,
|
|
@@ -1,129 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function isContainerWidthToken(value: unknown): value is string {
|
|
21
|
-
return typeof value === "string" && CONTAINER_WIDTH_TOKENS.has(value.trim());
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function isContainerAlignToken(value: unknown): value is "left" | "center" | "right" {
|
|
25
|
-
return typeof value === "string" && ["left", "center", "right"].includes(value.trim());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function hasStyleValue(value: unknown): boolean {
|
|
29
|
-
if (typeof value === "string") return value.trim().length > 0;
|
|
30
|
-
if (value && typeof value === "object") {
|
|
31
|
-
return Object.keys(value as Record<string, unknown>).length > 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function isStaticValue(value: unknown): boolean {
|
|
38
|
-
return !isResponsiveValue(value as Record<string, unknown> | undefined);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function Container(props: ContainerNativeProps): JSX.Element;
|
|
42
|
-
export function Container(props: ContainerAsChildProps): JSX.Element;
|
|
43
|
-
export function Container(props: ContainerNativeProps | ContainerAsChildProps) {
|
|
44
|
-
const {
|
|
45
|
-
asChild,
|
|
46
|
-
children,
|
|
47
|
-
variant,
|
|
48
|
-
maxWidth,
|
|
49
|
-
padding,
|
|
50
|
-
size,
|
|
51
|
-
align = "center",
|
|
52
|
-
ref,
|
|
53
|
-
style: userStyle,
|
|
54
|
-
...rest
|
|
55
|
-
} = props;
|
|
56
|
-
|
|
57
|
-
const responsiveVariant =
|
|
58
|
-
size === undefined && maxWidth === undefined ? (variant ?? "default") : undefined;
|
|
59
|
-
|
|
60
|
-
const { boxProps, rest: passthroughProps } = splitBoxLayoutProps(rest);
|
|
61
|
-
const layoutStyle: Record<string, string | number> = {
|
|
62
|
-
boxSizing: "border-box",
|
|
63
|
-
width: "100%",
|
|
64
|
-
};
|
|
65
|
-
applyBoxLayoutStyles(layoutStyle, boxProps);
|
|
66
|
-
|
|
67
|
-
const widthValue = maxWidth ?? size;
|
|
68
|
-
const usesInlineMaxWidth =
|
|
69
|
-
boxProps.maxWidth === undefined &&
|
|
70
|
-
widthValue !== undefined &&
|
|
71
|
-
(isResponsiveValue(widthValue) || !isContainerWidthToken(widthValue));
|
|
72
|
-
|
|
73
|
-
if (usesInlineMaxWidth) {
|
|
74
|
-
setResponsiveStyleVar(layoutStyle, "max-width", widthValue, (value) =>
|
|
75
|
-
typeof value === "string" && isContainerWidthToken(value)
|
|
76
|
-
? resolveContainerSizeValue(value)
|
|
77
|
-
: value,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
padding !== undefined &&
|
|
83
|
-
boxProps.px === undefined &&
|
|
84
|
-
boxProps.pl === undefined &&
|
|
85
|
-
boxProps.pr === undefined
|
|
86
|
-
) {
|
|
87
|
-
setResponsiveStyleVar(layoutStyle, "px", padding, resolveSpaceValue);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const applyAlign = (side: "marginLeft" | "marginRight", value: typeof align) => {
|
|
91
|
-
setResponsiveStyleVar(layoutStyle, side === "marginLeft" ? "ml" : "mr", value, (input) => {
|
|
92
|
-
const margins = resolveInlineAlignValue(input);
|
|
93
|
-
return side === "marginLeft" ? margins.marginLeft : margins.marginRight;
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
if (boxProps.ml === undefined && boxProps.mr === undefined && isResponsiveValue(align)) {
|
|
98
|
-
applyAlign("marginLeft", align);
|
|
99
|
-
applyAlign("marginRight", align);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const layoutClass =
|
|
103
|
-
Object.keys(layoutStyle).length > 2 || hasStyleValue(userStyle)
|
|
104
|
-
? withBoxLayoutClass(layoutStyle, userStyle)
|
|
105
|
-
: undefined;
|
|
106
|
-
|
|
107
|
-
const finalProps = mergeProps(passthroughProps, {
|
|
108
|
-
ref,
|
|
109
|
-
"data-slot": "container",
|
|
110
|
-
"data-ak-layout": "true",
|
|
111
|
-
"data-variant": responsiveVariant,
|
|
112
|
-
"data-size": isStaticValue(size)
|
|
113
|
-
? serializeResponsiveValueIf(size, isContainerWidthToken)
|
|
114
|
-
: undefined,
|
|
115
|
-
"data-align": isStaticValue(align)
|
|
116
|
-
? serializeResponsiveValueIf(align, isContainerAlignToken)
|
|
117
|
-
: undefined,
|
|
118
|
-
"data-max-width": isStaticValue(maxWidth)
|
|
119
|
-
? serializeResponsiveValueIf(maxWidth, isContainerWidthToken)
|
|
120
|
-
: undefined,
|
|
121
|
-
...(layoutClass ? { class: layoutClass } : {}),
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
if (asChild) {
|
|
125
|
-
return <Slot asChild {...finalProps} children={children} />;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return <div {...finalProps}>{children}</div>;
|
|
1
|
+
import { Block } from "../block";
|
|
2
|
+
import type { ContainerProps } from "./container.types";
|
|
3
|
+
|
|
4
|
+
export function Container(props: ContainerProps): JSX.Element {
|
|
5
|
+
const { children, size = "page", ...rest } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Block
|
|
9
|
+
maxWidth={size}
|
|
10
|
+
marginX="auto"
|
|
11
|
+
paddingX="page"
|
|
12
|
+
width="full"
|
|
13
|
+
{...rest}
|
|
14
|
+
data-slot="container"
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</Block>
|
|
18
|
+
);
|
|
129
19
|
}
|
|
@@ -1,34 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
|
-
import type { BoxLayoutOwnProps, LayoutResponsive } from "../box/box.types";
|
|
1
|
+
import type { BlockDivProps, BlockSize } from "../block";
|
|
4
2
|
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
export type ContainerOwnProps = BoxLayoutOwnProps & {
|
|
8
|
-
/** Bootstrap-like responsive container variant. */
|
|
9
|
-
variant?: ContainerVariant;
|
|
10
|
-
/** Radix-style container size token. */
|
|
11
|
-
size?: LayoutResponsive<"1" | "2" | "3" | "4" | "sm" | "md" | "lg" | "xl" | "fluid">;
|
|
12
|
-
/** Horizontal alignment of the constrained container. */
|
|
13
|
-
align?: LayoutResponsive<"left" | "center" | "right">;
|
|
14
|
-
/** Compatibility max-width override. */
|
|
15
|
-
maxWidth?: LayoutResponsive<string>;
|
|
16
|
-
/** Compatibility horizontal padding override. */
|
|
17
|
-
padding?: LayoutResponsive<string | number>;
|
|
18
|
-
children?: unknown;
|
|
3
|
+
export type ContainerProps = Omit<BlockDivProps, "maxWidth"> & {
|
|
4
|
+
size?: BlockSize;
|
|
19
5
|
};
|
|
20
|
-
|
|
21
|
-
export type ContainerNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
22
|
-
ContainerOwnProps & {
|
|
23
|
-
asChild?: false;
|
|
24
|
-
ref?: Ref<HTMLDivElement>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type ContainerAsChildProps = ContainerOwnProps & {
|
|
28
|
-
asChild: true;
|
|
29
|
-
children: JSXElement;
|
|
30
|
-
ref?: Ref<unknown>;
|
|
31
|
-
style?: JSX.IntrinsicElements["div"]["style"];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type ContainerProps = ContainerNativeProps | ContainerAsChildProps;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
export { Container } from "./container";
|
|
2
|
-
export {
|
|
3
|
-
export type {
|
|
4
|
-
ContainerProps,
|
|
5
|
-
ContainerVariant,
|
|
6
|
-
ContainerOwnProps,
|
|
7
|
-
ContainerNativeProps,
|
|
8
|
-
ContainerAsChildProps,
|
|
9
|
-
} from "./container.types";
|
|
2
|
+
export type { ContainerProps } from "./container.types";
|
|
@@ -1,42 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Block } from "../block";
|
|
2
2
|
import type { EmptyStateProps } from "./empty-state.types";
|
|
3
3
|
|
|
4
4
|
export function EmptyState(props: EmptyStateProps): JSX.Element {
|
|
5
|
-
const {
|
|
6
|
-
icon,
|
|
7
|
-
title,
|
|
8
|
-
titleAs: TitleTag = "h2",
|
|
9
|
-
description,
|
|
10
|
-
actions,
|
|
11
|
-
children,
|
|
12
|
-
ref,
|
|
13
|
-
class: className,
|
|
14
|
-
...rest
|
|
15
|
-
} = props;
|
|
5
|
+
const { icon, title, titleAs: TitleTag = "h2", description, action, children, ...rest } = props;
|
|
16
6
|
|
|
17
7
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
) : null}
|
|
34
|
-
{children}
|
|
35
|
-
{actions !== undefined ? (
|
|
36
|
-
<div class="empty-state-actions" data-slot="empty-state-actions">
|
|
37
|
-
{actions}
|
|
38
|
-
</div>
|
|
39
|
-
) : null}
|
|
40
|
-
</div>
|
|
8
|
+
<Block center minHeight="content" padding="xl" {...rest} data-slot="empty-state">
|
|
9
|
+
<Block align="center" gap="md" maxWidth="sm" data-slot="empty-state-content">
|
|
10
|
+
{icon !== undefined ? <div data-slot="empty-state-icon">{icon}</div> : null}
|
|
11
|
+
{title !== undefined ? <TitleTag data-slot="empty-state-title">{title}</TitleTag> : null}
|
|
12
|
+
{description !== undefined ? (
|
|
13
|
+
<p data-slot="empty-state-description">{description}</p>
|
|
14
|
+
) : null}
|
|
15
|
+
{children}
|
|
16
|
+
{action !== undefined ? (
|
|
17
|
+
<Block direction="row" justify="center" gap="sm" data-slot="empty-state-actions">
|
|
18
|
+
{action}
|
|
19
|
+
</Block>
|
|
20
|
+
) : null}
|
|
21
|
+
</Block>
|
|
22
|
+
</Block>
|
|
41
23
|
);
|
|
42
24
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlockDivProps } from "../block";
|
|
2
2
|
|
|
3
3
|
export type EmptyStateHeadingTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
4
|
|
|
5
|
-
export type EmptyStateProps =
|
|
5
|
+
export type EmptyStateProps = BlockDivProps & {
|
|
6
6
|
icon?: unknown;
|
|
7
7
|
title?: unknown;
|
|
8
8
|
titleAs?: EmptyStateHeadingTag;
|
|
9
9
|
description?: unknown;
|
|
10
|
-
|
|
11
|
-
children?: unknown;
|
|
12
|
-
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
action?: unknown;
|
|
13
11
|
};
|
|
@@ -3,11 +3,12 @@ import { mergeProps } from "../_internal/merge-props";
|
|
|
3
3
|
import type { FieldErrorProps, FieldHintProps, FieldProps } from "./field.types";
|
|
4
4
|
|
|
5
5
|
export function Field(props: FieldProps): JSX.Element {
|
|
6
|
-
const { children, class: className, ref, ...rest } = props;
|
|
6
|
+
const { children, class: className, invalid = false, ref, ...rest } = props;
|
|
7
7
|
const finalProps = mergeProps(rest, {
|
|
8
8
|
class: classes("field", className),
|
|
9
9
|
ref,
|
|
10
10
|
"data-slot": "field",
|
|
11
|
+
"data-invalid": invalid ? "true" : undefined,
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
return <div {...finalProps}>{children}</div>;
|
|
@@ -29,6 +30,7 @@ export function FieldError(props: FieldErrorProps): JSX.Element {
|
|
|
29
30
|
const finalProps = mergeProps(rest, {
|
|
30
31
|
class: classes("field-error", className),
|
|
31
32
|
ref,
|
|
33
|
+
role: "alert",
|
|
32
34
|
"data-slot": "field-error",
|
|
33
35
|
});
|
|
34
36
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Block } from "../block";
|
|
2
|
+
import { classes } from "../_internal/classes";
|
|
3
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
4
|
+
import type {
|
|
5
|
+
FooterContentProps,
|
|
6
|
+
FooterDescriptionProps,
|
|
7
|
+
FooterLinkProps,
|
|
8
|
+
FooterLinksProps,
|
|
9
|
+
FooterProps,
|
|
10
|
+
FooterSectionProps,
|
|
11
|
+
FooterTitleProps,
|
|
12
|
+
} from "./footer.types";
|
|
13
|
+
|
|
14
|
+
export function Footer(props: FooterProps): JSX.Element {
|
|
15
|
+
const { children, ...rest } = props;
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Block as="footer" background="muted" borderTop {...rest} data-slot="footer">
|
|
19
|
+
{children}
|
|
20
|
+
</Block>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function FooterContent(props: FooterContentProps): JSX.Element {
|
|
25
|
+
const { children, class: className, ref, ...rest } = props;
|
|
26
|
+
const finalProps = mergeProps(rest, {
|
|
27
|
+
ref,
|
|
28
|
+
class: classes("footer-content", className),
|
|
29
|
+
"data-slot": "footer-content",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return <div {...finalProps}>{children}</div>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function FooterSection(props: FooterSectionProps): JSX.Element {
|
|
36
|
+
const { children, class: className, ref, ...rest } = props;
|
|
37
|
+
const finalProps = mergeProps(rest, {
|
|
38
|
+
ref,
|
|
39
|
+
class: classes("footer-section", className),
|
|
40
|
+
"data-slot": "footer-section",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return <div {...finalProps}>{children}</div>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function FooterTitle(props: FooterTitleProps): JSX.Element {
|
|
47
|
+
const { children, class: className, ref, ...rest } = props;
|
|
48
|
+
const finalProps = mergeProps(rest, {
|
|
49
|
+
ref,
|
|
50
|
+
class: classes("footer-title", className),
|
|
51
|
+
"data-slot": "footer-title",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return <h2 {...finalProps}>{children}</h2>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function FooterDescription(props: FooterDescriptionProps): JSX.Element {
|
|
58
|
+
const { children, class: className, ref, ...rest } = props;
|
|
59
|
+
const finalProps = mergeProps(rest, {
|
|
60
|
+
ref,
|
|
61
|
+
class: classes("footer-description", className),
|
|
62
|
+
"data-slot": "footer-description",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return <p {...finalProps}>{children}</p>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function FooterLinks(props: FooterLinksProps): JSX.Element {
|
|
69
|
+
const { children, class: className, ref, ...rest } = props;
|
|
70
|
+
const finalProps = mergeProps(rest, {
|
|
71
|
+
ref,
|
|
72
|
+
class: classes("footer-links", className),
|
|
73
|
+
"data-slot": "footer-links",
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return <nav {...finalProps}>{children}</nav>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function FooterLink(props: FooterLinkProps): JSX.Element {
|
|
80
|
+
const { children, class: className, ref, ...rest } = props;
|
|
81
|
+
const finalProps = mergeProps(rest, {
|
|
82
|
+
ref,
|
|
83
|
+
class: classes("footer-link", className),
|
|
84
|
+
"data-slot": "footer-link",
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return <a {...finalProps}>{children}</a>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BlockElementProps } from "../block";
|
|
2
|
+
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
|
+
|
|
4
|
+
export type FooterProps = Omit<BlockElementProps<"footer">, "as">;
|
|
5
|
+
|
|
6
|
+
type DivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref">;
|
|
7
|
+
type HeadingProps = Omit<JSX.IntrinsicElements["h2"], "children" | "ref">;
|
|
8
|
+
type ParagraphProps = Omit<JSX.IntrinsicElements["p"], "children" | "ref">;
|
|
9
|
+
type NavProps = Omit<JSX.IntrinsicElements["nav"], "children" | "ref">;
|
|
10
|
+
type AnchorProps = Omit<JSX.IntrinsicElements["a"], "children" | "ref">;
|
|
11
|
+
|
|
12
|
+
export type FooterContentProps = DivProps & {
|
|
13
|
+
children?: unknown;
|
|
14
|
+
ref?: Ref<HTMLDivElement>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type FooterSectionProps = DivProps & {
|
|
18
|
+
children?: unknown;
|
|
19
|
+
ref?: Ref<HTMLDivElement>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type FooterTitleProps = HeadingProps & {
|
|
23
|
+
children?: unknown;
|
|
24
|
+
ref?: Ref<HTMLHeadingElement>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type FooterDescriptionProps = ParagraphProps & {
|
|
28
|
+
children?: unknown;
|
|
29
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type FooterLinksProps = NavProps & {
|
|
33
|
+
children?: unknown;
|
|
34
|
+
ref?: Ref<HTMLElement>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type FooterLinkProps = AnchorProps & {
|
|
38
|
+
children?: unknown;
|
|
39
|
+
ref?: Ref<HTMLAnchorElement>;
|
|
40
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { classes } from "../_internal/classes";
|
|
2
|
+
import { mergeLayoutStyles } from "../_internal/block-layout";
|
|
3
|
+
import { mergeProps } from "../_internal/merge-props";
|
|
4
|
+
import { styleDeclarationsToClass } from "../_internal/style";
|
|
5
|
+
import type { BlockSpace, LayoutBreakpoint, ResponsiveValue } from "../_internal/block-layout";
|
|
6
|
+
import type { GridAlign, GridColumns, GridElement, GridProps } from "./grid.types";
|
|
7
|
+
|
|
8
|
+
const DEFAULT_ELEMENT = "div";
|
|
9
|
+
const BREAKPOINTS: readonly LayoutBreakpoint[] = ["base", "sm", "md", "lg", "xl"];
|
|
10
|
+
|
|
11
|
+
const SPACE_TOKEN_MAP: Record<BlockSpace, string> = {
|
|
12
|
+
"0": "0",
|
|
13
|
+
xs: "var(--ak-space-xs)",
|
|
14
|
+
sm: "var(--ak-space-sm)",
|
|
15
|
+
md: "var(--ak-space-md)",
|
|
16
|
+
lg: "var(--ak-space-lg)",
|
|
17
|
+
xl: "var(--ak-space-xl)",
|
|
18
|
+
"2xl": "var(--ak-space-2xl)",
|
|
19
|
+
"3xl": "var(--ak-space-3xl)",
|
|
20
|
+
page: "var(--ak-layout-page-gutter)",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function isResponsiveValue<T>(
|
|
24
|
+
value: ResponsiveValue<T> | undefined,
|
|
25
|
+
): value is Partial<Record<LayoutBreakpoint, T>> {
|
|
26
|
+
return Boolean(
|
|
27
|
+
value &&
|
|
28
|
+
typeof value === "object" &&
|
|
29
|
+
!Array.isArray(value) &&
|
|
30
|
+
BREAKPOINTS.some((breakpoint) => breakpoint in value),
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizeResponsiveValue<T>(
|
|
35
|
+
value: ResponsiveValue<T> | undefined,
|
|
36
|
+
): Partial<Record<LayoutBreakpoint, T>> | undefined {
|
|
37
|
+
if (value === undefined) return undefined;
|
|
38
|
+
if (isResponsiveValue(value)) return value;
|
|
39
|
+
return { base: value };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function resolveColumns(value: GridColumns): string {
|
|
43
|
+
if (typeof value === "number") {
|
|
44
|
+
return `repeat(${value}, minmax(0, 1fr))`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const trimmed = value.trim();
|
|
48
|
+
return trimmed || "minmax(0, 1fr)";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function resolveGap(value: BlockSpace): string {
|
|
52
|
+
return SPACE_TOKEN_MAP[value] ?? value;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function resolveAlign(value: GridAlign): string {
|
|
56
|
+
if (value === "start") return "start";
|
|
57
|
+
if (value === "end") return "end";
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function setResponsiveVar<T>(
|
|
62
|
+
styles: Record<string, string | number>,
|
|
63
|
+
property: string,
|
|
64
|
+
value: ResponsiveValue<T> | undefined,
|
|
65
|
+
resolve: (value: T) => string | number | undefined,
|
|
66
|
+
) {
|
|
67
|
+
const normalized = normalizeResponsiveValue(value);
|
|
68
|
+
if (!normalized) return;
|
|
69
|
+
|
|
70
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
71
|
+
const breakpointValue = normalized[breakpoint];
|
|
72
|
+
if (breakpointValue === undefined) continue;
|
|
73
|
+
const resolved = resolve(breakpointValue);
|
|
74
|
+
if (resolved === undefined || resolved === "") continue;
|
|
75
|
+
styles[`--ak-grid-${property}-${breakpoint}`] = resolved;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function Grid<TElement extends GridElement = "div">(
|
|
80
|
+
props: GridProps<TElement>,
|
|
81
|
+
): JSX.Element {
|
|
82
|
+
const {
|
|
83
|
+
as,
|
|
84
|
+
columns,
|
|
85
|
+
gap,
|
|
86
|
+
align,
|
|
87
|
+
children,
|
|
88
|
+
class: classProp,
|
|
89
|
+
className,
|
|
90
|
+
ref,
|
|
91
|
+
style: userStyle,
|
|
92
|
+
...rest
|
|
93
|
+
} = props as GridProps<GridElement> & {
|
|
94
|
+
class?: unknown;
|
|
95
|
+
className?: unknown;
|
|
96
|
+
style?: unknown;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const styles: Record<string, string | number> = {};
|
|
100
|
+
setResponsiveVar(styles, "columns", columns, resolveColumns);
|
|
101
|
+
setResponsiveVar(styles, "gap", gap, resolveGap);
|
|
102
|
+
setResponsiveVar(styles, "align", align, resolveAlign);
|
|
103
|
+
|
|
104
|
+
const generatedClass = styleDeclarationsToClass(mergeLayoutStyles(styles, userStyle));
|
|
105
|
+
const finalProps = mergeProps(rest, {
|
|
106
|
+
ref,
|
|
107
|
+
class: classes("grid", classProp, className, generatedClass),
|
|
108
|
+
"data-slot": "grid",
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const Element = (as ?? DEFAULT_ELEMENT) as keyof JSX.IntrinsicElements;
|
|
112
|
+
return <Element {...finalProps}>{children}</Element>;
|
|
113
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
2
|
+
import type { BlockSpace, ResponsiveValue } from "../_internal/block-layout";
|
|
3
|
+
|
|
4
|
+
export type GridElement = "div" | "section" | "ul";
|
|
5
|
+
export type GridColumns = number | string;
|
|
6
|
+
export type GridAlign = "start" | "center" | "end" | "stretch";
|
|
7
|
+
|
|
8
|
+
type GridIntrinsicProps<TElement extends GridElement> = Omit<
|
|
9
|
+
JSX.IntrinsicElements[TElement],
|
|
10
|
+
"children" | "ref"
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export type GridProps<TElement extends GridElement = "div"> = GridIntrinsicProps<TElement> & {
|
|
14
|
+
as?: TElement;
|
|
15
|
+
columns?: ResponsiveValue<GridColumns>;
|
|
16
|
+
gap?: ResponsiveValue<BlockSpace>;
|
|
17
|
+
align?: ResponsiveValue<GridAlign>;
|
|
18
|
+
children?: unknown;
|
|
19
|
+
ref?: Ref<HTMLElement>;
|
|
20
|
+
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Block } from "../block";
|
|
2
2
|
import type { HeaderProps } from "./header.types";
|
|
3
3
|
|
|
4
4
|
export function Header(props: HeaderProps): JSX.Element {
|
|
5
|
-
const { children, position = "
|
|
5
|
+
const { children, position, sticky = position === "sticky", ...rest } = props;
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
|
-
<
|
|
8
|
+
<Block
|
|
9
|
+
as="header"
|
|
10
|
+
sticky={sticky}
|
|
11
|
+
top={sticky ? "0" : undefined}
|
|
12
|
+
zIndex={sticky ? "header" : undefined}
|
|
13
|
+
background="surface"
|
|
14
|
+
borderBottom
|
|
9
15
|
{...rest}
|
|
10
|
-
ref={ref}
|
|
11
|
-
class={classes("header", className)}
|
|
12
16
|
data-slot="header"
|
|
13
|
-
data-position={position}
|
|
14
17
|
>
|
|
15
18
|
{children}
|
|
16
|
-
</
|
|
19
|
+
</Block>
|
|
17
20
|
);
|
|
18
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { BlockElementProps } from "../block";
|
|
2
2
|
|
|
3
|
-
export type HeaderProps = Omit<
|
|
4
|
-
position?:
|
|
5
|
-
|
|
3
|
+
export type HeaderProps = Omit<BlockElementProps<"header">, "as" | "sticky"> & {
|
|
4
|
+
position?: "sticky" | "static";
|
|
5
|
+
sticky?: boolean;
|
|
6
6
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Block } from "../block";
|
|
2
|
+
import type { MainProps } from "./main.types";
|
|
3
|
+
|
|
4
|
+
export function Main(props: MainProps): JSX.Element {
|
|
5
|
+
const { children, ...rest } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Block as="main" grow {...rest} data-slot="main">
|
|
9
|
+
{children}
|
|
10
|
+
</Block>
|
|
11
|
+
);
|
|
12
|
+
}
|