@primer/react 38.32.0-rc.68e0ffa22 → 38.32.0-rc.85de10233
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 +12 -0
- package/dist/ActionBar/ActionBar.js +130 -424
- package/dist/ActionList/{ActionList-65f7daac.css → ActionList-1ff5220c.css} +2 -2
- package/dist/ActionList/ActionList-1ff5220c.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/Breadcrumbs/{Breadcrumbs-54395fc6.css → Breadcrumbs-16d81430.css} +2 -2
- package/dist/Breadcrumbs/{Breadcrumbs-54395fc6.css.map → Breadcrumbs-16d81430.css.map} +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +2 -2
- package/dist/FilteredActionList/FilteredActionList.js +66 -155
- package/dist/FilteredActionList/useAnnouncements.js +66 -138
- package/dist/LabelGroup/LabelGroup.js +76 -110
- package/dist/Overlay/Overlay.js +45 -169
- package/dist/PageHeader/PageHeader-b12247c8.css +2 -0
- package/dist/PageHeader/PageHeader-b12247c8.css.map +1 -0
- package/dist/PageHeader/PageHeader.js +64 -23
- package/dist/PageHeader/PageHeader.module.css.js +1 -1
- package/dist/SegmentedControl/SegmentedControl-a004561f.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-a004561f.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/TextInput/TextInput.js +7 -7
- package/dist/ToggleSwitch/ToggleSwitch.js +167 -186
- package/dist/TreeView/TreeView.js +309 -814
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +5 -0
- package/dist/UnderlineNav/UnderlineNav.js +136 -129
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/experimental/SelectPanel2/SelectPanel-917fdaef.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-608e207e.css.map → SelectPanel-917fdaef.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +38 -95
- package/dist/hooks/useControllableState.js +3 -3
- package/dist/hooks/useMedia.js +44 -43
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/internal/components/ValidationAnimationContainer.js +40 -34
- package/package.json +3 -1
- package/dist/ActionList/ActionList-65f7daac.css.map +0 -1
- package/dist/PageHeader/PageHeader-5e969745.css +0 -2
- package/dist/PageHeader/PageHeader-5e969745.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
2
|
import { announce } from "@primer/live-region-element";
|
|
4
3
|
//#region src/FilteredActionList/useAnnouncements.tsx
|
|
5
4
|
const delayMs = 500;
|
|
@@ -23,155 +22,84 @@ const getItemWithActiveDescendant = (listRef, items) => {
|
|
|
23
22
|
selected: activeItem === null || activeItem === void 0 ? void 0 : activeItem.selected
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
|
-
const useAnnouncements = (items, listContainerRef, inputRef,
|
|
27
|
-
const $ = c(33);
|
|
28
|
-
const enabled = t0 === void 0 ? true : t0;
|
|
29
|
-
const loading = t1 === void 0 ? false : t1;
|
|
25
|
+
const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loading = false, message, focusManagement) => {
|
|
30
26
|
const usingRovingTabindex = focusManagement === "roving-tabindex";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if ($[1] !== items) {
|
|
39
|
-
t3 = items.filter(_temp);
|
|
40
|
-
$[1] = items;
|
|
41
|
-
$[2] = t3;
|
|
42
|
-
} else t3 = $[2];
|
|
43
|
-
const selectedItems = t3.length;
|
|
44
|
-
let t4;
|
|
45
|
-
if ($[3] !== enabled) {
|
|
46
|
-
t4 = (...t5) => {
|
|
47
|
-
const args = t5;
|
|
48
|
-
if (enabled) return announce(...args);
|
|
49
|
-
};
|
|
50
|
-
$[3] = enabled;
|
|
51
|
-
$[4] = t4;
|
|
52
|
-
} else t4 = $[4];
|
|
53
|
-
const announce$1 = t4;
|
|
54
|
-
let t5;
|
|
55
|
-
let t6;
|
|
56
|
-
if ($[5] !== announce$1 || $[6] !== inputRef || $[7] !== items || $[8] !== listContainerRef || $[9] !== selectedItems || $[10] !== usingRovingTabindex) {
|
|
57
|
-
t5 = function announceInitialFocus() {
|
|
58
|
-
const focusHandler = () => {
|
|
59
|
-
if (usingRovingTabindex) announce$1(`${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`, {
|
|
60
|
-
delayMs,
|
|
61
|
-
from: liveRegion ? liveRegion : void 0
|
|
62
|
-
});
|
|
63
|
-
else window.requestAnimationFrame(() => {
|
|
64
|
-
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
65
|
-
if (!activeItem) return;
|
|
66
|
-
const { index, text, selected } = activeItem;
|
|
67
|
-
announce$1([
|
|
68
|
-
"Focus on filter text box and list of items",
|
|
69
|
-
`Focused item: ${text}`,
|
|
70
|
-
`${selected ? "selected" : "not selected"}`,
|
|
71
|
-
`${index + 1} of ${items.length}`
|
|
72
|
-
].join(", "), {
|
|
73
|
-
delayMs,
|
|
74
|
-
from: liveRegion ? liveRegion : void 0
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const inputElement = inputRef.current;
|
|
79
|
-
inputElement === null || inputElement === void 0 || inputElement.addEventListener("focus", focusHandler);
|
|
80
|
-
return () => inputElement === null || inputElement === void 0 ? void 0 : inputElement.removeEventListener("focus", focusHandler);
|
|
81
|
-
};
|
|
82
|
-
t6 = [
|
|
83
|
-
listContainerRef,
|
|
84
|
-
inputRef,
|
|
85
|
-
items,
|
|
86
|
-
liveRegion,
|
|
87
|
-
announce$1,
|
|
88
|
-
usingRovingTabindex,
|
|
89
|
-
selectedItems
|
|
90
|
-
];
|
|
91
|
-
$[5] = announce$1;
|
|
92
|
-
$[6] = inputRef;
|
|
93
|
-
$[7] = items;
|
|
94
|
-
$[8] = listContainerRef;
|
|
95
|
-
$[9] = selectedItems;
|
|
96
|
-
$[10] = usingRovingTabindex;
|
|
97
|
-
$[11] = t5;
|
|
98
|
-
$[12] = t6;
|
|
99
|
-
} else {
|
|
100
|
-
t5 = $[11];
|
|
101
|
-
t6 = $[12];
|
|
102
|
-
}
|
|
103
|
-
useEffect(t5, t6);
|
|
104
|
-
const isFirstRender = useFirstRender();
|
|
105
|
-
let t7;
|
|
106
|
-
if ($[13] !== announce$1 || $[14] !== isFirstRender || $[15] !== items || $[16] !== listContainerRef || $[17] !== loading || $[18] !== (message === null || message === void 0 ? void 0 : message.description) || $[19] !== (message === null || message === void 0 ? void 0 : message.title) || $[20] !== selectedItems || $[21] !== usingRovingTabindex) {
|
|
107
|
-
t7 = function announceListUpdates() {
|
|
108
|
-
if (isFirstRender) return;
|
|
109
|
-
liveRegion === null || liveRegion === void 0 || liveRegion.clear();
|
|
110
|
-
if (items.length === 0 && !loading) {
|
|
111
|
-
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
27
|
+
const liveRegion = document.querySelector("live-region");
|
|
28
|
+
const selectedItems = items.filter((item) => item.selected).length;
|
|
29
|
+
const announce$1 = useCallback((...args) => {
|
|
30
|
+
if (enabled) return announce(...args);
|
|
31
|
+
}, [enabled]);
|
|
32
|
+
useEffect(function announceInitialFocus() {
|
|
33
|
+
const focusHandler = () => {
|
|
114
34
|
if (usingRovingTabindex) announce$1(`${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`, {
|
|
115
35
|
delayMs,
|
|
116
36
|
from: liveRegion ? liveRegion : void 0
|
|
117
37
|
});
|
|
118
38
|
else window.requestAnimationFrame(() => {
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
121
|
-
const { index
|
|
39
|
+
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
40
|
+
if (!activeItem) return;
|
|
41
|
+
const { index, text, selected } = activeItem;
|
|
122
42
|
announce$1([
|
|
123
|
-
|
|
124
|
-
`Focused item: ${
|
|
125
|
-
`${
|
|
126
|
-
`${
|
|
43
|
+
`Focus on filter text box and list of items`,
|
|
44
|
+
`Focused item: ${text}`,
|
|
45
|
+
`${selected ? "selected" : "not selected"}`,
|
|
46
|
+
`${index + 1} of ${items.length}`
|
|
127
47
|
].join(", "), {
|
|
128
48
|
delayMs,
|
|
129
49
|
from: liveRegion ? liveRegion : void 0
|
|
130
50
|
});
|
|
131
51
|
});
|
|
132
52
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
$
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
53
|
+
const inputElement = inputRef.current;
|
|
54
|
+
inputElement === null || inputElement === void 0 || inputElement.addEventListener("focus", focusHandler);
|
|
55
|
+
return () => inputElement === null || inputElement === void 0 ? void 0 : inputElement.removeEventListener("focus", focusHandler);
|
|
56
|
+
}, [
|
|
57
|
+
listContainerRef,
|
|
58
|
+
inputRef,
|
|
59
|
+
items,
|
|
60
|
+
liveRegion,
|
|
61
|
+
announce$1,
|
|
62
|
+
usingRovingTabindex,
|
|
63
|
+
selectedItems
|
|
64
|
+
]);
|
|
65
|
+
const isFirstRender = useFirstRender();
|
|
66
|
+
useEffect(function announceListUpdates() {
|
|
67
|
+
if (isFirstRender) return;
|
|
68
|
+
liveRegion === null || liveRegion === void 0 || liveRegion.clear();
|
|
69
|
+
if (items.length === 0 && !loading) {
|
|
70
|
+
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (usingRovingTabindex) announce$1(`${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`, {
|
|
74
|
+
delayMs,
|
|
75
|
+
from: liveRegion ? liveRegion : void 0
|
|
76
|
+
});
|
|
77
|
+
else window.requestAnimationFrame(() => {
|
|
78
|
+
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
79
|
+
if (!activeItem) return;
|
|
80
|
+
const { index, text, selected } = activeItem;
|
|
81
|
+
announce$1([
|
|
82
|
+
`List updated`,
|
|
83
|
+
`Focused item: ${text}`,
|
|
84
|
+
`${selected ? "selected" : "not selected"}`,
|
|
85
|
+
`${index + 1} of ${items.length}`
|
|
86
|
+
].join(", "), {
|
|
87
|
+
delayMs,
|
|
88
|
+
from: liveRegion ? liveRegion : void 0
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}, [
|
|
92
|
+
announce$1,
|
|
93
|
+
isFirstRender,
|
|
94
|
+
items,
|
|
95
|
+
listContainerRef,
|
|
96
|
+
liveRegion,
|
|
97
|
+
usingRovingTabindex,
|
|
98
|
+
message === null || message === void 0 ? void 0 : message.title,
|
|
99
|
+
message === null || message === void 0 ? void 0 : message.description,
|
|
100
|
+
loading,
|
|
101
|
+
selectedItems
|
|
102
|
+
]);
|
|
172
103
|
};
|
|
173
|
-
function _temp(item) {
|
|
174
|
-
return item.selected;
|
|
175
|
-
}
|
|
176
104
|
//#endregion
|
|
177
105
|
export { useAnnouncements };
|
|
@@ -3,7 +3,6 @@ import { IconButton } from "../Button/IconButton.js";
|
|
|
3
3
|
import { ButtonComponent } from "../Button/Button.js";
|
|
4
4
|
import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
|
|
5
5
|
import LabelGroup_module_css_default from "./LabelGroup.module.css.js";
|
|
6
|
-
import { c } from "react-compiler-runtime";
|
|
7
6
|
import { clsx } from "clsx";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import React from "react";
|
|
@@ -14,108 +13,75 @@ const getOverlayWidth = (buttonClientRect, containerRef, overlayPaddingPx) => {
|
|
|
14
13
|
var _containerRef$current;
|
|
15
14
|
return overlayPaddingPx + buttonClientRect.right - (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().left) || 0);
|
|
16
15
|
};
|
|
17
|
-
const InlineToggle = (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
const InlineToggle = ({ collapseButtonRef, collapseInlineExpandedChildren, expandButtonRef, hiddenItemIds, isOverflowShown, showAllTokensInline }) => isOverflowShown ? /*#__PURE__*/ jsx(ButtonComponent, {
|
|
17
|
+
ref: collapseButtonRef,
|
|
18
|
+
onClick: collapseInlineExpandedChildren,
|
|
19
|
+
size: "small",
|
|
20
|
+
variant: "invisible",
|
|
21
|
+
children: "Show less"
|
|
22
|
+
}) : hiddenItemIds.length ? /*#__PURE__*/ jsxs(ButtonComponent, {
|
|
23
|
+
ref: expandButtonRef,
|
|
24
|
+
variant: "invisible",
|
|
25
|
+
size: "small",
|
|
26
|
+
onClick: showAllTokensInline,
|
|
27
|
+
children: [/*#__PURE__*/ jsxs(VisuallyHidden, { children: [
|
|
28
|
+
"Show +",
|
|
29
|
+
hiddenItemIds.length,
|
|
30
|
+
" more"
|
|
31
|
+
] }), /*#__PURE__*/ jsxs("span", {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: ["+", hiddenItemIds.length]
|
|
34
|
+
})]
|
|
35
|
+
}) : null;
|
|
36
|
+
const OverlayToggle = ({ children, closeOverflowOverlay, expandButtonRef, hiddenItemIds, isOverflowShown, openOverflowOverlay, overlayPaddingPx, overlayWidth, totalLength }) => hiddenItemIds.length ? /*#__PURE__*/ jsx(AnchoredOverlay, {
|
|
37
|
+
open: isOverflowShown,
|
|
38
|
+
onOpen: openOverflowOverlay,
|
|
39
|
+
onClose: closeOverflowOverlay,
|
|
40
|
+
width: "auto",
|
|
41
|
+
height: "auto",
|
|
42
|
+
align: "start",
|
|
43
|
+
side: "inside-right",
|
|
44
|
+
anchorRef: expandButtonRef,
|
|
45
|
+
anchorOffset: overlayPaddingPx * -1,
|
|
46
|
+
alignmentOffset: overlayPaddingPx * -1,
|
|
47
|
+
renderAnchor: (props) => /*#__PURE__*/ jsxs(ButtonComponent, {
|
|
48
|
+
variant: "invisible",
|
|
49
|
+
size: "small",
|
|
50
|
+
...props,
|
|
51
|
+
ref: expandButtonRef,
|
|
52
|
+
children: [/*#__PURE__*/ jsxs(VisuallyHidden, { children: [
|
|
53
|
+
"Show +",
|
|
54
|
+
hiddenItemIds.length,
|
|
55
|
+
" more"
|
|
56
|
+
] }), /*#__PURE__*/ jsxs("span", {
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
children: ["+", hiddenItemIds.length]
|
|
59
|
+
})]
|
|
60
|
+
}),
|
|
61
|
+
focusZoneSettings: { disabled: true },
|
|
62
|
+
overlayProps: {
|
|
63
|
+
role: "dialog",
|
|
64
|
+
"aria-label": `All ${totalLength} labels`,
|
|
65
|
+
"aria-modal": true
|
|
66
|
+
},
|
|
67
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
68
|
+
className: LabelGroup_module_css_default.OverlayContainer,
|
|
69
|
+
style: {
|
|
70
|
+
width: overlayWidth,
|
|
71
|
+
padding: `${overlayPaddingPx}px`
|
|
72
|
+
},
|
|
73
|
+
children: [/*#__PURE__*/ jsx("div", {
|
|
74
|
+
className: LabelGroup_module_css_default.OverlayInner,
|
|
75
|
+
children
|
|
76
|
+
}), /*#__PURE__*/ jsx(IconButton, {
|
|
77
|
+
onClick: closeOverflowOverlay,
|
|
78
|
+
icon: XIcon,
|
|
79
|
+
"aria-label": "Close",
|
|
30
80
|
variant: "invisible",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
hiddenItemIds.length,
|
|
36
|
-
" more"
|
|
37
|
-
] }), /*#__PURE__*/ jsxs("span", {
|
|
38
|
-
"aria-hidden": "true",
|
|
39
|
-
children: ["+", hiddenItemIds.length]
|
|
40
|
-
})]
|
|
41
|
-
}) : null;
|
|
42
|
-
$[0] = collapseButtonRef;
|
|
43
|
-
$[1] = collapseInlineExpandedChildren;
|
|
44
|
-
$[2] = expandButtonRef;
|
|
45
|
-
$[3] = hiddenItemIds;
|
|
46
|
-
$[4] = isOverflowShown;
|
|
47
|
-
$[5] = showAllTokensInline;
|
|
48
|
-
$[6] = t1;
|
|
49
|
-
} else t1 = $[6];
|
|
50
|
-
return t1;
|
|
51
|
-
};
|
|
52
|
-
const OverlayToggle = (t0) => {
|
|
53
|
-
const $ = c(10);
|
|
54
|
-
const { children, closeOverflowOverlay, expandButtonRef, hiddenItemIds, isOverflowShown, openOverflowOverlay, overlayPaddingPx, overlayWidth, totalLength } = t0;
|
|
55
|
-
let t1;
|
|
56
|
-
if ($[0] !== children || $[1] !== closeOverflowOverlay || $[2] !== expandButtonRef || $[3] !== hiddenItemIds.length || $[4] !== isOverflowShown || $[5] !== openOverflowOverlay || $[6] !== overlayPaddingPx || $[7] !== overlayWidth || $[8] !== totalLength) {
|
|
57
|
-
t1 = hiddenItemIds.length ? /*#__PURE__*/ jsx(AnchoredOverlay, {
|
|
58
|
-
open: isOverflowShown,
|
|
59
|
-
onOpen: openOverflowOverlay,
|
|
60
|
-
onClose: closeOverflowOverlay,
|
|
61
|
-
width: "auto",
|
|
62
|
-
height: "auto",
|
|
63
|
-
align: "start",
|
|
64
|
-
side: "inside-right",
|
|
65
|
-
anchorRef: expandButtonRef,
|
|
66
|
-
anchorOffset: overlayPaddingPx * -1,
|
|
67
|
-
alignmentOffset: overlayPaddingPx * -1,
|
|
68
|
-
renderAnchor: (props) => /*#__PURE__*/ jsxs(ButtonComponent, {
|
|
69
|
-
variant: "invisible",
|
|
70
|
-
size: "small",
|
|
71
|
-
...props,
|
|
72
|
-
ref: expandButtonRef,
|
|
73
|
-
children: [/*#__PURE__*/ jsxs(VisuallyHidden, { children: [
|
|
74
|
-
"Show +",
|
|
75
|
-
hiddenItemIds.length,
|
|
76
|
-
" more"
|
|
77
|
-
] }), /*#__PURE__*/ jsxs("span", {
|
|
78
|
-
"aria-hidden": "true",
|
|
79
|
-
children: ["+", hiddenItemIds.length]
|
|
80
|
-
})]
|
|
81
|
-
}),
|
|
82
|
-
focusZoneSettings: { disabled: true },
|
|
83
|
-
overlayProps: {
|
|
84
|
-
role: "dialog",
|
|
85
|
-
"aria-label": `All ${totalLength} labels`,
|
|
86
|
-
"aria-modal": true
|
|
87
|
-
},
|
|
88
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
89
|
-
className: LabelGroup_module_css_default.OverlayContainer,
|
|
90
|
-
style: {
|
|
91
|
-
width: overlayWidth,
|
|
92
|
-
padding: `${overlayPaddingPx}px`
|
|
93
|
-
},
|
|
94
|
-
children: [/*#__PURE__*/ jsx("div", {
|
|
95
|
-
className: LabelGroup_module_css_default.OverlayInner,
|
|
96
|
-
children
|
|
97
|
-
}), /*#__PURE__*/ jsx(IconButton, {
|
|
98
|
-
onClick: closeOverflowOverlay,
|
|
99
|
-
icon: XIcon,
|
|
100
|
-
"aria-label": "Close",
|
|
101
|
-
variant: "invisible",
|
|
102
|
-
className: LabelGroup_module_css_default.CloseButton
|
|
103
|
-
})]
|
|
104
|
-
})
|
|
105
|
-
}) : null;
|
|
106
|
-
$[0] = children;
|
|
107
|
-
$[1] = closeOverflowOverlay;
|
|
108
|
-
$[2] = expandButtonRef;
|
|
109
|
-
$[3] = hiddenItemIds.length;
|
|
110
|
-
$[4] = isOverflowShown;
|
|
111
|
-
$[5] = openOverflowOverlay;
|
|
112
|
-
$[6] = overlayPaddingPx;
|
|
113
|
-
$[7] = overlayWidth;
|
|
114
|
-
$[8] = totalLength;
|
|
115
|
-
$[9] = t1;
|
|
116
|
-
} else t1 = $[9];
|
|
117
|
-
return t1;
|
|
118
|
-
};
|
|
81
|
+
className: LabelGroup_module_css_default.CloseButton
|
|
82
|
+
})]
|
|
83
|
+
})
|
|
84
|
+
}) : null;
|
|
119
85
|
const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as: Component = "ul", className }) => {
|
|
120
86
|
const containerRef = React.useRef(null);
|
|
121
87
|
const collapseButtonRef = React.useRef(null);
|
|
@@ -177,14 +143,14 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
177
143
|
if (!visibleChildCount || isOverflowShown) return;
|
|
178
144
|
if (visibleChildCount === "auto") {
|
|
179
145
|
const observer = new IntersectionObserver((entries) => {
|
|
180
|
-
const
|
|
146
|
+
const updatedEntries = {};
|
|
181
147
|
for (const entry of entries) {
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
148
|
+
const targetId = entry.target.getAttribute("data-index");
|
|
149
|
+
if (targetId) updatedEntries[targetId] = entry.isIntersecting;
|
|
184
150
|
}
|
|
185
151
|
setVisibilityMap((prev) => ({
|
|
186
152
|
...prev,
|
|
187
|
-
...
|
|
153
|
+
...updatedEntries
|
|
188
154
|
}));
|
|
189
155
|
}, {
|
|
190
156
|
root: containerRef.current,
|
|
@@ -230,10 +196,10 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
230
196
|
"data-list": isList || void 0,
|
|
231
197
|
className: clsx(className, LabelGroup_module_css_default.Container),
|
|
232
198
|
"data-component": "LabelGroup",
|
|
233
|
-
children: [React.Children.map(children, (
|
|
199
|
+
children: [React.Children.map(children, (child, index) => /*#__PURE__*/ jsx(ItemWrapperComponent, {
|
|
234
200
|
"data-index": index,
|
|
235
201
|
className: clsx(LabelGroup_module_css_default.ItemWrapper, { [LabelGroup_module_css_default["ItemWrapper--hidden"]]: hiddenItemIds.includes(index.toString()) }),
|
|
236
|
-
children:
|
|
202
|
+
children: child
|
|
237
203
|
}, index)), /*#__PURE__*/ jsx(ToggleWrapper, {
|
|
238
204
|
"data-component": "LabelGroup.Toggle",
|
|
239
205
|
children: overflowStyle === "inline" ? /*#__PURE__*/ jsx(InlineToggle, {
|
|
@@ -261,8 +227,8 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
261
227
|
"data-list": isList || void 0,
|
|
262
228
|
className: clsx(className, LabelGroup_module_css_default.Container),
|
|
263
229
|
"data-component": "LabelGroup",
|
|
264
|
-
children: isList ? React.Children.map(children, (
|
|
265
|
-
return /*#__PURE__*/ jsx("li", { children:
|
|
230
|
+
children: isList ? React.Children.map(children, (child, index) => {
|
|
231
|
+
return /*#__PURE__*/ jsx("li", { children: child }, index);
|
|
266
232
|
}) : children
|
|
267
233
|
});
|
|
268
234
|
};
|