@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,40 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
export type DashboardPageProps = ComponentPropsWithoutRef<"div">;
|
|
3
|
+
/** Vertical rhythm of a dashboard page. Put it inside `Page` so the `page` container query applies. */
|
|
4
|
+
export declare function DashboardPage({ className, ...props }: DashboardPageProps): import("react").JSX.Element;
|
|
5
|
+
export interface KpiRowProps extends ComponentPropsWithoutRef<"div"> {
|
|
6
|
+
/** Accessible name of the group of figures, e.g. "Key figures". */
|
|
7
|
+
"aria-label"?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Joined KPI tiles: two per row when narrow, four from 720 px of `page` container width. It is a
|
|
11
|
+
* named `group`, so give it an `aria-label` when the tiles are not introduced by a heading.
|
|
12
|
+
*/
|
|
13
|
+
export declare function KpiRow({ className, ...props }: KpiRowProps): import("react").JSX.Element;
|
|
14
|
+
export interface CardGridProps extends ComponentPropsWithoutRef<"div"> {
|
|
15
|
+
/** Columns at the widest container: 2 (from 720 px) or 3 (2 from 720 px, 3 from 1180 px). Default 2. */
|
|
16
|
+
columns?: 2 | 3;
|
|
17
|
+
}
|
|
18
|
+
/** Equal cards that stack under 720 px of `page` container width. */
|
|
19
|
+
export declare function CardGrid({ columns, className, ...props }: CardGridProps): import("react").JSX.Element;
|
|
20
|
+
export interface DashboardCardProps {
|
|
21
|
+
title: string;
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
/** Slot at the end of the header (a chip, a button). */
|
|
24
|
+
aside?: ReactNode;
|
|
25
|
+
/** Heading level of the title; the card is a named `region`. Default 2. */
|
|
26
|
+
headingLevel?: 2 | 3 | 4;
|
|
27
|
+
className?: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export interface ChartCardProps extends DashboardCardProps {
|
|
31
|
+
/** Fixed height of the body in px; the chart inside uses `height="fill"`. Default 300. */
|
|
32
|
+
height?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Card with a fixed-height body so `height="fill"` charts take exactly the space left. It is a
|
|
36
|
+
* `region` named by its title.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ChartCard({ title, subtitle, aside, height, headingLevel, className, children, }: ChartCardProps): import("react").JSX.Element;
|
|
39
|
+
/** Card whose body is a table or grid that scrolls inside its own wrapper. A `region` named by its title. */
|
|
40
|
+
export declare function TableCard({ title, subtitle, aside, headingLevel, className, children, }: DashboardCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { Card, CardBody, CardHeader } from "../card/card.js";
|
|
5
|
+
function DashboardPage({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0 flex-col gap-4", className), ...props });
|
|
7
|
+
}
|
|
8
|
+
function KpiRow({ className, ...props }) {
|
|
9
|
+
return (
|
|
10
|
+
// biome-ignore lint/a11y/useSemanticElements: a fieldset would add form semantics and default chrome to a grid of figures
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
role: "group",
|
|
15
|
+
className: cn(
|
|
16
|
+
"grid grid-cols-2 gap-px overflow-hidden rounded-card border-card bg-line shadow-card @min-[720px]/page:grid-cols-4",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
const gridClasses = {
|
|
25
|
+
2: "grid-cols-1 @min-[720px]/page:grid-cols-2",
|
|
26
|
+
3: "grid-cols-1 @min-[720px]/page:grid-cols-2 @min-[1180px]/page:grid-cols-3"
|
|
27
|
+
};
|
|
28
|
+
function CardGrid({ columns = 2, className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsx("div", { className: cn("grid items-start gap-4", gridClasses[columns], className), ...props });
|
|
30
|
+
}
|
|
31
|
+
function CardTitle({
|
|
32
|
+
id,
|
|
33
|
+
title,
|
|
34
|
+
subtitle,
|
|
35
|
+
level
|
|
36
|
+
}) {
|
|
37
|
+
const Heading = `h${level}`;
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
39
|
+
/* @__PURE__ */ jsx(Heading, { id, className: "m-0 break-words font-semibold text-fs-140 text-ink", children: title }),
|
|
40
|
+
subtitle ? /* @__PURE__ */ jsx("p", { className: "m-0 break-words text-fs-120 text-ink-3", children: subtitle }) : null
|
|
41
|
+
] });
|
|
42
|
+
}
|
|
43
|
+
function ChartCard({
|
|
44
|
+
title,
|
|
45
|
+
subtitle,
|
|
46
|
+
aside,
|
|
47
|
+
height = 300,
|
|
48
|
+
headingLevel = 2,
|
|
49
|
+
className,
|
|
50
|
+
children
|
|
51
|
+
}) {
|
|
52
|
+
const titleId = useId();
|
|
53
|
+
return /* @__PURE__ */ jsx("section", { "aria-labelledby": titleId, className: cn("min-w-0", className), children: /* @__PURE__ */ jsxs(Card, { children: [
|
|
54
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
55
|
+
/* @__PURE__ */ jsx(CardTitle, { id: titleId, title, subtitle, level: headingLevel }),
|
|
56
|
+
aside
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx("div", { className: "min-w-0", style: { height }, children }) })
|
|
59
|
+
] }) });
|
|
60
|
+
}
|
|
61
|
+
function TableCard({
|
|
62
|
+
title,
|
|
63
|
+
subtitle,
|
|
64
|
+
aside,
|
|
65
|
+
headingLevel = 2,
|
|
66
|
+
className,
|
|
67
|
+
children
|
|
68
|
+
}) {
|
|
69
|
+
const titleId = useId();
|
|
70
|
+
return /* @__PURE__ */ jsx("section", { "aria-labelledby": titleId, className: cn("min-w-0", className), children: /* @__PURE__ */ jsxs(Card, { children: [
|
|
71
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
72
|
+
/* @__PURE__ */ jsx(CardTitle, { id: titleId, title, subtitle, level: headingLevel }),
|
|
73
|
+
aside
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0", children })
|
|
76
|
+
] }) });
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
CardGrid,
|
|
80
|
+
ChartCard,
|
|
81
|
+
DashboardPage,
|
|
82
|
+
KpiRow,
|
|
83
|
+
TableCard
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CardGrid, type CardGridProps, ChartCard, type ChartCardProps, type DashboardCardProps, DashboardPage, type DashboardPageProps, KpiRow, type KpiRowProps, TableCard, } from "./dashboard.js";
|
|
@@ -21,7 +21,7 @@ import { describeFilter, emptyGroup } from "./filter-builder.js";
|
|
|
21
21
|
import { FilterBuilder } from "./filter-builder-editor.js";
|
|
22
22
|
import { DEFAULT_DATA_GRID_LABELS } from "./labels.js";
|
|
23
23
|
import { distinctValues } from "./model.js";
|
|
24
|
-
const note = "text-fs-
|
|
24
|
+
const note = "text-fs-120 text-ink-3";
|
|
25
25
|
function Stack({ children }) {
|
|
26
26
|
return /* @__PURE__ */ jsx("div", { className: "grid gap-2", children });
|
|
27
27
|
}
|
|
@@ -207,7 +207,7 @@ function PersistenceGrid({ density, height, onReset }) {
|
|
|
207
207
|
{
|
|
208
208
|
type: "button",
|
|
209
209
|
onClick: reset,
|
|
210
|
-
className: "inline-flex h-control-sm items-center rounded-control border-divider bg-surface-control px-2.5 font-[600] text-fs-
|
|
210
|
+
className: "inline-flex h-control-sm items-center rounded-control border-divider bg-surface-control px-2.5 font-[600] text-fs-120 text-ink-2 hover:border-line-strong hover:text-ink",
|
|
211
211
|
children: "Restablecer todo"
|
|
212
212
|
}
|
|
213
213
|
)
|
|
@@ -288,7 +288,7 @@ function KeyboardDemo({ density }) {
|
|
|
288
288
|
"Celda activa: ",
|
|
289
289
|
/* @__PURE__ */ jsx("b", { className: "font-[650]", children: where })
|
|
290
290
|
] }),
|
|
291
|
-
/* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-fs-
|
|
291
|
+
/* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-fs-120", children: [
|
|
292
292
|
/* @__PURE__ */ jsx("caption", { className: "sr-only", children: "Atajos de teclado" }),
|
|
293
293
|
/* @__PURE__ */ jsx("tbody", { children: SHORTCUTS.map(([keys, action]) => /* @__PURE__ */ jsxs("tr", { className: "border-t-divider", children: [
|
|
294
294
|
/* @__PURE__ */ jsx("th", { scope: "row", className: "w-1/2 py-1.5 pr-3 font-[600] text-ink", children: /* @__PURE__ */ jsx("kbd", { className: "font-mono text-fs-120", children: keys }) }),
|
|
@@ -467,7 +467,7 @@ function FilterBuilderDemo({ density, height }) {
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
),
|
|
470
|
-
/* @__PURE__ */ jsxs("p", { className: "mt-3 border-t-divider pt-2 text-fs-
|
|
470
|
+
/* @__PURE__ */ jsxs("p", { className: "mt-3 border-t-divider pt-2 text-fs-120 text-ink-3", children: [
|
|
471
471
|
text ? `Filtro: ${text}` : "Sin filtro activo.",
|
|
472
472
|
" ",
|
|
473
473
|
/* @__PURE__ */ jsx(
|
|
@@ -2526,7 +2526,7 @@ function DataGrid({
|
|
|
2526
2526
|
"button",
|
|
2527
2527
|
{
|
|
2528
2528
|
type: "button",
|
|
2529
|
-
className: "rounded-control border border-danger px-2.5 py-1 font-[600] text-fs-
|
|
2529
|
+
className: "rounded-control border border-danger px-2.5 py-1 font-[600] text-fs-120 hover:bg-surface",
|
|
2530
2530
|
onClick: remote.retry,
|
|
2531
2531
|
children: labels.retry
|
|
2532
2532
|
}
|
|
@@ -2618,7 +2618,7 @@ function DataGrid({
|
|
|
2618
2618
|
"button",
|
|
2619
2619
|
{
|
|
2620
2620
|
type: "button",
|
|
2621
|
-
className: "rounded-control border-divider px-2.5 py-1 font-[600] text-fs-
|
|
2621
|
+
className: "rounded-control border-divider px-2.5 py-1 font-[600] text-fs-120 text-ink-2 hover:text-ink",
|
|
2622
2622
|
onClick: remote.retry,
|
|
2623
2623
|
children: labels.retry
|
|
2624
2624
|
}
|
|
@@ -2626,7 +2626,7 @@ function DataGrid({
|
|
|
2626
2626
|
"button",
|
|
2627
2627
|
{
|
|
2628
2628
|
type: "button",
|
|
2629
|
-
className: "rounded-control border-divider px-2.5 py-1 font-[600] text-fs-
|
|
2629
|
+
className: "rounded-control border-divider px-2.5 py-1 font-[600] text-fs-120 text-ink-2 hover:text-ink",
|
|
2630
2630
|
onClick: () => {
|
|
2631
2631
|
setFiltersState({});
|
|
2632
2632
|
setSearch("");
|
|
@@ -2659,7 +2659,7 @@ function DataGrid({
|
|
|
2659
2659
|
}
|
|
2660
2660
|
)
|
|
2661
2661
|
] }),
|
|
2662
|
-
rangeSelection ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 border-t-divider px-3 py-1.5 text-fs-
|
|
2662
|
+
rangeSelection ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 border-t-divider px-3 py-1.5 text-fs-120 text-ink-2", children: stats && cellRange ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2663
2663
|
/* @__PURE__ */ jsx("span", { className: "font-[650] text-ink", children: labels.rangeCells(rangeCellCount) }),
|
|
2664
2664
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2665
2665
|
labels.rangeCount,
|
|
@@ -2778,7 +2778,7 @@ function Pagination({
|
|
|
2778
2778
|
"nav",
|
|
2779
2779
|
{
|
|
2780
2780
|
"aria-label": labels.rowsPerPage,
|
|
2781
|
-
className: "flex flex-wrap items-center justify-end gap-x-3 gap-y-1 border-t-divider px-2 py-1.5 text-fs-
|
|
2781
|
+
className: "flex flex-wrap items-center justify-end gap-x-3 gap-y-1 border-t-divider px-2 py-1.5 text-fs-120 text-ink-2",
|
|
2782
2782
|
children: [
|
|
2783
2783
|
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
2784
2784
|
/* @__PURE__ */ jsx("span", { children: labels.rowsPerPage }),
|
|
@@ -2787,7 +2787,7 @@ function Pagination({
|
|
|
2787
2787
|
{
|
|
2788
2788
|
value: pageSize,
|
|
2789
2789
|
onChange: (event) => onPageSize(Number(event.target.value)),
|
|
2790
|
-
className: "h-control-sm rounded-input border-control bg-surface-control px-1.5 text-fs-
|
|
2790
|
+
className: "h-control-sm rounded-input border-control bg-surface-control px-1.5 text-fs-120 text-ink",
|
|
2791
2791
|
children: [.../* @__PURE__ */ new Set([...options, pageSize])].sort((a, b) => a - b).map((size) => /* @__PURE__ */ jsx("option", { value: size, children: size }, size))
|
|
2792
2792
|
}
|
|
2793
2793
|
)
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { DEFAULT_DATA_GRID_LABELS } from "./labels.js";
|
|
16
16
|
import { filterKindOf } from "./model.js";
|
|
17
17
|
const fieldClass = "h-control-sm w-full min-w-0 rounded-input border-control bg-surface-control px-2 text-fs-130 text-ink placeholder:text-ink-3 focus-visible:border-accent focus-visible:outline-none";
|
|
18
|
-
const buttonClass = "inline-flex h-control-sm shrink-0 items-center gap-1.5 whitespace-nowrap rounded-control border-divider bg-surface-control px-2.5 font-[600] text-fs-
|
|
18
|
+
const buttonClass = "inline-flex h-control-sm shrink-0 items-center gap-1.5 whitespace-nowrap rounded-control border-divider bg-surface-control px-2.5 font-[600] text-fs-120 text-ink-2 hover:border-line-strong hover:text-ink [&_svg]:size-3.5";
|
|
19
19
|
function FilterBuilder({
|
|
20
20
|
columns,
|
|
21
21
|
value,
|
|
@@ -107,7 +107,7 @@ function GroupEditor({
|
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
] }),
|
|
110
|
-
group.children.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-1 text-fs-
|
|
110
|
+
group.children.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-1 text-fs-120 text-ink-3", children: labels.noConditions }) : /* @__PURE__ */ jsx("ul", { className: "grid gap-2", children: group.children.map((child, index) => /* @__PURE__ */ jsxs("li", { className: "grid gap-1", children: [
|
|
111
111
|
index > 0 ? /* @__PURE__ */ jsx("span", { className: "font-[650] text-fs-110 text-ink-3 uppercase tracking-[.07em]", children: group.logic === "and" ? labels.filterAnd : labels.filterOr }) : null,
|
|
112
112
|
child.type === "group" ? /* @__PURE__ */ jsx(GroupEditor, { group: child, ...context }) : /* @__PURE__ */ jsx(ConditionEditor, { condition: child, ...context })
|
|
113
113
|
] }, child.id)) })
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { Popover, PopoverContent, PopoverTrigger } from "../../overlays/popover/popover.js";
|
|
17
17
|
import { cn } from "../../utils/cn.js";
|
|
18
18
|
const DENSITIES = ["compact", "normal", "comfortable"];
|
|
19
|
-
const buttonClass = "inline-flex h-control-sm shrink-0 items-center gap-1.5 whitespace-nowrap rounded-control border-divider bg-surface-control px-2.5 font-[600] text-fs-
|
|
19
|
+
const buttonClass = "inline-flex h-control-sm shrink-0 items-center gap-1.5 whitespace-nowrap rounded-control border-divider bg-surface-control px-2.5 font-[600] text-fs-120 text-ink-2 hover:border-line-strong hover:text-ink [&_svg]:size-3.5";
|
|
20
20
|
function GridToolbar({
|
|
21
21
|
labels,
|
|
22
22
|
search,
|
|
@@ -3,7 +3,7 @@ import { type Venta } from "./data-grid.fixtures.js";
|
|
|
3
3
|
import { type CellChange, type DataGridProps, type RowsChange } from "./data-grid.js";
|
|
4
4
|
import type { CellValue, DataGridColumn } from "./types.js";
|
|
5
5
|
export type SheetControls = Pick<DataGridProps<Venta>, "density" | "height">;
|
|
6
|
-
export declare const note = "text-fs-
|
|
6
|
+
export declare const note = "text-fs-120 text-ink-3";
|
|
7
7
|
export declare function Stack({ children }: {
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
}): import("react").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { BARBEROS, seeded, ventaColumns, ventas } from "./data-grid.fixtures.js"
|
|
|
4
4
|
import {
|
|
5
5
|
DataGrid
|
|
6
6
|
} from "./data-grid.js";
|
|
7
|
-
const note = "text-fs-
|
|
7
|
+
const note = "text-fs-120 text-ink-3";
|
|
8
8
|
function Stack({ children }) {
|
|
9
9
|
return /* @__PURE__ */ jsx("div", { className: "grid gap-2", children });
|
|
10
10
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
+
export type DetailHeaderLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export interface DetailHeaderProps extends Omit<ComponentPropsWithoutRef<"header">, "title"> {
|
|
4
|
+
/** The record's name: the heading of the header. */
|
|
5
|
+
name: ReactNode;
|
|
6
|
+
/** Picture slot before the name, usually an `Avatar` (pass `className="size-14"` for a larger one). */
|
|
7
|
+
avatar?: ReactNode;
|
|
8
|
+
/** Line under the name: a role, a code, a relationship. */
|
|
9
|
+
subtitle?: ReactNode;
|
|
10
|
+
/** Status next to the name: a `Chip` or `StatusPill`. Wraps under the name when narrow. */
|
|
11
|
+
status?: ReactNode;
|
|
12
|
+
/** Key facts row under the header, usually a `Facts` list. */
|
|
13
|
+
facts?: ReactNode;
|
|
14
|
+
/** Buttons for the record. They wrap under the name when the header's own width is 480px or less. */
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
/** Level of the name heading. Defaults to `2`, the level under the page's `h1`. */
|
|
17
|
+
headingLevel?: DetailHeaderLevel;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Header of a record screen (an applicant, a person, a student): picture, name, status, facts and
|
|
21
|
+
* actions in one block. It is the record's heading, not the page's: keep the page title in
|
|
22
|
+
* `PageHeader` and put this under it, or let it be the first thing of a detail pane.
|
|
23
|
+
*/
|
|
24
|
+
export declare function DetailHeader({ name, avatar, subtitle, status, facts, actions, headingLevel, className, ...props }: DetailHeaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
function DetailHeader({
|
|
4
|
+
name,
|
|
5
|
+
avatar,
|
|
6
|
+
subtitle,
|
|
7
|
+
status,
|
|
8
|
+
facts,
|
|
9
|
+
actions,
|
|
10
|
+
headingLevel = 2,
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
const Heading = `h${headingLevel}`;
|
|
15
|
+
return /* @__PURE__ */ jsxs("header", { className: cn("@container/detail-header flex min-w-0 flex-col", className), ...props, children: [
|
|
16
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start gap-x-4 gap-y-3", children: [
|
|
17
|
+
avatar !== void 0 ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: avatar }) : null,
|
|
18
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 basis-56", children: [
|
|
19
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-2.5 gap-y-1", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Heading, { className: "m-0 min-w-0 break-words font-semibold text-fs-200 text-ink [text-wrap:balance]", children: name }),
|
|
21
|
+
status
|
|
22
|
+
] }),
|
|
23
|
+
subtitle !== void 0 ? /* @__PURE__ */ jsx("p", { className: "m-0 mt-0.5 break-words text-ink-3 text-meta", children: subtitle }) : null
|
|
24
|
+
] }),
|
|
25
|
+
actions !== void 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 @max-[480px]/detail-header:basis-full", children: actions }) : null
|
|
26
|
+
] }),
|
|
27
|
+
facts
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
DetailHeader
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DetailHeader, type DetailHeaderLevel, type DetailHeaderProps, } from "./detail-header.js";
|
|
@@ -6,7 +6,7 @@ function Facts({ className, ...props }) {
|
|
|
6
6
|
{
|
|
7
7
|
className: cn(
|
|
8
8
|
"mt-3.5 grid grid-cols-3 gap-3.5 border-t-divider border-dashed pt-3.5",
|
|
9
|
-
"[&_dt]:font-semibold [&_dt]:text-fs-
|
|
9
|
+
"[&_dt]:font-semibold [&_dt]:text-fs-120 [&_dt]:text-ink-3",
|
|
10
10
|
"[&_dd]:mt-0.5 [&_dd]:font-[620] [&_dd]:text-fs-130",
|
|
11
11
|
"[&_dt]:break-words [&_dd]:break-words @max-[560px]/facts:grid-cols-1",
|
|
12
12
|
className
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import { type ChipGroupOption } from "../../forms/chip-group/chip-group.js";
|
|
3
|
+
export interface FilterBarChip {
|
|
4
|
+
id: string;
|
|
5
|
+
/** Text of the chip, e.g. "Status: Overdue". */
|
|
6
|
+
label: string;
|
|
7
|
+
onRemove: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface FilterBarQuickFilters {
|
|
10
|
+
options: readonly ChipGroupOption[];
|
|
11
|
+
/** Selected option (`""` for none). Pair it with `onValueChange`. */
|
|
12
|
+
value?: string;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
onValueChange?: (value: string) => void;
|
|
15
|
+
/** Name of the group. Defaults to the localized "Filters". */
|
|
16
|
+
label?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FilterBarLabels {
|
|
19
|
+
search: string;
|
|
20
|
+
filters: string;
|
|
21
|
+
moreFilters: string;
|
|
22
|
+
clearAll: string;
|
|
23
|
+
/** `{filter}` is replaced by the chip label. */
|
|
24
|
+
removeFilter: string;
|
|
25
|
+
activeFilters: string;
|
|
26
|
+
resultOne: string;
|
|
27
|
+
/** `{count}` is replaced. */
|
|
28
|
+
resultMany: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FilterBarProps extends Omit<ComponentPropsWithoutRef<"div">, "children"> {
|
|
31
|
+
/** Controlled search text. Pair it with `onSearchChange`. */
|
|
32
|
+
search?: string;
|
|
33
|
+
defaultSearch?: string;
|
|
34
|
+
onSearchChange?: (search: string) => void;
|
|
35
|
+
/** Placeholder of the search field. Defaults to the localized "Search". */
|
|
36
|
+
searchPlaceholder?: string;
|
|
37
|
+
/** Always-visible single-choice chips (a status, a period). Under a narrow container they move into the Filters popover. */
|
|
38
|
+
quickFilters?: FilterBarQuickFilters;
|
|
39
|
+
/** Extra filter controls; they go in the "More filters" popover. */
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
/** One removable chip per applied filter, in the row under the bar. */
|
|
42
|
+
activeFilters?: readonly FilterBarChip[];
|
|
43
|
+
/** Shows "Clear all" next to the chips; it should reset every filter, search included. */
|
|
44
|
+
onClearAll?: () => void;
|
|
45
|
+
/** Number of results of the current filters; announced politely when it changes. */
|
|
46
|
+
resultCount?: number;
|
|
47
|
+
/** End slot: export, create, view switch. */
|
|
48
|
+
actions?: ReactNode;
|
|
49
|
+
labels?: Partial<FilterBarLabels>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Toolbar for filtering a list or table: search, quick chips, a "More filters" popover, the
|
|
53
|
+
* applied filters as removable chips with "Clear all", and the result count. It answers to its own
|
|
54
|
+
* container width, never the viewport: under 40rem the quick chips and the extra filters fold into
|
|
55
|
+
* one "Filters" button and only the search stays inline. The bar holds no filter state beyond the
|
|
56
|
+
* search text: you pass the chips and the controls, and apply the filters to your rows.
|
|
57
|
+
*/
|
|
58
|
+
export declare function FilterBar({ search, defaultSearch, onSearchChange, searchPlaceholder, quickFilters, children, activeFilters, onClearAll, resultCount, actions, labels, className, ...props }: FilterBarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { Button } from "../../atoms/button/button.js";
|
|
5
|
+
import { Chip } from "../../atoms/chip/chip.js";
|
|
6
|
+
import { ChipGroup } 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
|
+
function fill(template, values) {
|
|
14
|
+
return template.replace(/\{(\w+)\}/g, (match, key) => values[key] ?? match);
|
|
15
|
+
}
|
|
16
|
+
function FilterBar({
|
|
17
|
+
search,
|
|
18
|
+
defaultSearch = "",
|
|
19
|
+
onSearchChange,
|
|
20
|
+
searchPlaceholder,
|
|
21
|
+
quickFilters,
|
|
22
|
+
children,
|
|
23
|
+
activeFilters = [],
|
|
24
|
+
onClearAll,
|
|
25
|
+
resultCount,
|
|
26
|
+
actions,
|
|
27
|
+
labels,
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
const strings = useUiStrings();
|
|
32
|
+
const text = {
|
|
33
|
+
search: labels?.search ?? strings.search,
|
|
34
|
+
filters: labels?.filters ?? strings.filters,
|
|
35
|
+
moreFilters: labels?.moreFilters ?? strings.moreFilters,
|
|
36
|
+
clearAll: labels?.clearAll ?? strings.clearAllFilters,
|
|
37
|
+
removeFilter: labels?.removeFilter ?? strings.removeFilter,
|
|
38
|
+
activeFilters: labels?.activeFilters ?? strings.activeFilters,
|
|
39
|
+
resultOne: labels?.resultOne ?? strings.resultOne,
|
|
40
|
+
resultMany: labels?.resultMany ?? strings.resultMany
|
|
41
|
+
};
|
|
42
|
+
const [query, setQuery] = useControllableState({
|
|
43
|
+
prop: search,
|
|
44
|
+
defaultProp: defaultSearch,
|
|
45
|
+
onChange: onSearchChange
|
|
46
|
+
});
|
|
47
|
+
const format = useMemo(() => new Intl.NumberFormat(strings.locale), [strings.locale]);
|
|
48
|
+
const count = activeFilters.length;
|
|
49
|
+
const suffix = count > 0 ? ` (${format.format(count)})` : "";
|
|
50
|
+
const hasExtra = children !== void 0 && children !== null && children !== false;
|
|
51
|
+
const quick = quickFilters ? /* @__PURE__ */ jsx(
|
|
52
|
+
ChipGroup,
|
|
53
|
+
{
|
|
54
|
+
type: "single",
|
|
55
|
+
allowDeselect: true,
|
|
56
|
+
"aria-label": quickFilters.label ?? text.filters,
|
|
57
|
+
options: quickFilters.options,
|
|
58
|
+
value: quickFilters.value,
|
|
59
|
+
defaultValue: quickFilters.defaultValue,
|
|
60
|
+
onValueChange: quickFilters.onValueChange
|
|
61
|
+
}
|
|
62
|
+
) : null;
|
|
63
|
+
const trigger = (label, className2) => /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "secondary", className: className2, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(SlidersHorizontal, { "aria-hidden": "true" }),
|
|
65
|
+
label,
|
|
66
|
+
suffix
|
|
67
|
+
] }) });
|
|
68
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("@container/filter-bar flex min-w-0 flex-col gap-2", className), ...props, children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
Input,
|
|
72
|
+
{
|
|
73
|
+
type: "search",
|
|
74
|
+
size: "xs",
|
|
75
|
+
value: query,
|
|
76
|
+
onChange: (event) => setQuery(event.target.value),
|
|
77
|
+
placeholder: searchPlaceholder ?? text.search,
|
|
78
|
+
"aria-label": text.search,
|
|
79
|
+
start: /* @__PURE__ */ jsx(Search, { "aria-hidden": "true", className: "size-4 text-ink-3" }),
|
|
80
|
+
className: "w-full min-w-0 @min-[40rem]/filter-bar:w-64"
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
quick ? /* @__PURE__ */ jsx("div", { className: "hidden min-w-0 @min-[40rem]/filter-bar:block", children: quick }) : null,
|
|
84
|
+
hasExtra ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
85
|
+
trigger(text.moreFilters, "hidden @min-[40rem]/filter-bar:inline-flex"),
|
|
86
|
+
/* @__PURE__ */ jsx(PopoverContent, { align: "start", "aria-label": text.moreFilters, className: "grid gap-3 p-3", children })
|
|
87
|
+
] }) : null,
|
|
88
|
+
quick || hasExtra ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
89
|
+
trigger(text.filters, "@min-[40rem]/filter-bar:hidden"),
|
|
90
|
+
/* @__PURE__ */ jsxs(PopoverContent, { align: "start", "aria-label": text.filters, className: "grid gap-3 p-3", children: [
|
|
91
|
+
quick,
|
|
92
|
+
children
|
|
93
|
+
] })
|
|
94
|
+
] }) : null,
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex min-w-0 flex-wrap items-center gap-2", children: [
|
|
96
|
+
resultCount !== void 0 ? /* @__PURE__ */ jsx("p", { role: "status", "aria-live": "polite", className: "m-0 text-fs-120 text-ink-3 tabular-nums", children: resultCount === 1 ? text.resultOne : fill(text.resultMany, { count: format.format(resultCount) }) }) : null,
|
|
97
|
+
actions
|
|
98
|
+
] })
|
|
99
|
+
] }),
|
|
100
|
+
count > 0 ? /* @__PURE__ */ jsxs(
|
|
101
|
+
"ul",
|
|
102
|
+
{
|
|
103
|
+
"aria-label": text.activeFilters,
|
|
104
|
+
className: "m-0 flex min-w-0 list-none flex-wrap items-center gap-1.5 p-0",
|
|
105
|
+
children: [
|
|
106
|
+
activeFilters.map((filter) => /* @__PURE__ */ jsx("li", { className: "min-w-0", children: /* @__PURE__ */ jsx(
|
|
107
|
+
Chip,
|
|
108
|
+
{
|
|
109
|
+
tone: "accent",
|
|
110
|
+
onRemove: filter.onRemove,
|
|
111
|
+
removeLabel: fill(text.removeFilter, { filter: filter.label }),
|
|
112
|
+
children: filter.label
|
|
113
|
+
}
|
|
114
|
+
) }, filter.id)),
|
|
115
|
+
onClearAll ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onClearAll, children: text.clearAll }) }) : null
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) : null
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
FilterBar
|
|
123
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FilterBar, type FilterBarChip, type FilterBarLabels, type FilterBarProps, type FilterBarQuickFilters, } from "./filter-bar.js";
|
|
@@ -44,7 +44,7 @@ function HBars({
|
|
|
44
44
|
),
|
|
45
45
|
children: [
|
|
46
46
|
rows.map((row) => /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
47
|
-
/* @__PURE__ */ jsx("span", { className: "truncate font-semibold text-fs-
|
|
47
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-semibold text-fs-120", children: row.name }),
|
|
48
48
|
/* @__PURE__ */ jsxs("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%]", children: [
|
|
49
49
|
paired ? /* @__PURE__ */ jsx("div", { className: "flex h-6.5 w-full flex-col items-start justify-center gap-0.75", children: row.values.map((value, index) => /* @__PURE__ */ jsx(
|
|
50
50
|
"div",
|
|
@@ -95,7 +95,7 @@ function HBars({
|
|
|
95
95
|
/* @__PURE__ */ jsx("div", { className: "relative h-4", children: ticks.map((tick) => /* @__PURE__ */ jsx(
|
|
96
96
|
"span",
|
|
97
97
|
{
|
|
98
|
-
className: "-translate-x-1/2 absolute font-medium text-fs-
|
|
98
|
+
className: "-translate-x-1/2 absolute font-medium text-fs-110 text-ink-3 leading-none tabular-nums",
|
|
99
99
|
style: { left: `${tick.position}%` },
|
|
100
100
|
children: tick.label
|
|
101
101
|
},
|
|
@@ -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";
|