@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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { type ComponentPropsWithoutRef, type ReactNode, useMemo } from "react";
|
|
4
|
+
import { Button } from "../../atoms/button/button.js";
|
|
5
|
+
import { Chip } from "../../atoms/chip/chip.js";
|
|
6
|
+
import { ChipGroup, type ChipGroupOption } from "../../forms/chip-group/chip-group.js";
|
|
7
|
+
import { Input } from "../../forms/input/input.js";
|
|
8
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
9
|
+
import { Search, SlidersHorizontal } from "../../icons/index.js";
|
|
10
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../overlays/popover/popover.js";
|
|
11
|
+
import { cn } from "../../utils/cn.js";
|
|
12
|
+
import { useControllableState } from "../../utils/use-controllable-state.js";
|
|
13
|
+
|
|
14
|
+
export interface FilterBarChip {
|
|
15
|
+
id: string;
|
|
16
|
+
/** Text of the chip, e.g. "Status: Overdue". */
|
|
17
|
+
label: string;
|
|
18
|
+
onRemove: () => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FilterBarQuickFilters {
|
|
22
|
+
options: readonly ChipGroupOption[];
|
|
23
|
+
/** Selected option (`""` for none). Pair it with `onValueChange`. */
|
|
24
|
+
value?: string;
|
|
25
|
+
defaultValue?: string;
|
|
26
|
+
onValueChange?: (value: string) => void;
|
|
27
|
+
/** Name of the group. Defaults to the localized "Filters". */
|
|
28
|
+
label?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FilterBarLabels {
|
|
32
|
+
search: string;
|
|
33
|
+
filters: string;
|
|
34
|
+
moreFilters: string;
|
|
35
|
+
clearAll: string;
|
|
36
|
+
/** `{filter}` is replaced by the chip label. */
|
|
37
|
+
removeFilter: string;
|
|
38
|
+
activeFilters: string;
|
|
39
|
+
resultOne: string;
|
|
40
|
+
/** `{count}` is replaced. */
|
|
41
|
+
resultMany: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface FilterBarProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
45
|
+
/** Controlled search text. Pair it with `onSearchChange`. */
|
|
46
|
+
search?: string;
|
|
47
|
+
defaultSearch?: string;
|
|
48
|
+
onSearchChange?: (search: string) => void;
|
|
49
|
+
/** Placeholder of the search field. Defaults to the localized "Search". */
|
|
50
|
+
searchPlaceholder?: string;
|
|
51
|
+
/** Always-visible single-choice chips (a status, a period). Under a narrow container they move into the Filters popover. */
|
|
52
|
+
quickFilters?: FilterBarQuickFilters;
|
|
53
|
+
/** Extra filter controls; they go in the "More filters" popover. */
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
/** One removable chip per applied filter, in the row under the bar. */
|
|
56
|
+
activeFilters?: readonly FilterBarChip[];
|
|
57
|
+
/** Shows "Clear all" next to the chips; it should reset every filter, search included. */
|
|
58
|
+
onClearAll?: () => void;
|
|
59
|
+
/** Number of results of the current filters; announced politely when it changes. */
|
|
60
|
+
resultCount?: number;
|
|
61
|
+
/** End slot: export, create, view switch. */
|
|
62
|
+
actions?: ReactNode;
|
|
63
|
+
labels?: Partial<FilterBarLabels>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function fill(template: string, values: Record<string, string>): string {
|
|
67
|
+
return template.replace(/\{(\w+)\}/g, (match, key: string) => values[key] ?? match);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Toolbar for filtering a list or table: search, quick chips, a "More filters" popover, the
|
|
72
|
+
* applied filters as removable chips with "Clear all", and the result count. It answers to its own
|
|
73
|
+
* container width, never the viewport: under 40rem the quick chips and the extra filters fold into
|
|
74
|
+
* one "Filters" button and only the search stays inline. The bar holds no filter state beyond the
|
|
75
|
+
* search text: you pass the chips and the controls, and apply the filters to your rows.
|
|
76
|
+
*/
|
|
77
|
+
export function FilterBar({
|
|
78
|
+
search,
|
|
79
|
+
defaultSearch = "",
|
|
80
|
+
onSearchChange,
|
|
81
|
+
searchPlaceholder,
|
|
82
|
+
quickFilters,
|
|
83
|
+
children,
|
|
84
|
+
activeFilters = [],
|
|
85
|
+
onClearAll,
|
|
86
|
+
resultCount,
|
|
87
|
+
actions,
|
|
88
|
+
labels,
|
|
89
|
+
className,
|
|
90
|
+
...props
|
|
91
|
+
}: FilterBarProps) {
|
|
92
|
+
const strings = useUiStrings();
|
|
93
|
+
const text: FilterBarLabels = {
|
|
94
|
+
search: labels?.search ?? strings.search,
|
|
95
|
+
filters: labels?.filters ?? strings.filters,
|
|
96
|
+
moreFilters: labels?.moreFilters ?? strings.moreFilters,
|
|
97
|
+
clearAll: labels?.clearAll ?? strings.clearAllFilters,
|
|
98
|
+
removeFilter: labels?.removeFilter ?? strings.removeFilter,
|
|
99
|
+
activeFilters: labels?.activeFilters ?? strings.activeFilters,
|
|
100
|
+
resultOne: labels?.resultOne ?? strings.resultOne,
|
|
101
|
+
resultMany: labels?.resultMany ?? strings.resultMany,
|
|
102
|
+
};
|
|
103
|
+
const [query, setQuery] = useControllableState<string>({
|
|
104
|
+
prop: search,
|
|
105
|
+
defaultProp: defaultSearch,
|
|
106
|
+
onChange: onSearchChange,
|
|
107
|
+
});
|
|
108
|
+
const format = useMemo(() => new Intl.NumberFormat(strings.locale), [strings.locale]);
|
|
109
|
+
const count = activeFilters.length;
|
|
110
|
+
const suffix = count > 0 ? ` (${format.format(count)})` : "";
|
|
111
|
+
const hasExtra = children !== undefined && children !== null && children !== false;
|
|
112
|
+
const quick = quickFilters ? (
|
|
113
|
+
<ChipGroup
|
|
114
|
+
type="single"
|
|
115
|
+
allowDeselect
|
|
116
|
+
aria-label={quickFilters.label ?? text.filters}
|
|
117
|
+
options={quickFilters.options}
|
|
118
|
+
value={quickFilters.value}
|
|
119
|
+
defaultValue={quickFilters.defaultValue}
|
|
120
|
+
onValueChange={quickFilters.onValueChange}
|
|
121
|
+
/>
|
|
122
|
+
) : null;
|
|
123
|
+
const trigger = (label: string, className: string) => (
|
|
124
|
+
<PopoverTrigger asChild>
|
|
125
|
+
<Button size="sm" variant="secondary" className={className}>
|
|
126
|
+
<SlidersHorizontal aria-hidden="true" />
|
|
127
|
+
{label}
|
|
128
|
+
{suffix}
|
|
129
|
+
</Button>
|
|
130
|
+
</PopoverTrigger>
|
|
131
|
+
);
|
|
132
|
+
return (
|
|
133
|
+
<div className={cn("@container/filter-bar flex min-w-0 flex-col gap-2", className)} {...props}>
|
|
134
|
+
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
|
135
|
+
<Input
|
|
136
|
+
type="search"
|
|
137
|
+
size="xs"
|
|
138
|
+
value={query}
|
|
139
|
+
onChange={(event) => setQuery(event.target.value)}
|
|
140
|
+
placeholder={searchPlaceholder ?? text.search}
|
|
141
|
+
aria-label={text.search}
|
|
142
|
+
start={<Search aria-hidden="true" className="size-4 text-ink-3" />}
|
|
143
|
+
className="w-full min-w-0 @min-[40rem]/filter-bar:w-64"
|
|
144
|
+
/>
|
|
145
|
+
{quick ? <div className="hidden min-w-0 @min-[40rem]/filter-bar:block">{quick}</div> : null}
|
|
146
|
+
{hasExtra ? (
|
|
147
|
+
<Popover>
|
|
148
|
+
{trigger(text.moreFilters, "hidden @min-[40rem]/filter-bar:inline-flex")}
|
|
149
|
+
<PopoverContent align="start" aria-label={text.moreFilters} className="grid gap-3 p-3">
|
|
150
|
+
{children}
|
|
151
|
+
</PopoverContent>
|
|
152
|
+
</Popover>
|
|
153
|
+
) : null}
|
|
154
|
+
{quick || hasExtra ? (
|
|
155
|
+
<Popover>
|
|
156
|
+
{trigger(text.filters, "@min-[40rem]/filter-bar:hidden")}
|
|
157
|
+
<PopoverContent align="start" aria-label={text.filters} className="grid gap-3 p-3">
|
|
158
|
+
{quick}
|
|
159
|
+
{children}
|
|
160
|
+
</PopoverContent>
|
|
161
|
+
</Popover>
|
|
162
|
+
) : null}
|
|
163
|
+
<div className="ml-auto flex min-w-0 flex-wrap items-center gap-2">
|
|
164
|
+
{resultCount !== undefined ? (
|
|
165
|
+
<p role="status" aria-live="polite" className="m-0 text-fs-120 text-ink-3 tabular-nums">
|
|
166
|
+
{resultCount === 1
|
|
167
|
+
? text.resultOne
|
|
168
|
+
: fill(text.resultMany, { count: format.format(resultCount) })}
|
|
169
|
+
</p>
|
|
170
|
+
) : null}
|
|
171
|
+
{actions}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
{count > 0 ? (
|
|
175
|
+
<ul
|
|
176
|
+
aria-label={text.activeFilters}
|
|
177
|
+
className="m-0 flex min-w-0 list-none flex-wrap items-center gap-1.5 p-0"
|
|
178
|
+
>
|
|
179
|
+
{activeFilters.map((filter) => (
|
|
180
|
+
<li key={filter.id} className="min-w-0">
|
|
181
|
+
<Chip
|
|
182
|
+
tone="accent"
|
|
183
|
+
onRemove={filter.onRemove}
|
|
184
|
+
removeLabel={fill(text.removeFilter, { filter: filter.label })}
|
|
185
|
+
>
|
|
186
|
+
{filter.label}
|
|
187
|
+
</Chip>
|
|
188
|
+
</li>
|
|
189
|
+
))}
|
|
190
|
+
{onClearAll ? (
|
|
191
|
+
<li>
|
|
192
|
+
<Button size="sm" variant="ghost" onClick={onClearAll}>
|
|
193
|
+
{text.clearAll}
|
|
194
|
+
</Button>
|
|
195
|
+
</li>
|
|
196
|
+
) : null}
|
|
197
|
+
</ul>
|
|
198
|
+
) : null}
|
|
199
|
+
</div>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
@@ -110,7 +110,7 @@ export function HBars({
|
|
|
110
110
|
>
|
|
111
111
|
{rows.map((row) => (
|
|
112
112
|
<Fragment key={row.id}>
|
|
113
|
-
<span className="truncate font-semibold text-fs-
|
|
113
|
+
<span className="truncate font-semibold text-fs-120">{row.name}</span>
|
|
114
114
|
<div className="relative flex h-5.5 items-center border-r-divider bg-[linear-gradient(to_right,var(--line)_1px,transparent_1px)] [background-size:20%_100%]">
|
|
115
115
|
{paired ? (
|
|
116
116
|
<div className="flex h-6.5 w-full flex-col items-start justify-center gap-0.75">
|
|
@@ -164,7 +164,7 @@ export function HBars({
|
|
|
164
164
|
{ticks.map((tick) => (
|
|
165
165
|
<span
|
|
166
166
|
key={tick.position}
|
|
167
|
-
className="-translate-x-1/2 absolute font-medium text-fs-
|
|
167
|
+
className="-translate-x-1/2 absolute font-medium text-fs-110 text-ink-3 leading-none tabular-nums"
|
|
168
168
|
style={{ left: `${tick.position}%` }}
|
|
169
169
|
>
|
|
170
170
|
{tick.label}
|
package/src/containers/index.ts
CHANGED
|
@@ -4,14 +4,19 @@ export * from "./banner/index.js";
|
|
|
4
4
|
export * from "./card/index.js";
|
|
5
5
|
export * from "./carousel/index.js";
|
|
6
6
|
export * from "./cell/index.js";
|
|
7
|
+
export * from "./chat-thread/index.js";
|
|
7
8
|
export * from "./cols/index.js";
|
|
8
9
|
export * from "./comment/index.js";
|
|
9
10
|
export * from "./confirm-action/index.js";
|
|
11
|
+
export * from "./context-rail/index.js";
|
|
12
|
+
export * from "./dashboard/index.js";
|
|
10
13
|
export * from "./data-grid/index.js";
|
|
11
14
|
export * from "./description-list/index.js";
|
|
15
|
+
export * from "./detail-header/index.js";
|
|
12
16
|
export * from "./facts/index.js";
|
|
13
17
|
export * from "./feed/index.js";
|
|
14
18
|
export * from "./file-tree/index.js";
|
|
19
|
+
export * from "./filter-bar/index.js";
|
|
15
20
|
export * from "./generic-row/index.js";
|
|
16
21
|
export * from "./grid/index.js";
|
|
17
22
|
export * from "./hbars/index.js";
|
|
@@ -24,14 +29,18 @@ export * from "./list-detail/index.js";
|
|
|
24
29
|
export * from "./note/index.js";
|
|
25
30
|
export * from "./page/index.js";
|
|
26
31
|
export * from "./page-header/index.js";
|
|
32
|
+
export * from "./pagination/index.js";
|
|
27
33
|
export * from "./resizable/index.js";
|
|
28
34
|
export * from "./responsive-list/index.js";
|
|
35
|
+
export * from "./row-actions/index.js";
|
|
29
36
|
export * from "./scrolly/index.js";
|
|
30
37
|
export * from "./section/index.js";
|
|
38
|
+
export * from "./selectable-card/index.js";
|
|
31
39
|
export * from "./settings-layout/index.js";
|
|
32
40
|
export * from "./settings-row/index.js";
|
|
33
41
|
export * from "./shortcuts/index.js";
|
|
34
42
|
export * from "./stack/index.js";
|
|
35
43
|
export * from "./table/index.js";
|
|
44
|
+
export * from "./table-columns-menu/index.js";
|
|
36
45
|
export * from "./timeline/index.js";
|
|
37
46
|
export * from "./toolbar/index.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
type CSSProperties,
|
|
4
5
|
type KeyboardEvent,
|
|
5
6
|
type ReactNode,
|
|
6
7
|
type PointerEvent as ReactPointerEvent,
|
|
@@ -15,8 +16,10 @@ import { Chip } from "../../atoms/chip/chip.js";
|
|
|
15
16
|
import { GripVertical } from "../../icons/index.js";
|
|
16
17
|
import type { ClassNames } from "../../utils/class-names.js";
|
|
17
18
|
import { cn } from "../../utils/cn.js";
|
|
19
|
+
import { useFocusRescue } from "../../utils/focus-rescue.js";
|
|
18
20
|
import {
|
|
19
21
|
dropIndex,
|
|
22
|
+
dropIndexGrid,
|
|
20
23
|
type KanbanCardData,
|
|
21
24
|
type KanbanColumnData,
|
|
22
25
|
type KanbanKey,
|
|
@@ -37,6 +40,7 @@ export type KanbanPart =
|
|
|
37
40
|
| "cards"
|
|
38
41
|
| "card"
|
|
39
42
|
| "grip"
|
|
43
|
+
| "actions"
|
|
40
44
|
| "empty"
|
|
41
45
|
| "indicator"
|
|
42
46
|
| "ghost";
|
|
@@ -47,10 +51,31 @@ export interface KanbanProps {
|
|
|
47
51
|
defaultColumns?: KanbanColumnData[];
|
|
48
52
|
/** Called after a drop (pointer release or keyboard drop) with the new board and the move. */
|
|
49
53
|
onColumnsChange?: (columns: KanbanColumnData[], move: KanbanMove) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Set to `false` for a board that only displays: no drag handle, no pointer or keyboard
|
|
56
|
+
* pick-up, and cards are plain content (with `cardActions` still rendered). Defaults to `true`.
|
|
57
|
+
*/
|
|
58
|
+
draggable?: boolean;
|
|
50
59
|
/** Refuse drops into another column that already reached its WIP limit. */
|
|
51
60
|
enforceLimit?: boolean;
|
|
52
61
|
/** Replaces the default card body. */
|
|
53
62
|
renderCard?: (card: KanbanCardData) => ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Buttons shown under each card. When set, the card is no longer one `role="button"`: its body
|
|
65
|
+
* is plain content, the actions are real, separately focusable controls, and keyboard
|
|
66
|
+
* pick-up moves to a grip button. Without it the card keeps the single-button behaviour.
|
|
67
|
+
*/
|
|
68
|
+
cardActions?: (card: KanbanCardData) => ReactNode;
|
|
69
|
+
/** Accessible name of the grip button when `cardActions` is set; defaults to "Mover tarjeta: <title>". */
|
|
70
|
+
gripLabel?: (card: KanbanCardData) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Lays the cards of a lane out as a responsive grid once the lane is 30rem (480 px) wide,
|
|
73
|
+
* with columns of at least `cardGridMinWidth`; a narrower lane stays a single column. Dropping with the pointer
|
|
74
|
+
* follows reading order; arrow keys still move a held card one place up or down the lane.
|
|
75
|
+
*/
|
|
76
|
+
cardGrid?: boolean;
|
|
77
|
+
/** Minimum card width (px) of the grid lane. Defaults to 224. */
|
|
78
|
+
cardGridMinWidth?: number;
|
|
54
79
|
emptyLabel?: string;
|
|
55
80
|
"aria-label"?: string;
|
|
56
81
|
className?: string;
|
|
@@ -102,8 +127,13 @@ export function Kanban({
|
|
|
102
127
|
columns: controlled,
|
|
103
128
|
defaultColumns = [],
|
|
104
129
|
onColumnsChange,
|
|
130
|
+
draggable = true,
|
|
105
131
|
enforceLimit = false,
|
|
106
132
|
renderCard,
|
|
133
|
+
cardActions,
|
|
134
|
+
gripLabel = (card) => `Mover tarjeta: ${card.title}`,
|
|
135
|
+
cardGrid = false,
|
|
136
|
+
cardGridMinWidth = 224,
|
|
107
137
|
emptyLabel = "Sin tarjetas",
|
|
108
138
|
className,
|
|
109
139
|
classNames,
|
|
@@ -119,6 +149,7 @@ export function Kanban({
|
|
|
119
149
|
const [status, setStatus] = useState("");
|
|
120
150
|
|
|
121
151
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
152
|
+
useFocusRescue(rootRef, { item: "[data-card-id]", group: "ul" });
|
|
122
153
|
const focusId = useRef<string | null>(null);
|
|
123
154
|
const columnsRef = useRef(columns);
|
|
124
155
|
columnsRef.current = columns;
|
|
@@ -137,7 +168,8 @@ export function Kanban({
|
|
|
137
168
|
useLayoutEffect(() => {
|
|
138
169
|
const id = focusId.current;
|
|
139
170
|
if (!id) return;
|
|
140
|
-
const
|
|
171
|
+
const card = rootRef.current?.querySelector<HTMLElement>(`[data-card-id="${CSS.escape(id)}"]`);
|
|
172
|
+
const el = card?.querySelector<HTMLElement>("[data-card-grip]") ?? card;
|
|
141
173
|
if (el && document.activeElement !== el) el.focus();
|
|
142
174
|
if (!grabbedId) focusId.current = null;
|
|
143
175
|
});
|
|
@@ -196,6 +228,7 @@ export function Kanban({
|
|
|
196
228
|
|
|
197
229
|
const startPointerDrag = (event: ReactPointerEvent<HTMLElement>, card: KanbanCardData) => {
|
|
198
230
|
if (event.button !== 0 || grabbedId) return;
|
|
231
|
+
if ((event.target as HTMLElement).closest("[data-card-actions]")) return;
|
|
199
232
|
if (event.pointerType === "touch" && !(event.target as HTMLElement).closest("[data-grip]")) {
|
|
200
233
|
return;
|
|
201
234
|
}
|
|
@@ -210,12 +243,17 @@ export function Kanban({
|
|
|
210
243
|
const column = document.elementFromPoint(x, y)?.closest<HTMLElement>("[data-column-id]");
|
|
211
244
|
const columnId = column?.dataset.columnId;
|
|
212
245
|
if (!column || !columnId) return null;
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
246
|
+
const others = Array.from(column.querySelectorAll<HTMLElement>("[data-card-id]")).filter(
|
|
247
|
+
(el) => el.dataset.cardId !== card.id,
|
|
248
|
+
);
|
|
249
|
+
if (column.hasAttribute("data-card-grid")) {
|
|
250
|
+
const rects = others.map((el) => el.getBoundingClientRect());
|
|
251
|
+
return { columnId, index: dropIndexGrid(rects, x, y) };
|
|
252
|
+
}
|
|
253
|
+
const mids = others.map((el) => {
|
|
254
|
+
const r = el.getBoundingClientRect();
|
|
255
|
+
return r.top + r.height / 2;
|
|
256
|
+
});
|
|
219
257
|
return { columnId, index: dropIndex(mids, y) };
|
|
220
258
|
};
|
|
221
259
|
|
|
@@ -284,10 +322,12 @@ export function Kanban({
|
|
|
284
322
|
}
|
|
285
323
|
}}
|
|
286
324
|
>
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
325
|
+
{draggable ? (
|
|
326
|
+
<p id={instructionsId} className="sr-only">
|
|
327
|
+
Presiona Espacio para tomar una tarjeta, las flechas para moverla y Espacio para soltarla.
|
|
328
|
+
Escape cancela.
|
|
329
|
+
</p>
|
|
330
|
+
) : null}
|
|
291
331
|
<div role="status" aria-live="assertive" className="sr-only">
|
|
292
332
|
{status}
|
|
293
333
|
</div>
|
|
@@ -322,37 +362,98 @@ export function Kanban({
|
|
|
322
362
|
const grabbed = grabbedId === card.id;
|
|
323
363
|
items.push(
|
|
324
364
|
<li key={card.id} className="min-w-0">
|
|
325
|
-
{
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
365
|
+
{cardActions ? (
|
|
366
|
+
<div
|
|
367
|
+
data-card-id={card.id}
|
|
368
|
+
onPointerDown={(e) => {
|
|
369
|
+
if (draggable) startPointerDrag(e, card);
|
|
370
|
+
}}
|
|
371
|
+
className={cn(
|
|
372
|
+
"relative flex flex-col gap-density-sm rounded-input border-card surface-card p-density shadow-card",
|
|
373
|
+
draggable && "cursor-grab select-none",
|
|
374
|
+
isDragged && "opacity-40",
|
|
375
|
+
grabbed && "shadow-selected",
|
|
376
|
+
classNames?.card,
|
|
377
|
+
)}
|
|
378
|
+
>
|
|
379
|
+
<div className="flex gap-1">
|
|
380
|
+
{draggable ? (
|
|
381
|
+
<button
|
|
382
|
+
type="button"
|
|
383
|
+
data-card-grip=""
|
|
384
|
+
data-grip=""
|
|
385
|
+
aria-label={gripLabel(card)}
|
|
386
|
+
aria-pressed={grabbed}
|
|
387
|
+
aria-roledescription="tarjeta arrastrable"
|
|
388
|
+
aria-describedby={instructionsId}
|
|
389
|
+
onKeyDown={(e) => onCardKeyDown(e, card)}
|
|
390
|
+
className={cn(
|
|
391
|
+
"-ml-1 flex min-h-8 w-6 shrink-0 touch-none items-start justify-center rounded-control pt-0.5 text-ink-3 focus-visible:focus-ring",
|
|
392
|
+
classNames?.grip,
|
|
393
|
+
)}
|
|
394
|
+
>
|
|
395
|
+
<GripVertical aria-hidden="true" className="size-4" />
|
|
396
|
+
</button>
|
|
397
|
+
) : null}
|
|
398
|
+
<div className="min-w-0 flex-1">
|
|
399
|
+
{renderCard ? renderCard(card) : <DefaultCard card={card} />}
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
<div
|
|
403
|
+
data-card-actions=""
|
|
404
|
+
className={cn(
|
|
405
|
+
"flex cursor-auto flex-wrap items-center gap-density-sm",
|
|
406
|
+
classNames?.actions,
|
|
407
|
+
)}
|
|
408
|
+
>
|
|
409
|
+
{cardActions(card)}
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
) : draggable ? (
|
|
413
|
+
// biome-ignore lint/a11y/useSemanticElements: draggable card is a custom widget
|
|
414
|
+
<div
|
|
415
|
+
role="button"
|
|
416
|
+
tabIndex={0}
|
|
417
|
+
data-card-id={card.id}
|
|
418
|
+
aria-pressed={grabbed}
|
|
419
|
+
aria-roledescription="tarjeta arrastrable"
|
|
420
|
+
aria-describedby={instructionsId}
|
|
421
|
+
onKeyDown={(e) => onCardKeyDown(e, card)}
|
|
422
|
+
onPointerDown={(e) => startPointerDrag(e, card)}
|
|
423
|
+
className={cn(
|
|
424
|
+
"pressable relative flex cursor-grab select-none gap-1 rounded-input border-card surface-card p-density shadow-card focus-visible:focus-ring",
|
|
425
|
+
isDragged && "opacity-40",
|
|
426
|
+
grabbed && "shadow-selected",
|
|
427
|
+
classNames?.card,
|
|
428
|
+
)}
|
|
429
|
+
>
|
|
430
|
+
<span
|
|
431
|
+
data-grip=""
|
|
432
|
+
aria-hidden="true"
|
|
433
|
+
className={cn(
|
|
434
|
+
"-ml-1 flex w-4 shrink-0 touch-none items-start pt-0.5 text-ink-3",
|
|
435
|
+
classNames?.grip,
|
|
436
|
+
)}
|
|
437
|
+
>
|
|
438
|
+
<GripVertical className="size-4" />
|
|
439
|
+
</span>
|
|
440
|
+
<div className="min-w-0 flex-1">
|
|
441
|
+
{renderCard ? renderCard(card) : <DefaultCard card={card} />}
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
) : (
|
|
445
|
+
<div
|
|
446
|
+
data-card-id={card.id}
|
|
345
447
|
className={cn(
|
|
346
|
-
"
|
|
347
|
-
classNames?.
|
|
448
|
+
"relative flex gap-1 rounded-input border-card surface-card p-density shadow-card",
|
|
449
|
+
classNames?.card,
|
|
348
450
|
)}
|
|
349
451
|
>
|
|
350
|
-
<
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
{renderCard ? renderCard(card) : <DefaultCard card={card} />}
|
|
452
|
+
<div className="min-w-0 flex-1">
|
|
453
|
+
{renderCard ? renderCard(card) : <DefaultCard card={card} />}
|
|
454
|
+
</div>
|
|
354
455
|
</div>
|
|
355
|
-
|
|
456
|
+
)}
|
|
356
457
|
</li>,
|
|
357
458
|
);
|
|
358
459
|
}
|
|
@@ -362,9 +463,10 @@ export function Kanban({
|
|
|
362
463
|
<section
|
|
363
464
|
key={column.id}
|
|
364
465
|
data-column-id={column.id}
|
|
466
|
+
data-card-grid={cardGrid ? "" : undefined}
|
|
365
467
|
aria-label={column.title}
|
|
366
468
|
className={cn(
|
|
367
|
-
"flex w-[min(18rem,85cqw)] shrink-0 snap-start flex-col gap-density-sm rounded-card bg-surface-sunken p-density-sm @4xl/kanban:w-auto @4xl/kanban:min-w-56 @4xl/kanban:flex-1",
|
|
469
|
+
"@container/lane flex w-[min(18rem,85cqw)] shrink-0 snap-start flex-col gap-density-sm rounded-card bg-surface-sunken p-density-sm @4xl/kanban:w-auto @4xl/kanban:min-w-56 @4xl/kanban:flex-1",
|
|
368
470
|
classNames?.column,
|
|
369
471
|
)}
|
|
370
472
|
>
|
|
@@ -397,8 +499,15 @@ export function Kanban({
|
|
|
397
499
|
</Chip>
|
|
398
500
|
</header>
|
|
399
501
|
<ul
|
|
502
|
+
style={
|
|
503
|
+
cardGrid
|
|
504
|
+
? ({ "--lane-card-min": `${cardGridMinWidth}px` } as CSSProperties)
|
|
505
|
+
: undefined
|
|
506
|
+
}
|
|
400
507
|
className={cn(
|
|
401
508
|
"m-0 flex min-h-16 list-none flex-col gap-density-sm p-0",
|
|
509
|
+
cardGrid &&
|
|
510
|
+
"@min-[30rem]/lane:grid @min-[30rem]/lane:grid-cols-[repeat(auto-fill,minmax(var(--lane-card-min),1fr))] @min-[30rem]/lane:items-start",
|
|
402
511
|
classNames?.cards,
|
|
403
512
|
)}
|
|
404
513
|
>
|
|
@@ -139,3 +139,23 @@ export function dropIndex(midpoints: number[], y: number): number {
|
|
|
139
139
|
}
|
|
140
140
|
return index;
|
|
141
141
|
}
|
|
142
|
+
|
|
143
|
+
export interface CardRect {
|
|
144
|
+
left: number;
|
|
145
|
+
right: number;
|
|
146
|
+
top: number;
|
|
147
|
+
bottom: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Insert index for a pointer at (`x`, `y`) over a lane that lays its cards out as a grid, from the
|
|
152
|
+
* rectangles of the cards left in the lane in reading order: a card is passed when the pointer is
|
|
153
|
+
* below its row, or inside its row and past its horizontal midpoint.
|
|
154
|
+
*/
|
|
155
|
+
export function dropIndexGrid(rects: CardRect[], x: number, y: number): number {
|
|
156
|
+
let index = 0;
|
|
157
|
+
for (const rect of rects) {
|
|
158
|
+
if (y > rect.bottom || (y >= rect.top && x > (rect.left + rect.right) / 2)) index += 1;
|
|
159
|
+
}
|
|
160
|
+
return index;
|
|
161
|
+
}
|
|
@@ -165,7 +165,7 @@ export function KpiValue({ suffix, trend, mono, className, children, ...props }:
|
|
|
165
165
|
<span
|
|
166
166
|
{...props}
|
|
167
167
|
className={cn(
|
|
168
|
-
"break-words text-kpi-number tabular-nums @max-[9rem]/kpi:text-fs-
|
|
168
|
+
"break-words text-kpi-number tabular-nums @max-[9rem]/kpi:text-fs-200",
|
|
169
169
|
mono && "font-mono tracking-normal",
|
|
170
170
|
valueTone,
|
|
171
171
|
classNames?.value,
|
|
@@ -32,6 +32,11 @@ export interface KpiGroupProps extends Omit<ComponentPropsWithoutRef<"dl">, "chi
|
|
|
32
32
|
layout?: KpiGroupLayout;
|
|
33
33
|
/** Minimum tile width in px for `layout="auto-fit"`. */
|
|
34
34
|
minItemWidth?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Columns on the narrowest containers. `1` (default) stacks the tiles; `2` keeps two across
|
|
37
|
+
* (and `auto-fit` never goes below two) for short tiles on a phone.
|
|
38
|
+
*/
|
|
39
|
+
minColumns?: 1 | 2;
|
|
35
40
|
/** Animate numeric values counting up. */
|
|
36
41
|
animate?: boolean;
|
|
37
42
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root wrapper and is merged last. */
|
|
@@ -46,6 +51,7 @@ export function KpiGroup({
|
|
|
46
51
|
items,
|
|
47
52
|
layout = "divided",
|
|
48
53
|
minItemWidth = 150,
|
|
54
|
+
minColumns = 1,
|
|
49
55
|
animate = true,
|
|
50
56
|
className,
|
|
51
57
|
classNames,
|
|
@@ -60,7 +66,11 @@ export function KpiGroup({
|
|
|
60
66
|
style={
|
|
61
67
|
autoFit
|
|
62
68
|
? {
|
|
63
|
-
gridTemplateColumns: `repeat(auto-fit, minmax(min(
|
|
69
|
+
gridTemplateColumns: `repeat(auto-fit, minmax(min(${
|
|
70
|
+
minColumns === 2
|
|
71
|
+
? `${minItemWidth}px, calc((100% - var(--gap-density)) / 2)`
|
|
72
|
+
: `100%, ${minItemWidth}px`
|
|
73
|
+
}), 1fr))`,
|
|
64
74
|
...style,
|
|
65
75
|
}
|
|
66
76
|
: style
|
|
@@ -69,7 +79,12 @@ export function KpiGroup({
|
|
|
69
79
|
"m-0 grid",
|
|
70
80
|
autoFit
|
|
71
81
|
? "gap-density"
|
|
72
|
-
:
|
|
82
|
+
: cn(
|
|
83
|
+
"gap-px overflow-hidden rounded-card border-card bg-divider shadow-card @sm/kpi-group:grid-cols-2 @3xl/kpi-group:grid-cols-4",
|
|
84
|
+
minColumns === 2
|
|
85
|
+
? "grid-cols-2 @max-sm/kpi-group:[&>:last-child:nth-child(odd)]:col-span-2"
|
|
86
|
+
: "grid-cols-1",
|
|
87
|
+
),
|
|
73
88
|
classNames?.list,
|
|
74
89
|
)}
|
|
75
90
|
>
|
|
@@ -4,12 +4,17 @@ export {
|
|
|
4
4
|
ListDetailDetailHeader,
|
|
5
5
|
type ListDetailDetailHeaderProps,
|
|
6
6
|
type ListDetailDetailProps,
|
|
7
|
+
ListDetailEmpty,
|
|
8
|
+
type ListDetailEmptyProps,
|
|
9
|
+
ListDetailHeader,
|
|
10
|
+
type ListDetailHeaderProps,
|
|
7
11
|
ListDetailItem,
|
|
8
12
|
type ListDetailItemProps,
|
|
9
13
|
ListDetailList,
|
|
10
14
|
type ListDetailListProps,
|
|
11
15
|
ListDetailMeta,
|
|
12
16
|
type ListDetailProps,
|
|
17
|
+
type ListDetailRatio,
|
|
13
18
|
ListDetailTitle,
|
|
14
19
|
useListDetail,
|
|
15
20
|
} from "./list-detail.js";
|