@primer/react 38.31.0-rc.f96563b64 → 38.31.1-rc.43134a516
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 +8 -0
- package/dist/ActionBar/ActionBar.js +93 -98
- package/dist/Autocomplete/Autocomplete.js +131 -74
- 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/ConfirmationDialog/ConfirmationDialog.js +86 -24
- package/dist/PageLayout/PageLayout.js +1274 -478
- package/dist/Pagination/Pagination.js +196 -70
- package/dist/SelectPanel/SelectPanelMessage.js +72 -29
- package/dist/UnderlineNav/UnderlineNav.js +214 -63
- package/dist/UnderlineNav/UnderlineNavItem.js +94 -22
- package/dist/hooks/useMergedRefs.js +20 -11
- package/dist/hooks/useScrollFlash.js +24 -10
- package/dist/internal/components/OverflowObserverProvider.js +157 -0
- package/dist/internal/hooks/useOverflowObserver.js +57 -0
- package/dist/utils/descendant-registry.js +79 -42
- package/package.json +1 -1
|
@@ -6,91 +6,242 @@ import { ActionList } from "../ActionList/index.js";
|
|
|
6
6
|
import { ActionMenu } from "../ActionMenu/ActionMenu.js";
|
|
7
7
|
import { SkeletonText } from "../SkeletonText/SkeletonText.js";
|
|
8
8
|
import { LoadingCounter, UnderlineItemList, UnderlineWrapper } from "../internal/components/UnderlineTabbedInterface.js";
|
|
9
|
+
import { OverflowObserverProvider } from "../internal/components/OverflowObserverProvider.js";
|
|
9
10
|
import UnderlineNav_module_css_default from "./UnderlineNav.module.css.js";
|
|
10
11
|
import { UnderlineNavContext } from "./UnderlineNavContext.js";
|
|
11
12
|
import { UnderlineNavItemsRegistry } from "./UnderlineNavItemsRegistry.js";
|
|
12
13
|
import { getValidChildren, isCurrent } from "./utils.js";
|
|
14
|
+
import { c } from "react-compiler-runtime";
|
|
13
15
|
import { clsx } from "clsx";
|
|
14
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
import { forwardRef,
|
|
17
|
+
import { forwardRef, useRef, useState } from "react";
|
|
16
18
|
//#region src/UnderlineNav/UnderlineNav.tsx
|
|
17
|
-
const UnderlineNav = /*#__PURE__*/ forwardRef((
|
|
18
|
-
|
|
19
|
+
const UnderlineNav = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
20
|
+
const $ = c(52);
|
|
21
|
+
const { as: t1, "aria-label": ariaLabel, loadingCounters: t2, variant: t3, className, children } = t0;
|
|
22
|
+
const as = t1 === void 0 ? "nav" : t1;
|
|
23
|
+
const loadingCounters = t2 === void 0 ? false : t2;
|
|
24
|
+
const variant = t3 === void 0 ? "inset" : t3;
|
|
19
25
|
const backupRef = useRef(null);
|
|
20
26
|
const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
21
27
|
const listRef = useRef(null);
|
|
22
|
-
/** Tracks whether any item has ever overflowed for the lifecycle of this component. Used to prevent flickering. */
|
|
23
28
|
const [hasEverOverflowed, setHasOverflowed] = useState(false);
|
|
24
29
|
const [registeredItems, setRegisteredItems] = UnderlineNavItemsRegistry.useRegistryState();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
let isOverflowing;
|
|
31
|
+
let overflowMenuItems;
|
|
32
|
+
let t4;
|
|
33
|
+
if ($[0] !== hasEverOverflowed || $[1] !== registeredItems) {
|
|
34
|
+
var _registeredItems$entr;
|
|
35
|
+
overflowMenuItems = Array.from((_registeredItems$entr = registeredItems === null || registeredItems === void 0 ? void 0 : registeredItems.entries()) !== null && _registeredItems$entr !== void 0 ? _registeredItems$entr : []).filter(_temp);
|
|
36
|
+
isOverflowing = overflowMenuItems.length > 0;
|
|
37
|
+
if (isOverflowing && !hasEverOverflowed) setHasOverflowed(true);
|
|
38
|
+
t4 = overflowMenuItems.some(_temp2);
|
|
39
|
+
$[0] = hasEverOverflowed;
|
|
40
|
+
$[1] = registeredItems;
|
|
41
|
+
$[2] = isOverflowing;
|
|
42
|
+
$[3] = overflowMenuItems;
|
|
43
|
+
$[4] = t4;
|
|
44
|
+
} else {
|
|
45
|
+
isOverflowing = $[2];
|
|
46
|
+
overflowMenuItems = $[3];
|
|
47
|
+
t4 = $[4];
|
|
48
|
+
}
|
|
49
|
+
const overflowingCurrentItem = t4;
|
|
50
|
+
let t5;
|
|
51
|
+
if ($[5] !== children) {
|
|
52
|
+
t5 = getValidChildren(children);
|
|
53
|
+
$[5] = children;
|
|
54
|
+
$[6] = t5;
|
|
55
|
+
} else t5 = $[6];
|
|
56
|
+
const validChildren = t5;
|
|
57
|
+
let t6;
|
|
58
|
+
let t7;
|
|
59
|
+
if ($[7] !== ariaLabel || $[8] !== validChildren) {
|
|
60
|
+
t6 = () => {
|
|
61
|
+
!(validChildren.filter(_temp3).length <= 1) && invariant(false, "Only one current element is allowed");
|
|
62
|
+
!ariaLabel && invariant(false, "Use the `aria-label` prop to provide an accessible label for assistive technology");
|
|
63
|
+
};
|
|
64
|
+
t7 = [validChildren, ariaLabel];
|
|
65
|
+
$[7] = ariaLabel;
|
|
66
|
+
$[8] = validChildren;
|
|
67
|
+
$[9] = t6;
|
|
68
|
+
$[10] = t7;
|
|
69
|
+
} else {
|
|
70
|
+
t6 = $[9];
|
|
71
|
+
t7 = $[10];
|
|
72
|
+
}
|
|
73
|
+
useDevOnlyEffect(t6, t7);
|
|
74
|
+
let t8;
|
|
75
|
+
if ($[11] !== loadingCounters) {
|
|
76
|
+
t8 = { loadingCounters };
|
|
77
|
+
$[11] = loadingCounters;
|
|
78
|
+
$[12] = t8;
|
|
79
|
+
} else t8 = $[12];
|
|
80
|
+
const contextValue = t8;
|
|
35
81
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
36
82
|
if (menuOpen && !isOverflowing) setMenuOpen(false);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
83
|
+
let t9;
|
|
84
|
+
if ($[13] !== ariaLabel) {
|
|
85
|
+
t9 = ariaLabel && /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
40
86
|
as: "h2",
|
|
41
87
|
children: `${ariaLabel} navigation`
|
|
42
|
-
})
|
|
88
|
+
});
|
|
89
|
+
$[13] = ariaLabel;
|
|
90
|
+
$[14] = t9;
|
|
91
|
+
} else t9 = $[14];
|
|
92
|
+
let t10;
|
|
93
|
+
if ($[15] !== className) {
|
|
94
|
+
t10 = clsx(UnderlineNav_module_css_default.UnderlineWrapper, className);
|
|
95
|
+
$[15] = className;
|
|
96
|
+
$[16] = t10;
|
|
97
|
+
} else t10 = $[16];
|
|
98
|
+
const t11 = hasEverOverflowed ? "true" : void 0;
|
|
99
|
+
const t12 = isOverflowing ? "true" : void 0;
|
|
100
|
+
let t13;
|
|
101
|
+
if ($[17] !== children || $[18] !== setRegisteredItems) {
|
|
102
|
+
t13 = /*#__PURE__*/ jsx(UnderlineNavItemsRegistry.Provider, {
|
|
103
|
+
setRegistry: setRegisteredItems,
|
|
104
|
+
children
|
|
105
|
+
});
|
|
106
|
+
$[17] = children;
|
|
107
|
+
$[18] = setRegisteredItems;
|
|
108
|
+
$[19] = t13;
|
|
109
|
+
} else t13 = $[19];
|
|
110
|
+
let t14;
|
|
111
|
+
if ($[20] !== navRef || $[21] !== t13) {
|
|
112
|
+
t14 = /*#__PURE__*/ jsx(UnderlineItemList, {
|
|
113
|
+
ref: listRef,
|
|
114
|
+
role: "list",
|
|
115
|
+
className: UnderlineNav_module_css_default.ItemsList,
|
|
116
|
+
children: /*#__PURE__*/ jsx(OverflowObserverProvider, {
|
|
117
|
+
rootRef: navRef,
|
|
118
|
+
children: t13
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
$[20] = navRef;
|
|
122
|
+
$[21] = t13;
|
|
123
|
+
$[22] = t14;
|
|
124
|
+
} else t14 = $[22];
|
|
125
|
+
let t15;
|
|
126
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
127
|
+
t15 = /*#__PURE__*/ jsx("div", { className: UnderlineNav_module_css_default.MoreButtonDivider });
|
|
128
|
+
$[23] = t15;
|
|
129
|
+
} else t15 = $[23];
|
|
130
|
+
const t16 = overflowingCurrentItem ? "true" : void 0;
|
|
131
|
+
const t17 = overflowingCurrentItem ? "More items, including current item" : void 0;
|
|
132
|
+
let t18;
|
|
133
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
134
|
+
t18 = /*#__PURE__*/ jsxs("span", { children: ["More", /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
135
|
+
as: "span",
|
|
136
|
+
children: " items"
|
|
137
|
+
})] });
|
|
138
|
+
$[24] = t18;
|
|
139
|
+
} else t18 = $[24];
|
|
140
|
+
let t19;
|
|
141
|
+
if ($[25] !== t16 || $[26] !== t17) {
|
|
142
|
+
t19 = /*#__PURE__*/ jsx(ActionMenu.Button, {
|
|
143
|
+
className: UnderlineNav_module_css_default.MoreButton,
|
|
144
|
+
variant: "invisible",
|
|
145
|
+
"data-component": "overflow-menu-button",
|
|
146
|
+
"data-current": t16,
|
|
147
|
+
"aria-label": t17,
|
|
148
|
+
children: t18
|
|
149
|
+
});
|
|
150
|
+
$[25] = t16;
|
|
151
|
+
$[26] = t17;
|
|
152
|
+
$[27] = t19;
|
|
153
|
+
} else t19 = $[27];
|
|
154
|
+
let t20;
|
|
155
|
+
if ($[28] !== loadingCounters || $[29] !== overflowMenuItems || $[30] !== registeredItems) {
|
|
156
|
+
t20 = registeredItems === void 0 ? /*#__PURE__*/ jsx(ActionList.Item, { children: /*#__PURE__*/ jsx(SkeletonText, {}) }) : overflowMenuItems.map((t21) => {
|
|
157
|
+
const [key, allProps] = t21;
|
|
158
|
+
const { children: menuItemChildren, counter, onSelect, ...menuItemProps } = allProps;
|
|
159
|
+
return /*#__PURE__*/ jsxs(ActionList.LinkItem, {
|
|
160
|
+
onClick: (event) => onSelect === null || onSelect === void 0 ? void 0 : onSelect(event),
|
|
161
|
+
...menuItemProps,
|
|
162
|
+
className: UnderlineNav_module_css_default.OverflowMenuItem,
|
|
163
|
+
children: [/*#__PURE__*/ jsx("span", {
|
|
164
|
+
className: UnderlineNav_module_css_default.OverflowMenuItemLabel,
|
|
165
|
+
children: menuItemChildren
|
|
166
|
+
}), loadingCounters ? /*#__PURE__*/ jsx(ActionList.TrailingVisual, { children: /*#__PURE__*/ jsx(LoadingCounter, {}) }) : counter !== void 0 && /*#__PURE__*/ jsx(ActionList.TrailingVisual, { children: /*#__PURE__*/ jsx("span", {
|
|
167
|
+
"data-component": "counter",
|
|
168
|
+
children: /*#__PURE__*/ jsx(CounterLabel, { children: counter })
|
|
169
|
+
}) })]
|
|
170
|
+
}, key);
|
|
171
|
+
});
|
|
172
|
+
$[28] = loadingCounters;
|
|
173
|
+
$[29] = overflowMenuItems;
|
|
174
|
+
$[30] = registeredItems;
|
|
175
|
+
$[31] = t20;
|
|
176
|
+
} else t20 = $[31];
|
|
177
|
+
let t21;
|
|
178
|
+
if ($[32] !== t20) {
|
|
179
|
+
t21 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t20 }) });
|
|
180
|
+
$[32] = t20;
|
|
181
|
+
$[33] = t21;
|
|
182
|
+
} else t21 = $[33];
|
|
183
|
+
let t22;
|
|
184
|
+
if ($[34] !== menuOpen || $[35] !== t19 || $[36] !== t21) {
|
|
185
|
+
t22 = /*#__PURE__*/ jsxs("div", {
|
|
186
|
+
className: UnderlineNav_module_css_default.MoreButtonContainer,
|
|
187
|
+
children: [t15, /*#__PURE__*/ jsxs(ActionMenu, {
|
|
188
|
+
open: menuOpen,
|
|
189
|
+
onOpenChange: setMenuOpen,
|
|
190
|
+
children: [t19, t21]
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
193
|
+
$[34] = menuOpen;
|
|
194
|
+
$[35] = t19;
|
|
195
|
+
$[36] = t21;
|
|
196
|
+
$[37] = t22;
|
|
197
|
+
} else t22 = $[37];
|
|
198
|
+
let t23;
|
|
199
|
+
if ($[38] !== ariaLabel || $[39] !== as || $[40] !== navRef || $[41] !== t10 || $[42] !== t11 || $[43] !== t12 || $[44] !== t14 || $[45] !== t22 || $[46] !== variant) {
|
|
200
|
+
t23 = /*#__PURE__*/ jsxs(UnderlineWrapper, {
|
|
43
201
|
as,
|
|
44
202
|
"aria-label": ariaLabel,
|
|
45
|
-
className:
|
|
203
|
+
className: t10,
|
|
46
204
|
ref: navRef,
|
|
47
205
|
"data-variant": variant,
|
|
48
206
|
"data-overflow-mode": "wrap",
|
|
49
|
-
"data-hide-icons":
|
|
50
|
-
"data-has-overflow":
|
|
51
|
-
children: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
});
|
|
207
|
+
"data-hide-icons": t11,
|
|
208
|
+
"data-has-overflow": t12,
|
|
209
|
+
children: [t14, t22]
|
|
210
|
+
});
|
|
211
|
+
$[38] = ariaLabel;
|
|
212
|
+
$[39] = as;
|
|
213
|
+
$[40] = navRef;
|
|
214
|
+
$[41] = t10;
|
|
215
|
+
$[42] = t11;
|
|
216
|
+
$[43] = t12;
|
|
217
|
+
$[44] = t14;
|
|
218
|
+
$[45] = t22;
|
|
219
|
+
$[46] = variant;
|
|
220
|
+
$[47] = t23;
|
|
221
|
+
} else t23 = $[47];
|
|
222
|
+
let t24;
|
|
223
|
+
if ($[48] !== contextValue || $[49] !== t23 || $[50] !== t9) {
|
|
224
|
+
t24 = /*#__PURE__*/ jsxs(UnderlineNavContext.Provider, {
|
|
225
|
+
value: contextValue,
|
|
226
|
+
children: [t9, t23]
|
|
227
|
+
});
|
|
228
|
+
$[48] = contextValue;
|
|
229
|
+
$[49] = t23;
|
|
230
|
+
$[50] = t9;
|
|
231
|
+
$[51] = t24;
|
|
232
|
+
} else t24 = $[51];
|
|
233
|
+
return t24;
|
|
93
234
|
});
|
|
94
235
|
UnderlineNav.displayName = "UnderlineNav";
|
|
236
|
+
function _temp(entry) {
|
|
237
|
+
return entry[1] !== null;
|
|
238
|
+
}
|
|
239
|
+
function _temp2(t0) {
|
|
240
|
+
const [, itemProps] = t0;
|
|
241
|
+
return isCurrent(itemProps);
|
|
242
|
+
}
|
|
243
|
+
function _temp3(child) {
|
|
244
|
+
return isCurrent(child.props);
|
|
245
|
+
}
|
|
95
246
|
//#endregion
|
|
96
247
|
export { UnderlineNav };
|
|
@@ -1,31 +1,77 @@
|
|
|
1
1
|
import { UnderlineItem } from "../internal/components/UnderlineTabbedInterface.js";
|
|
2
|
+
import { useIsClipped } from "../internal/hooks/useOverflowObserver.js";
|
|
2
3
|
import { UnderlineNavContext } from "./UnderlineNavContext.js";
|
|
3
4
|
import { UnderlineNavItemsRegistry } from "./UnderlineNavItemsRegistry.js";
|
|
4
5
|
import UnderlineNavItem_module_css_default from "./UnderlineNavItem.module.css.js";
|
|
6
|
+
import { c } from "react-compiler-runtime";
|
|
5
7
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import
|
|
8
|
+
import { forwardRef, useContext, useRef } from "react";
|
|
7
9
|
//#region src/UnderlineNav/UnderlineNavItem.tsx
|
|
8
10
|
const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
|
|
9
|
-
|
|
11
|
+
var _leadingVisual;
|
|
12
|
+
const $ = c(30);
|
|
13
|
+
let Icon;
|
|
14
|
+
let ariaCurrent;
|
|
15
|
+
let children;
|
|
16
|
+
let counter;
|
|
17
|
+
let leadingVisual;
|
|
18
|
+
let onSelect;
|
|
19
|
+
let props;
|
|
20
|
+
let t0;
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== allProps) {
|
|
23
|
+
({as: t0, href: t1, children, counter, onSelect, "aria-current": ariaCurrent, icon: Icon, leadingVisual, ...props} = allProps);
|
|
24
|
+
$[0] = allProps;
|
|
25
|
+
$[1] = Icon;
|
|
26
|
+
$[2] = ariaCurrent;
|
|
27
|
+
$[3] = children;
|
|
28
|
+
$[4] = counter;
|
|
29
|
+
$[5] = leadingVisual;
|
|
30
|
+
$[6] = onSelect;
|
|
31
|
+
$[7] = props;
|
|
32
|
+
$[8] = t0;
|
|
33
|
+
$[9] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
Icon = $[1];
|
|
36
|
+
ariaCurrent = $[2];
|
|
37
|
+
children = $[3];
|
|
38
|
+
counter = $[4];
|
|
39
|
+
leadingVisual = $[5];
|
|
40
|
+
onSelect = $[6];
|
|
41
|
+
props = $[7];
|
|
42
|
+
t0 = $[8];
|
|
43
|
+
t1 = $[9];
|
|
44
|
+
}
|
|
45
|
+
const Component = t0 === void 0 ? "a" : t0;
|
|
46
|
+
const href = t1 === void 0 ? "#" : t1;
|
|
10
47
|
const ref = useRef(null);
|
|
11
48
|
const { loadingCounters } = useContext(UnderlineNavContext);
|
|
12
|
-
const isOverflowing =
|
|
13
|
-
const observer = new IntersectionObserver(() => onChange(), { threshold: 1 });
|
|
14
|
-
if (ref.current) observer.observe(ref.current);
|
|
15
|
-
return () => observer.disconnect();
|
|
16
|
-
}, [ref]), () => ref.current ? ref.current.offsetTop > 0 : false, () => false);
|
|
49
|
+
const isOverflowing = useIsClipped(ref);
|
|
17
50
|
UnderlineNavItemsRegistry.useRegisterDescendant(isOverflowing ? allProps : null);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
let t2;
|
|
52
|
+
if ($[10] !== onSelect) {
|
|
53
|
+
t2 = (event) => {
|
|
54
|
+
if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") onSelect(event);
|
|
55
|
+
};
|
|
56
|
+
$[10] = onSelect;
|
|
57
|
+
$[11] = t2;
|
|
58
|
+
} else t2 = $[11];
|
|
59
|
+
const keyDownHandler = t2;
|
|
60
|
+
let t3;
|
|
61
|
+
if ($[12] !== onSelect) {
|
|
62
|
+
t3 = (event_0) => {
|
|
63
|
+
if (!event_0.defaultPrevented && typeof onSelect === "function") onSelect(event_0);
|
|
64
|
+
};
|
|
65
|
+
$[12] = onSelect;
|
|
66
|
+
$[13] = t3;
|
|
67
|
+
} else t3 = $[13];
|
|
68
|
+
const clickHandler = t3;
|
|
69
|
+
const t4 = isOverflowing ? true : allProps["aria-hidden"];
|
|
70
|
+
const t5 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
|
|
71
|
+
const t6 = isOverflowing ? -1 : allProps.tabIndex;
|
|
72
|
+
let t7;
|
|
73
|
+
if ($[14] !== Component || $[15] !== ariaCurrent || $[16] !== children || $[17] !== clickHandler || $[18] !== counter || $[19] !== forwardedRef || $[20] !== href || $[21] !== keyDownHandler || $[22] !== loadingCounters || $[23] !== props || $[24] !== t5 || $[25] !== t6) {
|
|
74
|
+
t7 = /*#__PURE__*/ jsx(UnderlineItem, {
|
|
29
75
|
ref: forwardedRef,
|
|
30
76
|
as: Component,
|
|
31
77
|
href,
|
|
@@ -33,13 +79,39 @@ const UnderlineNavItem = /*#__PURE__*/ forwardRef((allProps, forwardedRef) => {
|
|
|
33
79
|
onKeyDown: keyDownHandler,
|
|
34
80
|
onClick: clickHandler,
|
|
35
81
|
counter,
|
|
36
|
-
icon:
|
|
82
|
+
icon: t5,
|
|
37
83
|
loadingCounters,
|
|
38
84
|
...props,
|
|
39
|
-
tabIndex:
|
|
85
|
+
tabIndex: t6,
|
|
40
86
|
children
|
|
41
|
-
})
|
|
42
|
-
|
|
87
|
+
});
|
|
88
|
+
$[14] = Component;
|
|
89
|
+
$[15] = ariaCurrent;
|
|
90
|
+
$[16] = children;
|
|
91
|
+
$[17] = clickHandler;
|
|
92
|
+
$[18] = counter;
|
|
93
|
+
$[19] = forwardedRef;
|
|
94
|
+
$[20] = href;
|
|
95
|
+
$[21] = keyDownHandler;
|
|
96
|
+
$[22] = loadingCounters;
|
|
97
|
+
$[23] = props;
|
|
98
|
+
$[24] = t5;
|
|
99
|
+
$[25] = t6;
|
|
100
|
+
$[26] = t7;
|
|
101
|
+
} else t7 = $[26];
|
|
102
|
+
let t8;
|
|
103
|
+
if ($[27] !== t4 || $[28] !== t7) {
|
|
104
|
+
t8 = /*#__PURE__*/ jsx("li", {
|
|
105
|
+
className: UnderlineNavItem_module_css_default.UnderlineNavItem,
|
|
106
|
+
ref,
|
|
107
|
+
"aria-hidden": t4,
|
|
108
|
+
children: t7
|
|
109
|
+
});
|
|
110
|
+
$[27] = t4;
|
|
111
|
+
$[28] = t7;
|
|
112
|
+
$[29] = t8;
|
|
113
|
+
} else t8 = $[29];
|
|
114
|
+
return t8;
|
|
43
115
|
});
|
|
44
116
|
UnderlineNavItem.displayName = "UnderlineNavItem";
|
|
45
117
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
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
5
|
/**
|
|
5
6
|
* Cleanup functions for refs were introduced in React 19. For feature detection,
|
|
@@ -40,17 +41,25 @@ const supportsRefCleanup = reactMajorVersion >= 19 || isExperimentalReactVersion
|
|
|
40
41
|
* }
|
|
41
42
|
*/
|
|
42
43
|
function useMergedRefs(refA, refB) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
+
};
|
|
52
57
|
};
|
|
53
|
-
|
|
58
|
+
$[0] = refA;
|
|
59
|
+
$[1] = refB;
|
|
60
|
+
$[2] = t0;
|
|
61
|
+
} else t0 = $[2];
|
|
62
|
+
return t0;
|
|
54
63
|
}
|
|
55
64
|
/**
|
|
56
65
|
* React 19 supports callback refs that can return a cleanup function. If a cleanup function is returned, the
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from "react-compiler-runtime";
|
|
1
2
|
import { useEffect } from "react";
|
|
2
3
|
//#region src/hooks/useScrollFlash.ts
|
|
3
4
|
/**
|
|
@@ -5,16 +6,29 @@ import { useEffect } from "react";
|
|
|
5
6
|
* @param scrollContainerRef The ref of the scrollable content
|
|
6
7
|
*/
|
|
7
8
|
function useScrollFlash(scrollContainerRef) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
scrollContainer
|
|
14
|
-
scrollContainer
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const $ = c(3);
|
|
10
|
+
let t0;
|
|
11
|
+
let t1;
|
|
12
|
+
if ($[0] !== scrollContainerRef) {
|
|
13
|
+
t0 = () => {
|
|
14
|
+
const scrollContainer = scrollContainerRef.current;
|
|
15
|
+
if (!scrollContainer) return;
|
|
16
|
+
const id = requestAnimationFrame(() => {
|
|
17
|
+
const currentScroll = scrollContainer.scrollTop;
|
|
18
|
+
scrollContainer.scrollTop = currentScroll < 1 ? currentScroll + 1 : currentScroll - 1;
|
|
19
|
+
scrollContainer.scrollTop = currentScroll;
|
|
20
|
+
});
|
|
21
|
+
return () => cancelAnimationFrame(id);
|
|
22
|
+
};
|
|
23
|
+
t1 = [scrollContainerRef];
|
|
24
|
+
$[0] = scrollContainerRef;
|
|
25
|
+
$[1] = t0;
|
|
26
|
+
$[2] = t1;
|
|
27
|
+
} else {
|
|
28
|
+
t0 = $[1];
|
|
29
|
+
t1 = $[2];
|
|
30
|
+
}
|
|
31
|
+
useEffect(t0, t1);
|
|
18
32
|
}
|
|
19
33
|
//#endregion
|
|
20
34
|
export { useScrollFlash as default };
|