@accelint/design-toolkit 9.13.0 → 10.1.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 +1 -1
- package/dist/components/accordion/group.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/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 +2 -2
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/badge/context.d.ts +4 -4
- 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/toggle.d.ts +2 -2
- package/dist/components/carousel/context.d.ts +4 -4
- package/dist/components/carousel/gallery.d.ts +2 -2
- package/dist/components/carousel/index.d.ts +2 -2
- package/dist/components/carousel/navigation.d.ts +3 -3
- package/dist/components/carousel/position.d.ts +2 -2
- package/dist/components/carousel/select.d.ts +2 -2
- package/dist/components/carousel/viewer.d.ts +2 -2
- package/dist/components/checkbox/context.d.ts +3 -3
- package/dist/components/checkbox/group.d.ts +2 -2
- 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/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/date-field/index.js.map +1 -1
- 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/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/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/constants.d.ts +26 -0
- package/dist/components/floating-card/constants.js +40 -0
- package/dist/components/floating-card/constants.js.map +1 -0
- package/dist/components/floating-card/context.d.ts +38 -6
- package/dist/components/floating-card/context.js +24 -3
- package/dist/components/floating-card/context.js.map +1 -1
- package/dist/components/floating-card/hooks/use-card-layout.d.ts +36 -0
- package/dist/components/floating-card/hooks/use-card-layout.js +106 -0
- package/dist/components/floating-card/hooks/use-card-layout.js.map +1 -0
- package/dist/components/floating-card/hooks/use-drag.d.ts +62 -0
- package/dist/components/floating-card/hooks/use-drag.js +100 -0
- package/dist/components/floating-card/hooks/use-drag.js.map +1 -0
- package/dist/components/floating-card/hooks/use-mouse-interaction.d.ts +58 -0
- package/dist/components/floating-card/hooks/use-mouse-interaction.js +91 -0
- package/dist/components/floating-card/hooks/use-mouse-interaction.js.map +1 -0
- package/dist/components/floating-card/hooks/use-resize.d.ts +56 -0
- package/dist/components/floating-card/hooks/use-resize.js +98 -0
- package/dist/components/floating-card/hooks/use-resize.js.map +1 -0
- package/dist/components/floating-card/index.d.ts +6 -2
- package/dist/components/floating-card/index.js +24 -32
- package/dist/components/floating-card/index.js.map +1 -1
- package/dist/components/floating-card/panel.d.ts +69 -0
- package/dist/components/floating-card/panel.js +111 -0
- package/dist/components/floating-card/panel.js.map +1 -0
- package/dist/components/floating-card/provider.d.ts +10 -6
- package/dist/components/floating-card/provider.js +159 -153
- package/dist/components/floating-card/provider.js.map +1 -1
- package/dist/components/floating-card/styles.module.css +93 -39
- package/dist/components/floating-card/types.d.ts +51 -10
- package/dist/components/floating-card/utils.d.ts +8 -85
- package/dist/components/floating-card/utils.js +12 -38
- package/dist/components/floating-card/utils.js.map +1 -1
- package/dist/components/gantt/components/base-elements/range.d.ts +2 -2
- package/dist/components/gantt/components/containers/external/gantt-content-container/index.d.ts +2 -2
- package/dist/components/gantt/components/containers/external/gantt-panel-container/index.d.ts +2 -2
- package/dist/components/gantt/components/containers/internal/index.d.ts +2 -2
- package/dist/components/gantt/components/containers/internal/layout-container/index.d.ts +2 -2
- package/dist/components/gantt/components/containers/internal/virtualized-content-height-container/index.d.ts +2 -2
- package/dist/components/gantt/components/content-row/block.d.ts +2 -2
- package/dist/components/gantt/components/content-row/bracket.d.ts +3 -3
- package/dist/components/gantt/components/content-row/icon-marker.d.ts +2 -2
- package/dist/components/gantt/components/content-row/index.d.ts +2 -2
- package/dist/components/gantt/components/content-row/marker.d.ts +2 -2
- package/dist/components/gantt/components/content-row/spacer.d.ts +2 -2
- package/dist/components/gantt/components/current-time/index.d.ts +2 -2
- package/dist/components/gantt/components/header/index.d.ts +3 -3
- package/dist/components/gantt/components/panel-row/index.d.ts +2 -2
- package/dist/components/gantt/components/rows-virtualizer/index.d.ts +3 -3
- package/dist/components/gantt/components/timeline/index.d.ts +2 -2
- package/dist/components/gantt/components/timeline-chunk/index.d.ts +3 -3
- package/dist/components/gantt/context/index.d.ts +4 -4
- package/dist/components/gantt/context/store/index.d.ts +4 -4
- package/dist/components/gantt/context/temporal-data/index.d.ts +4 -4
- package/dist/components/gantt/hooks/use-layout-subscription/index.js +8 -8
- package/dist/components/gantt/hooks/use-layout-subscription/index.js.map +1 -1
- 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/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 +2 -2
- 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/mute-button.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/submenu.d.ts +2 -2
- package/dist/components/notice/index.d.ts +2 -2
- package/dist/components/notice/list.d.ts +2 -2
- package/dist/components/notice/notice-icon.d.ts +2 -2
- 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/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/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/value-editor.d.ts +2 -2
- package/dist/components/query-builder/value-selector.d.ts +2 -2
- 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 +2 -2
- 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/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/stepper/back.d.ts +71 -0
- package/dist/components/stepper/back.js +82 -0
- package/dist/components/stepper/back.js.map +1 -0
- package/dist/components/stepper/context.d.ts +49 -0
- package/dist/components/stepper/context.js +56 -0
- package/dist/components/stepper/context.js.map +1 -0
- package/dist/components/stepper/index.d.ts +22 -0
- package/dist/components/stepper/index.js +23 -0
- package/dist/components/stepper/list.d.ts +65 -0
- package/dist/components/stepper/list.js +121 -0
- package/dist/components/stepper/list.js.map +1 -0
- package/dist/components/stepper/next.d.ts +80 -0
- package/dist/components/stepper/next.js +91 -0
- package/dist/components/stepper/next.js.map +1 -0
- package/dist/components/stepper/panel.d.ts +66 -0
- package/dist/components/stepper/panel.js +77 -0
- package/dist/components/stepper/panel.js.map +1 -0
- package/dist/components/stepper/step.d.ts +49 -0
- package/dist/components/stepper/step.js +89 -0
- package/dist/components/stepper/step.js.map +1 -0
- package/dist/components/stepper/stepper.d.ts +130 -0
- package/dist/components/stepper/stepper.js +154 -0
- package/dist/components/stepper/stepper.js.map +1 -0
- package/dist/components/stepper/styles.module.css +126 -0
- package/dist/components/stepper/types.d.ts +205 -0
- package/dist/components/stepper/types.js +12 -0
- package/dist/components/stepper/use-stepper-state.d.ts +175 -0
- package/dist/components/stepper/use-stepper-state.js +225 -0
- package/dist/components/stepper/use-stepper-state.js.map +1 -0
- package/dist/components/switch/context.d.ts +4 -4
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/table/body.d.ts +4 -3
- package/dist/components/table/body.js.map +1 -1
- package/dist/components/table/cell.d.ts +4 -3
- package/dist/components/table/cell.js.map +1 -1
- package/dist/components/table/context.d.ts +2 -2
- package/dist/components/table/features.d.ts +80 -0
- package/dist/components/table/features.js +61 -0
- package/dist/components/table/features.js.map +1 -0
- package/dist/components/table/header-cell.d.ts +4 -3
- package/dist/components/table/header-cell.js.map +1 -1
- package/dist/components/table/header.d.ts +4 -3
- package/dist/components/table/header.js.map +1 -1
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +40 -49
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/table/row-ordering-feature.d.ts +88 -0
- package/dist/components/table/row-ordering-feature.js +115 -0
- package/dist/components/table/row-ordering-feature.js.map +1 -0
- package/dist/components/table/row.d.ts +4 -3
- package/dist/components/table/row.js.map +1 -1
- package/dist/components/table/types.d.ts +15 -13
- 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/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/item-actions.d.ts +2 -2
- package/dist/components/tree/item-content.d.ts +2 -2
- 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/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/index.d.ts +13 -2
- package/dist/index.js +11 -1
- package/dist/providers/portal.d.ts +2 -2
- package/dist/providers/theme-provider.d.ts +2 -2
- package/package.json +28 -12
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { SwitchProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime180 from "react/jsx-runtime";
|
|
16
16
|
|
|
17
17
|
//#region src/components/switch/index.d.ts
|
|
18
18
|
|
|
@@ -38,7 +38,7 @@ import * as react_jsx_runtime97 from "react/jsx-runtime";
|
|
|
38
38
|
declare function Switch({
|
|
39
39
|
ref,
|
|
40
40
|
...props
|
|
41
|
-
}: SwitchProps):
|
|
41
|
+
}: SwitchProps): react_jsx_runtime180.JSX.Element;
|
|
42
42
|
//#endregion
|
|
43
43
|
export { Switch };
|
|
44
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TableBodyProps } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react_jsx_runtime217 from "react/jsx-runtime";
|
|
15
|
+
import { RowData } from "@tanstack/react-table";
|
|
15
16
|
|
|
16
17
|
//#region src/components/table/body.d.ts
|
|
17
18
|
|
|
@@ -33,13 +34,13 @@ import * as react_jsx_runtime101 from "react/jsx-runtime";
|
|
|
33
34
|
* @param props.rows - Array of TanStack table rows to render.
|
|
34
35
|
* @returns The rendered TableBody component.
|
|
35
36
|
*/
|
|
36
|
-
declare function TableBody<T>({
|
|
37
|
+
declare function TableBody<T extends RowData>({
|
|
37
38
|
children,
|
|
38
39
|
className,
|
|
39
40
|
ref,
|
|
40
41
|
rows,
|
|
41
42
|
...rest
|
|
42
|
-
}: TableBodyProps<T>):
|
|
43
|
+
}: TableBodyProps<T>): react_jsx_runtime217.JSX.Element;
|
|
43
44
|
//#endregion
|
|
44
45
|
export { TableBody };
|
|
45
46
|
//# sourceMappingURL=body.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body.js","names":[],"sources":["../../../src/components/table/body.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { TableRow } from './row';\nimport type { TableBodyProps } from './types';\n\n/**\n * TableBody - Renders the table body section (`<tbody>`).\n *\n * @example\n * ```tsx\n * <Table>\n * <TableHeader headerGroups={table.getHeaderGroups()} />\n * <TableBody rows={table.getRowModel().rows} />\n * </Table>\n * ```\n *\n * @param props - {@link TableBodyProps}\n * @param props.children - Custom children content.\n * @param props.className - CSS class for the tbody element.\n * @param props.ref - Ref to the tbody element.\n * @param props.rows - Array of TanStack table rows to render.\n * @returns The rendered TableBody component.\n */\nexport function TableBody<T>({\n children,\n className,\n ref,\n rows,\n ...rest\n}: TableBodyProps<T>) {\n return (\n <tbody {...rest} ref={ref} className={clsx('group/tbody', className)}>\n {children || rows?.map((row) => <TableRow key={row.id} row={row} />)}\n </tbody>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"body.js","names":[],"sources":["../../../src/components/table/body.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { TableRow } from './row';\nimport type { RowData } from '@tanstack/react-table';\nimport type { TableBodyProps } from './types';\n\n/**\n * TableBody - Renders the table body section (`<tbody>`).\n *\n * @example\n * ```tsx\n * <Table>\n * <TableHeader headerGroups={table.getHeaderGroups()} />\n * <TableBody rows={table.getRowModel().rows} />\n * </Table>\n * ```\n *\n * @param props - {@link TableBodyProps}\n * @param props.children - Custom children content.\n * @param props.className - CSS class for the tbody element.\n * @param props.ref - Ref to the tbody element.\n * @param props.rows - Array of TanStack table rows to render.\n * @returns The rendered TableBody component.\n */\nexport function TableBody<T extends RowData>({\n children,\n className,\n ref,\n rows,\n ...rest\n}: TableBodyProps<T>) {\n return (\n <tbody {...rest} ref={ref} className={clsx('group/tbody', className)}>\n {children || rows?.map((row) => <TableRow key={row.id} row={row} />)}\n </tbody>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,UAA6B,EAC3C,UACA,WACA,KACA,MACA,GAAG,QACiB;AACpB,QACE,oBAAC;EAAM,GAAI;EAAW;EAAK,WAAW,KAAK,eAAe,UAAU;YACjE,YAAY,MAAM,KAAK,QAAQ,oBAAC,YAA2B,OAAb,IAAI,GAAgB,CAAC;GAC9D"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TableCellProps } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react_jsx_runtime231 from "react/jsx-runtime";
|
|
15
|
+
import { RowData } from "@tanstack/react-table";
|
|
15
16
|
|
|
16
17
|
//#region src/components/table/cell.d.ts
|
|
17
18
|
|
|
@@ -34,13 +35,13 @@ import * as react_jsx_runtime98 from "react/jsx-runtime";
|
|
|
34
35
|
* @param props.cell - TanStack table cell object.
|
|
35
36
|
* @returns The rendered TableCell component.
|
|
36
37
|
*/
|
|
37
|
-
declare function TableCell<T>({
|
|
38
|
+
declare function TableCell<T extends RowData>({
|
|
38
39
|
children,
|
|
39
40
|
ref,
|
|
40
41
|
className,
|
|
41
42
|
cell,
|
|
42
43
|
...rest
|
|
43
|
-
}: TableCellProps<T>):
|
|
44
|
+
}: TableCellProps<T>): react_jsx_runtime231.JSX.Element;
|
|
44
45
|
//#endregion
|
|
45
46
|
export { TableCell };
|
|
46
47
|
//# sourceMappingURL=cell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell.js","names":[],"sources":["../../../src/components/table/cell.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { flexRender } from '@tanstack/react-table';\nimport { useContext } from 'react';\nimport { HeaderColumnAction } from './constants/table';\nimport { TableContext } from './context';\nimport styles from './styles.module.css';\nimport type { TableCellProps } from './types';\n\n/**\n * TableCell - Data cell (`<td>`) within a table row.\n *\n * @example\n * ```tsx\n * <TableRow row={row}>\n * {row.getAllCells().map(cell => (\n * <TableCell key={cell.id} cell={cell} />\n * ))}\n * </TableRow>\n * ```\n *\n * @param props - {@link TableCellProps}\n * @param props.children - Custom children content.\n * @param props.ref - Ref to the td element.\n * @param props.className - CSS class for the td element.\n * @param props.cell - TanStack table cell object.\n * @returns The rendered TableCell component.\n */\nexport function TableCell<T>({\n children,\n ref,\n className,\n cell,\n ...rest\n}: TableCellProps<T>) {\n const { columnSelection, persistNumerals } = useContext(TableContext);\n const isNumeral = cell?.column.id === HeaderColumnAction.NUMERAL;\n const isSelected = cell?.column.id === columnSelection;\n const notPersistNums = isNumeral && !persistNumerals;\n\n return (\n <td\n {...rest}\n ref={ref}\n className={clsx(\n styles.cell,\n notPersistNums && styles.hideInRow,\n className,\n )}\n data-selected={isSelected || null}\n style={{ width: cell?.column.getSize() }}\n >\n {children ||\n (cell && flexRender(cell.column.columnDef.cell, cell.getContext()))}\n </td>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,
|
|
1
|
+
{"version":3,"file":"cell.js","names":[],"sources":["../../../src/components/table/cell.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport { flexRender, type RowData } from '@tanstack/react-table';\nimport { useContext } from 'react';\nimport { HeaderColumnAction } from './constants/table';\nimport { TableContext } from './context';\nimport styles from './styles.module.css';\nimport type { TableCellProps } from './types';\n\n/**\n * TableCell - Data cell (`<td>`) within a table row.\n *\n * @example\n * ```tsx\n * <TableRow row={row}>\n * {row.getAllCells().map(cell => (\n * <TableCell key={cell.id} cell={cell} />\n * ))}\n * </TableRow>\n * ```\n *\n * @param props - {@link TableCellProps}\n * @param props.children - Custom children content.\n * @param props.ref - Ref to the td element.\n * @param props.className - CSS class for the td element.\n * @param props.cell - TanStack table cell object.\n * @returns The rendered TableCell component.\n */\nexport function TableCell<T extends RowData>({\n children,\n ref,\n className,\n cell,\n ...rest\n}: TableCellProps<T>) {\n const { columnSelection, persistNumerals } = useContext(TableContext);\n const isNumeral = cell?.column.id === HeaderColumnAction.NUMERAL;\n const isSelected = cell?.column.id === columnSelection;\n const notPersistNums = isNumeral && !persistNumerals;\n\n return (\n <td\n {...rest}\n ref={ref}\n className={clsx(\n styles.cell,\n notPersistNums && styles.hideInRow,\n className,\n )}\n data-selected={isSelected || null}\n style={{ width: cell?.column.getSize() }}\n >\n {children ||\n (cell && flexRender(cell.column.columnDef.cell, cell.getContext()))}\n </td>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,UAA6B,EAC3C,UACA,KACA,WACA,MACA,GAAG,QACiB;CACpB,MAAM,EAAE,iBAAiB,oBAAoB,WAAW,aAAa;CACrE,MAAM,YAAY,MAAM,OAAO,OAAO,mBAAmB;CACzD,MAAM,aAAa,MAAM,OAAO,OAAO;CACvC,MAAM,iBAAiB,aAAa,CAAC;AAErC,QACE,oBAAC;EACC,GAAI;EACC;EACL,WAAW,KACT,OAAO,MACP,kBAAkB,OAAO,WACzB,UACD;EACD,iBAAe,cAAc;EAC7B,OAAO,EAAE,OAAO,MAAM,OAAO,SAAS,EAAE;YAEvC,YACE,QAAQ,WAAW,KAAK,OAAO,UAAU,MAAM,KAAK,YAAY,CAAC;GACjE"}
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TableContextValue } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react45 from "react";
|
|
15
15
|
|
|
16
16
|
//#region src/components/table/context.d.ts
|
|
17
17
|
/** Context for sharing table configuration across subcomponents */
|
|
18
|
-
declare const TableContext:
|
|
18
|
+
declare const TableContext: react45.Context<TableContextValue>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { TableContext };
|
|
21
21
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
14
|
+
import { RowData } from "@tanstack/react-table";
|
|
15
|
+
|
|
16
|
+
//#region src/components/table/features.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* The TanStack Table feature set registered for every Table instance.
|
|
19
|
+
*
|
|
20
|
+
* Use `typeof tableFeatures` (or {@link TableFeatures}) as the first generic
|
|
21
|
+
* of TanStack types (`ColumnDef`, `CellContext`, etc.) when typing columns
|
|
22
|
+
* for the Table component.
|
|
23
|
+
*/
|
|
24
|
+
declare const tableFeatures: {
|
|
25
|
+
rowSortingFeature: _tanstack_react_table0.TableFeature;
|
|
26
|
+
rowSelectionFeature: _tanstack_react_table0.TableFeature;
|
|
27
|
+
rowPinningFeature: _tanstack_react_table0.TableFeature;
|
|
28
|
+
rowPaginationFeature: _tanstack_react_table0.TableFeature;
|
|
29
|
+
rowOrderingFeature: _tanstack_react_table0.TableFeature;
|
|
30
|
+
columnOrderingFeature: _tanstack_react_table0.TableFeature;
|
|
31
|
+
columnSizingFeature: _tanstack_react_table0.TableFeature;
|
|
32
|
+
sortedRowModel: (table: _tanstack_react_table0.Table<any, any>) => () => _tanstack_react_table0.RowModel<any, any>;
|
|
33
|
+
paginatedRowModel: (table: _tanstack_react_table0.Table<any, any>) => () => _tanstack_react_table0.RowModel<any, any>;
|
|
34
|
+
sortFns: {
|
|
35
|
+
alphanumeric: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
36
|
+
alphanumericCaseSensitive: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
37
|
+
basic: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
38
|
+
datetime: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
39
|
+
text: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
40
|
+
textCaseSensitive: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Feature set type of the Table component; first generic parameter for
|
|
45
|
+
* TanStack Table types.
|
|
46
|
+
*/
|
|
47
|
+
type TableFeatures = typeof tableFeatures;
|
|
48
|
+
/**
|
|
49
|
+
* Column helper pre-bound to the Table component's feature set.
|
|
50
|
+
*
|
|
51
|
+
* Replacement for TanStack Table v8's `createColumnHelper<TData>()`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* const columnHelper = createTableColumnHelper<Person>();
|
|
56
|
+
* const columns = [columnHelper.accessor('firstName', { header: 'First Name' })];
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function createTableColumnHelper<TData extends RowData>(): _tanstack_react_table0.ColumnHelper<{
|
|
60
|
+
rowSortingFeature: _tanstack_react_table0.TableFeature;
|
|
61
|
+
rowSelectionFeature: _tanstack_react_table0.TableFeature;
|
|
62
|
+
rowPinningFeature: _tanstack_react_table0.TableFeature;
|
|
63
|
+
rowPaginationFeature: _tanstack_react_table0.TableFeature;
|
|
64
|
+
rowOrderingFeature: _tanstack_react_table0.TableFeature;
|
|
65
|
+
columnOrderingFeature: _tanstack_react_table0.TableFeature;
|
|
66
|
+
columnSizingFeature: _tanstack_react_table0.TableFeature;
|
|
67
|
+
sortedRowModel: (table: _tanstack_react_table0.Table<any, any>) => () => _tanstack_react_table0.RowModel<any, any>;
|
|
68
|
+
paginatedRowModel: (table: _tanstack_react_table0.Table<any, any>) => () => _tanstack_react_table0.RowModel<any, any>;
|
|
69
|
+
sortFns: {
|
|
70
|
+
alphanumeric: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
71
|
+
alphanumericCaseSensitive: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
72
|
+
basic: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
73
|
+
datetime: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
74
|
+
text: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
75
|
+
textCaseSensitive: _tanstack_react_table0.CreatedSortFn<any, any>;
|
|
76
|
+
};
|
|
77
|
+
}, TData>;
|
|
78
|
+
//#endregion
|
|
79
|
+
export { TableFeatures, createTableColumnHelper, tableFeatures };
|
|
80
|
+
//# sourceMappingURL=features.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import { rowOrderingFeature } from "./row-ordering-feature.js";
|
|
15
|
+
import { columnOrderingFeature, columnSizingFeature, createColumnHelper, createPaginatedRowModel, createSortedRowModel, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, tableFeatures as tableFeatures$1 } from "@tanstack/react-table";
|
|
16
|
+
|
|
17
|
+
//#region src/components/table/features.ts
|
|
18
|
+
/**
|
|
19
|
+
* The TanStack Table feature set registered for every Table instance.
|
|
20
|
+
*
|
|
21
|
+
* Use `typeof tableFeatures` (or {@link TableFeatures}) as the first generic
|
|
22
|
+
* of TanStack types (`ColumnDef`, `CellContext`, etc.) when typing columns
|
|
23
|
+
* for the Table component.
|
|
24
|
+
*/
|
|
25
|
+
const tableFeatures = tableFeatures$1({
|
|
26
|
+
rowSortingFeature,
|
|
27
|
+
rowSelectionFeature,
|
|
28
|
+
rowPinningFeature,
|
|
29
|
+
rowPaginationFeature,
|
|
30
|
+
rowOrderingFeature,
|
|
31
|
+
columnOrderingFeature,
|
|
32
|
+
columnSizingFeature,
|
|
33
|
+
sortedRowModel: createSortedRowModel(),
|
|
34
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
35
|
+
sortFns: {
|
|
36
|
+
alphanumeric: sortFn_alphanumeric,
|
|
37
|
+
alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,
|
|
38
|
+
basic: sortFn_basic,
|
|
39
|
+
datetime: sortFn_datetime,
|
|
40
|
+
text: sortFn_text,
|
|
41
|
+
textCaseSensitive: sortFn_textCaseSensitive
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Column helper pre-bound to the Table component's feature set.
|
|
46
|
+
*
|
|
47
|
+
* Replacement for TanStack Table v8's `createColumnHelper<TData>()`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const columnHelper = createTableColumnHelper<Person>();
|
|
52
|
+
* const columns = [columnHelper.accessor('firstName', { header: 'First Name' })];
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
function createTableColumnHelper() {
|
|
56
|
+
return createColumnHelper();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { createTableColumnHelper, tableFeatures };
|
|
61
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","names":["createTableFeatures"],"sources":["../../../src/components/table/features.ts"],"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\nimport {\n columnOrderingFeature,\n columnSizingFeature,\n createColumnHelper,\n createPaginatedRowModel,\n createSortedRowModel,\n tableFeatures as createTableFeatures,\n rowPaginationFeature,\n rowPinningFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_alphanumeric,\n sortFn_alphanumericCaseSensitive,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n sortFn_textCaseSensitive,\n} from '@tanstack/react-table';\nimport { rowOrderingFeature } from './row-ordering-feature';\nimport type { RowData } from '@tanstack/react-table';\n\n/**\n * The TanStack Table feature set registered for every Table instance.\n *\n * Use `typeof tableFeatures` (or {@link TableFeatures}) as the first generic\n * of TanStack types (`ColumnDef`, `CellContext`, etc.) when typing columns\n * for the Table component.\n */\nexport const tableFeatures = createTableFeatures({\n rowSortingFeature,\n rowSelectionFeature,\n rowPinningFeature,\n rowPaginationFeature,\n rowOrderingFeature,\n columnOrderingFeature,\n columnSizingFeature,\n sortedRowModel: createSortedRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n // all built-in sortFns so column `sortFn` string names (and 'auto') resolve\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n alphanumericCaseSensitive: sortFn_alphanumericCaseSensitive,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n textCaseSensitive: sortFn_textCaseSensitive,\n },\n});\n\n/**\n * Feature set type of the Table component; first generic parameter for\n * TanStack Table types.\n */\nexport type TableFeatures = typeof tableFeatures;\n\n/**\n * Column helper pre-bound to the Table component's feature set.\n *\n * Replacement for TanStack Table v8's `createColumnHelper<TData>()`.\n *\n * @example\n * ```tsx\n * const columnHelper = createTableColumnHelper<Person>();\n * const columns = [columnHelper.accessor('firstName', { header: 'First Name' })];\n * ```\n */\nexport function createTableColumnHelper<TData extends RowData>() {\n return createColumnHelper<TableFeatures, TData>();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,gBAAgBA,gBAAoB;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA,gBAAgB,sBAAsB;CACtC,mBAAmB,yBAAyB;CAE5C,SAAS;EACP,cAAc;EACd,2BAA2B;EAC3B,OAAO;EACP,UAAU;EACV,MAAM;EACN,mBAAmB;EACpB;CACF,CAAC;;;;;;;;;;;;AAmBF,SAAgB,0BAAiD;AAC/D,QAAO,oBAA0C"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TableHeaderCellProps } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react_jsx_runtime244 from "react/jsx-runtime";
|
|
15
|
+
import { RowData } from "@tanstack/react-table";
|
|
15
16
|
|
|
16
17
|
//#region src/components/table/header-cell.d.ts
|
|
17
18
|
|
|
@@ -36,13 +37,13 @@ import * as react_jsx_runtime100 from "react/jsx-runtime";
|
|
|
36
37
|
* @param props.header - TanStack table header object.
|
|
37
38
|
* @returns The rendered TableHeaderCell component.
|
|
38
39
|
*/
|
|
39
|
-
declare function TableHeaderCell<T>({
|
|
40
|
+
declare function TableHeaderCell<T extends RowData>({
|
|
40
41
|
ref,
|
|
41
42
|
children,
|
|
42
43
|
className,
|
|
43
44
|
header,
|
|
44
45
|
...rest
|
|
45
|
-
}: TableHeaderCellProps<T>):
|
|
46
|
+
}: TableHeaderCellProps<T>): react_jsx_runtime244.JSX.Element;
|
|
46
47
|
//#endregion
|
|
47
48
|
export { TableHeaderCell };
|
|
48
49
|
//# sourceMappingURL=header-cell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-cell.js","names":[],"sources":["../../../src/components/table/header-cell.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport ArrowDown from '@accelint/icons/arrow-down';\nimport ArrowUp from '@accelint/icons/arrow-up';\nimport Kebab from '@accelint/icons/kebab';\nimport { flexRender, type Header } from '@tanstack/react-table';\nimport { useContext, useState } from 'react';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { Menu } from '../menu';\nimport { MenuItem } from '../menu/item';\nimport { MenuSeparator } from '../menu/separator';\nimport { MenuTrigger } from '../menu/trigger';\nimport {\n HeaderColumnAction,\n headerColumnActionValues,\n SortDirection,\n} from './constants/table';\nimport { TableContext } from './context';\nimport styles from './styles.module.css';\nimport type { TableHeaderCellProps } from './types';\n\nfunction HeaderCellMenu<T>({
|
|
1
|
+
{"version":3,"file":"header-cell.js","names":[],"sources":["../../../src/components/table/header-cell.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { clsx } from '@accelint/design-foundation/lib/utils';\nimport ArrowDown from '@accelint/icons/arrow-down';\nimport ArrowUp from '@accelint/icons/arrow-up';\nimport Kebab from '@accelint/icons/kebab';\nimport { flexRender, type Header, type RowData } from '@tanstack/react-table';\nimport { useContext, useState } from 'react';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { Menu } from '../menu';\nimport { MenuItem } from '../menu/item';\nimport { MenuSeparator } from '../menu/separator';\nimport { MenuTrigger } from '../menu/trigger';\nimport {\n HeaderColumnAction,\n headerColumnActionValues,\n SortDirection,\n} from './constants/table';\nimport { TableContext } from './context';\nimport styles from './styles.module.css';\nimport type { TableFeatures } from './features';\nimport type { TableHeaderCellProps } from './types';\n\nfunction HeaderCellMenu<T extends RowData>({\n header,\n}: {\n header: Header<TableFeatures, T, unknown>;\n}) {\n const {\n enableColumnReordering,\n enableSorting,\n moveColumnLeft,\n moveColumnRight,\n persistHeaderKebabMenu,\n setColumnSelection,\n manualSorting,\n handleSortChange,\n handleColumnReordering,\n } = useContext(TableContext);\n\n const [hoveredArrow, setHoveredArrow] = useState(false);\n const hideHeaderKebab = !persistHeaderKebabMenu;\n\n if (\n headerColumnActionValues.includes(\n header.column.id as 'numeral' | 'kebab' | 'selection',\n ) ||\n !(enableSorting || enableColumnReordering)\n ) {\n return null;\n }\n\n const sort = header.column.getIsSorted();\n\n return (\n <div className={clsx(hideHeaderKebab && styles.hideInHeader)}>\n <MenuTrigger\n onOpenChange={(isOpen) =>\n setColumnSelection(isOpen ? header.column.id : null)\n }\n >\n <Button\n variant='icon'\n aria-label='Menu'\n onHoverChange={setHoveredArrow}\n >\n <Icon>\n {(!sort || hoveredArrow) && <Kebab />}\n {!hoveredArrow && sort === SortDirection.DESC && <ArrowDown />}\n {!hoveredArrow && sort === SortDirection.ASC && <ArrowUp />}\n </Icon>\n </Button>\n <Menu>\n {enableColumnReordering && (\n <>\n <MenuItem\n onAction={() => {\n const index = header.column.getIndex();\n moveColumnLeft(index);\n handleColumnReordering?.(index);\n }}\n isDisabled={header.column.getIsFirstColumn('center')}\n >\n Move Column Left\n </MenuItem>\n <MenuItem\n onAction={() => {\n const index = header.column.getIndex();\n moveColumnRight(index);\n handleColumnReordering?.(index);\n }}\n isDisabled={header.column.getIsLastColumn('center')}\n >\n Move Column Right\n </MenuItem>\n </>\n )}\n {enableColumnReordering && enableSorting && <MenuSeparator />}\n {enableSorting && (\n <>\n <MenuItem\n onAction={() => {\n manualSorting\n ? handleSortChange?.(header.column.id, SortDirection.ASC)\n : header.column.toggleSorting(false);\n }}\n isDisabled={sort === SortDirection.ASC}\n >\n Sort Ascending\n </MenuItem>\n <MenuItem\n onAction={() => {\n manualSorting\n ? handleSortChange?.(header.column.id, SortDirection.DESC)\n : header.column.toggleSorting(true);\n }}\n isDisabled={sort === SortDirection.DESC}\n >\n Sort Descending\n </MenuItem>\n <MenuItem\n onAction={() => {\n manualSorting\n ? handleSortChange?.(header.column.id, null)\n : header.column.clearSorting();\n }}\n isDisabled={!sort}\n >\n Clear Sort\n </MenuItem>\n </>\n )}\n </Menu>\n </MenuTrigger>\n </div>\n );\n}\n\n/**\n * TableHeaderCell - Individual header cell (`<th>`) with optional sorting controls.\n *\n * @example\n * ```tsx\n * <TableHeader headerGroups={headerGroups}>\n * <tr>\n * {headerGroup.headers.map(header => (\n * <TableHeaderCell key={header.id} header={header} />\n * ))}\n * </tr>\n * </TableHeader>\n * ```\n *\n * @param props - {@link TableHeaderCellProps}\n * @param props.ref - Ref to the th element.\n * @param props.children - Custom children content.\n * @param props.className - CSS class for the th element.\n * @param props.header - TanStack table header object.\n * @returns The rendered TableHeaderCell component.\n */\nexport function TableHeaderCell<T extends RowData>({\n ref,\n children,\n className,\n header,\n ...rest\n}: TableHeaderCellProps<T>) {\n const { columnSelection } = useContext(TableContext);\n const renderProps = header?.getContext();\n const sortLabel =\n header?.column.getIsSorted() === SortDirection.ASC\n ? 'ascending'\n : header?.column.getIsSorted() === SortDirection.DESC\n ? 'descending'\n : undefined;\n\n return (\n <th\n {...rest}\n aria-sort={sortLabel}\n ref={ref}\n style={{ width: header?.getSize() }}\n >\n <div\n className={clsx('group/header-cell', styles.headerCell, className)}\n data-selected={header?.column.id === columnSelection || null}\n >\n {children ||\n (header && (\n <>\n {header.column.id !== HeaderColumnAction.KEBAB &&\n renderProps &&\n flexRender(header.column.columnDef.header, renderProps)}\n <HeaderCellMenu header={header} />\n </>\n ))}\n </div>\n </th>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAS,eAAkC,EACzC,UAGC;CACD,MAAM,EACJ,wBACA,eACA,gBACA,iBACA,wBACA,oBACA,eACA,kBACA,2BACE,WAAW,aAAa;CAE5B,MAAM,CAAC,cAAc,mBAAmB,SAAS,MAAM;CACvD,MAAM,kBAAkB,CAAC;AAEzB,KACE,yBAAyB,SACvB,OAAO,OAAO,GACf,IACD,EAAE,iBAAiB,wBAEnB,QAAO;CAGT,MAAM,OAAO,OAAO,OAAO,aAAa;AAExC,QACE,oBAAC;EAAI,WAAW,KAAK,mBAAmB,OAAO,aAAa;YAC1D,qBAAC;GACC,eAAe,WACb,mBAAmB,SAAS,OAAO,OAAO,KAAK,KAAK;cAGtD,oBAAC;IACC,SAAQ;IACR,cAAW;IACX,eAAe;cAEf,qBAAC;MACG,CAAC,QAAQ,iBAAiB,oBAAC,UAAQ;KACpC,CAAC,gBAAgB,SAAS,cAAc,QAAQ,oBAAC,cAAY;KAC7D,CAAC,gBAAgB,SAAS,cAAc,OAAO,oBAAC,YAAU;QACtD;KACA,EACT,qBAAC;IACE,0BACC,8CACE,oBAAC;KACC,gBAAgB;MACd,MAAM,QAAQ,OAAO,OAAO,UAAU;AACtC,qBAAe,MAAM;AACrB,+BAAyB,MAAM;;KAEjC,YAAY,OAAO,OAAO,iBAAiB,SAAS;eACrD;MAEU,EACX,oBAAC;KACC,gBAAgB;MACd,MAAM,QAAQ,OAAO,OAAO,UAAU;AACtC,sBAAgB,MAAM;AACtB,+BAAyB,MAAM;;KAEjC,YAAY,OAAO,OAAO,gBAAgB,SAAS;eACpD;MAEU,IACV;IAEJ,0BAA0B,iBAAiB,oBAAC,kBAAgB;IAC5D,iBACC;KACE,oBAAC;MACC,gBAAgB;AACd,uBACI,mBAAmB,OAAO,OAAO,IAAI,cAAc,IAAI,GACvD,OAAO,OAAO,cAAc,MAAM;;MAExC,YAAY,SAAS,cAAc;gBACpC;OAEU;KACX,oBAAC;MACC,gBAAgB;AACd,uBACI,mBAAmB,OAAO,OAAO,IAAI,cAAc,KAAK,GACxD,OAAO,OAAO,cAAc,KAAK;;MAEvC,YAAY,SAAS,cAAc;gBACpC;OAEU;KACX,oBAAC;MACC,gBAAgB;AACd,uBACI,mBAAmB,OAAO,OAAO,IAAI,KAAK,GAC1C,OAAO,OAAO,cAAc;;MAElC,YAAY,CAAC;gBACd;OAEU;QACV;OAEA;IACK;GACV;;;;;;;;;;;;;;;;;;;;;;;AAyBV,SAAgB,gBAAmC,EACjD,KACA,UACA,WACA,QACA,GAAG,QACuB;CAC1B,MAAM,EAAE,oBAAoB,WAAW,aAAa;CACpD,MAAM,cAAc,QAAQ,YAAY;CACxC,MAAM,YACJ,QAAQ,OAAO,aAAa,KAAK,cAAc,MAC3C,cACA,QAAQ,OAAO,aAAa,KAAK,cAAc,OAC7C,eACA;AAER,QACE,oBAAC;EACC,GAAI;EACJ,aAAW;EACN;EACL,OAAO,EAAE,OAAO,QAAQ,SAAS,EAAE;YAEnC,oBAAC;GACC,WAAW,KAAK,qBAAqB,OAAO,YAAY,UAAU;GAClE,iBAAe,QAAQ,OAAO,OAAO,mBAAmB;aAEvD,YACE,UACC,8CACG,OAAO,OAAO,OAAO,mBAAmB,SACvC,eACA,WAAW,OAAO,OAAO,UAAU,QAAQ,YAAY,EACzD,oBAAC,kBAAuB,SAAU,IACjC;IAEH;GACH"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TableHeaderProps } from "./types.js";
|
|
14
|
-
import * as
|
|
14
|
+
import * as react_jsx_runtime198 from "react/jsx-runtime";
|
|
15
|
+
import { RowData } from "@tanstack/react-table";
|
|
15
16
|
|
|
16
17
|
//#region src/components/table/header.d.ts
|
|
17
18
|
|
|
@@ -34,14 +35,14 @@ import * as react_jsx_runtime99 from "react/jsx-runtime";
|
|
|
34
35
|
* @param props.columnSelection - Currently selected column ID.
|
|
35
36
|
* @returns The rendered TableHeader component.
|
|
36
37
|
*/
|
|
37
|
-
declare function TableHeader<T>({
|
|
38
|
+
declare function TableHeader<T extends RowData>({
|
|
38
39
|
ref,
|
|
39
40
|
children,
|
|
40
41
|
className,
|
|
41
42
|
headerGroups,
|
|
42
43
|
columnSelection,
|
|
43
44
|
...rest
|
|
44
|
-
}: TableHeaderProps<T>):
|
|
45
|
+
}: TableHeaderProps<T>): react_jsx_runtime198.JSX.Element;
|
|
45
46
|
//#endregion
|
|
46
47
|
export { TableHeader };
|
|
47
48
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.js","names":[],"sources":["../../../src/components/table/header.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { TableHeaderCell } from './header-cell';\nimport type { TableHeaderProps } from './types';\n\n/**\n * TableHeader - Renders the table header section (`<thead>`).\n *\n * @example\n * ```tsx\n * <Table>\n * <TableHeader headerGroups={table.getHeaderGroups()} />\n * <TableBody rows={table.getRowModel().rows} />\n * </Table>\n * ```\n *\n * @param props - {@link TableHeaderProps}\n * @param props.ref - Ref to the thead element.\n * @param props.children - Custom children content.\n * @param props.className - CSS class for the thead element.\n * @param props.headerGroups - Array of TanStack header groups.\n * @param props.columnSelection - Currently selected column ID.\n * @returns The rendered TableHeader component.\n */\nexport function TableHeader<T>({\n ref,\n children,\n className,\n headerGroups,\n columnSelection,\n ...rest\n}: TableHeaderProps<T>) {\n return (\n <thead {...rest} ref={ref} className={className}>\n {children ||\n headerGroups?.map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => (\n <TableHeaderCell key={header.id} header={header} />\n ))}\n </tr>\n ))}\n </thead>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"header.js","names":[],"sources":["../../../src/components/table/header.tsx"],"sourcesContent":["// __private-exports\n/*\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\nimport { TableHeaderCell } from './header-cell';\nimport type { RowData } from '@tanstack/react-table';\nimport type { TableHeaderProps } from './types';\n\n/**\n * TableHeader - Renders the table header section (`<thead>`).\n *\n * @example\n * ```tsx\n * <Table>\n * <TableHeader headerGroups={table.getHeaderGroups()} />\n * <TableBody rows={table.getRowModel().rows} />\n * </Table>\n * ```\n *\n * @param props - {@link TableHeaderProps}\n * @param props.ref - Ref to the thead element.\n * @param props.children - Custom children content.\n * @param props.className - CSS class for the thead element.\n * @param props.headerGroups - Array of TanStack header groups.\n * @param props.columnSelection - Currently selected column ID.\n * @returns The rendered TableHeader component.\n */\nexport function TableHeader<T extends RowData>({\n ref,\n children,\n className,\n headerGroups,\n columnSelection,\n ...rest\n}: TableHeaderProps<T>) {\n return (\n <thead {...rest} ref={ref} className={className}>\n {children ||\n headerGroups?.map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => (\n <TableHeaderCell key={header.id} header={header} />\n ))}\n </tr>\n ))}\n </thead>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,YAA+B,EAC7C,KACA,UACA,WACA,cACA,iBACA,GAAG,QACmB;AACtB,QACE,oBAAC;EAAM,GAAI;EAAW;EAAgB;YACnC,YACC,cAAc,KAAK,gBACjB,oBAAC,kBACE,YAAY,QAAQ,KAAK,WACxB,oBAAC,mBAAwC,UAAnB,OAAO,GAAsB,CACnD,IAHK,YAAY,GAIhB,CACL;GACE"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { TableProps } from "./types.js";
|
|
14
14
|
import "client-only";
|
|
15
|
-
import * as
|
|
15
|
+
import * as react_jsx_runtime199 from "react/jsx-runtime";
|
|
16
16
|
import { Key } from "@react-types/shared";
|
|
17
17
|
|
|
18
18
|
//#region src/components/table/index.d.ts
|
|
@@ -72,7 +72,7 @@ declare function Table<T extends {
|
|
|
72
72
|
defaultPage,
|
|
73
73
|
onPageChange,
|
|
74
74
|
...rest
|
|
75
|
-
}: TableProps<T>):
|
|
75
|
+
}: TableProps<T>): react_jsx_runtime199.JSX.Element;
|
|
76
76
|
//#endregion
|
|
77
77
|
export { Table };
|
|
78
78
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -21,6 +21,7 @@ import { MenuItem } from "../menu/item.js";
|
|
|
21
21
|
import { MenuSeparator } from "../menu/separator.js";
|
|
22
22
|
import { MenuTrigger } from "../menu/trigger.js";
|
|
23
23
|
import { TableContext } from "./context.js";
|
|
24
|
+
import { tableFeatures as tableFeatures$1 } from "./features.js";
|
|
24
25
|
import { TableBody } from "./body.js";
|
|
25
26
|
import { TableHeader } from "./header.js";
|
|
26
27
|
import "client-only";
|
|
@@ -30,13 +31,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
30
31
|
import Kebab from "@accelint/icons/kebab";
|
|
31
32
|
import { useControlledState } from "react-stately/useControlledState";
|
|
32
33
|
import PinIcon from "@accelint/icons/pin";
|
|
33
|
-
import {
|
|
34
|
-
import { getCoreRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
34
|
+
import { useTable } from "@tanstack/react-table";
|
|
35
35
|
import styles from "./styles.module.css";
|
|
36
36
|
|
|
37
37
|
//#region src/components/table/index.tsx
|
|
38
38
|
const META_COLUMN_WIDTH = 32;
|
|
39
|
-
function RowActionsMenu({
|
|
39
|
+
function RowActionsMenu({ row }) {
|
|
40
40
|
const { enableRowActions, persistRowKebabMenu } = useContext(TableContext);
|
|
41
41
|
const isPinned = !!row.getIsPinned();
|
|
42
42
|
return enableRowActions && /* @__PURE__ */ jsx("div", {
|
|
@@ -52,13 +52,13 @@ function RowActionsMenu({ moveRowsDown, moveRowsUp, row, rows }) {
|
|
|
52
52
|
}),
|
|
53
53
|
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
54
54
|
/* @__PURE__ */ jsx(MenuItem, {
|
|
55
|
-
onAction: () =>
|
|
56
|
-
isDisabled:
|
|
55
|
+
onAction: () => row.moveUp(),
|
|
56
|
+
isDisabled: !row.getCanMoveUp(),
|
|
57
57
|
children: "Move Up"
|
|
58
58
|
}),
|
|
59
59
|
/* @__PURE__ */ jsx(MenuItem, {
|
|
60
|
-
onAction: () =>
|
|
61
|
-
isDisabled:
|
|
60
|
+
onAction: () => row.moveDown(),
|
|
61
|
+
isDisabled: !row.getCanMoveDown(),
|
|
62
62
|
children: "Move Down"
|
|
63
63
|
})
|
|
64
64
|
] })] })
|
|
@@ -95,7 +95,26 @@ function RowActionsMenu({ moveRowsDown, moveRowsUp, row, rows }) {
|
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
97
|
function Table({ children, columns: columnsProp, data: dataProp, showCheckbox, rowSelection: rowSelectionProp, kebabPosition = "right", persistRowKebabMenu = true, persistHeaderKebabMenu = true, persistNumerals = false, enableSorting = true, enableColumnReordering = true, enableRowActions = true, manualSorting = false, onSortChange, onColumnReorderChange, onRowSelectionChange, fullWidth = false, pageSize, page: pageProp, defaultPage = 1, onPageChange, ...rest }) {
|
|
98
|
-
const
|
|
98
|
+
const [rowOrdering, setRowOrdering] = useState([]);
|
|
99
|
+
const data = useMemo(() => {
|
|
100
|
+
const items = dataProp ?? [];
|
|
101
|
+
if (!rowOrdering.length) return items;
|
|
102
|
+
const rank = /* @__PURE__ */ new Map();
|
|
103
|
+
rowOrdering.forEach((id, index) => {
|
|
104
|
+
rank.set(id, index);
|
|
105
|
+
});
|
|
106
|
+
const slots = new Array(rowOrdering.length);
|
|
107
|
+
const unranked = [];
|
|
108
|
+
for (const item of items) {
|
|
109
|
+
const slot = rank.get(String(item.id));
|
|
110
|
+
if (slot === void 0 || slots[slot] !== void 0) unranked.push(item);
|
|
111
|
+
else slots[slot] = item;
|
|
112
|
+
}
|
|
113
|
+
const ordered = [];
|
|
114
|
+
for (const slot of slots) if (slot !== void 0) ordered.push(slot);
|
|
115
|
+
for (const item of unranked) ordered.push(item);
|
|
116
|
+
return ordered;
|
|
117
|
+
}, [dataProp, rowOrdering]);
|
|
99
118
|
const [rowSelection, setRowSelection] = useState(rowSelectionProp ?? {});
|
|
100
119
|
const [columnSelection, setColumnSelection] = useState(null);
|
|
101
120
|
const [rowPinning, setRowPinning] = useState({
|
|
@@ -112,45 +131,16 @@ function Table({ children, columns: columnsProp, data: dataProp, showCheckbox, r
|
|
|
112
131
|
setCurrentPage((typeof updater === "function" ? updater(pagination) : updater).pageIndex + 1);
|
|
113
132
|
}, [pagination, setCurrentPage]);
|
|
114
133
|
/**
|
|
115
|
-
* moveUpSelectedRows moves the selected rows up in the table.
|
|
116
|
-
* It finds the first selected row, determines its index,
|
|
117
|
-
* and moves it before the previous row if it exists.
|
|
118
|
-
*/
|
|
119
|
-
const moveRowsUp = useCallback((row, rows) => {
|
|
120
|
-
const rowsToMove = rowSelection[row.id] ? rows.filter(({ id }) => rowSelection[id]) : [row];
|
|
121
|
-
const firstRowToMove = rowsToMove[0];
|
|
122
|
-
if (!firstRowToMove || firstRowToMove.index === 0) return;
|
|
123
|
-
const prevRowId = rows[firstRowToMove.index - 1]?.id;
|
|
124
|
-
if (!prevRowId) return;
|
|
125
|
-
moveBefore(prevRowId, rowsToMove.map(({ id }) => id));
|
|
126
|
-
}, [rowSelection, moveBefore]);
|
|
127
|
-
/**
|
|
128
|
-
* moveDownRows moves the selected or active rows down in the table.
|
|
129
|
-
* It finds the last selected row, determines its index,
|
|
130
|
-
* and moves it after the next row if it exists.
|
|
131
|
-
*/
|
|
132
|
-
const moveRowsDown = useCallback((row, rows) => {
|
|
133
|
-
const rowsToMove = rowSelection[row.id] ? rows.filter(({ id }) => rowSelection[id]) : [row];
|
|
134
|
-
const lastRowToMove = rowsToMove[rowsToMove.length - 1];
|
|
135
|
-
if (!lastRowToMove || lastRowToMove.index === rows.length - 1) return;
|
|
136
|
-
const nextRowId = rows[lastRowToMove.index + 1]?.id;
|
|
137
|
-
if (!nextRowId) return;
|
|
138
|
-
moveAfter(nextRowId, rowsToMove.map(({ id }) => id));
|
|
139
|
-
}, [rowSelection, moveAfter]);
|
|
140
|
-
/**
|
|
141
134
|
* actionColumn defines the actions available in the kebab menu for each row.
|
|
142
|
-
* It includes options to move the row up or down in the table.
|
|
135
|
+
* It includes options to move the row up or down in the table. Moves go
|
|
136
|
+
* through the table's rowOrderingFeature APIs, which are identity-stable, so
|
|
137
|
+
* this column def never has to be recreated.
|
|
143
138
|
*/
|
|
144
139
|
const actionColumn = useMemo(() => ({
|
|
145
140
|
id: "kebab",
|
|
146
|
-
cell: ({ row }) => /* @__PURE__ */ jsx(RowActionsMenu, {
|
|
147
|
-
moveRowsUp,
|
|
148
|
-
moveRowsDown,
|
|
149
|
-
row,
|
|
150
|
-
rows: getRowModel().rows
|
|
151
|
-
}),
|
|
141
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(RowActionsMenu, { row }),
|
|
152
142
|
size: META_COLUMN_WIDTH
|
|
153
|
-
}), [
|
|
143
|
+
}), []);
|
|
154
144
|
/**
|
|
155
145
|
* columns defines the structure of the table.
|
|
156
146
|
* It includes the action column and optionally a checkbox column.
|
|
@@ -173,13 +163,13 @@ function Table({ children, columns: columnsProp, data: dataProp, showCheckbox, r
|
|
|
173
163
|
id: "selection",
|
|
174
164
|
header: ({ table }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
175
165
|
isSelected: table.getIsAllRowsSelected(),
|
|
176
|
-
isIndeterminate: table.getIsSomeRowsSelected(),
|
|
166
|
+
isIndeterminate: table.getIsSomeRowsSelected() && !table.getIsAllRowsSelected(),
|
|
177
167
|
onChange: table.toggleAllRowsSelected
|
|
178
168
|
}),
|
|
179
169
|
cell: ({ row }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
180
170
|
isSelected: row.getIsSelected(),
|
|
181
171
|
isIndeterminate: row.getIsSomeSelected(),
|
|
182
|
-
onChange: row.toggleSelected
|
|
172
|
+
onChange: (isSelected) => row.toggleSelected(isSelected)
|
|
183
173
|
}),
|
|
184
174
|
size: META_COLUMN_WIDTH
|
|
185
175
|
}] : [],
|
|
@@ -202,7 +192,8 @@ function Table({ children, columns: columnsProp, data: dataProp, showCheckbox, r
|
|
|
202
192
|
setRowSelection(updaterOrValue);
|
|
203
193
|
onRowSelectionChange?.(updaterOrValue);
|
|
204
194
|
}, [onRowSelectionChange]);
|
|
205
|
-
const { getHeaderGroups, getTopRows, getCenterRows, getBottomRows,
|
|
195
|
+
const { getHeaderGroups, getTopRows, getCenterRows, getBottomRows, setColumnOrder } = useTable({
|
|
196
|
+
features: tableFeatures$1,
|
|
206
197
|
data,
|
|
207
198
|
columns,
|
|
208
199
|
enableSorting,
|
|
@@ -213,6 +204,7 @@ function Table({ children, columns: columnsProp, data: dataProp, showCheckbox, r
|
|
|
213
204
|
state: {
|
|
214
205
|
rowSelection,
|
|
215
206
|
rowPinning,
|
|
207
|
+
rowOrdering,
|
|
216
208
|
...pagination != null && { pagination }
|
|
217
209
|
},
|
|
218
210
|
getRowId: (row, index) => {
|
|
@@ -221,12 +213,11 @@ function Table({ children, columns: columnsProp, data: dataProp, showCheckbox, r
|
|
|
221
213
|
enableRowSelection: true,
|
|
222
214
|
enableRowPinning: true,
|
|
223
215
|
manualSorting,
|
|
216
|
+
manualPagination: pagination == null,
|
|
224
217
|
onRowSelectionChange: handleRowSelectionChange,
|
|
225
218
|
onRowPinningChange: setRowPinning,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
getSortedRowModel: getSortedRowModel(),
|
|
229
|
-
...pageSize != null && { getPaginationRowModel: getPaginationRowModel() }
|
|
219
|
+
onRowOrderingChange: setRowOrdering,
|
|
220
|
+
onPaginationChange: handlePaginationChange
|
|
230
221
|
});
|
|
231
222
|
const moveColumnLeft = useCallback((oldIndex) => {
|
|
232
223
|
setColumnOrder((order) => {
|