doom-design-system 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.module.css +121 -124
- package/dist/components/ActionRow/ActionRow.module.css +25 -24
- package/dist/components/Alert/Alert.module.css +74 -76
- package/dist/components/Avatar/Avatar.module.css +66 -66
- package/dist/components/Badge/Badge.module.css +50 -48
- package/dist/components/Breadcrumbs/Breadcrumbs.module.css +32 -33
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.module.css +150 -152
- package/dist/components/Card/Card.module.css +37 -39
- package/dist/components/Chart/Chart.module.css +213 -245
- package/dist/components/Chart/behaviors/DraggablePuck.d.ts +36 -0
- package/dist/components/Chart/behaviors/DraggablePuck.js +94 -0
- package/dist/components/Chart/behaviors/Markers.js +6 -4
- package/dist/components/Chart/behaviors/SelectionUpdate.js +2 -4
- package/dist/components/Chart/behaviors/index.d.ts +1 -1
- package/dist/components/Chart/behaviors/index.js +1 -1
- package/dist/components/Chart/engine/CoordinateSystem.d.ts +59 -0
- package/dist/components/Chart/engine/CoordinateSystem.js +126 -0
- package/dist/components/Chart/engine/Engine.d.ts +102 -0
- package/dist/components/Chart/engine/Engine.js +226 -0
- package/dist/components/Chart/engine/Scheduler.d.ts +59 -0
- package/dist/components/Chart/engine/Scheduler.js +139 -0
- package/dist/components/Chart/engine/SpatialMap.d.ts +114 -0
- package/dist/components/Chart/engine/SpatialMap.js +270 -0
- package/dist/components/Chart/engine/index.d.ts +13 -0
- package/dist/components/Chart/engine/index.js +9 -0
- package/dist/components/Chart/engine/types.d.ts +137 -0
- package/dist/components/Chart/engine/types.js +47 -0
- package/dist/components/Chart/hooks/useEngine.d.ts +43 -0
- package/dist/components/Chart/hooks/useEngine.js +128 -0
- package/dist/components/Chart/sensors/DataHoverSensor/DataHoverSensor.d.ts +17 -19
- package/dist/components/Chart/sensors/DataHoverSensor/DataHoverSensor.js +38 -51
- package/dist/components/Chart/sensors/DragSensor/DragSensor.d.ts +38 -0
- package/dist/components/Chart/sensors/DragSensor/DragSensor.js +105 -0
- package/dist/components/Chart/sensors/DragSensor/index.d.ts +2 -0
- package/dist/components/Chart/sensors/DragSensor/index.js +1 -0
- package/dist/components/Chart/sensors/{KeyboardSensor.d.ts → KeyboardSensor/KeyboardSensor.d.ts} +1 -1
- package/dist/components/Chart/sensors/KeyboardSensor/KeyboardSensor.js +86 -0
- package/dist/components/Chart/sensors/KeyboardSensor/index.d.ts +1 -0
- package/dist/components/Chart/sensors/KeyboardSensor/index.js +1 -0
- package/dist/components/Chart/sensors/{SelectionSensor.d.ts → SelectionSensor/SelectionSensor.d.ts} +2 -2
- package/dist/components/Chart/sensors/SelectionSensor/SelectionSensor.js +39 -0
- package/dist/components/Chart/sensors/SelectionSensor/index.d.ts +1 -0
- package/dist/components/Chart/sensors/SelectionSensor/index.js +1 -0
- package/dist/components/Chart/sensors/SensorManager/SensorManager.js +36 -41
- package/dist/components/Chart/sensors/index.d.ts +1 -0
- package/dist/components/Chart/sensors/index.js +3 -2
- package/dist/components/Chart/sensors/utils/search.d.ts +1 -1
- package/dist/components/Chart/sensors/utils/search.js +25 -4
- package/dist/components/Chart/state/store/chart.store.js +18 -0
- package/dist/components/Chart/state/store/slices/series.slice.d.ts +1 -0
- package/dist/components/Chart/state/store/slices/series.slice.js +3 -2
- package/dist/components/Chart/subcomponents/Axis/Axis.module.css +32 -33
- package/dist/components/Chart/subcomponents/BarSeries/BarSeries.js +6 -1
- package/dist/components/Chart/subcomponents/BarSeries/BarSeries.module.css +11 -9
- package/dist/components/Chart/subcomponents/Cursor/Cursor.js +8 -1
- package/dist/components/Chart/subcomponents/Cursor/Cursor.module.css +14 -13
- package/dist/components/Chart/subcomponents/CustomSeries/CustomSeries.js +4 -0
- package/dist/components/Chart/subcomponents/CustomSeries/CustomSeries.module.css +5 -3
- package/dist/components/Chart/subcomponents/Footer/Footer.module.css +5 -3
- package/dist/components/Chart/subcomponents/Grid/Grid.module.css +12 -11
- package/dist/components/Chart/subcomponents/Header/Header.module.css +8 -7
- package/dist/components/Chart/subcomponents/InteractionLayer/InteractionLayer.d.ts +4 -4
- package/dist/components/Chart/subcomponents/InteractionLayer/InteractionLayer.js +39 -76
- package/dist/components/Chart/subcomponents/Legend/Legend.module.css +30 -32
- package/dist/components/Chart/subcomponents/LineSeries/LineSeries.js +9 -3
- package/dist/components/Chart/subcomponents/LineSeries/LineSeries.module.css +21 -21
- package/dist/components/Chart/subcomponents/Root/Root.js +113 -7
- package/dist/components/Chart/subcomponents/Root/Root.module.css +70 -82
- package/dist/components/Chart/subcomponents/ScatterSeries/ScatterSeries.js +6 -1
- package/dist/components/Chart/subcomponents/ScatterSeries/ScatterSeries.module.css +7 -5
- package/dist/components/Chart/subcomponents/Series/Series.module.css +118 -128
- package/dist/components/Chart/subcomponents/SeriesPoint/SeriesPoint.module.css +10 -8
- package/dist/components/Chart/subcomponents/Tooltip/Tooltip.js +2 -3
- package/dist/components/Chart/subcomponents/Tooltip/Tooltip.module.css +52 -67
- package/dist/components/Chart/types/context.d.ts +9 -0
- package/dist/components/Chart/types/events.d.ts +5 -7
- package/dist/components/Chart/types/interaction.d.ts +24 -2
- package/dist/components/Chart/types/interaction.js +1 -0
- package/dist/components/Checkbox/Checkbox.module.css +57 -59
- package/dist/components/Chip/Chip.module.css +105 -115
- package/dist/components/Combobox/Combobox.d.ts +2 -1
- package/dist/components/Combobox/Combobox.js +2 -2
- package/dist/components/Combobox/Combobox.module.css +233 -210
- package/dist/components/CopyButton/CopyButton.module.css +84 -90
- package/dist/components/Drawer/Drawer.module.css +126 -145
- package/dist/components/Dropdown/Dropdown.d.ts +3 -1
- package/dist/components/Dropdown/Dropdown.js +3 -3
- package/dist/components/Dropdown/Dropdown.module.css +52 -32
- package/dist/components/FileUpload/FileUpload.js +24 -0
- package/dist/components/FileUpload/FileUpload.module.css +295 -313
- package/dist/components/Form/Form.module.css +35 -39
- package/dist/components/Image/Image.module.css +53 -54
- package/dist/components/Input/Input.d.ts +4 -2
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Input/Input.module.css +135 -119
- package/dist/components/Label/Label.module.css +17 -15
- package/dist/components/Layout/Layout.module.css +95 -111
- package/dist/components/Link/Link.module.css +67 -65
- package/dist/components/Modal/Modal.module.css +112 -132
- package/dist/components/Page/Page.module.css +21 -21
- package/dist/components/Pagination/Pagination.module.css +56 -56
- package/dist/components/Popover/Popover.module.css +17 -16
- package/dist/components/ProgressBar/ProgressBar.module.css +36 -37
- package/dist/components/RadioGroup/RadioGroup.module.css +74 -77
- package/dist/components/Select/Select.d.ts +2 -1
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/Select.module.css +133 -98
- package/dist/components/Sheet/Sheet.module.css +134 -154
- package/dist/components/Sidebar/Sidebar.module.css +72 -74
- package/dist/components/Sidebar/subcomponents/Footer/Footer.module.css +7 -5
- package/dist/components/Sidebar/subcomponents/Group/Group.module.css +80 -85
- package/dist/components/Sidebar/subcomponents/Header/Header.module.css +12 -10
- package/dist/components/Sidebar/subcomponents/Item/Item.module.css +54 -55
- package/dist/components/Sidebar/subcomponents/MobileOverlay/MobileOverlay.module.css +38 -38
- package/dist/components/Sidebar/subcomponents/MobileTrigger/MobileTrigger.module.css +5 -3
- package/dist/components/Sidebar/subcomponents/Nav/Nav.module.css +13 -11
- package/dist/components/Sidebar/subcomponents/Rail/Rail.module.css +62 -63
- package/dist/components/Sidebar/subcomponents/Section/Section.module.css +86 -91
- package/dist/components/Skeleton/Skeleton.module.css +28 -26
- package/dist/components/Slat/Slat.module.css +93 -94
- package/dist/components/Slider/Slider.module.css +116 -121
- package/dist/components/Spinner/Spinner.module.css +28 -27
- package/dist/components/SplitButton/SplitButton.d.ts +3 -1
- package/dist/components/SplitButton/SplitButton.js +2 -2
- package/dist/components/SplitButton/SplitButton.module.css +104 -87
- package/dist/components/Switch/Switch.module.css +64 -63
- package/dist/components/Table/FilterBuilder/FilterBuilder.module.css +36 -36
- package/dist/components/Table/FilterBuilder/FilterConditionRow.js +1 -1
- package/dist/components/Table/FilterBuilder/FilterConditionRow.module.css +21 -22
- package/dist/components/Table/FilterBuilder/FilterGroup.js +4 -4
- package/dist/components/Table/FilterBuilder/FilterGroup.module.css +355 -389
- package/dist/components/Table/FilterBuilder/FilterSheet.module.css +68 -71
- package/dist/components/Table/Table.d.ts +4 -2
- package/dist/components/Table/Table.js +50 -13
- package/dist/components/Table/Table.module.css +210 -188
- package/dist/components/Table/TableHeaderFilter.js +1 -1
- package/dist/components/Table/TableHeaderFilter.module.css +51 -57
- package/dist/components/Tabs/Tabs.module.css +79 -80
- package/dist/components/Text/Text.module.css +108 -131
- package/dist/components/Textarea/Textarea.d.ts +3 -1
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.module.css +114 -94
- package/dist/components/Toast/Toast.module.css +82 -82
- package/dist/components/Tooltip/Tooltip.module.css +17 -16
- package/dist/styles/globals.css +1677 -1691
- package/dist/styles/palettes.d.ts +0 -5
- package/dist/styles/palettes.js +0 -8
- package/dist/styles/themes/definitions.d.ts +0 -8
- package/dist/styles/themes/definitions.js +117 -5
- package/dist/styles/types.d.ts +2 -0
- package/dist/styles/types.js +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/.agent/skills/doom/a2ui/a2ui-examples.md +0 -289
- package/.agent/skills/doom/a2ui/a2ui-principles.md +0 -49
- package/.agent/skills/doom/a2ui/a2ui-protocol.md +0 -191
- package/.agent/skills/doom/components/a2ui.md +0 -46
- package/.agent/skills/doom/components/accordion.md +0 -44
- package/.agent/skills/doom/components/actionrow.md +0 -33
- package/.agent/skills/doom/components/alert.md +0 -35
- package/.agent/skills/doom/components/avatar.md +0 -36
- package/.agent/skills/doom/components/badge.md +0 -29
- package/.agent/skills/doom/components/breadcrumbs.md +0 -33
- package/.agent/skills/doom/components/button.md +0 -43
- package/.agent/skills/doom/components/card.md +0 -41
- package/.agent/skills/doom/components/chart.md +0 -106
- package/.agent/skills/doom/components/checkbox.md +0 -38
- package/.agent/skills/doom/components/chip.md +0 -35
- package/.agent/skills/doom/components/combobox.md +0 -50
- package/.agent/skills/doom/components/copybutton.md +0 -41
- package/.agent/skills/doom/components/drawer.md +0 -69
- package/.agent/skills/doom/components/dropdown.md +0 -33
- package/.agent/skills/doom/components/fileupload.md +0 -49
- package/.agent/skills/doom/components/form.md +0 -55
- package/.agent/skills/doom/components/icon.md +0 -47
- package/.agent/skills/doom/components/image.md +0 -48
- package/.agent/skills/doom/components/input.md +0 -54
- package/.agent/skills/doom/components/label.md +0 -32
- package/.agent/skills/doom/components/layout.md +0 -92
- package/.agent/skills/doom/components/link.md +0 -39
- package/.agent/skills/doom/components/modal.md +0 -71
- package/.agent/skills/doom/components/page.md +0 -41
- package/.agent/skills/doom/components/pagination.md +0 -32
- package/.agent/skills/doom/components/popover.md +0 -45
- package/.agent/skills/doom/components/progressbar.md +0 -37
- package/.agent/skills/doom/components/radiogroup.md +0 -45
- package/.agent/skills/doom/components/select.md +0 -43
- package/.agent/skills/doom/components/sheet.md +0 -71
- package/.agent/skills/doom/components/sidebar.md +0 -92
- package/.agent/skills/doom/components/skeleton.md +0 -35
- package/.agent/skills/doom/components/slat.md +0 -46
- package/.agent/skills/doom/components/slider.md +0 -51
- package/.agent/skills/doom/components/spinner.md +0 -34
- package/.agent/skills/doom/components/splitbutton.md +0 -35
- package/.agent/skills/doom/components/switch.md +0 -40
- package/.agent/skills/doom/components/table.md +0 -82
- package/.agent/skills/doom/components/tabs.md +0 -65
- package/.agent/skills/doom/components/text.md +0 -42
- package/.agent/skills/doom/components/textarea.md +0 -46
- package/.agent/skills/doom/components/toast.md +0 -59
- package/.agent/skills/doom/components/tooltip.md +0 -35
- package/.agent/skills/doom/index.md +0 -167
- package/.agent/skills/doom/styles/aesthetic.md +0 -151
- package/.agent/skills/doom/styles/css-variables.md +0 -80
- package/.agent/skills/doom/styles/mixins.md +0 -97
- package/.agent/skills/doom/styles/tokens.md +0 -129
- package/.agent/skills/doom/styles/utilities.md +0 -84
- package/dist/components/Chart/sensors/KeyboardSensor.js +0 -82
- package/dist/components/Chart/sensors/SelectionSensor.js +0 -41
|
@@ -1,72 +1,69 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.emptyState {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.addSiblingButton {
|
|
71
|
-
margin-top: var(--spacing-2);
|
|
1
|
+
@layer doom.components {
|
|
2
|
+
.conditionList {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--space-2);
|
|
6
|
+
margin-bottom: var(--space-4);
|
|
7
|
+
}
|
|
8
|
+
.emptyState {
|
|
9
|
+
padding: var(--space-6);
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-size: var(--text-sm);
|
|
12
|
+
color: var(--on-surface-muted);
|
|
13
|
+
background: var(--surface-accent);
|
|
14
|
+
border-radius: var(--radius-md);
|
|
15
|
+
text-transform: uppercase;
|
|
16
|
+
letter-spacing: 0.05em;
|
|
17
|
+
}
|
|
18
|
+
.logicToggle {
|
|
19
|
+
align-self: center;
|
|
20
|
+
padding: var(--space-1) var(--space-2);
|
|
21
|
+
font-family: var(--font-family);
|
|
22
|
+
font-size: var(--text-xs);
|
|
23
|
+
font-weight: var(--font-bold);
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
letter-spacing: 0.1em;
|
|
26
|
+
color: var(--primary);
|
|
27
|
+
background: transparent;
|
|
28
|
+
border: var(--surface-border-width) solid var(--primary);
|
|
29
|
+
border-radius: var(--radius-md);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
transition: all var(--duration-fast) var(--ease-in-out);
|
|
32
|
+
}
|
|
33
|
+
.logicToggle:hover {
|
|
34
|
+
background: var(--primary);
|
|
35
|
+
color: var(--primary-foreground);
|
|
36
|
+
}
|
|
37
|
+
.logicToggle:focus-visible {
|
|
38
|
+
outline: none;
|
|
39
|
+
transform: translate(calc(-1 * var(--space-0\.5)), calc(-1 * var(--space-0\.5)));
|
|
40
|
+
box-shadow: var(--shadow-offset-xl) var(--shadow-primary);
|
|
41
|
+
border-color: var(--primary);
|
|
42
|
+
}
|
|
43
|
+
.logicToggle:focus {
|
|
44
|
+
outline: none;
|
|
45
|
+
}
|
|
46
|
+
.addButton {
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
.siblingLogic {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
padding: var(--space-2) 0;
|
|
54
|
+
}
|
|
55
|
+
.siblingLogic span {
|
|
56
|
+
padding: var(--space-1) var(--space-2);
|
|
57
|
+
font-size: var(--text-xs);
|
|
58
|
+
font-weight: var(--font-bold);
|
|
59
|
+
text-transform: uppercase;
|
|
60
|
+
letter-spacing: 0.1em;
|
|
61
|
+
color: var(--secondary-foreground);
|
|
62
|
+
background: var(--secondary);
|
|
63
|
+
border: var(--surface-border-width) solid var(--secondary);
|
|
64
|
+
border-radius: var(--radius-md);
|
|
65
|
+
}
|
|
66
|
+
.addSiblingButton {
|
|
67
|
+
margin-top: var(--space-2);
|
|
68
|
+
}
|
|
72
69
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnDef } from "@tanstack/react-table";
|
|
1
|
+
import { ColumnDef, Row } from "@tanstack/react-table";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { type FilterOperatorKey } from "./FilterBuilder/FilterBuilder";
|
|
4
4
|
import type { FilterGroupItem } from "./FilterBuilder/FilterGroup";
|
|
@@ -36,5 +36,7 @@ export interface TableProps<T> {
|
|
|
36
36
|
operators?: FilterOperatorKey[];
|
|
37
37
|
}[];
|
|
38
38
|
striped?: boolean;
|
|
39
|
+
onRowClick?: (row: Row<T>, e: React.MouseEvent) => void;
|
|
40
|
+
renderExpandedRow?: (row: Row<T>) => React.ReactNode | null;
|
|
39
41
|
}
|
|
40
|
-
export declare function Table<T>({ data, columns, enablePagination, enableFiltering, enableColumnFilters, enableSorting, enableVirtualization, enableAdvancedFiltering, onAdvancedFilterChange, pageSize, height, className, style, variant, density, toolbarContent, filters, striped, maxHeight, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function Table<T>({ data, columns, enablePagination, enableFiltering, enableColumnFilters, enableSorting, enableVirtualization, enableAdvancedFiltering, onAdvancedFilterChange, pageSize, height, className, style, variant, density, toolbarContent, filters, striped, maxHeight, onRowClick, renderExpandedRow, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { flexRender, getCoreRowModel, getFacetedUniqueValues, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from "@tanstack/react-table";
|
|
2
|
+
import { flexRender, getCoreRowModel, getExpandedRowModel, getFacetedUniqueValues, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from "@tanstack/react-table";
|
|
3
3
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { Filter, ListFilter, Search } from "lucide-react";
|
|
6
|
-
import { useMemo, useState } from "react";
|
|
5
|
+
import { ChevronRight, Filter, ListFilter, Search } from "lucide-react";
|
|
6
|
+
import React, { useMemo, useState } from "react";
|
|
7
7
|
import { Button } from "../Button/Button.js";
|
|
8
8
|
import { Chip } from "../Chip/Chip.js";
|
|
9
9
|
import { Input } from "../Input/Input.js";
|
|
@@ -19,6 +19,7 @@ const coreRowModel = getCoreRowModel();
|
|
|
19
19
|
const sortedRowModel = getSortedRowModel();
|
|
20
20
|
const paginationRowModel = getPaginationRowModel();
|
|
21
21
|
const filteredRowModel = getFilteredRowModel();
|
|
22
|
+
const expandedRowModel = getExpandedRowModel();
|
|
22
23
|
const convertToFilterNode = (item) => {
|
|
23
24
|
if (item.type === "group") {
|
|
24
25
|
return {
|
|
@@ -35,7 +36,7 @@ const convertToFilterNode = (item) => {
|
|
|
35
36
|
logic: item.logic,
|
|
36
37
|
};
|
|
37
38
|
};
|
|
38
|
-
function VirtualTableBody({ table, columns, striped, density, scrollElement, }) {
|
|
39
|
+
function VirtualTableBody({ table, columns, striped, density, scrollElement, onRowClick, renderExpandedRow, totalColumns, }) {
|
|
39
40
|
const { rows } = table.getRowModel();
|
|
40
41
|
const rowVirtualizer = useVirtualizer({
|
|
41
42
|
count: rows.length,
|
|
@@ -47,20 +48,30 @@ function VirtualTableBody({ table, columns, striped, density, scrollElement, })
|
|
|
47
48
|
height: `${rowVirtualizer.getVirtualItems()[0].start}px`,
|
|
48
49
|
}, children: _jsx("td", { colSpan: columns.length, style: { border: 0, padding: 0 } }) })), rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
49
50
|
const row = rows[virtualRow.index];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const expandedContent = row.getIsExpanded() && renderExpandedRow
|
|
52
|
+
? renderExpandedRow(row)
|
|
53
|
+
: null;
|
|
54
|
+
return (_jsxs(React.Fragment, { children: [_jsx("tr", { ref: rowVirtualizer.measureElement, className: clsx(styles.tr, {
|
|
55
|
+
[styles.striped]: striped && virtualRow.index % 2 !== 0,
|
|
56
|
+
[styles.clickable]: !!onRowClick,
|
|
57
|
+
}), "data-index": virtualRow.index, onClick: onRowClick ? (e) => onRowClick(row, e) : undefined, children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[`density-${density}`], cell.column.id === "__expand" && styles.expandCol), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }), expandedContent && (_jsx("tr", { className: styles.expandedRow, children: _jsx("td", { colSpan: totalColumns, children: expandedContent }) }))] }, row.id));
|
|
53
58
|
}), rowVirtualizer.getVirtualItems().length > 0 && (_jsx("tr", { style: {
|
|
54
59
|
height: `${rowVirtualizer.getTotalSize() -
|
|
55
60
|
rowVirtualizer.getVirtualItems()[rowVirtualizer.getVirtualItems().length - 1].end}px`,
|
|
56
61
|
}, children: _jsx("td", { colSpan: columns.length, style: { border: 0, padding: 0 } }) }))] }));
|
|
57
62
|
}
|
|
58
|
-
function StandardTableBody({ table, striped, density }) {
|
|
59
|
-
return (_jsx("tbody", { children: table.getRowModel().rows.map((row) =>
|
|
63
|
+
function StandardTableBody({ table, striped, density, onRowClick, renderExpandedRow, totalColumns, }) {
|
|
64
|
+
return (_jsx("tbody", { children: table.getRowModel().rows.map((row) => {
|
|
65
|
+
const expandedContent = row.getIsExpanded() && renderExpandedRow
|
|
66
|
+
? renderExpandedRow(row)
|
|
67
|
+
: null;
|
|
68
|
+
return (_jsxs(React.Fragment, { children: [_jsx("tr", { className: clsx(styles.tr, striped && styles.striped, onRowClick && styles.clickable, "group"), onClick: onRowClick ? (e) => onRowClick(row, e) : undefined, children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density], cell.column.id === "__expand" && styles.expandCol), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }), expandedContent && (_jsx("tr", { className: styles.expandedRow, children: _jsx("td", { colSpan: totalColumns, children: expandedContent }) }))] }, row.id));
|
|
69
|
+
}) }));
|
|
60
70
|
}
|
|
61
|
-
export function Table({ data, columns, enablePagination = true, enableFiltering = true, enableColumnFilters = true, enableSorting = true, enableVirtualization = false, enableAdvancedFiltering = false, onAdvancedFilterChange, pageSize = 10, height, className, style, variant = "default", density = "standard", toolbarContent, filters, striped = false, maxHeight, }) {
|
|
71
|
+
export function Table({ data, columns, enablePagination = true, enableFiltering = true, enableColumnFilters = true, enableSorting = true, enableVirtualization = false, enableAdvancedFiltering = false, onAdvancedFilterChange, pageSize = 10, height, className, style, variant = "default", density = "standard", toolbarContent, filters, striped = false, maxHeight, onRowClick, renderExpandedRow, }) {
|
|
62
72
|
var _a;
|
|
63
73
|
const [sorting, setSorting] = useState([]);
|
|
74
|
+
const [expanded, setExpanded] = useState({});
|
|
64
75
|
const [globalFilter, setGlobalFilter] = useState("");
|
|
65
76
|
const [columnFilters, setColumnFilters] = useState([]);
|
|
66
77
|
const [isFilterExpanded, setIsFilterExpanded] = useState(true);
|
|
@@ -114,24 +125,50 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
|
|
|
114
125
|
return Object.assign(Object.assign({}, col), { id: `column-${index}` });
|
|
115
126
|
});
|
|
116
127
|
}, [columns]);
|
|
128
|
+
const finalColumns = useMemo(() => {
|
|
129
|
+
if (!renderExpandedRow) {
|
|
130
|
+
return normalizedColumns;
|
|
131
|
+
}
|
|
132
|
+
const expandColumn = {
|
|
133
|
+
id: "__expand",
|
|
134
|
+
header: "",
|
|
135
|
+
size: 40,
|
|
136
|
+
enableSorting: false,
|
|
137
|
+
enableColumnFilter: false,
|
|
138
|
+
cell: ({ row }) => {
|
|
139
|
+
const content = renderExpandedRow(row);
|
|
140
|
+
if (!content) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return (_jsx("button", { "aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row", className: styles.expandToggle, onClick: (e) => {
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
row.toggleExpanded();
|
|
146
|
+
}, children: _jsx(ChevronRight, { className: clsx(styles.expandToggleIcon, row.getIsExpanded() && styles.expanded), size: 20 }) }));
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
return [expandColumn, ...normalizedColumns];
|
|
150
|
+
}, [normalizedColumns, renderExpandedRow]);
|
|
117
151
|
const table = useReactTable({
|
|
118
152
|
data: filteredData,
|
|
119
|
-
columns:
|
|
153
|
+
columns: finalColumns,
|
|
120
154
|
state: {
|
|
121
155
|
sorting,
|
|
122
156
|
globalFilter,
|
|
123
157
|
columnFilters,
|
|
124
158
|
pagination,
|
|
159
|
+
expanded,
|
|
125
160
|
},
|
|
126
161
|
enableSorting,
|
|
127
162
|
onSortingChange: setSorting,
|
|
128
163
|
onGlobalFilterChange: setGlobalFilter,
|
|
129
164
|
onColumnFiltersChange: setColumnFilters,
|
|
130
165
|
onPaginationChange: setPagination,
|
|
166
|
+
onExpandedChange: setExpanded,
|
|
131
167
|
getCoreRowModel: coreRowModel,
|
|
132
168
|
getSortedRowModel: sortedRowModel,
|
|
133
169
|
getPaginationRowModel: enablePagination ? paginationRowModel : undefined,
|
|
134
170
|
getFilteredRowModel: enableFiltering || enableColumnFilters ? filteredRowModel : undefined,
|
|
171
|
+
getExpandedRowModel: renderExpandedRow ? expandedRowModel : undefined,
|
|
135
172
|
defaultColumn: {
|
|
136
173
|
filterFn: smartColumnFilterFn,
|
|
137
174
|
},
|
|
@@ -152,7 +189,7 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
|
|
|
152
189
|
height: "24px",
|
|
153
190
|
padding: "0 4px",
|
|
154
191
|
marginRight: "-4px",
|
|
155
|
-
}, variant: "ghost", onClick: () => setIsFilterBuilderOpen(true), children: _jsx(Filter, { size:
|
|
192
|
+
}, variant: "ghost", onClick: () => setIsFilterBuilderOpen(true), children: _jsx(Filter, { size: 20, strokeWidth: 2.5 }) })) : undefined, placeholder: "Search...", startAdornment: _jsx(Search, { size: 20 }), value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : "", onChange: (e) => setGlobalFilter(e.target.value) }) })), _jsxs("div", { className: styles.actionsWrapper, children: [filters && filters.length > 0 && !enableAdvancedFiltering && (_jsxs(Button, { variant: "outline", onClick: () => setIsFilterExpanded(!isFilterExpanded), children: [_jsx(ListFilter, { size: 20 }), "FILTERS"] })), toolbarContent && (_jsx("div", { className: styles.controls, children: toolbarContent }))] })] })), enableAdvancedFiltering && activeAdvancedCount > 0 && (_jsx("div", { className: styles.filterBar, children: _jsxs(Chip, { onClick: () => setIsFilterBuilderOpen(true), onDismiss: () => {
|
|
156
193
|
setAdvancedFilterValue(null);
|
|
157
194
|
onAdvancedFilterChange === null || onAdvancedFilterChange === void 0 ? void 0 : onAdvancedFilterChange(null);
|
|
158
195
|
}, children: [activeAdvancedCount, " Filter", activeAdvancedCount > 1 ? "s" : ""] }) })), !enableAdvancedFiltering &&
|
|
@@ -184,7 +221,7 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
|
|
|
184
221
|
}[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : null), enableColumnFilters &&
|
|
185
222
|
!enableAdvancedFiltering &&
|
|
186
223
|
header.column.getCanFilter() && (_jsx(TableHeaderFilter, { column: header.column }))] }) }, header.id));
|
|
187
|
-
}) }, headerGroup.id))) }), isVirtual ? (_jsx(VirtualTableBody, { columns:
|
|
224
|
+
}) }, headerGroup.id))) }), isVirtual ? (_jsx(VirtualTableBody, { columns: finalColumns, density: density, renderExpandedRow: renderExpandedRow, scrollElement: scrollElement, striped: striped, table: table, totalColumns: finalColumns.length, onRowClick: onRowClick })) : (_jsx(StandardTableBody, { columns: finalColumns, density: density, renderExpandedRow: renderExpandedRow, striped: striped, table: table, totalColumns: finalColumns.length, onRowClick: onRowClick }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { className: styles.noResults, children: "No results found." }))] }), enablePagination && !isVirtual && (_jsx("div", { className: styles.paginationContainer, children: _jsxs(Flex, { align: "center", gap: 4, style: { width: "100%", justifyContent: "space-between" }, children: [_jsx("div", { style: { flexShrink: 0 }, children: _jsx(Select, { options: [
|
|
188
225
|
{ value: 10, label: "10 rows" },
|
|
189
226
|
{ value: 20, label: "20 rows" },
|
|
190
227
|
{ value: 50, label: "50 rows" },
|