@wallarm-org/design-system 2.4.0 → 2.5.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/CodeSnippet/internal/CodeSnippetFrame.js +101 -66
- package/dist/components/Table/StickyGroupParent.js +11 -4
- package/dist/components/Table/TableBody/TableRowOverlay.js +46 -30
- package/dist/components/Table/TableContext/TableProvider.js +294 -284
- package/dist/components/Table/TableContext/types.d.ts +3 -0
- package/dist/components/Table/TableRow.d.ts +12 -1
- package/dist/components/Table/TableRow.js +264 -177
- package/dist/components/Table/lib/createDragHandleColumn.js +5 -24
- package/dist/components/Table/lib/useRowDnd.d.ts +2 -0
- package/dist/components/Table/lib/useRowDnd.js +46 -41
- package/dist/components/Table/types.d.ts +39 -0
- package/dist/metadata/components.json +37 -3
- package/package.json +3 -1
|
@@ -2,10 +2,12 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
+
import { trackDismissableElement } from "@zag-js/dismissable";
|
|
6
|
+
import { trapFocus } from "@zag-js/focus-trap";
|
|
5
7
|
import { cn } from "../../../utils/cn.js";
|
|
6
8
|
import { useTestId } from "../../../utils/testId.js";
|
|
7
|
-
const FULLSCREEN_CLASSES = "fixed inset-16
|
|
8
|
-
const BACKDROP_CLASSES = "fixed inset-0
|
|
9
|
+
const FULLSCREEN_CLASSES = cn("fixed inset-16 m-0 w-auto h-auto min-w-0 min-h-0 max-w-[none] max-h-[none]", "z-[calc(var(--drawer-positioner-z-index)+(var(--layer-index,0)*var(--drawer-level-ratio)))]");
|
|
10
|
+
const BACKDROP_CLASSES = cn("fixed inset-0 backdrop-blur-xs bg-component-dialog-overlay", "z-[calc(var(--drawer-overlay-z-index)+(var(--layer-index,0)*var(--drawer-level-ratio)))]");
|
|
9
11
|
const HOST_CLASSES = "contents";
|
|
10
12
|
const noop = ()=>{};
|
|
11
13
|
const subscribeNoop = ()=>noop;
|
|
@@ -18,7 +20,7 @@ const createHost = ()=>{
|
|
|
18
20
|
return host;
|
|
19
21
|
};
|
|
20
22
|
const CodeSnippetFrame = (t0)=>{
|
|
21
|
-
const $ = c(
|
|
23
|
+
const $ = c(45);
|
|
22
24
|
let children;
|
|
23
25
|
let className;
|
|
24
26
|
let isFullscreen;
|
|
@@ -96,96 +98,129 @@ const CodeSnippetFrame = (t0)=>{
|
|
|
96
98
|
useLayoutEffect(t3, t4);
|
|
97
99
|
let t5;
|
|
98
100
|
let t6;
|
|
99
|
-
if ($[15] !==
|
|
101
|
+
if ($[15] !== host || $[16] !== isFullscreen || $[17] !== setIsFullscreen) {
|
|
100
102
|
t5 = ()=>{
|
|
101
|
-
if (!isFullscreen) return;
|
|
102
|
-
const
|
|
103
|
-
|
|
103
|
+
if (!isFullscreen || !host) return;
|
|
104
|
+
const options = {
|
|
105
|
+
onRequestDismiss: (event)=>{
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
setIsFullscreen(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const untrack = trackDismissableElement(host, options);
|
|
111
|
+
const untrap = trapFocus(host);
|
|
112
|
+
return ()=>{
|
|
113
|
+
untrap();
|
|
114
|
+
untrack();
|
|
104
115
|
};
|
|
105
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
106
|
-
return ()=>document.removeEventListener("keydown", handleKeyDown);
|
|
107
116
|
};
|
|
108
117
|
t6 = [
|
|
109
118
|
isFullscreen,
|
|
119
|
+
host,
|
|
110
120
|
setIsFullscreen
|
|
111
121
|
];
|
|
112
|
-
$[15] =
|
|
113
|
-
$[16] =
|
|
114
|
-
$[17] =
|
|
115
|
-
$[18] =
|
|
122
|
+
$[15] = host;
|
|
123
|
+
$[16] = isFullscreen;
|
|
124
|
+
$[17] = setIsFullscreen;
|
|
125
|
+
$[18] = t5;
|
|
126
|
+
$[19] = t6;
|
|
116
127
|
} else {
|
|
117
|
-
t5 = $[
|
|
118
|
-
t6 = $[
|
|
128
|
+
t5 = $[18];
|
|
129
|
+
t6 = $[19];
|
|
119
130
|
}
|
|
120
131
|
useEffect(t5, t6);
|
|
121
132
|
let t7;
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
let t8;
|
|
134
|
+
if ($[20] !== isFullscreen || $[21] !== setIsFullscreen) {
|
|
135
|
+
t7 = ()=>{
|
|
136
|
+
if (!isFullscreen) return;
|
|
137
|
+
const handleKeyDown = (event_0)=>{
|
|
138
|
+
if ("Escape" === event_0.key && !event_0.defaultPrevented) setIsFullscreen(false);
|
|
139
|
+
};
|
|
140
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
141
|
+
return ()=>document.removeEventListener("keydown", handleKeyDown);
|
|
142
|
+
};
|
|
143
|
+
t8 = [
|
|
144
|
+
isFullscreen,
|
|
145
|
+
setIsFullscreen
|
|
146
|
+
];
|
|
147
|
+
$[20] = isFullscreen;
|
|
148
|
+
$[21] = setIsFullscreen;
|
|
149
|
+
$[22] = t7;
|
|
150
|
+
$[23] = t8;
|
|
151
|
+
} else {
|
|
152
|
+
t7 = $[22];
|
|
153
|
+
t8 = $[23];
|
|
154
|
+
}
|
|
155
|
+
useEffect(t7, t8);
|
|
156
|
+
let t9;
|
|
157
|
+
if ($[24] !== backdropTestId || $[25] !== isFullscreen || $[26] !== setIsFullscreen) {
|
|
158
|
+
t9 = isFullscreen ? /*#__PURE__*/ jsx("div", {
|
|
124
159
|
"aria-hidden": "true",
|
|
125
160
|
"data-testid": backdropTestId,
|
|
126
161
|
className: BACKDROP_CLASSES,
|
|
127
162
|
onClick: ()=>setIsFullscreen(false)
|
|
128
163
|
}) : null;
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
} else
|
|
134
|
-
const
|
|
135
|
-
let
|
|
136
|
-
if ($[
|
|
137
|
-
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
} else
|
|
142
|
-
let
|
|
143
|
-
if ($[
|
|
144
|
-
|
|
164
|
+
$[24] = backdropTestId;
|
|
165
|
+
$[25] = isFullscreen;
|
|
166
|
+
$[26] = setIsFullscreen;
|
|
167
|
+
$[27] = t9;
|
|
168
|
+
} else t9 = $[27];
|
|
169
|
+
const t10 = isFullscreen && FULLSCREEN_CLASSES;
|
|
170
|
+
let t11;
|
|
171
|
+
if ($[28] !== className || $[29] !== t10) {
|
|
172
|
+
t11 = cn(className, t10);
|
|
173
|
+
$[28] = className;
|
|
174
|
+
$[29] = t10;
|
|
175
|
+
$[30] = t11;
|
|
176
|
+
} else t11 = $[30];
|
|
177
|
+
let t12;
|
|
178
|
+
if ($[31] !== children || $[32] !== props || $[33] !== ref || $[34] !== t11) {
|
|
179
|
+
t12 = /*#__PURE__*/ jsx("div", {
|
|
145
180
|
...props,
|
|
146
181
|
ref: ref,
|
|
147
|
-
className:
|
|
182
|
+
className: t11,
|
|
148
183
|
children: children
|
|
149
184
|
});
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
} else
|
|
156
|
-
let
|
|
157
|
-
if ($[
|
|
158
|
-
|
|
185
|
+
$[31] = children;
|
|
186
|
+
$[32] = props;
|
|
187
|
+
$[33] = ref;
|
|
188
|
+
$[34] = t11;
|
|
189
|
+
$[35] = t12;
|
|
190
|
+
} else t12 = $[35];
|
|
191
|
+
let t13;
|
|
192
|
+
if ($[36] !== t12 || $[37] !== t9) {
|
|
193
|
+
t13 = /*#__PURE__*/ jsxs(Fragment, {
|
|
159
194
|
children: [
|
|
160
|
-
|
|
161
|
-
|
|
195
|
+
t9,
|
|
196
|
+
t12
|
|
162
197
|
]
|
|
163
198
|
});
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
} else
|
|
168
|
-
const frame =
|
|
169
|
-
let
|
|
170
|
-
if ($[
|
|
171
|
-
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
} else
|
|
177
|
-
let
|
|
178
|
-
if ($[
|
|
179
|
-
|
|
199
|
+
$[36] = t12;
|
|
200
|
+
$[37] = t9;
|
|
201
|
+
$[38] = t13;
|
|
202
|
+
} else t13 = $[38];
|
|
203
|
+
const frame = t13;
|
|
204
|
+
let t14;
|
|
205
|
+
if ($[39] !== frame || $[40] !== host || $[41] !== portalReady) {
|
|
206
|
+
t14 = portalReady && host ? /*#__PURE__*/ createPortal(frame, host) : frame;
|
|
207
|
+
$[39] = frame;
|
|
208
|
+
$[40] = host;
|
|
209
|
+
$[41] = portalReady;
|
|
210
|
+
$[42] = t14;
|
|
211
|
+
} else t14 = $[42];
|
|
212
|
+
let t15;
|
|
213
|
+
if ($[43] !== t14) {
|
|
214
|
+
t15 = /*#__PURE__*/ jsx("div", {
|
|
180
215
|
ref: placeholderRef,
|
|
181
216
|
"data-slot": "code-snippet-frame",
|
|
182
217
|
className: HOST_CLASSES,
|
|
183
|
-
children:
|
|
218
|
+
children: t14
|
|
184
219
|
});
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
} else
|
|
188
|
-
return
|
|
220
|
+
$[43] = t14;
|
|
221
|
+
$[44] = t15;
|
|
222
|
+
} else t15 = $[44];
|
|
223
|
+
return t15;
|
|
189
224
|
};
|
|
190
225
|
CodeSnippetFrame.displayName = "CodeSnippetFrame";
|
|
191
226
|
export { CodeSnippetFrame };
|
|
@@ -2,18 +2,19 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
import { useStickyGroupParent } from "./hooks/index.js";
|
|
5
|
-
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useTableValue, withTableState } from "./lib/index.js";
|
|
5
|
+
import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_SELECT_COLUMN_ID, useRenderEveryTime, useTableValue, withTableState } from "./lib/index.js";
|
|
6
6
|
import { Td, Tr } from "./primitives/index.js";
|
|
7
7
|
import { TableBodyCell } from "./TableBody/TableBodyCell.js";
|
|
8
8
|
import { TableColGroup } from "./TableColGroup.js";
|
|
9
9
|
import { useTableContext } from "./TableContext/index.js";
|
|
10
|
+
import { TableFullWidthCell } from "./TableRow.js";
|
|
10
11
|
const SYSTEM_COLUMN_IDS = new Set([
|
|
11
12
|
TABLE_EXPAND_COLUMN_ID,
|
|
12
13
|
TABLE_SELECT_COLUMN_ID,
|
|
13
14
|
TABLE_DRAG_HANDLE_COLUMN_ID
|
|
14
15
|
]);
|
|
15
16
|
const StickyGroupParent = ({ tableWidth, headerHeight })=>{
|
|
16
|
-
const { table, containerRef, tbodyRef, virtualizerRef, virtualized } = useTableContext();
|
|
17
|
+
const { table, containerRef, tbodyRef, virtualizerRef, virtualized, renderFullWidthGroupRow } = useTableContext();
|
|
17
18
|
const useWindowScroll = 'window' === virtualized;
|
|
18
19
|
const { stickyRow, pushUpOffset } = useStickyGroupParent({
|
|
19
20
|
table,
|
|
@@ -64,6 +65,8 @@ const StickyGroupParent = ({ tableWidth, headerHeight })=>{
|
|
|
64
65
|
const dataCells = cells?.filter((c)=>!SYSTEM_COLUMN_IDS.has(c.column.id));
|
|
65
66
|
const firstDataCell = dataCells?.[0];
|
|
66
67
|
const isSelected = useTableValue(()=>stickyRow?.getIsAllSubRowsSelected());
|
|
68
|
+
const fullWidthContent = useRenderEveryTime(()=>stickyRow ? renderFullWidthGroupRow?.(stickyRow) : void 0);
|
|
69
|
+
const isFullWidth = void 0 !== fullWidthContent;
|
|
67
70
|
return /*#__PURE__*/ jsx("div", {
|
|
68
71
|
className: "sticky z-[21] h-0 overflow-visible pointer-events-none",
|
|
69
72
|
style: {
|
|
@@ -98,12 +101,16 @@ const StickyGroupParent = ({ tableWidth, headerHeight })=>{
|
|
|
98
101
|
cell: cell,
|
|
99
102
|
disablePinnedShadow: true
|
|
100
103
|
}, cell.id)),
|
|
101
|
-
|
|
104
|
+
isFullWidth && /*#__PURE__*/ jsx(TableFullWidthCell, {
|
|
105
|
+
colSpan: dataCells.length,
|
|
106
|
+
children: fullWidthContent
|
|
107
|
+
}),
|
|
108
|
+
!isFullWidth && firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
|
|
102
109
|
cell: firstDataCell,
|
|
103
110
|
className: "border-r-0",
|
|
104
111
|
disablePinnedShadow: true
|
|
105
112
|
}),
|
|
106
|
-
withTableState(table.state, ()=>dataCells.slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
|
|
113
|
+
withTableState(table.state, ()=>(isFullWidth ? [] : dataCells).slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
|
|
107
114
|
className: cn('border-b border-border-primary-light bg-bg-surface-2 overlay', 'group-hover/row:overlay-states-primary-hover group-data-[selected]/row:overlay-states-primary-active', 'group-data-[preview-active]/row:overlay-states-primary-hover group-has-[[data-state=open]]/row:overlay-states-primary-hover'),
|
|
108
115
|
style: {
|
|
109
116
|
width: cell.column.getSize()
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
3
3
|
import { flexRender } from "@tanstack/react-table";
|
|
4
4
|
import { cn } from "../../../utils/cn.js";
|
|
5
|
-
import { getAlignClass, withTableState } from "../lib/index.js";
|
|
5
|
+
import { getAlignClass, useRenderEveryTime, withTableState } from "../lib/index.js";
|
|
6
6
|
import { Td, Tr } from "../primitives/index.js";
|
|
7
7
|
import { useTableContext } from "../TableContext/index.js";
|
|
8
8
|
const TableRowOverlayInner = (t0)=>{
|
|
9
|
-
const $ = compiler_runtime_c(
|
|
9
|
+
const $ = compiler_runtime_c(10);
|
|
10
10
|
const { row } = t0;
|
|
11
|
-
const { table } = useTableContext();
|
|
11
|
+
const { table, renderFullWidthRow } = useTableContext();
|
|
12
12
|
let t1;
|
|
13
|
-
if ($[0] !==
|
|
14
|
-
t1 = ()=>
|
|
13
|
+
if ($[0] !== renderFullWidthRow || $[1] !== row) {
|
|
14
|
+
t1 = ()=>renderFullWidthRow?.(row);
|
|
15
|
+
$[0] = renderFullWidthRow;
|
|
16
|
+
$[1] = row;
|
|
17
|
+
$[2] = t1;
|
|
18
|
+
} else t1 = $[2];
|
|
19
|
+
const fullWidthContent = useRenderEveryTime(t1);
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[3] !== fullWidthContent || $[4] !== row || $[5] !== table) {
|
|
22
|
+
t2 = ()=>{
|
|
15
23
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
16
24
|
return /*#__PURE__*/ jsx("table", {
|
|
17
25
|
className: "w-full table-fixed border-collapse",
|
|
@@ -20,36 +28,44 @@ const TableRowOverlayInner = (t0)=>{
|
|
|
20
28
|
cursor: "grabbing"
|
|
21
29
|
},
|
|
22
30
|
children: /*#__PURE__*/ jsx("tbody", {
|
|
23
|
-
children: /*#__PURE__*/
|
|
31
|
+
children: /*#__PURE__*/ jsxs(Tr, {
|
|
24
32
|
className: "pointer-events-none shadow-lg opacity-90 bg-bg-primary",
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
const meta = cell.column.columnDef.meta;
|
|
28
|
-
return /*#__PURE__*/ jsx(Td, {
|
|
33
|
+
children: [
|
|
34
|
+
void 0 !== fullWidthContent && /*#__PURE__*/ jsx(Td, {
|
|
29
35
|
pinned: false,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
colSpan: row.getVisibleCells().length,
|
|
37
|
+
children: fullWidthContent
|
|
38
|
+
}),
|
|
39
|
+
(void 0 === fullWidthContent ? row.getVisibleCells() : []).map((cell)=>{
|
|
40
|
+
const column = visibleColumns.find((c)=>c.id === cell.column.id);
|
|
41
|
+
const meta = cell.column.columnDef.meta;
|
|
42
|
+
return /*#__PURE__*/ jsx(Td, {
|
|
43
|
+
pinned: false,
|
|
44
|
+
className: cn(getAlignClass(meta), meta?.cellClassName),
|
|
45
|
+
style: {
|
|
46
|
+
width: column?.getSize()
|
|
47
|
+
},
|
|
48
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
49
|
+
}, cell.id);
|
|
50
|
+
})
|
|
51
|
+
]
|
|
37
52
|
})
|
|
38
53
|
})
|
|
39
54
|
});
|
|
40
55
|
};
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
$[3] = fullWidthContent;
|
|
57
|
+
$[4] = row;
|
|
58
|
+
$[5] = table;
|
|
59
|
+
$[6] = t2;
|
|
60
|
+
} else t2 = $[6];
|
|
61
|
+
let t3;
|
|
62
|
+
if ($[7] !== t2 || $[8] !== table.state) {
|
|
63
|
+
t3 = withTableState(table.state, t2);
|
|
64
|
+
$[7] = t2;
|
|
65
|
+
$[8] = table.state;
|
|
66
|
+
$[9] = t3;
|
|
67
|
+
} else t3 = $[9];
|
|
68
|
+
return t3;
|
|
53
69
|
};
|
|
54
70
|
const TableRowOverlay = TableRowOverlayInner;
|
|
55
71
|
TableRowOverlay.displayName = "TableRowOverlay";
|