@accelint/design-toolkit 9.9.1 → 9.10.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/catalog-info.yaml +3 -3
- package/dist/components/accordion/group.d.ts +2 -2
- package/dist/components/accordion/header.d.ts +2 -2
- package/dist/components/accordion/index.d.ts +2 -2
- package/dist/components/accordion/panel.d.ts +2 -2
- package/dist/components/accordion/styles.module.css +19 -3
- package/dist/components/accordion/trigger.d.ts +2 -2
- package/dist/components/action-bar/index.d.ts +2 -2
- package/dist/components/audio/index.d.ts +2 -2
- package/dist/components/avatar/context.d.ts +4 -4
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/badge/context.d.ts +4 -4
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/breadcrumbs/index.d.ts +2 -2
- package/dist/components/breadcrumbs/item.d.ts +2 -2
- package/dist/components/button/context.d.ts +8 -8
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/link.d.ts +2 -2
- package/dist/components/button/styles.module.css +16 -0
- package/dist/components/button/toggle.d.ts +2 -2
- package/dist/components/carousel/context.d.ts +40 -0
- package/dist/components/carousel/context.js +55 -0
- package/dist/components/carousel/context.js.map +1 -0
- package/dist/components/carousel/gallery.d.ts +38 -0
- package/dist/components/carousel/gallery.js +84 -0
- package/dist/components/carousel/gallery.js.map +1 -0
- package/dist/components/carousel/index.d.ts +56 -0
- package/dist/components/carousel/index.js +66 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/carousel/navigation.d.ts +51 -0
- package/dist/components/carousel/navigation.js +82 -0
- package/dist/components/carousel/navigation.js.map +1 -0
- package/dist/components/carousel/position.d.ts +33 -0
- package/dist/components/carousel/position.js +48 -0
- package/dist/components/carousel/position.js.map +1 -0
- package/dist/components/carousel/select.d.ts +38 -0
- package/dist/components/carousel/select.js +69 -0
- package/dist/components/carousel/select.js.map +1 -0
- package/dist/components/carousel/style.module.css +62 -0
- package/dist/components/carousel/types.d.ts +87 -0
- package/dist/components/carousel/types.js +12 -0
- package/dist/components/carousel/viewer.d.ts +40 -0
- package/dist/components/carousel/viewer.js +75 -0
- package/dist/components/carousel/viewer.js.map +1 -0
- package/dist/components/checkbox/context.d.ts +3 -3
- package/dist/components/checkbox/group.d.ts +2 -2
- package/dist/components/checkbox/group.js +1 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/chip/context.d.ts +4 -4
- package/dist/components/chip/deletable.d.ts +2 -2
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/list.d.ts +4 -4
- package/dist/components/chip/selectable.d.ts +2 -2
- package/dist/components/classification-badge/context.d.ts +4 -4
- package/dist/components/classification-badge/index.d.ts +2 -2
- package/dist/components/classification-banner/context.d.ts +4 -4
- package/dist/components/classification-banner/index.d.ts +2 -2
- package/dist/components/clock/index.d.ts +2 -2
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/combobox-field/context.d.ts +4 -4
- package/dist/components/combobox-field/index.d.ts +2 -2
- package/dist/components/combobox-field/index.js +1 -1
- package/dist/components/combobox-field/styles.module.css +12 -0
- package/dist/components/coordinate-field/context.d.ts +6 -6
- package/dist/components/coordinate-field/index.d.ts +2 -2
- package/dist/components/coordinate-field/segment.d.ts +2 -2
- package/dist/components/date-field/index.d.ts +2 -2
- package/dist/components/deferred-collection/index.d.ts +2 -2
- package/dist/components/details-list/context.d.ts +4 -4
- package/dist/components/details-list/index.d.ts +2 -2
- package/dist/components/details-list/label.d.ts +2 -2
- package/dist/components/details-list/value.d.ts +2 -2
- package/dist/components/dialog/content.d.ts +2 -2
- package/dist/components/dialog/context.d.ts +2 -2
- package/dist/components/dialog/footer.d.ts +2 -2
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/dialog/styles.module.css +23 -0
- package/dist/components/dialog/title.d.ts +2 -2
- package/dist/components/divider/context.d.ts +4 -4
- package/dist/components/divider/index.d.ts +2 -2
- package/dist/components/drawer/back.d.ts +2 -2
- package/dist/components/drawer/close.d.ts +2 -2
- package/dist/components/drawer/content.d.ts +2 -2
- package/dist/components/drawer/context.d.ts +2 -2
- package/dist/components/drawer/footer.d.ts +2 -2
- package/dist/components/drawer/header-title.d.ts +2 -2
- package/dist/components/drawer/header.d.ts +2 -2
- package/dist/components/drawer/index.d.ts +2 -2
- package/dist/components/drawer/layout-main.d.ts +2 -2
- package/dist/components/drawer/layout.d.ts +2 -2
- package/dist/components/drawer/menu-item.d.ts +2 -2
- package/dist/components/drawer/menu.d.ts +2 -2
- package/dist/components/drawer/panel.d.ts +2 -2
- package/dist/components/drawer/styles.module.css +54 -2
- package/dist/components/drawer/trigger.d.ts +2 -2
- package/dist/components/drawer/view.d.ts +2 -2
- package/dist/components/flashcard/index.d.ts +9 -9
- package/dist/components/floating-card/context.d.ts +37 -5
- package/dist/components/floating-card/context.js +18 -3
- package/dist/components/floating-card/context.js.map +1 -1
- package/dist/components/floating-card/index.d.ts +53 -3
- package/dist/components/floating-card/index.js +41 -11
- package/dist/components/floating-card/index.js.map +1 -1
- package/dist/components/floating-card/provider.d.ts +94 -17
- package/dist/components/floating-card/provider.js +116 -20
- package/dist/components/floating-card/provider.js.map +1 -1
- package/dist/components/floating-card/styles.module.css +5 -0
- package/dist/components/gantt/components/base-elements/point.d.ts +28 -0
- package/dist/components/gantt/components/base-elements/point.js +44 -0
- package/dist/components/gantt/components/base-elements/point.js.map +1 -0
- package/dist/components/gantt/components/base-elements/range.d.ts +30 -0
- package/dist/components/gantt/components/base-elements/range.js +51 -0
- package/dist/components/gantt/components/base-elements/range.js.map +1 -0
- package/dist/components/gantt/components/base-elements/use-point-element-layout/index.d.ts +12 -0
- package/dist/components/gantt/components/base-elements/use-point-element-layout/index.js +42 -0
- package/dist/components/gantt/components/base-elements/use-point-element-layout/index.js.map +1 -0
- package/dist/components/gantt/components/base-elements/use-range-element-layout/index.d.ts +23 -0
- package/dist/components/gantt/components/base-elements/use-range-element-layout/index.js +50 -0
- package/dist/components/gantt/components/base-elements/use-range-element-layout/index.js.map +1 -0
- package/dist/components/gantt/components/containers/external/gantt-content-container/index.d.ts +23 -0
- package/dist/components/gantt/components/containers/external/gantt-content-container/index.js +40 -0
- package/dist/components/gantt/components/containers/external/gantt-content-container/index.js.map +1 -0
- package/dist/components/gantt/components/containers/external/gantt-panel-container/index.d.ts +23 -0
- package/dist/components/gantt/components/containers/external/gantt-panel-container/index.js +33 -0
- package/dist/components/gantt/components/containers/external/gantt-panel-container/index.js.map +1 -0
- package/dist/components/gantt/components/containers/external/styles.module.css +32 -0
- package/dist/components/gantt/components/containers/internal/index.d.ts +22 -0
- package/dist/components/gantt/components/containers/internal/index.js +35 -0
- package/dist/components/gantt/components/containers/internal/index.js.map +1 -0
- package/dist/components/gantt/components/containers/internal/layout-container/index.d.ts +22 -0
- package/dist/components/gantt/components/containers/internal/layout-container/index.js +27 -0
- package/dist/components/gantt/components/containers/internal/layout-container/index.js.map +1 -0
- package/dist/components/gantt/components/containers/internal/styles.module.css +35 -0
- package/dist/components/gantt/components/containers/internal/virtualized-content-height-container/index.d.ts +22 -0
- package/dist/components/gantt/components/containers/internal/virtualized-content-height-container/index.js +38 -0
- package/dist/components/gantt/components/containers/internal/virtualized-content-height-container/index.js.map +1 -0
- package/dist/components/gantt/components/content-row/block.d.ts +27 -0
- package/dist/components/gantt/components/content-row/block.js +39 -0
- package/dist/components/gantt/components/content-row/block.js.map +1 -0
- package/dist/components/gantt/components/content-row/bracket.d.ts +23 -0
- package/dist/components/gantt/components/content-row/bracket.js +48 -0
- package/dist/components/gantt/components/content-row/bracket.js.map +1 -0
- package/dist/components/gantt/components/content-row/icon-marker.d.ts +27 -0
- package/dist/components/gantt/components/content-row/icon-marker.js +41 -0
- package/dist/components/gantt/components/content-row/icon-marker.js.map +1 -0
- package/dist/components/gantt/components/content-row/index.d.ts +24 -0
- package/dist/components/gantt/components/content-row/index.js +32 -0
- package/dist/components/gantt/components/content-row/index.js.map +1 -0
- package/dist/components/gantt/components/content-row/marker.d.ts +21 -0
- package/dist/components/gantt/components/content-row/marker.js +35 -0
- package/dist/components/gantt/components/content-row/marker.js.map +1 -0
- package/dist/components/gantt/components/content-row/spacer.d.ts +23 -0
- package/dist/components/gantt/components/content-row/spacer.js +35 -0
- package/dist/components/gantt/components/content-row/spacer.js.map +1 -0
- package/dist/components/gantt/components/content-row/styles.module.css +198 -0
- package/dist/components/gantt/components/content-row/use-elapsed-percentage/index.d.ts +19 -0
- package/dist/components/gantt/components/content-row/use-elapsed-percentage/index.js +27 -0
- package/dist/components/gantt/components/content-row/use-elapsed-percentage/index.js.map +1 -0
- package/dist/components/gantt/components/content-row/use-is-elapsed/index.d.ts +10 -0
- package/dist/components/gantt/components/content-row/use-is-elapsed/index.js +24 -0
- package/dist/components/gantt/components/content-row/use-is-elapsed/index.js.map +1 -0
- package/dist/components/gantt/components/current-time/index.d.ts +28 -0
- package/dist/components/gantt/components/current-time/index.js +63 -0
- package/dist/components/gantt/components/current-time/index.js.map +1 -0
- package/dist/components/gantt/components/current-time/styles.module.css +42 -0
- package/dist/components/gantt/components/current-time/use-current-time-layout/index.d.ts +31 -0
- package/dist/components/gantt/components/current-time/use-current-time-layout/index.js +58 -0
- package/dist/components/gantt/components/current-time/use-current-time-layout/index.js.map +1 -0
- package/dist/components/gantt/components/header/index.d.ts +25 -0
- package/dist/components/gantt/components/header/index.js +41 -0
- package/dist/components/gantt/components/header/index.js.map +1 -0
- package/dist/components/gantt/components/header/styles.module.css +23 -0
- package/dist/components/gantt/components/panel-row/index.d.ts +24 -0
- package/dist/components/gantt/components/panel-row/index.js +33 -0
- package/dist/components/gantt/components/panel-row/index.js.map +1 -0
- package/dist/components/gantt/components/panel-row/styles.module.css +24 -0
- package/dist/components/gantt/components/rows-virtualizer/index.d.ts +25 -0
- package/dist/components/gantt/components/rows-virtualizer/index.js +67 -0
- package/dist/components/gantt/components/rows-virtualizer/index.js.map +1 -0
- package/dist/components/gantt/components/rows-virtualizer/styles.module.css +30 -0
- package/dist/components/gantt/components/rows-virtualizer/use-rendered-rows/index.d.ts +29 -0
- package/dist/components/gantt/components/rows-virtualizer/use-rendered-rows/index.js +57 -0
- package/dist/components/gantt/components/rows-virtualizer/use-rendered-rows/index.js.map +1 -0
- package/dist/components/gantt/components/rows-virtualizer/use-scroll-sync/index.d.ts +10 -0
- package/dist/components/gantt/components/rows-virtualizer/use-scroll-sync/index.js +58 -0
- package/dist/components/gantt/components/rows-virtualizer/use-scroll-sync/index.js.map +1 -0
- package/dist/components/gantt/components/styles.module.css +46 -0
- package/dist/components/gantt/components/timeline/index.d.ts +19 -0
- package/dist/components/gantt/components/timeline/index.js +45 -0
- package/dist/components/gantt/components/timeline/index.js.map +1 -0
- package/dist/components/gantt/components/timeline/use-timeline-transform/index.d.ts +29 -0
- package/dist/components/gantt/components/timeline/use-timeline-transform/index.js +33 -0
- package/dist/components/gantt/components/timeline/use-timeline-transform/index.js.map +1 -0
- package/dist/components/gantt/components/timeline-chunk/index.d.ts +25 -0
- package/dist/components/gantt/components/timeline-chunk/index.js +43 -0
- package/dist/components/gantt/components/timeline-chunk/index.js.map +1 -0
- package/dist/components/gantt/constants.d.ts +31 -0
- package/dist/components/gantt/constants.js +57 -0
- package/dist/components/gantt/constants.js.map +1 -0
- package/dist/components/gantt/context/index.d.ts +60 -0
- package/dist/components/gantt/context/index.js +78 -0
- package/dist/components/gantt/context/index.js.map +1 -0
- package/dist/components/gantt/context/store/index.d.ts +45 -0
- package/dist/components/gantt/context/store/index.js +42 -0
- package/dist/components/gantt/context/store/index.js.map +1 -0
- package/dist/components/gantt/context/temporal-data/index.d.ts +48 -0
- package/dist/components/gantt/context/temporal-data/index.js +80 -0
- package/dist/components/gantt/context/temporal-data/index.js.map +1 -0
- package/dist/components/gantt/gantt.d.ts +50 -0
- package/dist/components/gantt/gantt.js +51 -0
- package/dist/components/gantt/gantt.js.map +1 -0
- package/dist/components/gantt/hooks/use-horizontal-scroll-update/index.d.ts +22 -0
- package/dist/components/gantt/hooks/use-horizontal-scroll-update/index.js +36 -0
- package/dist/components/gantt/hooks/use-horizontal-scroll-update/index.js.map +1 -0
- package/dist/components/gantt/hooks/use-layout-subscription/index.d.ts +26 -0
- package/dist/components/gantt/hooks/use-layout-subscription/index.js +45 -0
- package/dist/components/gantt/hooks/use-layout-subscription/index.js.map +1 -0
- package/dist/components/gantt/hooks/use-resize-intersection-effect/index.d.ts +26 -0
- package/dist/components/gantt/hooks/use-resize-intersection-effect/index.js +50 -0
- package/dist/components/gantt/hooks/use-resize-intersection-effect/index.js.map +1 -0
- package/dist/components/gantt/hooks/use-root-element-height/index.d.ts +5 -0
- package/dist/components/gantt/hooks/use-root-element-height/index.js +24 -0
- package/dist/components/gantt/hooks/use-root-element-height/index.js.map +1 -0
- package/dist/components/gantt/hooks/use-scrollbar-height/index.d.ts +5 -0
- package/dist/components/gantt/hooks/use-scrollbar-height/index.js +40 -0
- package/dist/components/gantt/hooks/use-scrollbar-height/index.js.map +1 -0
- package/dist/components/gantt/hooks/use-total-data-region-thresholds/index.d.ts +19 -0
- package/dist/components/gantt/hooks/use-total-data-region-thresholds/index.js +87 -0
- package/dist/components/gantt/hooks/use-total-data-region-thresholds/index.js.map +1 -0
- package/dist/components/gantt/hooks/use-vertical-scroll-update/index.d.ts +22 -0
- package/dist/components/gantt/hooks/use-vertical-scroll-update/index.js +38 -0
- package/dist/components/gantt/hooks/use-vertical-scroll-update/index.js.map +1 -0
- package/dist/components/gantt/public-types.d.ts +31 -0
- package/dist/components/gantt/public-types.js +12 -0
- package/dist/components/gantt/store.d.ts +51 -0
- package/dist/components/gantt/store.js +46 -0
- package/dist/components/gantt/store.js.map +1 -0
- package/dist/components/gantt/styles.module.css +30 -0
- package/dist/components/gantt/types.d.ts +67 -0
- package/dist/components/gantt/types.js +12 -0
- package/dist/components/gantt/utils/conversions.d.ts +23 -0
- package/dist/components/gantt/utils/conversions.js +34 -0
- package/dist/components/gantt/utils/conversions.js.map +1 -0
- package/dist/components/gantt/utils/dates.d.ts +11 -0
- package/dist/components/gantt/utils/dates.js +41 -0
- package/dist/components/gantt/utils/dates.js.map +1 -0
- package/dist/components/gantt/utils/formatting.d.ts +5 -0
- package/dist/components/gantt/utils/formatting.js +54 -0
- package/dist/components/gantt/utils/formatting.js.map +1 -0
- package/dist/components/gantt/utils/generation.d.ts +19 -0
- package/dist/components/gantt/utils/generation.js +37 -0
- package/dist/components/gantt/utils/generation.js.map +1 -0
- package/dist/components/gantt/utils/helpers.d.ts +26 -0
- package/dist/components/gantt/utils/helpers.js +55 -0
- package/dist/components/gantt/utils/helpers.js.map +1 -0
- package/dist/components/gantt/utils/layout.d.ts +32 -0
- package/dist/components/gantt/utils/layout.js +55 -0
- package/dist/components/gantt/utils/layout.js.map +1 -0
- package/dist/components/gantt/utils/thresholds.d.ts +52 -0
- package/dist/components/gantt/utils/thresholds.js +116 -0
- package/dist/components/gantt/utils/thresholds.js.map +1 -0
- package/dist/components/hero/context.d.ts +2 -2
- package/dist/components/hero/index.d.ts +2 -2
- package/dist/components/hero/subtitle.d.ts +3 -3
- package/dist/components/hero/title.d.ts +2 -2
- package/dist/components/hotkey/context.d.ts +4 -4
- package/dist/components/hotkey/index.d.ts +2 -2
- package/dist/components/hotkey/set.d.ts +2 -2
- package/dist/components/icon/context.d.ts +4 -4
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/input/context.d.ts +2 -2
- package/dist/components/input/index.d.ts +2 -2
- package/dist/components/kanban/card-body.d.ts +2 -2
- package/dist/components/kanban/card-header-actions.d.ts +2 -2
- package/dist/components/kanban/card-header-title.d.ts +2 -2
- package/dist/components/kanban/card-header.d.ts +2 -2
- package/dist/components/kanban/card.d.ts +2 -2
- package/dist/components/kanban/column-actions.d.ts +2 -2
- package/dist/components/kanban/column-container.d.ts +2 -2
- package/dist/components/kanban/column-content.d.ts +2 -2
- package/dist/components/kanban/column-header-actions.d.ts +2 -2
- package/dist/components/kanban/column-header-drag-handle.d.ts +2 -2
- package/dist/components/kanban/column-header-title.d.ts +2 -2
- package/dist/components/kanban/column-header.d.ts +2 -2
- package/dist/components/kanban/column.d.ts +2 -2
- package/dist/components/kanban/context.d.ts +2 -2
- package/dist/components/kanban/header-actions.d.ts +2 -2
- package/dist/components/kanban/header-search.d.ts +2 -2
- package/dist/components/kanban/header-title.d.ts +2 -2
- package/dist/components/kanban/header.d.ts +2 -2
- package/dist/components/kanban/kanban.d.ts +4 -4
- package/dist/components/kanban/styles.module.css +5 -0
- package/dist/components/label/context.d.ts +4 -4
- package/dist/components/label/index.d.ts +2 -2
- package/dist/components/lines/index.d.ts +2 -2
- package/dist/components/link/context.d.ts +2 -2
- package/dist/components/link/index.d.ts +2 -2
- package/dist/components/list/context.d.ts +2 -2
- package/dist/components/list/index.d.ts +2 -2
- package/dist/components/list/item-content.d.ts +2 -2
- package/dist/components/list/item-description.d.ts +2 -2
- package/dist/components/list/item-title.d.ts +2 -2
- package/dist/components/list/item.d.ts +2 -2
- package/dist/components/media-controls/context.d.ts +4 -4
- package/dist/components/media-controls/fullscreen-button.d.ts +2 -2
- package/dist/components/media-controls/index.d.ts +2 -2
- package/dist/components/media-controls/play-button.d.ts +2 -2
- package/dist/components/media-controls/playback-rate.d.ts +2 -2
- package/dist/components/media-controls/seek-button.d.ts +2 -2
- package/dist/components/media-controls/time-display.d.ts +2 -2
- package/dist/components/media-controls/time-range.d.ts +2 -2
- package/dist/components/media-controls/volume-slider.d.ts +2 -2
- package/dist/components/menu/context.d.ts +2 -2
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/item-description.d.ts +2 -2
- package/dist/components/menu/item-label.d.ts +2 -2
- package/dist/components/menu/item.d.ts +2 -2
- package/dist/components/menu/section.d.ts +2 -2
- package/dist/components/menu/separator.d.ts +2 -2
- package/dist/components/menu/styles.module.css +12 -0
- package/dist/components/menu/submenu.d.ts +3 -3
- package/dist/components/notice/index.d.ts +2 -2
- package/dist/components/notice/index.js +1 -0
- package/dist/components/notice/index.js.map +1 -1
- package/dist/components/notice/list.js +10 -1
- package/dist/components/notice/list.js.map +1 -1
- package/dist/components/notice/styles.module.css +27 -0
- package/dist/components/options/context.d.ts +2 -2
- package/dist/components/options/index.d.ts +2 -2
- package/dist/components/options/item-content.d.ts +2 -2
- package/dist/components/options/item-description.d.ts +2 -2
- package/dist/components/options/item-label.d.ts +2 -2
- package/dist/components/options/item.d.ts +2 -2
- package/dist/components/options/section.d.ts +2 -2
- package/dist/components/pagination/context.d.ts +2 -2
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/next.d.ts +2 -2
- package/dist/components/pagination/pages.d.ts +2 -2
- package/dist/components/pagination/prev.d.ts +2 -2
- package/dist/components/popover/content.d.ts +2 -2
- package/dist/components/popover/footer.d.ts +2 -2
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/styles.module.css +34 -0
- package/dist/components/popover/title.d.ts +2 -2
- package/dist/components/popover/trigger.d.ts +2 -2
- package/dist/components/query-builder/action-element.d.ts +2 -2
- package/dist/components/query-builder/actions.d.ts +4 -4
- package/dist/components/query-builder/combinator-selector.d.ts +2 -2
- package/dist/components/query-builder/index.d.ts +2 -2
- package/dist/components/query-builder/rule-group.d.ts +4 -4
- package/dist/components/query-builder/rule.d.ts +2 -2
- package/dist/components/query-builder/styles.module.css +4 -1
- package/dist/components/query-builder/value-editor.d.ts +2 -2
- package/dist/components/query-builder/value-editor.js +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.d.ts +2 -2
- package/dist/components/query-builder/value-selector.js +1 -1
- package/dist/components/radio/context.d.ts +3 -3
- package/dist/components/radio/group.d.ts +2 -2
- package/dist/components/radio/index.d.ts +2 -2
- package/dist/components/search-field/context.d.ts +4 -4
- package/dist/components/search-field/index.d.ts +2 -2
- package/dist/components/select-field/context.d.ts +4 -4
- package/dist/components/select-field/index.d.ts +2 -2
- package/dist/components/sidenav/avatar.d.ts +2 -2
- package/dist/components/sidenav/content.d.ts +2 -2
- package/dist/components/sidenav/context.d.ts +2 -2
- package/dist/components/sidenav/footer.d.ts +2 -2
- package/dist/components/sidenav/header.d.ts +2 -2
- package/dist/components/sidenav/index.d.ts +2 -2
- package/dist/components/sidenav/item.d.ts +2 -2
- package/dist/components/sidenav/link.d.ts +2 -2
- package/dist/components/sidenav/menu-item.d.ts +2 -2
- package/dist/components/sidenav/menu.d.ts +2 -2
- package/dist/components/sidenav/styles.module.css +30 -10
- package/dist/components/sidenav/trigger.d.ts +2 -2
- package/dist/components/skeleton/index.d.ts +2 -2
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/status-indicator/index.d.ts +2 -2
- package/dist/components/switch/context.d.ts +4 -4
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/styles.module.css +8 -0
- package/dist/components/table/body.d.ts +2 -2
- package/dist/components/table/cell.d.ts +2 -2
- package/dist/components/table/header-cell.d.ts +2 -2
- package/dist/components/table/header.d.ts +2 -2
- package/dist/components/table/index.d.ts +6 -2
- package/dist/components/table/index.js +19 -6
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/table/row.d.ts +2 -2
- package/dist/components/table/types.d.ts +17 -0
- package/dist/components/tabs/context.d.ts +6 -6
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tabs/list.d.ts +2 -2
- package/dist/components/tabs/panel.d.ts +2 -2
- package/dist/components/tabs/tab.d.ts +2 -2
- package/dist/components/text-area-field/context.d.ts +4 -4
- package/dist/components/text-area-field/index.d.ts +2 -2
- package/dist/components/text-field/context.d.ts +4 -4
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/time-field/index.d.ts +2 -2
- package/dist/components/tooltip/context.d.ts +2 -2
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/styles.module.css +35 -0
- package/dist/components/tooltip/trigger.d.ts +2 -2
- package/dist/components/tree/context.d.ts +3 -3
- package/dist/components/tree/index.d.ts +2 -2
- package/dist/components/tree/index.js +20 -10
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/item-actions.d.ts +2 -2
- package/dist/components/tree/item-content.d.ts +2 -2
- package/dist/components/tree/item-content.js +3 -2
- package/dist/components/tree/item-content.js.map +1 -1
- package/dist/components/tree/item-description.d.ts +2 -2
- package/dist/components/tree/item-label.d.ts +2 -2
- package/dist/components/tree/item-prefix-icon.d.ts +2 -2
- package/dist/components/tree/item.d.ts +2 -2
- package/dist/components/tree/lines.d.ts +2 -2
- package/dist/components/tree/types.d.ts +1 -0
- package/dist/components/video/index.d.ts +2 -2
- package/dist/components/view-stack/context.d.ts +2 -2
- package/dist/components/view-stack/index.d.ts +2 -2
- package/dist/components/view-stack/trigger.d.ts +2 -2
- package/dist/components/view-stack/view.d.ts +2 -2
- package/dist/hooks/use-tree/actions/cache.d.ts +20 -3
- package/dist/hooks/use-tree/actions/cache.js +110 -2
- package/dist/hooks/use-tree/actions/cache.js.map +1 -1
- package/dist/hooks/use-tree/actions/index.d.ts +2 -1
- package/dist/hooks/use-tree/actions/index.js +70 -11
- package/dist/hooks/use-tree/actions/index.js.map +1 -1
- package/dist/hooks/use-tree/state/index.d.ts +20 -1
- package/dist/hooks/use-tree/state/index.js +22 -2
- package/dist/hooks/use-tree/state/index.js.map +1 -1
- package/dist/hooks/use-tree/types.d.ts +14 -0
- package/dist/index.d.ts +24 -5
- package/dist/index.js +27 -10
- package/dist/providers/theme-provider.d.ts +2 -2
- package/package.json +68 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["actionColumn: NonNullable<typeof columnsProp>[number]"],"sources":["../../../src/components/table/index.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport 'client-only';\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport Kebab from '@accelint/icons/kebab';\nimport Pin from '@accelint/icons/pin';\nimport { useListData } from '@react-stately/data';\nimport {\n getCoreRowModel,\n getSortedRowModel,\n type Row,\n type RowPinningState,\n type RowSelectionState,\n useReactTable,\n} from '@tanstack/react-table';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { Icon } from '../icon';\nimport { Menu } from '../menu';\nimport { MenuItem } from '../menu/item';\nimport { MenuSeparator } from '../menu/separator';\nimport { MenuTrigger } from '../menu/trigger';\nimport { TableBody } from './body';\nimport { TableContext } from './context';\nimport { TableHeader } from './header';\nimport styles from './styles.module.css';\nimport type { Key } from '@react-types/shared';\nimport type { TableProps } from './types';\n\n// This width is for columns in the table that provide features:\n// - Row count\n// - Row actions kebab\n// - Row selection (checkbox)\n// These columns should not need to grow with table width\nconst META_COLUMN_WIDTH = 32;\n\ntype RowActionsMenuProps<T> = {\n row: Row<T>;\n rows: Row<T>[];\n moveRowsDown: (row: Row<T>, rows: Row<T>[]) => void;\n moveRowsUp: (row: Row<T>, rows: Row<T>[]) => void;\n};\n\nfunction RowActionsMenu<T>({\n moveRowsDown,\n moveRowsUp,\n row,\n rows,\n}: RowActionsMenuProps<T>) {\n const { enableRowActions, persistRowKebabMenu } = useContext(TableContext);\n const isPinned = !!row.getIsPinned();\n const hideRowKebab = !persistRowKebabMenu;\n\n return (\n enableRowActions && (\n <div className={clsx(hideRowKebab && styles.hideInRow)}>\n <MenuTrigger>\n <Button variant='icon' aria-label={`row ${row.index + 1} actions`}>\n <Icon>\n <Kebab />\n </Icon>\n </Button>\n <Menu>\n <MenuItem onAction={() => row.pin(isPinned ? false : 'top')}>\n {isPinned ? 'Unpin' : 'Pin'}\n </MenuItem>\n <MenuSeparator />\n <MenuItem\n onAction={() => moveRowsUp(row, rows)}\n isDisabled={isPinned || row.index === 0}\n >\n Move Up\n </MenuItem>\n <MenuItem\n onAction={() => moveRowsDown(row, rows)}\n isDisabled={isPinned || row.index === rows.length - 1}\n >\n Move Down\n </MenuItem>\n </Menu>\n </MenuTrigger>\n </div>\n )\n );\n}\n\n/**\n * Table - Configurable data table with sorting, selection, and row actions\n *\n * Supports data-driven mode with TanStack column definitions or static mode with subcomponents.\n *\n * @param props - {@link TableProps}\n * @param props.children - Custom children for static mode.\n * @param props.columns - Column definitions for data-driven mode.\n * @param props.data - Data array for data-driven mode.\n * @param props.showCheckbox - Whether to show selection checkboxes.\n * @param props.rowSelection - Initial row selection state.\n * @param props.kebabPosition - Position of row action menu.\n * @param props.persistRowKebabMenu - Keep row kebab menu visible.\n * @param props.persistHeaderKebabMenu - Keep header kebab menu visible.\n * @param props.persistNumerals - Keep row numerals visible.\n * @param props.enableSorting - Enable column sorting.\n * @param props.enableColumnReordering - Enable column reordering.\n * @param props.enableRowActions - Enable row action menu.\n * @param props.manualSorting - Use server-side sorting.\n * @param props.onSortChange - Callback when sort changes.\n * @param props.onColumnReorderChange - Callback when column order changes.\n * @param props.onRowSelectionChange - Callback when row selection changes.\n * @param props.fullWidth - Whether table uses full width.\n * @returns The rendered Table component.\n *\n * @example\n * ```tsx\n * <Table columns={columns} data={rows} enableSorting showCheckbox />\n * ```\n */\nexport function Table<T extends { id: Key }>({\n children,\n columns: columnsProp,\n data: dataProp,\n showCheckbox,\n rowSelection: rowSelectionProp,\n kebabPosition = 'right',\n persistRowKebabMenu = true,\n persistHeaderKebabMenu = true,\n persistNumerals = false,\n enableSorting = true,\n enableColumnReordering = true,\n enableRowActions = true,\n manualSorting = false,\n onSortChange,\n onColumnReorderChange,\n onRowSelectionChange,\n fullWidth = false,\n ...rest\n}: TableProps<T>) {\n const {\n items: data,\n moveAfter,\n moveBefore,\n } = useListData({\n initialItems: dataProp,\n });\n const [rowSelection, setRowSelection] = useState<RowSelectionState>(\n rowSelectionProp ?? {},\n );\n const [columnSelection, setColumnSelection] = useState<string | null>(null);\n const [rowPinning, setRowPinning] = useState<RowPinningState>({\n top: [],\n bottom: [],\n });\n\n /**\n * moveUpSelectedRows moves the selected rows up in the table.\n * It finds the first selected row, determines its index,\n * and moves it before the previous row if it exists.\n */\n const moveRowsUp = useCallback(\n (row: Row<T>, rows: Row<T>[]) => {\n const isSelected = rowSelection[row.id];\n const rowsToMove = isSelected\n ? rows.filter(({ id }) => rowSelection[id])\n : [row];\n const firstRowToMove = rowsToMove[0];\n\n if (!firstRowToMove || firstRowToMove.index === 0) {\n return;\n }\n\n const prevRowId = rows[firstRowToMove.index - 1]?.id;\n\n if (!prevRowId) {\n return;\n }\n\n moveBefore(\n prevRowId,\n rowsToMove.map(({ id }) => id),\n );\n },\n [rowSelection, moveBefore],\n );\n\n /**\n * moveDownRows moves the selected or active rows down in the table.\n * It finds the last selected row, determines its index,\n * and moves it after the next row if it exists.\n */\n const moveRowsDown = useCallback(\n (row: Row<T>, rows: Row<T>[]) => {\n const isSelected = rowSelection[row.id];\n const rowsToMove = isSelected\n ? rows.filter(({ id }) => rowSelection[id])\n : [row];\n const lastRowToMove = rowsToMove[rowsToMove.length - 1];\n\n if (!lastRowToMove || lastRowToMove.index === rows.length - 1) {\n return;\n }\n\n const nextRowId = rows[lastRowToMove.index + 1]?.id;\n\n if (!nextRowId) {\n return;\n }\n\n moveAfter(\n nextRowId,\n rowsToMove.map(({ id }) => id),\n );\n },\n [rowSelection, moveAfter],\n );\n\n /**\n * actionColumn defines the actions available in the kebab menu for each row.\n * It includes options to move the row up or down in the table.\n */\n // biome-ignore lint/correctness/useExhaustiveDependencies: can of worms to fix ticket added\n const actionColumn: NonNullable<typeof columnsProp>[number] = useMemo(\n () => ({\n id: 'kebab',\n cell: ({ row }) => (\n <RowActionsMenu\n moveRowsUp={moveRowsUp}\n moveRowsDown={moveRowsDown}\n row={row}\n rows={getRowModel().rows}\n />\n ),\n size: META_COLUMN_WIDTH,\n }),\n [moveRowsUp, moveRowsDown],\n );\n\n /**\n * columns defines the structure of the table.\n * It includes the action column and optionally a checkbox column.\n * The kebab menu position can be set to 'left' or 'right'.\n * If showCheckbox is true, a checkbox column is added.\n */\n const columns = useMemo<NonNullable<typeof columnsProp>>(\n () => [\n {\n id: 'numeral',\n cell: ({ row }) =>\n row.getIsPinned() ? (\n <Icon size='small'>\n <Pin />\n </Icon>\n ) : (\n <span data-testid='numeral'>{row.index + 1}</span>\n ),\n size: META_COLUMN_WIDTH,\n },\n ...(showCheckbox\n ? ([\n {\n id: 'selection',\n header: ({ table }) => (\n <Checkbox\n isSelected={table.getIsAllRowsSelected()}\n isIndeterminate={table.getIsSomeRowsSelected()}\n onChange={table.toggleAllRowsSelected}\n />\n ),\n cell: ({ row }) => (\n <Checkbox\n isSelected={row.getIsSelected()}\n isIndeterminate={row.getIsSomeSelected()}\n onChange={row.toggleSelected}\n />\n ),\n size: META_COLUMN_WIDTH,\n },\n ] satisfies NonNullable<typeof columnsProp>)\n : []),\n ...(kebabPosition === 'left' ? [actionColumn] : []),\n ...(columnsProp ?? []),\n ...(kebabPosition === 'right' ? [actionColumn] : []),\n ],\n [showCheckbox, columnsProp, kebabPosition, actionColumn],\n );\n\n const handleSortChange = (\n columnId: string,\n sortDirection: 'asc' | 'desc' | null,\n ) => {\n onSortChange?.(columnId, sortDirection);\n };\n\n const handleColumnReordering = (index: number) => {\n onColumnReorderChange?.(index);\n };\n\n const handleRowSelectionChange = useCallback(\n (\n updaterOrValue:\n | RowSelectionState\n | ((old: RowSelectionState) => RowSelectionState),\n ) => {\n setRowSelection(updaterOrValue);\n onRowSelectionChange?.(updaterOrValue);\n },\n [onRowSelectionChange],\n );\n\n const {\n getHeaderGroups,\n getTopRows,\n getCenterRows,\n getBottomRows,\n getRowModel,\n setColumnOrder,\n } = useReactTable<T>({\n data,\n columns,\n enableSorting,\n initialState: {\n columnOrder: columns.map(({ id }) => id ?? ''),\n rowSelection: rowSelectionProp ?? {},\n },\n state: {\n rowSelection,\n rowPinning,\n },\n getRowId: (row, index) => {\n // Use the index as the row ID if no unique identifier is available\n return row.id ? row.id.toString() : index.toString();\n },\n enableRowSelection: true,\n enableRowPinning: true,\n manualSorting: manualSorting,\n onRowSelectionChange: handleRowSelectionChange,\n onRowPinningChange: setRowPinning,\n getCoreRowModel: getCoreRowModel<T>(),\n getSortedRowModel: getSortedRowModel<T>(),\n });\n\n const moveColumnLeft = useCallback(\n (oldIndex: number) => {\n setColumnOrder((order) => {\n const newColumnOrder = [...order];\n const newIndex = oldIndex - 1;\n\n if (newIndex < 0) {\n return order;\n }\n\n [newColumnOrder[oldIndex], newColumnOrder[newIndex]] = [\n newColumnOrder[newIndex] as string,\n newColumnOrder[oldIndex] as string,\n ];\n\n return newColumnOrder;\n });\n },\n [setColumnOrder],\n );\n\n const moveColumnRight = useCallback(\n (oldIndex: number) => {\n setColumnOrder((order) => {\n const newColumnOrder = [...order];\n const newIndex = oldIndex + 1;\n\n if (newIndex >= order.length) {\n return order;\n }\n\n [newColumnOrder[oldIndex], newColumnOrder[newIndex]] = [\n newColumnOrder[newIndex] as string,\n newColumnOrder[oldIndex] as string,\n ];\n\n return newColumnOrder;\n });\n },\n [setColumnOrder],\n );\n\n const className = clsx(fullWidth && 'w-full table-fixed', rest.className);\n\n if (children) {\n return (\n <table {...rest} className={className}>\n {children}\n </table>\n );\n }\n\n return (\n <TableContext.Provider\n value={{\n persistRowKebabMenu,\n persistHeaderKebabMenu,\n persistNumerals,\n enableSorting,\n enableColumnReordering,\n enableRowActions,\n columnSelection,\n setColumnSelection,\n moveColumnLeft,\n moveColumnRight,\n manualSorting,\n handleSortChange,\n handleColumnReordering,\n }}\n >\n <table {...rest} className={className}>\n <TableHeader\n headerGroups={getHeaderGroups()}\n columnSelection={columnSelection}\n />\n <TableBody\n rows={[...getTopRows(), ...getCenterRows(), ...getBottomRows()]}\n />\n </table>\n </TableContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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AAG,MAAM;GACjC,MAAM,WAAW,WAAW;AAE5B,OAAI,YAAY,MAAM,OACpB,QAAO;AAGT,IAAC,eAAe,WAAW,eAAe,aAAa,CACrD,eAAe,WACf,eAAe,UAChB;AAED,UAAO;IACP;IAEJ,CAAC,eAAe,CACjB;CAED,MAAM,YAAY,KAAK,aAAa,sBAAsB,KAAK,UAAU;AAEzE,KAAI,SACF,QACE,oBAAC;EAAM,GAAI;EAAiB;EACzB;GACK;AAIZ,QACE,oBAAC,aAAa;EACZ,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;YAED,qBAAC;GAAM,GAAI;GAAiB;cAC1B,oBAAC;IACC,cAAc,iBAAiB;IACd;KACjB,EACF,oBAAC,aACC,MAAM;IAAC,GAAG,YAAY;IAAE,GAAG,eAAe;IAAE,GAAG,eAAe;IAAC,GAC/D;IACI;GACc"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["actionColumn: NonNullable<typeof columnsProp>[number]","Pin"],"sources":["../../../src/components/table/index.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport 'client-only';\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport Kebab from '@accelint/icons/kebab';\nimport Pin from '@accelint/icons/pin';\nimport { useListData } from '@react-stately/data';\nimport { useControlledState } from '@react-stately/utils';\nimport {\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type OnChangeFn,\n type PaginationState,\n type Row,\n type RowPinningState,\n type RowSelectionState,\n useReactTable,\n} from '@tanstack/react-table';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { Icon } from '../icon';\nimport { Menu } from '../menu';\nimport { MenuItem } from '../menu/item';\nimport { MenuSeparator } from '../menu/separator';\nimport { MenuTrigger } from '../menu/trigger';\nimport { TableBody } from './body';\nimport { TableContext } from './context';\nimport { TableHeader } from './header';\nimport styles from './styles.module.css';\nimport type { Key } from '@react-types/shared';\nimport type { TableProps } from './types';\n\n// This width is for columns in the table that provide features:\n// - Row count\n// - Row actions kebab\n// - Row selection (checkbox)\n// These columns should not need to grow with table width\nconst META_COLUMN_WIDTH = 32;\n\ntype RowActionsMenuProps<T> = {\n row: Row<T>;\n rows: Row<T>[];\n moveRowsDown: (row: Row<T>, rows: Row<T>[]) => void;\n moveRowsUp: (row: Row<T>, rows: Row<T>[]) => void;\n};\n\nfunction RowActionsMenu<T>({\n moveRowsDown,\n moveRowsUp,\n row,\n rows,\n}: RowActionsMenuProps<T>) {\n const { enableRowActions, persistRowKebabMenu } = useContext(TableContext);\n const isPinned = !!row.getIsPinned();\n const hideRowKebab = !persistRowKebabMenu;\n\n return (\n enableRowActions && (\n <div className={clsx(hideRowKebab && styles.hideInRow)}>\n <MenuTrigger>\n <Button variant='icon' aria-label={`row ${row.index + 1} actions`}>\n <Icon>\n <Kebab />\n </Icon>\n </Button>\n <Menu>\n <MenuItem onAction={() => row.pin(isPinned ? false : 'top')}>\n {isPinned ? 'Unpin' : 'Pin'}\n </MenuItem>\n <MenuSeparator />\n <MenuItem\n onAction={() => moveRowsUp(row, rows)}\n isDisabled={isPinned || row.index === 0}\n >\n Move Up\n </MenuItem>\n <MenuItem\n onAction={() => moveRowsDown(row, rows)}\n isDisabled={isPinned || row.index === rows.length - 1}\n >\n Move Down\n </MenuItem>\n </Menu>\n </MenuTrigger>\n </div>\n )\n );\n}\n\n/**\n * Table - Configurable data table with sorting, selection, and row actions\n *\n * Supports data-driven mode with TanStack column definitions or static mode with subcomponents.\n *\n * @param props - {@link TableProps}\n * @param props.children - Custom children for static mode.\n * @param props.columns - Column definitions for data-driven mode.\n * @param props.data - Data array for data-driven mode.\n * @param props.showCheckbox - Whether to show selection checkboxes.\n * @param props.rowSelection - Initial row selection state.\n * @param props.kebabPosition - Position of row action menu.\n * @param props.persistRowKebabMenu - Keep row kebab menu visible.\n * @param props.persistHeaderKebabMenu - Keep header kebab menu visible.\n * @param props.persistNumerals - Keep row numerals visible.\n * @param props.enableSorting - Enable column sorting.\n * @param props.enableColumnReordering - Enable column reordering.\n * @param props.enableRowActions - Enable row action menu.\n * @param props.manualSorting - Use server-side sorting.\n * @param props.onSortChange - Callback when sort changes.\n * @param props.onColumnReorderChange - Callback when column order changes.\n * @param props.onRowSelectionChange - Callback when row selection changes.\n * @param props.fullWidth - Whether table uses full width.\n * @returns The rendered Table component.\n *\n * @example\n * ```tsx\n * <Table columns={columns} data={rows} enableSorting showCheckbox />\n * ```\n */\nexport function Table<T extends { id: Key }>({\n children,\n columns: columnsProp,\n data: dataProp,\n showCheckbox,\n rowSelection: rowSelectionProp,\n kebabPosition = 'right',\n persistRowKebabMenu = true,\n persistHeaderKebabMenu = true,\n persistNumerals = false,\n enableSorting = true,\n enableColumnReordering = true,\n enableRowActions = true,\n manualSorting = false,\n onSortChange,\n onColumnReorderChange,\n onRowSelectionChange,\n fullWidth = false,\n pageSize,\n page: pageProp,\n defaultPage = 1,\n onPageChange,\n ...rest\n}: TableProps<T>) {\n const {\n items: data,\n moveAfter,\n moveBefore,\n } = useListData({\n initialItems: dataProp,\n });\n const [rowSelection, setRowSelection] = useState<RowSelectionState>(\n rowSelectionProp ?? {},\n );\n const [columnSelection, setColumnSelection] = useState<string | null>(null);\n const [rowPinning, setRowPinning] = useState<RowPinningState>({\n top: [],\n bottom: [],\n });\n\n const [currentPage, setCurrentPage] = useControlledState(\n pageProp,\n defaultPage,\n onPageChange,\n );\n\n const pagination = useMemo(\n () =>\n pageSize != null ? { pageIndex: currentPage - 1, pageSize } : undefined,\n [currentPage, pageSize],\n );\n\n const handlePaginationChange = useCallback<OnChangeFn<PaginationState>>(\n (updater) => {\n if (pagination == null) {\n return;\n }\n const next =\n typeof updater === 'function' ? updater(pagination) : updater;\n setCurrentPage(next.pageIndex + 1);\n },\n [pagination, setCurrentPage],\n );\n\n /**\n * moveUpSelectedRows moves the selected rows up in the table.\n * It finds the first selected row, determines its index,\n * and moves it before the previous row if it exists.\n */\n const moveRowsUp = useCallback(\n (row: Row<T>, rows: Row<T>[]) => {\n const isSelected = rowSelection[row.id];\n const rowsToMove = isSelected\n ? rows.filter(({ id }) => rowSelection[id])\n : [row];\n const firstRowToMove = rowsToMove[0];\n\n if (!firstRowToMove || firstRowToMove.index === 0) {\n return;\n }\n\n const prevRowId = rows[firstRowToMove.index - 1]?.id;\n\n if (!prevRowId) {\n return;\n }\n\n moveBefore(\n prevRowId,\n rowsToMove.map(({ id }) => id),\n );\n },\n [rowSelection, moveBefore],\n );\n\n /**\n * moveDownRows moves the selected or active rows down in the table.\n * It finds the last selected row, determines its index,\n * and moves it after the next row if it exists.\n */\n const moveRowsDown = useCallback(\n (row: Row<T>, rows: Row<T>[]) => {\n const isSelected = rowSelection[row.id];\n const rowsToMove = isSelected\n ? rows.filter(({ id }) => rowSelection[id])\n : [row];\n const lastRowToMove = rowsToMove[rowsToMove.length - 1];\n\n if (!lastRowToMove || lastRowToMove.index === rows.length - 1) {\n return;\n }\n\n const nextRowId = rows[lastRowToMove.index + 1]?.id;\n\n if (!nextRowId) {\n return;\n }\n\n moveAfter(\n nextRowId,\n rowsToMove.map(({ id }) => id),\n );\n },\n [rowSelection, moveAfter],\n );\n\n /**\n * actionColumn defines the actions available in the kebab menu for each row.\n * It includes options to move the row up or down in the table.\n */\n // biome-ignore lint/correctness/useExhaustiveDependencies: can of worms to fix ticket added\n const actionColumn: NonNullable<typeof columnsProp>[number] = useMemo(\n () => ({\n id: 'kebab',\n cell: ({ row }) => (\n <RowActionsMenu\n moveRowsUp={moveRowsUp}\n moveRowsDown={moveRowsDown}\n row={row}\n rows={getRowModel().rows}\n />\n ),\n size: META_COLUMN_WIDTH,\n }),\n [moveRowsUp, moveRowsDown],\n );\n\n /**\n * columns defines the structure of the table.\n * It includes the action column and optionally a checkbox column.\n * The kebab menu position can be set to 'left' or 'right'.\n * If showCheckbox is true, a checkbox column is added.\n */\n const columns = useMemo<NonNullable<typeof columnsProp>>(\n () => [\n {\n id: 'numeral',\n cell: ({ row }) =>\n row.getIsPinned() ? (\n <Icon size='small'>\n <Pin />\n </Icon>\n ) : (\n <span data-testid='numeral'>{row.index + 1}</span>\n ),\n size: META_COLUMN_WIDTH,\n },\n ...(showCheckbox\n ? ([\n {\n id: 'selection',\n header: ({ table }) => (\n <Checkbox\n isSelected={table.getIsAllRowsSelected()}\n isIndeterminate={table.getIsSomeRowsSelected()}\n onChange={table.toggleAllRowsSelected}\n />\n ),\n cell: ({ row }) => (\n <Checkbox\n isSelected={row.getIsSelected()}\n isIndeterminate={row.getIsSomeSelected()}\n onChange={row.toggleSelected}\n />\n ),\n size: META_COLUMN_WIDTH,\n },\n ] satisfies NonNullable<typeof columnsProp>)\n : []),\n ...(kebabPosition === 'left' ? [actionColumn] : []),\n ...(columnsProp ?? []),\n ...(kebabPosition === 'right' ? [actionColumn] : []),\n ],\n [showCheckbox, columnsProp, kebabPosition, actionColumn],\n );\n\n const handleSortChange = (\n columnId: string,\n sortDirection: 'asc' | 'desc' | null,\n ) => {\n onSortChange?.(columnId, sortDirection);\n };\n\n const handleColumnReordering = (index: number) => {\n onColumnReorderChange?.(index);\n };\n\n const handleRowSelectionChange = useCallback(\n (\n updaterOrValue:\n | RowSelectionState\n | ((old: RowSelectionState) => RowSelectionState),\n ) => {\n setRowSelection(updaterOrValue);\n onRowSelectionChange?.(updaterOrValue);\n },\n [onRowSelectionChange],\n );\n\n const {\n getHeaderGroups,\n getTopRows,\n getCenterRows,\n getBottomRows,\n getRowModel,\n setColumnOrder,\n } = useReactTable<T>({\n data,\n columns,\n enableSorting,\n initialState: {\n columnOrder: columns.map(({ id }) => id ?? ''),\n rowSelection: rowSelectionProp ?? {},\n },\n state: {\n rowSelection,\n rowPinning,\n ...(pagination != null && { pagination }),\n },\n getRowId: (row, index) => {\n // Use the index as the row ID if no unique identifier is available\n return row.id ? row.id.toString() : index.toString();\n },\n enableRowSelection: true,\n enableRowPinning: true,\n manualSorting: manualSorting,\n onRowSelectionChange: handleRowSelectionChange,\n onRowPinningChange: setRowPinning,\n onPaginationChange: handlePaginationChange,\n getCoreRowModel: getCoreRowModel<T>(),\n getSortedRowModel: getSortedRowModel<T>(),\n ...(pageSize != null && {\n getPaginationRowModel: getPaginationRowModel<T>(),\n }),\n });\n\n const moveColumnLeft = useCallback(\n (oldIndex: number) => {\n setColumnOrder((order) => {\n const newColumnOrder = [...order];\n const newIndex = oldIndex - 1;\n\n if (newIndex < 0) {\n return order;\n }\n\n [newColumnOrder[oldIndex], newColumnOrder[newIndex]] = [\n newColumnOrder[newIndex] as string,\n newColumnOrder[oldIndex] as string,\n ];\n\n return newColumnOrder;\n });\n },\n [setColumnOrder],\n );\n\n const moveColumnRight = useCallback(\n (oldIndex: number) => {\n setColumnOrder((order) => {\n const newColumnOrder = [...order];\n const newIndex = oldIndex + 1;\n\n if (newIndex >= order.length) {\n return order;\n }\n\n [newColumnOrder[oldIndex], newColumnOrder[newIndex]] = [\n newColumnOrder[newIndex] as string,\n newColumnOrder[oldIndex] as string,\n ];\n\n return newColumnOrder;\n });\n },\n [setColumnOrder],\n );\n\n const className = clsx(fullWidth && 'w-full table-fixed', rest.className);\n\n if (children) {\n return (\n <table {...rest} className={className}>\n {children}\n </table>\n );\n }\n\n return (\n <TableContext.Provider\n value={{\n persistRowKebabMenu,\n persistHeaderKebabMenu,\n persistNumerals,\n enableSorting,\n enableColumnReordering,\n enableRowActions,\n columnSelection,\n setColumnSelection,\n moveColumnLeft,\n moveColumnRight,\n manualSorting,\n handleSortChange,\n handleColumnReordering,\n }}\n >\n <table {...rest} className={className}>\n <TableHeader\n headerGroups={getHeaderGroups()}\n columnSelection={columnSelection}\n />\n <TableBody\n rows={[...getTopRows(), ...getCenterRows(), ...getBottomRows()]}\n />\n </table>\n </TableContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,oBAAoB;AAS1B,SAAS,eAAkB,EACzB,cACA,YACA,KACA,QACyB;CACzB,MAAM,EAAE,kBAAkB,wBAAwB,WAAW,aAAa;CAC1E,MAAM,WAAW,CAAC,CAAC,IAAI,aAAa;AAGpC,QACE,oBACE,oBAAC;EAAI,WAAW,KAJC,CAAC,uBAImB,OAAO,UAAU;YACpD,qBAAC,0BACC,oBAAC;GAAO,SAAQ;GAAO,cAAY,OAAO,IAAI,QAAQ,EAAE;aACtD,oBAAC,kBACC,oBAAC,UAAQ,GACJ;IACA,EACT,qBAAC;GACC,oBAAC;IAAS,gBAAgB,IAAI,IAAI,WAAW,QAAQ,MAAM;cACxD,WAAW,UAAU;KACb;GACX,oBAAC,kBAAgB;GACjB,oBAAC;IACC,gBAAgB,WAAW,KAAK,KAAK;IACrC,YAAY,YAAY,IAAI,UAAU;cACvC;KAEU;GACX,oBAAC;IACC,gBAAgB,aAAa,KAAK,KAAK;IACvC,YAAY,YAAY,IAAI,UAAU,KAAK,SAAS;cACrD;KAEU;MACN,IACK;GACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCZ,SAAgB,MAA6B,EAC3C,UACA,SAAS,aACT,MAAM,UACN,cACA,cAAc,kBACd,gBAAgB,SAChB,sBAAsB,MACtB,yBAAyB,MACzB,kBAAkB,OAClB,gBAAgB,MAChB,yBAAyB,MACzB,mBAAmB,MACnB,gBAAgB,OAChB,cACA,uBACA,sBACA,YAAY,OACZ,UACA,MAAM,UACN,cAAc,GACd,cACA,GAAG,QACa;CAChB,MAAM,EACJ,OAAO,MACP,WACA,eACE,YAAY,EACd,c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7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TableRowProps } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react_jsx_runtime213 from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
//#region src/components/table/row.d.ts
|
|
17
17
|
|
|
@@ -44,7 +44,7 @@ declare function TableRow<T>({
|
|
|
44
44
|
className,
|
|
45
45
|
row,
|
|
46
46
|
...rest
|
|
47
|
-
}: TableRowProps<T>):
|
|
47
|
+
}: TableRowProps<T>): react_jsx_runtime213.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { TableRow };
|
|
50
50
|
//# sourceMappingURL=row.d.ts.map
|
|
@@ -123,6 +123,23 @@ type ExtendedTableProps<T extends {
|
|
|
123
123
|
* @default false
|
|
124
124
|
*/
|
|
125
125
|
fullWidth?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Number of rows per page. Enables built-in pagination when set.
|
|
128
|
+
*/
|
|
129
|
+
pageSize?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Controlled current page (1-indexed).
|
|
132
|
+
*/
|
|
133
|
+
page?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Uncontrolled default page (1-indexed).
|
|
136
|
+
* @default 1
|
|
137
|
+
*/
|
|
138
|
+
defaultPage?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Callback when the page changes.
|
|
141
|
+
*/
|
|
142
|
+
onPageChange?: (page: number) => void;
|
|
126
143
|
};
|
|
127
144
|
/**
|
|
128
145
|
* Props for the Table component.
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
import { ProviderProps } from "../../lib/types.js";
|
|
14
14
|
import { TabProps as TabProps$1, TabsProps as TabsProps$1 } from "./types.js";
|
|
15
15
|
import "client-only";
|
|
16
|
-
import * as
|
|
16
|
+
import * as react52 from "react";
|
|
17
17
|
import { ContextValue } from "react-aria-components";
|
|
18
|
-
import * as
|
|
18
|
+
import * as react_jsx_runtime226 from "react/jsx-runtime";
|
|
19
19
|
|
|
20
20
|
//#region src/components/tabs/context.d.ts
|
|
21
21
|
/** Context for sharing props across Tabs components */
|
|
22
|
-
declare const TabsContext:
|
|
22
|
+
declare const TabsContext: react52.Context<ContextValue<TabsProps$1, HTMLDivElement>>;
|
|
23
23
|
/**
|
|
24
24
|
* Sets default props for all Tabs components within.
|
|
25
25
|
*
|
|
@@ -42,12 +42,12 @@ declare const TabsContext: react41.Context<ContextValue<TabsProps$1, HTMLDivElem
|
|
|
42
42
|
declare function TabsProvider({
|
|
43
43
|
children,
|
|
44
44
|
...props
|
|
45
|
-
}: ProviderProps<TabsProps$1>):
|
|
46
|
-
declare const TabContext:
|
|
45
|
+
}: ProviderProps<TabsProps$1>): react_jsx_runtime226.JSX.Element;
|
|
46
|
+
declare const TabContext: react52.Context<ContextValue<TabProps$1, Element>>;
|
|
47
47
|
declare function TabProvider({
|
|
48
48
|
children,
|
|
49
49
|
...props
|
|
50
|
-
}: ProviderProps<TabProps$1>):
|
|
50
|
+
}: ProviderProps<TabProps$1>): react_jsx_runtime226.JSX.Element;
|
|
51
51
|
//#endregion
|
|
52
52
|
export { TabContext, TabProvider, TabsContext, TabsProvider };
|
|
53
53
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TabsProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime228 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tabs/index.d.ts
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ import * as react_jsx_runtime173 from "react/jsx-runtime";
|
|
|
44
44
|
declare function Tabs({
|
|
45
45
|
ref,
|
|
46
46
|
...props
|
|
47
|
-
}: TabsProps):
|
|
47
|
+
}: TabsProps): react_jsx_runtime228.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { Tabs };
|
|
50
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import "client-only";
|
|
14
14
|
import { TabListProps } from "react-aria-components";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime225 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tabs/list.d.ts
|
|
18
18
|
|
|
@@ -40,7 +40,7 @@ declare function TabList<T extends object>({
|
|
|
40
40
|
children,
|
|
41
41
|
className,
|
|
42
42
|
...rest
|
|
43
|
-
}: TabListProps<T>):
|
|
43
|
+
}: TabListProps<T>): react_jsx_runtime225.JSX.Element;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { TabList };
|
|
46
46
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import "client-only";
|
|
14
14
|
import { TabPanelProps } from "react-aria-components";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime88 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tabs/panel.d.ts
|
|
18
18
|
|
|
@@ -41,7 +41,7 @@ declare function TabPanel({
|
|
|
41
41
|
children,
|
|
42
42
|
className,
|
|
43
43
|
...rest
|
|
44
|
-
}: TabPanelProps):
|
|
44
|
+
}: TabPanelProps): react_jsx_runtime88.JSX.Element;
|
|
45
45
|
//#endregion
|
|
46
46
|
export { TabPanel };
|
|
47
47
|
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TabProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime229 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tabs/tab.d.ts
|
|
18
18
|
|
|
@@ -38,7 +38,7 @@ import * as react_jsx_runtime176 from "react/jsx-runtime";
|
|
|
38
38
|
declare function Tab({
|
|
39
39
|
ref,
|
|
40
40
|
...props
|
|
41
|
-
}: TabProps):
|
|
41
|
+
}: TabProps): react_jsx_runtime229.JSX.Element;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { Tab };
|
|
44
44
|
//# sourceMappingURL=tab.d.ts.map
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
import { ProviderProps } from "../../lib/types.js";
|
|
14
14
|
import { TextAreaFieldProps } from "./types.js";
|
|
15
15
|
import "client-only";
|
|
16
|
-
import * as
|
|
16
|
+
import * as react54 from "react";
|
|
17
17
|
import { ContextValue } from "react-aria-components";
|
|
18
|
-
import * as
|
|
18
|
+
import * as react_jsx_runtime230 from "react/jsx-runtime";
|
|
19
19
|
|
|
20
20
|
//#region src/components/text-area-field/context.d.ts
|
|
21
21
|
/** Context for sharing props across TextAreaField components */
|
|
22
|
-
declare const TextAreaFieldContext:
|
|
22
|
+
declare const TextAreaFieldContext: react54.Context<ContextValue<TextAreaFieldProps, HTMLDivElement>>;
|
|
23
23
|
/**
|
|
24
24
|
* Sets default props for all TextAreaField components within.
|
|
25
25
|
*
|
|
@@ -42,7 +42,7 @@ declare const TextAreaFieldContext: react47.Context<ContextValue<TextAreaFieldPr
|
|
|
42
42
|
declare function TextAreaFieldProvider({
|
|
43
43
|
children,
|
|
44
44
|
...props
|
|
45
|
-
}: ProviderProps<TextAreaFieldProps>):
|
|
45
|
+
}: ProviderProps<TextAreaFieldProps>): react_jsx_runtime230.JSX.Element;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { TextAreaFieldContext, TextAreaFieldProvider };
|
|
48
48
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TextAreaFieldProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime231 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/text-area-field/index.d.ts
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ import * as react_jsx_runtime204 from "react/jsx-runtime";
|
|
|
44
44
|
declare function TextAreaField({
|
|
45
45
|
ref,
|
|
46
46
|
...props
|
|
47
|
-
}: TextAreaFieldProps):
|
|
47
|
+
}: TextAreaFieldProps): react_jsx_runtime231.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { TextAreaField };
|
|
50
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
import { ProviderProps } from "../../lib/types.js";
|
|
14
14
|
import { TextFieldProps as TextFieldProps$1 } from "./types.js";
|
|
15
15
|
import "client-only";
|
|
16
|
-
import * as
|
|
16
|
+
import * as react56 from "react";
|
|
17
17
|
import { ContextValue } from "react-aria-components";
|
|
18
|
-
import * as
|
|
18
|
+
import * as react_jsx_runtime237 from "react/jsx-runtime";
|
|
19
19
|
|
|
20
20
|
//#region src/components/text-field/context.d.ts
|
|
21
21
|
/** Context for sharing props across TextField components */
|
|
22
|
-
declare const TextFieldContext:
|
|
22
|
+
declare const TextFieldContext: react56.Context<ContextValue<TextFieldProps$1, HTMLDivElement>>;
|
|
23
23
|
/**
|
|
24
24
|
* Sets default props for all TextField components within.
|
|
25
25
|
*
|
|
@@ -42,7 +42,7 @@ declare const TextFieldContext: react18.Context<ContextValue<TextFieldProps$1, H
|
|
|
42
42
|
declare function TextFieldProvider({
|
|
43
43
|
children,
|
|
44
44
|
...props
|
|
45
|
-
}: ProviderProps<TextFieldProps$1>):
|
|
45
|
+
}: ProviderProps<TextFieldProps$1>): react_jsx_runtime237.JSX.Element;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { TextFieldContext, TextFieldProvider };
|
|
48
48
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TextFieldProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime233 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/text-field/index.d.ts
|
|
18
18
|
|
|
@@ -40,7 +40,7 @@ import * as react_jsx_runtime193 from "react/jsx-runtime";
|
|
|
40
40
|
declare function TextField({
|
|
41
41
|
ref,
|
|
42
42
|
...props
|
|
43
|
-
}: TextFieldProps):
|
|
43
|
+
}: TextFieldProps): react_jsx_runtime233.JSX.Element;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { TextField };
|
|
46
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { TimeFieldProps as TimeFieldProps$1 } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
15
|
import { TimeValue } from "react-aria-components";
|
|
16
|
-
import * as
|
|
16
|
+
import * as react_jsx_runtime236 from "react/jsx-runtime";
|
|
17
17
|
|
|
18
18
|
//#region src/components/time-field/index.d.ts
|
|
19
19
|
|
|
@@ -58,7 +58,7 @@ declare function TimeField<T extends TimeValue>({
|
|
|
58
58
|
isRequired,
|
|
59
59
|
isReadOnly,
|
|
60
60
|
...rest
|
|
61
|
-
}: TimeFieldProps$1<T>):
|
|
61
|
+
}: TimeFieldProps$1<T>): react_jsx_runtime236.JSX.Element;
|
|
62
62
|
//#endregion
|
|
63
63
|
export { TimeField };
|
|
64
64
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
import { TooltipTriggerProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react55 from "react";
|
|
16
16
|
import { ContextValue } from "react-aria-components";
|
|
17
17
|
|
|
18
18
|
//#region src/components/tooltip/context.d.ts
|
|
19
19
|
/** Context for sharing props across TooltipTrigger components */
|
|
20
|
-
declare const TooltipContext:
|
|
20
|
+
declare const TooltipContext: react55.Context<ContextValue<TooltipTriggerProps, HTMLDivElement>>;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { TooltipContext };
|
|
23
23
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TooltipProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime238 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tooltip/index.d.ts
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ declare function Tooltip({
|
|
|
44
44
|
offset,
|
|
45
45
|
placement,
|
|
46
46
|
...props
|
|
47
|
-
}: TooltipProps):
|
|
47
|
+
}: TooltipProps): react_jsx_runtime238.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { Tooltip };
|
|
50
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -14,7 +14,42 @@
|
|
|
14
14
|
|
|
15
15
|
@layer components.l1 {
|
|
16
16
|
.tooltip {
|
|
17
|
+
--offset: var(--spacing-xxs);
|
|
18
|
+
--offset-neg: calc(var(--spacing-xxs) * -1);
|
|
19
|
+
|
|
17
20
|
@apply fg-primary-bold rounded-small bg-surface-overlay px-s py-xs text-body-xs shadow-elevation-overlay flex items-center justify-center text-center wrap-break-word select-none;
|
|
18
21
|
max-width: 160px;
|
|
22
|
+
|
|
23
|
+
@variant motion-safe {
|
|
24
|
+
transition:
|
|
25
|
+
transform var(--animation-duration-normal),
|
|
26
|
+
opacity var(--animation-duration-normal);
|
|
27
|
+
|
|
28
|
+
@variant placement-top {
|
|
29
|
+
--origin: translateY(var(--offset));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@variant placement-bottom {
|
|
33
|
+
--origin: translateY(var(--offset-neg));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@variant placement-left {
|
|
37
|
+
--origin: translateX(var(--offset));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@variant placement-right {
|
|
41
|
+
--origin: translateX(var(--offset-neg));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@variant entering {
|
|
45
|
+
transform: var(--origin);
|
|
46
|
+
opacity: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@variant exiting {
|
|
50
|
+
transform: var(--origin);
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
19
54
|
}
|
|
20
55
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TooltipTriggerProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime235 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tooltip/trigger.d.ts
|
|
18
18
|
|
|
@@ -38,7 +38,7 @@ import * as react_jsx_runtime202 from "react/jsx-runtime";
|
|
|
38
38
|
declare function TooltipTrigger({
|
|
39
39
|
ref,
|
|
40
40
|
...props
|
|
41
|
-
}: TooltipTriggerProps):
|
|
41
|
+
}: TooltipTriggerProps): react_jsx_runtime235.JSX.Element;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { TooltipTrigger };
|
|
44
44
|
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
|
|
13
13
|
import { TreeContextValue, TreeItemContextValue } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react45 from "react";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tree/context.d.ts
|
|
18
18
|
/** Context for sharing state across Tree components */
|
|
19
|
-
declare const TreeContext:
|
|
19
|
+
declare const TreeContext: react45.Context<TreeContextValue>;
|
|
20
20
|
/** Context for sharing state within a TreeItem */
|
|
21
|
-
declare const TreeItemContext:
|
|
21
|
+
declare const TreeItemContext: react45.Context<TreeItemContextValue>;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { TreeContext, TreeItemContext };
|
|
24
24
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TreeProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime192 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/tree/index.d.ts
|
|
18
18
|
|
|
@@ -75,7 +75,7 @@ declare function Tree<T>({
|
|
|
75
75
|
onVisibilityChange,
|
|
76
76
|
onSelectionChange,
|
|
77
77
|
...rest
|
|
78
|
-
}: TreeProps<T>):
|
|
78
|
+
}: TreeProps<T>): react_jsx_runtime192.JSX.Element;
|
|
79
79
|
//#endregion
|
|
80
80
|
export { Tree };
|
|
81
81
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -30,6 +30,21 @@ const defaultRenderDropIndicator = (target) => {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
+
* Helper to collect node state keys from cache tree nodes.
|
|
34
|
+
* Reduces cognitive complexity by extracting the iteration logic.
|
|
35
|
+
*/
|
|
36
|
+
function collectNodeKeys(nodes, acc) {
|
|
37
|
+
for (const node of nodes) {
|
|
38
|
+
if (node.isDisabled) acc.disabledKeys?.add(node.key);
|
|
39
|
+
if (node.isExpanded) acc.expandedKeys?.add(node.key);
|
|
40
|
+
if (node.isSelected) acc.selectedKeys?.add(node.key);
|
|
41
|
+
if (node.isVisible) acc.visibleKeys?.add(node.key);
|
|
42
|
+
if (node.isVisibleComputed) acc.visibilityComputedKeys.add(node.key);
|
|
43
|
+
if (node.isIndeterminate) acc.indeterminateKeys.add(node.key);
|
|
44
|
+
}
|
|
45
|
+
return acc;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
33
48
|
* Tree - Hierarchical tree view with selection, visibility, and drag-and-drop
|
|
34
49
|
*
|
|
35
50
|
* Supports static or dynamic collections with keyboard navigation and accessibility.
|
|
@@ -92,23 +107,17 @@ function Tree({ children, className, disabledKeys: disabledKeysProp, dragAndDrop
|
|
|
92
107
|
});
|
|
93
108
|
const cache = useMemo(() => items ? new Cache([...items]) : null, [items]);
|
|
94
109
|
const nodes = useMemo(() => cache?.getAllNodes(), [cache]);
|
|
95
|
-
const { disabledKeys, expandedKeys, selectedKeys, visibleKeys, visibilityComputedKeys } = useMemo(() => {
|
|
110
|
+
const { disabledKeys, expandedKeys, selectedKeys, visibleKeys, visibilityComputedKeys, indeterminateKeys } = useMemo(() => {
|
|
96
111
|
const acc = {
|
|
97
112
|
disabledKeys: nodes ? /* @__PURE__ */ new Set() : disabledKeysProp,
|
|
98
113
|
expandedKeys: nodes ? /* @__PURE__ */ new Set() : expandedKeysProp,
|
|
99
114
|
selectedKeys: nodes ? /* @__PURE__ */ new Set() : selectedKeysProp,
|
|
100
115
|
visibleKeys: nodes ? /* @__PURE__ */ new Set() : visibleKeysProp,
|
|
101
|
-
visibilityComputedKeys: /* @__PURE__ */ new Set()
|
|
116
|
+
visibilityComputedKeys: /* @__PURE__ */ new Set(),
|
|
117
|
+
indeterminateKeys: /* @__PURE__ */ new Set()
|
|
102
118
|
};
|
|
103
119
|
if (!nodes) return acc;
|
|
104
|
-
return nodes
|
|
105
|
-
if (isDisabled) acc$1.disabledKeys?.add(key);
|
|
106
|
-
if (isExpanded) acc$1.expandedKeys?.add(key);
|
|
107
|
-
if (isSelected) acc$1.selectedKeys?.add(key);
|
|
108
|
-
if (isVisible) acc$1.visibleKeys?.add(key);
|
|
109
|
-
if (isVisibleComputed) acc$1.visibilityComputedKeys.add(key);
|
|
110
|
-
return acc$1;
|
|
111
|
-
}, acc);
|
|
120
|
+
return collectNodeKeys(nodes, acc);
|
|
112
121
|
}, [
|
|
113
122
|
nodes,
|
|
114
123
|
disabledKeysProp,
|
|
@@ -129,6 +138,7 @@ function Tree({ children, className, disabledKeys: disabledKeysProp, dragAndDrop
|
|
|
129
138
|
variant,
|
|
130
139
|
visibleKeys,
|
|
131
140
|
visibilityComputedKeys,
|
|
141
|
+
indeterminateKeys,
|
|
132
142
|
isStatic: typeof children !== "function",
|
|
133
143
|
onVisibilityChange: onVisibilityChange ?? (() => void 0)
|
|
134
144
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["AriaTree","className"],"sources":["../../../src/components/tree/index.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport { Cache, type CacheTreeNode } from '@/hooks/use-tree/actions/cache';\nimport type { Key, Selection } from '@react-types/shared';\nimport 'client-only';\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { useMemo } from 'react';\nimport {\n Tree as AriaTree,\n composeRenderProps,\n DropIndicator,\n type DropTarget,\n useDragAndDrop,\n} from 'react-aria-components';\nimport { TreeContext } from './context';\nimport styles from './styles.module.css';\nimport type { TreeProps } from './types';\n\nconst defaultRenderDropIndicator = (target: DropTarget) => {\n const isBetweenItems =\n target.type === 'item' &&\n (target.dropPosition === 'before' || target.dropPosition === 'after');\n return (\n <DropIndicator\n target={target}\n className={\n isBetweenItems ? styles.dropIndicatorBetween : styles.dropIndicator\n }\n />\n );\n};\n\n/**\n * Helper to collect node state keys from cache tree nodes.\n * Reduces cognitive complexity by extracting the iteration logic.\n */\nfunction collectNodeKeys<T>(\n nodes: MapIterator<CacheTreeNode<T>>,\n acc: {\n disabledKeys?: Set<Key>;\n expandedKeys?: Set<Key>;\n selectedKeys?: Set<Key>;\n visibleKeys?: Set<Key>;\n visibilityComputedKeys: Set<Key>;\n indeterminateKeys: Set<Key>;\n },\n) {\n for (const node of nodes) {\n if (node.isDisabled) {\n acc.disabledKeys?.add(node.key);\n }\n if (node.isExpanded) {\n acc.expandedKeys?.add(node.key);\n }\n if (node.isSelected) {\n acc.selectedKeys?.add(node.key);\n }\n if (node.isVisible) {\n acc.visibleKeys?.add(node.key);\n }\n if (node.isVisibleComputed) {\n acc.visibilityComputedKeys.add(node.key);\n }\n if (node.isIndeterminate) {\n acc.indeterminateKeys.add(node.key);\n }\n }\n return acc;\n}\n\n/**\n * Tree - Hierarchical tree view with selection, visibility, and drag-and-drop\n *\n * Supports static or dynamic collections with keyboard navigation and accessibility.\n *\n * @param props - {@link TreeProps}\n * @param props.children - Tree items or render function for dynamic collections.\n * @param props.className - CSS class for the tree container.\n * @param props.disabledKeys - Set of disabled item keys.\n * @param props.dragAndDropConfig - Configuration for drag and drop behavior.\n * @param props.expandedKeys - Set of expanded item keys.\n * @param props.items - Data source for dynamic collections.\n * @param props.selectedKeys - Set of selected item keys.\n * @param props.showRuleLines - Whether to show connecting lines between items.\n * @param props.showVisibility - Whether to show visibility toggle buttons.\n * @param props.selectionMode - Selection mode for the tree.\n * @param props.variant - Visual density variant.\n * @param props.visibleKeys - Set of visible item keys.\n * @param props.onVisibilityChange - Callback when item visibility changes.\n * @param props.onSelectionChange - Callback when selection changes.\n * @returns The rendered Tree component.\n *\n * @example\n * // Dynamic collection\n * ```tsx\n * <Tree items={items} expandedKeys={expandedKeys}>\n * {(node) => <TreeItem key={node.key}>{node.label}</TreeItem>}\n * </Tree>\n * ```\n *\n * @example\n * ```tsx\n * // Static collection\n * <Tree>\n * <TreeItem id=\"one\" textValue=\"one\">\n * <TreeItemContent>One</TreeItemContent>\n * <TreeItem id=\"two\" textValue=\"two\">\n * <TreeItemContent>Two</TreeItemContent>\n * </TreeItem>\n * </TreeItem>\n * </Tree>\n * ```\n */\nexport function Tree<T>({\n children,\n className,\n disabledKeys: disabledKeysProp,\n dragAndDropConfig,\n expandedKeys: expandedKeysProp,\n items,\n selectedKeys: selectedKeysProp,\n showRuleLines = true,\n showVisibility = true,\n selectionMode = 'multiple',\n variant = 'cozy',\n visibleKeys: visibleKeysProp,\n onVisibilityChange,\n onSelectionChange,\n ...rest\n}: TreeProps<T>) {\n /**\n * A static collection is hard-coded. Dynamic is data-driven from an external source.\n * https://react-spectrum.adobe.com/react-aria/Tree.html#content\n *\n * Controlled state should only be used on a static tree.\n */\n if (\n items &&\n (disabledKeysProp ||\n expandedKeysProp ||\n selectedKeysProp ||\n visibleKeysProp)\n ) {\n throw new Error(\n 'Tree should only be controlled with state from either `items` or keys props, not both',\n );\n }\n\n /**\n * A static tree won't support the node iterator pattern.\n */\n if (!!items !== (typeof children === 'function')) {\n throw new Error(\n 'Tree `items` and node iterator `children` must be used together',\n );\n }\n\n const { dragAndDropHooks } = useDragAndDrop({\n renderDropIndicator: defaultRenderDropIndicator,\n getAllowedDropOperations: () => ['move'],\n getDropOperation: () => 'move',\n ...dragAndDropConfig,\n });\n const cache = useMemo(() => (items ? new Cache([...items]) : null), [items]);\n const nodes = useMemo(() => cache?.getAllNodes(), [cache]);\n const {\n disabledKeys,\n expandedKeys,\n selectedKeys,\n visibleKeys,\n visibilityComputedKeys,\n indeterminateKeys,\n } = useMemo(() => {\n const acc = {\n disabledKeys: nodes ? new Set<Key>() : disabledKeysProp,\n expandedKeys: nodes ? new Set<Key>() : expandedKeysProp,\n selectedKeys: nodes ? new Set<Key>() : selectedKeysProp,\n visibleKeys: nodes ? new Set<Key>() : visibleKeysProp,\n visibilityComputedKeys: new Set<Key>(),\n indeterminateKeys: new Set<Key>(),\n };\n\n if (!nodes) {\n return acc;\n }\n\n return collectNodeKeys<T>(nodes, acc);\n }, [\n nodes,\n disabledKeysProp,\n expandedKeysProp,\n selectedKeysProp,\n visibleKeysProp,\n ]);\n\n const handleSelectionChange = selectedKeys\n ? (selection: Selection) => {\n if (selection !== 'all') {\n onSelectionChange?.(selection);\n }\n }\n : undefined;\n\n return (\n <TreeContext.Provider\n value={{\n disabledKeys,\n expandedKeys,\n selectedKeys,\n showRuleLines,\n showVisibility,\n variant,\n visibleKeys,\n visibilityComputedKeys,\n indeterminateKeys,\n isStatic: typeof children !== 'function',\n onVisibilityChange: onVisibilityChange ?? (() => undefined), // TODO: improve\n }}\n >\n <AriaTree\n {...rest}\n className={composeRenderProps(className, (className) =>\n clsx(styles.tree, className),\n )}\n disabledKeys={disabledKeys}\n dragAndDropHooks={dragAndDropHooks}\n expandedKeys={expandedKeys}\n items={items}\n selectedKeys={selectedKeys}\n onSelectionChange={handleSelectionChange}\n selectionMode={selectionMode}\n >\n {children}\n </AriaTree>\n </TreeContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,8BAA8B,WAAuB;AAIzD,QACE,oBAAC;EACS;EACR,WALF,OAAO,SAAS,WACf,OAAO,iBAAiB,YAAY,OAAO,iBAAiB,WAKxC,OAAO,uBAAuB,OAAO;GAExD;;;;;;AAQN,SAAS,gBACP,OACA,KAQA;AACA,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,KAAK,WACP,KAAI,cAAc,IAAI,KAAK,IAAI;AAEjC,MAAI,KAAK,WACP,KAAI,cAAc,IAAI,KAAK,IAAI;AAEjC,MAAI,KAAK,WACP,KAAI,cAAc,IAAI,KAAK,IAAI;AAEjC,MAAI,KAAK,UACP,KAAI,aAAa,IAAI,KAAK,IAAI;AAEhC,MAAI,KAAK,kBACP,KAAI,uBAAuB,IAAI,KAAK,IAAI;AAE1C,MAAI,KAAK,gBACP,KAAI,kBAAkB,IAAI,KAAK,IAAI;;AAGvC,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CT,SAAgB,KAAQ,EACtB,UACA,WACA,cAAc,kBACd,mBACA,cAAc,kBACd,OACA,cAAc,kBACd,gBAAgB,MAChB,iBAAiB,MACjB,gBAAgB,YAChB,UAAU,QACV,aAAa,iBACb,oBACA,mBACA,GAAG,QACY;;;;;;;AAOf,KACE,UACC,oBACC,oBACA,oBACA,iBAEF,OAAM,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import * as react_jsx_runtime185 from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
//#region src/components/tree/item-actions.d.ts
|
|
17
17
|
|
|
@@ -39,7 +39,7 @@ declare function TreeItemActions({
|
|
|
39
39
|
className
|
|
40
40
|
}: PropsWithChildren & {
|
|
41
41
|
className?: string;
|
|
42
|
-
}):
|
|
42
|
+
}): react_jsx_runtime185.JSX.Element;
|
|
43
43
|
//#endregion
|
|
44
44
|
export { TreeItemActions };
|
|
45
45
|
//# sourceMappingURL=item-actions.d.ts.map
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TreeItemContentProps } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react_jsx_runtime186 from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
//#region src/components/tree/item-content.d.ts
|
|
17
17
|
|
|
@@ -35,7 +35,7 @@ import * as react_jsx_runtime198 from "react/jsx-runtime";
|
|
|
35
35
|
*/
|
|
36
36
|
declare function TreeItemContent({
|
|
37
37
|
children
|
|
38
|
-
}: TreeItemContentProps):
|
|
38
|
+
}: TreeItemContentProps): react_jsx_runtime186.JSX.Element;
|
|
39
39
|
//#endregion
|
|
40
40
|
export { TreeItemContent };
|
|
41
41
|
//# sourceMappingURL=item-content.d.ts.map
|