@jcsoftdev/ui 0.4.0 → 0.6.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 +434 -0
- package/README.md +26 -4
- package/bin/ui-theme.mjs +40 -6
- package/dist/ai/code-block/code-block.js +1 -1
- package/dist/atoms/big-date/big-date.js +2 -2
- package/dist/atoms/button/button.d.ts +14 -2
- package/dist/atoms/button/button.js +12 -5
- package/dist/atoms/chip/chip.d.ts +5 -0
- package/dist/atoms/chip/chip.js +3 -3
- package/dist/atoms/divider/divider.d.ts +15 -0
- package/dist/atoms/divider/divider.js +27 -0
- package/dist/atoms/divider/index.d.ts +1 -0
- package/dist/atoms/divider/index.js +1 -0
- package/dist/atoms/icon-button/icon-button.d.ts +1 -1
- package/dist/atoms/icon-button/icon-button.js +1 -1
- package/dist/atoms/index.d.ts +1 -0
- package/dist/atoms/index.js +1 -0
- 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/auth/auth-illustration/auth-illustration.d.ts +35 -0
- package/dist/auth/auth-illustration/auth-illustration.js +72 -0
- package/dist/auth/auth-illustration/index.d.ts +3 -0
- package/dist/auth/auth-illustration/index.js +11 -0
- package/dist/auth/auth-illustration/look.d.ts +30 -0
- package/dist/auth/auth-illustration/look.js +0 -0
- package/dist/auth/auth-illustration/model.d.ts +133 -0
- package/dist/auth/auth-illustration/model.js +202 -0
- package/dist/auth/auth-illustration/use-art-pointer.d.ts +9 -0
- package/dist/auth/auth-illustration/use-art-pointer.js +69 -0
- package/dist/auth/auth-layout/auth-layout.d.ts +80 -0
- package/dist/auth/auth-layout/auth-layout.js +190 -0
- package/dist/auth/auth-layout/index.d.ts +1 -0
- package/dist/auth/auth-layout/index.js +1 -0
- package/dist/auth/character/character.d.ts +12 -0
- package/dist/auth/character/character.js +333 -0
- package/dist/auth/character/index.d.ts +1 -0
- package/dist/auth/character/index.js +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +4 -0
- package/dist/auth/internal/auth-context.d.ts +17 -0
- package/dist/auth/internal/auth-context.js +10 -0
- package/dist/auth/internal/auth-styles.d.ts +1 -0
- package/dist/auth/internal/auth-styles.js +29 -0
- package/dist/auth/internal/portal-glyphs.d.ts +6 -0
- package/dist/auth/internal/portal-glyphs.js +39 -0
- package/dist/auth/login-form/context.d.ts +51 -0
- package/dist/auth/login-form/context.js +12 -0
- package/dist/auth/login-form/index.d.ts +2 -0
- package/dist/auth/login-form/index.js +23 -0
- package/dist/auth/login-form/login-form.d.ts +66 -0
- package/dist/auth/login-form/login-form.js +233 -0
- package/dist/auth/login-form/parts.d.ts +71 -0
- package/dist/auth/login-form/parts.js +371 -0
- package/dist/auth/looks/auth-illustration-any.d.ts +16 -0
- package/dist/auth/looks/auth-illustration-any.js +24 -0
- package/dist/auth/looks/index.d.ts +1 -0
- package/dist/auth/looks/index.js +1 -0
- package/dist/auth/mosaic/index.d.ts +1 -0
- package/dist/auth/mosaic/index.js +1 -0
- package/dist/auth/mosaic/mosaic.d.ts +11 -0
- package/dist/auth/mosaic/mosaic.js +195 -0
- package/dist/auth/slabs/index.d.ts +1 -0
- package/dist/auth/slabs/index.js +1 -0
- package/dist/auth/slabs/slabs.d.ts +13 -0
- package/dist/auth/slabs/slabs.js +136 -0
- package/dist/auth/stack/index.d.ts +1 -0
- package/dist/auth/stack/index.js +1 -0
- package/dist/auth/stack/stack.d.ts +6 -0
- package/dist/auth/stack/stack.js +222 -0
- package/dist/auth/statement/index.d.ts +1 -0
- package/dist/auth/statement/index.js +1 -0
- package/dist/auth/statement/statement.d.ts +13 -0
- package/dist/auth/statement/statement.js +99 -0
- 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 +101 -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 +109 -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 +28 -2
- package/dist/containers/responsive-list/responsive-list.js +134 -25
- 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 +4 -0
- package/dist/forms/index.js +4 -0
- package/dist/forms/input/input.d.ts +6 -2
- package/dist/forms/input/input.js +6 -2
- 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/password-input/index.d.ts +1 -0
- package/dist/forms/password-input/index.js +1 -0
- package/dist/forms/password-input/password-input.d.ts +16 -0
- package/dist/forms/password-input/password-input.js +45 -0
- 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 +150 -0
- package/dist/i18n/strings.js +80 -2
- package/dist/icons/eye.d.ts +2 -0
- package/dist/icons/eye.js +11 -0
- package/dist/icons/graduation-cap.d.ts +2 -0
- package/dist/icons/graduation-cap.js +12 -0
- package/dist/icons/house.d.ts +2 -0
- package/dist/icons/house.js +11 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +8 -0
- package/dist/icons/mail.d.ts +2 -0
- package/dist/icons/mail.js +11 -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.js +10 -2
- 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/toaster.d.ts +28 -2
- package/dist/overlays/toaster/toaster.js +73 -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.js +1 -1
- package/dist/utils/class-tokens.generated.js +4 -6
- 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/icons/svg/eye.svg +4 -0
- package/icons/svg/graduation-cap.svg +5 -0
- package/icons/svg/house.svg +4 -0
- package/icons/svg/mail.svg +4 -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/big-date/big-date.tsx +2 -2
- package/src/atoms/button/button.tsx +33 -6
- package/src/atoms/chip/chip.tsx +8 -3
- package/src/atoms/divider/divider.tsx +40 -0
- package/src/atoms/divider/index.ts +1 -0
- package/src/atoms/icon-button/icon-button.tsx +2 -2
- package/src/atoms/index.ts +1 -0
- 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/auth/auth-illustration/auth-illustration.tsx +100 -0
- package/src/auth/auth-illustration/index.ts +8 -0
- package/src/auth/auth-illustration/look.ts +32 -0
- package/src/auth/auth-illustration/model.ts +330 -0
- package/src/auth/auth-illustration/use-art-pointer.ts +78 -0
- package/src/auth/auth-layout/auth-layout.tsx +282 -0
- package/src/auth/auth-layout/index.ts +1 -0
- package/src/auth/character/character.tsx +346 -0
- package/src/auth/character/index.ts +1 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/internal/auth-context.ts +26 -0
- package/src/auth/internal/auth-styles.tsx +39 -0
- package/src/auth/internal/portal-glyphs.tsx +32 -0
- package/src/auth/login-form/context.ts +78 -0
- package/src/auth/login-form/index.ts +21 -0
- package/src/auth/login-form/login-form.tsx +330 -0
- package/src/auth/login-form/parts.tsx +457 -0
- package/src/auth/looks/auth-illustration-any.tsx +38 -0
- package/src/auth/looks/index.ts +1 -0
- package/src/auth/mosaic/index.ts +1 -0
- package/src/auth/mosaic/mosaic.tsx +255 -0
- package/src/auth/slabs/index.ts +1 -0
- package/src/auth/slabs/slabs.tsx +181 -0
- package/src/auth/stack/index.ts +1 -0
- package/src/auth/stack/stack.tsx +267 -0
- package/src/auth/statement/index.ts +1 -0
- package/src/auth/statement/statement.tsx +122 -0
- 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 +146 -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 +157 -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 +183 -46
- 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 +4 -0
- package/src/forms/input/input.tsx +12 -3
- package/src/forms/internal/listbox-items.tsx +3 -4
- package/src/forms/native-select/native-select.tsx +1 -1
- package/src/forms/password-input/index.ts +1 -0
- package/src/forms/password-input/password-input.tsx +57 -0
- 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 +150 -0
- package/src/icons/eye.tsx +12 -0
- package/src/icons/graduation-cap.tsx +13 -0
- package/src/icons/house.tsx +12 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/mail.tsx +12 -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 +7 -2
- 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/toaster.tsx +113 -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 +1 -1
- package/src/utils/class-tokens.generated.ts +4 -6
- 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
|
@@ -9,14 +9,23 @@ import {
|
|
|
9
9
|
useContext,
|
|
10
10
|
useEffect,
|
|
11
11
|
useLayoutEffect,
|
|
12
|
+
useMemo,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
15
|
} from "react";
|
|
15
16
|
import { Checkbox } from "../../atoms/checkbox/checkbox.js";
|
|
16
17
|
import { useUiStrings } from "../../i18n/index.js";
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
ArrowDown,
|
|
20
|
+
ArrowLeftToLine,
|
|
21
|
+
ArrowRightToLine,
|
|
22
|
+
ArrowUp,
|
|
23
|
+
ChevronsUpDown,
|
|
24
|
+
PinOff,
|
|
25
|
+
} from "../../icons/index.js";
|
|
18
26
|
import { cn } from "../../utils/cn.js";
|
|
19
27
|
import { useControllableState } from "../../utils/use-controllable-state.js";
|
|
28
|
+
import { CELL_PY } from "./cell-padding.js";
|
|
20
29
|
import {
|
|
21
30
|
computePinOffsets,
|
|
22
31
|
type PinnedColumns,
|
|
@@ -26,10 +35,17 @@ import {
|
|
|
26
35
|
sanitizePinned,
|
|
27
36
|
setColumnPin,
|
|
28
37
|
} from "./pin.js";
|
|
29
|
-
|
|
30
38
|
import { formatSelectRow, selectAllState, setKeys, toggleKey } from "./selection.js";
|
|
39
|
+
import { ariaSortFor, nextTableSort, type TableSort } from "./sort.js";
|
|
31
40
|
|
|
32
41
|
export type { PinnedColumns, PinSide } from "./pin.js";
|
|
42
|
+
export {
|
|
43
|
+
type AriaSort,
|
|
44
|
+
ariaSortFor,
|
|
45
|
+
nextTableSort,
|
|
46
|
+
type TableSort,
|
|
47
|
+
type TableSortDirection,
|
|
48
|
+
} from "./sort.js";
|
|
33
49
|
|
|
34
50
|
export interface TableLabels {
|
|
35
51
|
pinLeft: string;
|
|
@@ -69,8 +85,48 @@ interface SelectionContextValue {
|
|
|
69
85
|
/** `null` while the table has no selection props, so rows stay plain. */
|
|
70
86
|
const SelectionContext = createContext<SelectionContextValue | null>(null);
|
|
71
87
|
|
|
88
|
+
interface SortContextValue {
|
|
89
|
+
sort: TableSort | null;
|
|
90
|
+
toggle: (columnId: string) => void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** `null` while the table has no sort props, so `sortable` headers stay plain. */
|
|
94
|
+
const SortContext = createContext<SortContextValue | null>(null);
|
|
95
|
+
|
|
96
|
+
/** Ids of the columns the table hides; empty by default. */
|
|
97
|
+
const HiddenContext = createContext<ReadonlySet<string>>(new Set());
|
|
98
|
+
|
|
72
99
|
const FLUSH_START = "[&_:is(th,td):first-child]:pl-0 [&_td:first-child>a]:pl-0";
|
|
73
100
|
const FLUSH_END = "[&_:is(th,td):last-child]:pr-0 [&_td:last-child>a]:pr-0";
|
|
101
|
+
/**
|
|
102
|
+
* Row density. Each sets `--row-min-h` (the least a body row measures, whatever it holds) and
|
|
103
|
+
* `--table-cell-py` (the vertical cell padding), so a row of text and a row holding a 30px control
|
|
104
|
+
* come out the same height. Override either variable with `className` or `style` to tune it.
|
|
105
|
+
*/
|
|
106
|
+
export type TableDensity = "comfortable" | "compact";
|
|
107
|
+
|
|
108
|
+
const DENSITY: Readonly<Record<TableDensity, string>> = {
|
|
109
|
+
comfortable: "[--row-min-h:48px] [--table-cell-py:--spacing(2)]",
|
|
110
|
+
compact: "[--row-min-h:40px] [--table-cell-py:--spacing(1)]",
|
|
111
|
+
};
|
|
112
|
+
// A table row's `height` works as a minimum: content taller than it still grows the row.
|
|
113
|
+
const ROW_MIN_HEIGHT = "[&>tbody>tr]:h-(--row-min-h)";
|
|
114
|
+
|
|
115
|
+
// The last column (the actions one) sticks to the right edge from 24rem of the wrapper's width, so
|
|
116
|
+
// it stays reachable while the other columns scroll under it; a narrower table scrolls it along,
|
|
117
|
+
// since a pinned column would take most of a phone screen. Sticky cells in a collapsed-border table
|
|
118
|
+
// lose their bottom border, so an inset shadow redraws it, and the edge shadow shows only while
|
|
119
|
+
// columns are hidden underneath.
|
|
120
|
+
// Written out in full (no interpolation) so Tailwind finds every class in the source.
|
|
121
|
+
const STICKY_ACTIONS = cn(
|
|
122
|
+
"@sm/table:[&_:is(th,td):last-child]:sticky @sm/table:[&_:is(th,td):last-child]:right-0 @sm/table:[&_:is(th,td):last-child]:bg-surface",
|
|
123
|
+
"@sm/table:[&_td:last-child]:z-1 @sm/table:[&_th:last-child]:z-2 @sm/table:[&_td:last-child]:transition-colors @sm/table:[&_td:last-child]:duration-(--motion-duration)",
|
|
124
|
+
"@sm/table:[&_tr:hover>td:last-child]:bg-surface-2 @sm/table:[&_tr[data-selected]>td:last-child]:bg-accent-soft",
|
|
125
|
+
"@sm/table:[&_:is(th,td):last-child]:[box-shadow:var(--sticky-divider,0_0_transparent),var(--sticky-edge,0_0_transparent)]",
|
|
126
|
+
"[&_th:last-child]:[--sticky-divider:inset_0_-1px_0_var(--border-color-divider)] [&_tbody>tr:not(:last-child)>td:last-child]:[--sticky-divider:inset_0_-1px_0_var(--border-color-divider)]",
|
|
127
|
+
);
|
|
128
|
+
const STICKY_EDGE = "[&_:is(th,td):last-child]:[--sticky-edge:var(--shadow-pinned-end)]";
|
|
129
|
+
|
|
74
130
|
const STICKY_HEADER =
|
|
75
131
|
"[&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-2 [&_thead_th]:bg-surface [&_thead_th]:shadow-[inset_0_-1px_0_var(--border-color-divider)]";
|
|
76
132
|
|
|
@@ -105,6 +161,27 @@ export interface TableProps extends ComponentPropsWithoutRef<"table"> {
|
|
|
105
161
|
defaultSelectedKeys?: readonly string[];
|
|
106
162
|
/** Called with the next keys. Setting it turns selection on. */
|
|
107
163
|
onSelectedKeysChange?: (keys: string[]) => void;
|
|
164
|
+
/**
|
|
165
|
+
* Controlled sort state. Setting it, `defaultSort` or `onSortChange` turns sorting on for the
|
|
166
|
+
* headers marked `sortable`. The table only reports the state: sort your rows yourself.
|
|
167
|
+
*/
|
|
168
|
+
sort?: TableSort | null;
|
|
169
|
+
/** Initial sort when uncontrolled. */
|
|
170
|
+
defaultSort?: TableSort | null;
|
|
171
|
+
/** Called with the next sort (`null` when the sort is cleared). */
|
|
172
|
+
onSortChange?: (sort: TableSort | null) => void;
|
|
173
|
+
/** Ids (`columnId`) of the columns to hide. Headers and cells with that id render nothing. */
|
|
174
|
+
hiddenColumns?: readonly string[];
|
|
175
|
+
/**
|
|
176
|
+
* Row density: `comfortable` (default) gives every body row at least 48px, `compact` 40px, with
|
|
177
|
+
* the cells centred vertically. Rows never depend on what a cell holds for their height.
|
|
178
|
+
*/
|
|
179
|
+
density?: TableDensity;
|
|
180
|
+
/**
|
|
181
|
+
* Keeps the last column (the row actions) stuck to the right edge while the table scrolls
|
|
182
|
+
* sideways, from 24rem of the table's own width up. Leave the last column unpinned when using it.
|
|
183
|
+
*/
|
|
184
|
+
stickyActions?: boolean;
|
|
108
185
|
}
|
|
109
186
|
|
|
110
187
|
function readStorage(key: string): string | null {
|
|
@@ -148,6 +225,12 @@ export function Table({
|
|
|
148
225
|
selectedKeys,
|
|
149
226
|
defaultSelectedKeys,
|
|
150
227
|
onSelectedKeysChange,
|
|
228
|
+
sort,
|
|
229
|
+
defaultSort,
|
|
230
|
+
onSortChange,
|
|
231
|
+
hiddenColumns,
|
|
232
|
+
density = "comfortable",
|
|
233
|
+
stickyActions,
|
|
151
234
|
...props
|
|
152
235
|
}: TableProps) {
|
|
153
236
|
const strings = useUiStrings();
|
|
@@ -160,6 +243,18 @@ export function Table({
|
|
|
160
243
|
defaultProp: defaultSelectedKeys ?? [],
|
|
161
244
|
onChange: onSelectedKeysChange ? (keys) => onSelectedKeysChange([...keys]) : undefined,
|
|
162
245
|
});
|
|
246
|
+
const sortOn = sort !== undefined || defaultSort !== undefined || onSortChange !== undefined;
|
|
247
|
+
const [currentSort, setSort] = useControllableState<TableSort | null>({
|
|
248
|
+
prop: sort,
|
|
249
|
+
defaultProp: defaultSort ?? null,
|
|
250
|
+
onChange: onSortChange,
|
|
251
|
+
});
|
|
252
|
+
const sortContext: SortContextValue | null = sortOn
|
|
253
|
+
? { sort: currentSort, toggle: (columnId) => setSort(nextTableSort(currentSort, columnId)) }
|
|
254
|
+
: null;
|
|
255
|
+
const hiddenKey = (hiddenColumns ?? []).join("\u0000");
|
|
256
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: hiddenKey is the content of hiddenColumns
|
|
257
|
+
const hidden = useMemo(() => new Set(hiddenColumns ?? []), [hiddenKey]);
|
|
163
258
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
164
259
|
const tableRef = useRef<HTMLTableElement>(null);
|
|
165
260
|
const controlled = pinnedColumns !== undefined;
|
|
@@ -266,29 +361,38 @@ export function Table({
|
|
|
266
361
|
return (
|
|
267
362
|
<PinContext.Provider value={context}>
|
|
268
363
|
<SelectionContext.Provider value={selection}>
|
|
269
|
-
<
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
364
|
+
<SortContext.Provider value={sortContext}>
|
|
365
|
+
<HiddenContext.Provider value={hidden}>
|
|
366
|
+
<div
|
|
367
|
+
ref={wrapperRef}
|
|
368
|
+
onScroll={measure}
|
|
369
|
+
style={maxHeight !== undefined ? { maxHeight } : undefined}
|
|
370
|
+
tabIndex={maxHeight !== undefined ? 0 : undefined}
|
|
371
|
+
className={cn(
|
|
372
|
+
"@container/table max-w-full overflow-x-auto",
|
|
373
|
+
maxHeight !== undefined && "overflow-y-auto focus-visible:focus-ring",
|
|
374
|
+
wrapperClassName,
|
|
375
|
+
)}
|
|
376
|
+
>
|
|
377
|
+
<table
|
|
378
|
+
ref={tableRef}
|
|
379
|
+
data-table-density={density}
|
|
380
|
+
className={cn(
|
|
381
|
+
"w-full border-collapse text-fs-130",
|
|
382
|
+
DENSITY[density],
|
|
383
|
+
ROW_MIN_HEIGHT,
|
|
384
|
+
stickyActions && STICKY_ACTIONS,
|
|
385
|
+
stickyActions && scrolled.end && STICKY_EDGE,
|
|
386
|
+
(flush === true || flush === "start") && FLUSH_START,
|
|
387
|
+
(flush === true || flush === "end") && FLUSH_END,
|
|
388
|
+
stickyHeader && STICKY_HEADER,
|
|
389
|
+
className,
|
|
390
|
+
)}
|
|
391
|
+
{...props}
|
|
392
|
+
/>
|
|
393
|
+
</div>
|
|
394
|
+
</HiddenContext.Provider>
|
|
395
|
+
</SortContext.Provider>
|
|
292
396
|
</SelectionContext.Provider>
|
|
293
397
|
</PinContext.Provider>
|
|
294
398
|
);
|
|
@@ -321,7 +425,7 @@ function usePinnedCell(columnId: string | undefined, header: boolean) {
|
|
|
321
425
|
const shadowed =
|
|
322
426
|
position.edge && (position.side === "left" ? context.scrolledStart : context.scrolledEnd);
|
|
323
427
|
const className = cn(
|
|
324
|
-
"sticky bg-surface",
|
|
428
|
+
"sticky bg-surface transition-colors duration-(--motion-duration) motion-reduce:transition-none",
|
|
325
429
|
header
|
|
326
430
|
? "z-2"
|
|
327
431
|
: "z-1 group-hover/row:bg-surface-2 group-aria-selected/row:bg-accent-soft group-data-[selected=true]/row:bg-accent-soft",
|
|
@@ -377,19 +481,70 @@ function PinButtons({ columnId }: { columnId: string }) {
|
|
|
377
481
|
);
|
|
378
482
|
}
|
|
379
483
|
|
|
484
|
+
function SortButton({
|
|
485
|
+
columnId,
|
|
486
|
+
context,
|
|
487
|
+
children,
|
|
488
|
+
}: {
|
|
489
|
+
columnId: string;
|
|
490
|
+
context: SortContextValue;
|
|
491
|
+
children: ReactNode;
|
|
492
|
+
}) {
|
|
493
|
+
const direction = ariaSortFor(context.sort, columnId);
|
|
494
|
+
const Icon =
|
|
495
|
+
direction === "ascending" ? ArrowUp : direction === "descending" ? ArrowDown : ChevronsUpDown;
|
|
496
|
+
return (
|
|
497
|
+
<button
|
|
498
|
+
type="button"
|
|
499
|
+
onClick={() => context.toggle(columnId)}
|
|
500
|
+
className={cn(
|
|
501
|
+
"-mx-1 inline-flex items-center gap-1 rounded-xs px-1 font-[inherit] text-[length:inherit] uppercase tracking-[inherit] hover:text-ink focus-visible:focus-ring",
|
|
502
|
+
direction !== "none" ? "text-ink" : "text-inherit",
|
|
503
|
+
)}
|
|
504
|
+
>
|
|
505
|
+
{children}
|
|
506
|
+
<Icon
|
|
507
|
+
aria-hidden="true"
|
|
508
|
+
className={cn("size-3.5 shrink-0", direction === "none" && "opacity-50")}
|
|
509
|
+
/>
|
|
510
|
+
</button>
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
380
514
|
export function TableHeaderCell({
|
|
381
515
|
className,
|
|
382
516
|
alignRight,
|
|
383
517
|
columnId,
|
|
384
518
|
pinnable,
|
|
519
|
+
sortable,
|
|
385
520
|
children,
|
|
386
521
|
style,
|
|
387
522
|
...props
|
|
388
|
-
}: ComponentPropsWithoutRef<"th"> &
|
|
523
|
+
}: ComponentPropsWithoutRef<"th"> &
|
|
524
|
+
AlignProps & {
|
|
525
|
+
pinnable?: boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Makes the header a button that cycles the sort (ascending, descending, off) and reports it
|
|
528
|
+
* as `aria-sort`. Needs a `columnId` and a `Table` with `sort`, `defaultSort` or `onSortChange`.
|
|
529
|
+
*/
|
|
530
|
+
sortable?: boolean;
|
|
531
|
+
}): ReactNode {
|
|
389
532
|
const pinned = usePinnedCell(columnId, true);
|
|
533
|
+
const hiddenIds = useContext(HiddenContext);
|
|
534
|
+
const sortContext = useContext(SortContext);
|
|
535
|
+
if (columnId && hiddenIds.has(columnId)) return null;
|
|
536
|
+
const sorting = sortable && columnId && sortContext ? { columnId, context: sortContext } : null;
|
|
537
|
+
const content = sorting ? (
|
|
538
|
+
<SortButton columnId={sorting.columnId} context={sorting.context}>
|
|
539
|
+
{children}
|
|
540
|
+
</SortButton>
|
|
541
|
+
) : (
|
|
542
|
+
children
|
|
543
|
+
);
|
|
390
544
|
const showPin = pinnable && columnId && pinned.context;
|
|
391
545
|
return (
|
|
392
546
|
<th
|
|
547
|
+
aria-sort={sorting ? ariaSortFor(sorting.context.sort, sorting.columnId) : undefined}
|
|
393
548
|
className={cn(
|
|
394
549
|
"whitespace-nowrap border-b-divider px-4 py-2.5 text-left font-[650] text-fs-110 text-ink-3 uppercase tracking-[.07em] @max-sm/table:px-2.5",
|
|
395
550
|
alignRight && "text-right",
|
|
@@ -402,11 +557,11 @@ export function TableHeaderCell({
|
|
|
402
557
|
>
|
|
403
558
|
{showPin ? (
|
|
404
559
|
<span className={cn("inline-flex items-center gap-1", alignRight && "flex-row-reverse")}>
|
|
405
|
-
{
|
|
560
|
+
{content}
|
|
406
561
|
<PinButtons columnId={columnId} />
|
|
407
562
|
</span>
|
|
408
563
|
) : (
|
|
409
|
-
|
|
564
|
+
content
|
|
410
565
|
)}
|
|
411
566
|
</th>
|
|
412
567
|
);
|
|
@@ -429,7 +584,7 @@ export function TableRow({ className, rowKey, ...props }: TableRowProps) {
|
|
|
429
584
|
aria-selected={isSelected}
|
|
430
585
|
data-selected={isSelected || undefined}
|
|
431
586
|
className={cn(
|
|
432
|
-
"group/row border-b-divider last:border-b-0 hover:bg-surface-2",
|
|
587
|
+
"group/row border-b-divider transition-colors duration-(--motion-duration) ease-(--motion-ease) last:border-b-0 hover:bg-surface-2 motion-reduce:transition-none",
|
|
433
588
|
isSelected && "bg-accent-soft hover:bg-accent-soft",
|
|
434
589
|
className,
|
|
435
590
|
)}
|
|
@@ -451,7 +606,10 @@ export function TableSelectCell({ rowKey, label, className, ...props }: TableSel
|
|
|
451
606
|
if (!selection)
|
|
452
607
|
throw new Error("TableSelectCell needs a Table with selectedKeys or onSelectedKeysChange");
|
|
453
608
|
return (
|
|
454
|
-
<td
|
|
609
|
+
<td
|
|
610
|
+
className={cn("w-px px-4 align-middle @max-sm/table:px-2.5", CELL_PY, className)}
|
|
611
|
+
{...props}
|
|
612
|
+
>
|
|
455
613
|
<Checkbox
|
|
456
614
|
checked={selection.selected.includes(rowKey)}
|
|
457
615
|
onCheckedChange={() => selection.toggle(rowKey)}
|
|
@@ -507,7 +665,7 @@ export interface TableActionsCellProps extends ComponentPropsWithoutRef<"td"> {
|
|
|
507
665
|
export function TableActionsCell({ menu, className, children, ...props }: TableActionsCellProps) {
|
|
508
666
|
return (
|
|
509
667
|
<td
|
|
510
|
-
className={cn("w-px px-4
|
|
668
|
+
className={cn("w-px px-4 text-right align-middle @max-sm/table:px-2.5", CELL_PY, className)}
|
|
511
669
|
{...props}
|
|
512
670
|
>
|
|
513
671
|
<div
|
|
@@ -533,10 +691,13 @@ export function TableCell({
|
|
|
533
691
|
...props
|
|
534
692
|
}: ComponentPropsWithoutRef<"td"> & AlignProps) {
|
|
535
693
|
const pinned = usePinnedCell(columnId, false);
|
|
694
|
+
const hiddenIds = useContext(HiddenContext);
|
|
695
|
+
if (columnId && hiddenIds.has(columnId)) return null;
|
|
536
696
|
return (
|
|
537
697
|
<td
|
|
538
698
|
className={cn(
|
|
539
|
-
"px-4
|
|
699
|
+
"px-4 align-middle @max-sm/table:px-2.5",
|
|
700
|
+
CELL_PY,
|
|
540
701
|
alignRight && "text-right",
|
|
541
702
|
pinned.className,
|
|
542
703
|
className,
|
|
@@ -576,6 +737,7 @@ export function TableLinkRow({
|
|
|
576
737
|
...props
|
|
577
738
|
}: TableLinkRowProps) {
|
|
578
739
|
const pinned = usePinnedCell(primaryColumnId, false);
|
|
740
|
+
const hiddenIds = useContext(HiddenContext);
|
|
579
741
|
const selection = useContext(SelectionContext);
|
|
580
742
|
const isSelected =
|
|
581
743
|
selection && rowKey !== undefined ? selection.selected.includes(rowKey) : undefined;
|
|
@@ -584,24 +746,29 @@ export function TableLinkRow({
|
|
|
584
746
|
aria-selected={isSelected}
|
|
585
747
|
data-selected={isSelected || undefined}
|
|
586
748
|
className={cn(
|
|
587
|
-
"group/row relative border-b-divider last:border-b-0 hover:bg-surface-2",
|
|
749
|
+
"group/row relative border-b-divider transition-colors duration-(--motion-duration) ease-(--motion-ease) last:border-b-0 hover:bg-surface-2 motion-reduce:transition-none",
|
|
588
750
|
isSelected && "bg-accent-soft hover:bg-accent-soft",
|
|
589
751
|
className,
|
|
590
752
|
)}
|
|
591
753
|
{...props}
|
|
592
754
|
>
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
<a
|
|
599
|
-
href={href}
|
|
600
|
-
className="block px-4 py-2.75 font-[650] text-ink no-underline before:absolute before:inset-0 before:content-[''] @max-sm/table:px-2.5"
|
|
755
|
+
{primaryColumnId && hiddenIds.has(primaryColumnId) ? null : (
|
|
756
|
+
<td
|
|
757
|
+
className={cn("p-0 align-middle", pinned.className)}
|
|
758
|
+
style={pinned.style}
|
|
759
|
+
{...pinned.attrs}
|
|
601
760
|
>
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
761
|
+
<a
|
|
762
|
+
href={href}
|
|
763
|
+
className={cn(
|
|
764
|
+
"block px-4 font-[650] text-ink no-underline before:absolute before:inset-0 before:content-[''] @max-sm/table:px-2.5",
|
|
765
|
+
CELL_PY,
|
|
766
|
+
)}
|
|
767
|
+
>
|
|
768
|
+
{primary}
|
|
769
|
+
</a>
|
|
770
|
+
</td>
|
|
771
|
+
)}
|
|
605
772
|
{children}
|
|
606
773
|
</tr>
|
|
607
774
|
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Checkbox } from "../../atoms/checkbox/checkbox.js";
|
|
4
|
+
import { useUiStrings } from "../../i18n/index.js";
|
|
5
|
+
import { Columns3 } from "../../icons/index.js";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../overlays/popover/popover.js";
|
|
7
|
+
|
|
8
|
+
export interface TableColumnOption {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TableColumnsMenuProps {
|
|
14
|
+
columns: readonly TableColumnOption[];
|
|
15
|
+
/** Ids of the hidden columns; pass the same list to `Table` as `hiddenColumns`. */
|
|
16
|
+
hiddenColumns: readonly string[];
|
|
17
|
+
onHiddenColumnsChange: (hidden: string[]) => void;
|
|
18
|
+
/** Trigger text. Defaults to the localized "Columns". */
|
|
19
|
+
label?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Popover with a checkbox per column. The last visible column cannot be hidden. */
|
|
23
|
+
export function TableColumnsMenu({
|
|
24
|
+
columns,
|
|
25
|
+
hiddenColumns,
|
|
26
|
+
onHiddenColumnsChange,
|
|
27
|
+
label,
|
|
28
|
+
}: TableColumnsMenuProps) {
|
|
29
|
+
const strings = useUiStrings();
|
|
30
|
+
const name = label ?? strings.columns;
|
|
31
|
+
const visible = columns.filter((column) => !hiddenColumns.includes(column.id));
|
|
32
|
+
return (
|
|
33
|
+
<Popover>
|
|
34
|
+
<PopoverTrigger asChild>
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
className="inline-flex h-control-sm items-center gap-1.5 rounded-control bg-surface-control px-2.5 text-fs-120 text-ink shadow-control hover:bg-surface-2 focus-visible:focus-ring [&_svg]:size-4"
|
|
38
|
+
>
|
|
39
|
+
<Columns3 aria-hidden="true" />
|
|
40
|
+
{name}
|
|
41
|
+
</button>
|
|
42
|
+
</PopoverTrigger>
|
|
43
|
+
<PopoverContent align="end" aria-label={name}>
|
|
44
|
+
<ul className="m-0 grid list-none gap-1 p-0">
|
|
45
|
+
{columns.map((column) => {
|
|
46
|
+
const shown = !hiddenColumns.includes(column.id);
|
|
47
|
+
return (
|
|
48
|
+
<li key={column.id} className="px-1.5 py-1">
|
|
49
|
+
<Checkbox
|
|
50
|
+
label={column.label}
|
|
51
|
+
checked={shown}
|
|
52
|
+
disabled={shown && visible.length === 1}
|
|
53
|
+
onCheckedChange={() =>
|
|
54
|
+
onHiddenColumnsChange(
|
|
55
|
+
shown
|
|
56
|
+
? [...hiddenColumns, column.id]
|
|
57
|
+
: hiddenColumns.filter((id) => id !== column.id),
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
/>
|
|
61
|
+
</li>
|
|
62
|
+
);
|
|
63
|
+
})}
|
|
64
|
+
</ul>
|
|
65
|
+
</PopoverContent>
|
|
66
|
+
</Popover>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -1,80 +1,13 @@
|
|
|
1
1
|
import type { Decorator } from "@storybook/react-vite";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
import { Card, CardBody, CardHeader } from "../containers/card/index.js";
|
|
4
|
-
import { cn } from "../utils/cn.js";
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<div className="grid grid-cols-2 gap-px overflow-hidden rounded-card bg-line border-card shadow-card @min-[720px]/page:grid-cols-4">
|
|
15
|
-
{children}
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const gridClasses = {
|
|
21
|
-
2: "grid-cols-1 @min-[720px]/page:grid-cols-2",
|
|
22
|
-
3: "grid-cols-1 @min-[720px]/page:grid-cols-2 @min-[1180px]/page:grid-cols-3",
|
|
23
|
-
} as const;
|
|
24
|
-
|
|
25
|
-
/** Equal cards that stack under 720 px of page width. */
|
|
26
|
-
export function CardGrid({ columns = 2, children }: { columns?: 2 | 3; children: ReactNode }) {
|
|
27
|
-
return <div className={cn("grid items-start gap-4", gridClasses[columns])}>{children}</div>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ChartCardProps {
|
|
31
|
-
title: string;
|
|
32
|
-
subtitle?: string;
|
|
33
|
-
/** Slot at the end of the header (a chip, a button). */
|
|
34
|
-
aside?: ReactNode;
|
|
35
|
-
/** Fixed height of the body in px; the chart inside uses `height="fill"`. */
|
|
36
|
-
height?: number;
|
|
37
|
-
children: ReactNode;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function CardTitle({ title, subtitle }: { title: string; subtitle?: string }) {
|
|
41
|
-
return (
|
|
42
|
-
<div className="min-w-0 flex-1">
|
|
43
|
-
<h2 className="m-0 break-words font-semibold text-fs-140 text-ink">{title}</h2>
|
|
44
|
-
{subtitle ? <p className="m-0 break-words text-fs-120 text-ink-3">{subtitle}</p> : null}
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Card with a fixed-height body so `height="fill"` charts take exactly the space left. */
|
|
50
|
-
export function ChartCard({ title, subtitle, aside, height = 300, children }: ChartCardProps) {
|
|
51
|
-
return (
|
|
52
|
-
<Card>
|
|
53
|
-
<CardHeader>
|
|
54
|
-
<CardTitle title={title} subtitle={subtitle} />
|
|
55
|
-
{aside}
|
|
56
|
-
</CardHeader>
|
|
57
|
-
<CardBody>
|
|
58
|
-
<div className="min-w-0" style={{ height }}>
|
|
59
|
-
{children}
|
|
60
|
-
</div>
|
|
61
|
-
</CardBody>
|
|
62
|
-
</Card>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** Card whose body is a table or grid that scrolls inside its own wrapper. */
|
|
67
|
-
export function TableCard({ title, subtitle, aside, children }: Omit<ChartCardProps, "height">) {
|
|
68
|
-
return (
|
|
69
|
-
<Card>
|
|
70
|
-
<CardHeader>
|
|
71
|
-
<CardTitle title={title} subtitle={subtitle} />
|
|
72
|
-
{aside}
|
|
73
|
-
</CardHeader>
|
|
74
|
-
<div className="min-w-0">{children}</div>
|
|
75
|
-
</Card>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
3
|
+
export {
|
|
4
|
+
CardGrid,
|
|
5
|
+
ChartCard,
|
|
6
|
+
type ChartCardProps,
|
|
7
|
+
DashboardPage,
|
|
8
|
+
KpiRow,
|
|
9
|
+
TableCard,
|
|
10
|
+
} from "../containers/dashboard/index.js";
|
|
78
11
|
|
|
79
12
|
/** Container-width frames for the `Narrow` (320) and `Tablet` (768) variants. */
|
|
80
13
|
export const narrowFrame: Decorator = (Story) => (
|
|
@@ -33,6 +33,11 @@ interface ChipGroupCommon {
|
|
|
33
33
|
"aria-labelledby"?: string | undefined;
|
|
34
34
|
"aria-describedby"?: string | undefined;
|
|
35
35
|
"aria-invalid"?: boolean | "true" | "false" | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Minimum chip height: `sm` (default) is 30px (`--control-height-sm`), `md` 38px
|
|
38
|
+
* (`--control-height-md`), the heights of `Button` and `Input` of the same size.
|
|
39
|
+
*/
|
|
40
|
+
size?: "sm" | "md" | undefined;
|
|
36
41
|
className?: string | undefined;
|
|
37
42
|
/** Per-part classes merged with `cn`; consumer classes win. `className` still targets the root. */
|
|
38
43
|
classNames?: ClassNames<ChipGroupPart>;
|
|
@@ -71,6 +76,7 @@ export function ChipGroup(props: ChipGroupProps) {
|
|
|
71
76
|
name,
|
|
72
77
|
invalid,
|
|
73
78
|
id,
|
|
79
|
+
size = "sm",
|
|
74
80
|
className,
|
|
75
81
|
classNames,
|
|
76
82
|
"aria-label": ariaLabel,
|
|
@@ -156,7 +162,8 @@ export function ChipGroup(props: ChipGroupProps) {
|
|
|
156
162
|
{...item}
|
|
157
163
|
onClick={() => toggle(option.value)}
|
|
158
164
|
className={cn(
|
|
159
|
-
"inline-flex
|
|
165
|
+
"inline-flex cursor-pointer items-center gap-1.5 rounded-badge border-control bg-surface-control px-3 font-medium text-fs-130 text-ink-2 hover:bg-surface-2 focus-visible:focus-ring disabled:cursor-not-allowed disabled:opacity-50 aria-pressed:border-accent aria-pressed:bg-accent-soft aria-pressed:text-accent-ink group-data-[invalid]/chips:border-danger min-h-(--touch-target) [&_svg]:size-3",
|
|
166
|
+
size === "md" ? "min-h-control-md" : "min-h-control-sm",
|
|
160
167
|
classNames?.chip,
|
|
161
168
|
)}
|
|
162
169
|
>
|
|
@@ -271,7 +271,7 @@ export function Combobox({
|
|
|
271
271
|
onKeyDown={handleKeyDown}
|
|
272
272
|
className={cn(
|
|
273
273
|
"w-full min-w-0 rounded-input border-control bg-surface-control pl-3 text-control text-ink placeholder:text-ink-3 focus:border-transparent focus:outline-2 focus:outline-accent-ink focus:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-danger",
|
|
274
|
-
size === "sm" ? "h-control-sm" : "h-
|
|
274
|
+
size === "sm" ? "h-control-sm" : "h-control-md min-h-(--touch-target)",
|
|
275
275
|
hasClear ? "pr-8" : "pr-3",
|
|
276
276
|
classNames?.input,
|
|
277
277
|
)}
|
|
@@ -67,7 +67,7 @@ export function CopyField({
|
|
|
67
67
|
onCopy?.(value);
|
|
68
68
|
}}
|
|
69
69
|
className={cn(
|
|
70
|
-
"inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-button px-2.5 font-semibold text-ink-2 text-meta hover:bg-surface-2 hover:text-ink focus-visible:focus-ring
|
|
70
|
+
"inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-button px-2.5 font-semibold text-ink-2 text-meta hover:bg-surface-2 hover:text-ink focus-visible:focus-ring",
|
|
71
71
|
copied && "text-success",
|
|
72
72
|
classNames?.button,
|
|
73
73
|
)}
|
|
@@ -49,6 +49,8 @@ export interface DatePickerProps
|
|
|
49
49
|
locale?: string;
|
|
50
50
|
/** First day of the week in the calendar, 0 (Sunday) to 6. Defaults from the locale (es-PE: Monday). */
|
|
51
51
|
weekStartsOn?: WeekStart;
|
|
52
|
+
/** `sm` is 30px and `md` (default) 38px, the heights of `Button` and `Input` of the same size. */
|
|
53
|
+
size?: "sm" | "md";
|
|
52
54
|
/** Shows a button that clears the date. Default `true`. */
|
|
53
55
|
clearable?: boolean;
|
|
54
56
|
clearLabel?: string;
|
|
@@ -63,8 +65,9 @@ export interface DatePickerProps
|
|
|
63
65
|
classNames?: ClassNames<DatePickerPart>;
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
// The clear and calendar buttons wrap a 14-16px glyph; `min-h-control-sm` gives each a 30px hit area.
|
|
66
69
|
const ICON_BUTTON =
|
|
67
|
-
"flex w-8 items-center justify-center rounded-input text-ink-3 outline-none hover:text-ink focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50";
|
|
70
|
+
"flex min-h-control-sm w-8 items-center justify-center rounded-input text-ink-3 outline-none hover:text-ink focus-visible:focus-ring disabled:pointer-events-none disabled:opacity-50";
|
|
68
71
|
|
|
69
72
|
/**
|
|
70
73
|
* Typed date field plus a calendar popover. The value is an ISO "YYYY-MM-DD" string end to end,
|
|
@@ -80,6 +83,7 @@ export function DatePicker({
|
|
|
80
83
|
isDateDisabled,
|
|
81
84
|
locale: localeProp,
|
|
82
85
|
weekStartsOn,
|
|
86
|
+
size = "md",
|
|
83
87
|
clearable = true,
|
|
84
88
|
clearLabel,
|
|
85
89
|
name,
|
|
@@ -167,7 +171,8 @@ export function DatePicker({
|
|
|
167
171
|
}}
|
|
168
172
|
onKeyDown={handleKeyDown}
|
|
169
173
|
className={cn(
|
|
170
|
-
|
|
174
|
+
size === "sm" ? "h-control-sm" : "h-control-md",
|
|
175
|
+
"min-h-(--touch-target) w-full min-w-0 rounded-input border-control bg-surface-control pl-3 text-control text-ink tabular-nums placeholder:text-ink-3 focus:border-transparent focus:outline-2 focus:outline-accent-ink focus:-outline-offset-1 disabled:cursor-not-allowed disabled:opacity-50 aria-[invalid=true]:border-danger",
|
|
171
176
|
hasClear ? "pr-16" : "pr-9",
|
|
172
177
|
classNames?.input,
|
|
173
178
|
className,
|