@askrjs/themes 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -13
- package/THEMING.md +24 -18
- package/dist/components/_internal/block-layout.d.ts +49 -0
- package/dist/components/_internal/block-layout.js +210 -0
- package/dist/components/_internal/block-layout.js.map +1 -0
- package/dist/components/_internal/jsx.js.map +1 -1
- package/dist/components/_internal/style.js +25 -1
- package/dist/components/_internal/style.js.map +1 -1
- package/dist/components/alert/alert.js +2 -2
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/alert.types.d.ts +0 -1
- package/dist/components/aside/aside.d.ts +7 -0
- package/dist/components/aside/aside.js +16 -0
- package/dist/components/aside/aside.js.map +1 -0
- package/dist/components/aside/aside.types.d.ts +6 -0
- package/dist/components/aside/index.d.ts +2 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/badge/index.d.ts +1 -2
- package/dist/components/block/block.d.ts +2 -3
- package/dist/components/block/block.js +16 -46
- package/dist/components/block/block.js.map +1 -1
- package/dist/components/block/block.types.d.ts +13 -23
- package/dist/components/block/index.d.ts +3 -3
- package/dist/components/brand/brand.d.ts +9 -0
- package/dist/components/brand/brand.js +49 -0
- package/dist/components/brand/brand.js.map +1 -0
- package/dist/components/brand/brand.types.d.ts +31 -0
- package/dist/components/brand/index.d.ts +2 -0
- package/dist/components/card/card.d.ts +3 -3
- package/dist/components/card/card.js +6 -11
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/card.types.d.ts +10 -12
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/catalog.d.ts +156 -0
- package/dist/components/catalog.js +723 -0
- package/dist/components/catalog.js.map +1 -0
- package/dist/components/container/container.d.ts +2 -3
- package/dist/components/container/container.js +8 -71
- package/dist/components/container/container.js.map +1 -1
- package/dist/components/container/container.types.d.ts +5 -24
- package/dist/components/container/index.d.ts +2 -3
- package/dist/components/empty-state/empty-state.js +34 -28
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/empty-state/empty-state.types.d.ts +3 -6
- package/dist/components/field/field.js +4 -2
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/field.types.d.ts +1 -0
- package/dist/components/footer/footer.d.ts +13 -0
- package/dist/components/footer/footer.js +86 -0
- package/dist/components/footer/footer.js.map +1 -0
- package/dist/components/footer/footer.types.d.ts +37 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/grid/grid.d.ts +7 -0
- package/dist/components/grid/grid.js +76 -0
- package/dist/components/grid/grid.js.map +1 -0
- package/dist/components/grid/grid.types.d.ts +19 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/header/header.js +9 -6
- package/dist/components/header/header.js.map +1 -1
- package/dist/components/header/header.types.d.ts +5 -5
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/main/index.d.ts +2 -0
- package/dist/components/main/main.d.ts +7 -0
- package/dist/components/main/main.js +17 -0
- package/dist/components/main/main.js.map +1 -0
- package/dist/components/main/main.types.d.ts +6 -0
- package/dist/components/nav/index.d.ts +2 -2
- package/dist/components/nav/nav.d.ts +8 -6
- package/dist/components/nav/nav.js +93 -58
- package/dist/components/nav/nav.js.map +1 -1
- package/dist/components/nav/nav.types.d.ts +16 -20
- package/dist/components/navbar/index.d.ts +4 -5
- package/dist/components/navbar/navbar.d.ts +3 -38
- package/dist/components/navbar/navbar.js +102 -198
- package/dist/components/navbar/navbar.js.map +1 -1
- package/dist/components/navbar/navbar.types.d.ts +14 -24
- package/dist/components/page/index.d.ts +2 -0
- package/dist/components/page/page.d.ts +7 -0
- package/dist/components/page/page.js +22 -0
- package/dist/components/page/page.js.map +1 -0
- package/dist/components/page/page.types.d.ts +6 -0
- package/dist/components/page-header/index.d.ts +2 -0
- package/dist/components/page-header/page-header.d.ts +7 -0
- package/dist/components/page-header/page-header.js +37 -0
- package/dist/components/page-header/page-header.js.map +1 -0
- package/dist/components/page-header/page-header.types.d.ts +10 -0
- package/dist/components/section/index.d.ts +2 -3
- package/dist/components/section/section.d.ts +2 -3
- package/dist/components/section/section.js +7 -30
- package/dist/components/section/section.js.map +1 -1
- package/dist/components/section/section.types.d.ts +3 -20
- package/dist/components/separator/index.d.ts +1 -2
- package/dist/components/sidebar/index.d.ts +2 -0
- package/dist/components/sidebar/sidebar.d.ts +17 -2
- package/dist/components/sidebar/sidebar.js +115 -211
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/sidebar/sidebar.types.d.ts +21 -23
- package/dist/components/skeleton/index.d.ts +1 -2
- package/dist/components/skeleton/skeleton.js +12 -1
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/skeleton/skeleton.types.d.ts +2 -0
- package/dist/components/spinner/index.d.ts +1 -1
- package/dist/components/spinner/spinner.js +6 -3
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/spinner/spinner.types.d.ts +3 -1
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/stat.d.ts +10 -0
- package/dist/components/stat/stat.js +52 -0
- package/dist/components/stat/stat.js.map +1 -0
- package/dist/components/stat/stat.types.d.ts +24 -0
- package/dist/components/text/index.d.ts +2 -0
- package/dist/components/text/text.d.ts +7 -0
- package/dist/components/text/text.js +28 -0
- package/dist/components/text/text.js.map +1 -0
- package/dist/components/text/text.types.d.ts +26 -0
- package/dist/components/theme/theme.js +97 -18
- package/dist/components/theme/theme.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/toolbar.d.ts +7 -0
- package/dist/components/toolbar/toolbar.js +30 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/toolbar/toolbar.types.d.ts +9 -0
- package/dist/components.d.ts +60 -0
- package/dist/components.js +35 -0
- package/dist/controls.d.ts +2 -2
- package/dist/controls.js +3 -3
- package/dist/core.d.ts +36 -0
- package/dist/core.js +19 -0
- package/dist/navs.d.ts +3 -15
- package/dist/navs.js +2 -8
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +2 -2
- package/dist/surfaces.d.ts +10 -8
- package/dist/surfaces.js +6 -4
- package/dist/themes/default/index.css +3691 -3959
- package/package.json +239 -73
- package/src/components/_internal/block-layout.ts +354 -0
- package/src/components/_internal/jsx.ts +18 -6
- package/src/components/_internal/style.ts +42 -4
- package/src/components/alert/alert.tsx +1 -2
- package/src/components/alert/alert.types.ts +0 -1
- package/src/components/aside/aside.tsx +12 -0
- package/src/components/aside/aside.types.ts +3 -0
- package/src/components/aside/index.ts +2 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +1 -1
- package/src/components/badge/index.ts +0 -1
- package/src/components/block/block.a11y.ts +0 -6
- package/src/components/block/block.tsx +40 -56
- package/src/components/block/block.types.ts +59 -41
- package/src/components/block/index.ts +1 -10
- package/src/components/brand/brand.tsx +61 -0
- package/src/components/brand/brand.types.ts +39 -0
- package/src/components/brand/index.ts +2 -0
- package/src/components/card/card.tsx +6 -18
- package/src/components/card/card.types.ts +9 -11
- package/src/components/card/index.ts +2 -3
- package/src/components/catalog.tsx +713 -0
- package/src/components/container/container.a11y.ts +0 -5
- package/src/components/container/container.tsx +18 -128
- package/src/components/container/container.types.ts +3 -32
- package/src/components/container/index.ts +1 -8
- package/src/components/empty-state/empty-state.tsx +17 -35
- package/src/components/empty-state/empty-state.types.ts +3 -5
- package/src/components/field/field.tsx +3 -1
- package/src/components/field/field.types.ts +1 -0
- package/src/components/footer/footer.tsx +88 -0
- package/src/components/footer/footer.types.ts +40 -0
- package/src/components/footer/index.ts +10 -0
- package/src/components/grid/grid.tsx +113 -0
- package/src/components/grid/grid.types.ts +20 -0
- package/src/components/grid/index.ts +2 -0
- package/src/components/header/header.tsx +10 -7
- package/src/components/header/header.types.ts +4 -4
- package/src/components/header/index.ts +1 -2
- package/src/components/main/index.ts +2 -0
- package/src/components/main/main.tsx +12 -0
- package/src/components/main/main.types.ts +3 -0
- package/src/components/nav/index.ts +7 -9
- package/src/components/nav/nav.tsx +153 -110
- package/src/components/nav/nav.types.ts +26 -27
- package/src/components/navbar/index.ts +4 -11
- package/src/components/navbar/navbar.tsx +104 -251
- package/src/components/navbar/navbar.types.ts +16 -42
- package/src/components/page/index.ts +2 -0
- package/src/components/page/page.tsx +17 -0
- package/src/components/page/page.types.ts +3 -0
- package/src/components/page-header/index.ts +2 -0
- package/src/components/page-header/page-header.tsx +29 -0
- package/src/components/page-header/page-header.types.ts +7 -0
- package/src/components/section/index.ts +1 -7
- package/src/components/section/section.a11y.ts +0 -1
- package/src/components/section/section.tsx +9 -35
- package/src/components/section/section.types.ts +2 -22
- package/src/components/separator/index.ts +4 -9
- package/src/components/sidebar/index.ts +27 -5
- package/src/components/sidebar/sidebar.tsx +145 -317
- package/src/components/sidebar/sidebar.types.ts +21 -28
- package/src/components/skeleton/index.ts +1 -2
- package/src/components/skeleton/skeleton.tsx +33 -1
- package/src/components/skeleton/skeleton.types.ts +2 -0
- package/src/components/spinner/index.ts +1 -1
- package/src/components/spinner/spinner.tsx +7 -2
- package/src/components/spinner/spinner.types.ts +3 -0
- package/src/components/stat/index.ts +2 -0
- package/src/components/stat/stat.tsx +47 -0
- package/src/components/stat/stat.types.ts +24 -0
- package/src/components/text/index.ts +2 -0
- package/src/components/text/text.tsx +39 -0
- package/src/components/text/text.types.ts +35 -0
- package/src/components/theme/theme.tsx +163 -21
- package/src/components/toolbar/index.ts +2 -0
- package/src/components/toolbar/toolbar.tsx +24 -0
- package/src/components/toolbar/toolbar.types.ts +6 -0
- package/src/components.ts +289 -0
- package/src/controls.ts +69 -2
- package/src/core.ts +42 -0
- package/src/navs.ts +9 -24
- package/src/overlays.ts +101 -59
- package/src/parity.ts +125 -0
- package/src/surfaces.ts +60 -13
- package/src/themes/default/index.css +11 -14
- package/src/themes/default/styles/actions/button-group.css +6 -6
- package/src/themes/default/styles/actions/button.css +98 -60
- package/src/themes/default/styles/actions/toggle-group.css +61 -25
- package/src/themes/default/styles/base/text.css +87 -0
- package/src/themes/default/styles/base/typography.css +24 -117
- package/src/themes/default/styles/base/utilities.css +0 -250
- package/src/themes/default/styles/disclosure/accordion.css +35 -28
- package/src/themes/default/styles/display/alert.css +7 -7
- package/src/themes/default/styles/display/avatar.css +7 -1
- package/src/themes/default/styles/display/badge.css +10 -10
- package/src/themes/default/styles/display/card.css +10 -47
- package/src/themes/default/styles/display/catalog.css +753 -0
- package/src/themes/default/styles/display/coverage.css +30 -305
- package/src/themes/default/styles/display/progress-circle.css +2 -0
- package/src/themes/default/styles/display/scroll-area.css +29 -24
- package/src/themes/default/styles/display/spinner.css +38 -1
- package/src/themes/default/styles/display/stat.css +21 -0
- package/src/themes/default/styles/display/table.css +39 -12
- package/src/themes/default/styles/display/virtual-list.css +24 -13
- package/src/themes/default/styles/display/virtual-table.css +58 -36
- package/src/themes/default/styles/forms/checkbox.css +12 -21
- package/src/themes/default/styles/forms/input-group.css +2 -1
- package/src/themes/default/styles/forms/input.css +11 -12
- package/src/themes/default/styles/forms/radio-group.css +44 -27
- package/src/themes/default/styles/forms/select.css +33 -35
- package/src/themes/default/styles/forms/slider.css +61 -47
- package/src/themes/default/styles/forms/switch.css +18 -23
- package/src/themes/default/styles/forms/textarea.css +12 -12
- package/src/themes/default/styles/layout/block.css +96 -12
- package/src/themes/default/styles/layout/grid.css +78 -0
- package/src/themes/default/styles/layout/layout.css +502 -772
- package/src/themes/default/styles/layout/patterns.css +0 -155
- package/src/themes/default/styles/navigation/nav.css +104 -154
- package/src/themes/default/styles/overlays/alert-dialog.css +2 -2
- package/src/themes/default/styles/overlays/dialog.css +76 -22
- package/src/themes/default/styles/overlays/dropdown.css +108 -31
- package/src/themes/default/styles/overlays/hover-card.css +39 -17
- package/src/themes/default/styles/overlays/menubar.css +223 -0
- package/src/themes/default/styles/overlays/popover.css +69 -23
- package/src/themes/default/styles/overlays/toast.css +91 -33
- package/src/themes/default/styles/overlays/tooltip.css +88 -14
- package/src/themes/default/styles/shell/brand.css +48 -0
- package/src/themes/default/styles/shell/footer.css +72 -0
- package/src/themes/default/styles/shell/header.css +7 -50
- package/src/themes/default/styles/shell/navbar.css +226 -453
- package/src/themes/default/styles/shell/sidebar.css +243 -829
- package/src/themes/default/tokens.css +145 -98
- package/templates/theme/index.css +11 -14
- package/templates/theme/styles/actions/button-group.css +6 -6
- package/templates/theme/styles/actions/button.css +98 -60
- package/templates/theme/styles/actions/toggle-group.css +61 -25
- package/templates/theme/styles/base/text.css +87 -0
- package/templates/theme/styles/base/typography.css +24 -117
- package/templates/theme/styles/disclosure/accordion.css +35 -28
- package/templates/theme/styles/display/alert.css +7 -7
- package/templates/theme/styles/display/avatar.css +7 -1
- package/templates/theme/styles/display/badge.css +10 -10
- package/templates/theme/styles/display/card.css +10 -47
- package/templates/theme/styles/display/catalog.css +753 -0
- package/templates/theme/styles/display/coverage.css +30 -305
- package/templates/theme/styles/display/scroll-area.css +29 -24
- package/templates/theme/styles/display/spinner.css +38 -1
- package/templates/theme/styles/display/stat.css +21 -0
- package/templates/theme/styles/display/table.css +39 -12
- package/templates/theme/styles/display/virtual-list.css +24 -13
- package/templates/theme/styles/display/virtual-table.css +58 -36
- package/templates/theme/styles/forms/checkbox.css +12 -21
- package/templates/theme/styles/forms/input.css +11 -12
- package/templates/theme/styles/forms/radio-group.css +44 -27
- package/templates/theme/styles/forms/select.css +33 -35
- package/templates/theme/styles/forms/slider.css +61 -47
- package/templates/theme/styles/forms/switch.css +18 -23
- package/templates/theme/styles/forms/textarea.css +12 -12
- package/templates/theme/styles/layout/block.css +96 -12
- package/templates/theme/styles/layout/grid.css +78 -0
- package/templates/theme/styles/layout/layout.css +676 -1
- package/templates/theme/styles/layout/patterns.css +0 -155
- package/templates/theme/styles/navigation/nav.css +104 -154
- package/templates/theme/styles/overlays/alert-dialog.css +2 -2
- package/templates/theme/styles/overlays/dialog.css +76 -22
- package/templates/theme/styles/overlays/dropdown.css +108 -31
- package/templates/theme/styles/overlays/hover-card.css +39 -17
- package/templates/theme/styles/overlays/menubar.css +223 -0
- package/templates/theme/styles/overlays/popover.css +69 -23
- package/templates/theme/styles/overlays/toast.css +80 -33
- package/templates/theme/styles/overlays/tooltip.css +88 -14
- package/templates/theme/styles/shell/brand.css +48 -0
- package/templates/theme/styles/shell/footer.css +72 -0
- package/templates/theme/styles/shell/header.css +7 -50
- package/templates/theme/styles/shell/navbar.css +226 -453
- package/templates/theme/styles/shell/sidebar.css +197 -779
- package/templates/theme/tokens.css +145 -98
- package/dist/components/_internal/box-layout.js +0 -116
- package/dist/components/_internal/box-layout.js.map +0 -1
- package/dist/components/_internal/layout.d.ts +0 -9
- package/dist/components/_internal/layout.js +0 -147
- package/dist/components/_internal/layout.js.map +0 -1
- package/dist/components/badge/badge.a11y.d.ts +0 -17
- package/dist/components/block/block.a11y.d.ts +0 -20
- package/dist/components/box/box.a11y.d.ts +0 -14
- package/dist/components/box/box.d.ts +0 -9
- package/dist/components/box/box.js +0 -36
- package/dist/components/box/box.js.map +0 -1
- package/dist/components/box/box.types.d.ts +0 -72
- package/dist/components/box/index.d.ts +0 -3
- package/dist/components/breadcrumb/breadcrumb.a11y.d.ts +0 -17
- package/dist/components/breadcrumb/breadcrumb.a11y.js +0 -15
- package/dist/components/breadcrumb/breadcrumb.a11y.js.map +0 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +0 -18
- package/dist/components/breadcrumb/breadcrumb.js +0 -113
- package/dist/components/breadcrumb/breadcrumb.js.map +0 -1
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +0 -65
- package/dist/components/breadcrumb/index.d.ts +0 -3
- package/dist/components/container/container.a11y.d.ts +0 -19
- package/dist/components/flex/flex.a11y.d.ts +0 -22
- package/dist/components/flex/flex.d.ts +0 -9
- package/dist/components/flex/flex.js +0 -115
- package/dist/components/flex/flex.js.map +0 -1
- package/dist/components/flex/flex.types.d.ts +0 -42
- package/dist/components/flex/index.d.ts +0 -3
- package/dist/components/header/header.a11y.d.ts +0 -14
- package/dist/components/header/header.a11y.js +0 -12
- package/dist/components/header/header.a11y.js.map +0 -1
- package/dist/components/inline/index.d.ts +0 -8
- package/dist/components/inline/index.js +0 -13
- package/dist/components/inline/index.js.map +0 -1
- package/dist/components/list-group/index.d.ts +0 -2
- package/dist/components/list-group/list-group.d.ts +0 -9
- package/dist/components/list-group/list-group.js +0 -43
- package/dist/components/list-group/list-group.js.map +0 -1
- package/dist/components/list-group/list-group.types.d.ts +0 -32
- package/dist/components/navbar/navbar-panel.js +0 -42
- package/dist/components/navbar/navbar-panel.js.map +0 -1
- package/dist/components/navbar/navbar.context.js +0 -13
- package/dist/components/navbar/navbar.context.js.map +0 -1
- package/dist/components/navbar/navbar.render.js +0 -26
- package/dist/components/navbar/navbar.render.js.map +0 -1
- package/dist/components/navbar/navbar.shared.js +0 -18
- package/dist/components/navbar/navbar.shared.js.map +0 -1
- package/dist/components/pagination/index.d.ts +0 -2
- package/dist/components/pagination/pagination.d.ts +0 -11
- package/dist/components/pagination/pagination.js +0 -95
- package/dist/components/pagination/pagination.js.map +0 -1
- package/dist/components/pagination/pagination.types.d.ts +0 -40
- package/dist/components/section/section.a11y.d.ts +0 -15
- package/dist/components/separator/separator.a11y.d.ts +0 -17
- package/dist/components/separator/separator.a11y.js +0 -15
- package/dist/components/separator/separator.a11y.js.map +0 -1
- package/dist/components/shell/index.d.ts +0 -3
- package/dist/components/shell/shell-nav.types.d.ts +0 -7
- package/dist/components/shell/shell-panel.js +0 -54
- package/dist/components/shell/shell-panel.js.map +0 -1
- package/dist/components/shell/shell-responsive.js +0 -118
- package/dist/components/shell/shell-responsive.js.map +0 -1
- package/dist/components/shell/shell.a11y.d.ts +0 -23
- package/dist/components/shell/shell.a11y.js +0 -23
- package/dist/components/shell/shell.a11y.js.map +0 -1
- package/dist/components/shell/shell.d.ts +0 -13
- package/dist/components/shell/shell.js +0 -69
- package/dist/components/shell/shell.js.map +0 -1
- package/dist/components/shell/shell.types.d.ts +0 -58
- package/dist/components/sidebar/sidebar-panel.d.ts +0 -7
- package/dist/components/sidebar/sidebar-panel.js +0 -49
- package/dist/components/sidebar/sidebar-panel.js.map +0 -1
- package/dist/components/sidebar/sidebar-toggle.d.ts +0 -7
- package/dist/components/sidebar/sidebar-toggle.js +0 -8
- package/dist/components/sidebar/sidebar-toggle.js.map +0 -1
- package/dist/components/sidebar/sidebar.context.js +0 -21
- package/dist/components/sidebar/sidebar.context.js.map +0 -1
- package/dist/components/sidebar/sidebar.shared.js +0 -12
- package/dist/components/sidebar/sidebar.shared.js.map +0 -1
- package/dist/components/skeleton/skeleton.a11y.d.ts +0 -16
- package/dist/components/spacer/index.d.ts +0 -3
- package/dist/components/spacer/spacer.a11y.d.ts +0 -17
- package/dist/components/spacer/spacer.d.ts +0 -8
- package/dist/components/spacer/spacer.js +0 -49
- package/dist/components/spacer/spacer.js.map +0 -1
- package/dist/components/spacer/spacer.types.d.ts +0 -26
- package/dist/components/stack/index.d.ts +0 -3
- package/dist/components/stack/stack.a11y.d.ts +0 -18
- package/dist/components/stack/stack.d.ts +0 -8
- package/dist/components/stack/stack.js +0 -16
- package/dist/components/stack/stack.js.map +0 -1
- package/dist/components/stack/stack.types.d.ts +0 -22
- package/dist/feedback.d.ts +0 -5
- package/dist/feedback.js +0 -4
- package/dist/layouts.d.ts +0 -25
- package/dist/layouts.js +0 -11
- package/dist/shells.d.ts +0 -16
- package/dist/shells.js +0 -11
- package/src/components/_internal/box-layout.ts +0 -164
- package/src/components/_internal/layout.ts +0 -211
- package/src/components/box/box.a11y.ts +0 -11
- package/src/components/box/box.tsx +0 -38
- package/src/components/box/box.types.ts +0 -76
- package/src/components/box/index.ts +0 -11
- package/src/components/breadcrumb/breadcrumb.a11y.ts +0 -15
- package/src/components/breadcrumb/breadcrumb.tsx +0 -123
- package/src/components/breadcrumb/breadcrumb.types.ts +0 -74
- package/src/components/breadcrumb/index.ts +0 -24
- package/src/components/flex/flex.a11y.ts +0 -19
- package/src/components/flex/flex.tsx +0 -162
- package/src/components/flex/flex.types.ts +0 -51
- package/src/components/flex/index.ts +0 -16
- package/src/components/inline/index.tsx +0 -28
- package/src/components/list-group/index.ts +0 -7
- package/src/components/list-group/list-group.tsx +0 -74
- package/src/components/list-group/list-group.types.ts +0 -32
- package/src/components/navbar/navbar-panel.tsx +0 -62
- package/src/components/navbar/navbar.context.ts +0 -22
- package/src/components/navbar/navbar.render.tsx +0 -32
- package/src/components/navbar/navbar.shared.ts +0 -21
- package/src/components/pagination/index.ts +0 -8
- package/src/components/pagination/pagination.tsx +0 -158
- package/src/components/pagination/pagination.types.ts +0 -41
- package/src/components/shell/index.ts +0 -16
- package/src/components/shell/shell-nav.types.ts +0 -3
- package/src/components/shell/shell-panel.tsx +0 -85
- package/src/components/shell/shell-responsive.tsx +0 -246
- package/src/components/shell/shell.a11y.ts +0 -20
- package/src/components/shell/shell.tsx +0 -74
- package/src/components/shell/shell.types.ts +0 -71
- package/src/components/sidebar/sidebar-panel.tsx +0 -67
- package/src/components/sidebar/sidebar-toggle.tsx +0 -5
- package/src/components/sidebar/sidebar.context.ts +0 -40
- package/src/components/sidebar/sidebar.shared.ts +0 -12
- package/src/components/spacer/index.ts +0 -9
- package/src/components/spacer/spacer.a11y.ts +0 -14
- package/src/components/spacer/spacer.tsx +0 -61
- package/src/components/spacer/spacer.types.ts +0 -31
- package/src/components/stack/index.ts +0 -3
- package/src/components/stack/stack.a11y.ts +0 -15
- package/src/components/stack/stack.tsx +0 -13
- package/src/components/stack/stack.types.ts +0 -22
- package/src/feedback.ts +0 -6
- package/src/layouts.ts +0 -19
- package/src/shells.ts +0 -13
- package/src/themes/default/styles/actions/toggle.css +0 -50
- package/src/themes/default/styles/disclosure/collapsible.css +0 -58
- package/src/themes/default/styles/display/list-group.css +0 -84
- package/src/themes/default/styles/forms/form.css +0 -5
- package/src/themes/default/styles/layout/responsive-layout.css +0 -230
- package/src/themes/default/styles/navigation/breadcrumb.css +0 -45
- package/src/themes/default/styles/navigation/menu.css +0 -203
- package/src/themes/default/styles/navigation/menubar.css +0 -255
- package/src/themes/default/styles/navigation/pagination.css +0 -91
- package/src/themes/default/styles/shell/theme.css +0 -37
- package/templates/theme/styles/actions/toggle.css +0 -50
- package/templates/theme/styles/disclosure/collapsible.css +0 -58
- package/templates/theme/styles/display/list-group.css +0 -84
- package/templates/theme/styles/forms/form.css +0 -5
- package/templates/theme/styles/layout/responsive-layout.css +0 -230
- package/templates/theme/styles/navigation/breadcrumb.css +0 -45
- package/templates/theme/styles/navigation/menu.css +0 -203
- package/templates/theme/styles/navigation/menubar.css +0 -255
- package/templates/theme/styles/navigation/pagination.css +0 -91
- package/templates/theme/styles/shell/theme.css +0 -37
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { serializeCssDeclarations } from "./style";
|
|
2
|
+
|
|
3
|
+
export type LayoutBreakpoint = "base" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type ResponsiveValue<T> = T | Partial<Record<LayoutBreakpoint, T>>;
|
|
5
|
+
|
|
6
|
+
export type BlockSpace = "0" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "page";
|
|
7
|
+
export type BlockMargin = BlockSpace | "auto";
|
|
8
|
+
export type BlockSize =
|
|
9
|
+
| "auto"
|
|
10
|
+
| "full"
|
|
11
|
+
| "screen"
|
|
12
|
+
| "content"
|
|
13
|
+
| "sidebar"
|
|
14
|
+
| "page"
|
|
15
|
+
| "sm"
|
|
16
|
+
| "md"
|
|
17
|
+
| "lg"
|
|
18
|
+
| "xl";
|
|
19
|
+
export type BlockDirection = "row" | "column" | "row-reverse" | "column-reverse";
|
|
20
|
+
export type BlockRowFrom = Exclude<LayoutBreakpoint, "base">;
|
|
21
|
+
export type BlockAlign = "start" | "end" | "center" | "stretch" | "baseline";
|
|
22
|
+
export type BlockJustify = "start" | "end" | "center" | "between";
|
|
23
|
+
export type BlockBackground =
|
|
24
|
+
| "surface"
|
|
25
|
+
| "muted"
|
|
26
|
+
| "selected"
|
|
27
|
+
| "canvas"
|
|
28
|
+
| "raised"
|
|
29
|
+
| "overlay"
|
|
30
|
+
| "transparent";
|
|
31
|
+
export type BlockRadius = true | "sm" | "md" | "lg" | "xl" | "round";
|
|
32
|
+
export type BlockShadow = true | "sm" | "md" | "lg";
|
|
33
|
+
export type BlockZIndex =
|
|
34
|
+
| "header"
|
|
35
|
+
| "sticky"
|
|
36
|
+
| "fixed"
|
|
37
|
+
| "dropdown"
|
|
38
|
+
| "modal"
|
|
39
|
+
| "popover"
|
|
40
|
+
| "toast"
|
|
41
|
+
| "tooltip";
|
|
42
|
+
|
|
43
|
+
export type BlockLayoutProps = {
|
|
44
|
+
padding?: ResponsiveValue<BlockSpace>;
|
|
45
|
+
paddingX?: ResponsiveValue<BlockSpace>;
|
|
46
|
+
paddingY?: ResponsiveValue<BlockSpace>;
|
|
47
|
+
margin?: ResponsiveValue<BlockMargin>;
|
|
48
|
+
marginX?: ResponsiveValue<BlockMargin>;
|
|
49
|
+
marginY?: ResponsiveValue<BlockMargin>;
|
|
50
|
+
width?: ResponsiveValue<BlockSize>;
|
|
51
|
+
minWidth?: ResponsiveValue<BlockSize>;
|
|
52
|
+
maxWidth?: ResponsiveValue<BlockSize>;
|
|
53
|
+
height?: ResponsiveValue<BlockSize>;
|
|
54
|
+
minHeight?: ResponsiveValue<BlockSize>;
|
|
55
|
+
maxHeight?: ResponsiveValue<BlockSize>;
|
|
56
|
+
rowFrom?: BlockRowFrom;
|
|
57
|
+
direction?: ResponsiveValue<BlockDirection>;
|
|
58
|
+
align?: ResponsiveValue<BlockAlign>;
|
|
59
|
+
justify?: ResponsiveValue<BlockJustify>;
|
|
60
|
+
gap?: ResponsiveValue<BlockSpace>;
|
|
61
|
+
grow?: ResponsiveValue<boolean | number>;
|
|
62
|
+
shrink?: ResponsiveValue<boolean | number>;
|
|
63
|
+
center?: ResponsiveValue<boolean>;
|
|
64
|
+
sticky?: boolean;
|
|
65
|
+
top?: ResponsiveValue<BlockSpace>;
|
|
66
|
+
zIndex?: ResponsiveValue<BlockZIndex>;
|
|
67
|
+
background?: ResponsiveValue<BlockBackground>;
|
|
68
|
+
border?: ResponsiveValue<boolean>;
|
|
69
|
+
borderBottom?: ResponsiveValue<boolean>;
|
|
70
|
+
borderRight?: ResponsiveValue<boolean>;
|
|
71
|
+
radius?: ResponsiveValue<BlockRadius>;
|
|
72
|
+
shadow?: ResponsiveValue<BlockShadow>;
|
|
73
|
+
hide?: ResponsiveValue<boolean>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const BREAKPOINTS: readonly LayoutBreakpoint[] = ["base", "sm", "md", "lg", "xl"];
|
|
77
|
+
|
|
78
|
+
const SPACE_TOKEN_MAP: Record<string, string> = {
|
|
79
|
+
"0": "0",
|
|
80
|
+
xs: "var(--ak-space-xs)",
|
|
81
|
+
sm: "var(--ak-space-sm)",
|
|
82
|
+
md: "var(--ak-space-md)",
|
|
83
|
+
lg: "var(--ak-space-lg)",
|
|
84
|
+
xl: "var(--ak-space-xl)",
|
|
85
|
+
"2xl": "var(--ak-space-2xl)",
|
|
86
|
+
"3xl": "var(--ak-space-3xl)",
|
|
87
|
+
page: "var(--ak-layout-page-gutter)",
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const SIZE_TOKEN_MAP: Record<string, string> = {
|
|
91
|
+
auto: "auto",
|
|
92
|
+
full: "100%",
|
|
93
|
+
screen: "100dvh",
|
|
94
|
+
content: "min(60vh, 36rem)",
|
|
95
|
+
sidebar: "var(--ak-layout-sidebar-width)",
|
|
96
|
+
page: "var(--ak-layout-content-max-width)",
|
|
97
|
+
sm: "var(--ak-container-1)",
|
|
98
|
+
md: "var(--ak-container-2)",
|
|
99
|
+
lg: "var(--ak-container-3)",
|
|
100
|
+
xl: "var(--ak-container-4)",
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const BACKGROUND_TOKEN_MAP: Record<string, string> = {
|
|
104
|
+
canvas: "var(--ak-color-bg)",
|
|
105
|
+
surface: "var(--ak-color-surface)",
|
|
106
|
+
muted: "var(--ak-color-surface-muted)",
|
|
107
|
+
raised: "var(--ak-color-surface-raised)",
|
|
108
|
+
overlay: "var(--ak-color-surface-overlay)",
|
|
109
|
+
selected: "var(--ak-color-selected)",
|
|
110
|
+
transparent: "transparent",
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const RADIUS_TOKEN_MAP: Record<string, string> = {
|
|
114
|
+
sm: "var(--ak-radius-sm)",
|
|
115
|
+
md: "var(--ak-radius-md)",
|
|
116
|
+
lg: "var(--ak-radius-lg)",
|
|
117
|
+
xl: "var(--ak-radius-xl)",
|
|
118
|
+
round: "var(--ak-radius-round)",
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const SHADOW_TOKEN_MAP: Record<string, string> = {
|
|
122
|
+
sm: "var(--ak-shadow-sm)",
|
|
123
|
+
md: "var(--ak-shadow-md)",
|
|
124
|
+
lg: "var(--ak-shadow-lg)",
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const Z_INDEX_TOKEN_MAP: Record<string, string> = {
|
|
128
|
+
header: "var(--ak-z-sticky)",
|
|
129
|
+
sticky: "var(--ak-z-sticky)",
|
|
130
|
+
fixed: "var(--ak-z-fixed)",
|
|
131
|
+
dropdown: "var(--ak-z-dropdown)",
|
|
132
|
+
modal: "var(--ak-z-modal)",
|
|
133
|
+
popover: "var(--ak-z-popover)",
|
|
134
|
+
toast: "var(--ak-z-toast)",
|
|
135
|
+
tooltip: "var(--ak-z-tooltip)",
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const BORDER_VALUE = "1px solid var(--ak-color-border-subtle)";
|
|
139
|
+
|
|
140
|
+
const BLOCK_LAYOUT_KEYS = new Set<keyof BlockLayoutProps>([
|
|
141
|
+
"padding",
|
|
142
|
+
"paddingX",
|
|
143
|
+
"paddingY",
|
|
144
|
+
"margin",
|
|
145
|
+
"marginX",
|
|
146
|
+
"marginY",
|
|
147
|
+
"width",
|
|
148
|
+
"minWidth",
|
|
149
|
+
"maxWidth",
|
|
150
|
+
"height",
|
|
151
|
+
"minHeight",
|
|
152
|
+
"maxHeight",
|
|
153
|
+
"rowFrom",
|
|
154
|
+
"direction",
|
|
155
|
+
"align",
|
|
156
|
+
"justify",
|
|
157
|
+
"gap",
|
|
158
|
+
"grow",
|
|
159
|
+
"shrink",
|
|
160
|
+
"center",
|
|
161
|
+
"sticky",
|
|
162
|
+
"top",
|
|
163
|
+
"zIndex",
|
|
164
|
+
"background",
|
|
165
|
+
"border",
|
|
166
|
+
"borderBottom",
|
|
167
|
+
"borderRight",
|
|
168
|
+
"radius",
|
|
169
|
+
"shadow",
|
|
170
|
+
"hide",
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
function isResponsiveValue<T>(
|
|
174
|
+
value: ResponsiveValue<T> | undefined,
|
|
175
|
+
): value is Partial<Record<LayoutBreakpoint, T>> {
|
|
176
|
+
return Boolean(
|
|
177
|
+
value &&
|
|
178
|
+
typeof value === "object" &&
|
|
179
|
+
!Array.isArray(value) &&
|
|
180
|
+
BREAKPOINTS.some((breakpoint) => breakpoint in value),
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function normalizeResponsiveValue<T>(
|
|
185
|
+
value: ResponsiveValue<T> | undefined,
|
|
186
|
+
): Partial<Record<LayoutBreakpoint, T>> | undefined {
|
|
187
|
+
if (value === undefined) return undefined;
|
|
188
|
+
if (isResponsiveValue(value)) return value;
|
|
189
|
+
return { base: value };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function resolveTokenValue(
|
|
193
|
+
value: string | number,
|
|
194
|
+
tokens: Record<string, string>,
|
|
195
|
+
): string | number {
|
|
196
|
+
if (typeof value === "number") return value;
|
|
197
|
+
const trimmed = value.trim();
|
|
198
|
+
return tokens[trimmed] ?? trimmed;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function resolveSpaceValue(value: string | number): string | number {
|
|
202
|
+
return resolveTokenValue(value, SPACE_TOKEN_MAP);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function resolveSizeValue(value: string): string {
|
|
206
|
+
return String(resolveTokenValue(value, SIZE_TOKEN_MAP));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function resolveAlignValue(value: BlockAlign): string {
|
|
210
|
+
if (value === "start") return "flex-start";
|
|
211
|
+
if (value === "end") return "flex-end";
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function resolveJustifyValue(value: BlockJustify): string {
|
|
216
|
+
if (value === "start") return "flex-start";
|
|
217
|
+
if (value === "end") return "flex-end";
|
|
218
|
+
if (value === "between") return "space-between";
|
|
219
|
+
return value;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function resolveFlexFlag(value: boolean | number): string | number {
|
|
223
|
+
if (value === true) return 1;
|
|
224
|
+
if (value === false) return 0;
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function resolveBorderValue(value: boolean): string | undefined {
|
|
229
|
+
if (value === false) return "0";
|
|
230
|
+
return BORDER_VALUE;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function resolveRadiusValue(value: BlockRadius): string | undefined {
|
|
234
|
+
if (value === true) return RADIUS_TOKEN_MAP.md;
|
|
235
|
+
return String(resolveTokenValue(value, RADIUS_TOKEN_MAP));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function resolveShadowValue(value: BlockShadow): string | undefined {
|
|
239
|
+
if (value === true) return SHADOW_TOKEN_MAP.sm;
|
|
240
|
+
return String(resolveTokenValue(value, SHADOW_TOKEN_MAP));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function setResponsiveVar<T>(
|
|
244
|
+
styles: Record<string, string | number>,
|
|
245
|
+
property: string,
|
|
246
|
+
value: ResponsiveValue<T> | undefined,
|
|
247
|
+
resolve: (value: T) => string | number | undefined,
|
|
248
|
+
) {
|
|
249
|
+
const normalized = normalizeResponsiveValue(value);
|
|
250
|
+
if (!normalized) return;
|
|
251
|
+
|
|
252
|
+
for (const breakpoint of BREAKPOINTS) {
|
|
253
|
+
const breakpointValue = normalized[breakpoint];
|
|
254
|
+
if (breakpointValue === undefined) continue;
|
|
255
|
+
const resolved = resolve(breakpointValue);
|
|
256
|
+
if (resolved === undefined || resolved === "") continue;
|
|
257
|
+
styles[`--ak-${property}-${breakpoint}`] = resolved;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function splitBlockLayoutProps<T extends Record<string, unknown>>(
|
|
262
|
+
props: T,
|
|
263
|
+
): {
|
|
264
|
+
blockProps: Partial<BlockLayoutProps>;
|
|
265
|
+
rest: Omit<T, keyof BlockLayoutProps>;
|
|
266
|
+
} {
|
|
267
|
+
const blockProps: Partial<BlockLayoutProps> = {};
|
|
268
|
+
const rest: Record<string, unknown> = {};
|
|
269
|
+
|
|
270
|
+
for (const [key, value] of Object.entries(props)) {
|
|
271
|
+
if (BLOCK_LAYOUT_KEYS.has(key as keyof BlockLayoutProps)) {
|
|
272
|
+
(blockProps as Record<string, unknown>)[key] = value;
|
|
273
|
+
} else {
|
|
274
|
+
rest[key] = value;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return { blockProps, rest: rest as Omit<T, keyof BlockLayoutProps> };
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export function applyBlockLayoutStyles(
|
|
282
|
+
styles: Record<string, string | number>,
|
|
283
|
+
props: Partial<BlockLayoutProps>,
|
|
284
|
+
) {
|
|
285
|
+
setResponsiveVar(styles, "p", props.padding, resolveSpaceValue);
|
|
286
|
+
setResponsiveVar(styles, "px", props.paddingX, resolveSpaceValue);
|
|
287
|
+
setResponsiveVar(styles, "py", props.paddingY, resolveSpaceValue);
|
|
288
|
+
setResponsiveVar(styles, "m", props.margin, resolveSpaceValue);
|
|
289
|
+
setResponsiveVar(styles, "mx", props.marginX, resolveSpaceValue);
|
|
290
|
+
setResponsiveVar(styles, "my", props.marginY, resolveSpaceValue);
|
|
291
|
+
|
|
292
|
+
setResponsiveVar(styles, "width", props.width, resolveSizeValue);
|
|
293
|
+
setResponsiveVar(styles, "min-width", props.minWidth, resolveSizeValue);
|
|
294
|
+
setResponsiveVar(styles, "max-width", props.maxWidth, resolveSizeValue);
|
|
295
|
+
setResponsiveVar(styles, "height", props.height, resolveSizeValue);
|
|
296
|
+
setResponsiveVar(styles, "min-height", props.minHeight, resolveSizeValue);
|
|
297
|
+
setResponsiveVar(styles, "max-height", props.maxHeight, resolveSizeValue);
|
|
298
|
+
|
|
299
|
+
if (props.rowFrom !== undefined) {
|
|
300
|
+
styles[`--ak-flex-direction-${props.rowFrom}`] = "row";
|
|
301
|
+
}
|
|
302
|
+
setResponsiveVar(styles, "flex-direction", props.direction, (value) => value);
|
|
303
|
+
setResponsiveVar(styles, "align-items", props.align, resolveAlignValue);
|
|
304
|
+
setResponsiveVar(styles, "justify-content", props.justify, resolveJustifyValue);
|
|
305
|
+
setResponsiveVar(styles, "gap", props.gap, resolveSpaceValue);
|
|
306
|
+
setResponsiveVar(styles, "flex-grow", props.grow, resolveFlexFlag);
|
|
307
|
+
setResponsiveVar(styles, "flex-shrink", props.shrink, resolveFlexFlag);
|
|
308
|
+
|
|
309
|
+
if (props.center !== undefined) {
|
|
310
|
+
setResponsiveVar(styles, "align-items", props.center, (value) =>
|
|
311
|
+
value ? "center" : undefined,
|
|
312
|
+
);
|
|
313
|
+
setResponsiveVar(styles, "justify-content", props.center, (value) =>
|
|
314
|
+
value ? "center" : undefined,
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (props.sticky) {
|
|
319
|
+
styles["--ak-position-base"] = "sticky";
|
|
320
|
+
}
|
|
321
|
+
setResponsiveVar(styles, "top", props.top, resolveSpaceValue);
|
|
322
|
+
setResponsiveVar(styles, "z-index", props.zIndex, (value) =>
|
|
323
|
+
String(resolveTokenValue(value, Z_INDEX_TOKEN_MAP)),
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
setResponsiveVar(styles, "background", props.background, (value) =>
|
|
327
|
+
String(resolveTokenValue(value, BACKGROUND_TOKEN_MAP)),
|
|
328
|
+
);
|
|
329
|
+
setResponsiveVar(styles, "border", props.border, resolveBorderValue);
|
|
330
|
+
setResponsiveVar(styles, "border-bottom", props.borderBottom, resolveBorderValue);
|
|
331
|
+
setResponsiveVar(styles, "border-right", props.borderRight, resolveBorderValue);
|
|
332
|
+
setResponsiveVar(styles, "border-radius", props.radius, resolveRadiusValue);
|
|
333
|
+
setResponsiveVar(styles, "box-shadow", props.shadow, resolveShadowValue);
|
|
334
|
+
setResponsiveVar(styles, "display", props.hide, (value) => (value ? "none" : "flex"));
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export function mergeLayoutStyles(
|
|
338
|
+
layout: Record<string, string | number>,
|
|
339
|
+
user: unknown,
|
|
340
|
+
): string | undefined {
|
|
341
|
+
const merged: Record<string, unknown> = { ...layout };
|
|
342
|
+
|
|
343
|
+
if (user !== null && user !== undefined && typeof user === "object") {
|
|
344
|
+
Object.assign(merged, user as Record<string, unknown>);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const mergedString = serializeCssDeclarations(merged);
|
|
348
|
+
|
|
349
|
+
if (typeof user === "string" && user.trim()) {
|
|
350
|
+
return mergedString ? `${mergedString};${user.trim()}` : user.trim();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return mergedString || undefined;
|
|
354
|
+
}
|
|
@@ -53,9 +53,11 @@ export function collectJsxElements(
|
|
|
53
53
|
): JSXElement[] {
|
|
54
54
|
const result: JSXElement[] = [];
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
function visit(value: unknown): void {
|
|
57
57
|
if (Array.isArray(value)) {
|
|
58
|
-
value.
|
|
58
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
59
|
+
visit(value[index]);
|
|
60
|
+
}
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -68,13 +70,23 @@ export function collectJsxElements(
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
visit(value.props?.children);
|
|
71
|
-
}
|
|
73
|
+
}
|
|
72
74
|
|
|
73
75
|
visit(children);
|
|
74
76
|
|
|
75
77
|
return result;
|
|
76
78
|
}
|
|
77
79
|
|
|
80
|
+
function isEventHandlerLikeKey(key: string): boolean {
|
|
81
|
+
return key.length >= 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function compareKeys(left: string, right: string): number {
|
|
85
|
+
if (left < right) return -1;
|
|
86
|
+
if (left > right) return 1;
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
function serializeArray(value: readonly unknown[]): string {
|
|
79
91
|
if (value.length === 0) {
|
|
80
92
|
return "";
|
|
@@ -101,7 +113,7 @@ function serializeSerializableProps(props: Record<string, unknown>): string {
|
|
|
101
113
|
const keys: string[] = [];
|
|
102
114
|
|
|
103
115
|
for (const key of Object.keys(props)) {
|
|
104
|
-
if (key === "children" || key === "ref" || key
|
|
116
|
+
if (key === "children" || key === "ref" || isEventHandlerLikeKey(key)) {
|
|
105
117
|
continue;
|
|
106
118
|
}
|
|
107
119
|
|
|
@@ -127,14 +139,14 @@ function serializeSerializableProps(props: Record<string, unknown>): string {
|
|
|
127
139
|
}
|
|
128
140
|
|
|
129
141
|
if (keys.length === 2) {
|
|
130
|
-
if (keys[1]
|
|
142
|
+
if (keys[1] < keys[0]) {
|
|
131
143
|
[keys[0], keys[1]] = [keys[1], keys[0]];
|
|
132
144
|
}
|
|
133
145
|
|
|
134
146
|
return `${keys[0]}:${String(props[keys[0]])},${keys[1]}:${String(props[keys[1]])}`;
|
|
135
147
|
}
|
|
136
148
|
|
|
137
|
-
keys.sort(
|
|
149
|
+
keys.sort(compareKeys);
|
|
138
150
|
|
|
139
151
|
let result = `${keys[0]}:${String(props[keys[0]])}`;
|
|
140
152
|
|
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
const cssPropertyNameCache = new Map<string, string>();
|
|
2
|
+
|
|
3
|
+
function cssPropertyName(name: string): string {
|
|
4
|
+
let cached = cssPropertyNameCache.get(name);
|
|
5
|
+
if (cached !== undefined) {
|
|
6
|
+
return cached;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let result = "";
|
|
10
|
+
|
|
11
|
+
for (let index = 0; index < name.length; index += 1) {
|
|
12
|
+
const code = name.charCodeAt(index);
|
|
13
|
+
|
|
14
|
+
if (code >= 65 && code <= 90) {
|
|
15
|
+
result += `-${String.fromCharCode(code + 32)}`;
|
|
16
|
+
} else {
|
|
17
|
+
result += name[index];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
cssPropertyNameCache.set(name, result);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function serializeCssDeclarations(styles: Record<string, unknown>): string {
|
|
26
|
+
const keys = Object.keys(styles);
|
|
27
|
+
let result = "";
|
|
28
|
+
|
|
29
|
+
for (const key of keys) {
|
|
30
|
+
const value = styles[key];
|
|
31
|
+
if (value === undefined || value === null) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const declaration = `${cssPropertyName(key)}:${String(value)}`;
|
|
36
|
+
result = result ? `${result};${declaration}` : declaration;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
|
|
1
42
|
export function mergeCssVar(style: unknown, name: string, value: string): string {
|
|
2
43
|
const decl = `${name}:${value}`;
|
|
3
44
|
|
|
@@ -7,10 +48,7 @@ export function mergeCssVar(style: unknown, name: string, value: string): string
|
|
|
7
48
|
}
|
|
8
49
|
|
|
9
50
|
if (style && typeof style === "object") {
|
|
10
|
-
const entries =
|
|
11
|
-
.filter(([, v]) => v !== undefined && v !== null)
|
|
12
|
-
.map(([k, v]) => `${k.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}:${String(v)}`)
|
|
13
|
-
.join(";");
|
|
51
|
+
const entries = serializeCssDeclarations(style as Record<string, unknown>);
|
|
14
52
|
return entries ? `${entries};${decl}` : decl;
|
|
15
53
|
}
|
|
16
54
|
|
|
@@ -17,7 +17,6 @@ export function Alert(props: AlertProps): JSX.Element {
|
|
|
17
17
|
class: className,
|
|
18
18
|
description,
|
|
19
19
|
dismissLabel = "Dismiss alert",
|
|
20
|
-
dismissible = false,
|
|
21
20
|
icon,
|
|
22
21
|
onDismiss,
|
|
23
22
|
ref,
|
|
@@ -27,7 +26,7 @@ export function Alert(props: AlertProps): JSX.Element {
|
|
|
27
26
|
role,
|
|
28
27
|
...rest
|
|
29
28
|
} = props;
|
|
30
|
-
const shouldRenderDismiss =
|
|
29
|
+
const shouldRenderDismiss = onDismiss !== undefined;
|
|
31
30
|
const resolvedRole = role ?? resolveAlertRole(variant);
|
|
32
31
|
const hasVariant = variant !== "default";
|
|
33
32
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Block } from "../block";
|
|
2
|
+
import type { AsideProps } from "./aside.types";
|
|
3
|
+
|
|
4
|
+
export function Aside(props: AsideProps): JSX.Element {
|
|
5
|
+
const { children, ...rest } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Block as="aside" {...rest} data-slot="aside">
|
|
9
|
+
{children}
|
|
10
|
+
</Block>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slot } from "@askrjs/askr/foundations";
|
|
2
2
|
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
-
import { mergeLayoutStyles } from "../_internal/layout";
|
|
3
|
+
import { mergeLayoutStyles } from "../_internal/block-layout";
|
|
4
4
|
import { styleDeclarationsToClass } from "../_internal/style";
|
|
5
5
|
import type { AspectRatioAsChildProps, AspectRatioProps } from "./aspect-ratio.types";
|
|
6
6
|
|
|
@@ -2,12 +2,6 @@ export const BLOCK_A11Y_CONTRACT = {
|
|
|
2
2
|
DATA_ATTRIBUTES: {
|
|
3
3
|
slot: "data-slot" as const,
|
|
4
4
|
layout: "data-ak-layout" as const,
|
|
5
|
-
gap: "data-gap" as const,
|
|
6
|
-
gapX: "data-gap-x" as const,
|
|
7
|
-
gapY: "data-gap-y" as const,
|
|
8
|
-
align: "data-align" as const,
|
|
9
|
-
justify: "data-justify" as const,
|
|
10
|
-
size: "data-size" as const,
|
|
11
5
|
},
|
|
12
6
|
SLOT_VALUES: {
|
|
13
7
|
root: "block" as const,
|
|
@@ -1,71 +1,55 @@
|
|
|
1
1
|
import { Slot } from "@askrjs/askr/foundations";
|
|
2
|
+
import { classes } from "../_internal/classes";
|
|
3
|
+
import {
|
|
4
|
+
applyBlockLayoutStyles,
|
|
5
|
+
mergeLayoutStyles,
|
|
6
|
+
splitBlockLayoutProps,
|
|
7
|
+
} from "../_internal/block-layout";
|
|
2
8
|
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
-
import {
|
|
4
|
-
import type { BlockAsChildProps,
|
|
9
|
+
import { styleDeclarationsToClass } from "../_internal/style";
|
|
10
|
+
import type { BlockAsChildProps, BlockNativeProps } from "./block.types";
|
|
5
11
|
|
|
6
|
-
const
|
|
7
|
-
"1",
|
|
8
|
-
"2",
|
|
9
|
-
"3",
|
|
10
|
-
"4",
|
|
11
|
-
"5",
|
|
12
|
-
"6",
|
|
13
|
-
"7",
|
|
14
|
-
"8",
|
|
15
|
-
"9",
|
|
16
|
-
"xs",
|
|
17
|
-
"sm",
|
|
18
|
-
"md",
|
|
19
|
-
"lg",
|
|
20
|
-
"xl",
|
|
21
|
-
"2xl",
|
|
22
|
-
"3xl",
|
|
23
|
-
]);
|
|
12
|
+
const DEFAULT_ELEMENT = "div";
|
|
24
13
|
|
|
25
|
-
export function Block(props:
|
|
26
|
-
export function Block(props: BlockSpanProps): JSX.Element;
|
|
14
|
+
export function Block(props: BlockNativeProps): JSX.Element;
|
|
27
15
|
export function Block(props: BlockAsChildProps): JSX.Element;
|
|
28
|
-
export function Block(props:
|
|
29
|
-
const as = "as" in props ? props.as :
|
|
30
|
-
const {
|
|
16
|
+
export function Block(props: BlockNativeProps | BlockAsChildProps) {
|
|
17
|
+
const as = "as" in props ? props.as : DEFAULT_ELEMENT;
|
|
18
|
+
const {
|
|
19
|
+
asChild,
|
|
20
|
+
children,
|
|
21
|
+
ref,
|
|
22
|
+
class: classProp,
|
|
23
|
+
className,
|
|
24
|
+
style: userStyle,
|
|
25
|
+
...rest
|
|
26
|
+
} = props as (BlockNativeProps | BlockAsChildProps) & {
|
|
27
|
+
class?: unknown;
|
|
28
|
+
className?: unknown;
|
|
29
|
+
style?: unknown;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const { blockProps, rest: passthroughProps } = splitBlockLayoutProps(rest);
|
|
33
|
+
const layoutStyle: Record<string, string | number> = {};
|
|
34
|
+
applyBlockLayoutStyles(layoutStyle, blockProps);
|
|
35
|
+
|
|
36
|
+
const layoutClass = styleDeclarationsToClass(mergeLayoutStyles(layoutStyle, userStyle));
|
|
37
|
+
const slot =
|
|
38
|
+
typeof (passthroughProps as Record<string, unknown>)["data-slot"] === "string"
|
|
39
|
+
? String((passthroughProps as Record<string, unknown>)["data-slot"])
|
|
40
|
+
: "block";
|
|
31
41
|
|
|
32
|
-
const finalProps = mergeProps(
|
|
42
|
+
const finalProps = mergeProps(passthroughProps, {
|
|
33
43
|
ref,
|
|
34
|
-
|
|
44
|
+
class: classes(classProp, className, layoutClass),
|
|
45
|
+
"data-slot": slot,
|
|
35
46
|
"data-ak-layout": "true",
|
|
36
|
-
"data-gap": serializeResponsiveValueIf(
|
|
37
|
-
gap,
|
|
38
|
-
(value) => typeof value === "string" && SPACE_TOKENS.has(value.trim()),
|
|
39
|
-
),
|
|
40
|
-
"data-gap-x": serializeResponsiveValueIf(
|
|
41
|
-
gapX,
|
|
42
|
-
(value) => typeof value === "string" && SPACE_TOKENS.has(value.trim()),
|
|
43
|
-
),
|
|
44
|
-
"data-gap-y": serializeResponsiveValueIf(
|
|
45
|
-
gapY,
|
|
46
|
-
(value) => typeof value === "string" && SPACE_TOKENS.has(value.trim()),
|
|
47
|
-
),
|
|
48
|
-
"data-align": serializeResponsiveValueIf(
|
|
49
|
-
align,
|
|
50
|
-
(value) =>
|
|
51
|
-
typeof value === "string" &&
|
|
52
|
-
["start", "end", "center", "stretch", "baseline"].includes(value.trim()),
|
|
53
|
-
),
|
|
54
|
-
"data-justify": serializeResponsiveValueIf(
|
|
55
|
-
justify,
|
|
56
|
-
(value) =>
|
|
57
|
-
typeof value === "string" && ["start", "end", "center", "between"].includes(value.trim()),
|
|
58
|
-
),
|
|
59
|
-
"data-size": `initial:${size}`,
|
|
60
47
|
});
|
|
61
48
|
|
|
62
49
|
if (asChild) {
|
|
63
50
|
return <Slot asChild {...finalProps} children={children as JSX.Element} />;
|
|
64
51
|
}
|
|
65
52
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return <div {...finalProps}>{children}</div>;
|
|
53
|
+
const Element = (as ?? DEFAULT_ELEMENT) as keyof JSX.IntrinsicElements;
|
|
54
|
+
return <Element {...finalProps}>{children}</Element>;
|
|
71
55
|
}
|