@primer/react 38.43.0-rc.fd837f586 → 38.44.0-rc.0c9e08268
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 +18 -0
- package/dist/DataTable/DataTable.d.ts +20 -0
- package/dist/DataTable/DataTable.js +106 -88
- package/dist/DataTable/Table-0327e248.css +2 -0
- package/dist/DataTable/Table-0327e248.css.map +1 -0
- package/dist/DataTable/Table.js +53 -41
- package/dist/DataTable/Table.module.css.js +6 -5
- package/dist/DataTable/TableGroup.d.ts +25 -1
- package/dist/DataTable/TableGroup.js +195 -119
- package/dist/DataTable/useTable.js +184 -131
- package/dist/Token/_RemoveTokenButton.js +115 -20
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +417 -121
- package/dist/hooks/useControllableState.js +70 -19
- package/dist/hooks/useOnOutsideClick.js +48 -21
- package/dist/hooks/useSafeTimeout.js +54 -19
- package/dist/internal/hooks/useDevOnlyEffect.js +3 -8
- package/generated/components.json +47 -0
- package/package.json +3 -3
- package/dist/DataTable/Table-6ee6a868.css +0 -2
- package/dist/DataTable/Table-6ee6a868.css.map +0 -1
|
@@ -4,51 +4,81 @@ 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(
|
|
8
|
-
const { columns, data, initialSortColumn, initialSortDirection, externalSorting, getRowId, rowSelection: t1, selectedRows: controlledSelectedRows, defaultSelectedRows, onSelectionChange, isRowSelectable } = t0;
|
|
7
|
+
const $ = c(77);
|
|
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
|
+
const collapsibleGroups = t2 === void 0 ? false : t2;
|
|
10
11
|
const tableId = useId();
|
|
11
12
|
const [rowOrder, setRowOrder] = useState(data);
|
|
12
13
|
const [prevData, setPrevData] = useState(data);
|
|
13
14
|
const [prevColumns, setPrevColumns] = useState(columns);
|
|
14
|
-
let
|
|
15
|
+
let t3;
|
|
15
16
|
if ($[0] !== columns || $[1] !== initialSortColumn || $[2] !== initialSortDirection) {
|
|
16
|
-
|
|
17
|
+
t3 = () => getInitialSortState(columns, initialSortColumn, initialSortDirection);
|
|
17
18
|
$[0] = columns;
|
|
18
19
|
$[1] = initialSortColumn;
|
|
19
20
|
$[2] = initialSortDirection;
|
|
20
|
-
$[3] =
|
|
21
|
-
} else
|
|
22
|
-
const [sortByColumn, setSortByColumn] = useState(
|
|
23
|
-
let
|
|
21
|
+
$[3] = t3;
|
|
22
|
+
} else t3 = $[3];
|
|
23
|
+
const [sortByColumn, setSortByColumn] = useState(t3);
|
|
24
|
+
let t4;
|
|
24
25
|
if ($[4] !== defaultSelectedRows) {
|
|
25
|
-
|
|
26
|
+
t4 = () => defaultSelectedRows !== null && defaultSelectedRows !== void 0 ? defaultSelectedRows : /* @__PURE__ */ new Set();
|
|
26
27
|
$[4] = defaultSelectedRows;
|
|
27
|
-
$[5] =
|
|
28
|
-
} else
|
|
29
|
-
let
|
|
28
|
+
$[5] = t4;
|
|
29
|
+
} else t4 = $[5];
|
|
30
|
+
let t5;
|
|
30
31
|
if ($[6] !== onSelectionChange) {
|
|
31
|
-
|
|
32
|
+
t5 = (nextSelectedRows) => {
|
|
32
33
|
onSelectionChange === null || onSelectionChange === void 0 || onSelectionChange({ selectedRows: new Set(nextSelectedRows) });
|
|
33
34
|
};
|
|
34
35
|
$[6] = onSelectionChange;
|
|
35
|
-
$[7] =
|
|
36
|
-
} else
|
|
37
|
-
let
|
|
38
|
-
if ($[8] !== controlledSelectedRows || $[9] !==
|
|
39
|
-
|
|
36
|
+
$[7] = t5;
|
|
37
|
+
} else t5 = $[7];
|
|
38
|
+
let t6;
|
|
39
|
+
if ($[8] !== controlledSelectedRows || $[9] !== t4 || $[10] !== t5) {
|
|
40
|
+
t6 = {
|
|
40
41
|
name: "DataTable selectedRows",
|
|
41
42
|
value: controlledSelectedRows,
|
|
42
|
-
defaultValue:
|
|
43
|
-
onChange:
|
|
43
|
+
defaultValue: t4,
|
|
44
|
+
onChange: t5
|
|
44
45
|
};
|
|
45
46
|
$[8] = controlledSelectedRows;
|
|
46
|
-
$[9] =
|
|
47
|
-
$[10] =
|
|
48
|
-
$[11] =
|
|
49
|
-
} else
|
|
50
|
-
const [selectedRows, setSelectedRows] = useControllableState(
|
|
47
|
+
$[9] = t4;
|
|
48
|
+
$[10] = t5;
|
|
49
|
+
$[11] = t6;
|
|
50
|
+
} else t6 = $[11];
|
|
51
|
+
const [selectedRows, setSelectedRows] = useControllableState(t6);
|
|
51
52
|
const { gridTemplateColumns } = useTableLayout(columns, rowSelection);
|
|
53
|
+
let t7;
|
|
54
|
+
if ($[12] !== data || $[13] !== defaultExpandedGroups) {
|
|
55
|
+
t7 = () => defaultExpandedGroups !== null && defaultExpandedGroups !== void 0 ? defaultExpandedGroups : new Set(data.filter(isDataTableRowGroup).map(_temp));
|
|
56
|
+
$[12] = data;
|
|
57
|
+
$[13] = defaultExpandedGroups;
|
|
58
|
+
$[14] = t7;
|
|
59
|
+
} else t7 = $[14];
|
|
60
|
+
let t8;
|
|
61
|
+
if ($[15] !== onExpandedGroupsChange) {
|
|
62
|
+
t8 = (nextExpandedGroups) => {
|
|
63
|
+
onExpandedGroupsChange === null || onExpandedGroupsChange === void 0 || onExpandedGroupsChange({ expandedGroups: new Set(nextExpandedGroups) });
|
|
64
|
+
};
|
|
65
|
+
$[15] = onExpandedGroupsChange;
|
|
66
|
+
$[16] = t8;
|
|
67
|
+
} else t8 = $[16];
|
|
68
|
+
let t9;
|
|
69
|
+
if ($[17] !== controlledExpandedGroups || $[18] !== t7 || $[19] !== t8) {
|
|
70
|
+
t9 = {
|
|
71
|
+
name: "DataTable expandedGroups",
|
|
72
|
+
value: controlledExpandedGroups,
|
|
73
|
+
defaultValue: t7,
|
|
74
|
+
onChange: t8
|
|
75
|
+
};
|
|
76
|
+
$[17] = controlledExpandedGroups;
|
|
77
|
+
$[18] = t7;
|
|
78
|
+
$[19] = t8;
|
|
79
|
+
$[20] = t9;
|
|
80
|
+
} else t9 = $[20];
|
|
81
|
+
const [expandedGroups, setExpandedGroups] = useControllableState(t9);
|
|
52
82
|
if (columns !== prevColumns) {
|
|
53
83
|
setPrevColumns(columns);
|
|
54
84
|
if (sortByColumn) {
|
|
@@ -59,21 +89,21 @@ function useTable(t0) {
|
|
|
59
89
|
})) setSortByColumn(null);
|
|
60
90
|
}
|
|
61
91
|
}
|
|
62
|
-
let
|
|
63
|
-
if ($[
|
|
64
|
-
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
67
|
-
} else
|
|
68
|
-
const hasGroups =
|
|
92
|
+
let t10;
|
|
93
|
+
if ($[21] !== rowOrder) {
|
|
94
|
+
t10 = rowOrder.some(isDataTableRowGroup);
|
|
95
|
+
$[21] = rowOrder;
|
|
96
|
+
$[22] = t10;
|
|
97
|
+
} else t10 = $[22];
|
|
98
|
+
const hasGroups = t10;
|
|
69
99
|
let bodies;
|
|
70
100
|
let headers;
|
|
71
101
|
let sortBy;
|
|
72
|
-
let
|
|
73
|
-
if ($[
|
|
74
|
-
let
|
|
75
|
-
if ($[
|
|
76
|
-
|
|
102
|
+
let t11;
|
|
103
|
+
if ($[23] !== collapsibleGroups || $[24] !== columns || $[25] !== data || $[26] !== expandedGroups || $[27] !== externalSorting || $[28] !== getRowId || $[29] !== hasGroups || $[30] !== isRowSelectable || $[31] !== prevData || $[32] !== rowOrder || $[33] !== rowSelection || $[34] !== selectedRows || $[35] !== sortByColumn || $[36] !== tableId) {
|
|
104
|
+
let t12;
|
|
105
|
+
if ($[41] !== hasGroups || $[42] !== sortByColumn || $[43] !== tableId) {
|
|
106
|
+
t12 = (column_1, index) => {
|
|
77
107
|
var _column_1$id;
|
|
78
108
|
const id_0 = (_column_1$id = column_1.id) !== null && _column_1$id !== void 0 ? _column_1$id : column_1.field;
|
|
79
109
|
if (id_0 === void 0) throw new Error("Expected either an `id` or `field` to be defined for a Column");
|
|
@@ -91,12 +121,12 @@ function useTable(t0) {
|
|
|
91
121
|
}
|
|
92
122
|
};
|
|
93
123
|
};
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
} else
|
|
99
|
-
headers = columns.map(
|
|
124
|
+
$[41] = hasGroups;
|
|
125
|
+
$[42] = sortByColumn;
|
|
126
|
+
$[43] = tableId;
|
|
127
|
+
$[44] = t12;
|
|
128
|
+
} else t12 = $[44];
|
|
129
|
+
headers = columns.map(t12);
|
|
100
130
|
if (data !== prevData) {
|
|
101
131
|
setPrevData(data);
|
|
102
132
|
updateRowOrder(data, sortByColumn);
|
|
@@ -204,16 +234,17 @@ function useTable(t0) {
|
|
|
204
234
|
const groupStartIndex = rowIndex_0;
|
|
205
235
|
bodies.push({
|
|
206
236
|
type: "row-group",
|
|
207
|
-
key: `group:${item_0.groupId}`,
|
|
237
|
+
key: `group:${typeof item_0.groupId}:${item_0.groupId}`,
|
|
208
238
|
id: item_0.groupId,
|
|
209
239
|
label: item_0.label,
|
|
210
240
|
rows: item_0.rows.map((row_1, index_2) => createRow(row_1, groupStartIndex + index_2)),
|
|
241
|
+
expanded: !collapsibleGroups || expandedGroups.has(item_0.groupId),
|
|
211
242
|
"aria-label": item_0["aria-label"]
|
|
212
243
|
});
|
|
213
244
|
rowIndex_0 = rowIndex_0 + item_0.rows.length;
|
|
214
245
|
body = {
|
|
215
246
|
type: "row-body",
|
|
216
|
-
key: `rows:after:${item_0.groupId}`,
|
|
247
|
+
key: `rows:after:${typeof item_0.groupId}:${item_0.groupId}`,
|
|
217
248
|
rows: []
|
|
218
249
|
};
|
|
219
250
|
} else {
|
|
@@ -221,132 +252,154 @@ function useTable(t0) {
|
|
|
221
252
|
rowIndex_0 = rowIndex_0 + 1;
|
|
222
253
|
}
|
|
223
254
|
if (body.rows.length > 0 || bodies.length === 0) bodies.push(body);
|
|
224
|
-
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
255
|
+
t11 = bodies.flatMap(_temp2).filter(_temp3);
|
|
256
|
+
$[23] = collapsibleGroups;
|
|
257
|
+
$[24] = columns;
|
|
258
|
+
$[25] = data;
|
|
259
|
+
$[26] = expandedGroups;
|
|
260
|
+
$[27] = externalSorting;
|
|
261
|
+
$[28] = getRowId;
|
|
262
|
+
$[29] = hasGroups;
|
|
263
|
+
$[30] = isRowSelectable;
|
|
264
|
+
$[31] = prevData;
|
|
265
|
+
$[32] = rowOrder;
|
|
266
|
+
$[33] = rowSelection;
|
|
267
|
+
$[34] = selectedRows;
|
|
268
|
+
$[35] = sortByColumn;
|
|
269
|
+
$[36] = tableId;
|
|
270
|
+
$[37] = bodies;
|
|
271
|
+
$[38] = headers;
|
|
272
|
+
$[39] = sortBy;
|
|
273
|
+
$[40] = t11;
|
|
241
274
|
} else {
|
|
242
|
-
bodies = $[
|
|
243
|
-
headers = $[
|
|
244
|
-
sortBy = $[
|
|
245
|
-
|
|
275
|
+
bodies = $[37];
|
|
276
|
+
headers = $[38];
|
|
277
|
+
sortBy = $[39];
|
|
278
|
+
t11 = $[40];
|
|
246
279
|
}
|
|
247
|
-
const selectableRows =
|
|
248
|
-
let
|
|
249
|
-
if ($[
|
|
250
|
-
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
} else
|
|
254
|
-
const effectiveSelectedRows =
|
|
280
|
+
const selectableRows = t11;
|
|
281
|
+
let t12;
|
|
282
|
+
if ($[45] !== selectableRows) {
|
|
283
|
+
t12 = new Set(selectableRows.filter(_temp4).map(_temp5));
|
|
284
|
+
$[45] = selectableRows;
|
|
285
|
+
$[46] = t12;
|
|
286
|
+
} else t12 = $[46];
|
|
287
|
+
const effectiveSelectedRows = t12;
|
|
255
288
|
const selectedCount = effectiveSelectedRows.size;
|
|
256
289
|
const selectableCount = selectableRows.length;
|
|
257
290
|
const allSelected = selectableCount > 0 && selectedCount === selectableCount;
|
|
258
291
|
const someSelected = selectedCount > 0 && !allSelected;
|
|
259
|
-
let
|
|
260
|
-
if ($[
|
|
261
|
-
|
|
292
|
+
let t13;
|
|
293
|
+
if ($[47] !== selectedRows || $[48] !== setSelectedRows) {
|
|
294
|
+
t13 = function toggleRowSelection(row_5) {
|
|
262
295
|
if (!row_5.selectable) return;
|
|
263
296
|
const nextSelectedRows_0 = new Set(selectedRows);
|
|
264
297
|
if (nextSelectedRows_0.has(row_5.selectionId)) nextSelectedRows_0.delete(row_5.selectionId);
|
|
265
298
|
else nextSelectedRows_0.add(row_5.selectionId);
|
|
266
299
|
setSelectedRows(nextSelectedRows_0);
|
|
267
300
|
};
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
} else
|
|
272
|
-
const toggleRowSelection =
|
|
273
|
-
let
|
|
274
|
-
if ($[
|
|
275
|
-
|
|
301
|
+
$[47] = selectedRows;
|
|
302
|
+
$[48] = setSelectedRows;
|
|
303
|
+
$[49] = t13;
|
|
304
|
+
} else t13 = $[49];
|
|
305
|
+
const toggleRowSelection = t13;
|
|
306
|
+
let t14;
|
|
307
|
+
if ($[50] !== allSelected || $[51] !== selectableRows || $[52] !== selectedRows || $[53] !== setSelectedRows) {
|
|
308
|
+
t14 = function toggleAllRows() {
|
|
276
309
|
if (selectableRows.length === 0) return;
|
|
277
310
|
const nextSelectedRows_1 = new Set(selectedRows);
|
|
278
311
|
for (const row_6 of selectableRows) if (allSelected) nextSelectedRows_1.delete(row_6.selectionId);
|
|
279
312
|
else nextSelectedRows_1.add(row_6.selectionId);
|
|
280
313
|
setSelectedRows(nextSelectedRows_1);
|
|
281
314
|
};
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
} else
|
|
288
|
-
const toggleAllRows =
|
|
289
|
-
let
|
|
290
|
-
if ($[
|
|
291
|
-
|
|
315
|
+
$[50] = allSelected;
|
|
316
|
+
$[51] = selectableRows;
|
|
317
|
+
$[52] = selectedRows;
|
|
318
|
+
$[53] = setSelectedRows;
|
|
319
|
+
$[54] = t14;
|
|
320
|
+
} else t14 = $[54];
|
|
321
|
+
const toggleAllRows = t14;
|
|
322
|
+
let t15;
|
|
323
|
+
if ($[55] !== collapsibleGroups || $[56] !== expandedGroups || $[57] !== setExpandedGroups) {
|
|
324
|
+
t15 = function toggleGroupExpansion(group_0) {
|
|
325
|
+
if (!collapsibleGroups) return;
|
|
326
|
+
const nextExpandedGroups_0 = new Set(expandedGroups);
|
|
327
|
+
if (nextExpandedGroups_0.has(group_0.id)) nextExpandedGroups_0.delete(group_0.id);
|
|
328
|
+
else nextExpandedGroups_0.add(group_0.id);
|
|
329
|
+
setExpandedGroups(nextExpandedGroups_0);
|
|
330
|
+
};
|
|
331
|
+
$[55] = collapsibleGroups;
|
|
332
|
+
$[56] = expandedGroups;
|
|
333
|
+
$[57] = setExpandedGroups;
|
|
334
|
+
$[58] = t15;
|
|
335
|
+
} else t15 = $[58];
|
|
336
|
+
const toggleGroupExpansion = t15;
|
|
337
|
+
let t16;
|
|
338
|
+
if ($[59] !== sortBy || $[60] !== toggleAllRows || $[61] !== toggleGroupExpansion || $[62] !== toggleRowSelection) {
|
|
339
|
+
t16 = {
|
|
292
340
|
sortBy,
|
|
293
341
|
toggleRowSelection,
|
|
294
|
-
toggleAllRows
|
|
342
|
+
toggleAllRows,
|
|
343
|
+
toggleGroupExpansion
|
|
295
344
|
};
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
345
|
+
$[59] = sortBy;
|
|
346
|
+
$[60] = toggleAllRows;
|
|
347
|
+
$[61] = toggleGroupExpansion;
|
|
348
|
+
$[62] = toggleRowSelection;
|
|
349
|
+
$[63] = t16;
|
|
350
|
+
} else t16 = $[63];
|
|
351
|
+
const t17 = `${tableId}-selection-column`;
|
|
352
|
+
let t18;
|
|
353
|
+
if ($[64] !== allSelected || $[65] !== effectiveSelectedRows || $[66] !== selectableCount || $[67] !== selectedCount || $[68] !== someSelected || $[69] !== t17) {
|
|
354
|
+
t18 = {
|
|
355
|
+
headerId: t17,
|
|
306
356
|
selectedRows: effectiveSelectedRows,
|
|
307
357
|
allSelected,
|
|
308
358
|
someSelected,
|
|
309
359
|
selectableCount,
|
|
310
360
|
selectedCount
|
|
311
361
|
};
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
} else
|
|
320
|
-
let
|
|
321
|
-
if ($[
|
|
322
|
-
|
|
362
|
+
$[64] = allSelected;
|
|
363
|
+
$[65] = effectiveSelectedRows;
|
|
364
|
+
$[66] = selectableCount;
|
|
365
|
+
$[67] = selectedCount;
|
|
366
|
+
$[68] = someSelected;
|
|
367
|
+
$[69] = t17;
|
|
368
|
+
$[70] = t18;
|
|
369
|
+
} else t18 = $[70];
|
|
370
|
+
let t19;
|
|
371
|
+
if ($[71] !== bodies || $[72] !== gridTemplateColumns || $[73] !== headers || $[74] !== t16 || $[75] !== t18) {
|
|
372
|
+
t19 = {
|
|
323
373
|
headers,
|
|
324
|
-
actions:
|
|
325
|
-
selection:
|
|
374
|
+
actions: t16,
|
|
375
|
+
selection: t18,
|
|
326
376
|
gridTemplateColumns,
|
|
327
377
|
bodies
|
|
328
378
|
};
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
$[
|
|
335
|
-
} else
|
|
336
|
-
return
|
|
379
|
+
$[71] = bodies;
|
|
380
|
+
$[72] = gridTemplateColumns;
|
|
381
|
+
$[73] = headers;
|
|
382
|
+
$[74] = t16;
|
|
383
|
+
$[75] = t18;
|
|
384
|
+
$[76] = t19;
|
|
385
|
+
} else t19 = $[76];
|
|
386
|
+
return t19;
|
|
337
387
|
}
|
|
338
|
-
function
|
|
388
|
+
function _temp5(row_4) {
|
|
339
389
|
return row_4.selectionId;
|
|
340
390
|
}
|
|
341
|
-
function
|
|
391
|
+
function _temp4(row_3) {
|
|
342
392
|
return row_3.selected;
|
|
343
393
|
}
|
|
344
|
-
function
|
|
394
|
+
function _temp3(row_2) {
|
|
345
395
|
return row_2.selectable;
|
|
346
396
|
}
|
|
347
|
-
function
|
|
397
|
+
function _temp2(body_0) {
|
|
348
398
|
return body_0.rows;
|
|
349
399
|
}
|
|
400
|
+
function _temp(group) {
|
|
401
|
+
return group.groupId;
|
|
402
|
+
}
|
|
350
403
|
function isDataTableRowGroup(item) {
|
|
351
404
|
return "groupId" in item && "rows" in item && Array.isArray(item.rows);
|
|
352
405
|
}
|
|
@@ -1,29 +1,124 @@
|
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
1
2
|
import { defaultTokenSize } from "./constants.js";
|
|
2
3
|
import _RemoveTokenButton_module_css_default from "./_RemoveTokenButton.module.css.js";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
import { clsx } from "clsx";
|
|
5
6
|
import { XIcon } from "@primer/octicons-react";
|
|
6
7
|
//#region src/Token/_RemoveTokenButton.tsx
|
|
7
|
-
const RemoveTokenButton = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
const RemoveTokenButton = (t0) => {
|
|
9
|
+
const $ = c(32);
|
|
10
|
+
let ariaLabel;
|
|
11
|
+
let className;
|
|
12
|
+
let isParentInteractive;
|
|
13
|
+
let rest;
|
|
14
|
+
let t1;
|
|
15
|
+
let t2;
|
|
16
|
+
if ($[0] !== t0) {
|
|
17
|
+
const { "aria-label": t3, isParentInteractive: t4, size: t5, className: t6, borderOffset: t7, as: _as, children: _children, ...t8 } = t0;
|
|
18
|
+
ariaLabel = t3;
|
|
19
|
+
isParentInteractive = t4;
|
|
20
|
+
t1 = t5;
|
|
21
|
+
className = t6;
|
|
22
|
+
t2 = t7;
|
|
23
|
+
rest = t8;
|
|
24
|
+
$[0] = t0;
|
|
25
|
+
$[1] = ariaLabel;
|
|
26
|
+
$[2] = className;
|
|
27
|
+
$[3] = isParentInteractive;
|
|
28
|
+
$[4] = rest;
|
|
29
|
+
$[5] = t1;
|
|
30
|
+
$[6] = t2;
|
|
31
|
+
} else {
|
|
32
|
+
ariaLabel = $[1];
|
|
33
|
+
className = $[2];
|
|
34
|
+
isParentInteractive = $[3];
|
|
35
|
+
rest = $[4];
|
|
36
|
+
t1 = $[5];
|
|
37
|
+
t2 = $[6];
|
|
38
|
+
}
|
|
39
|
+
const size = t1 === void 0 ? defaultTokenSize : t1;
|
|
40
|
+
const borderOffset = t2 === void 0 ? 0 : t2;
|
|
41
|
+
if (isParentInteractive) {
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[7] !== className) {
|
|
44
|
+
t3 = clsx(_RemoveTokenButton_module_css_default.TokenButton, className);
|
|
45
|
+
$[7] = className;
|
|
46
|
+
$[8] = t3;
|
|
47
|
+
} else t3 = $[8];
|
|
48
|
+
const t4 = `translate(${borderOffset}px, -${borderOffset}px)`;
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[9] !== t4) {
|
|
51
|
+
t5 = { transform: t4 };
|
|
52
|
+
$[9] = t4;
|
|
53
|
+
$[10] = t5;
|
|
54
|
+
} else t5 = $[10];
|
|
55
|
+
const t6 = size === "small" || size === "medium" ? 12 : 16;
|
|
56
|
+
let t7;
|
|
57
|
+
if ($[11] !== t6) {
|
|
58
|
+
t7 = /* @__PURE__ */ jsx(XIcon, { size: t6 });
|
|
59
|
+
$[11] = t6;
|
|
60
|
+
$[12] = t7;
|
|
61
|
+
} else t7 = $[12];
|
|
62
|
+
let t8;
|
|
63
|
+
if ($[13] !== ariaLabel || $[14] !== rest || $[15] !== size || $[16] !== t3 || $[17] !== t5 || $[18] !== t7) {
|
|
64
|
+
t8 = /* @__PURE__ */ jsx("span", {
|
|
65
|
+
...rest,
|
|
66
|
+
tabIndex: -1,
|
|
67
|
+
"aria-label": ariaLabel,
|
|
68
|
+
"data-size": size,
|
|
69
|
+
className: t3,
|
|
70
|
+
style: t5,
|
|
71
|
+
children: t7
|
|
72
|
+
});
|
|
73
|
+
$[13] = ariaLabel;
|
|
74
|
+
$[14] = rest;
|
|
75
|
+
$[15] = size;
|
|
76
|
+
$[16] = t3;
|
|
77
|
+
$[17] = t5;
|
|
78
|
+
$[18] = t7;
|
|
79
|
+
$[19] = t8;
|
|
80
|
+
} else t8 = $[19];
|
|
81
|
+
return t8;
|
|
82
|
+
}
|
|
83
|
+
let t3;
|
|
84
|
+
if ($[20] !== className) {
|
|
85
|
+
t3 = clsx(_RemoveTokenButton_module_css_default.TokenButton, className);
|
|
86
|
+
$[20] = className;
|
|
87
|
+
$[21] = t3;
|
|
88
|
+
} else t3 = $[21];
|
|
89
|
+
const t4 = `translate(${borderOffset}px, -${borderOffset}px)`;
|
|
90
|
+
let t5;
|
|
91
|
+
if ($[22] !== t4) {
|
|
92
|
+
t5 = { transform: t4 };
|
|
93
|
+
$[22] = t4;
|
|
94
|
+
$[23] = t5;
|
|
95
|
+
} else t5 = $[23];
|
|
96
|
+
const t6 = size === "small" || size === "medium" ? 12 : 16;
|
|
97
|
+
let t7;
|
|
98
|
+
if ($[24] !== t6) {
|
|
99
|
+
t7 = /* @__PURE__ */ jsx(XIcon, { size: t6 });
|
|
100
|
+
$[24] = t6;
|
|
101
|
+
$[25] = t7;
|
|
102
|
+
} else t7 = $[25];
|
|
103
|
+
let t8;
|
|
104
|
+
if ($[26] !== rest || $[27] !== size || $[28] !== t3 || $[29] !== t5 || $[30] !== t7) {
|
|
105
|
+
t8 = /* @__PURE__ */ jsx("button", {
|
|
106
|
+
...rest,
|
|
107
|
+
"aria-label": "Remove token",
|
|
108
|
+
"data-size": size,
|
|
109
|
+
className: t3,
|
|
110
|
+
style: t5,
|
|
111
|
+
type: "button",
|
|
112
|
+
children: t7
|
|
113
|
+
});
|
|
114
|
+
$[26] = rest;
|
|
115
|
+
$[27] = size;
|
|
116
|
+
$[28] = t3;
|
|
117
|
+
$[29] = t5;
|
|
118
|
+
$[30] = t7;
|
|
119
|
+
$[31] = t8;
|
|
120
|
+
} else t8 = $[31];
|
|
121
|
+
return t8;
|
|
27
122
|
};
|
|
28
123
|
//#endregion
|
|
29
124
|
export { RemoveTokenButton as default };
|