@primer/react 0.0.0-20260701235500 → 0.0.0-20260702155148
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 +7 -1
- package/dist/ActionList/Heading.js +25 -35
- package/dist/ActionList/List.js +46 -45
- package/dist/AnchoredOverlay/AnchoredOverlay.js +2 -4
- package/dist/Autocomplete/Autocomplete.js +131 -74
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- package/dist/Autocomplete/AutocompleteMenu.js +277 -119
- package/dist/Autocomplete/AutocompleteOverlay.js +113 -38
- package/dist/Banner/Banner.js +414 -96
- package/dist/Button/Button.js +29 -8
- package/dist/Button/IconButton.js +120 -28
- package/dist/Button/LinkButton.js +34 -8
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.js +4 -5
- package/dist/ConfirmationDialog/ConfirmationDialog.js +86 -24
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/FilteredActionList/FilteredActionList.js +5 -7
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/PageLayout/PageLayout.js +1274 -478
- package/dist/Pagination/Pagination.js +196 -70
- package/dist/SelectPanel/SelectPanelMessage.js +72 -29
- package/dist/TextInput/TextInput.js +4 -5
- package/dist/TooltipV2/Tooltip.js +5 -15
- package/dist/UnderlineNav/UnderlineNav-964b246d.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-964b246d.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.js +198 -64
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +110 -22
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -16
- package/dist/hooks/useMergedRefs.js +20 -14
- package/dist/hooks/useOpenAndCloseFocus.js +1 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +24 -10
- 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/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
|
@@ -10,87 +10,221 @@ import UnderlineNav_module_css_default from "./UnderlineNav.module.css.js";
|
|
|
10
10
|
import { UnderlineNavContext } from "./UnderlineNavContext.js";
|
|
11
11
|
import { UnderlineNavItemsRegistry } from "./UnderlineNavItemsRegistry.js";
|
|
12
12
|
import { getValidChildren, isCurrent } from "./utils.js";
|
|
13
|
+
import { c } from "react-compiler-runtime";
|
|
13
14
|
import { clsx } from "clsx";
|
|
14
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import { forwardRef,
|
|
16
|
+
import { forwardRef, useRef, useState } from "react";
|
|
16
17
|
//#region src/UnderlineNav/UnderlineNav.tsx
|
|
17
|
-
const UnderlineNav = /*#__PURE__*/ forwardRef((
|
|
18
|
-
|
|
18
|
+
const UnderlineNav = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
19
|
+
const $ = c(47);
|
|
20
|
+
const { as: t1, "aria-label": ariaLabel, loadingCounters: t2, variant: t3, className, children } = t0;
|
|
21
|
+
const as = t1 === void 0 ? "nav" : t1;
|
|
22
|
+
const loadingCounters = t2 === void 0 ? false : t2;
|
|
23
|
+
const variant = t3 === void 0 ? "inset" : t3;
|
|
19
24
|
const backupRef = useRef(null);
|
|
20
25
|
const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
21
26
|
const listRef = useRef(null);
|
|
22
|
-
/** Tracks whether any item has ever overflowed for the lifecycle of this component. Used to prevent flickering. */
|
|
23
|
-
const [hasEverOverflowed, setHasOverflowed] = useState(false);
|
|
24
27
|
const [registeredItems, setRegisteredItems] = UnderlineNavItemsRegistry.useRegistryState();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
let isOverflowing;
|
|
29
|
+
let overflowMenuItems;
|
|
30
|
+
let t4;
|
|
31
|
+
if ($[0] !== registeredItems) {
|
|
32
|
+
var _registeredItems$entr;
|
|
33
|
+
overflowMenuItems = Array.from((_registeredItems$entr = registeredItems === null || registeredItems === void 0 ? void 0 : registeredItems.entries()) !== null && _registeredItems$entr !== void 0 ? _registeredItems$entr : []).filter(_temp);
|
|
34
|
+
isOverflowing = overflowMenuItems.length > 0;
|
|
35
|
+
t4 = overflowMenuItems.some(_temp2);
|
|
36
|
+
$[0] = registeredItems;
|
|
37
|
+
$[1] = isOverflowing;
|
|
38
|
+
$[2] = overflowMenuItems;
|
|
39
|
+
$[3] = t4;
|
|
40
|
+
} else {
|
|
41
|
+
isOverflowing = $[1];
|
|
42
|
+
overflowMenuItems = $[2];
|
|
43
|
+
t4 = $[3];
|
|
44
|
+
}
|
|
45
|
+
const overflowingCurrentItem = t4;
|
|
46
|
+
let t5;
|
|
47
|
+
if ($[4] !== children) {
|
|
48
|
+
t5 = getValidChildren(children);
|
|
49
|
+
$[4] = children;
|
|
50
|
+
$[5] = t5;
|
|
51
|
+
} else t5 = $[5];
|
|
52
|
+
const validChildren = t5;
|
|
53
|
+
let t6;
|
|
54
|
+
let t7;
|
|
55
|
+
if ($[6] !== ariaLabel || $[7] !== validChildren) {
|
|
56
|
+
t6 = () => {
|
|
57
|
+
!(validChildren.filter(_temp3).length <= 1) && invariant(false, "Only one current element is allowed");
|
|
58
|
+
!ariaLabel && invariant(false, "Use the `aria-label` prop to provide an accessible label for assistive technology");
|
|
59
|
+
};
|
|
60
|
+
t7 = [validChildren, ariaLabel];
|
|
61
|
+
$[6] = ariaLabel;
|
|
62
|
+
$[7] = validChildren;
|
|
63
|
+
$[8] = t6;
|
|
64
|
+
$[9] = t7;
|
|
65
|
+
} else {
|
|
66
|
+
t6 = $[8];
|
|
67
|
+
t7 = $[9];
|
|
68
|
+
}
|
|
69
|
+
useDevOnlyEffect(t6, t7);
|
|
70
|
+
let t8;
|
|
71
|
+
if ($[10] !== loadingCounters) {
|
|
72
|
+
t8 = { loadingCounters };
|
|
73
|
+
$[10] = loadingCounters;
|
|
74
|
+
$[11] = t8;
|
|
75
|
+
} else t8 = $[11];
|
|
76
|
+
const contextValue = t8;
|
|
35
77
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
36
78
|
if (menuOpen && !isOverflowing) setMenuOpen(false);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
let t9;
|
|
80
|
+
if ($[12] !== ariaLabel) {
|
|
81
|
+
t9 = ariaLabel && /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
40
82
|
as: "h2",
|
|
41
83
|
children: `${ariaLabel} navigation`
|
|
42
|
-
})
|
|
84
|
+
});
|
|
85
|
+
$[12] = ariaLabel;
|
|
86
|
+
$[13] = t9;
|
|
87
|
+
} else t9 = $[13];
|
|
88
|
+
let t10;
|
|
89
|
+
if ($[14] !== className) {
|
|
90
|
+
t10 = clsx(UnderlineNav_module_css_default.UnderlineWrapper, className);
|
|
91
|
+
$[14] = className;
|
|
92
|
+
$[15] = t10;
|
|
93
|
+
} else t10 = $[15];
|
|
94
|
+
const t11 = isOverflowing ? "true" : void 0;
|
|
95
|
+
let t12;
|
|
96
|
+
if ($[16] !== children || $[17] !== setRegisteredItems) {
|
|
97
|
+
t12 = /*#__PURE__*/ jsx(UnderlineItemList, {
|
|
98
|
+
ref: listRef,
|
|
99
|
+
role: "list",
|
|
100
|
+
className: UnderlineNav_module_css_default.ItemsList,
|
|
101
|
+
children: /*#__PURE__*/ jsx(UnderlineNavItemsRegistry.Provider, {
|
|
102
|
+
setRegistry: setRegisteredItems,
|
|
103
|
+
children
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
$[16] = children;
|
|
107
|
+
$[17] = setRegisteredItems;
|
|
108
|
+
$[18] = t12;
|
|
109
|
+
} else t12 = $[18];
|
|
110
|
+
let t13;
|
|
111
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
112
|
+
t13 = /*#__PURE__*/ jsx("div", { className: UnderlineNav_module_css_default.MoreButtonDivider });
|
|
113
|
+
$[19] = t13;
|
|
114
|
+
} else t13 = $[19];
|
|
115
|
+
const t14 = overflowingCurrentItem ? "true" : void 0;
|
|
116
|
+
const t15 = overflowingCurrentItem ? "More items, including current item" : void 0;
|
|
117
|
+
let t16;
|
|
118
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
119
|
+
t16 = /*#__PURE__*/ jsxs("span", { children: ["More", /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
120
|
+
as: "span",
|
|
121
|
+
children: " items"
|
|
122
|
+
})] });
|
|
123
|
+
$[20] = t16;
|
|
124
|
+
} else t16 = $[20];
|
|
125
|
+
let t17;
|
|
126
|
+
if ($[21] !== t14 || $[22] !== t15) {
|
|
127
|
+
t17 = /*#__PURE__*/ jsx(ActionMenu.Button, {
|
|
128
|
+
className: UnderlineNav_module_css_default.MoreButton,
|
|
129
|
+
variant: "invisible",
|
|
130
|
+
"data-component": "overflow-menu-button",
|
|
131
|
+
"data-current": t14,
|
|
132
|
+
"aria-label": t15,
|
|
133
|
+
children: t16
|
|
134
|
+
});
|
|
135
|
+
$[21] = t14;
|
|
136
|
+
$[22] = t15;
|
|
137
|
+
$[23] = t17;
|
|
138
|
+
} else t17 = $[23];
|
|
139
|
+
let t18;
|
|
140
|
+
if ($[24] !== loadingCounters || $[25] !== overflowMenuItems || $[26] !== registeredItems) {
|
|
141
|
+
t18 = registeredItems === void 0 ? /*#__PURE__*/ jsx(ActionList.Item, { children: /*#__PURE__*/ jsx(SkeletonText, {}) }) : overflowMenuItems.map((t19) => {
|
|
142
|
+
const [key, allProps] = t19;
|
|
143
|
+
const { children: menuItemChildren, counter, onSelect, ...menuItemProps } = allProps;
|
|
144
|
+
return /*#__PURE__*/ jsxs(ActionList.LinkItem, {
|
|
145
|
+
onClick: (event) => onSelect === null || onSelect === void 0 ? void 0 : onSelect(event),
|
|
146
|
+
...menuItemProps,
|
|
147
|
+
className: UnderlineNav_module_css_default.OverflowMenuItem,
|
|
148
|
+
children: [/*#__PURE__*/ jsx("span", {
|
|
149
|
+
className: UnderlineNav_module_css_default.OverflowMenuItemLabel,
|
|
150
|
+
children: menuItemChildren
|
|
151
|
+
}), loadingCounters ? /*#__PURE__*/ jsx(ActionList.TrailingVisual, { children: /*#__PURE__*/ jsx(LoadingCounter, {}) }) : counter !== void 0 && /*#__PURE__*/ jsx(ActionList.TrailingVisual, { children: /*#__PURE__*/ jsx("span", {
|
|
152
|
+
"data-component": "counter",
|
|
153
|
+
children: /*#__PURE__*/ jsx(CounterLabel, { children: counter })
|
|
154
|
+
}) })]
|
|
155
|
+
}, key);
|
|
156
|
+
});
|
|
157
|
+
$[24] = loadingCounters;
|
|
158
|
+
$[25] = overflowMenuItems;
|
|
159
|
+
$[26] = registeredItems;
|
|
160
|
+
$[27] = t18;
|
|
161
|
+
} else t18 = $[27];
|
|
162
|
+
let t19;
|
|
163
|
+
if ($[28] !== t18) {
|
|
164
|
+
t19 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t18 }) });
|
|
165
|
+
$[28] = t18;
|
|
166
|
+
$[29] = t19;
|
|
167
|
+
} else t19 = $[29];
|
|
168
|
+
let t20;
|
|
169
|
+
if ($[30] !== menuOpen || $[31] !== t17 || $[32] !== t19) {
|
|
170
|
+
t20 = /*#__PURE__*/ jsxs("div", {
|
|
171
|
+
className: UnderlineNav_module_css_default.MoreButtonContainer,
|
|
172
|
+
children: [t13, /*#__PURE__*/ jsxs(ActionMenu, {
|
|
173
|
+
open: menuOpen,
|
|
174
|
+
onOpenChange: setMenuOpen,
|
|
175
|
+
children: [t17, t19]
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
$[30] = menuOpen;
|
|
179
|
+
$[31] = t17;
|
|
180
|
+
$[32] = t19;
|
|
181
|
+
$[33] = t20;
|
|
182
|
+
} else t20 = $[33];
|
|
183
|
+
let t21;
|
|
184
|
+
if ($[34] !== ariaLabel || $[35] !== as || $[36] !== navRef || $[37] !== t10 || $[38] !== t11 || $[39] !== t12 || $[40] !== t20 || $[41] !== variant) {
|
|
185
|
+
t21 = /*#__PURE__*/ jsxs(UnderlineWrapper, {
|
|
43
186
|
as,
|
|
44
187
|
"aria-label": ariaLabel,
|
|
45
|
-
className:
|
|
188
|
+
className: t10,
|
|
46
189
|
ref: navRef,
|
|
47
190
|
"data-variant": variant,
|
|
48
191
|
"data-overflow-mode": "wrap",
|
|
49
|
-
"data-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}), /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: registeredItems === void 0 ? /*#__PURE__*/ jsx(ActionList.Item, { children: /*#__PURE__*/ jsx(SkeletonText, {}) }) : overflowMenuItems.map(([key, allProps]) => {
|
|
75
|
-
const { children: menuItemChildren, counter, onSelect, ...menuItemProps } = allProps;
|
|
76
|
-
return /*#__PURE__*/ jsxs(ActionList.LinkItem, {
|
|
77
|
-
onClick: (event) => onSelect === null || onSelect === void 0 ? void 0 : onSelect(event),
|
|
78
|
-
...menuItemProps,
|
|
79
|
-
className: UnderlineNav_module_css_default.OverflowMenuItem,
|
|
80
|
-
children: [/*#__PURE__*/ jsx("span", {
|
|
81
|
-
className: UnderlineNav_module_css_default.OverflowMenuItemLabel,
|
|
82
|
-
children: menuItemChildren
|
|
83
|
-
}), loadingCounters ? /*#__PURE__*/ jsx(ActionList.TrailingVisual, { children: /*#__PURE__*/ jsx(LoadingCounter, {}) }) : counter !== void 0 && /*#__PURE__*/ jsx(ActionList.TrailingVisual, { children: /*#__PURE__*/ jsx("span", {
|
|
84
|
-
"data-component": "counter",
|
|
85
|
-
children: /*#__PURE__*/ jsx(CounterLabel, { children: counter })
|
|
86
|
-
}) })]
|
|
87
|
-
}, key);
|
|
88
|
-
}) }) })]
|
|
89
|
-
})]
|
|
90
|
-
})]
|
|
91
|
-
})]
|
|
92
|
-
});
|
|
192
|
+
"data-has-overflow": t11,
|
|
193
|
+
children: [t12, t20]
|
|
194
|
+
});
|
|
195
|
+
$[34] = ariaLabel;
|
|
196
|
+
$[35] = as;
|
|
197
|
+
$[36] = navRef;
|
|
198
|
+
$[37] = t10;
|
|
199
|
+
$[38] = t11;
|
|
200
|
+
$[39] = t12;
|
|
201
|
+
$[40] = t20;
|
|
202
|
+
$[41] = variant;
|
|
203
|
+
$[42] = t21;
|
|
204
|
+
} else t21 = $[42];
|
|
205
|
+
let t22;
|
|
206
|
+
if ($[43] !== contextValue || $[44] !== t21 || $[45] !== t9) {
|
|
207
|
+
t22 = /*#__PURE__*/ jsxs(UnderlineNavContext.Provider, {
|
|
208
|
+
value: contextValue,
|
|
209
|
+
children: [t9, t21]
|
|
210
|
+
});
|
|
211
|
+
$[43] = contextValue;
|
|
212
|
+
$[44] = t21;
|
|
213
|
+
$[45] = t9;
|
|
214
|
+
$[46] = t22;
|
|
215
|
+
} else t22 = $[46];
|
|
216
|
+
return t22;
|
|
93
217
|
});
|
|
94
218
|
UnderlineNav.displayName = "UnderlineNav";
|
|
219
|
+
function _temp(entry) {
|
|
220
|
+
return entry[1] !== null;
|
|
221
|
+
}
|
|
222
|
+
function _temp2(t0) {
|
|
223
|
+
const [, itemProps] = t0;
|
|
224
|
+
return isCurrent(itemProps);
|
|
225
|
+
}
|
|
226
|
+
function _temp3(child) {
|
|
227
|
+
return isCurrent(child.props);
|
|
228
|
+
}
|
|
95
229
|
//#endregion
|
|
96
230
|
export { UnderlineNav };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./UnderlineNav-
|
|
1
|
+
import "./UnderlineNav-964b246d.css";
|
|
2
2
|
//#region src/UnderlineNav/UnderlineNav.module.css.js
|
|
3
3
|
var UnderlineNav_module_css_default = {
|
|
4
4
|
"UnderlineWrapper": "prc-UnderlineNav-UnderlineWrapper-GWONT",
|
|
5
5
|
"detect-overflow": "prc-UnderlineNav-detect-overflow-6HuSH",
|
|
6
6
|
"ItemsList": "prc-UnderlineNav-ItemsList-oj8gN",
|
|
7
|
+
"hide-icons": "prc-UnderlineNav-hide-icons-FR8HX",
|
|
7
8
|
"MoreButtonContainer": "prc-UnderlineNav-MoreButtonContainer-Dnrq6",
|
|
8
9
|
"OverflowMenuItem": "prc-UnderlineNav-OverflowMenuItem-7SG7M",
|
|
9
10
|
"OverflowMenuItemLabel": "prc-UnderlineNav-OverflowMenuItemLabel-F80v6",
|
|
@@ -2,30 +2,89 @@ import { UnderlineItem } from "../internal/components/UnderlineTabbedInterface.j
|
|
|
2
2
|
import { UnderlineNavContext } from "./UnderlineNavContext.js";
|
|
3
3
|
import { UnderlineNavItemsRegistry } from "./UnderlineNavItemsRegistry.js";
|
|
4
4
|
import UnderlineNavItem_module_css_default from "./UnderlineNavItem.module.css.js";
|
|
5
|
+
import { c } from "react-compiler-runtime";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import
|
|
7
|
+
import { forwardRef, useContext, useRef, useSyncExternalStore } from "react";
|
|
7
8
|
//#region src/UnderlineNav/UnderlineNavItem.tsx
|
|
8
9
|
const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
|
|
9
|
-
|
|
10
|
+
var _leadingVisual;
|
|
11
|
+
const $ = c(32);
|
|
12
|
+
let Icon;
|
|
13
|
+
let ariaCurrent;
|
|
14
|
+
let children;
|
|
15
|
+
let counter;
|
|
16
|
+
let leadingVisual;
|
|
17
|
+
let onSelect;
|
|
18
|
+
let props;
|
|
19
|
+
let t0;
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== allProps) {
|
|
22
|
+
({as: t0, href: t1, children, counter, onSelect, "aria-current": ariaCurrent, icon: Icon, leadingVisual, ...props} = allProps);
|
|
23
|
+
$[0] = allProps;
|
|
24
|
+
$[1] = Icon;
|
|
25
|
+
$[2] = ariaCurrent;
|
|
26
|
+
$[3] = children;
|
|
27
|
+
$[4] = counter;
|
|
28
|
+
$[5] = leadingVisual;
|
|
29
|
+
$[6] = onSelect;
|
|
30
|
+
$[7] = props;
|
|
31
|
+
$[8] = t0;
|
|
32
|
+
$[9] = t1;
|
|
33
|
+
} else {
|
|
34
|
+
Icon = $[1];
|
|
35
|
+
ariaCurrent = $[2];
|
|
36
|
+
children = $[3];
|
|
37
|
+
counter = $[4];
|
|
38
|
+
leadingVisual = $[5];
|
|
39
|
+
onSelect = $[6];
|
|
40
|
+
props = $[7];
|
|
41
|
+
t0 = $[8];
|
|
42
|
+
t1 = $[9];
|
|
43
|
+
}
|
|
44
|
+
const Component = t0 === void 0 ? "a" : t0;
|
|
45
|
+
const href = t1 === void 0 ? "#" : t1;
|
|
10
46
|
const ref = useRef(null);
|
|
11
47
|
const { loadingCounters } = useContext(UnderlineNavContext);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
48
|
+
let t2;
|
|
49
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
50
|
+
t2 = (onChange) => {
|
|
51
|
+
const observer = new IntersectionObserver(() => onChange(), { threshold: 1 });
|
|
52
|
+
if (ref.current) observer.observe(ref.current);
|
|
53
|
+
return () => observer.disconnect();
|
|
54
|
+
};
|
|
55
|
+
$[10] = t2;
|
|
56
|
+
} else t2 = $[10];
|
|
57
|
+
let t3;
|
|
58
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
59
|
+
t3 = () => ref.current ? ref.current.offsetTop > 0 : false;
|
|
60
|
+
$[11] = t3;
|
|
61
|
+
} else t3 = $[11];
|
|
62
|
+
const isOverflowing = useSyncExternalStore(t2, t3, _temp);
|
|
17
63
|
UnderlineNavItemsRegistry.useRegisterDescendant(isOverflowing ? allProps : null);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
64
|
+
let t4;
|
|
65
|
+
if ($[12] !== onSelect) {
|
|
66
|
+
t4 = (event) => {
|
|
67
|
+
if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") onSelect(event);
|
|
68
|
+
};
|
|
69
|
+
$[12] = onSelect;
|
|
70
|
+
$[13] = t4;
|
|
71
|
+
} else t4 = $[13];
|
|
72
|
+
const keyDownHandler = t4;
|
|
73
|
+
let t5;
|
|
74
|
+
if ($[14] !== onSelect) {
|
|
75
|
+
t5 = (event_0) => {
|
|
76
|
+
if (!event_0.defaultPrevented && typeof onSelect === "function") onSelect(event_0);
|
|
77
|
+
};
|
|
78
|
+
$[14] = onSelect;
|
|
79
|
+
$[15] = t5;
|
|
80
|
+
} else t5 = $[15];
|
|
81
|
+
const clickHandler = t5;
|
|
82
|
+
const t6 = isOverflowing ? true : allProps["aria-hidden"];
|
|
83
|
+
const t7 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
|
|
84
|
+
const t8 = isOverflowing ? -1 : allProps.tabIndex;
|
|
85
|
+
let t9;
|
|
86
|
+
if ($[16] !== Component || $[17] !== ariaCurrent || $[18] !== children || $[19] !== clickHandler || $[20] !== counter || $[21] !== forwardedRef || $[22] !== href || $[23] !== keyDownHandler || $[24] !== loadingCounters || $[25] !== props || $[26] !== t7 || $[27] !== t8) {
|
|
87
|
+
t9 = /*#__PURE__*/ jsx(UnderlineItem, {
|
|
29
88
|
ref: forwardedRef,
|
|
30
89
|
as: Component,
|
|
31
90
|
href,
|
|
@@ -33,14 +92,43 @@ const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
|
|
|
33
92
|
onKeyDown: keyDownHandler,
|
|
34
93
|
onClick: clickHandler,
|
|
35
94
|
counter,
|
|
36
|
-
icon:
|
|
95
|
+
icon: t7,
|
|
37
96
|
loadingCounters,
|
|
38
97
|
...props,
|
|
39
|
-
tabIndex:
|
|
98
|
+
tabIndex: t8,
|
|
40
99
|
children
|
|
41
|
-
})
|
|
42
|
-
|
|
100
|
+
});
|
|
101
|
+
$[16] = Component;
|
|
102
|
+
$[17] = ariaCurrent;
|
|
103
|
+
$[18] = children;
|
|
104
|
+
$[19] = clickHandler;
|
|
105
|
+
$[20] = counter;
|
|
106
|
+
$[21] = forwardedRef;
|
|
107
|
+
$[22] = href;
|
|
108
|
+
$[23] = keyDownHandler;
|
|
109
|
+
$[24] = loadingCounters;
|
|
110
|
+
$[25] = props;
|
|
111
|
+
$[26] = t7;
|
|
112
|
+
$[27] = t8;
|
|
113
|
+
$[28] = t9;
|
|
114
|
+
} else t9 = $[28];
|
|
115
|
+
let t10;
|
|
116
|
+
if ($[29] !== t6 || $[30] !== t9) {
|
|
117
|
+
t10 = /*#__PURE__*/ jsx("li", {
|
|
118
|
+
className: UnderlineNavItem_module_css_default.UnderlineNavItem,
|
|
119
|
+
ref,
|
|
120
|
+
"aria-hidden": t6,
|
|
121
|
+
children: t9
|
|
122
|
+
});
|
|
123
|
+
$[29] = t6;
|
|
124
|
+
$[30] = t9;
|
|
125
|
+
$[31] = t10;
|
|
126
|
+
} else t10 = $[31];
|
|
127
|
+
return t10;
|
|
43
128
|
});
|
|
44
129
|
UnderlineNavItem.displayName = "UnderlineNavItem";
|
|
130
|
+
function _temp() {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
45
133
|
//#endregion
|
|
46
134
|
export { UnderlineNavItem };
|
|
@@ -73,7 +73,7 @@ type TabPanelProps = {
|
|
|
73
73
|
value: string;
|
|
74
74
|
};
|
|
75
75
|
type TabListHookProps<T extends HTMLElement> = TabListProps & {
|
|
76
|
-
/** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.
|
|
76
|
+
/** Optional ref to use for the tablist. If none is provided, one will be generated automatically */ref?: React.RefObject<T>;
|
|
77
77
|
};
|
|
78
78
|
type TabListHookResult<T extends HTMLElement> = {
|
|
79
79
|
/** Props to be spread onto the tablist element */tabListProps: {
|
|
@@ -81,7 +81,7 @@ type TabListHookResult<T extends HTMLElement> = {
|
|
|
81
81
|
'aria-orientation': AriaAttributes['aria-orientation'];
|
|
82
82
|
'aria-label': AriaAttributes['aria-label'];
|
|
83
83
|
'aria-labelledby': AriaAttributes['aria-labelledby'];
|
|
84
|
-
ref: React.
|
|
84
|
+
ref: React.RefObject<T | null>;
|
|
85
85
|
role: 'tablist';
|
|
86
86
|
};
|
|
87
87
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { useRef } from "react";
|
|
4
3
|
//#region src/experimental/Tabs/useTabList.ts
|
|
5
4
|
function useTabList(props) {
|
|
6
|
-
const $ = c(
|
|
5
|
+
const $ = c(9);
|
|
7
6
|
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": ariaOrientation } = props;
|
|
8
|
-
const ref =
|
|
9
|
-
const mergedRef = useMergedRefs(ref, props.ref);
|
|
7
|
+
const ref = useProvidedRefOrCreate(props.ref);
|
|
10
8
|
let t0;
|
|
11
|
-
if ($[0] !== ariaOrientation) {
|
|
9
|
+
if ($[0] !== ariaOrientation || $[1] !== ref) {
|
|
12
10
|
t0 = (event) => {
|
|
13
11
|
const { current: tablist } = ref;
|
|
14
12
|
if (tablist === null) return;
|
|
@@ -35,27 +33,28 @@ function useTabList(props) {
|
|
|
35
33
|
}
|
|
36
34
|
};
|
|
37
35
|
$[0] = ariaOrientation;
|
|
38
|
-
$[1] =
|
|
39
|
-
|
|
36
|
+
$[1] = ref;
|
|
37
|
+
$[2] = t0;
|
|
38
|
+
} else t0 = $[2];
|
|
40
39
|
const onKeyDown = t0;
|
|
41
40
|
const t1 = ariaOrientation !== null && ariaOrientation !== void 0 ? ariaOrientation : "horizontal";
|
|
42
41
|
let t2;
|
|
43
|
-
if ($[
|
|
42
|
+
if ($[3] !== ariaLabel || $[4] !== ariaLabelledby || $[5] !== onKeyDown || $[6] !== ref || $[7] !== t1) {
|
|
44
43
|
t2 = { tabListProps: {
|
|
45
|
-
ref
|
|
44
|
+
ref,
|
|
46
45
|
"aria-label": ariaLabel,
|
|
47
46
|
"aria-labelledby": ariaLabelledby,
|
|
48
47
|
"aria-orientation": t1,
|
|
49
48
|
role: "tablist",
|
|
50
49
|
onKeyDown
|
|
51
50
|
} };
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
$[4] = mergedRef;
|
|
51
|
+
$[3] = ariaLabel;
|
|
52
|
+
$[4] = ariaLabelledby;
|
|
55
53
|
$[5] = onKeyDown;
|
|
56
|
-
$[6] =
|
|
57
|
-
$[7] =
|
|
58
|
-
|
|
54
|
+
$[6] = ref;
|
|
55
|
+
$[7] = t1;
|
|
56
|
+
$[8] = t2;
|
|
57
|
+
} else t2 = $[8];
|
|
59
58
|
return t2;
|
|
60
59
|
}
|
|
61
60
|
function _temp2(tab_0) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { isExperimentalReactVersion, reactMajorVersion } from "../utils/environment.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import "react";
|
|
3
4
|
//#region src/hooks/useMergedRefs.ts
|
|
4
|
-
var _version$split$;
|
|
5
|
-
const majorReactVersion = parseInt((_version$split$ = version.split(".")[0]) !== null && _version$split$ !== void 0 ? _version$split$ : "18", 10);
|
|
6
5
|
/**
|
|
7
6
|
* Cleanup functions for refs were introduced in React 19. For feature detection,
|
|
8
7
|
* we look to see if current version of React is >= 19 or if it is an
|
|
@@ -42,18 +41,25 @@ const supportsRefCleanup = reactMajorVersion >= 19 || isExperimentalReactVersion
|
|
|
42
41
|
* }
|
|
43
42
|
*/
|
|
44
43
|
function useMergedRefs(refA, refB) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
const $ = c(3);
|
|
45
|
+
let t0;
|
|
46
|
+
if ($[0] !== refA || $[1] !== refB) {
|
|
47
|
+
t0 = (value) => {
|
|
48
|
+
const cleanupA = setRef(refA, value);
|
|
49
|
+
const cleanupB = setRef(refB, value);
|
|
50
|
+
if (!supportsRefCleanup) return;
|
|
51
|
+
return () => {
|
|
52
|
+
if (cleanupA) cleanupA();
|
|
53
|
+
else setRef(refA, null);
|
|
54
|
+
if (cleanupB) cleanupB();
|
|
55
|
+
else setRef(refB, null);
|
|
56
|
+
};
|
|
55
57
|
};
|
|
56
|
-
|
|
58
|
+
$[0] = refA;
|
|
59
|
+
$[1] = refB;
|
|
60
|
+
$[2] = t0;
|
|
61
|
+
} else t0 = $[2];
|
|
62
|
+
return t0;
|
|
57
63
|
}
|
|
58
64
|
/**
|
|
59
65
|
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
@@ -18,13 +18,7 @@ function useOpenAndCloseFocus(t0) {
|
|
|
18
18
|
}
|
|
19
19
|
const returnFocusRefCurrent = returnFocusRef.current;
|
|
20
20
|
return function() {
|
|
21
|
-
|
|
22
|
-
returnFocusRefCurrent.setAttribute("data-restoring-focus", "true");
|
|
23
|
-
returnFocusRefCurrent.focus();
|
|
24
|
-
queueMicrotask(() => {
|
|
25
|
-
returnFocusRefCurrent.removeAttribute("data-restoring-focus");
|
|
26
|
-
});
|
|
27
|
-
}
|
|
21
|
+
returnFocusRefCurrent === null || returnFocusRefCurrent === void 0 || returnFocusRefCurrent.focus();
|
|
28
22
|
};
|
|
29
23
|
};
|
|
30
24
|
t2 = [
|
|
@@ -9,14 +9,17 @@ import React from "react";
|
|
|
9
9
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
10
10
|
* @type TRef The type of the RefObject which should be created.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
14
|
-
* {@linkcode useMergedRefs} instead.
|
|
12
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
13
|
+
* created ref instead.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* ```diff
|
|
16
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
17
|
+
* + const ref = useRef(null)
|
|
18
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
19
|
+
*
|
|
20
|
+
* - return <div ref={ref} />
|
|
21
|
+
* + return <div ref={mergedRef} />
|
|
22
|
+
* ```
|
|
20
23
|
*/
|
|
21
24
|
declare function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef | null>): React.RefObject<TRef | null>;
|
|
22
25
|
//#endregion
|
|
@@ -8,14 +8,17 @@ import React from "react";
|
|
|
8
8
|
* @param providedRef The ref to use - if undefined, will use the ref from a call to React.useRef
|
|
9
9
|
* @type TRef The type of the RefObject which should be created.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
* {@linkcode useMergedRefs} instead.
|
|
11
|
+
* @deprecated This hook is incompatible with forwarded callback refs. Prefer `useMergedRefs` with an internally
|
|
12
|
+
* created ref instead.
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* ```diff
|
|
15
|
+
* - const ref = useProvidedRefOrCreate(forwardedRef as RefObject<...>)
|
|
16
|
+
* + const ref = useRef(null)
|
|
17
|
+
* + const mergedRef = useMergedRefs(forwardedRef, ref)
|
|
18
|
+
*
|
|
19
|
+
* - return <div ref={ref} />
|
|
20
|
+
* + return <div ref={mergedRef} />
|
|
21
|
+
* ```
|
|
19
22
|
*/
|
|
20
23
|
function useProvidedRefOrCreate(providedRef) {
|
|
21
24
|
const createdRef = React.useRef(null);
|