@jcsoftdev/ui 0.5.0 → 0.7.0
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/CHANGELOG.md +361 -0
- package/README.md +31 -5
- package/bin/ui-theme.mjs +40 -6
- package/dist/ai/code-block/code-block.js +1 -1
- package/dist/atoms/avatar/avatar.d.ts +6 -1
- package/dist/atoms/avatar/avatar.js +3 -2
- package/dist/atoms/big-date/big-date.js +2 -2
- package/dist/atoms/button/button.d.ts +6 -1
- package/dist/atoms/button/button.js +2 -2
- package/dist/atoms/chip/chip.d.ts +5 -0
- package/dist/atoms/chip/chip.js +3 -3
- package/dist/atoms/icon-button/icon-button.js +1 -1
- package/dist/atoms/internal/hit-area.d.ts +5 -4
- package/dist/atoms/internal/hit-area.js +1 -1
- package/dist/atoms/progress/index.d.ts +1 -1
- package/dist/atoms/progress/index.js +4 -1
- package/dist/atoms/progress/progress.d.ts +6 -1
- package/dist/atoms/progress/progress.js +19 -1
- package/dist/atoms/radio-group/radio-group.js +1 -1
- package/dist/atoms/status-pill/status-pill.d.ts +16 -5
- package/dist/atoms/status-pill/status-pill.js +43 -18
- package/dist/brand/logo-forge.js +1 -1
- package/dist/charts/candlestick-chart/candlestick-chart.js +2 -2
- package/dist/charts/chart-grid/chart-grid.js +2 -2
- package/dist/charts/chord-chart/chord-chart.js +1 -1
- package/dist/charts/core/axes.js +2 -2
- package/dist/charts/core/cartesian/annotations.js +2 -2
- package/dist/charts/core/cartesian/marks.js +1 -1
- package/dist/charts/core/distribution/marks.js +1 -1
- package/dist/charts/core/distribution/xy-points.js +1 -1
- package/dist/charts/core/export-menu.js +1 -1
- package/dist/charts/funnel-chart/funnel-chart.js +1 -1
- package/dist/charts/gantt-chart/gantt-chart.js +4 -4
- package/dist/charts/gantt-chart/gantt-marks.js +3 -3
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +2 -0
- package/dist/charts/maps/geo/map-data-table.js +1 -1
- package/dist/charts/polar-area-chart/polar-area-chart.js +1 -1
- package/dist/charts/radar-chart/radar-chart.js +1 -1
- package/dist/charts/stock-chart/stock-chart.js +1 -1
- package/dist/charts/stock-chart/stock-drawing-layer.js +3 -3
- package/dist/charts/stock-chart/stock-plot.js +2 -2
- package/dist/containers/chat-thread/chat-thread.d.ts +98 -0
- package/dist/containers/chat-thread/chat-thread.js +219 -0
- package/dist/containers/chat-thread/format.d.ts +20 -0
- package/dist/containers/chat-thread/format.js +50 -0
- package/dist/containers/chat-thread/index.d.ts +1 -0
- package/dist/containers/chat-thread/index.js +8 -0
- package/dist/containers/cols/cols.d.ts +1 -1
- package/dist/containers/cols/cols.js +7 -0
- package/dist/containers/comment/comment.js +1 -1
- package/dist/containers/context-rail/context-rail.d.ts +62 -0
- package/dist/containers/context-rail/context-rail.js +175 -0
- package/dist/containers/context-rail/index.d.ts +1 -0
- package/dist/containers/context-rail/index.js +6 -0
- package/dist/containers/dashboard/dashboard.d.ts +40 -0
- package/dist/containers/dashboard/dashboard.js +84 -0
- package/dist/containers/dashboard/index.d.ts +1 -0
- package/dist/containers/dashboard/index.js +14 -0
- package/dist/containers/data-grid/data-grid.demos.js +4 -4
- package/dist/containers/data-grid/data-grid.js +6 -6
- package/dist/containers/data-grid/filter-builder-editor.js +2 -2
- package/dist/containers/data-grid/grid-toolbar.js +1 -1
- package/dist/containers/data-grid/spreadsheet.demos.d.ts +1 -1
- package/dist/containers/data-grid/spreadsheet.demos.js +1 -1
- package/dist/containers/detail-header/detail-header.d.ts +24 -0
- package/dist/containers/detail-header/detail-header.js +32 -0
- package/dist/containers/detail-header/index.d.ts +1 -0
- package/dist/containers/detail-header/index.js +6 -0
- package/dist/containers/facts/facts.js +1 -1
- package/dist/containers/filter-bar/filter-bar.d.ts +58 -0
- package/dist/containers/filter-bar/filter-bar.js +123 -0
- package/dist/containers/filter-bar/index.d.ts +1 -0
- package/dist/containers/filter-bar/index.js +6 -0
- package/dist/containers/hbars/hbars.js +2 -2
- package/dist/containers/index.d.ts +9 -0
- package/dist/containers/index.js +9 -0
- package/dist/containers/kanban/kanban.d.ts +23 -2
- package/dist/containers/kanban/kanban.js +103 -21
- package/dist/containers/kanban/model.d.ts +12 -0
- package/dist/containers/kanban/model.js +8 -0
- package/dist/containers/kpi/kpi.js +1 -1
- package/dist/containers/kpi-group/kpi-group.d.ts +6 -1
- package/dist/containers/kpi-group/kpi-group.js +6 -2
- package/dist/containers/list-detail/index.d.ts +1 -1
- package/dist/containers/list-detail/index.js +4 -0
- package/dist/containers/list-detail/list-detail.d.ts +51 -3
- package/dist/containers/list-detail/list-detail.js +111 -15
- package/dist/containers/page/page.d.ts +17 -4
- package/dist/containers/page/page.js +33 -4
- package/dist/containers/page-header/back.d.ts +10 -0
- package/dist/containers/page-header/back.js +28 -0
- package/dist/containers/page-header/index.d.ts +1 -0
- package/dist/containers/page-header/index.js +1 -0
- package/dist/containers/page-header/page-header.d.ts +19 -2
- package/dist/containers/page-header/page-header.js +26 -2
- package/dist/containers/pagination/cursor-pagination.d.ts +28 -0
- package/dist/containers/pagination/cursor-pagination.js +48 -0
- package/dist/containers/pagination/index.d.ts +3 -0
- package/dist/containers/pagination/index.js +10 -0
- package/dist/containers/pagination/pagination.d.ts +52 -0
- package/dist/containers/pagination/pagination.js +216 -0
- package/dist/containers/pagination/range.d.ts +29 -0
- package/dist/containers/pagination/range.js +42 -0
- package/dist/containers/pagination/use-pagination.d.ts +18 -0
- package/dist/containers/pagination/use-pagination.js +22 -0
- package/dist/containers/responsive-list/responsive-list.d.ts +29 -3
- package/dist/containers/responsive-list/responsive-list.js +202 -82
- package/dist/containers/row-actions/index.d.ts +1 -0
- package/dist/containers/row-actions/index.js +4 -0
- package/dist/containers/row-actions/row-actions.d.ts +26 -0
- package/dist/containers/row-actions/row-actions.js +78 -0
- package/dist/containers/selectable-card/index.d.ts +1 -0
- package/dist/containers/selectable-card/index.js +6 -0
- package/dist/containers/selectable-card/selectable-card.d.ts +26 -0
- package/dist/containers/selectable-card/selectable-card.js +57 -0
- package/dist/containers/settings-layout/settings-layout.d.ts +24 -7
- package/dist/containers/settings-layout/settings-layout.js +63 -8
- package/dist/containers/shortcuts/shortcuts.js +1 -1
- package/dist/containers/table/cell-padding.d.ts +2 -0
- package/dist/containers/table/cell-padding.js +4 -0
- package/dist/containers/table/index.d.ts +1 -0
- package/dist/containers/table/index.js +8 -0
- package/dist/containers/table/sort.d.ts +14 -0
- package/dist/containers/table/sort.js +11 -0
- package/dist/containers/table/table-parts.d.ts +24 -0
- package/dist/containers/table/table-parts.js +52 -0
- package/dist/containers/table/table.d.ts +37 -3
- package/dist/containers/table/table.js +120 -19
- package/dist/containers/table-columns-menu/index.d.ts +1 -0
- package/dist/containers/table-columns-menu/index.js +6 -0
- package/dist/containers/table-columns-menu/table-columns-menu.d.ts +14 -0
- package/dist/containers/table-columns-menu/table-columns-menu.js +46 -0
- package/dist/dashboards/layout.d.ts +1 -27
- package/dist/dashboards/layout.js +8 -40
- package/dist/forms/chip-group/chip-group.d.ts +5 -0
- package/dist/forms/chip-group/chip-group.js +3 -1
- package/dist/forms/combobox/combobox.js +1 -1
- package/dist/forms/copy-field/copy-field.js +1 -1
- package/dist/forms/date-picker/date-picker.d.ts +3 -1
- package/dist/forms/date-picker/date-picker.js +4 -2
- package/dist/forms/date-picker/date-time-picker.d.ts +8 -2
- package/dist/forms/date-picker/date-time-picker.js +13 -2
- package/dist/forms/field/field.d.ts +9 -2
- package/dist/forms/field/field.js +18 -4
- package/dist/forms/fieldset/fieldset.d.ts +11 -0
- package/dist/forms/fieldset/fieldset.js +12 -0
- package/dist/forms/fieldset/index.d.ts +1 -0
- package/dist/forms/fieldset/index.js +4 -0
- package/dist/forms/form-footer/form-footer.d.ts +26 -0
- package/dist/forms/form-footer/form-footer.js +44 -0
- package/dist/forms/form-footer/index.d.ts +1 -0
- package/dist/forms/form-footer/index.js +4 -0
- package/dist/forms/form-grid/form-grid.d.ts +21 -4
- package/dist/forms/form-grid/form-grid.js +20 -3
- package/dist/forms/form-grid/index.d.ts +1 -1
- package/dist/forms/form-grid/index.js +6 -2
- package/dist/forms/form-section/form-section.d.ts +12 -0
- package/dist/forms/form-section/form-section.js +30 -0
- package/dist/forms/form-section/index.d.ts +1 -0
- package/dist/forms/form-section/index.js +4 -0
- package/dist/forms/index.d.ts +3 -0
- package/dist/forms/index.js +3 -0
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +4 -1
- package/dist/forms/internal/listbox-items.d.ts +1 -1
- package/dist/forms/internal/listbox-items.js +3 -2
- package/dist/forms/native-select/native-select.js +1 -1
- package/dist/forms/number-stepper/index.d.ts +1 -1
- package/dist/forms/number-stepper/number-stepper.d.ts +7 -0
- package/dist/forms/number-stepper/number-stepper.js +37 -6
- package/dist/forms/select/index.d.ts +1 -1
- package/dist/forms/select/select.d.ts +5 -2
- package/dist/forms/select/select.js +7 -2
- package/dist/forms/select-menu/select-menu.js +1 -1
- package/dist/forms/time-input/time-input.d.ts +4 -2
- package/dist/forms/time-input/time-input.js +3 -1
- package/dist/i18n/strings.d.ts +94 -0
- package/dist/i18n/strings.js +50 -0
- package/dist/motion/count-up.d.ts +20 -0
- package/dist/motion/count-up.js +59 -0
- package/dist/motion/cross-fade.d.ts +21 -0
- package/dist/motion/cross-fade.js +86 -0
- package/dist/motion/index.d.ts +5 -0
- package/dist/motion/index.js +14 -0
- package/dist/motion/model.d.ts +15 -0
- package/dist/motion/model.js +68 -0
- package/dist/motion/motion-styles.d.ts +1 -0
- package/dist/motion/motion-styles.js +35 -0
- package/dist/motion/reveal.d.ts +37 -0
- package/dist/motion/reveal.js +69 -0
- package/dist/motion/use-enter-phase.d.ts +11 -0
- package/dist/motion/use-enter-phase.js +40 -0
- package/dist/motion/use-highlight-row.d.ts +22 -0
- package/dist/motion/use-highlight-row.js +38 -0
- package/dist/navigation/tabs/tabs.js +1 -1
- package/dist/navigation/wizard/wizard.d.ts +4 -1
- package/dist/navigation/wizard/wizard.js +3 -0
- package/dist/overlays/alert-dialog/alert-dialog.js +8 -1
- package/dist/overlays/context-menu/context-menu.js +3 -1
- package/dist/overlays/dialog/dialog.d.ts +1 -0
- package/dist/overlays/dialog/dialog.js +11 -3
- package/dist/overlays/drawer/drawer.d.ts +18 -4
- package/dist/overlays/drawer/drawer.js +53 -4
- package/dist/overlays/drawer/index.d.ts +1 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/overlays/dropdown-menu/dropdown-menu.js +5 -4
- package/dist/overlays/hover-card/hover-card.js +2 -0
- package/dist/overlays/popover/popover.js +2 -0
- package/dist/overlays/toaster/index.d.ts +1 -1
- package/dist/overlays/toaster/toast-store.d.ts +2 -0
- package/dist/overlays/toaster/toast-store.js +6 -1
- package/dist/overlays/toaster/toaster.d.ts +28 -2
- package/dist/overlays/toaster/toaster.js +86 -29
- package/dist/overlays/tooltip/tooltip.js +2 -0
- package/dist/primitives/use-presence.js +9 -0
- package/dist/shell/app-shell/app-shell.d.ts +8 -1
- package/dist/shell/app-shell/app-shell.js +50 -3
- package/dist/shell/index.d.ts +1 -0
- package/dist/shell/index.js +1 -0
- package/dist/shell/sidebar/sidebar.d.ts +17 -1
- package/dist/shell/sidebar/sidebar.js +126 -76
- package/dist/shell/topbar/topbar.d.ts +4 -2
- package/dist/shell/topbar/topbar.js +2 -0
- package/dist/showcase/operations-bento.js +2 -2
- package/dist/states/empty-state/empty-state.d.ts +10 -3
- package/dist/states/empty-state/empty-state.js +46 -5
- package/dist/states/error-state/error-state.js +1 -1
- package/dist/states/skeleton/skeleton.d.ts +16 -1
- package/dist/states/skeleton/skeleton.js +13 -5
- package/dist/utils/class-tokens.generated.js +4 -6
- package/dist/utils/focus-chain.d.ts +11 -0
- package/dist/utils/focus-chain.js +39 -0
- package/dist/utils/focus-rescue.d.ts +13 -0
- package/dist/utils/focus-rescue.js +48 -0
- package/dist/utils/list-navigation.d.ts +14 -0
- package/dist/utils/list-navigation.js +44 -0
- package/dist/utils/overlay-motion.d.ts +12 -0
- package/dist/utils/overlay-motion.js +14 -0
- package/dist/utils/use-container-width.d.ts +6 -0
- package/dist/utils/use-container-width.js +19 -0
- package/package.json +2 -2
- package/scripts/build-theme.mjs +46 -5
- package/src/ai/code-block/code-block.tsx +1 -1
- package/src/atoms/avatar/avatar.tsx +8 -2
- package/src/atoms/big-date/big-date.tsx +2 -2
- package/src/atoms/button/button.tsx +8 -3
- package/src/atoms/chip/chip.tsx +8 -3
- package/src/atoms/icon-button/icon-button.tsx +1 -1
- package/src/atoms/internal/hit-area.ts +5 -4
- package/src/atoms/progress/index.ts +8 -1
- package/src/atoms/progress/progress.tsx +30 -1
- package/src/atoms/radio-group/radio-group.tsx +1 -1
- package/src/atoms/status-pill/status-pill.tsx +59 -18
- package/src/brand/logo-forge.tsx +1 -1
- package/src/charts/candlestick-chart/candlestick-chart.tsx +2 -2
- package/src/charts/chart-grid/chart-grid.tsx +2 -2
- package/src/charts/chord-chart/chord-chart.tsx +1 -1
- package/src/charts/core/axes.tsx +2 -2
- package/src/charts/core/cartesian/annotations.tsx +2 -2
- package/src/charts/core/cartesian/marks.tsx +1 -1
- package/src/charts/core/distribution/marks.tsx +1 -1
- package/src/charts/core/distribution/xy-points.tsx +1 -1
- package/src/charts/core/export-menu.tsx +1 -1
- package/src/charts/funnel-chart/funnel-chart.tsx +1 -1
- package/src/charts/gantt-chart/gantt-chart.tsx +4 -4
- package/src/charts/gantt-chart/gantt-marks.tsx +3 -3
- package/src/charts/index.ts +2 -0
- package/src/charts/maps/geo/map-data-table.tsx +1 -1
- package/src/charts/polar-area-chart/polar-area-chart.tsx +1 -1
- package/src/charts/radar-chart/radar-chart.tsx +1 -1
- package/src/charts/stock-chart/stock-chart.tsx +1 -1
- package/src/charts/stock-chart/stock-drawing-layer.tsx +3 -3
- package/src/charts/stock-chart/stock-plot.tsx +2 -2
- package/src/containers/chat-thread/chat-thread.tsx +331 -0
- package/src/containers/chat-thread/format.ts +67 -0
- package/src/containers/chat-thread/index.ts +12 -0
- package/src/containers/cols/cols.tsx +13 -1
- package/src/containers/comment/comment.tsx +1 -1
- package/src/containers/context-rail/context-rail.tsx +229 -0
- package/src/containers/context-rail/index.ts +7 -0
- package/src/containers/dashboard/dashboard.tsx +142 -0
- package/src/containers/dashboard/index.ts +12 -0
- package/src/containers/data-grid/data-grid.demos.tsx +4 -4
- package/src/containers/data-grid/data-grid.tsx +6 -6
- package/src/containers/data-grid/filter-builder-editor.tsx +2 -2
- package/src/containers/data-grid/grid-toolbar.tsx +1 -1
- package/src/containers/data-grid/spreadsheet.demos.tsx +1 -1
- package/src/containers/detail-header/detail-header.tsx +64 -0
- package/src/containers/detail-header/index.ts +5 -0
- package/src/containers/facts/facts.tsx +1 -1
- package/src/containers/filter-bar/filter-bar.tsx +201 -0
- package/src/containers/filter-bar/index.ts +7 -0
- package/src/containers/hbars/hbars.tsx +2 -2
- package/src/containers/index.ts +9 -0
- package/src/containers/kanban/kanban.tsx +148 -39
- package/src/containers/kanban/model.ts +20 -0
- package/src/containers/kpi/kpi.tsx +1 -1
- package/src/containers/kpi-group/kpi-group.tsx +17 -2
- package/src/containers/list-detail/index.ts +5 -0
- package/src/containers/list-detail/list-detail.tsx +159 -9
- package/src/containers/page/page.tsx +61 -7
- package/src/containers/page-header/back.tsx +42 -0
- package/src/containers/page-header/index.ts +1 -0
- package/src/containers/page-header/page-header.tsx +49 -3
- package/src/containers/pagination/cursor-pagination.tsx +79 -0
- package/src/containers/pagination/index.ts +7 -0
- package/src/containers/pagination/pagination.tsx +266 -0
- package/src/containers/pagination/range.ts +68 -0
- package/src/containers/pagination/use-pagination.ts +44 -0
- package/src/containers/responsive-list/responsive-list.tsx +190 -47
- package/src/containers/row-actions/index.ts +1 -0
- package/src/containers/row-actions/row-actions.tsx +114 -0
- package/src/containers/selectable-card/index.ts +5 -0
- package/src/containers/selectable-card/selectable-card.tsx +84 -0
- package/src/containers/settings-layout/settings-layout.tsx +104 -13
- package/src/containers/shortcuts/shortcuts.tsx +1 -1
- package/src/containers/table/cell-padding.ts +2 -0
- package/src/containers/table/index.ts +6 -0
- package/src/containers/table/sort.ts +23 -0
- package/src/containers/table/table-parts.tsx +81 -0
- package/src/containers/table/table.tsx +212 -45
- package/src/containers/table-columns-menu/index.ts +5 -0
- package/src/containers/table-columns-menu/table-columns-menu.tsx +68 -0
- package/src/dashboards/layout.tsx +8 -75
- package/src/forms/chip-group/chip-group.tsx +8 -1
- package/src/forms/combobox/combobox.tsx +1 -1
- package/src/forms/copy-field/copy-field.tsx +1 -1
- package/src/forms/date-picker/date-picker.tsx +7 -2
- package/src/forms/date-picker/date-time-picker.tsx +28 -2
- package/src/forms/field/field.tsx +30 -3
- package/src/forms/fieldset/fieldset.tsx +22 -0
- package/src/forms/fieldset/index.ts +1 -0
- package/src/forms/form-footer/form-footer.tsx +74 -0
- package/src/forms/form-footer/index.ts +1 -0
- package/src/forms/form-grid/form-grid.tsx +42 -5
- package/src/forms/form-grid/index.ts +8 -1
- package/src/forms/form-section/form-section.tsx +41 -0
- package/src/forms/form-section/index.ts +1 -0
- package/src/forms/index.ts +3 -0
- package/src/forms/input/input.tsx +10 -3
- package/src/forms/internal/listbox-items.tsx +3 -4
- package/src/forms/native-select/native-select.tsx +1 -1
- package/src/forms/number-stepper/index.ts +1 -0
- package/src/forms/number-stepper/number-stepper.tsx +51 -6
- package/src/forms/select/index.ts +1 -1
- package/src/forms/select/select.tsx +14 -3
- package/src/forms/select-menu/select-menu.tsx +1 -1
- package/src/forms/time-input/time-input.tsx +6 -2
- package/src/i18n/strings.ts +94 -0
- package/src/motion/count-up.tsx +83 -0
- package/src/motion/cross-fade.tsx +139 -0
- package/src/motion/index.ts +5 -0
- package/src/motion/model.ts +86 -0
- package/src/motion/motion-styles.tsx +47 -0
- package/src/motion/reveal.tsx +115 -0
- package/src/motion/use-enter-phase.ts +50 -0
- package/src/motion/use-highlight-row.ts +63 -0
- package/src/navigation/tabs/tabs.tsx +1 -1
- package/src/navigation/wizard/wizard.tsx +6 -1
- package/src/overlays/alert-dialog/alert-dialog.tsx +5 -1
- package/src/overlays/context-menu/context-menu.tsx +3 -2
- package/src/overlays/dialog/dialog.tsx +9 -3
- package/src/overlays/drawer/drawer.tsx +68 -6
- package/src/overlays/drawer/index.ts +1 -0
- package/src/overlays/dropdown-menu/dropdown-menu.tsx +5 -4
- package/src/overlays/hover-card/hover-card.tsx +2 -0
- package/src/overlays/popover/popover.tsx +2 -0
- package/src/overlays/toaster/index.ts +2 -0
- package/src/overlays/toaster/toast-store.ts +8 -0
- package/src/overlays/toaster/toaster.tsx +127 -17
- package/src/overlays/tooltip/tooltip.tsx +2 -0
- package/src/primitives/use-presence.ts +13 -0
- package/src/shell/app-shell/app-shell.tsx +54 -2
- package/src/shell/index.ts +1 -0
- package/src/shell/sidebar/sidebar.tsx +154 -75
- package/src/shell/topbar/topbar.tsx +8 -0
- package/src/showcase/operations-bento.tsx +2 -2
- package/src/states/empty-state/empty-state.tsx +52 -9
- package/src/states/error-state/error-state.tsx +1 -1
- package/src/states/skeleton/skeleton.tsx +33 -5
- package/src/utils/class-tokens.generated.ts +4 -6
- package/src/utils/focus-chain.ts +53 -0
- package/src/utils/focus-rescue.ts +68 -0
- package/src/utils/list-navigation.ts +63 -0
- package/src/utils/overlay-motion.ts +33 -0
- package/src/utils/use-container-width.ts +24 -0
- package/styles/Theme.kt +15 -18
- package/styles/tailwind.css +29 -28
- package/styles/theme.css +29 -28
- package/styles/tokens.css +46 -0
- package/tokens/default.json +51 -29
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
3
4
|
import { useUiStrings } from "../../i18n/index.js";
|
|
4
5
|
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { useFocusRescue } from "../../utils/focus-rescue.js";
|
|
7
|
+
import { focusRowByKey } from "../../utils/list-navigation.js";
|
|
5
8
|
import {
|
|
6
9
|
Table,
|
|
7
10
|
TableBody,
|
|
@@ -10,6 +13,32 @@ import {
|
|
|
10
13
|
TableHeaderCell,
|
|
11
14
|
TableRow
|
|
12
15
|
} from "../table/table.js";
|
|
16
|
+
const tableClasses = {
|
|
17
|
+
480: {
|
|
18
|
+
table: "hidden @min-[480px]/responsive-list:block",
|
|
19
|
+
cards: "@min-[480px]/responsive-list:hidden"
|
|
20
|
+
},
|
|
21
|
+
640: {
|
|
22
|
+
table: "hidden @min-[640px]/responsive-list:block",
|
|
23
|
+
cards: "@min-[640px]/responsive-list:hidden"
|
|
24
|
+
},
|
|
25
|
+
672: {
|
|
26
|
+
table: "hidden @min-[42rem]/responsive-list:block",
|
|
27
|
+
cards: "@min-[42rem]/responsive-list:hidden"
|
|
28
|
+
},
|
|
29
|
+
768: {
|
|
30
|
+
table: "hidden @min-[768px]/responsive-list:block",
|
|
31
|
+
cards: "@min-[768px]/responsive-list:hidden"
|
|
32
|
+
},
|
|
33
|
+
960: {
|
|
34
|
+
table: "hidden @min-[960px]/responsive-list:block",
|
|
35
|
+
cards: "@min-[960px]/responsive-list:hidden"
|
|
36
|
+
},
|
|
37
|
+
1280: {
|
|
38
|
+
table: "hidden @min-[1280px]/responsive-list:block",
|
|
39
|
+
cards: "@min-[1280px]/responsive-list:hidden"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
13
42
|
function ResponsiveList({
|
|
14
43
|
caption,
|
|
15
44
|
items,
|
|
@@ -18,100 +47,191 @@ function ResponsiveList({
|
|
|
18
47
|
renderActions,
|
|
19
48
|
actionsHeader,
|
|
20
49
|
rowClassName,
|
|
50
|
+
layout = "auto",
|
|
51
|
+
breakpoint = 672,
|
|
52
|
+
cardLabels = "visible",
|
|
53
|
+
selectedKey,
|
|
54
|
+
onSelect,
|
|
55
|
+
selectOnFocus = false,
|
|
21
56
|
className,
|
|
22
57
|
classNames
|
|
23
58
|
}) {
|
|
24
59
|
const strings = useUiStrings();
|
|
60
|
+
const rootRef = useRef(null);
|
|
61
|
+
useFocusRescue(rootRef, { item: "[data-row-key]", group: "tbody, ul" });
|
|
25
62
|
const primary = columns.find((column) => column.primary) ?? columns[0];
|
|
26
63
|
const details = columns.filter((column) => column !== primary);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)
|
|
53
|
-
|
|
64
|
+
const selectable = onSelect !== void 0;
|
|
65
|
+
const listbox = selectable && !renderActions;
|
|
66
|
+
const firstKey = items[0] ? rowKey(items[0]) : void 0;
|
|
67
|
+
const stopKey = selectedKey != null && items.some((item) => rowKey(item) === selectedKey) ? selectedKey : firstKey;
|
|
68
|
+
const rowProps = (item, kind) => {
|
|
69
|
+
if (!selectable) return {};
|
|
70
|
+
const key = rowKey(item);
|
|
71
|
+
const selected = key === selectedKey;
|
|
72
|
+
const select = () => onSelect(key, item);
|
|
73
|
+
return {
|
|
74
|
+
tabIndex: key === stopKey ? 0 : -1,
|
|
75
|
+
"data-selected": selected ? "true" : void 0,
|
|
76
|
+
...kind === "grid" || listbox ? { "aria-selected": selected } : { "aria-current": selected ? "true" : void 0 },
|
|
77
|
+
...kind === "card" && listbox ? { role: "option" } : {},
|
|
78
|
+
onClick: (event) => {
|
|
79
|
+
if (event.target.closest(
|
|
80
|
+
"a, button, input, select, textarea, [data-row-actions]"
|
|
81
|
+
))
|
|
82
|
+
return;
|
|
83
|
+
select();
|
|
84
|
+
},
|
|
85
|
+
onKeyDown: (event) => {
|
|
86
|
+
if (event.target !== event.currentTarget) return;
|
|
87
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
select();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const scope = event.currentTarget.closest("[data-row-scope]");
|
|
93
|
+
if (!scope || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
94
|
+
const row = focusRowByKey(scope, event.currentTarget, event.key);
|
|
95
|
+
if (!row) return;
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
if (selectOnFocus) {
|
|
98
|
+
const nextKey = row.getAttribute("data-row-key");
|
|
99
|
+
const next = items.find((candidate) => rowKey(candidate) === nextKey);
|
|
100
|
+
if (next) onSelect(rowKey(next), next);
|
|
101
|
+
}
|
|
54
102
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"li",
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
return /* @__PURE__ */ jsxs(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
ref: rootRef,
|
|
109
|
+
className: cn("@container/responsive-list min-w-0", classNames?.root, className),
|
|
110
|
+
children: [
|
|
111
|
+
layout === "auto" ? /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
66
113
|
{
|
|
67
|
-
"data-row-key": rowKey(item),
|
|
68
114
|
className: cn(
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
classNames?.
|
|
115
|
+
"rounded-card border-card shadow-card surface-card",
|
|
116
|
+
tableClasses[breakpoint].table,
|
|
117
|
+
classNames?.tableWrapper
|
|
72
118
|
),
|
|
73
|
-
children:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
119
|
+
children: /* @__PURE__ */ jsxs(
|
|
120
|
+
Table,
|
|
121
|
+
{
|
|
122
|
+
...selectable ? { role: "grid", "aria-label": caption, "data-row-scope": "" } : {},
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }),
|
|
125
|
+
/* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsxs(TableRow, { className: "hover:bg-transparent", children: [
|
|
126
|
+
columns.map((column) => /* @__PURE__ */ jsx(TableHeaderCell, { scope: "col", alignRight: column.align === "end", children: column.header }, column.key)),
|
|
127
|
+
renderActions ? /* @__PURE__ */ jsx(TableHeaderCell, { scope: "col", alignRight: true, children: actionsHeader ?? strings.actions }) : null
|
|
128
|
+
] }) }),
|
|
129
|
+
/* @__PURE__ */ jsx(TableBody, { children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
130
|
+
TableRow,
|
|
131
|
+
{
|
|
132
|
+
"data-row-key": rowKey(item),
|
|
133
|
+
className: cn(
|
|
134
|
+
rowClassName?.(item),
|
|
135
|
+
selectable && "cursor-pointer focus-visible:focus-ring data-[selected=true]:bg-accent-soft"
|
|
136
|
+
),
|
|
137
|
+
...rowProps(item, "grid"),
|
|
138
|
+
children: [
|
|
139
|
+
columns.map((column) => /* @__PURE__ */ jsx(TableCell, { alignRight: column.align === "end", children: column.cell(item) }, column.key)),
|
|
140
|
+
renderActions ? /* @__PURE__ */ jsx(TableCell, { alignRight: true, children: /* @__PURE__ */ jsx(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
"data-row-actions": "",
|
|
144
|
+
className: cn("flex flex-wrap justify-end gap-2", classNames?.actions),
|
|
145
|
+
children: renderActions(item)
|
|
146
|
+
}
|
|
147
|
+
) }) : null
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
rowKey(item)
|
|
151
|
+
)) })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
) : null,
|
|
157
|
+
/* @__PURE__ */ jsx(
|
|
158
|
+
"ul",
|
|
159
|
+
{
|
|
160
|
+
"aria-label": caption,
|
|
161
|
+
...listbox ? { role: "listbox" } : {},
|
|
162
|
+
...selectable ? { "data-row-scope": "" } : {},
|
|
163
|
+
className: cn(
|
|
164
|
+
"m-0 flex list-none flex-col gap-density p-0",
|
|
165
|
+
layout === "auto" && tableClasses[breakpoint].cards,
|
|
166
|
+
classNames?.cards
|
|
167
|
+
),
|
|
168
|
+
children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
169
|
+
"li",
|
|
170
|
+
{
|
|
171
|
+
"data-row-key": rowKey(item),
|
|
172
|
+
className: cn(
|
|
173
|
+
"flex min-w-0 flex-col gap-3 rounded-card border-card p-card shadow-card surface-card",
|
|
174
|
+
selectable && "cursor-pointer focus-visible:focus-ring data-[selected=true]:bg-accent-soft data-[selected=true]:shadow-selected",
|
|
175
|
+
rowClassName?.(item),
|
|
176
|
+
classNames?.card
|
|
177
|
+
),
|
|
178
|
+
...rowProps(item, "card"),
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
className: cn(
|
|
184
|
+
"min-w-0 font-semibold text-fs-150 text-ink [overflow-wrap:anywhere]",
|
|
185
|
+
classNames?.cardTitle
|
|
186
|
+
),
|
|
187
|
+
children: primary?.cell(item)
|
|
188
|
+
}
|
|
90
189
|
),
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
190
|
+
details.length > 0 ? /* @__PURE__ */ jsx("dl", { className: cn("m-0 flex flex-col gap-2", classNames?.cardDetails), children: details.map((column) => /* @__PURE__ */ jsxs(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
className: cn(
|
|
194
|
+
"flex items-baseline justify-between gap-4",
|
|
195
|
+
cardLabels === "hidden" && "justify-start",
|
|
196
|
+
classNames?.cardDetail
|
|
197
|
+
),
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
"dt",
|
|
201
|
+
{
|
|
202
|
+
className: cn(
|
|
203
|
+
"shrink-0 text-ink-3 text-meta",
|
|
204
|
+
cardLabels === "hidden" && "sr-only",
|
|
205
|
+
classNames?.cardLabel
|
|
206
|
+
),
|
|
207
|
+
children: column.header
|
|
208
|
+
}
|
|
99
209
|
),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
210
|
+
/* @__PURE__ */ jsx(
|
|
211
|
+
"dd",
|
|
212
|
+
{
|
|
213
|
+
className: cn(
|
|
214
|
+
"m-0 min-w-0 text-right text-body text-ink [overflow-wrap:anywhere]",
|
|
215
|
+
cardLabels === "hidden" && "text-left",
|
|
216
|
+
classNames?.cardValue
|
|
217
|
+
),
|
|
218
|
+
children: column.cell(item)
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
column.key
|
|
224
|
+
)) }) : null,
|
|
225
|
+
renderActions ? /* @__PURE__ */ jsx("div", { "data-row-actions": "", className: cn("flex flex-wrap gap-2", classNames?.actions), children: renderActions(item) }) : null
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
rowKey(item)
|
|
229
|
+
))
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
);
|
|
115
235
|
}
|
|
116
236
|
export {
|
|
117
237
|
ResponsiveList
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type RowActionItem, RowActions, type RowActionsProps } from "./row-actions.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
export interface RowActionItem {
|
|
3
|
+
/** Stable key of the item. */
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
onSelect: () => void;
|
|
7
|
+
/** Leading decorative icon. */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** `danger` items sort to the end of the menu, behind a separator, and read in the danger colour. */
|
|
10
|
+
tone?: "default" | "danger";
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface RowActionsProps extends Omit<ComponentPropsWithoutRef<"span">, "children" | "onClick" | "onKeyDown"> {
|
|
14
|
+
/** Accessible name of the overflow trigger. Name the row: "Actions for Ana Quispe". */
|
|
15
|
+
label: string;
|
|
16
|
+
/** At most one inline action, typically a `Button size="sm"`: the one thing the row is mostly for. */
|
|
17
|
+
primary?: ReactNode;
|
|
18
|
+
/** The rest, in the overflow menu. No trigger renders when it is empty. */
|
|
19
|
+
items: readonly RowActionItem[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One row's actions: at most one inline primary action, the rest in an overflow menu behind a
|
|
23
|
+
* 30px "more" button. It never wraps, so the row keeps its height; destructive items sort last,
|
|
24
|
+
* behind a separator. The menu is a WAI-ARIA menu: arrows, Home/End, typeahead, Escape.
|
|
25
|
+
*/
|
|
26
|
+
export declare function RowActions({ label, primary, items, className, ...props }: RowActionsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
Fragment
|
|
5
|
+
} from "react";
|
|
6
|
+
import { IconButton } from "../../atoms/icon-button/icon-button.js";
|
|
7
|
+
import { EllipsisVertical } from "../../icons/index.js";
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenu,
|
|
10
|
+
DropdownMenuContent,
|
|
11
|
+
DropdownMenuItem,
|
|
12
|
+
DropdownMenuSeparator,
|
|
13
|
+
DropdownMenuTrigger
|
|
14
|
+
} from "../../overlays/dropdown-menu/dropdown-menu.js";
|
|
15
|
+
import { cn } from "../../utils/cn.js";
|
|
16
|
+
function contain(event) {
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
}
|
|
19
|
+
function RowActions({ label, primary, items, className, ...props }) {
|
|
20
|
+
const regular = items.filter((item) => item.tone !== "danger");
|
|
21
|
+
const destructive = items.filter((item) => item.tone === "danger");
|
|
22
|
+
return (
|
|
23
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: only stops events from bubbling to the row; the controls inside are the interactive parts
|
|
24
|
+
/* @__PURE__ */ jsxs(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
"data-slot": "row-actions",
|
|
28
|
+
className: cn(
|
|
29
|
+
"inline-flex flex-nowrap items-center justify-end gap-1.5 whitespace-nowrap",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props,
|
|
33
|
+
onClick: contain,
|
|
34
|
+
onKeyDown: contain,
|
|
35
|
+
children: [
|
|
36
|
+
primary,
|
|
37
|
+
items.length > 0 ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
39
|
+
IconButton,
|
|
40
|
+
{
|
|
41
|
+
size: "sm",
|
|
42
|
+
variant: "secondary",
|
|
43
|
+
label,
|
|
44
|
+
className: "transition-[scale,color] duration-(--motion-duration) ease-(--motion-ease) motion-reduce:transition-none [@media(hover:hover)]:text-ink-3 [@media(hover:hover)]:group-focus-within/row:text-ink [@media(hover:hover)]:group-hover/row:text-ink data-[state=open]:text-ink",
|
|
45
|
+
children: /* @__PURE__ */ jsx(EllipsisVertical, { "aria-hidden": "true" })
|
|
46
|
+
}
|
|
47
|
+
) }),
|
|
48
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", children: [regular, destructive].map(
|
|
49
|
+
(group, index) => group.length === 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
index === 1 && regular.length > 0 ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
|
|
51
|
+
group.map((item) => /* @__PURE__ */ jsxs(
|
|
52
|
+
DropdownMenuItem,
|
|
53
|
+
{
|
|
54
|
+
disabled: item.disabled,
|
|
55
|
+
onSelect: () => item.onSelect(),
|
|
56
|
+
"data-tone": item.tone === "danger" ? "danger" : void 0,
|
|
57
|
+
className: cn(
|
|
58
|
+
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
59
|
+
item.tone === "danger" && "text-danger data-highlighted:bg-danger-soft"
|
|
60
|
+
),
|
|
61
|
+
children: [
|
|
62
|
+
item.icon,
|
|
63
|
+
item.label
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
item.id
|
|
67
|
+
))
|
|
68
|
+
] }, index === 0 ? "regular" : "destructive")
|
|
69
|
+
) })
|
|
70
|
+
] }) : null
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
RowActions
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SelectableCard, type SelectableCardPart, type SelectableCardProps, } from "./selectable-card.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef, type ReactNode } from "react";
|
|
2
|
+
import type { ClassNames } from "../../utils/class-names.js";
|
|
3
|
+
export type SelectableCardPart = "root" | "content" | "reason";
|
|
4
|
+
export interface SelectableCardProps extends Omit<ComponentPropsWithRef<"button">, "children" | "role" | "aria-checked"> {
|
|
5
|
+
/** Card content. It sits inside a button, so use phrasing content only (spans, text, icons). */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Selectable mode. Omitted: the card is a plain button that runs `onClick`. A boolean makes it
|
|
9
|
+
* a toggle (`aria-pressed`), or a radio (`aria-checked`) with `semantics="radio"`.
|
|
10
|
+
*/
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
/** `"pressed"` for a toggle (default), `"radio"` when exactly one card of a group is selected; wrap the group in `role="radiogroup"`. */
|
|
13
|
+
semantics?: "pressed" | "radio";
|
|
14
|
+
/** The card stays focusable and ignores clicks (`aria-disabled`), and the reason is read out with it. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Visible text explaining why the card is disabled; announced as its description. */
|
|
17
|
+
disabledReason?: string;
|
|
18
|
+
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root and is merged last. */
|
|
19
|
+
classNames?: ClassNames<SelectableCardPart>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A card that is itself the interactive element: one `button`, no overlay and no nested
|
|
23
|
+
* controls. Use it as a button (`onClick`) or as a selectable option (`selected`). A disabled card
|
|
24
|
+
* keeps focus so its reason can be reached.
|
|
25
|
+
*/
|
|
26
|
+
export declare function SelectableCard({ children, selected, semantics, disabled, disabledReason, onClick, className, classNames, "aria-describedby": describedBy, ...props }: SelectableCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
function SelectableCard({
|
|
6
|
+
children,
|
|
7
|
+
selected,
|
|
8
|
+
semantics = "pressed",
|
|
9
|
+
disabled = false,
|
|
10
|
+
disabledReason,
|
|
11
|
+
onClick,
|
|
12
|
+
className,
|
|
13
|
+
classNames,
|
|
14
|
+
"aria-describedby": describedBy,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const reasonId = useId();
|
|
18
|
+
const showReason = disabled && Boolean(disabledReason);
|
|
19
|
+
const radio = semantics === "radio" && selected !== void 0;
|
|
20
|
+
const handleClick = (event) => {
|
|
21
|
+
if (disabled) {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
onClick?.(event);
|
|
26
|
+
};
|
|
27
|
+
return (
|
|
28
|
+
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-checked is only set together with role="radio"
|
|
29
|
+
/* @__PURE__ */ jsxs(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
...props,
|
|
34
|
+
role: radio ? "radio" : void 0,
|
|
35
|
+
"aria-checked": radio ? selected : void 0,
|
|
36
|
+
"aria-pressed": !radio && selected !== void 0 ? selected : void 0,
|
|
37
|
+
"aria-disabled": disabled || void 0,
|
|
38
|
+
"aria-describedby": [describedBy, showReason ? reasonId : void 0].filter(Boolean).join(" ") || void 0,
|
|
39
|
+
onClick: handleClick,
|
|
40
|
+
className: cn(
|
|
41
|
+
"pressable flex w-full min-w-0 flex-col gap-1 rounded-card border-card p-card text-left shadow-card surface-card focus-visible:focus-ring",
|
|
42
|
+
selected && "border-accent-line bg-accent-soft shadow-selected",
|
|
43
|
+
disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
44
|
+
classNames?.root,
|
|
45
|
+
className
|
|
46
|
+
),
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: cn("flex min-w-0 flex-col gap-1", classNames?.content), children }),
|
|
49
|
+
showReason ? /* @__PURE__ */ jsx("span", { id: reasonId, className: cn("text-ink-3 text-meta", classNames?.reason), children: disabledReason }) : null
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
SelectableCard
|
|
57
|
+
};
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
/** Container widths (px) under which the layout stacks. The set is closed so every query is a literal class. */
|
|
3
|
+
export type SettingsLayoutBreakpoint = 720 | 940 | 1080 | 1280;
|
|
4
|
+
export type SettingsLayoutContainer = "page" | "self";
|
|
5
|
+
export interface SettingsLayoutProps extends ComponentPropsWithoutRef<"div"> {
|
|
6
|
+
/**
|
|
7
|
+
* Container width (px) under which the nav and the content stack. `"never"` keeps two columns.
|
|
8
|
+
* Defaults to 940. `SettingsLayoutNav` follows it without being told.
|
|
9
|
+
*/
|
|
10
|
+
breakpoint?: SettingsLayoutBreakpoint | "never";
|
|
11
|
+
/**
|
|
12
|
+
* Which container is measured. `"page"` (default) is the ancestor `@container/page`;
|
|
13
|
+
* `"self"` wraps the layout in its own container, for use outside a page shell.
|
|
14
|
+
*/
|
|
15
|
+
container?: SettingsLayoutContainer;
|
|
16
|
+
}
|
|
3
17
|
/**
|
|
4
|
-
* Two-column settings grid (side nav + content).
|
|
5
|
-
*
|
|
18
|
+
* Two-column settings grid (side nav + content). Stacks to one column under `breakpoint`
|
|
19
|
+
* (940 px by default) of the measured container, never of the viewport.
|
|
6
20
|
*/
|
|
7
|
-
export declare function SettingsLayout({ className, ...props }: SettingsLayoutProps): import("react").JSX.Element;
|
|
8
|
-
export
|
|
21
|
+
export declare function SettingsLayout({ breakpoint, container, className, ...props }: SettingsLayoutProps): import("react").JSX.Element;
|
|
22
|
+
export interface SettingsLayoutNavProps extends ComponentPropsWithoutRef<"nav"> {
|
|
23
|
+
/** Overrides the breakpoint the surrounding `SettingsLayout` set. */
|
|
24
|
+
breakpoint?: SettingsLayoutBreakpoint | "never";
|
|
25
|
+
}
|
|
9
26
|
/** Sticky side nav that becomes a scrollable horizontal row on narrow pages. */
|
|
10
|
-
export declare function SettingsLayoutNav({ "aria-label": ariaLabel, className, ...props }: SettingsLayoutNavProps): import("react").JSX.Element;
|
|
27
|
+
export declare function SettingsLayoutNav({ "aria-label": ariaLabel, breakpoint, className, ...props }: SettingsLayoutNavProps): import("react").JSX.Element;
|
|
11
28
|
export interface SettingsLayoutNavItemProps extends ComponentPropsWithoutRef<"button"> {
|
|
12
29
|
/** Currently visible section. */
|
|
13
30
|
active?: boolean;
|