@dmsi/wedgekit-react 0.0.26 → 0.0.27
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/{chunk-KDEPZ6I7.js → chunk-2S2Z3L56.js} +5 -1
- package/dist/{chunk-TU55CHXU.js → chunk-4JLU7TAC.js} +3 -1
- package/dist/{chunk-Z2LOGSGE.js → chunk-4N2PED4P.js} +15 -3
- package/dist/{chunk-U42SKNR6.js → chunk-57WRM337.js} +68 -30
- package/dist/{chunk-ZFGGZXB6.js → chunk-AY7ELVQY.js} +5 -2
- package/dist/{chunk-I2UVVKQI.js → chunk-CHTO7PW4.js} +3 -2
- package/dist/{chunk-WIDBAFBU.js → chunk-FWPJ73IK.js} +3 -1
- package/dist/{chunk-5TLFMKSR.js → chunk-INYI65WW.js} +15 -5
- package/dist/{chunk-TJ44JJCB.js → chunk-J6LETUNM.js} +5 -2
- package/dist/{chunk-T6HZARR7.js → chunk-MZJS2ZAU.js} +6 -3
- package/dist/{chunk-ZCBSLV7U.js → chunk-O4M2GISS.js} +5 -2
- package/dist/{chunk-OUTEIXV4.js → chunk-OUSNH76S.js} +11 -3
- package/dist/{chunk-YDREJNAS.js → chunk-PDDZ5PMY.js} +18 -4
- package/dist/{chunk-4RD5ZF2V.js → chunk-QBIEU25R.js} +10 -4
- package/dist/chunk-QUPHLL7D.js +61 -0
- package/dist/{chunk-OISE6NMA.js → chunk-QV2EFOYF.js} +17 -6
- package/dist/{chunk-YZQNTOIF.js → chunk-QZGUMB7T.js} +10 -5
- package/dist/{chunk-S7R37IUP.js → chunk-S5K22XTH.js} +5 -2
- package/dist/{chunk-GCPJH5R6.js → chunk-S5KPS4IQ.js} +22 -7
- package/dist/{chunk-VELXLFMJ.js → chunk-SAMX4YGM.js} +4 -1
- package/dist/{chunk-TWP6YSFO.js → chunk-SKHSGGO3.js} +14 -6
- package/dist/chunk-TVDFTRGL.js +57 -0
- package/dist/{chunk-N32PXOA5.js → chunk-UT7XCBZF.js} +9 -4
- package/dist/{chunk-L4UM372R.js → chunk-VC3R5EUH.js} +3 -0
- package/dist/{chunk-UIQ733QP.js → chunk-VG4EPHJA.js} +7 -3
- package/dist/components/Breadcrumbs.cjs +29 -9
- package/dist/components/Breadcrumbs.js +29 -9
- package/dist/components/Button.cjs +6 -3
- package/dist/components/Button.js +1 -1
- package/dist/components/CalendarRange.cjs +11 -3
- package/dist/components/CalendarRange.js +1 -1
- package/dist/components/Caption.cjs +53 -9
- package/dist/components/Caption.js +53 -9
- package/dist/components/Checkbox.cjs +15 -6
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/ContentTab.cjs +20 -7
- package/dist/components/ContentTab.js +2 -2
- package/dist/components/ContentTabs.cjs +32 -18
- package/dist/components/ContentTabs.js +14 -13
- package/dist/components/DMSiLogo.cjs +22 -4
- package/dist/components/DMSiLogo.js +9 -5
- package/dist/components/DataGrid.cjs +374 -243
- package/dist/components/DataGrid.js +283 -226
- package/dist/components/DataGridCell.cjs +79 -21
- package/dist/components/DataGridCell.js +7 -7
- package/dist/components/DataTable.cjs +197 -139
- package/dist/components/DataTable.js +197 -139
- package/dist/components/DateInput.cjs +36 -10
- package/dist/components/DateInput.js +7 -3
- package/dist/components/DateRangeInput.cjs +36 -10
- package/dist/components/DateRangeInput.js +7 -3
- package/dist/components/DebugJson.cjs +21 -13
- package/dist/components/DebugJson.js +21 -13
- package/dist/components/Display.cjs +5 -2
- package/dist/components/Display.js +1 -1
- package/dist/components/EditingContext.cjs +4 -1
- package/dist/components/EditingContext.js +4 -1
- package/dist/components/FilterGroup.cjs +102 -32
- package/dist/components/FilterGroup.js +41 -17
- package/dist/components/FullViewportBox.cjs +10 -2
- package/dist/components/FullViewportBox.js +10 -2
- package/dist/components/Grid.cjs +3 -1
- package/dist/components/Grid.js +3 -1
- package/dist/components/Heading.cjs +5 -2
- package/dist/components/Heading.js +1 -1
- package/dist/components/HorizontalDivider.cjs +2 -2
- package/dist/components/HorizontalDivider.js +2 -2
- package/dist/components/Input.cjs +21 -7
- package/dist/components/Input.js +2 -2
- package/dist/components/InputGroup.cjs +13 -6
- package/dist/components/InputGroup.js +9 -5
- package/dist/components/Label.cjs +5 -2
- package/dist/components/Label.js +1 -1
- package/dist/components/List.cjs +3 -2
- package/dist/components/List.js +3 -2
- package/dist/components/LogoAgilityTopBar.cjs +22 -4
- package/dist/components/LogoAgilityTopBar.js +9 -5
- package/dist/components/LogoDMSiTopBar.cjs +22 -4
- package/dist/components/LogoDMSiTopBar.js +1 -1
- package/dist/components/LogoMillworkTopBar.cjs +22 -4
- package/dist/components/LogoMillworkTopBar.js +9 -5
- package/dist/components/MainBar.cjs +2 -0
- package/dist/components/MainBar.js +2 -0
- package/dist/components/Menu.cjs +3 -0
- package/dist/components/Menu.js +1 -1
- package/dist/components/MenuOption.cjs +28 -7
- package/dist/components/MenuOption.js +3 -3
- package/dist/components/MobileDataGrid.cjs +101 -46
- package/dist/components/MobileDataGrid.js +23 -11
- package/dist/components/Modal.cjs +96 -51
- package/dist/components/Modal.js +19 -7
- package/dist/components/ModalButtons.cjs +43 -26
- package/dist/components/ModalButtons.js +2 -2
- package/dist/components/ModalContent.cjs +3 -1
- package/dist/components/ModalContent.js +1 -1
- package/dist/components/ModalHeader.cjs +40 -25
- package/dist/components/ModalHeader.js +3 -3
- package/dist/components/ModalScrim.cjs +3 -1
- package/dist/components/ModalScrim.js +1 -1
- package/dist/components/NavigationTab.cjs +9 -3
- package/dist/components/NavigationTab.js +2 -2
- package/dist/components/NavigationTabs.cjs +15 -7
- package/dist/components/NavigationTabs.js +8 -6
- package/dist/components/NestedMenu.cjs +28 -7
- package/dist/components/NestedMenu.js +3 -3
- package/dist/components/Notification.cjs +84 -38
- package/dist/components/Notification.js +8 -4
- package/dist/components/OptionPill.cjs +24 -6
- package/dist/components/OptionPill.js +3 -3
- package/dist/components/Paragraph.cjs +7 -3
- package/dist/components/Paragraph.js +1 -1
- package/dist/components/Password.cjs +33 -11
- package/dist/components/Password.js +14 -6
- package/dist/components/ProjectBar.cjs +3 -1
- package/dist/components/ProjectBar.js +3 -1
- package/dist/components/Radio.cjs +13 -7
- package/dist/components/Radio.js +7 -5
- package/dist/components/Search.cjs +34 -12
- package/dist/components/Search.js +3 -3
- package/dist/components/Select.cjs +25 -7
- package/dist/components/Select.js +3 -3
- package/dist/components/SideMenu.cjs +6 -1
- package/dist/components/SideMenu.js +6 -1
- package/dist/components/SideMenuGroup.cjs +96 -49
- package/dist/components/SideMenuGroup.js +31 -19
- package/dist/components/SideMenuItem.cjs +99 -43
- package/dist/components/SideMenuItem.js +32 -12
- package/dist/components/Stack.cjs +91 -30
- package/dist/components/Stack.js +1 -1
- package/dist/components/StatusPill.cjs +13 -6
- package/dist/components/StatusPill.js +9 -5
- package/dist/components/Stepper.cjs +35 -17
- package/dist/components/Stepper.js +11 -10
- package/dist/components/Subheader.cjs +5 -2
- package/dist/components/Subheader.js +1 -1
- package/dist/components/Surface.cjs +5 -2
- package/dist/components/Surface.js +5 -2
- package/dist/components/Swatch.cjs +1544 -1308
- package/dist/components/Swatch.js +1469 -1275
- package/dist/components/Textarea.cjs +5 -2
- package/dist/components/Textarea.js +5 -2
- package/dist/components/Theme.cjs +3 -2
- package/dist/components/Theme.js +1 -1
- package/dist/components/Time.cjs +98 -40
- package/dist/components/Time.js +18 -6
- package/dist/components/Toast.cjs +38 -15
- package/dist/components/Toast.js +23 -10
- package/dist/components/Tooltip.cjs +5 -4
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/TopBar.cjs +16 -8
- package/dist/components/TopBar.js +12 -5
- package/package.json +1 -1
- package/src/components/Breadcrumbs.tsx +24 -15
- package/src/components/Button.tsx +7 -3
- package/src/components/CalendarRange.tsx +9 -0
- package/src/components/Caption.tsx +36 -6
- package/src/components/Checkbox.tsx +7 -2
- package/src/components/ContentTab.tsx +13 -3
- package/src/components/ContentTabs.tsx +11 -8
- package/src/components/DMSiLogo.tsx +2 -1
- package/src/components/DataGrid.tsx +85 -23
- package/src/components/DataGridCell.tsx +15 -2
- package/src/components/DataTable.tsx +64 -14
- package/src/components/DateInput.tsx +5 -1
- package/src/components/DateRangeInput.tsx +5 -1
- package/src/components/DebugJson.tsx +7 -3
- package/src/components/Display.tsx +3 -0
- package/src/components/EditingContext.tsx +8 -6
- package/src/components/FilterGroup.tsx +23 -3
- package/src/components/FullViewportBox.tsx +6 -1
- package/src/components/Grid.tsx +3 -0
- package/src/components/Heading.tsx +3 -0
- package/src/components/HorizontalDivider.tsx +4 -2
- package/src/components/Input.tsx +19 -10
- package/src/components/InputGroup.tsx +8 -4
- package/src/components/Label.tsx +3 -0
- package/src/components/Link.tsx +1 -0
- package/src/components/List.tsx +7 -1
- package/src/components/LogoAgilityTopBar.tsx +2 -1
- package/src/components/LogoDMSiTopBar.tsx +2 -1
- package/src/components/LogoMillworkTopBar.tsx +2 -1
- package/src/components/MainBar.tsx +3 -0
- package/src/components/Menu.tsx +3 -0
- package/src/components/MenuOption.tsx +72 -58
- package/src/components/MobileDataGrid.tsx +15 -4
- package/src/components/Modal.tsx +10 -1
- package/src/components/ModalButtons.tsx +12 -1
- package/src/components/ModalContent.tsx +3 -0
- package/src/components/ModalHeader.tsx +16 -6
- package/src/components/ModalScrim.tsx +3 -0
- package/src/components/NavigationTab.tsx +6 -3
- package/src/components/NavigationTabs.tsx +5 -2
- package/src/components/Notification.tsx +4 -0
- package/src/components/OptionPill.tsx +9 -1
- package/src/components/Paragraph.tsx +3 -0
- package/src/components/Password.tsx +9 -3
- package/src/components/ProjectBar.tsx +3 -0
- package/src/components/Radio.tsx +3 -2
- package/src/components/Search.tsx +56 -41
- package/src/components/Select.tsx +6 -1
- package/src/components/SideMenu.tsx +7 -1
- package/src/components/SideMenuGroup.tsx +13 -2
- package/src/components/SideMenuItem.tsx +15 -2
- package/src/components/Stack.tsx +8 -3
- package/src/components/StatusPill.tsx +4 -2
- package/src/components/Stepper.tsx +5 -5
- package/src/components/Subheader.tsx +3 -0
- package/src/components/Surface.tsx +3 -0
- package/src/components/Swatch.tsx +415 -140
- package/src/components/Textarea.tsx +6 -3
- package/src/components/Theme.tsx +3 -1
- package/src/components/Time.tsx +21 -5
- package/src/components/Toast.tsx +29 -14
- package/src/components/Tooltip.tsx +46 -32
- package/src/components/TopBar.tsx +7 -3
- package/dist/chunk-DBYSGYST.js +0 -47
- package/dist/chunk-UK3WG7HQ.js +0 -48
|
@@ -9,7 +9,8 @@ export type ContentTabProps = {
|
|
|
9
9
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
10
10
|
selected?: boolean;
|
|
11
11
|
className?: string;
|
|
12
|
-
|
|
12
|
+
id?: string;
|
|
13
|
+
} & Omit<ComponentPropsWithRef<"button">, "id">;
|
|
13
14
|
|
|
14
15
|
export const ContentTab = ({
|
|
15
16
|
label,
|
|
@@ -18,6 +19,7 @@ export const ContentTab = ({
|
|
|
18
19
|
disabled = false,
|
|
19
20
|
onClick,
|
|
20
21
|
ref,
|
|
22
|
+
id,
|
|
21
23
|
...props
|
|
22
24
|
}: ContentTabProps) => {
|
|
23
25
|
const [active, setActive] = useState(false);
|
|
@@ -43,8 +45,9 @@ export const ContentTab = ({
|
|
|
43
45
|
);
|
|
44
46
|
|
|
45
47
|
return (
|
|
46
|
-
<div className="relative">
|
|
48
|
+
<div id={id} className="relative">
|
|
47
49
|
<Button
|
|
50
|
+
id={id ? `${id}-button` : undefined}
|
|
48
51
|
ref={ref}
|
|
49
52
|
variant="tertiary"
|
|
50
53
|
disabled={disabled}
|
|
@@ -58,7 +61,14 @@ export const ContentTab = ({
|
|
|
58
61
|
>
|
|
59
62
|
{label}
|
|
60
63
|
</Button>
|
|
61
|
-
{selected &&
|
|
64
|
+
{selected && (
|
|
65
|
+
<div
|
|
66
|
+
id={id ? `${id}-indicator` : undefined}
|
|
67
|
+
className={computedClassName}
|
|
68
|
+
>
|
|
69
|
+
{" "}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
62
72
|
</div>
|
|
63
73
|
);
|
|
64
74
|
};
|
|
@@ -12,12 +12,13 @@ type Tab = {
|
|
|
12
12
|
export type ContentTabsProps = {
|
|
13
13
|
tabs: Tab[];
|
|
14
14
|
onTabChange?: (tabId: string) => void;
|
|
15
|
+
id?: string;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
const afterClasses =
|
|
18
19
|
"after:absolute after:bottom-0 after:left-0 after:w-full after:h-0.5 after:bg-border-primary-normal z-0";
|
|
19
20
|
|
|
20
|
-
export const ContentTabs = ({ tabs, onTabChange }: ContentTabsProps) => {
|
|
21
|
+
export const ContentTabs = ({ tabs, onTabChange, id }: ContentTabsProps) => {
|
|
21
22
|
const [selectedTab, setSelectedTab] = useState<string>(tabs[0]?.id || "");
|
|
22
23
|
const [focusedTabIndex, setFocusedTabIndex] = useState<number>(0);
|
|
23
24
|
const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
|
|
@@ -42,9 +43,9 @@ export const ContentTabs = ({ tabs, onTabChange }: ContentTabsProps) => {
|
|
|
42
43
|
} else {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
-
setSelectedTab(
|
|
47
|
-
onTabChange?.(
|
|
46
|
+
const tabId = tabs[newIndex].id;
|
|
47
|
+
setSelectedTab(tabId);
|
|
48
|
+
onTabChange?.(tabId);
|
|
48
49
|
tabRefs.current[newIndex]?.focus();
|
|
49
50
|
setFocusedTabIndex(newIndex);
|
|
50
51
|
};
|
|
@@ -52,9 +53,10 @@ export const ContentTabs = ({ tabs, onTabChange }: ContentTabsProps) => {
|
|
|
52
53
|
const selectedContent = tabs.find((tab) => tab.id === selectedTab)?.content;
|
|
53
54
|
|
|
54
55
|
return (
|
|
55
|
-
<div>
|
|
56
|
+
<div id={id}>
|
|
56
57
|
<div className="overflow-x-auto pb-2">
|
|
57
58
|
<div
|
|
59
|
+
id={id ? `${id}-tablist` : undefined}
|
|
58
60
|
role="tablist"
|
|
59
61
|
aria-orientation="horizontal"
|
|
60
62
|
className={clsx("flex relative", afterClasses)}
|
|
@@ -65,19 +67,20 @@ export const ContentTabs = ({ tabs, onTabChange }: ContentTabsProps) => {
|
|
|
65
67
|
return (
|
|
66
68
|
<ContentTab
|
|
67
69
|
key={tab.id}
|
|
68
|
-
id={
|
|
70
|
+
id={id ? `${id}-tab-${tab.id}` : undefined}
|
|
69
71
|
label={tab.label}
|
|
70
72
|
selected={isSelected}
|
|
71
73
|
onClick={() => handleTabClick(tab.id, index)}
|
|
72
74
|
onFocus={() => {
|
|
73
75
|
setSelectedTab(tab.id);
|
|
76
|
+
|
|
74
77
|
setFocusedTabIndex(index);
|
|
75
78
|
onTabChange?.(tab.id);
|
|
76
79
|
}}
|
|
77
80
|
className={clsx(!isSelected && afterClasses)}
|
|
78
81
|
role="tab"
|
|
79
82
|
aria-selected={isSelected}
|
|
80
|
-
aria-controls={
|
|
83
|
+
aria-controls={`${id}-panel-${tab.id}`}
|
|
81
84
|
tabIndex={isSelected ? 0 : -1}
|
|
82
85
|
ref={(el) => {
|
|
83
86
|
tabRefs.current[index] = el;
|
|
@@ -89,7 +92,7 @@ export const ContentTabs = ({ tabs, onTabChange }: ContentTabsProps) => {
|
|
|
89
92
|
</div>
|
|
90
93
|
{selectedContent && (
|
|
91
94
|
<div
|
|
92
|
-
id={`panel-${selectedTab}`}
|
|
95
|
+
id={(id ? `${id}-` : "") + `panel-${selectedTab}`}
|
|
93
96
|
className="mt-2"
|
|
94
97
|
role="tabpanel"
|
|
95
98
|
aria-labelledby={`tab-${selectedTab}`}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function DMSiLogo() {
|
|
1
|
+
export function DMSiLogo(props: React.SVGProps<SVGSVGElement>) {
|
|
2
2
|
return (
|
|
3
3
|
<svg
|
|
4
4
|
width="107"
|
|
@@ -6,6 +6,7 @@ export function DMSiLogo() {
|
|
|
6
6
|
viewBox="0 0 107 24"
|
|
7
7
|
fill="none"
|
|
8
8
|
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
{...props}
|
|
9
10
|
>
|
|
10
11
|
<path
|
|
11
12
|
d="M10.1472 5.86855H22.261C24.0328 5.86855 25.2192 5.79792 26.2514 7.25517C27.1489 8.60833 27.4185 9.79792 27.2105 11.4336C27.0025 13.0693 26.5596 14.2291 25.4926 15.6529C24.9996 16.3295 24.3795 16.8648 23.6284 17.2552C22.6077 17.7533 21.9529 17.6827 20.9206 17.6827H8.69893V17.6381L8.00562 23.2589H20.7704C24.2755 23.2589 27.6496 22.5228 30.4807 19.9949C33.0999 17.6827 34.6444 14.8128 35.0489 11.612C35.4918 8.12506 34.6406 5.72357 32.2948 3.3035C29.8875 0.775615 26.8793 0.362976 23.2278 0.362976H10.8328L10.1472 5.92803V5.86855Z"
|
|
@@ -97,6 +97,7 @@ export interface DataGridPagination {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export interface DataGridProps<T extends Record<string, unknown>> {
|
|
100
|
+
id?: string;
|
|
100
101
|
data: T[];
|
|
101
102
|
columns: ColumnDef<T>[];
|
|
102
103
|
status?: string;
|
|
@@ -120,6 +121,7 @@ export interface DataGridProps<T extends Record<string, unknown>> {
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
export function DataGrid<T extends Record<string, unknown>>({
|
|
124
|
+
id,
|
|
123
125
|
data,
|
|
124
126
|
columns,
|
|
125
127
|
status,
|
|
@@ -205,7 +207,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
205
207
|
}
|
|
206
208
|
: setLocalRowSelection;
|
|
207
209
|
|
|
208
|
-
const
|
|
210
|
+
const dndId = useId();
|
|
209
211
|
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
210
212
|
|
|
211
213
|
const [columnVisibility, setColumnVisibility] = useState<
|
|
@@ -221,8 +223,8 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
221
223
|
});
|
|
222
224
|
|
|
223
225
|
const toggleColumnVisibility = useCallback(
|
|
224
|
-
(
|
|
225
|
-
setColumnVisibility((prev) => ({ ...prev, [
|
|
226
|
+
(columnId: string, isVisible: boolean) => {
|
|
227
|
+
setColumnVisibility((prev) => ({ ...prev, [columnId]: isVisible }));
|
|
226
228
|
},
|
|
227
229
|
[setColumnVisibility],
|
|
228
230
|
);
|
|
@@ -276,9 +278,11 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
276
278
|
String(i + 1),
|
|
277
279
|
);
|
|
278
280
|
|
|
279
|
-
const allSelectedAcrossPages = allRowIds.every(
|
|
281
|
+
const allSelectedAcrossPages = allRowIds.every(
|
|
282
|
+
(rowId) => rowSelection[rowId],
|
|
283
|
+
);
|
|
280
284
|
const someSelectedAcrossPages =
|
|
281
|
-
!allSelectedAcrossPages && allRowIds.some((
|
|
285
|
+
!allSelectedAcrossPages && allRowIds.some((rowId) => rowSelection[rowId]);
|
|
282
286
|
|
|
283
287
|
const toggleSelectAllAcrossPages = () => {
|
|
284
288
|
setRowSelection((prev) => {
|
|
@@ -286,14 +290,14 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
286
290
|
|
|
287
291
|
if (isSelecting) {
|
|
288
292
|
const newSelection: Record<string, boolean> = {};
|
|
289
|
-
for (const
|
|
290
|
-
newSelection[
|
|
293
|
+
for (const rowId of allRowIds) {
|
|
294
|
+
newSelection[rowId] = true;
|
|
291
295
|
}
|
|
292
296
|
return { ...prev, ...newSelection };
|
|
293
297
|
} else {
|
|
294
298
|
const updatedSelection: Record<string, boolean> = { ...prev };
|
|
295
|
-
for (const
|
|
296
|
-
delete updatedSelection[
|
|
299
|
+
for (const rowId of allRowIds) {
|
|
300
|
+
delete updatedSelection[rowId];
|
|
297
301
|
}
|
|
298
302
|
return updatedSelection;
|
|
299
303
|
}
|
|
@@ -351,7 +355,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
351
355
|
|
|
352
356
|
return (
|
|
353
357
|
<DndContext
|
|
354
|
-
id={
|
|
358
|
+
id={dndId}
|
|
355
359
|
collisionDetection={closestCenter}
|
|
356
360
|
modifiers={[restrictToHorizontalAxis]}
|
|
357
361
|
onDragEnd={handleDragEnd}
|
|
@@ -361,7 +365,10 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
361
365
|
items={columnOrder}
|
|
362
366
|
strategy={horizontalListSortingStrategy}
|
|
363
367
|
>
|
|
364
|
-
<div
|
|
368
|
+
<div
|
|
369
|
+
id={id}
|
|
370
|
+
className="flex flex-col flex-1 h-full w-full rounded border border-border-primary-normal overflow-hidden text-text-primary-normal"
|
|
371
|
+
>
|
|
365
372
|
<div
|
|
366
373
|
className="overflow-auto scrollbar-thin relative contain-paint will-change-transform"
|
|
367
374
|
ref={containerRef}
|
|
@@ -386,6 +393,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
386
393
|
return (
|
|
387
394
|
<DraggableCellHeader
|
|
388
395
|
key={header.id}
|
|
396
|
+
id={id ? `${id}-header-${header.id}` : undefined}
|
|
389
397
|
header={header}
|
|
390
398
|
locked={header.column.columnDef.meta?.locked}
|
|
391
399
|
center={centerHeader}
|
|
@@ -441,11 +449,15 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
441
449
|
<React.Fragment key={header.id}>
|
|
442
450
|
{header.column.columnDef.meta?.checkbox ? (
|
|
443
451
|
<DataGridCell
|
|
452
|
+
id={id ? `${id}-header-${header.id}` : undefined}
|
|
444
453
|
type="header"
|
|
445
454
|
component="checkbox"
|
|
446
455
|
locked={header.column.columnDef.meta?.locked}
|
|
447
456
|
>
|
|
448
457
|
<Checkbox
|
|
458
|
+
id={
|
|
459
|
+
id ? `${id}-select-all-checkbox` : undefined
|
|
460
|
+
}
|
|
449
461
|
checked={allSelectedAcrossPages}
|
|
450
462
|
indeterminate={someSelectedAcrossPages}
|
|
451
463
|
onChange={toggleSelectAllAcrossPages}
|
|
@@ -469,6 +481,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
469
481
|
) : null}
|
|
470
482
|
{enableColumnSelector && (
|
|
471
483
|
<ColumnSelectorHeaderCell
|
|
484
|
+
id={id ? `${id}-column-selector` : undefined}
|
|
472
485
|
table={table}
|
|
473
486
|
toggleColumnVisibility={toggleColumnVisibility}
|
|
474
487
|
resetColumnVisibility={resetColumnVisibility}
|
|
@@ -479,6 +492,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
479
492
|
</thead>
|
|
480
493
|
|
|
481
494
|
<TableBody
|
|
495
|
+
id={id}
|
|
482
496
|
columnVirtualizer={columnVirtualizer}
|
|
483
497
|
table={table}
|
|
484
498
|
tableContainerRef={containerRef}
|
|
@@ -515,15 +529,24 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
515
529
|
<div className="flex justify-between items-center">
|
|
516
530
|
<div className="flex items-center gap-1 w-min">
|
|
517
531
|
<Select
|
|
532
|
+
id={id ? `${id}-pagesize-select` : undefined}
|
|
518
533
|
wrapperClassName="!w-20"
|
|
519
534
|
value={pagination.pageSize.toString()}
|
|
520
535
|
onChange={(e) =>
|
|
521
536
|
pagination.onPageSizeChange?.(Number(e.target.value))
|
|
522
537
|
}
|
|
523
538
|
renderMenu={(props) => (
|
|
524
|
-
<Menu
|
|
539
|
+
<Menu
|
|
540
|
+
{...props}
|
|
541
|
+
id={id ? `${id}-pagesize-menu` : undefined}
|
|
542
|
+
>
|
|
525
543
|
{PAGE_SIZE_OPTIONS.map((option) => (
|
|
526
544
|
<MenuOption
|
|
545
|
+
id={
|
|
546
|
+
id
|
|
547
|
+
? `${id}-pagesize-option-${option}`
|
|
548
|
+
: undefined
|
|
549
|
+
}
|
|
527
550
|
key={option}
|
|
528
551
|
selected={pagination.pageSize === option}
|
|
529
552
|
onClick={() =>
|
|
@@ -536,11 +559,12 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
536
559
|
</Menu>
|
|
537
560
|
)}
|
|
538
561
|
/>
|
|
539
|
-
<Label
|
|
562
|
+
<Label>Per Page</Label>
|
|
540
563
|
</div>
|
|
541
564
|
|
|
542
565
|
<div className="flex items-center gap-2">
|
|
543
566
|
<Button
|
|
567
|
+
id={id ? `${id}-prev-page-button` : undefined}
|
|
544
568
|
iconOnly
|
|
545
569
|
leftIcon={<Icon name="chevron_left" />}
|
|
546
570
|
onClick={() =>
|
|
@@ -558,6 +582,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
558
582
|
of {pagination.total}
|
|
559
583
|
</Paragraph>
|
|
560
584
|
<Button
|
|
585
|
+
id={id ? `${id}-next-page-button` : undefined}
|
|
561
586
|
iconOnly
|
|
562
587
|
leftIcon={<Icon name="chevron_right" />}
|
|
563
588
|
onClick={() =>
|
|
@@ -585,6 +610,7 @@ export function DataGrid<T extends Record<string, unknown>>({
|
|
|
585
610
|
DataGrid.displayName = "DataGrid";
|
|
586
611
|
|
|
587
612
|
interface TableBodyProps<TData extends RowData> {
|
|
613
|
+
id?: string;
|
|
588
614
|
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
589
615
|
table: Table<TData>;
|
|
590
616
|
tableContainerRef: React.RefObject<HTMLDivElement | null>;
|
|
@@ -600,6 +626,7 @@ interface TableBodyProps<TData extends RowData> {
|
|
|
600
626
|
// Helpers
|
|
601
627
|
|
|
602
628
|
function TableBody<T>({
|
|
629
|
+
id,
|
|
603
630
|
columnVirtualizer,
|
|
604
631
|
table,
|
|
605
632
|
tableContainerRef,
|
|
@@ -626,7 +653,11 @@ function TableBody<T>({
|
|
|
626
653
|
<tbody
|
|
627
654
|
style={{
|
|
628
655
|
display: "grid",
|
|
629
|
-
height: `${
|
|
656
|
+
height: `${
|
|
657
|
+
showFilterRow
|
|
658
|
+
? rowVirtualizer.getTotalSize() + 40
|
|
659
|
+
: rowVirtualizer.getTotalSize()
|
|
660
|
+
}px`, // tells scrollbar how big the table is
|
|
630
661
|
position: "relative", // needed for absolute positioning of rows
|
|
631
662
|
}}
|
|
632
663
|
>
|
|
@@ -645,6 +676,7 @@ function TableBody<T>({
|
|
|
645
676
|
{table.getHeaderGroups().flatMap((x) =>
|
|
646
677
|
x.headers.map((header) => (
|
|
647
678
|
<DragAlongCell
|
|
679
|
+
id={id ? `${id}-filter-cell-${header.id}` : undefined}
|
|
648
680
|
noPadding
|
|
649
681
|
key={header.id}
|
|
650
682
|
cell={header}
|
|
@@ -656,6 +688,7 @@ function TableBody<T>({
|
|
|
656
688
|
table,
|
|
657
689
|
}) ?? (
|
|
658
690
|
<Search
|
|
691
|
+
id={id ? `${id}-filter-search-${header.id}` : undefined}
|
|
659
692
|
removeRoundness
|
|
660
693
|
onChange={(e) =>
|
|
661
694
|
header.column.setFilterValue(e.target.value)
|
|
@@ -676,6 +709,7 @@ function TableBody<T>({
|
|
|
676
709
|
|
|
677
710
|
return (
|
|
678
711
|
<TableBodyRow
|
|
712
|
+
id={id}
|
|
679
713
|
columnVirtualizer={columnVirtualizer}
|
|
680
714
|
key={row.id}
|
|
681
715
|
row={row}
|
|
@@ -695,12 +729,14 @@ function TableBody<T>({
|
|
|
695
729
|
display: "flex",
|
|
696
730
|
position: "absolute",
|
|
697
731
|
width: "100%",
|
|
698
|
-
transform: `translateY(${
|
|
732
|
+
transform: `translateY(${
|
|
733
|
+
virtualRows[virtualRows.length - 1].start + 40
|
|
734
|
+
}px)`,
|
|
699
735
|
}}
|
|
700
736
|
className="odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal"
|
|
701
737
|
>
|
|
702
738
|
{table.getAllLeafColumns().map((column) => (
|
|
703
|
-
<LoadingCell key={column.id} column={column.columnDef} />
|
|
739
|
+
<LoadingCell id={id} key={column.id} column={column.columnDef} />
|
|
704
740
|
))}
|
|
705
741
|
</tr>
|
|
706
742
|
)}
|
|
@@ -709,6 +745,7 @@ function TableBody<T>({
|
|
|
709
745
|
}
|
|
710
746
|
|
|
711
747
|
interface TableBodyRowProps<T> {
|
|
748
|
+
id?: string;
|
|
712
749
|
columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
|
713
750
|
row: Row<T>;
|
|
714
751
|
rowVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
|
|
@@ -720,6 +757,7 @@ interface TableBodyRowProps<T> {
|
|
|
720
757
|
}
|
|
721
758
|
|
|
722
759
|
function TableBodyRow<T>({
|
|
760
|
+
id,
|
|
723
761
|
columnVirtualizer,
|
|
724
762
|
row,
|
|
725
763
|
// rowVirtualizer,
|
|
@@ -752,7 +790,9 @@ function TableBodyRow<T>({
|
|
|
752
790
|
style={{
|
|
753
791
|
display: "flex",
|
|
754
792
|
position: "absolute",
|
|
755
|
-
transform: `translateY(${
|
|
793
|
+
transform: `translateY(${
|
|
794
|
+
showFilterRow ? virtualRow.start + 40 : virtualRow.start
|
|
795
|
+
}px)`,
|
|
756
796
|
width: "100%",
|
|
757
797
|
}}
|
|
758
798
|
>
|
|
@@ -768,8 +808,13 @@ function TableBodyRow<T>({
|
|
|
768
808
|
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
769
809
|
</React.Fragment>
|
|
770
810
|
) : (
|
|
771
|
-
<DragAlongCell
|
|
811
|
+
<DragAlongCell
|
|
812
|
+
key={cell.id}
|
|
813
|
+
id={id ? `${id}-cell-${cell.id}` : undefined}
|
|
814
|
+
cell={cell}
|
|
815
|
+
>
|
|
772
816
|
<Tooltip
|
|
817
|
+
id={id ? `${id}-tooltip-${cell.id}` : undefined}
|
|
773
818
|
showOnTruncation
|
|
774
819
|
message={cell.getValue() as string}
|
|
775
820
|
position="bottom"
|
|
@@ -793,22 +838,29 @@ function TableBodyRow<T>({
|
|
|
793
838
|
}
|
|
794
839
|
|
|
795
840
|
const LoadingCell = <T extends RowData>({
|
|
841
|
+
id,
|
|
796
842
|
column,
|
|
797
843
|
}: {
|
|
844
|
+
id?: string;
|
|
798
845
|
column: ColumnDef<T>;
|
|
799
846
|
}) => {
|
|
800
847
|
const key = `loading-${column.id}`;
|
|
801
848
|
if (column.cell === "checkbox") {
|
|
802
849
|
return (
|
|
803
|
-
<DataGridCell key={key}>
|
|
804
|
-
<Checkbox disabled />
|
|
850
|
+
<DataGridCell id={id ? `${id}-${key}` : undefined} key={key}>
|
|
851
|
+
<Checkbox id={id ? `${id}-${key}-checkbox` : undefined} disabled />
|
|
805
852
|
</DataGridCell>
|
|
806
853
|
);
|
|
807
854
|
}
|
|
808
855
|
if (column.cell === "input") {
|
|
809
856
|
return (
|
|
810
|
-
<DataGridCell
|
|
857
|
+
<DataGridCell
|
|
858
|
+
id={id ? `${id}-${key}` : undefined}
|
|
859
|
+
key={key}
|
|
860
|
+
component="input"
|
|
861
|
+
>
|
|
811
862
|
<Input
|
|
863
|
+
id={id ? `${id}-${key}-input` : undefined}
|
|
812
864
|
align="left"
|
|
813
865
|
disabled
|
|
814
866
|
wrapperClassName="!rounded-none !border-0"
|
|
@@ -817,17 +869,19 @@ const LoadingCell = <T extends RowData>({
|
|
|
817
869
|
);
|
|
818
870
|
}
|
|
819
871
|
return (
|
|
820
|
-
<DataGridCell key={key}>
|
|
872
|
+
<DataGridCell id={id ? `${id}-${key}` : undefined} key={key}>
|
|
821
873
|
<div className="bg-linear-270 to-neutral-300/[24%] from-neutral-300/[12%] rounded-xs w-full max-w-25 h-6"></div>
|
|
822
874
|
</DataGridCell>
|
|
823
875
|
);
|
|
824
876
|
};
|
|
825
877
|
|
|
826
878
|
function ColumnSelectorHeaderCell<T>({
|
|
879
|
+
id,
|
|
827
880
|
table,
|
|
828
881
|
toggleColumnVisibility,
|
|
829
882
|
resetColumnVisibility,
|
|
830
883
|
}: {
|
|
884
|
+
id?: string;
|
|
831
885
|
table: Table<T>;
|
|
832
886
|
toggleColumnVisibility: (id: string, isVisible: boolean) => void;
|
|
833
887
|
resetColumnVisibility: () => void;
|
|
@@ -837,24 +891,28 @@ function ColumnSelectorHeaderCell<T>({
|
|
|
837
891
|
|
|
838
892
|
return (
|
|
839
893
|
<DataGridCell
|
|
894
|
+
id={id}
|
|
840
895
|
width="48"
|
|
841
896
|
type="header"
|
|
842
897
|
color="text-secondary-normal"
|
|
843
898
|
ref={ref}
|
|
844
899
|
>
|
|
845
900
|
<Button
|
|
901
|
+
id={id ? `${id}-button` : undefined}
|
|
846
902
|
onClick={() => setShow((prev) => !prev)}
|
|
847
903
|
variant="navigation"
|
|
848
904
|
iconOnly
|
|
849
905
|
leftIcon={<Icon name="tune" />}
|
|
850
906
|
></Button>
|
|
851
907
|
<Menu
|
|
908
|
+
id={id ? `${id}-menu` : undefined}
|
|
852
909
|
positionTo={ref}
|
|
853
910
|
position="bottom-right"
|
|
854
911
|
show={show}
|
|
855
912
|
setShow={setShow}
|
|
856
913
|
>
|
|
857
914
|
<Button
|
|
915
|
+
id={id ? `${id}-reset-button` : undefined}
|
|
858
916
|
variant="tertiary"
|
|
859
917
|
onClick={() => {
|
|
860
918
|
resetColumnVisibility();
|
|
@@ -868,6 +926,7 @@ function ColumnSelectorHeaderCell<T>({
|
|
|
868
926
|
.filter((x) => x.columnDef.meta?.inVisibilityMenu)
|
|
869
927
|
.map((column) => (
|
|
870
928
|
<ColumnSelectorMenuOption
|
|
929
|
+
id={id ? `${id}-option-${column.id}` : undefined}
|
|
871
930
|
key={column.id}
|
|
872
931
|
column={column}
|
|
873
932
|
toggleColumnVisibility={toggleColumnVisibility}
|
|
@@ -879,9 +938,11 @@ function ColumnSelectorHeaderCell<T>({
|
|
|
879
938
|
}
|
|
880
939
|
|
|
881
940
|
function ColumnSelectorMenuOption<T>({
|
|
941
|
+
id,
|
|
882
942
|
column,
|
|
883
943
|
toggleColumnVisibility,
|
|
884
944
|
}: {
|
|
945
|
+
id?: string;
|
|
885
946
|
column: Column<T, unknown>;
|
|
886
947
|
toggleColumnVisibility: (id: string, isVisible: boolean) => void;
|
|
887
948
|
}) {
|
|
@@ -891,8 +952,9 @@ function ColumnSelectorMenuOption<T>({
|
|
|
891
952
|
? column.columnDef.header
|
|
892
953
|
: null;
|
|
893
954
|
return (
|
|
894
|
-
<MenuOption selected={isVisible} defaultChecked={isVisible}>
|
|
955
|
+
<MenuOption id={id} selected={isVisible} defaultChecked={isVisible}>
|
|
895
956
|
<Checkbox
|
|
957
|
+
id={id ? `${id}-checkbox` : undefined}
|
|
896
958
|
label={label ?? "Unknown"}
|
|
897
959
|
checked={isVisible}
|
|
898
960
|
onChange={(e) => {
|
|
@@ -31,6 +31,7 @@ import { useSubMenuSystem } from "./useMenuSystem";
|
|
|
31
31
|
type Tags = "td" | "th";
|
|
32
32
|
|
|
33
33
|
type DataGridCellProps = PropsWithChildren<{
|
|
34
|
+
id?: string;
|
|
34
35
|
type?: "default" | "header" | "summary";
|
|
35
36
|
component?: "header" | "checkbox" | "icon" | "button" | "static" | "input";
|
|
36
37
|
locked?: boolean;
|
|
@@ -45,6 +46,7 @@ type DataGridCellProps = PropsWithChildren<{
|
|
|
45
46
|
|
|
46
47
|
export const DataGridCell = memo(
|
|
47
48
|
({
|
|
49
|
+
id,
|
|
48
50
|
type = "default",
|
|
49
51
|
component = "static",
|
|
50
52
|
children,
|
|
@@ -161,6 +163,7 @@ export const DataGridCell = memo(
|
|
|
161
163
|
|
|
162
164
|
return (
|
|
163
165
|
<Element
|
|
166
|
+
id={id}
|
|
164
167
|
className={clsx("flex", !width && "flex-1")}
|
|
165
168
|
style={{ width }}
|
|
166
169
|
{...props}
|
|
@@ -192,12 +195,14 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
192
195
|
header,
|
|
193
196
|
children,
|
|
194
197
|
locked = false,
|
|
198
|
+
id,
|
|
195
199
|
...props
|
|
196
200
|
}: {
|
|
197
201
|
header: Header<T, unknown>;
|
|
198
202
|
children: React.ReactNode;
|
|
199
203
|
locked?: boolean;
|
|
200
204
|
width?: string;
|
|
205
|
+
id?: string;
|
|
201
206
|
} & DataGridCellProps &
|
|
202
207
|
ComponentProps<"th">) {
|
|
203
208
|
const { attributes, isDragging, listeners, setNodeRef, transform, node } =
|
|
@@ -209,13 +214,13 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
209
214
|
const [filter, setFilter] = useState(
|
|
210
215
|
(header.column.getFilterValue() as string) ?? "",
|
|
211
216
|
);
|
|
212
|
-
|
|
217
|
+
|
|
213
218
|
const {
|
|
214
219
|
menuRootRef,
|
|
215
220
|
isMenuActive,
|
|
216
221
|
registerSubMenu,
|
|
217
222
|
listeners: subMenuListeners,
|
|
218
|
-
mobileHide
|
|
223
|
+
mobileHide,
|
|
219
224
|
} = useSubMenuSystem(node);
|
|
220
225
|
|
|
221
226
|
useEffect(() => {
|
|
@@ -241,6 +246,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
241
246
|
|
|
242
247
|
return (
|
|
243
248
|
<DataGridCell
|
|
249
|
+
id={id}
|
|
244
250
|
locked={locked}
|
|
245
251
|
type="header"
|
|
246
252
|
component="header"
|
|
@@ -257,6 +263,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
257
263
|
|
|
258
264
|
{header.column.getCanFilter() && (
|
|
259
265
|
<Menu
|
|
266
|
+
id={id ? `${id}-menu` : undefined}
|
|
260
267
|
ref={menuRootRef}
|
|
261
268
|
positionTo={node}
|
|
262
269
|
show={showMenu}
|
|
@@ -264,9 +271,11 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
264
271
|
mobileHide={mobileHide}
|
|
265
272
|
>
|
|
266
273
|
<MenuOption
|
|
274
|
+
id={id ? `${id}-filter-option` : undefined}
|
|
267
275
|
{...subMenuListeners}
|
|
268
276
|
subMenu={({ menuId, subMenuLevel, ...props }) => (
|
|
269
277
|
<Menu
|
|
278
|
+
id={id ? `${id}-filter-submenu` : undefined}
|
|
270
279
|
{...props}
|
|
271
280
|
show={isMenuActive(menuId, subMenuLevel)}
|
|
272
281
|
ref={(el) => {
|
|
@@ -275,6 +284,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
275
284
|
>
|
|
276
285
|
<div className={clsx(paddingUsingComponentGap)}>
|
|
277
286
|
<Search
|
|
287
|
+
id={id ? `${id}-filter-search` : undefined}
|
|
278
288
|
onChange={(event) => {
|
|
279
289
|
setFilter(event.target.value);
|
|
280
290
|
}}
|
|
@@ -288,6 +298,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
288
298
|
</div>
|
|
289
299
|
|
|
290
300
|
<MenuOption
|
|
301
|
+
id={id ? `${id}-filter-contains` : undefined}
|
|
291
302
|
onClick={handleFilterFnChange}
|
|
292
303
|
before={menuOptionIcon("includesString")}
|
|
293
304
|
>
|
|
@@ -295,6 +306,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
295
306
|
</MenuOption>
|
|
296
307
|
|
|
297
308
|
<MenuOption
|
|
309
|
+
id={id ? `${id}-filter-startswith` : undefined}
|
|
298
310
|
onClick={handleFilterFnChange}
|
|
299
311
|
before={menuOptionIcon("startsWith")}
|
|
300
312
|
>
|
|
@@ -302,6 +314,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
|
|
|
302
314
|
</MenuOption>
|
|
303
315
|
|
|
304
316
|
<MenuOption
|
|
317
|
+
id={id ? `${id}-filter-endswith` : undefined}
|
|
305
318
|
onClick={handleFilterFnChange}
|
|
306
319
|
before={menuOptionIcon("endsWith")}
|
|
307
320
|
>
|