@primer/react 0.0.0-20260218234921 → 0.0.0-20260219011733
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 +5 -3
- package/dist/ActionList/Description.d.ts.map +1 -1
- package/dist/ActionList/Description.js +40 -76
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +63 -108
- package/dist/ActionList/shared.d.ts +0 -1
- package/dist/ActionList/shared.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +82 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260219011733
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -16,18 +16,20 @@
|
|
|
16
16
|
|
|
17
17
|
- [#7552](https://github.com/primer/react/pull/7552) [`551ec63`](https://github.com/primer/react/commit/551ec6338af5c45e3f549245d85a4dd5a708df47) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(Button): fix CounterLabel remount and remove conditional DEV hook
|
|
18
18
|
|
|
19
|
-
- [#7529](https://github.com/primer/react/pull/7529) [`7b11c23`](https://github.com/primer/react/commit/7b11c23088e9887608d28b8198f3370425f4cd8a) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Add keyboard-accessible tooltip for truncated ActionList.Description
|
|
20
|
-
|
|
21
19
|
- [#7504](https://github.com/primer/react/pull/7504) [`d91e78e`](https://github.com/primer/react/commit/d91e78e8d1e69915222354b95d09d93d269dbd8b) Thanks [@TylerJDev](https://github.com/TylerJDev)! - UnderlineNav: Adds `overflow: hidden` when the "More" button isn't present
|
|
22
20
|
|
|
23
21
|
- [#7526](https://github.com/primer/react/pull/7526) [`0c2358a`](https://github.com/primer/react/commit/0c2358aa12a409f7cbcf15ce4fd41cbb9eee4b6c) Thanks [@hectahertz](https://github.com/hectahertz)! - Add `content-visibility: auto` to ActionList items to improve rendering performance for large lists by allowing the browser to skip layout and paint for off-screen items.
|
|
24
22
|
|
|
25
23
|
- Fake entry to force publishing
|
|
26
24
|
|
|
25
|
+
- [#7498](https://github.com/primer/react/pull/7498) [`0c19492`](https://github.com/primer/react/commit/0c19492ec6fea2b35746307dd0cf8f3ab0746d99) Thanks [@hectahertz](https://github.com/hectahertz)! - Remove render phase setStates on SelectPanel
|
|
26
|
+
|
|
27
27
|
- [#7556](https://github.com/primer/react/pull/7556) [`6dc1858`](https://github.com/primer/react/commit/6dc1858538e3b7ea66b78dd9d37c391c530d78ae) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(ActionList): replace `:has([aria-disabled])` child scan with `data-is-disabled` attribute for faster style recalculation
|
|
28
28
|
|
|
29
29
|
- [#7548](https://github.com/primer/react/pull/7548) [`d4b32c3`](https://github.com/primer/react/commit/d4b32c3672d3d5421711324654c1028527dcdf38) Thanks [@hectahertz](https://github.com/hectahertz)! - perf(useIsMacOS): replace useState+useEffect with useSyncExternalStore to eliminate unnecessary re-render
|
|
30
30
|
|
|
31
|
+
- [#7497](https://github.com/primer/react/pull/7497) [`0b696cc`](https://github.com/primer/react/commit/0b696cc75435b01aacc15e81396fe26e5901c01b) Thanks [@hectahertz](https://github.com/hectahertz)! - Improve SelectPanel performance
|
|
32
|
+
|
|
31
33
|
## 38.12.0
|
|
32
34
|
|
|
33
35
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,
|
|
1
|
+
{"version":3,"file":"Description.d.ts","sourceRoot":"","sources":["../../src/ActionList/Description.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAgD7F,CAAA"}
|
|
@@ -7,7 +7,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
7
7
|
import Truncate from '../Truncate/Truncate.js';
|
|
8
8
|
|
|
9
9
|
const Description = t0 => {
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(26);
|
|
11
11
|
let className;
|
|
12
12
|
let props;
|
|
13
13
|
let style;
|
|
@@ -37,8 +37,7 @@ const Description = t0 => {
|
|
|
37
37
|
const variant = t1 === undefined ? "inline" : t1;
|
|
38
38
|
const {
|
|
39
39
|
blockDescriptionId,
|
|
40
|
-
inlineDescriptionId
|
|
41
|
-
setTruncatedText
|
|
40
|
+
inlineDescriptionId
|
|
42
41
|
} = React.useContext(ItemContext);
|
|
43
42
|
const containerRef = React.useRef(null);
|
|
44
43
|
const [computedTitle, setComputedTitle] = React.useState("");
|
|
@@ -66,101 +65,66 @@ const Description = t0 => {
|
|
|
66
65
|
}
|
|
67
66
|
React.useEffect(t2, t3);
|
|
68
67
|
const effectiveTitle = typeof props.children === "string" ? props.children : computedTitle;
|
|
69
|
-
let t4;
|
|
70
|
-
let t5;
|
|
71
|
-
if ($[11] !== effectiveTitle || $[12] !== setTruncatedText || $[13] !== truncate) {
|
|
72
|
-
t4 = () => {
|
|
73
|
-
if (!truncate || !containerRef.current || !setTruncatedText) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const isContentTruncated = function isContentTruncated() {
|
|
77
|
-
const el = containerRef.current;
|
|
78
|
-
if (!el) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return el.scrollWidth > el.clientWidth;
|
|
82
|
-
};
|
|
83
|
-
setTruncatedText(isContentTruncated() ? effectiveTitle : undefined);
|
|
84
|
-
const observer = new ResizeObserver(() => {
|
|
85
|
-
setTruncatedText(isContentTruncated() ? effectiveTitle : undefined);
|
|
86
|
-
});
|
|
87
|
-
observer.observe(containerRef.current);
|
|
88
|
-
return () => {
|
|
89
|
-
observer.disconnect();
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
t5 = [truncate, effectiveTitle, setTruncatedText];
|
|
93
|
-
$[11] = effectiveTitle;
|
|
94
|
-
$[12] = setTruncatedText;
|
|
95
|
-
$[13] = truncate;
|
|
96
|
-
$[14] = t4;
|
|
97
|
-
$[15] = t5;
|
|
98
|
-
} else {
|
|
99
|
-
t4 = $[14];
|
|
100
|
-
t5 = $[15];
|
|
101
|
-
}
|
|
102
|
-
React.useEffect(t4, t5);
|
|
103
68
|
if (variant === "block" || !truncate) {
|
|
104
|
-
const
|
|
105
|
-
let
|
|
106
|
-
if ($[
|
|
107
|
-
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
69
|
+
const t4 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
|
|
70
|
+
let t5;
|
|
71
|
+
if ($[11] !== className) {
|
|
72
|
+
t5 = clsx(className, classes.Description);
|
|
73
|
+
$[11] = className;
|
|
74
|
+
$[12] = t5;
|
|
110
75
|
} else {
|
|
111
|
-
|
|
76
|
+
t5 = $[12];
|
|
112
77
|
}
|
|
113
|
-
let
|
|
114
|
-
if ($[
|
|
115
|
-
|
|
116
|
-
id:
|
|
117
|
-
className:
|
|
78
|
+
let t6;
|
|
79
|
+
if ($[13] !== props.children || $[14] !== style || $[15] !== t4 || $[16] !== t5) {
|
|
80
|
+
t6 = /*#__PURE__*/jsx("span", {
|
|
81
|
+
id: t4,
|
|
82
|
+
className: t5,
|
|
118
83
|
style: style,
|
|
119
84
|
"data-component": "ActionList.Description",
|
|
120
85
|
children: props.children
|
|
121
86
|
});
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
87
|
+
$[13] = props.children;
|
|
88
|
+
$[14] = style;
|
|
89
|
+
$[15] = t4;
|
|
90
|
+
$[16] = t5;
|
|
91
|
+
$[17] = t6;
|
|
127
92
|
} else {
|
|
128
|
-
|
|
93
|
+
t6 = $[17];
|
|
129
94
|
}
|
|
130
|
-
return
|
|
95
|
+
return t6;
|
|
131
96
|
} else {
|
|
132
|
-
let
|
|
133
|
-
if ($[
|
|
134
|
-
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
97
|
+
let t4;
|
|
98
|
+
if ($[18] !== className) {
|
|
99
|
+
t4 = clsx(className, classes.Description);
|
|
100
|
+
$[18] = className;
|
|
101
|
+
$[19] = t4;
|
|
137
102
|
} else {
|
|
138
|
-
|
|
103
|
+
t4 = $[19];
|
|
139
104
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
t8 = /*#__PURE__*/jsx(Truncate, {
|
|
105
|
+
let t5;
|
|
106
|
+
if ($[20] !== effectiveTitle || $[21] !== inlineDescriptionId || $[22] !== props.children || $[23] !== style || $[24] !== t4) {
|
|
107
|
+
t5 = /*#__PURE__*/jsx(Truncate, {
|
|
144
108
|
ref: containerRef,
|
|
145
109
|
id: inlineDescriptionId,
|
|
146
|
-
className:
|
|
110
|
+
className: t4,
|
|
147
111
|
style: style,
|
|
148
|
-
title:
|
|
112
|
+
title: effectiveTitle,
|
|
149
113
|
inline: true,
|
|
150
114
|
maxWidth: "100%",
|
|
151
115
|
"data-component": "ActionList.Description",
|
|
152
116
|
children: props.children
|
|
153
117
|
});
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
118
|
+
$[20] = effectiveTitle;
|
|
119
|
+
$[21] = inlineDescriptionId;
|
|
120
|
+
$[22] = props.children;
|
|
121
|
+
$[23] = style;
|
|
122
|
+
$[24] = t4;
|
|
123
|
+
$[25] = t5;
|
|
160
124
|
} else {
|
|
161
|
-
|
|
125
|
+
t5 = $[25];
|
|
162
126
|
}
|
|
163
|
-
return
|
|
127
|
+
return t5;
|
|
164
128
|
}
|
|
165
129
|
};
|
|
166
130
|
Description.__SLOT__ = Symbol('ActionList.Description');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/ActionList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAmBrC,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAEpD,CAAA;AA0SD,QAAA,MAAM,IAAI,IAlRa,EAAE,SAAS,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqRjD,CAAA;AAEF,OAAO,EAAC,IAAI,EAAC,CAAA"}
|
package/dist/ActionList/Item.js
CHANGED
|
@@ -15,44 +15,8 @@ import VisuallyHidden from '../_VisuallyHidden.js';
|
|
|
15
15
|
import classes from './ActionList.module.css.js';
|
|
16
16
|
import { clsx } from 'clsx';
|
|
17
17
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
18
|
-
import { TooltipContext, Tooltip } from '../TooltipV2/Tooltip.js';
|
|
19
18
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
19
|
|
|
21
|
-
/**
|
|
22
|
-
* Stable wrapper that keeps Tooltip in the tree for button-semantic items
|
|
23
|
-
* to avoid remount cycles when truncation state changes.
|
|
24
|
-
* For non-button-semantic items, renders children directly.
|
|
25
|
-
*/
|
|
26
|
-
function ConditionalTooltip(t0) {
|
|
27
|
-
const $ = c(4);
|
|
28
|
-
const {
|
|
29
|
-
text,
|
|
30
|
-
enabled,
|
|
31
|
-
children
|
|
32
|
-
} = t0;
|
|
33
|
-
if (!enabled) {
|
|
34
|
-
return children;
|
|
35
|
-
}
|
|
36
|
-
const t1 = text || "";
|
|
37
|
-
const t2 = !text;
|
|
38
|
-
let t3;
|
|
39
|
-
if ($[0] !== children || $[1] !== t1 || $[2] !== t2) {
|
|
40
|
-
t3 = /*#__PURE__*/jsx(Tooltip, {
|
|
41
|
-
text: t1,
|
|
42
|
-
direction: "e",
|
|
43
|
-
delay: "medium",
|
|
44
|
-
_privateDisableTooltip: t2,
|
|
45
|
-
children: children
|
|
46
|
-
});
|
|
47
|
-
$[0] = children;
|
|
48
|
-
$[1] = t1;
|
|
49
|
-
$[2] = t2;
|
|
50
|
-
$[3] = t3;
|
|
51
|
-
} else {
|
|
52
|
-
t3 = $[3];
|
|
53
|
-
}
|
|
54
|
-
return t3;
|
|
55
|
-
}
|
|
56
20
|
const SubItem = t0 => {
|
|
57
21
|
const $ = c(2);
|
|
58
22
|
const {
|
|
@@ -254,7 +218,6 @@ const UnwrappedItem = ({
|
|
|
254
218
|
const blockDescriptionId = `${itemId}--block-description`;
|
|
255
219
|
const trailingVisualId = `${itemId}--trailing-visual`;
|
|
256
220
|
const inactiveWarningId = inactive && !showInactiveIndicator ? `${itemId}--warning-message` : undefined;
|
|
257
|
-
const [truncatedText, setTruncatedText] = React.useState(undefined);
|
|
258
221
|
const DefaultItemWrapper = listSemantics ? DivItemContainerNoBox : ButtonItemContainerNoBox;
|
|
259
222
|
const ItemWrapper = _PrivateItemWrapper || DefaultItemWrapper;
|
|
260
223
|
|
|
@@ -275,8 +238,8 @@ const UnwrappedItem = ({
|
|
|
275
238
|
'data-inactive': inactive ? true : undefined,
|
|
276
239
|
'data-loading': loading && !inactive ? true : undefined,
|
|
277
240
|
tabIndex: focusable ? undefined : 0,
|
|
278
|
-
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''}`,
|
|
279
|
-
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined,
|
|
241
|
+
'aria-labelledby': `${labelId} ${slots.trailingVisual ? trailingVisualId : ''} ${slots.description && descriptionVariant === 'inline' ? inlineDescriptionId : ''}`,
|
|
242
|
+
'aria-describedby': [slots.description && descriptionVariant === 'block' ? blockDescriptionId : undefined, inactiveWarningId !== null && inactiveWarningId !== void 0 ? inactiveWarningId : undefined].filter(String).join(' ').trim() || undefined,
|
|
280
243
|
...(includeSelectionAttribute && {
|
|
281
244
|
[itemSelectionAttribute]: selected
|
|
282
245
|
}),
|
|
@@ -306,76 +269,68 @@ const UnwrappedItem = ({
|
|
|
306
269
|
inactive: Boolean(inactiveText),
|
|
307
270
|
inlineDescriptionId,
|
|
308
271
|
blockDescriptionId,
|
|
309
|
-
trailingVisualId
|
|
310
|
-
setTruncatedText: buttonSemantics ? setTruncatedText : undefined
|
|
272
|
+
trailingVisualId
|
|
311
273
|
},
|
|
312
|
-
children: /*#__PURE__*/
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
className:
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
"
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
id: inactiveWarningId,
|
|
373
|
-
children: inactiveText
|
|
374
|
-
}) : null]
|
|
375
|
-
})]
|
|
376
|
-
}), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
|
|
377
|
-
})
|
|
378
|
-
})
|
|
274
|
+
children: /*#__PURE__*/jsxs("li", {
|
|
275
|
+
...containerProps,
|
|
276
|
+
ref: listSemantics ? forwardedRef : null,
|
|
277
|
+
"data-variant": variant === 'danger' ? variant : undefined,
|
|
278
|
+
"data-active": active ? true : undefined,
|
|
279
|
+
"data-inactive": inactiveText ? true : undefined,
|
|
280
|
+
"data-is-disabled": disabled ? true : undefined,
|
|
281
|
+
"data-has-subitem": slots.subItem ? true : undefined,
|
|
282
|
+
"data-has-description": slots.description ? true : false,
|
|
283
|
+
className: clsx(classes.ActionListItem, className),
|
|
284
|
+
children: [/*#__PURE__*/jsxs(ItemWrapper, {
|
|
285
|
+
...wrapperProps,
|
|
286
|
+
className: classes.ActionListContent,
|
|
287
|
+
"data-size": size
|
|
288
|
+
// @ts-ignore: ItemWrapper is polymorphic and the ref type depends on the rendered element ('button' or 'li')
|
|
289
|
+
,
|
|
290
|
+
ref: forwardedRef,
|
|
291
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
292
|
+
className: classes.Spacer
|
|
293
|
+
}), /*#__PURE__*/jsx(Selection, {
|
|
294
|
+
selected: selected,
|
|
295
|
+
className: classes.LeadingAction
|
|
296
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
297
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
298
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
299
|
+
labelId: labelId,
|
|
300
|
+
loading: loading,
|
|
301
|
+
position: "leading",
|
|
302
|
+
children: slots.leadingVisual
|
|
303
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
304
|
+
className: classes.ActionListSubContent,
|
|
305
|
+
"data-component": "ActionList.Item--DividerContainer",
|
|
306
|
+
children: [/*#__PURE__*/jsxs(ConditionalWrapper, {
|
|
307
|
+
if: !!slots.description,
|
|
308
|
+
className: classes.ItemDescriptionWrap,
|
|
309
|
+
"data-description-variant": descriptionVariant,
|
|
310
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
311
|
+
id: labelId,
|
|
312
|
+
className: classes.ItemLabel,
|
|
313
|
+
children: [childrenWithoutSlots, loading === true && !inactive && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
314
|
+
children: "Loading"
|
|
315
|
+
})]
|
|
316
|
+
}), slots.description]
|
|
317
|
+
}), /*#__PURE__*/jsx(VisualOrIndicator, {
|
|
318
|
+
inactiveText: showInactiveIndicator ? inactiveText : undefined,
|
|
319
|
+
itemHasLeadingVisual: Boolean(slots.leadingVisual),
|
|
320
|
+
labelId: labelId,
|
|
321
|
+
loading: loading,
|
|
322
|
+
position: "trailing",
|
|
323
|
+
children: trailingVisual
|
|
324
|
+
}),
|
|
325
|
+
// If the item is inactive, but it's not in an overlay (e.g. ActionMenu, SelectPanel),
|
|
326
|
+
// render the inactive warning message directly in the item.
|
|
327
|
+
!showInactiveIndicator && inactiveText ? /*#__PURE__*/jsx("span", {
|
|
328
|
+
className: classes.InactiveWarning,
|
|
329
|
+
id: inactiveWarningId,
|
|
330
|
+
children: inactiveText
|
|
331
|
+
}) : null]
|
|
332
|
+
})]
|
|
333
|
+
}), !inactive && !loading && !menuContext && Boolean(slots.trailingAction) && slots.trailingAction, slots.subItem]
|
|
379
334
|
})
|
|
380
335
|
});
|
|
381
336
|
};
|
|
@@ -77,7 +77,6 @@ export type ItemContext = Pick<ActionListItemProps<React.ElementType>, 'variant'
|
|
|
77
77
|
blockDescriptionId?: string;
|
|
78
78
|
trailingVisualId?: string;
|
|
79
79
|
inactive?: boolean;
|
|
80
|
-
setTruncatedText?: (text: string | undefined) => void;
|
|
81
80
|
};
|
|
82
81
|
export declare const ItemContext: React.Context<ItemContext>;
|
|
83
82
|
export declare const getVariantStyles: (variant: ActionListItemProps<React.ElementType>["variant"], disabled: ActionListItemProps<React.ElementType>["disabled"], inactive?: boolean) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/ActionList/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAIjE,KAAK,yBAAyB,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,KAAK,CAAA;AAE/E,MAAM,MAAM,mBAAmB,CAAC,EAAE,SAAS,KAAK,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C,WAAW,CAM1C,CAAA;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,GAAG,WAAW,CAM1D,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA"}
|
|
@@ -132,8 +132,6 @@ function Panel({
|
|
|
132
132
|
wide: false
|
|
133
133
|
}, false);
|
|
134
134
|
const [selectedOnSort, setSelectedOnSort] = useState([]);
|
|
135
|
-
const [prevItems, setPrevItems] = useState([]);
|
|
136
|
-
const [prevOpen, setPrevOpen] = useState(open);
|
|
137
135
|
const initialHeightRef = useRef(0);
|
|
138
136
|
const initialScaleRef = useRef(1);
|
|
139
137
|
const noticeRef = useRef(null);
|
|
@@ -205,6 +203,19 @@ function Panel({
|
|
|
205
203
|
resetSort();
|
|
206
204
|
}
|
|
207
205
|
}, [loadingManagedInternally, externalOnFilterChange, setInternalFilterValue, dataLoadedOnce, safeSetTimeout, safeClearTimeout, items.length, resetSort]);
|
|
206
|
+
|
|
207
|
+
// Pre-compute a Set of item IDs in the current filtered view for O(1) lookups
|
|
208
|
+
const itemsInViewSet = useMemo(() => {
|
|
209
|
+
const set = new Set();
|
|
210
|
+
for (const item of items) {
|
|
211
|
+
if (item.id !== undefined) {
|
|
212
|
+
set.add(item.id);
|
|
213
|
+
} else {
|
|
214
|
+
set.add(item);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return set;
|
|
218
|
+
}, [items]);
|
|
208
219
|
const handleSelectAllChange = useCallback(checked => {
|
|
209
220
|
// Exit early if not in multi-select mode
|
|
210
221
|
if (!isMultiSelectVariant(selected)) {
|
|
@@ -212,13 +223,20 @@ function Panel({
|
|
|
212
223
|
}
|
|
213
224
|
const multiSelectOnChange = onSelectedChange;
|
|
214
225
|
const selectedArray = selected;
|
|
215
|
-
|
|
226
|
+
|
|
227
|
+
// Use Set for O(1) lookup instead of O(n) items.some()
|
|
228
|
+
const selectedItemsNotInFilteredView = selectedArray.filter(selectedItem => {
|
|
229
|
+
if (selectedItem.id !== undefined) {
|
|
230
|
+
return !itemsInViewSet.has(selectedItem.id);
|
|
231
|
+
}
|
|
232
|
+
return !itemsInViewSet.has(selectedItem);
|
|
233
|
+
});
|
|
216
234
|
if (checked) {
|
|
217
235
|
multiSelectOnChange([...selectedItemsNotInFilteredView, ...items]);
|
|
218
236
|
} else {
|
|
219
237
|
multiSelectOnChange(selectedItemsNotInFilteredView);
|
|
220
238
|
}
|
|
221
|
-
}, [items, onSelectedChange, selected]);
|
|
239
|
+
}, [items, itemsInViewSet, onSelectedChange, selected]);
|
|
222
240
|
|
|
223
241
|
// disable body scroll when the panel is open on narrow screens
|
|
224
242
|
useEffect(() => {
|
|
@@ -384,10 +402,29 @@ function Panel({
|
|
|
384
402
|
});
|
|
385
403
|
};
|
|
386
404
|
}, [placeholder, renderAnchor, selected]);
|
|
405
|
+
|
|
406
|
+
// Pre-compute a Set of selected item IDs/references for O(1) lookups
|
|
407
|
+
// This optimizes isItemCurrentlySelected from O(m) to O(1) per call
|
|
408
|
+
const selectedItemsSet = useMemo(() => {
|
|
409
|
+
const set = new Set();
|
|
410
|
+
if (isMultiSelectVariant(selected)) {
|
|
411
|
+
for (const item of selected) {
|
|
412
|
+
if (item.id !== undefined) {
|
|
413
|
+
set.add(item.id);
|
|
414
|
+
} else {
|
|
415
|
+
set.add(item);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return set;
|
|
420
|
+
}, [selected]);
|
|
387
421
|
const isItemCurrentlySelected = useCallback(item => {
|
|
388
|
-
// For multi-select,
|
|
422
|
+
// For multi-select, use the pre-computed Set for O(1) lookup
|
|
389
423
|
if (isMultiSelectVariant(selected)) {
|
|
390
|
-
|
|
424
|
+
if (item.id !== undefined) {
|
|
425
|
+
return selectedItemsSet.has(item.id);
|
|
426
|
+
}
|
|
427
|
+
return selectedItemsSet.has(item);
|
|
391
428
|
}
|
|
392
429
|
|
|
393
430
|
// For single-select modal, there is an intermediate state when the user has selected
|
|
@@ -398,8 +435,24 @@ function Panel({
|
|
|
398
435
|
|
|
399
436
|
// For single-select anchored, we just need to check if the item is the selected item
|
|
400
437
|
return (selected === null || selected === void 0 ? void 0 : selected.id) !== undefined ? selected.id === item.id : selected === item;
|
|
401
|
-
}, [selected, intermediateSelected, isSingleSelectModal]);
|
|
438
|
+
}, [selected, selectedItemsSet, intermediateSelected, isSingleSelectModal]);
|
|
402
439
|
const itemsToRender = useMemo(() => {
|
|
440
|
+
// Pre-compute a Set of selected item IDs/references for O(1) lookups during sorting
|
|
441
|
+
// This avoids O(m * k) work per comparison in the sort function
|
|
442
|
+
const selectedOnSortSet = new Set();
|
|
443
|
+
for (const item of selectedOnSort) {
|
|
444
|
+
if (item.id !== undefined) {
|
|
445
|
+
selectedOnSortSet.add(item.id);
|
|
446
|
+
} else {
|
|
447
|
+
selectedOnSortSet.add(item);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
const isSelectedForSort = item => {
|
|
451
|
+
if (item.id !== undefined) {
|
|
452
|
+
return selectedOnSortSet.has(item.id);
|
|
453
|
+
}
|
|
454
|
+
return selectedOnSortSet.has(item);
|
|
455
|
+
};
|
|
403
456
|
return items.map(item => {
|
|
404
457
|
return {
|
|
405
458
|
...item,
|
|
@@ -436,42 +489,39 @@ function Panel({
|
|
|
436
489
|
};
|
|
437
490
|
}).sort((itemA, itemB) => {
|
|
438
491
|
if (shouldOrderSelectedFirst) {
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
if (key === 'selected') {
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
return itemA[key] === value;
|
|
445
|
-
}));
|
|
446
|
-
|
|
447
|
-
// itemB is selected (for sorting purposes) if an object in selectedOnSort matches every property of itemA, except for the selected property
|
|
448
|
-
const itemBSelected = selectedOnSort.some(item => Object.entries(item).every(([key, value]) => {
|
|
449
|
-
if (key === 'selected') {
|
|
450
|
-
return true;
|
|
451
|
-
}
|
|
452
|
-
return itemB[key] === value;
|
|
453
|
-
}));
|
|
492
|
+
const itemASelected = isSelectedForSort(itemA);
|
|
493
|
+
const itemBSelected = isSelectedForSort(itemB);
|
|
454
494
|
|
|
455
495
|
// order selected items first
|
|
456
|
-
if (itemASelected
|
|
496
|
+
if (itemASelected && !itemBSelected) {
|
|
457
497
|
return -1;
|
|
458
|
-
} else if (itemASelected
|
|
498
|
+
} else if (!itemASelected && itemBSelected) {
|
|
459
499
|
return 1;
|
|
460
500
|
}
|
|
461
501
|
}
|
|
462
502
|
return 0;
|
|
463
503
|
});
|
|
464
504
|
}, [onClose, onSelectedChange, items, selected, isItemCurrentlySelected, isSingleSelectModal, intermediateSelected, shouldOrderSelectedFirst, selectedOnSort]);
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
505
|
+
|
|
506
|
+
// Track previous items and reset sort when items first load
|
|
507
|
+
const prevItemsRef = useRef(items);
|
|
508
|
+
useEffect(() => {
|
|
509
|
+
if (prevItemsRef.current !== items) {
|
|
510
|
+
if (prevItemsRef.current.length === 0 && items.length > 0) {
|
|
511
|
+
resetSort();
|
|
512
|
+
}
|
|
513
|
+
prevItemsRef.current = items;
|
|
514
|
+
}
|
|
515
|
+
}, [items, resetSort]);
|
|
516
|
+
|
|
517
|
+
// Reset sort when panel opens
|
|
518
|
+
const prevOpenRef = useRef(open);
|
|
519
|
+
useEffect(() => {
|
|
520
|
+
if (prevOpenRef.current !== open) {
|
|
468
521
|
resetSort();
|
|
522
|
+
prevOpenRef.current = open;
|
|
469
523
|
}
|
|
470
|
-
}
|
|
471
|
-
if (open !== prevOpen) {
|
|
472
|
-
setPrevOpen(open);
|
|
473
|
-
resetSort();
|
|
474
|
-
}
|
|
524
|
+
}, [open, resetSort]);
|
|
475
525
|
const focusTrapSettings = {
|
|
476
526
|
initialFocusRef: inputRef || undefined
|
|
477
527
|
};
|
package/package.json
CHANGED