@primer/react 0.0.0-20260715132522 → 0.0.0-20260715134933
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 -5
- package/dist/ActionList/Group.js +1 -1
- package/dist/ActionList/Item.js +1 -1
- package/dist/ActionList/List.js +1 -1
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +1 -2
- package/dist/Autocomplete/AutocompleteMenu.js +46 -39
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -4
- package/dist/Dialog/Dialog.js +1 -1
- package/dist/FilteredActionList/useAnnouncements.js +14 -20
- package/dist/LabelGroup/LabelGroup.js +16 -25
- package/dist/NavList/NavList.js +1 -1
- package/dist/PageHeader/PageHeader.js +1 -1
- package/dist/PageLayout/DragHandle.d.ts +45 -0
- package/dist/PageLayout/DragHandle.js +224 -0
- package/dist/PageLayout/PageLayout.js +54 -248
- package/dist/PageLayout/index.d.ts +3 -1
- package/dist/PageLayout/usePaneWidth.d.ts +63 -1
- package/dist/PageLayout/usePaneWidth.js +51 -36
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/TooltipV2/Tooltip.js +1 -2
- package/dist/TreeView/TreeView.js +3 -6
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/experimental/index.js +1 -1
- package/dist/hooks/useDialog.js +1 -2
- package/dist/hooks/useScrollFlash.js +1 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -5
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- 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/utils/warning.js +2 -3
- package/package.json +2 -2
- package/dist/internal/components/UnderlineTabbedInterface-9aca4eac.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-9aca4eac.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260715134933
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#8160](https://github.com/primer/react/pull/8160) [`74c731b`](https://github.com/primer/react/commit/74c731b16478bd328eb44ca87d4eb66d43f56fd8) Thanks [@TylerJDev](https://github.com/TylerJDev)! - PageLayout: Export the resize primitives `usePaneWidth` and `DragHandle` (with `defaultPaneWidth` and related types) so pane-resize behavior can be reused outside of `PageLayout`.
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
11
|
- [#8064](https://github.com/primer/react/pull/8064) [`eb447fe`](https://github.com/primer/react/commit/eb447fef0f1565934dc38d09df21d8063957aa9d) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Update the ActionBar overflow menu anchor label to `More items`
|
|
8
12
|
|
|
9
|
-
- [#8005](https://github.com/primer/react/pull/8005) [`5d24be4`](https://github.com/primer/react/commit/5d24be483f2fdfa305970907984d04522e2aa13c) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Derive `AutocompleteMenu` close-time re-sorting and `LabelGroup` numeric truncation during render instead of in effects, removing redundant render passes. No public API or visual changes.
|
|
10
|
-
|
|
11
13
|
- Fake entry to force publishing
|
|
12
14
|
|
|
13
15
|
- [#8116](https://github.com/primer/react/pull/8116) [`cade4af`](https://github.com/primer/react/commit/cade4af9a70f3fd2622031af585dc07dccd79e11) Thanks [@mattcosta7](https://github.com/mattcosta7)! - `useAnchoredPosition`: improve performance by caching the scrollable-ancestor walk per anchor, reducing repositioning work for overlays, menus, and tooltips.
|
|
14
16
|
|
|
15
|
-
- [#8164](https://github.com/primer/react/pull/8164) [`f86e5a6`](https://github.com/primer/react/commit/f86e5a6420e857e7476c3954d419f4e228bdcf1a) Thanks [@jonrohan](https://github.com/jonrohan)! - Fix `UnderlineNav` tab list not filling the full width of the underline nav in Safari
|
|
16
|
-
|
|
17
17
|
## 38.32.0
|
|
18
18
|
|
|
19
19
|
### Minor Changes
|
package/dist/ActionList/Group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
3
2
|
import { invariant } from "../utils/invariant.js";
|
|
3
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
4
4
|
import { ListContext } from "./shared.js";
|
|
5
5
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
|
6
6
|
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
package/dist/ActionList/Item.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
2
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
3
2
|
import { ConditionalWrapper } from "../internal/components/ConditionalWrapper.js";
|
|
4
3
|
import { invariant } from "../utils/invariant.js";
|
|
5
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
6
5
|
import VisuallyHidden from "../_VisuallyHidden.js";
|
|
7
6
|
import { TooltipContext } from "../TooltipV2/TooltipContext.js";
|
|
8
7
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
8
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
9
9
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
10
10
|
import { ItemContext, ListContext } from "./shared.js";
|
|
11
11
|
import ActionList_module_css_default from "./ActionList.module.css.js";
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
4
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
5
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
5
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
6
6
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
7
7
|
import { ActionListContainerContext } from "./ActionListContainerContext.js";
|
|
8
8
|
import { ListContext } from "./shared.js";
|
|
@@ -2,10 +2,10 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
2
2
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
3
3
|
import { useMenuKeyboardNavigation } from "../hooks/useMenuKeyboardNavigation.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
6
5
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
7
6
|
import { ButtonComponent } from "../Button/Button.js";
|
|
8
7
|
import { useResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
8
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
9
9
|
import { DialogContext } from "../Dialog/DialogContext.js";
|
|
10
10
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
11
11
|
import { Divider } from "../ActionList/Divider.js";
|
|
@@ -122,8 +122,7 @@ const AnchoredOverlay = ({ renderAnchor, anchorRef: externalAnchorRef, anchorId:
|
|
|
122
122
|
else currentOverlay.style.removeProperty("position-try-fallbacks");
|
|
123
123
|
pendingPositionFrame = requestAnimationFrame(() => {
|
|
124
124
|
pendingPositionFrame = null;
|
|
125
|
-
const
|
|
126
|
-
const result = getDefaultPosition(anchorElement, currentOverlay, fallbackWidth);
|
|
125
|
+
const result = getDefaultPosition(anchorElement, currentOverlay, width ? parseInt(widthMap[width]) : parseInt(widthMap.small));
|
|
127
126
|
currentOverlay.setAttribute("data-align", result.horizontal);
|
|
128
127
|
if (result.suggestedSide) currentOverlay.setAttribute("data-side", result.suggestedSide);
|
|
129
128
|
const offset = result.horizontal === "left" ? result.leftOffset : result.rightOffset;
|
|
@@ -43,7 +43,7 @@ const debounceAnnouncement = debounce((announcement) => {
|
|
|
43
43
|
announce(announcement);
|
|
44
44
|
}, 250);
|
|
45
45
|
function AutocompleteMenu(props) {
|
|
46
|
-
const $ = c(
|
|
46
|
+
const $ = c(78);
|
|
47
47
|
const autocompleteContext = useContext(AutocompleteContext);
|
|
48
48
|
const deferredInputContext = useContext(AutocompleteDeferredInputContext);
|
|
49
49
|
if (autocompleteContext === null || deferredInputContext === null) throw new Error("AutocompleteContext returned null values");
|
|
@@ -193,11 +193,10 @@ function AutocompleteMenu(props) {
|
|
|
193
193
|
t12 = (current, _previous, directlyActivated) => {
|
|
194
194
|
activeDescendantRef.current = current || null;
|
|
195
195
|
if (current) {
|
|
196
|
-
|
|
196
|
+
setHighlightedItem(allItemsToRenderRef.current.find((item_1) => {
|
|
197
197
|
var _current$closest;
|
|
198
198
|
return item_1.id === ((_current$closest = current.closest("li")) === null || _current$closest === void 0 ? void 0 : _current$closest.getAttribute("data-id"));
|
|
199
|
-
});
|
|
200
|
-
setHighlightedItem(selectedItem);
|
|
199
|
+
}));
|
|
201
200
|
setIsMenuDirectlyActivated(directlyActivated);
|
|
202
201
|
}
|
|
203
202
|
if (current && customScrollContainerRef && customScrollContainerRef.current && directlyActivated) scrollIntoView(current, customScrollContainerRef.current, menuScrollMargins);
|
|
@@ -254,46 +253,54 @@ function AutocompleteMenu(props) {
|
|
|
254
253
|
t16 = $[54];
|
|
255
254
|
}
|
|
256
255
|
useEffect(t15, t16);
|
|
257
|
-
if (showMenu === false) {
|
|
258
|
-
const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn((itemId_0) => isItemSelected(itemId_0, selectedItemIds)));
|
|
259
|
-
if (!(itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element_0, index) => element_0 === sortedItemIds[index]))) setSortedItemIds(itemIdSortResult);
|
|
260
|
-
}
|
|
261
256
|
let t17;
|
|
262
257
|
let t18;
|
|
263
|
-
if ($[55] !== onOpenChange || $[56] !== showMenu) {
|
|
258
|
+
if ($[55] !== onOpenChange || $[56] !== selectedItemIds || $[57] !== showMenu || $[58] !== sortOnCloseFn || $[59] !== sortedItemIds) {
|
|
264
259
|
t17 = () => {
|
|
260
|
+
const itemIdSortResult = [...sortedItemIds].sort(sortOnCloseFn ? sortOnCloseFn : getDefaultSortFn((itemId_0) => isItemSelected(itemId_0, selectedItemIds)));
|
|
261
|
+
const sortResultMatchesState = itemIdSortResult.length === sortedItemIds.length && itemIdSortResult.every((element_0, index) => element_0 === sortedItemIds[index]);
|
|
262
|
+
if (showMenu === false && !sortResultMatchesState) setSortedItemIds(itemIdSortResult);
|
|
265
263
|
onOpenChange && onOpenChange(Boolean(showMenu));
|
|
266
264
|
};
|
|
267
|
-
t18 = [
|
|
265
|
+
t18 = [
|
|
266
|
+
showMenu,
|
|
267
|
+
onOpenChange,
|
|
268
|
+
selectedItemIds,
|
|
269
|
+
sortOnCloseFn,
|
|
270
|
+
sortedItemIds
|
|
271
|
+
];
|
|
268
272
|
$[55] = onOpenChange;
|
|
269
|
-
$[56] =
|
|
270
|
-
$[57] =
|
|
271
|
-
$[58] =
|
|
273
|
+
$[56] = selectedItemIds;
|
|
274
|
+
$[57] = showMenu;
|
|
275
|
+
$[58] = sortOnCloseFn;
|
|
276
|
+
$[59] = sortedItemIds;
|
|
277
|
+
$[60] = t17;
|
|
278
|
+
$[61] = t18;
|
|
272
279
|
} else {
|
|
273
|
-
t17 = $[
|
|
274
|
-
t18 = $[
|
|
280
|
+
t17 = $[60];
|
|
281
|
+
t18 = $[61];
|
|
275
282
|
}
|
|
276
283
|
useEffect(t17, t18);
|
|
277
284
|
let t19;
|
|
278
|
-
if ($[
|
|
285
|
+
if ($[62] !== selectedItemIds.length || $[63] !== setSelectedItemLength) {
|
|
279
286
|
t19 = () => {
|
|
280
287
|
if (selectedItemIds.length) setSelectedItemLength(selectedItemIds.length);
|
|
281
288
|
};
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
} else t19 = $[
|
|
289
|
+
$[62] = selectedItemIds.length;
|
|
290
|
+
$[63] = setSelectedItemLength;
|
|
291
|
+
$[64] = t19;
|
|
292
|
+
} else t19 = $[64];
|
|
286
293
|
let t20;
|
|
287
|
-
if ($[
|
|
294
|
+
if ($[65] !== selectedItemIds || $[66] !== setSelectedItemLength) {
|
|
288
295
|
t20 = [selectedItemIds, setSelectedItemLength];
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
} else t20 = $[
|
|
296
|
+
$[65] = selectedItemIds;
|
|
297
|
+
$[66] = setSelectedItemLength;
|
|
298
|
+
$[67] = t20;
|
|
299
|
+
} else t20 = $[67];
|
|
293
300
|
useEffect(t19, t20);
|
|
294
301
|
if (selectionVariant === "single" && selectedItemIds.length > 1) throw new Error("Autocomplete: selectionVariant \"single\" cannot be used with multiple selected items");
|
|
295
302
|
let t21;
|
|
296
|
-
if ($[
|
|
303
|
+
if ($[68] !== allItemsToRender || $[69] !== ariaLabelledBy || $[70] !== emptyStateText || $[71] !== id || $[72] !== loading || $[73] !== selectionVariant) {
|
|
297
304
|
t21 = loading ? /*#__PURE__*/ jsx("div", {
|
|
298
305
|
className: AutocompleteMenu_module_css_default.SpinnerWrapper,
|
|
299
306
|
children: /*#__PURE__*/ jsx(Spinner, {})
|
|
@@ -311,24 +318,24 @@ function AutocompleteMenu(props) {
|
|
|
311
318
|
children: emptyStateText
|
|
312
319
|
}) : null
|
|
313
320
|
});
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
321
|
-
} else t21 = $[
|
|
321
|
+
$[68] = allItemsToRender;
|
|
322
|
+
$[69] = ariaLabelledBy;
|
|
323
|
+
$[70] = emptyStateText;
|
|
324
|
+
$[71] = id;
|
|
325
|
+
$[72] = loading;
|
|
326
|
+
$[73] = selectionVariant;
|
|
327
|
+
$[74] = t21;
|
|
328
|
+
} else t21 = $[74];
|
|
322
329
|
let t22;
|
|
323
|
-
if ($[
|
|
330
|
+
if ($[75] !== showMenu || $[76] !== t21) {
|
|
324
331
|
t22 = /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
325
332
|
isVisible: showMenu,
|
|
326
333
|
children: t21
|
|
327
334
|
});
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
} else t22 = $[
|
|
335
|
+
$[75] = showMenu;
|
|
336
|
+
$[76] = t21;
|
|
337
|
+
$[77] = t22;
|
|
338
|
+
} else t22 = $[77];
|
|
332
339
|
return t22;
|
|
333
340
|
}
|
|
334
341
|
function _temp5(item_2) {
|
|
@@ -250,10 +250,7 @@ function Breadcrumbs(t0) {
|
|
|
250
250
|
const measuredContainerWidth = containerElement.offsetWidth;
|
|
251
251
|
setContainerWidth((prev_0) => prev_0 === measuredContainerWidth ? prev_0 : measuredContainerWidth);
|
|
252
252
|
const listElement = containerElement.querySelector("ol");
|
|
253
|
-
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length)
|
|
254
|
-
const widths = Array.from(listElement.children).map(_temp3);
|
|
255
|
-
setChildArrayWidths(widths);
|
|
256
|
-
}
|
|
253
|
+
if (listElement && listElement.children.length > 0 && listElement.children.length === childArray.length) setChildArrayWidths(Array.from(listElement.children).map(_temp3));
|
|
257
254
|
};
|
|
258
255
|
$[3] = childArray.length;
|
|
259
256
|
$[4] = overflow;
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -3,9 +3,9 @@ import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
|
3
3
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
4
4
|
import { useResizeObserver } from "../hooks/useResizeObserver.js";
|
|
5
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
7
6
|
import { IconButton } from "../Button/IconButton.js";
|
|
8
7
|
import { ButtonComponent } from "../Button/Button.js";
|
|
8
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
9
9
|
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
10
10
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
11
11
|
import Portal_default from "../Portal/index.js";
|
|
@@ -31,23 +31,20 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
31
31
|
}, [enabled]);
|
|
32
32
|
useEffect(function announceInitialFocus() {
|
|
33
33
|
const focusHandler = () => {
|
|
34
|
-
if (usingRovingTabindex) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
} else window.requestAnimationFrame(() => {
|
|
34
|
+
if (usingRovingTabindex) announce$1(`${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`, {
|
|
35
|
+
delayMs,
|
|
36
|
+
from: liveRegion ? liveRegion : void 0
|
|
37
|
+
});
|
|
38
|
+
else window.requestAnimationFrame(() => {
|
|
41
39
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
42
40
|
if (!activeItem) return;
|
|
43
41
|
const { index, text, selected } = activeItem;
|
|
44
|
-
|
|
42
|
+
announce$1([
|
|
45
43
|
`Focus on filter text box and list of items`,
|
|
46
44
|
`Focused item: ${text}`,
|
|
47
45
|
`${selected ? "selected" : "not selected"}`,
|
|
48
46
|
`${index + 1} of ${items.length}`
|
|
49
|
-
].join(", ")
|
|
50
|
-
announce$1(announcementText, {
|
|
47
|
+
].join(", "), {
|
|
51
48
|
delayMs,
|
|
52
49
|
from: liveRegion ? liveRegion : void 0
|
|
53
50
|
});
|
|
@@ -73,23 +70,20 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
73
70
|
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
74
71
|
return;
|
|
75
72
|
}
|
|
76
|
-
if (usingRovingTabindex) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
} else window.requestAnimationFrame(() => {
|
|
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(() => {
|
|
83
78
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
84
79
|
if (!activeItem) return;
|
|
85
80
|
const { index, text, selected } = activeItem;
|
|
86
|
-
|
|
81
|
+
announce$1([
|
|
87
82
|
`List updated`,
|
|
88
83
|
`Focused item: ${text}`,
|
|
89
84
|
`${selected ? "selected" : "not selected"}`,
|
|
90
85
|
`${index + 1} of ${items.length}`
|
|
91
|
-
].join(", ")
|
|
92
|
-
announce$1(announcementText, {
|
|
86
|
+
].join(", "), {
|
|
93
87
|
delayMs,
|
|
94
88
|
from: liveRegion ? liveRegion : void 0
|
|
95
89
|
});
|
|
@@ -13,16 +13,6 @@ const getOverlayWidth = (buttonClientRect, containerRef, overlayPaddingPx) => {
|
|
|
13
13
|
var _containerRef$current;
|
|
14
14
|
return overlayPaddingPx + buttonClientRect.right - (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().left) || 0);
|
|
15
15
|
};
|
|
16
|
-
const getVisibilityMapAfterIndex = (childCount, truncateAfter) => {
|
|
17
|
-
const updatedEntries = {};
|
|
18
|
-
for (let index = 0; index < childCount; index++) updatedEntries[index.toString()] = index < truncateAfter;
|
|
19
|
-
return updatedEntries;
|
|
20
|
-
};
|
|
21
|
-
const visibilityMapsMatch = (left, right) => {
|
|
22
|
-
const leftKeys = Object.keys(left);
|
|
23
|
-
const rightKeys = Object.keys(right);
|
|
24
|
-
return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.prototype.hasOwnProperty.call(right, key) && left[key] === right[key]);
|
|
25
|
-
};
|
|
26
16
|
const InlineToggle = ({ collapseButtonRef, collapseInlineExpandedChildren, expandButtonRef, hiddenItemIds, isOverflowShown, showAllTokensInline }) => isOverflowShown ? /*#__PURE__*/ jsx(ButtonComponent, {
|
|
27
17
|
ref: collapseButtonRef,
|
|
28
18
|
onClick: collapseInlineExpandedChildren,
|
|
@@ -109,7 +99,6 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
109
99
|
bottom: 0,
|
|
110
100
|
toJSON: () => void 0
|
|
111
101
|
});
|
|
112
|
-
const childArray = React.Children.toArray(children);
|
|
113
102
|
const overlayPaddingPx = 8;
|
|
114
103
|
const hiddenItemIds = Object.keys(visibilityMap).filter((key) => !visibilityMap[key]);
|
|
115
104
|
const overlayWidth = hiddenItemIds.length && overflowStyle === "overlay" ? getOverlayWidth(buttonClientRect, containerRef, overlayPaddingPx) : void 0;
|
|
@@ -121,8 +110,15 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
121
110
|
}
|
|
122
111
|
}, [buttonClientRect]);
|
|
123
112
|
const hideChildrenAfterIndex = React.useCallback((truncateAfter) => {
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
var _containerRef$current2;
|
|
114
|
+
const containerChildren = ((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.children) || [];
|
|
115
|
+
const updatedEntries = {};
|
|
116
|
+
for (const child of containerChildren) {
|
|
117
|
+
const targetId = child.getAttribute("data-index");
|
|
118
|
+
if (targetId) updatedEntries[targetId] = parseInt(targetId, 10) < truncateAfter;
|
|
119
|
+
}
|
|
120
|
+
setVisibilityMap(updatedEntries);
|
|
121
|
+
}, []);
|
|
126
122
|
const openOverflowOverlay = React.useCallback(() => setIsOverflowShown(true), [setIsOverflowShown]);
|
|
127
123
|
const closeOverflowOverlay = React.useCallback(() => {
|
|
128
124
|
setIsOverflowShown(false);
|
|
@@ -143,12 +139,6 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
143
139
|
setVisibilityMap({});
|
|
144
140
|
setIsOverflowShown(true);
|
|
145
141
|
}, [setVisibilityMap, setIsOverflowShown]);
|
|
146
|
-
const numericVisibilityMap = React.useMemo(() => visibleChildCount && typeof visibleChildCount === "number" && !isOverflowShown ? getVisibilityMapAfterIndex(childArray.length, visibleChildCount) : void 0, [
|
|
147
|
-
childArray.length,
|
|
148
|
-
isOverflowShown,
|
|
149
|
-
visibleChildCount
|
|
150
|
-
]);
|
|
151
|
-
if (numericVisibilityMap && !visibilityMapsMatch(visibilityMap, numericVisibilityMap)) setVisibilityMap(numericVisibilityMap);
|
|
152
142
|
React.useEffect(() => {
|
|
153
143
|
if (!visibleChildCount || isOverflowShown) return;
|
|
154
144
|
if (visibleChildCount === "auto") {
|
|
@@ -167,15 +157,16 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
167
157
|
rootMargin: `0px -${buttonClientRect.width}px 0px 0px`,
|
|
168
158
|
threshold: 1
|
|
169
159
|
});
|
|
170
|
-
for (const item of ((_containerRef$
|
|
171
|
-
var _containerRef$
|
|
160
|
+
for (const item of ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.children) || []) {
|
|
161
|
+
var _containerRef$current3;
|
|
172
162
|
if (item.getAttribute("data-index")) observer.observe(item);
|
|
173
163
|
}
|
|
174
164
|
return () => observer.disconnect();
|
|
175
|
-
}
|
|
165
|
+
} else hideChildrenAfterIndex(visibleChildCount);
|
|
176
166
|
}, [
|
|
177
167
|
buttonClientRect,
|
|
178
168
|
visibleChildCount,
|
|
169
|
+
hideChildrenAfterIndex,
|
|
179
170
|
isOverflowShown
|
|
180
171
|
]);
|
|
181
172
|
React.useEffect(() => {
|
|
@@ -205,7 +196,7 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
205
196
|
"data-list": isList || void 0,
|
|
206
197
|
className: clsx(className, LabelGroup_module_css_default.Container),
|
|
207
198
|
"data-component": "LabelGroup",
|
|
208
|
-
children: [
|
|
199
|
+
children: [React.Children.map(children, (child, index) => /*#__PURE__*/ jsx(ItemWrapperComponent, {
|
|
209
200
|
"data-index": index,
|
|
210
201
|
className: clsx(LabelGroup_module_css_default.ItemWrapper, { [LabelGroup_module_css_default["ItemWrapper--hidden"]]: hiddenItemIds.includes(index.toString()) }),
|
|
211
202
|
children: child
|
|
@@ -218,7 +209,7 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
218
209
|
hiddenItemIds,
|
|
219
210
|
isOverflowShown,
|
|
220
211
|
showAllTokensInline,
|
|
221
|
-
totalLength:
|
|
212
|
+
totalLength: React.Children.toArray(children).length
|
|
222
213
|
}) : /*#__PURE__*/ jsx(OverlayToggle, {
|
|
223
214
|
closeOverflowOverlay,
|
|
224
215
|
expandButtonRef,
|
|
@@ -227,7 +218,7 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
227
218
|
openOverflowOverlay,
|
|
228
219
|
overlayPaddingPx,
|
|
229
220
|
overlayWidth,
|
|
230
|
-
totalLength:
|
|
221
|
+
totalLength: React.Children.toArray(children).length,
|
|
231
222
|
children
|
|
232
223
|
})
|
|
233
224
|
})]
|
package/dist/NavList/NavList.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
2
2
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
3
|
-
import { useSlots } from "../hooks/useSlots.js";
|
|
4
3
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
5
4
|
import _VisuallyHidden_module_css_default from "../_VisuallyHidden.module.css.js";
|
|
5
|
+
import { useSlots } from "../hooks/useSlots.js";
|
|
6
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
7
7
|
import Heading$1 from "../Heading/Heading.js";
|
|
8
8
|
import ActionList_module_css_default from "../ActionList/ActionList.module.css.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { warning } from "../utils/warning.js";
|
|
3
|
-
import { isSlot } from "../utils/is-slot.js";
|
|
4
3
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
4
|
+
import { isSlot } from "../utils/is-slot.js";
|
|
5
5
|
import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
|
|
6
6
|
import Heading from "../Heading/Heading.js";
|
|
7
7
|
import Link from "../Link/Link.js";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/PageLayout/DragHandle.d.ts
|
|
4
|
+
type DragHandleProps = {
|
|
5
|
+
/** Ref for imperative ARIA updates during drag */handleRef: React.RefObject<HTMLDivElement>; /** Called once when drag starts with initial cursor X position */
|
|
6
|
+
onDragStart: (clientX: number) => void; /** Called on each drag tick with cursor position (pointer) or delta (keyboard) */
|
|
7
|
+
onDrag: (value: number, isKeyboard: boolean) => void; /** Called when drag operation completes */
|
|
8
|
+
onDragEnd: () => void; /** Reset width on double-click */
|
|
9
|
+
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
10
|
+
/**
|
|
11
|
+
* Accessible name for the slider. Defaults to `'Draggable pane splitter'`.
|
|
12
|
+
* Provide a context-specific or localized label for standalone usage.
|
|
13
|
+
* Ignored when `aria-labelledby` is provided.
|
|
14
|
+
*/
|
|
15
|
+
'aria-label'?: string; /** Id of an element that labels the slider. Takes precedence over `aria-label`. */
|
|
16
|
+
'aria-labelledby'?: string; /** ARIA slider min value */
|
|
17
|
+
'aria-valuemin'?: number; /** ARIA slider max value */
|
|
18
|
+
'aria-valuemax'?: number; /** ARIA slider current value */
|
|
19
|
+
'aria-valuenow'?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Ref to the element that receives drag-time styling/containment optimizations
|
|
22
|
+
* (e.g. the resizable pane). When omitted, those side effects are skipped.
|
|
23
|
+
*/
|
|
24
|
+
dragTargetRef?: React.RefObject<HTMLElement | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Ref to a content wrapper element that receives drag-time containment.
|
|
27
|
+
* Only needed for layouts (like PageLayout) that optimize sibling content during drag.
|
|
28
|
+
*/
|
|
29
|
+
contentWrapperRef?: React.RefObject<HTMLElement | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Formats the `aria-valuetext` announced for the current width.
|
|
32
|
+
* @default valueNow => `Pane width ${valueNow} pixels`
|
|
33
|
+
*/
|
|
34
|
+
formatValueText?: (valueNow: number) => string; /** Value for the `data-component` attribute. */
|
|
35
|
+
'data-component'?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* DragHandle - handles all pointer and keyboard interactions for resizing.
|
|
39
|
+
* ARIA values are set in JSX for SSR accessibility, then updated via DOM
|
|
40
|
+
* manipulation during drag for performance. The consumer owns writing the width
|
|
41
|
+
* (via the `onDrag` callback); this component only reports interactions.
|
|
42
|
+
*/
|
|
43
|
+
declare const DragHandle: React.NamedExoticComponent<DragHandleProps>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { DragHandle, DragHandleProps };
|