@primer/react 0.0.0-20260720205022 → 0.0.0-20260722001252
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 +43 -3
- package/dist/ActionBar/ActionBar-3767d551.css +2 -0
- package/dist/ActionBar/ActionBar-3767d551.css.map +1 -0
- package/dist/ActionBar/ActionBar.js +1 -1
- package/dist/ActionBar/ActionBar.module.css.js +1 -1
- package/dist/ActionList/Group.js +2 -2
- package/dist/ActionList/Item.js +1 -1
- package/dist/ActionList/List.js +15 -21
- package/dist/ActionMenu/ActionMenu.js +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +5 -7
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/Autocomplete/AutocompleteMenu.js +3 -2
- package/dist/Breadcrumbs/Breadcrumbs.js +4 -1
- package/dist/ButtonGroup/ButtonGroup.js +8 -15
- package/dist/Checkbox/Checkbox.js +9 -16
- package/dist/Dialog/Dialog.js +6 -13
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FeatureFlags/useFeatureFlag.js +2 -1
- package/dist/FilteredActionList/FilteredActionList.js +20 -31
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/FilteredActionList/useAnnouncements.js +20 -14
- package/dist/LabelGroup/LabelGroup-db41f443.css +2 -0
- package/dist/LabelGroup/LabelGroup-db41f443.css.map +1 -0
- package/dist/LabelGroup/LabelGroup.module.css.js +1 -1
- package/dist/NavList/NavList.d.ts +1 -0
- package/dist/NavList/NavList.js +40 -29
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/PageHeader/PageHeader.js +22 -31
- 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 +52 -36
- package/dist/SelectPanel/SelectPanel.js +1 -1
- package/dist/TextInput/TextInput.js +6 -13
- package/dist/TextInputWithTokens/TextInputWithTokens.js +1 -1
- package/dist/ThemeProvider.d.ts +1 -4
- package/dist/ThemeProvider.js +43 -76
- package/dist/Timeline/Timeline-b7e6685b.css +2 -0
- package/dist/Timeline/Timeline-b7e6685b.css.map +1 -0
- package/dist/Timeline/Timeline.module.css.js +1 -1
- package/dist/TooltipV2/Tooltip.js +13 -19
- package/dist/TreeView/TreeView.js +6 -3
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -2
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +10 -18
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/experimental/index.js +4 -4
- package/dist/hooks/useAnchoredPosition.js +14 -1
- package/dist/hooks/useDialog.js +2 -1
- package/dist/hooks/useMergedRefs.d.ts +4 -4
- package/dist/hooks/useMergedRefs.js +5 -8
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +2 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -5
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +1 -1
- package/dist/internal/components/OverflowObserverProvider.js +5 -5
- package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-798ef3cb.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/theme.d.ts +1 -1142
- package/dist/theme.js +1 -3
- package/dist/useTheme.d.ts +1 -3
- package/dist/utils/warning.js +3 -2
- package/generated/components.json +13 -13
- package/generated/hooks.json +0 -15
- package/package.json +7 -10
- package/dist/ActionBar/ActionBar-e63def3c.css +0 -2
- package/dist/ActionBar/ActionBar-e63def3c.css.map +0 -1
- package/dist/LabelGroup/LabelGroup-7d19205a.css +0 -2
- package/dist/LabelGroup/LabelGroup-7d19205a.css.map +0 -1
- package/dist/Timeline/Timeline-ff81db92.css +0 -2
- package/dist/Timeline/Timeline-ff81db92.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +0 -1
- package/dist/legacy-theme/ts/color-schemes.js +0 -4252
- package/dist/utils/types/KeyPaths.d.ts +0 -4
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
2
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
4
3
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
5
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
6
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
7
5
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
8
6
|
import { ActionListContainerContext } from "../ActionList/ActionListContainerContext.js";
|
|
9
7
|
import { ActionList } from "../ActionList/index.js";
|
|
@@ -36,17 +34,8 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
36
34
|
}, [onFilterChange, setInternalFilterValue]);
|
|
37
35
|
const inputAndListContainerRef = useRef(null);
|
|
38
36
|
const listRef = useRef(null);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const mergedScrollContainerRef = useMergedRefs(scrollContainerRef, providedScrollContainerRef);
|
|
42
|
-
const providedOrCreatedScrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
43
|
-
const readScrollContainerRef = mergedRefEnabled ? scrollContainerRef : providedOrCreatedScrollContainerRef;
|
|
44
|
-
const appliedScrollContainerRef = mergedRefEnabled ? mergedScrollContainerRef : providedOrCreatedScrollContainerRef;
|
|
45
|
-
const inputRef = useRef(null);
|
|
46
|
-
const mergedInputRef = useMergedRefs(inputRef, providedInputRef);
|
|
47
|
-
const providedOrCreatedInputRef = useProvidedRefOrCreate(providedInputRef);
|
|
48
|
-
const readInputRef = mergedRefEnabled ? inputRef : providedOrCreatedInputRef;
|
|
49
|
-
const appliedInputRef = mergedRefEnabled ? mergedInputRef : providedOrCreatedInputRef;
|
|
37
|
+
const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
38
|
+
const inputRef = useProvidedRefOrCreate(providedInputRef);
|
|
50
39
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
51
40
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
52
41
|
const activeDescendantRef = useRef();
|
|
@@ -100,12 +89,12 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
100
89
|
onListContainerRefChanged === null || onListContainerRefChanged === void 0 || onListContainerRefChanged(node);
|
|
101
90
|
}, [onListContainerRefChanged]);
|
|
102
91
|
useEffect(() => {
|
|
103
|
-
onInputRefChanged === null || onInputRefChanged === void 0 || onInputRefChanged(
|
|
104
|
-
}, [
|
|
92
|
+
onInputRefChanged === null || onInputRefChanged === void 0 || onInputRefChanged(inputRef);
|
|
93
|
+
}, [inputRef, onInputRefChanged]);
|
|
105
94
|
const DEFAULT_VIRTUAL_ITEM_HEIGHT = 32;
|
|
106
95
|
const virtualizer = useVirtualizer({
|
|
107
96
|
count: items.length,
|
|
108
|
-
getScrollElement: () =>
|
|
97
|
+
getScrollElement: () => scrollContainerRef.current,
|
|
109
98
|
estimateSize: () => DEFAULT_VIRTUAL_ITEM_HEIGHT,
|
|
110
99
|
overscan: 10,
|
|
111
100
|
enabled: isVirtualized,
|
|
@@ -139,7 +128,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
139
128
|
focusableElementFilter: (element) => {
|
|
140
129
|
return !(element instanceof HTMLInputElement);
|
|
141
130
|
},
|
|
142
|
-
activeDescendantFocus:
|
|
131
|
+
activeDescendantFocus: inputRef,
|
|
143
132
|
onActiveDescendantChanged: (current, previous, directlyActivated) => {
|
|
144
133
|
activeDescendantRef.current = current;
|
|
145
134
|
if (isVirtualized && current) {
|
|
@@ -147,7 +136,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
147
136
|
const range = virtualizer.range;
|
|
148
137
|
if (index !== null && range && (Number(index) < range.startIndex || Number(index) >= range.endIndex)) virtualizer.scrollToIndex(Number(index), { align: "auto" });
|
|
149
138
|
}
|
|
150
|
-
if (current &&
|
|
139
|
+
if (current && scrollContainerRef.current && (directlyActivated || focusPrependedElements)) scrollIntoView(current, scrollContainerRef.current, {
|
|
151
140
|
...menuScrollMargins,
|
|
152
141
|
behavior: scrollBehavior
|
|
153
142
|
});
|
|
@@ -164,14 +153,14 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
164
153
|
isVirtualized
|
|
165
154
|
]);
|
|
166
155
|
useEffect(() => {
|
|
167
|
-
if (activeDescendantRef.current &&
|
|
156
|
+
if (activeDescendantRef.current && scrollContainerRef.current) scrollIntoView(activeDescendantRef.current, scrollContainerRef.current, {
|
|
168
157
|
...menuScrollMargins,
|
|
169
158
|
behavior: scrollBehavior
|
|
170
159
|
});
|
|
171
160
|
}, [
|
|
172
161
|
items,
|
|
173
|
-
|
|
174
|
-
|
|
162
|
+
inputRef,
|
|
163
|
+
scrollContainerRef,
|
|
175
164
|
scrollBehavior
|
|
176
165
|
]);
|
|
177
166
|
useEffect(() => {
|
|
@@ -181,7 +170,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
181
170
|
const list = listRef.current;
|
|
182
171
|
if (!list) return;
|
|
183
172
|
const handleFocusIn = (event) => {
|
|
184
|
-
if (event.target ===
|
|
173
|
+
if (event.target === inputRef.current || list.contains(event.target)) setIsInputFocused(inputRef.current && inputRef.current === document.activeElement ? true : false);
|
|
185
174
|
};
|
|
186
175
|
inputAndListContainerElement.addEventListener("focusin", handleFocusIn);
|
|
187
176
|
return () => {
|
|
@@ -190,26 +179,26 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
190
179
|
}
|
|
191
180
|
}, [
|
|
192
181
|
items,
|
|
193
|
-
|
|
182
|
+
inputRef,
|
|
194
183
|
listContainerElement,
|
|
195
184
|
usingRovingTabindex
|
|
196
185
|
]);
|
|
197
186
|
useEffect(() => {
|
|
198
|
-
if (usingRovingTabindex && !loading) setIsInputFocused(
|
|
187
|
+
if (usingRovingTabindex && !loading) setIsInputFocused(inputRef.current && inputRef.current === document.activeElement ? true : false);
|
|
199
188
|
}, [
|
|
200
189
|
loading,
|
|
201
|
-
|
|
190
|
+
inputRef,
|
|
202
191
|
usingRovingTabindex
|
|
203
192
|
]);
|
|
204
|
-
useAnnouncements(items, usingRovingTabindex ? listRef : { current: listContainerElement },
|
|
205
|
-
useScrollFlash(
|
|
193
|
+
useAnnouncements(items, usingRovingTabindex ? listRef : { current: listContainerElement }, inputRef, announcementsEnabled, loading, messageText, _PrivateFocusManagement);
|
|
194
|
+
useScrollFlash(scrollContainerRef);
|
|
206
195
|
const handleSelectAllChange = useCallback((e) => {
|
|
207
196
|
if (onSelectAllChange) onSelectAllChange(e.target.checked);
|
|
208
197
|
}, [onSelectAllChange]);
|
|
209
198
|
function getBodyContent() {
|
|
210
|
-
if (loading &&
|
|
199
|
+
if (loading && scrollContainerRef.current && loadingType.appearsInBody) return /*#__PURE__*/ jsx(FilteredActionListBodyLoader, {
|
|
211
200
|
loadingType,
|
|
212
|
-
height:
|
|
201
|
+
height: scrollContainerRef.current.clientHeight
|
|
213
202
|
});
|
|
214
203
|
if (message) return message;
|
|
215
204
|
let firstGroupIndex = 0;
|
|
@@ -301,7 +290,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
301
290
|
"data-component": "FilteredActionList",
|
|
302
291
|
children: [
|
|
303
292
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
304
|
-
inputRef
|
|
293
|
+
inputRef,
|
|
305
294
|
value: filterValue,
|
|
306
295
|
onInputChange,
|
|
307
296
|
onInputKeyPress,
|
|
@@ -335,7 +324,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
335
324
|
})]
|
|
336
325
|
}),
|
|
337
326
|
/*#__PURE__*/ jsx("div", {
|
|
338
|
-
ref:
|
|
327
|
+
ref: scrollContainerRef,
|
|
339
328
|
className: FilteredActionList_module_css_default.Container,
|
|
340
329
|
children: getBodyContent()
|
|
341
330
|
})
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
//#region src/FilteredActionList/FilteredActionListInput.d.ts
|
|
5
5
|
interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
|
|
6
|
-
inputRef: React.
|
|
6
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
7
7
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
9
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -31,20 +31,23 @@ 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
|
-
|
|
34
|
+
if (usingRovingTabindex) {
|
|
35
|
+
const announcementText = `${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`;
|
|
36
|
+
announce$1(announcementText, {
|
|
37
|
+
delayMs,
|
|
38
|
+
from: liveRegion ? liveRegion : void 0
|
|
39
|
+
});
|
|
40
|
+
} else window.requestAnimationFrame(() => {
|
|
39
41
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
40
42
|
if (!activeItem) return;
|
|
41
43
|
const { index, text, selected } = activeItem;
|
|
42
|
-
|
|
44
|
+
const announcementText = [
|
|
43
45
|
`Focus on filter text box and list of items`,
|
|
44
46
|
`Focused item: ${text}`,
|
|
45
47
|
`${selected ? "selected" : "not selected"}`,
|
|
46
48
|
`${index + 1} of ${items.length}`
|
|
47
|
-
].join(", ")
|
|
49
|
+
].join(", ");
|
|
50
|
+
announce$1(announcementText, {
|
|
48
51
|
delayMs,
|
|
49
52
|
from: liveRegion ? liveRegion : void 0
|
|
50
53
|
});
|
|
@@ -70,20 +73,23 @@ const useAnnouncements = (items, listContainerRef, inputRef, enabled = true, loa
|
|
|
70
73
|
announce$1(`${message === null || message === void 0 ? void 0 : message.title}. ${message === null || message === void 0 ? void 0 : message.description}`, { delayMs });
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
if (usingRovingTabindex)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (usingRovingTabindex) {
|
|
77
|
+
const announcementText = `${items.length} item${items.length > 1 ? "s" : ""} available, ${selectedItems} selected.`;
|
|
78
|
+
announce$1(announcementText, {
|
|
79
|
+
delayMs,
|
|
80
|
+
from: liveRegion ? liveRegion : void 0
|
|
81
|
+
});
|
|
82
|
+
} else window.requestAnimationFrame(() => {
|
|
78
83
|
const activeItem = getItemWithActiveDescendant(listContainerRef, items);
|
|
79
84
|
if (!activeItem) return;
|
|
80
85
|
const { index, text, selected } = activeItem;
|
|
81
|
-
|
|
86
|
+
const announcementText = [
|
|
82
87
|
`List updated`,
|
|
83
88
|
`Focused item: ${text}`,
|
|
84
89
|
`${selected ? "selected" : "not selected"}`,
|
|
85
90
|
`${index + 1} of ${items.length}`
|
|
86
|
-
].join(", ")
|
|
91
|
+
].join(", ");
|
|
92
|
+
announce$1(announcementText, {
|
|
87
93
|
delayMs,
|
|
88
94
|
from: liveRegion ? liveRegion : void 0
|
|
89
95
|
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-LabelGroup-Container-E-ePP{contain:layout;display:flex;flex-wrap:nowrap;gap:var(--base-size-4,.25rem);line-height:1;max-width:100%;overflow:hidden}.prc-LabelGroup-Container-E-ePP:where([data-overflow=inline]){flex-wrap:wrap}.prc-LabelGroup-Container-E-ePP:where([data-list]){list-style-type:none;margin-block-end:0;margin-block-start:0;padding-inline-start:0}.prc-LabelGroup-ItemWrapper-GkO4t{align-items:center;display:flex;min-height:28px}.prc-LabelGroup-ItemWrapper--hidden-mdrB0{order:9999;pointer-events:none;visibility:hidden}.prc-LabelGroup-OverlayContainer-duQvd{align-items:flex-start;display:flex}.prc-LabelGroup-OverlayInner-nDXRC{display:flex;flex-wrap:wrap;gap:var(--base-size-4,.25rem)}.prc-LabelGroup-CloseButton-IyLno{flex-shrink:0}
|
|
2
|
+
/*# sourceMappingURL=LabelGroup-db41f443.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/LabelGroup/LabelGroup.module.css.js"],"names":[],"mappings":"AAAA,gCAYE,cAAe,CAXf,YAAa,CACb,gBAAiB,CACjB,6BAAuB,CAEvB,aAAc,CACd,cAAe,CACf,eAiBF,CAVE,8DACE,cACF,CAEA,mDAIE,oBAAqB,CADrB,kBAAmB,CADnB,oBAAqB,CADrB,sBAIF,CAGF,kCAEE,kBAAmB,CADnB,YAAa,CAOb,eACF,CAEA,0CACE,UAAW,CACX,mBAAoB,CACpB,iBACF,CAEA,uCACE,sBAAuB,CACvB,YACF,CAEA,mCACE,YAAa,CACb,cAAe,CACf,6BACF,CAEA,kCACE,aACF","file":"LabelGroup-db41f443.css","sourcesContent":[".Container {\n display: flex;\n flex-wrap: nowrap;\n gap: var(--base-size-4);\n /* stylelint-disable-next-line primer/typography */\n line-height: 1;\n max-width: 100%;\n overflow: hidden;\n\n /* Isolate the IntersectionObserver-driven show/hide of overflowing labels so it can't invalidate\n ancestor layout. Safe because the row already clips (overflow: hidden) and the expanded overlay is\n rendered separately, so it isn't affected by the new containing block/stacking context. */\n contain: layout;\n\n &:where([data-overflow='inline']) {\n flex-wrap: wrap;\n }\n\n &:where([data-list]) {\n padding-inline-start: 0;\n margin-block-start: 0;\n margin-block-end: 0;\n list-style-type: none;\n }\n}\n\n.ItemWrapper {\n display: flex;\n align-items: center;\n /* This min-height matches the height of the expand/collapse button.\n Without it, the labels/tokens will do a slight layout shift when expanded.\n This is because the height of the first row will match the token sizes,\n but the height of the second row will be the height of the collapse button.\n */\n min-height: 28px;\n}\n\n.ItemWrapper--hidden {\n order: 9999;\n pointer-events: none;\n visibility: hidden;\n}\n\n.OverlayContainer {\n align-items: flex-start;\n display: flex;\n}\n\n.OverlayInner {\n display: flex;\n flex-wrap: wrap;\n gap: var(--base-size-4);\n}\n\n.CloseButton {\n flex-shrink: 0;\n}\n"]}
|
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";
|
|
3
4
|
import { fixedForwardRef } from "../utils/modern-polymorphic.js";
|
|
4
5
|
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";
|
|
@@ -375,57 +375,68 @@ Divider.displayName = "NavList.Divider";
|
|
|
375
375
|
const TrailingAction = ActionList.TrailingAction;
|
|
376
376
|
TrailingAction.displayName = "NavList.TrailingAction";
|
|
377
377
|
const Group = (t0) => {
|
|
378
|
-
const $ = c(
|
|
378
|
+
const $ = c(19);
|
|
379
379
|
let children;
|
|
380
|
+
let hideDivider;
|
|
380
381
|
let props;
|
|
381
382
|
let title;
|
|
382
383
|
if ($[0] !== t0) {
|
|
383
|
-
({title, children, ...props} = t0);
|
|
384
|
+
({title, children, hideDivider, ...props} = t0);
|
|
384
385
|
$[0] = t0;
|
|
385
386
|
$[1] = children;
|
|
386
|
-
$[2] =
|
|
387
|
-
$[3] =
|
|
387
|
+
$[2] = hideDivider;
|
|
388
|
+
$[3] = props;
|
|
389
|
+
$[4] = title;
|
|
388
390
|
} else {
|
|
389
391
|
children = $[1];
|
|
390
|
-
|
|
391
|
-
|
|
392
|
+
hideDivider = $[2];
|
|
393
|
+
props = $[3];
|
|
394
|
+
title = $[4];
|
|
392
395
|
}
|
|
393
396
|
const headingLevel = React.useContext(NavListHeadingLevelContext);
|
|
394
397
|
let t1;
|
|
395
|
-
if ($[
|
|
398
|
+
if ($[5] !== headingLevel) {
|
|
396
399
|
t1 = headingLevel ? levelToHeadingTag(headingLevel + 1) : "h3";
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
399
|
-
} else t1 = $[
|
|
400
|
+
$[5] = headingLevel;
|
|
401
|
+
$[6] = t1;
|
|
402
|
+
} else t1 = $[6];
|
|
400
403
|
const groupHeadingAs = t1;
|
|
401
404
|
let t2;
|
|
402
|
-
if ($[
|
|
403
|
-
t2 = /*#__PURE__*/ jsx(ActionList.Divider, {});
|
|
404
|
-
$[
|
|
405
|
-
|
|
405
|
+
if ($[7] !== hideDivider) {
|
|
406
|
+
t2 = !hideDivider && /*#__PURE__*/ jsx(ActionList.Divider, {});
|
|
407
|
+
$[7] = hideDivider;
|
|
408
|
+
$[8] = t2;
|
|
409
|
+
} else t2 = $[8];
|
|
406
410
|
let t3;
|
|
407
|
-
if ($[
|
|
411
|
+
if ($[9] !== groupHeadingAs || $[10] !== title) {
|
|
408
412
|
t3 = title ? /*#__PURE__*/ jsx(ActionList.GroupHeading, {
|
|
409
413
|
as: groupHeadingAs,
|
|
410
414
|
"data-component": "ActionList.GroupHeading",
|
|
411
415
|
children: title
|
|
412
416
|
}) : null;
|
|
413
|
-
$[
|
|
414
|
-
$[
|
|
415
|
-
$[
|
|
416
|
-
} else t3 = $[
|
|
417
|
+
$[9] = groupHeadingAs;
|
|
418
|
+
$[10] = title;
|
|
419
|
+
$[11] = t3;
|
|
420
|
+
} else t3 = $[11];
|
|
417
421
|
let t4;
|
|
418
|
-
if ($[
|
|
419
|
-
t4 = /*#__PURE__*/ jsxs(
|
|
422
|
+
if ($[12] !== children || $[13] !== props || $[14] !== t3) {
|
|
423
|
+
t4 = /*#__PURE__*/ jsxs(ActionList.Group, {
|
|
420
424
|
...props,
|
|
421
425
|
children: [t3, children]
|
|
422
|
-
})
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
} else t4 = $[
|
|
428
|
-
|
|
426
|
+
});
|
|
427
|
+
$[12] = children;
|
|
428
|
+
$[13] = props;
|
|
429
|
+
$[14] = t3;
|
|
430
|
+
$[15] = t4;
|
|
431
|
+
} else t4 = $[15];
|
|
432
|
+
let t5;
|
|
433
|
+
if ($[16] !== t2 || $[17] !== t4) {
|
|
434
|
+
t5 = /*#__PURE__*/ jsxs(Fragment, { children: [t2, t4] });
|
|
435
|
+
$[16] = t2;
|
|
436
|
+
$[17] = t4;
|
|
437
|
+
$[18] = t5;
|
|
438
|
+
} else t5 = $[18];
|
|
439
|
+
return t5;
|
|
429
440
|
};
|
|
430
441
|
const GroupExpand = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
431
442
|
const $ = c(23);
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import { useOverlay } from "../hooks/useOverlay.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
4
|
import Portal_default from "../Portal/index.js";
|
|
5
|
+
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
6
|
import Overlay_module_css_default from "./Overlay.module.css.js";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
2
|
import { warning } from "../utils/warning.js";
|
|
4
|
-
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
5
|
-
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
6
3
|
import { isSlot } from "../utils/is-slot.js";
|
|
4
|
+
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
7
5
|
import { getResponsiveAttributes } from "../internal/utils/getResponsiveAttributes.js";
|
|
8
6
|
import Heading from "../Heading/Heading.js";
|
|
9
7
|
import Link from "../Link/Link.js";
|
|
@@ -12,7 +10,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
|
|
|
12
10
|
import { c } from "react-compiler-runtime";
|
|
13
11
|
import { clsx } from "clsx";
|
|
14
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import React, { useEffect
|
|
13
|
+
import React, { useEffect } from "react";
|
|
16
14
|
import { ArrowLeftIcon } from "@primer/octicons-react";
|
|
17
15
|
//#region src/PageHeader/PageHeader.tsx
|
|
18
16
|
const hiddenOnRegularAndWide = {
|
|
@@ -29,12 +27,7 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
29
27
|
const $ = c(17);
|
|
30
28
|
const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
|
|
31
29
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
32
|
-
const
|
|
33
|
-
const rootRef = useRef(null);
|
|
34
|
-
const mergedRef = useMergedRefs(rootRef, forwardedRef);
|
|
35
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
36
|
-
const readRef = mergedRefEnabled ? rootRef : providedOrCreatedRef;
|
|
37
|
-
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
30
|
+
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
38
31
|
const hoistChildState = (nodes) => {
|
|
39
32
|
const result = { hasNavigation: false };
|
|
40
33
|
for (const child of React.Children.toArray(nodes)) {
|
|
@@ -61,12 +54,12 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
61
54
|
const isInteractive = _temp;
|
|
62
55
|
let t2;
|
|
63
56
|
let t3;
|
|
64
|
-
if ($[0] !== children || $[1] !==
|
|
57
|
+
if ($[0] !== children || $[1] !== rootRef) {
|
|
65
58
|
t2 = function validateInteractiveElementsInTitle() {
|
|
66
59
|
let hasContextArea = false;
|
|
67
60
|
let hasLeadingAction = false;
|
|
68
|
-
if (!
|
|
69
|
-
const titleArea = Array.from(
|
|
61
|
+
if (!rootRef.current || rootRef.current.children.length <= 0) return;
|
|
62
|
+
const titleArea = Array.from(rootRef.current.children).find(_temp2);
|
|
70
63
|
if (!titleArea) return;
|
|
71
64
|
for (const child_1 of React.Children.toArray(children)) {
|
|
72
65
|
if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === ContextArea || isSlot(child_1, ContextArea))) hasContextArea = true;
|
|
@@ -74,9 +67,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
74
67
|
}
|
|
75
68
|
warning(Array.from(titleArea.childNodes).some((child_2) => child_2 instanceof HTMLElement && isInteractive(child_2) || Array.from(child_2.childNodes).some((child_3) => child_3 instanceof HTMLElement && isInteractive(child_3))) && (hasContextArea || hasLeadingAction), "When PageHeader.ContextArea or PageHeader.LeadingAction is present, we recommended not to include any interactive items in the PageHeader.TitleArea to make sure the focus order is logical.");
|
|
76
69
|
};
|
|
77
|
-
t3 = [children,
|
|
70
|
+
t3 = [children, rootRef];
|
|
78
71
|
$[0] = children;
|
|
79
|
-
$[1] =
|
|
72
|
+
$[1] = rootRef;
|
|
80
73
|
$[2] = t2;
|
|
81
74
|
$[3] = t3;
|
|
82
75
|
} else {
|
|
@@ -96,9 +89,9 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
96
89
|
const t8 = getResponsiveAttributes("title-size-variant", titleVariant);
|
|
97
90
|
const t9 = getNavHiddenDataAttributes(navigationHidden);
|
|
98
91
|
let t10;
|
|
99
|
-
if ($[6] !== BaseComponent || $[7] !==
|
|
92
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
|
|
100
93
|
t10 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
101
|
-
ref:
|
|
94
|
+
ref: rootRef,
|
|
102
95
|
className: t4,
|
|
103
96
|
"data-component": t5,
|
|
104
97
|
"data-has-border": t6,
|
|
@@ -110,10 +103,10 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
110
103
|
children
|
|
111
104
|
});
|
|
112
105
|
$[6] = BaseComponent;
|
|
113
|
-
$[7] =
|
|
114
|
-
$[8] =
|
|
115
|
-
$[9] =
|
|
116
|
-
$[10] =
|
|
106
|
+
$[7] = ariaLabel;
|
|
107
|
+
$[8] = children;
|
|
108
|
+
$[9] = role;
|
|
109
|
+
$[10] = rootRef;
|
|
117
110
|
$[11] = t4;
|
|
118
111
|
$[12] = t6;
|
|
119
112
|
$[13] = t7;
|
|
@@ -302,9 +295,7 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
302
295
|
const { children, className, hidden: t1, variant: t2 } = t0;
|
|
303
296
|
const hidden = t1 === void 0 ? false : t1;
|
|
304
297
|
const variant = t2 === void 0 ? "medium" : t2;
|
|
305
|
-
const
|
|
306
|
-
const providedOrCreatedRef = useProvidedRefOrCreate(forwardedRef);
|
|
307
|
-
const appliedRef = mergedRefEnabled ? forwardedRef : providedOrCreatedRef;
|
|
298
|
+
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
308
299
|
let t3;
|
|
309
300
|
if ($[0] !== className) {
|
|
310
301
|
t3 = clsx(PageHeader_module_css_default.TitleArea, className);
|
|
@@ -324,20 +315,20 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
324
315
|
$[5] = t5;
|
|
325
316
|
} else t5 = $[5];
|
|
326
317
|
let t6;
|
|
327
|
-
if ($[6] !==
|
|
318
|
+
if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
|
|
328
319
|
t6 = /*#__PURE__*/ jsx("div", {
|
|
329
320
|
className: t3,
|
|
330
|
-
ref:
|
|
321
|
+
ref: titleAreaRef,
|
|
331
322
|
"data-component": "TitleArea",
|
|
332
323
|
...t4,
|
|
333
324
|
...t5,
|
|
334
325
|
children
|
|
335
326
|
});
|
|
336
|
-
$[6] =
|
|
337
|
-
$[7] =
|
|
338
|
-
$[8] =
|
|
339
|
-
$[9] =
|
|
340
|
-
$[10] =
|
|
327
|
+
$[6] = children;
|
|
328
|
+
$[7] = t3;
|
|
329
|
+
$[8] = t4;
|
|
330
|
+
$[9] = t5;
|
|
331
|
+
$[10] = titleAreaRef;
|
|
341
332
|
$[11] = t6;
|
|
342
333
|
} else t6 = $[11];
|
|
343
334
|
return t6;
|
|
@@ -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 };
|