@primer/react 38.44.1-rc.f98981f35 → 38.45.0-rc.33f45c4d7
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/CHANGELOG.md +19 -1
- package/dist/ActionMenu/ActionMenu.js +12 -8
- package/dist/Blankslate/{Blankslate-11d7a7fd.css → Blankslate-670cf090.css} +2 -2
- package/dist/Blankslate/Blankslate-670cf090.css.map +1 -0
- package/dist/Blankslate/Blankslate.js +46 -36
- package/dist/Blankslate/Blankslate.module.css.js +1 -1
- package/dist/DataTable/DataTable.d.ts +11 -2
- package/dist/DataTable/DataTable.js +153 -61
- package/dist/DataTable/Table-3916da1f.css +2 -0
- package/dist/DataTable/Table-3916da1f.css.map +1 -0
- package/dist/DataTable/Table.d.ts +1 -0
- package/dist/DataTable/Table.js +18 -13
- package/dist/DataTable/Table.module.css.js +3 -1
- package/dist/DataTable/TableBulkActions-aca5618a.css +2 -0
- package/dist/DataTable/TableBulkActions-aca5618a.css.map +1 -0
- package/dist/DataTable/TableBulkActions.d.ts +15 -0
- package/dist/DataTable/TableBulkActions.js +217 -0
- package/dist/DataTable/TableBulkActions.module.css.js +12 -0
- package/dist/DataTable/TableGroup.d.ts +7 -1
- package/dist/DataTable/TableGroup.js +153 -120
- package/dist/DataTable/index.d.ts +4 -2
- package/dist/DataTable/index.js +2 -0
- package/dist/DataTable/useTable.js +103 -65
- package/dist/FeatureFlags/DefaultFeatureFlags.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.js +7 -3
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +2 -1
- package/dist/FilteredActionList/FilteredActionListInput.js +16 -14
- package/dist/SegmentedControl/SegmentedControl-3dc28307.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-3dc28307.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/SegmentedControl/SegmentedControlButton.js +119 -76
- package/dist/TooltipV2/Tooltip.d.ts +1 -1
- package/dist/TooltipV2/Tooltip.js +128 -101
- package/dist/experimental/index.d.ts +3 -2
- package/dist/utils/descendant-registry.d.ts +1 -1
- package/dist/utils/descendant-registry.js +94 -76
- package/generated/components.json +68 -2
- package/package.json +2 -2
- package/dist/Blankslate/Blankslate-11d7a7fd.css.map +0 -1
- package/dist/DataTable/Table-0327e248.css +0 -2
- package/dist/DataTable/Table-0327e248.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-99b8e34e.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-99b8e34e.css.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c } from "../utils/react-compiler-runtime.js";
|
|
2
2
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
|
+
import Checkbox from "../Checkbox/Checkbox.js";
|
|
3
4
|
import { useControllableState } from "../hooks/useControllableState.js";
|
|
4
5
|
import { Button } from "../internal/components/ButtonReset.js";
|
|
5
6
|
import { TableGroupContext } from "./TableGroupContext.js";
|
|
@@ -11,8 +12,8 @@ import { clsx } from "clsx";
|
|
|
11
12
|
import { ChevronRightIcon } from "@primer/octicons-react";
|
|
12
13
|
//#region src/DataTable/TableGroup.tsx
|
|
13
14
|
function TableGroup(t0) {
|
|
14
|
-
const $ = c(
|
|
15
|
-
const { className, id, label, rowCount, colSpan, children, "aria-label": ariaLabel, collapsible: t1, expanded: controlledExpanded, defaultExpanded: t2, onExpandedChange } = t0;
|
|
15
|
+
const $ = c(71);
|
|
16
|
+
const { className, id, label, rowCount, colSpan, children, "aria-label": ariaLabel, collapsible: t1, expanded: controlledExpanded, defaultExpanded: t2, onExpandedChange, selection, selectionDisabled, onToggleSelect } = t0;
|
|
16
17
|
const collapsible = t1 === void 0 ? false : t1;
|
|
17
18
|
const defaultExpanded = t2 === void 0 ? true : t2;
|
|
18
19
|
const headerId = useId();
|
|
@@ -69,10 +70,27 @@ function TableGroup(t0) {
|
|
|
69
70
|
t8 = clsx("TableGroupHeaderCell", Table_module_css_default.TableGroupHeaderCell);
|
|
70
71
|
$[12] = t8;
|
|
71
72
|
} else t8 = $[12];
|
|
72
|
-
const t9 = collapsible ? ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label : ariaLabel;
|
|
73
|
+
const t9 = collapsible || selection !== void 0 ? ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label : ariaLabel;
|
|
73
74
|
let t10;
|
|
74
|
-
if ($[13] !== ariaLabel || $[14] !==
|
|
75
|
-
t10 =
|
|
75
|
+
if ($[13] !== ariaLabel || $[14] !== label || $[15] !== onToggleSelect || $[16] !== selection || $[17] !== selectionDisabled) {
|
|
76
|
+
t10 = selection !== void 0 ? /* @__PURE__ */ jsx(Checkbox, {
|
|
77
|
+
className: Table_module_css_default.TableGroupSelection,
|
|
78
|
+
checked: selection === "all",
|
|
79
|
+
indeterminate: selection === "some",
|
|
80
|
+
disabled: selectionDisabled || !onToggleSelect,
|
|
81
|
+
"aria-label": `Select ${ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label}`,
|
|
82
|
+
onChange: () => onToggleSelect === null || onToggleSelect === void 0 ? void 0 : onToggleSelect()
|
|
83
|
+
}) : null;
|
|
84
|
+
$[13] = ariaLabel;
|
|
85
|
+
$[14] = label;
|
|
86
|
+
$[15] = onToggleSelect;
|
|
87
|
+
$[16] = selection;
|
|
88
|
+
$[17] = selectionDisabled;
|
|
89
|
+
$[18] = t10;
|
|
90
|
+
} else t10 = $[18];
|
|
91
|
+
let t11;
|
|
92
|
+
if ($[19] !== ariaLabel || $[20] !== bodyId || $[21] !== collapsible || $[22] !== expanded || $[23] !== isExpanded || $[24] !== label || $[25] !== rowCount || $[26] !== setExpanded) {
|
|
93
|
+
t11 = collapsible ? /* @__PURE__ */ jsx(Button, {
|
|
76
94
|
className: Table_module_css_default.TableGroupToggle,
|
|
77
95
|
"data-component": "Table.Group.Toggle",
|
|
78
96
|
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : label,
|
|
@@ -84,78 +102,90 @@ function TableGroup(t0) {
|
|
|
84
102
|
},
|
|
85
103
|
children: /* @__PURE__ */ jsx(ChevronRightIcon, { "aria-hidden": "true" })
|
|
86
104
|
}) : null;
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
} else
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
$[
|
|
101
|
-
} else
|
|
102
|
-
const
|
|
103
|
-
let t13;
|
|
104
|
-
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
105
|
-
t13 = clsx("TableGroupHeaderLabel", Table_module_css_default.TableGroupHeaderLabel);
|
|
106
|
-
$[23] = t13;
|
|
107
|
-
} else t13 = $[23];
|
|
105
|
+
$[19] = ariaLabel;
|
|
106
|
+
$[20] = bodyId;
|
|
107
|
+
$[21] = collapsible;
|
|
108
|
+
$[22] = expanded;
|
|
109
|
+
$[23] = isExpanded;
|
|
110
|
+
$[24] = label;
|
|
111
|
+
$[25] = rowCount;
|
|
112
|
+
$[26] = setExpanded;
|
|
113
|
+
$[27] = t11;
|
|
114
|
+
} else t11 = $[27];
|
|
115
|
+
let t12;
|
|
116
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
117
|
+
t12 = clsx("TableGroupHeaderContent", Table_module_css_default.TableGroupHeaderContent);
|
|
118
|
+
$[28] = t12;
|
|
119
|
+
} else t12 = $[28];
|
|
120
|
+
const t13 = collapsible || void 0;
|
|
108
121
|
let t14;
|
|
109
|
-
if ($[
|
|
110
|
-
t14 =
|
|
111
|
-
$[
|
|
112
|
-
} else t14 = $[
|
|
122
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
+
t14 = clsx("TableGroupHeaderLabel", Table_module_css_default.TableGroupHeaderLabel);
|
|
124
|
+
$[29] = t14;
|
|
125
|
+
} else t14 = $[29];
|
|
113
126
|
let t15;
|
|
114
|
-
if ($[
|
|
115
|
-
t15 = /* @__PURE__ */
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
$[25] = label;
|
|
120
|
-
$[26] = t15;
|
|
121
|
-
} else t15 = $[26];
|
|
127
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
128
|
+
t15 = /* @__PURE__ */ jsx(VisuallyHidden, { children: "," });
|
|
129
|
+
$[30] = t15;
|
|
130
|
+
} else t15 = $[30];
|
|
122
131
|
let t16;
|
|
123
|
-
if ($[
|
|
124
|
-
t16 =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const t17 = rowCount === 1 ? " row" : " rows";
|
|
128
|
-
let t18;
|
|
129
|
-
if ($[28] !== t17) {
|
|
130
|
-
t18 = /* @__PURE__ */ jsx(VisuallyHidden, { children: t17 });
|
|
131
|
-
$[28] = t17;
|
|
132
|
-
$[29] = t18;
|
|
133
|
-
} else t18 = $[29];
|
|
134
|
-
let t19;
|
|
135
|
-
if ($[30] !== rowCount || $[31] !== t18) {
|
|
136
|
-
t19 = /* @__PURE__ */ jsxs("span", {
|
|
137
|
-
className: t16,
|
|
138
|
-
children: [rowCount, t18]
|
|
132
|
+
if ($[31] !== label) {
|
|
133
|
+
t16 = /* @__PURE__ */ jsxs("span", {
|
|
134
|
+
className: t14,
|
|
135
|
+
children: [label, t15]
|
|
139
136
|
});
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
$[31] = label;
|
|
138
|
+
$[32] = t16;
|
|
139
|
+
} else t16 = $[32];
|
|
140
|
+
let t17;
|
|
141
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
142
|
+
t17 = clsx("TableGroupHeaderCount", Table_module_css_default.TableGroupHeaderCount);
|
|
143
|
+
$[33] = t17;
|
|
144
|
+
} else t17 = $[33];
|
|
145
|
+
const t18 = rowCount === 1 ? " row" : " rows";
|
|
146
|
+
let t19;
|
|
147
|
+
if ($[34] !== t18) {
|
|
148
|
+
t19 = /* @__PURE__ */ jsx(VisuallyHidden, { children: t18 });
|
|
149
|
+
$[34] = t18;
|
|
150
|
+
$[35] = t19;
|
|
151
|
+
} else t19 = $[35];
|
|
144
152
|
let t20;
|
|
145
|
-
if ($[
|
|
153
|
+
if ($[36] !== rowCount || $[37] !== t19) {
|
|
146
154
|
t20 = /* @__PURE__ */ jsxs("span", {
|
|
147
|
-
className:
|
|
148
|
-
|
|
149
|
-
children: [t15, t19]
|
|
155
|
+
className: t17,
|
|
156
|
+
children: [rowCount, t19]
|
|
150
157
|
});
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
|
|
155
|
-
} else t20 = $[36];
|
|
158
|
+
$[36] = rowCount;
|
|
159
|
+
$[37] = t19;
|
|
160
|
+
$[38] = t20;
|
|
161
|
+
} else t20 = $[38];
|
|
156
162
|
let t21;
|
|
157
|
-
if ($[
|
|
158
|
-
t21 = /* @__PURE__ */
|
|
163
|
+
if ($[39] !== t13 || $[40] !== t16 || $[41] !== t20) {
|
|
164
|
+
t21 = /* @__PURE__ */ jsxs("span", {
|
|
165
|
+
className: t12,
|
|
166
|
+
"aria-hidden": t13,
|
|
167
|
+
children: [t16, t20]
|
|
168
|
+
});
|
|
169
|
+
$[39] = t13;
|
|
170
|
+
$[40] = t16;
|
|
171
|
+
$[41] = t20;
|
|
172
|
+
$[42] = t21;
|
|
173
|
+
} else t21 = $[42];
|
|
174
|
+
let t22;
|
|
175
|
+
if ($[43] !== selection || $[44] !== t11 || $[45] !== t21) {
|
|
176
|
+
t22 = /* @__PURE__ */ jsxs("span", {
|
|
177
|
+
className: Table_module_css_default.TableGroupHeaderTitle,
|
|
178
|
+
"data-selection": selection,
|
|
179
|
+
children: [t11, t21]
|
|
180
|
+
});
|
|
181
|
+
$[43] = selection;
|
|
182
|
+
$[44] = t11;
|
|
183
|
+
$[45] = t21;
|
|
184
|
+
$[46] = t22;
|
|
185
|
+
} else t22 = $[46];
|
|
186
|
+
let t23;
|
|
187
|
+
if ($[47] !== colSpan || $[48] !== headerId || $[49] !== t10 || $[50] !== t22 || $[51] !== t9) {
|
|
188
|
+
t23 = /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs("th", {
|
|
159
189
|
id: headerId,
|
|
160
190
|
ref: headerRef,
|
|
161
191
|
className: t8,
|
|
@@ -164,72 +194,75 @@ function TableGroup(t0) {
|
|
|
164
194
|
role: "columnheader",
|
|
165
195
|
"aria-label": t9,
|
|
166
196
|
"data-component": "Table.Group.Header",
|
|
167
|
-
children: [t10,
|
|
197
|
+
children: [t10, t22]
|
|
168
198
|
}) });
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
} else
|
|
176
|
-
let
|
|
177
|
-
if ($[
|
|
178
|
-
|
|
199
|
+
$[47] = colSpan;
|
|
200
|
+
$[48] = headerId;
|
|
201
|
+
$[49] = t10;
|
|
202
|
+
$[50] = t22;
|
|
203
|
+
$[51] = t9;
|
|
204
|
+
$[52] = t23;
|
|
205
|
+
} else t23 = $[52];
|
|
206
|
+
let t24;
|
|
207
|
+
if ($[53] !== id || $[54] !== t23 || $[55] !== t7) {
|
|
208
|
+
t24 = /* @__PURE__ */ jsx("tbody", {
|
|
179
209
|
className: t7,
|
|
180
210
|
role: "rowgroup",
|
|
181
211
|
"data-component": "Table.Group",
|
|
182
212
|
"data-group-id": id,
|
|
183
|
-
children:
|
|
213
|
+
children: t23
|
|
184
214
|
});
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
} else
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
if ($[
|
|
193
|
-
|
|
194
|
-
$[
|
|
195
|
-
} else
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
215
|
+
$[53] = id;
|
|
216
|
+
$[54] = t23;
|
|
217
|
+
$[55] = t7;
|
|
218
|
+
$[56] = t24;
|
|
219
|
+
} else t24 = $[56];
|
|
220
|
+
const t25 = !isExpanded;
|
|
221
|
+
let t26;
|
|
222
|
+
if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
|
|
223
|
+
t26 = clsx("TableBody", Table_module_css_default.TableBody);
|
|
224
|
+
$[57] = t26;
|
|
225
|
+
} else t26 = $[57];
|
|
226
|
+
const t27 = collapsible ? selection : void 0;
|
|
227
|
+
let t28;
|
|
228
|
+
if ($[58] !== children || $[59] !== contextValue) {
|
|
229
|
+
t28 = /* @__PURE__ */ jsx(TableGroupContext.Provider, {
|
|
199
230
|
value: contextValue,
|
|
200
231
|
children
|
|
201
232
|
});
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
} else
|
|
206
|
-
let
|
|
207
|
-
if ($[
|
|
208
|
-
|
|
233
|
+
$[58] = children;
|
|
234
|
+
$[59] = contextValue;
|
|
235
|
+
$[60] = t28;
|
|
236
|
+
} else t28 = $[60];
|
|
237
|
+
let t29;
|
|
238
|
+
if ($[61] !== bodyId || $[62] !== bodyRef || $[63] !== id || $[64] !== t25 || $[65] !== t27 || $[66] !== t28) {
|
|
239
|
+
t29 = /* @__PURE__ */ jsx("tbody", {
|
|
209
240
|
id: bodyId,
|
|
210
241
|
ref: bodyRef,
|
|
211
|
-
hidden:
|
|
212
|
-
className:
|
|
242
|
+
hidden: t25,
|
|
243
|
+
className: t26,
|
|
213
244
|
role: "rowgroup",
|
|
214
245
|
"data-component": "Table.Group.Body",
|
|
215
246
|
"data-group-id": id,
|
|
216
|
-
|
|
247
|
+
"data-selection": t27,
|
|
248
|
+
children: t28
|
|
217
249
|
});
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
|
|
232
|
-
|
|
250
|
+
$[61] = bodyId;
|
|
251
|
+
$[62] = bodyRef;
|
|
252
|
+
$[63] = id;
|
|
253
|
+
$[64] = t25;
|
|
254
|
+
$[65] = t27;
|
|
255
|
+
$[66] = t28;
|
|
256
|
+
$[67] = t29;
|
|
257
|
+
} else t29 = $[67];
|
|
258
|
+
let t30;
|
|
259
|
+
if ($[68] !== t24 || $[69] !== t29) {
|
|
260
|
+
t30 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t24, t29] });
|
|
261
|
+
$[68] = t24;
|
|
262
|
+
$[69] = t29;
|
|
263
|
+
$[70] = t30;
|
|
264
|
+
} else t30 = $[70];
|
|
265
|
+
return t30;
|
|
233
266
|
}
|
|
234
267
|
//#endregion
|
|
235
268
|
export { TableGroup };
|
|
@@ -2,7 +2,8 @@ import { SlotMarker } from "../utils/types/Slots.js";
|
|
|
2
2
|
import { ObjectPaths } from "./utils.js";
|
|
3
3
|
import { DataTableData, DataTableRowGroup, DataTableRowId, UniqueRow } from "./row.js";
|
|
4
4
|
import { CellAlignment, Column, ColumnWidth, createColumnHelper } from "./column.js";
|
|
5
|
-
import {
|
|
5
|
+
import { TableBulkActions, TableBulkActionsProps } from "./TableBulkActions.js";
|
|
6
|
+
import { DataTable, DataTableBulkActionsContext, DataTableProps } from "./DataTable.js";
|
|
6
7
|
import { ErrorDialog } from "./ErrorDialog.js";
|
|
7
8
|
import { Table as Table$1, TableActions, TableActionsProps, TableBody, TableBodyProps, TableCell, TableCellPlaceholder, TableCellProps, TableContainer, TableContainerProps, TableDivider, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, TableRowSelection, TableRowSelectionProps, TableSelectionHeader, TableSelectionHeaderProps, TableSkeleton, TableSkeletonProps, TableSubtitle, TableSubtitleProps, TableTitle, TableTitleProps } from "./Table.js";
|
|
8
9
|
import { TableGroup, TableGroupProps } from "./TableGroup.js";
|
|
@@ -14,6 +15,7 @@ declare const Table: typeof Table$1 & SlotMarker & {
|
|
|
14
15
|
Title: typeof TableTitle;
|
|
15
16
|
Subtitle: typeof TableSubtitle;
|
|
16
17
|
Actions: typeof TableActions;
|
|
18
|
+
BulkActions: typeof TableBulkActions;
|
|
17
19
|
Divider: typeof TableDivider;
|
|
18
20
|
Skeleton: typeof TableSkeleton;
|
|
19
21
|
Head: typeof TableHead;
|
|
@@ -29,4 +31,4 @@ declare const Table: typeof Table$1 & SlotMarker & {
|
|
|
29
31
|
ErrorDialog: typeof ErrorDialog;
|
|
30
32
|
};
|
|
31
33
|
//#endregion
|
|
32
|
-
export { type CellAlignment, type Column, type ColumnWidth, DataTable, type DataTableData, type DataTableProps, type DataTableRowGroup, type DataTableRowId, type ObjectPaths, Table, type TableActionsProps, type TableBodyProps, type TableCellProps, type TableContainerProps, type TableGroupProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, type TableRowSelectionProps, type TableSelectionHeaderProps, type TableSubtitleProps, type TableTitleProps, type UniqueRow, createColumnHelper };
|
|
34
|
+
export { type CellAlignment, type Column, type ColumnWidth, DataTable, type DataTableBulkActionsContext, type DataTableData, type DataTableProps, type DataTableRowGroup, type DataTableRowId, type ObjectPaths, Table, type TableActionsProps, type TableBodyProps, type TableBulkActionsProps, type TableCellProps, type TableContainerProps, type TableGroupProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, type TableRowSelectionProps, type TableSelectionHeaderProps, type TableSubtitleProps, type TableTitleProps, type UniqueRow, createColumnHelper };
|
package/dist/DataTable/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Table as Table$1, TableActions, TableBody, TableCell, TableCellPlaceholder, TableContainer, TableDivider, TableHead, TableHeader, TableRow, TableRowSelection, TableSelectionHeader, TableSkeleton, TableSubtitle, TableTitle } from "./Table.js";
|
|
2
2
|
import { TableGroup } from "./TableGroup.js";
|
|
3
|
+
import { TableBulkActions } from "./TableBulkActions.js";
|
|
3
4
|
import { DataTable } from "./DataTable.js";
|
|
4
5
|
import { ErrorDialog } from "./ErrorDialog.js";
|
|
5
6
|
import { Pagination } from "./Pagination.js";
|
|
@@ -10,6 +11,7 @@ const Table = Object.assign(Table$1, {
|
|
|
10
11
|
Title: TableTitle,
|
|
11
12
|
Subtitle: TableSubtitle,
|
|
12
13
|
Actions: TableActions,
|
|
14
|
+
BulkActions: TableBulkActions,
|
|
13
15
|
Divider: TableDivider,
|
|
14
16
|
Skeleton: TableSkeleton,
|
|
15
17
|
Head: TableHead,
|
|
@@ -4,7 +4,7 @@ import { DEFAULT_SORT_DIRECTION, SortDirection, strategies, transition } from ".
|
|
|
4
4
|
import { useId, useState } from "react";
|
|
5
5
|
//#region src/DataTable/useTable.ts
|
|
6
6
|
function useTable(t0) {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(82);
|
|
8
8
|
const { columns, data, initialSortColumn, initialSortDirection, externalSorting, getRowId, rowSelection: t1, selectedRows: controlledSelectedRows, defaultSelectedRows, onSelectionChange, isRowSelectable, collapsibleGroups: t2, expandedGroups: controlledExpandedGroups, defaultExpandedGroups, onExpandedGroupsChange } = t0;
|
|
9
9
|
const rowSelection = t1 === void 0 ? false : t1;
|
|
10
10
|
const collapsibleGroups = t2 === void 0 ? false : t2;
|
|
@@ -232,13 +232,17 @@ function useTable(t0) {
|
|
|
232
232
|
for (const item_0 of rowOrder) if (isDataTableRowGroup(item_0)) {
|
|
233
233
|
if (body.rows.length > 0) bodies.push(body);
|
|
234
234
|
const groupStartIndex = rowIndex_0;
|
|
235
|
+
const rows_1 = item_0.rows.map((row_1, index_2) => createRow(row_1, groupStartIndex + index_2));
|
|
236
|
+
const selectableRows = rows_1.filter(_temp2);
|
|
235
237
|
bodies.push({
|
|
236
238
|
type: "row-group",
|
|
237
239
|
key: `group:${typeof item_0.groupId}:${item_0.groupId}`,
|
|
238
240
|
id: item_0.groupId,
|
|
239
241
|
label: item_0.label,
|
|
240
|
-
rows:
|
|
242
|
+
rows: rows_1,
|
|
241
243
|
expanded: !collapsibleGroups || expandedGroups.has(item_0.groupId),
|
|
244
|
+
selection: selectableRows.length > 0 && selectableRows.every(_temp3) ? "all" : selectableRows.some(_temp4) ? "some" : "none",
|
|
245
|
+
selectable: selectableRows.length > 0,
|
|
242
246
|
"aria-label": item_0["aria-label"]
|
|
243
247
|
});
|
|
244
248
|
rowIndex_0 = rowIndex_0 + item_0.rows.length;
|
|
@@ -252,7 +256,7 @@ function useTable(t0) {
|
|
|
252
256
|
rowIndex_0 = rowIndex_0 + 1;
|
|
253
257
|
}
|
|
254
258
|
if (body.rows.length > 0 || bodies.length === 0) bodies.push(body);
|
|
255
|
-
t11 = bodies.flatMap(
|
|
259
|
+
t11 = bodies.flatMap(_temp5).filter(_temp6);
|
|
256
260
|
$[23] = collapsibleGroups;
|
|
257
261
|
$[24] = columns;
|
|
258
262
|
$[25] = data;
|
|
@@ -277,25 +281,25 @@ function useTable(t0) {
|
|
|
277
281
|
sortBy = $[39];
|
|
278
282
|
t11 = $[40];
|
|
279
283
|
}
|
|
280
|
-
const
|
|
284
|
+
const selectableRows_0 = t11;
|
|
281
285
|
let t12;
|
|
282
|
-
if ($[45] !==
|
|
283
|
-
t12 = new Set(
|
|
284
|
-
$[45] =
|
|
286
|
+
if ($[45] !== selectableRows_0) {
|
|
287
|
+
t12 = new Set(selectableRows_0.filter(_temp7).map(_temp8));
|
|
288
|
+
$[45] = selectableRows_0;
|
|
285
289
|
$[46] = t12;
|
|
286
290
|
} else t12 = $[46];
|
|
287
291
|
const effectiveSelectedRows = t12;
|
|
288
292
|
const selectedCount = effectiveSelectedRows.size;
|
|
289
|
-
const selectableCount =
|
|
293
|
+
const selectableCount = selectableRows_0.length;
|
|
290
294
|
const allSelected = selectableCount > 0 && selectedCount === selectableCount;
|
|
291
295
|
const someSelected = selectedCount > 0 && !allSelected;
|
|
292
296
|
let t13;
|
|
293
297
|
if ($[47] !== selectedRows || $[48] !== setSelectedRows) {
|
|
294
|
-
t13 = function toggleRowSelection(
|
|
295
|
-
if (!
|
|
298
|
+
t13 = function toggleRowSelection(row_8) {
|
|
299
|
+
if (!row_8.selectable) return;
|
|
296
300
|
const nextSelectedRows_0 = new Set(selectedRows);
|
|
297
|
-
if (nextSelectedRows_0.has(
|
|
298
|
-
else nextSelectedRows_0.add(
|
|
301
|
+
if (nextSelectedRows_0.has(row_8.selectionId)) nextSelectedRows_0.delete(row_8.selectionId);
|
|
302
|
+
else nextSelectedRows_0.add(row_8.selectionId);
|
|
299
303
|
setSelectedRows(nextSelectedRows_0);
|
|
300
304
|
};
|
|
301
305
|
$[47] = selectedRows;
|
|
@@ -303,54 +307,76 @@ function useTable(t0) {
|
|
|
303
307
|
$[49] = t13;
|
|
304
308
|
} else t13 = $[49];
|
|
305
309
|
const toggleRowSelection = t13;
|
|
306
|
-
let
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
+
let toggleAllRows;
|
|
311
|
+
let toggleGroupSelection;
|
|
312
|
+
if ($[50] !== allSelected || $[51] !== selectableRows_0 || $[52] !== selectedRows || $[53] !== setSelectedRows) {
|
|
313
|
+
toggleAllRows = function toggleAllRows() {
|
|
314
|
+
toggleRowsSelection(selectableRows_0, allSelected);
|
|
315
|
+
};
|
|
316
|
+
toggleGroupSelection = function toggleGroupSelection(group_0) {
|
|
317
|
+
toggleRowsSelection(group_0.rows.filter(_temp9), group_0.selection === "all");
|
|
318
|
+
};
|
|
319
|
+
function toggleRowsSelection(rows_2, allSelected_0) {
|
|
320
|
+
if (rows_2.length === 0) return;
|
|
310
321
|
const nextSelectedRows_1 = new Set(selectedRows);
|
|
311
|
-
for (const
|
|
312
|
-
else nextSelectedRows_1.add(
|
|
322
|
+
for (const row_10 of rows_2) if (allSelected_0) nextSelectedRows_1.delete(row_10.selectionId);
|
|
323
|
+
else nextSelectedRows_1.add(row_10.selectionId);
|
|
313
324
|
setSelectedRows(nextSelectedRows_1);
|
|
314
|
-
}
|
|
325
|
+
}
|
|
315
326
|
$[50] = allSelected;
|
|
316
|
-
$[51] =
|
|
327
|
+
$[51] = selectableRows_0;
|
|
317
328
|
$[52] = selectedRows;
|
|
318
329
|
$[53] = setSelectedRows;
|
|
319
|
-
$[54] =
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
330
|
+
$[54] = toggleAllRows;
|
|
331
|
+
$[55] = toggleGroupSelection;
|
|
332
|
+
} else {
|
|
333
|
+
toggleAllRows = $[54];
|
|
334
|
+
toggleGroupSelection = $[55];
|
|
335
|
+
}
|
|
336
|
+
let t14;
|
|
337
|
+
if ($[56] !== collapsibleGroups || $[57] !== expandedGroups || $[58] !== setExpandedGroups) {
|
|
338
|
+
t14 = function toggleGroupExpansion(group_1) {
|
|
325
339
|
if (!collapsibleGroups) return;
|
|
326
340
|
const nextExpandedGroups_0 = new Set(expandedGroups);
|
|
327
|
-
if (nextExpandedGroups_0.has(
|
|
328
|
-
else nextExpandedGroups_0.add(
|
|
341
|
+
if (nextExpandedGroups_0.has(group_1.id)) nextExpandedGroups_0.delete(group_1.id);
|
|
342
|
+
else nextExpandedGroups_0.add(group_1.id);
|
|
329
343
|
setExpandedGroups(nextExpandedGroups_0);
|
|
330
344
|
};
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
$[
|
|
335
|
-
} else
|
|
336
|
-
const toggleGroupExpansion =
|
|
345
|
+
$[56] = collapsibleGroups;
|
|
346
|
+
$[57] = expandedGroups;
|
|
347
|
+
$[58] = setExpandedGroups;
|
|
348
|
+
$[59] = t14;
|
|
349
|
+
} else t14 = $[59];
|
|
350
|
+
const toggleGroupExpansion = t14;
|
|
351
|
+
let t15;
|
|
352
|
+
if ($[60] !== setSelectedRows) {
|
|
353
|
+
t15 = () => {
|
|
354
|
+
setSelectedRows(/* @__PURE__ */ new Set());
|
|
355
|
+
};
|
|
356
|
+
$[60] = setSelectedRows;
|
|
357
|
+
$[61] = t15;
|
|
358
|
+
} else t15 = $[61];
|
|
337
359
|
let t16;
|
|
338
|
-
if ($[
|
|
360
|
+
if ($[62] !== sortBy || $[63] !== t15 || $[64] !== toggleAllRows || $[65] !== toggleGroupExpansion || $[66] !== toggleGroupSelection || $[67] !== toggleRowSelection) {
|
|
339
361
|
t16 = {
|
|
340
362
|
sortBy,
|
|
341
363
|
toggleRowSelection,
|
|
342
364
|
toggleAllRows,
|
|
343
|
-
|
|
365
|
+
toggleGroupSelection,
|
|
366
|
+
toggleGroupExpansion,
|
|
367
|
+
clearSelection: t15
|
|
344
368
|
};
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
-
$[
|
|
348
|
-
$[
|
|
349
|
-
$[
|
|
350
|
-
|
|
369
|
+
$[62] = sortBy;
|
|
370
|
+
$[63] = t15;
|
|
371
|
+
$[64] = toggleAllRows;
|
|
372
|
+
$[65] = toggleGroupExpansion;
|
|
373
|
+
$[66] = toggleGroupSelection;
|
|
374
|
+
$[67] = toggleRowSelection;
|
|
375
|
+
$[68] = t16;
|
|
376
|
+
} else t16 = $[68];
|
|
351
377
|
const t17 = `${tableId}-selection-column`;
|
|
352
378
|
let t18;
|
|
353
|
-
if ($[
|
|
379
|
+
if ($[69] !== allSelected || $[70] !== effectiveSelectedRows || $[71] !== selectableCount || $[72] !== selectedCount || $[73] !== someSelected || $[74] !== t17) {
|
|
354
380
|
t18 = {
|
|
355
381
|
headerId: t17,
|
|
356
382
|
selectedRows: effectiveSelectedRows,
|
|
@@ -359,16 +385,16 @@ function useTable(t0) {
|
|
|
359
385
|
selectableCount,
|
|
360
386
|
selectedCount
|
|
361
387
|
};
|
|
362
|
-
$[
|
|
363
|
-
$[
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
} else t18 = $[
|
|
388
|
+
$[69] = allSelected;
|
|
389
|
+
$[70] = effectiveSelectedRows;
|
|
390
|
+
$[71] = selectableCount;
|
|
391
|
+
$[72] = selectedCount;
|
|
392
|
+
$[73] = someSelected;
|
|
393
|
+
$[74] = t17;
|
|
394
|
+
$[75] = t18;
|
|
395
|
+
} else t18 = $[75];
|
|
370
396
|
let t19;
|
|
371
|
-
if ($[
|
|
397
|
+
if ($[76] !== bodies || $[77] !== gridTemplateColumns || $[78] !== headers || $[79] !== t16 || $[80] !== t18) {
|
|
372
398
|
t19 = {
|
|
373
399
|
headers,
|
|
374
400
|
actions: t16,
|
|
@@ -376,26 +402,38 @@ function useTable(t0) {
|
|
|
376
402
|
gridTemplateColumns,
|
|
377
403
|
bodies
|
|
378
404
|
};
|
|
379
|
-
$[
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
382
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
385
|
-
} else t19 = $[
|
|
405
|
+
$[76] = bodies;
|
|
406
|
+
$[77] = gridTemplateColumns;
|
|
407
|
+
$[78] = headers;
|
|
408
|
+
$[79] = t16;
|
|
409
|
+
$[80] = t18;
|
|
410
|
+
$[81] = t19;
|
|
411
|
+
} else t19 = $[81];
|
|
386
412
|
return t19;
|
|
387
413
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
414
|
+
function _temp9(row_9) {
|
|
415
|
+
return row_9.selectable;
|
|
416
|
+
}
|
|
417
|
+
function _temp8(row_7) {
|
|
418
|
+
return row_7.selectionId;
|
|
419
|
+
}
|
|
420
|
+
function _temp7(row_6) {
|
|
421
|
+
return row_6.selected;
|
|
422
|
+
}
|
|
423
|
+
function _temp6(row_5) {
|
|
424
|
+
return row_5.selectable;
|
|
425
|
+
}
|
|
426
|
+
function _temp5(body_0) {
|
|
427
|
+
return body_0.rows;
|
|
390
428
|
}
|
|
391
429
|
function _temp4(row_3) {
|
|
392
430
|
return row_3.selected;
|
|
393
431
|
}
|
|
394
|
-
function _temp3(
|
|
395
|
-
return
|
|
432
|
+
function _temp3(row_4) {
|
|
433
|
+
return row_4.selected;
|
|
396
434
|
}
|
|
397
|
-
function _temp2(
|
|
398
|
-
return
|
|
435
|
+
function _temp2(row_2) {
|
|
436
|
+
return row_2.selectable;
|
|
399
437
|
}
|
|
400
438
|
function _temp(group) {
|
|
401
439
|
return group.groupId;
|
|
@@ -10,7 +10,8 @@ const DefaultFeatureFlags = FeatureFlagScope.create({
|
|
|
10
10
|
primer_react_action_list_item_gap: false,
|
|
11
11
|
primer_react_timeline_list_semantics: false,
|
|
12
12
|
primer_react_merged_forwarded_refs: false,
|
|
13
|
-
primer_react_button_loading_disabled_styles: false
|
|
13
|
+
primer_react_button_loading_disabled_styles: false,
|
|
14
|
+
primer_react_blankslate_compact_default: false
|
|
14
15
|
});
|
|
15
16
|
//#endregion
|
|
16
17
|
export { DefaultFeatureFlags };
|