@primer/react 0.0.0-20260218211705 → 0.0.0-20260218212716
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 +1 -1
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +324 -82
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -4
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +3 -2
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +85 -94
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/styles.d.ts +16 -0
- package/dist/UnderlineNav/styles.d.ts.map +1 -0
- package/dist/UnderlineNav/styles.js +19 -0
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +48 -41
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/generated/components.json +2 -2
- package/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-e56ca858.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-e56ca858.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-b6e35b9d.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-b6e35b9d.css.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-UnderlineNav-MenuItemContent-3J7gB{align-items:center;display:flex;justify-content:space-between}.prc-UnderlineNav-MoreButton-Y8soj{background:transparent;border:0;box-shadow:none;font-weight:var(--base-text-weight-normal,400);margin:0;padding:var(--base-size-4,.25rem) var(--base-size-8,.5rem)}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}
|
|
2
|
+
/*# sourceMappingURL=UnderlineNav-4344d9b0.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,wCAEE,kBAAmB,CADnB,YAAa,CAEb,6BACF,CAGA,mCAGE,sBAAuB,CADvB,QAAS,CAGT,eAAgB,CADhB,8CAA2C,CAH3C,QAAS,CAQT,0DAKF,CAHE,mEACE,aACF","file":"UnderlineNav-4344d9b0.css","sourcesContent":[".MenuItemContent {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n/* More button styles migrated from styles.ts (was moreBtnStyles) */\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n border: 0;\n background: transparent;\n font-weight: var(--base-text-weight-normal);\n box-shadow: none;\n padding-top: var(--base-size-4);\n padding-bottom: var(--base-size-4);\n padding-left: var(--base-size-8);\n padding-right: var(--base-size-8);\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAmBjF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;AAwEhC,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA;AAgCD,eAAO,MAAM,YAAY,mFA8SxB,CAAA"}
|
|
@@ -1,20 +1,119 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useState,
|
|
1
|
+
import React, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
|
+
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
2
4
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
5
|
+
import { dividerStyles, baseMenuMinWidth, menuItemStyles } from './styles.js';
|
|
6
|
+
import { UnderlineWrapper, UnderlineItemList, LoadingCounter, GAP } from '../internal/components/UnderlineTabbedInterface.js';
|
|
7
|
+
import { TriangleDownIcon } from '@primer/octicons-react';
|
|
8
|
+
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
9
|
+
import { useOnOutsideClick } from '../hooks/useOnOutsideClick.js';
|
|
10
|
+
import { useId } from '../hooks/useId.js';
|
|
3
11
|
import { ActionList } from '../ActionList/index.js';
|
|
4
|
-
import { UnderlineWrapper, UnderlineItemList, LoadingCounter } from '../internal/components/UnderlineTabbedInterface.js';
|
|
5
12
|
import { invariant } from '../utils/invariant.js';
|
|
6
13
|
import classes from './UnderlineNav.module.css.js';
|
|
7
|
-
import {
|
|
8
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
|
+
import { getAnchoredPosition } from '@primer/behaviors';
|
|
15
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
16
|
+
import { ButtonComponent } from '../Button/Button.js';
|
|
9
17
|
import CounterLabel from '../CounterLabel/CounterLabel.js';
|
|
10
|
-
import { ActionMenu } from '../ActionMenu/ActionMenu.js';
|
|
11
18
|
|
|
19
|
+
// When page is loaded, we don't have ref for the more button as it is not on the DOM yet.
|
|
20
|
+
// However, we need to calculate number of possible items when the more button present as well. So using the width of the more button as a constant.
|
|
21
|
+
const MORE_BTN_WIDTH = 86;
|
|
12
22
|
// The height is needed to make sure we don't have a layout shift when the more button is the only item in the nav.
|
|
13
|
-
const MORE_BTN_HEIGHT =
|
|
23
|
+
const MORE_BTN_HEIGHT = 45;
|
|
24
|
+
const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, noIconChildWidthArray, updateListAndMenu) => {
|
|
25
|
+
let iconsVisible = true;
|
|
26
|
+
if (childWidthArray.length === 0) {
|
|
27
|
+
updateListAndMenu({
|
|
28
|
+
items: childArray,
|
|
29
|
+
menuItems: []
|
|
30
|
+
}, iconsVisible, false);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const numberOfItemsPossible = calculatePossibleItems(childWidthArray, navWidth);
|
|
34
|
+
const numberOfItemsWithoutIconPossible = calculatePossibleItems(noIconChildWidthArray, navWidth);
|
|
35
|
+
// We need to take more menu width into account when calculating the number of items possible
|
|
36
|
+
const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(noIconChildWidthArray, navWidth, moreMenuWidth || MORE_BTN_WIDTH);
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
const items = [];
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
const menuItems = [];
|
|
41
|
+
|
|
42
|
+
// First, we check if we can fit all the items with their icons
|
|
43
|
+
if (childArray.length <= numberOfItemsPossible) {
|
|
44
|
+
items.push(...childArray);
|
|
45
|
+
} else if (childArray.length <= numberOfItemsWithoutIconPossible) {
|
|
46
|
+
// if we can't fit all the items with their icons, we check if we can fit all the items without their icons
|
|
47
|
+
iconsVisible = false;
|
|
48
|
+
items.push(...childArray);
|
|
49
|
+
} else {
|
|
50
|
+
// if we can't fit all the items without their icons, we keep the icons hidden and show the ones that doesn't fit into the list in the overflow menu
|
|
51
|
+
iconsVisible = false;
|
|
52
|
+
|
|
53
|
+
/* Below is an accessibility requirement. Never show only one item in the overflow menu.
|
|
54
|
+
* If there is only one item left to display in the overflow menu according to the calculation,
|
|
55
|
+
* we need to pull another item from the list into the overflow menu.
|
|
56
|
+
*/
|
|
57
|
+
const numberOfItemsInMenu = childArray.length - numberOfItemsPossibleWithMoreMenu;
|
|
58
|
+
const numberOfListItems = numberOfItemsInMenu === 1 ? numberOfItemsPossibleWithMoreMenu - 1 : numberOfItemsPossibleWithMoreMenu;
|
|
59
|
+
for (const [index, child] of childArray.entries()) {
|
|
60
|
+
if (index < numberOfListItems) {
|
|
61
|
+
items.push(child);
|
|
62
|
+
} else {
|
|
63
|
+
const ariaCurrent = child.props['aria-current'];
|
|
64
|
+
const isCurrent = Boolean(ariaCurrent) && ariaCurrent !== 'false';
|
|
65
|
+
// We need to make sure to keep the selected item always visible.
|
|
66
|
+
// To do that, we swap the selected item with the last item in the list to make it visible. (When there is at least 1 item in the list to swap.)
|
|
67
|
+
if (isCurrent && numberOfListItems > 0) {
|
|
68
|
+
// If selected item couldn't make in to the list, we swap it with the last item in the list.
|
|
69
|
+
const indexToReplaceAt = numberOfListItems - 1; // because we are replacing the last item in the list
|
|
70
|
+
// splice method modifies the array by removing 1 item here at the given index and replace it with the "child" element then returns the removed item.
|
|
71
|
+
const propsectiveAction = items.splice(indexToReplaceAt, 1, child)[0];
|
|
72
|
+
menuItems.push(propsectiveAction);
|
|
73
|
+
} else {
|
|
74
|
+
menuItems.push(child);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
updateListAndMenu({
|
|
80
|
+
items,
|
|
81
|
+
menuItems
|
|
82
|
+
}, iconsVisible, true);
|
|
83
|
+
};
|
|
14
84
|
const getValidChildren = children => {
|
|
15
85
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
86
|
return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
17
87
|
};
|
|
88
|
+
const calculatePossibleItems = (childWidthArray, navWidth, moreMenuWidth = 0) => {
|
|
89
|
+
const widthToFit = navWidth - moreMenuWidth;
|
|
90
|
+
let breakpoint = childWidthArray.length; // assume all items will fit
|
|
91
|
+
let sumsOfChildWidth = 0;
|
|
92
|
+
for (const [index, childWidth] of childWidthArray.entries()) {
|
|
93
|
+
sumsOfChildWidth = sumsOfChildWidth + childWidth.width + GAP;
|
|
94
|
+
if (sumsOfChildWidth > widthToFit) {
|
|
95
|
+
breakpoint = index;
|
|
96
|
+
break;
|
|
97
|
+
} else {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return breakpoint;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Inline styles converted from baseMenuStyles for use as CSSProperties
|
|
105
|
+
const baseMenuInlineStyles = {
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
zIndex: 1,
|
|
108
|
+
top: '90%',
|
|
109
|
+
boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)',
|
|
110
|
+
borderRadius: 12,
|
|
111
|
+
background: 'var(--overlay-bgColor)',
|
|
112
|
+
listStyle: 'none',
|
|
113
|
+
minWidth: `${baseMenuMinWidth}px`,
|
|
114
|
+
maxWidth: '640px',
|
|
115
|
+
right: 0
|
|
116
|
+
};
|
|
18
117
|
const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
19
118
|
as = 'nav',
|
|
20
119
|
'aria-label': ariaLabel,
|
|
@@ -23,31 +122,41 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
23
122
|
className,
|
|
24
123
|
children
|
|
25
124
|
}, forwardedRef) => {
|
|
125
|
+
var _listRef$current2;
|
|
26
126
|
const backupRef = useRef(null);
|
|
27
127
|
const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
28
128
|
const listRef = useRef(null);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return copy;
|
|
40
|
-
});
|
|
41
|
-
}, []);
|
|
42
|
-
const unregisterItem = useCallback(id => {
|
|
43
|
-
setRegisteredItems(prev => {
|
|
44
|
-
if (!prev.has(id)) return prev;
|
|
45
|
-
const copy = new Map(prev);
|
|
46
|
-
copy.delete(id);
|
|
47
|
-
return copy;
|
|
48
|
-
});
|
|
49
|
-
}, []);
|
|
129
|
+
const moreMenuRef = useRef(null);
|
|
130
|
+
const moreMenuBtnRef = useRef(null);
|
|
131
|
+
const containerRef = React.useRef(null);
|
|
132
|
+
const disclosureWidgetId = useId();
|
|
133
|
+
const [isWidgetOpen, setIsWidgetOpen] = useState(false);
|
|
134
|
+
const [iconsVisible, setIconsVisible] = useState(true);
|
|
135
|
+
const [childWidthArray, setChildWidthArray] = useState([]);
|
|
136
|
+
const [noIconChildWidthArray, setNoIconChildWidthArray] = useState([]);
|
|
137
|
+
// Track whether the initial overflow calculation is complete to prevent CLS
|
|
138
|
+
const [isOverflowMeasured, setIsOverflowMeasured] = useState(false);
|
|
50
139
|
const validChildren = getValidChildren(children);
|
|
140
|
+
|
|
141
|
+
// Responsive props object manages which items are in the list and which items are in the menu.
|
|
142
|
+
const [responsiveProps, setResponsiveProps] = useState({
|
|
143
|
+
items: validChildren,
|
|
144
|
+
menuItems: []
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Make sure to have the fresh props data for list items when children are changed (keeping aria-current up-to-date)
|
|
148
|
+
const listItems = responsiveProps.items.map(item => {
|
|
149
|
+
var _validChildren$find;
|
|
150
|
+
return (_validChildren$find = validChildren.find(child => child.key === item.key)) !== null && _validChildren$find !== void 0 ? _validChildren$find : item;
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Make sure to have the fresh props data for menu items when children are changed (keeping aria-current up-to-date)
|
|
154
|
+
const menuItems = responsiveProps.menuItems.map(menuItem => {
|
|
155
|
+
var _validChildren$find2;
|
|
156
|
+
return (_validChildren$find2 = validChildren.find(child => child.key === menuItem.key)) !== null && _validChildren$find2 !== void 0 ? _validChildren$find2 : menuItem;
|
|
157
|
+
});
|
|
158
|
+
// This is the case where the viewport is too narrow to show any list item with the more menu. In this case, we only show the dropdown
|
|
159
|
+
const onlyMenuVisible = responsiveProps.items.length === 0;
|
|
51
160
|
if (process.env.NODE_ENV !== "production") {
|
|
52
161
|
// Practically, this is not a conditional hook, it is just making sure this hook runs only on DEV not PROD.
|
|
53
162
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -60,83 +169,216 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
60
169
|
!ariaLabel ? process.env.NODE_ENV !== "production" ? invariant(false, 'Use the `aria-label` prop to provide an accessible label for assistive technology') : invariant(false) : void 0;
|
|
61
170
|
});
|
|
62
171
|
}
|
|
63
|
-
|
|
172
|
+
function getItemsWidth(itemText) {
|
|
173
|
+
var _noIconChildWidthArra, _noIconChildWidthArra2;
|
|
174
|
+
return (_noIconChildWidthArra = (_noIconChildWidthArra2 = noIconChildWidthArray.find(item => item.text === itemText)) === null || _noIconChildWidthArra2 === void 0 ? void 0 : _noIconChildWidthArra2.width) !== null && _noIconChildWidthArra !== void 0 ? _noIconChildWidthArra : 0;
|
|
175
|
+
}
|
|
176
|
+
const swapMenuItemWithListItem = (prospectiveListItem, indexOfProspectiveListItem, event, callback) => {
|
|
177
|
+
var _navRef$current$getBo, _navRef$current, _listRef$current$getB, _listRef$current;
|
|
178
|
+
// get the selected menu item's width
|
|
179
|
+
const widthToFitIntoList = getItemsWidth(prospectiveListItem.props.children);
|
|
180
|
+
// Check if there is any empty space on the right side of the list
|
|
181
|
+
const availableSpace = ((_navRef$current$getBo = (_navRef$current = navRef.current) === null || _navRef$current === void 0 ? void 0 : _navRef$current.getBoundingClientRect().width) !== null && _navRef$current$getBo !== void 0 ? _navRef$current$getBo : 0) - ((_listRef$current$getB = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.getBoundingClientRect().width) !== null && _listRef$current$getB !== void 0 ? _listRef$current$getB : 0);
|
|
182
|
+
|
|
183
|
+
// Calculate how many items need to be pulled in to the menu to make room for the selected menu item
|
|
184
|
+
// I.e. if we need to pull 2 items in (index 0 and index 1), breakpoint (index) will return 1.
|
|
185
|
+
const index = getBreakpointForItemSwapping(widthToFitIntoList, availableSpace);
|
|
186
|
+
const indexToSliceAt = responsiveProps.items.length - 1 - index;
|
|
187
|
+
// Form the new list of items
|
|
188
|
+
const itemsLeftInList = [...responsiveProps.items].slice(0, indexToSliceAt);
|
|
189
|
+
const updatedItemList = [...itemsLeftInList, prospectiveListItem];
|
|
190
|
+
// Form the new menu items
|
|
191
|
+
const itemsToAddToMenu = [...responsiveProps.items].slice(indexToSliceAt);
|
|
192
|
+
const updatedMenuItems = [...menuItems];
|
|
193
|
+
// Add itemsToAddToMenu array's items to the menu at the index of the prospectiveListItem and remove 1 count of items (prospectiveListItem)
|
|
194
|
+
updatedMenuItems.splice(indexOfProspectiveListItem, 1, ...itemsToAddToMenu);
|
|
195
|
+
callback({
|
|
196
|
+
items: updatedItemList,
|
|
197
|
+
menuItems: updatedMenuItems
|
|
198
|
+
}, false, true);
|
|
199
|
+
};
|
|
200
|
+
// How many items do we need to pull in to the menu to make room for the selected menu item.
|
|
201
|
+
function getBreakpointForItemSwapping(widthToFitIntoList, availableSpace) {
|
|
202
|
+
let widthToSwap = 0;
|
|
203
|
+
let breakpoint = 0;
|
|
204
|
+
for (const [index, item] of [...responsiveProps.items].reverse().entries()) {
|
|
205
|
+
widthToSwap += getItemsWidth(item.props.children);
|
|
206
|
+
if (widthToFitIntoList < widthToSwap + availableSpace) {
|
|
207
|
+
breakpoint = index;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return breakpoint;
|
|
212
|
+
}
|
|
213
|
+
const updateListAndMenu = useCallback((props, displayIcons, overflowMeasured) => {
|
|
214
|
+
setResponsiveProps(props);
|
|
215
|
+
setIconsVisible(displayIcons);
|
|
216
|
+
if (overflowMeasured) {
|
|
217
|
+
setIsOverflowMeasured(true);
|
|
218
|
+
}
|
|
219
|
+
}, []);
|
|
220
|
+
const setChildrenWidth = useCallback(size => {
|
|
221
|
+
setChildWidthArray(arr => {
|
|
222
|
+
const newArr = [...arr, size];
|
|
223
|
+
return newArr;
|
|
224
|
+
});
|
|
225
|
+
}, []);
|
|
226
|
+
const setNoIconChildrenWidth = useCallback(size => {
|
|
227
|
+
setNoIconChildWidthArray(arr => {
|
|
228
|
+
const newArr = [...arr, size];
|
|
229
|
+
return newArr;
|
|
230
|
+
});
|
|
231
|
+
}, []);
|
|
232
|
+
const closeOverlay = React.useCallback(() => {
|
|
233
|
+
setIsWidgetOpen(false);
|
|
234
|
+
}, [setIsWidgetOpen]);
|
|
235
|
+
const focusOnMoreMenuBtn = React.useCallback(() => {
|
|
236
|
+
var _moreMenuBtnRef$curre;
|
|
237
|
+
(_moreMenuBtnRef$curre = moreMenuBtnRef.current) === null || _moreMenuBtnRef$curre === void 0 ? void 0 : _moreMenuBtnRef$curre.focus();
|
|
238
|
+
}, []);
|
|
239
|
+
const onAnchorClick = useCallback(event => {
|
|
240
|
+
if (event.defaultPrevented || event.button !== 0) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
setIsWidgetOpen(isWidgetOpen => !isWidgetOpen);
|
|
244
|
+
}, []);
|
|
245
|
+
useOnEscapePress(event => {
|
|
246
|
+
if (isWidgetOpen) {
|
|
247
|
+
event.preventDefault();
|
|
248
|
+
closeOverlay();
|
|
249
|
+
focusOnMoreMenuBtn();
|
|
250
|
+
}
|
|
251
|
+
}, [isWidgetOpen]);
|
|
252
|
+
useOnOutsideClick({
|
|
253
|
+
onClickOutside: closeOverlay,
|
|
254
|
+
containerRef,
|
|
255
|
+
ignoreClickRefs: [moreMenuBtnRef]
|
|
256
|
+
});
|
|
257
|
+
useResizeObserver(resizeObserverEntries => {
|
|
258
|
+
var _moreMenuRef$current$, _moreMenuRef$current;
|
|
259
|
+
const navWidth = resizeObserverEntries[0].contentRect.width;
|
|
260
|
+
const moreMenuWidth = (_moreMenuRef$current$ = (_moreMenuRef$current = moreMenuRef.current) === null || _moreMenuRef$current === void 0 ? void 0 : _moreMenuRef$current.getBoundingClientRect().width) !== null && _moreMenuRef$current$ !== void 0 ? _moreMenuRef$current$ : 0;
|
|
261
|
+
navWidth !== 0 && overflowEffect(navWidth, moreMenuWidth, validChildren, childWidthArray, noIconChildWidthArray, updateListAndMenu);
|
|
262
|
+
}, navRef);
|
|
263
|
+
|
|
264
|
+
// Compute menuInlineStyles if needed
|
|
265
|
+
let menuInlineStyles = {
|
|
266
|
+
...baseMenuInlineStyles
|
|
267
|
+
};
|
|
268
|
+
if (containerRef.current && listRef.current) {
|
|
269
|
+
const {
|
|
270
|
+
left
|
|
271
|
+
} = getAnchoredPosition(containerRef.current, listRef.current, {
|
|
272
|
+
align: 'start',
|
|
273
|
+
side: 'outside-bottom'
|
|
274
|
+
});
|
|
275
|
+
menuInlineStyles = {
|
|
276
|
+
...baseMenuInlineStyles,
|
|
277
|
+
right: undefined,
|
|
278
|
+
left
|
|
279
|
+
};
|
|
280
|
+
}
|
|
64
281
|
return /*#__PURE__*/jsxs(UnderlineNavContext.Provider, {
|
|
65
282
|
value: {
|
|
283
|
+
setChildrenWidth,
|
|
284
|
+
setNoIconChildrenWidth,
|
|
66
285
|
loadingCounters,
|
|
67
|
-
|
|
68
|
-
unregisterItem
|
|
286
|
+
iconsVisible
|
|
69
287
|
},
|
|
70
288
|
children: [ariaLabel && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
71
289
|
as: "h2",
|
|
72
290
|
children: `${ariaLabel} navigation`
|
|
73
|
-
}), /*#__PURE__*/
|
|
291
|
+
}), /*#__PURE__*/jsx(UnderlineWrapper, {
|
|
74
292
|
as: as,
|
|
75
293
|
"aria-label": ariaLabel,
|
|
76
294
|
className: className,
|
|
77
295
|
ref: navRef,
|
|
78
|
-
"data-variant": variant
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// can cause flickering because hiding the icons makes more space, allowing them to show, which fills that
|
|
82
|
-
// space...so after that, if anything has ever wrapped, we just keep the icons hidden to prevent that flickering.
|
|
83
|
-
,
|
|
84
|
-
"data-hide-icons": isOrEverHasOverflowed ? 'true' : 'false',
|
|
85
|
-
children: [/*#__PURE__*/jsx(UnderlineItemList, {
|
|
296
|
+
"data-variant": variant,
|
|
297
|
+
"data-overflow-measured": isOverflowMeasured ? 'true' : 'false',
|
|
298
|
+
children: /*#__PURE__*/jsxs(UnderlineItemList, {
|
|
86
299
|
ref: listRef,
|
|
87
300
|
role: "list",
|
|
88
|
-
children:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
301
|
+
children: [listItems, menuItems.length > 0 && /*#__PURE__*/jsxs("li", {
|
|
302
|
+
ref: moreMenuRef,
|
|
303
|
+
style: {
|
|
304
|
+
display: 'flex',
|
|
305
|
+
alignItems: 'center',
|
|
306
|
+
height: `${MORE_BTN_HEIGHT}px`
|
|
307
|
+
},
|
|
308
|
+
children: [!onlyMenuVisible && /*#__PURE__*/jsx("div", {
|
|
309
|
+
style: dividerStyles
|
|
310
|
+
}), /*#__PURE__*/jsx(ButtonComponent, {
|
|
311
|
+
ref: moreMenuBtnRef,
|
|
98
312
|
className: classes.MoreButton,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
313
|
+
"aria-controls": disclosureWidgetId,
|
|
314
|
+
"aria-expanded": isWidgetOpen,
|
|
315
|
+
onClick: onAnchorClick,
|
|
316
|
+
trailingAction: TriangleDownIcon,
|
|
317
|
+
children: /*#__PURE__*/jsx("span", {
|
|
318
|
+
children: onlyMenuVisible ? /*#__PURE__*/jsxs(Fragment, {
|
|
319
|
+
children: [/*#__PURE__*/jsxs(VisuallyHidden, {
|
|
320
|
+
as: "span",
|
|
321
|
+
children: [`${ariaLabel}`, "\xA0"]
|
|
322
|
+
}), "Menu"]
|
|
323
|
+
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
324
|
+
children: ["More", /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
325
|
+
as: "span",
|
|
326
|
+
children: ["\xA0", `${ariaLabel} items`]
|
|
327
|
+
})]
|
|
328
|
+
})
|
|
104
329
|
})
|
|
105
|
-
}), /*#__PURE__*/jsx(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
330
|
+
}), /*#__PURE__*/jsx(ActionList, {
|
|
331
|
+
selectionVariant: "single",
|
|
332
|
+
ref: containerRef,
|
|
333
|
+
id: disclosureWidgetId,
|
|
334
|
+
style: {
|
|
335
|
+
...((_listRef$current2 = listRef.current) !== null && _listRef$current2 !== void 0 && _listRef$current2.clientWidth && listRef.current.clientWidth >= baseMenuMinWidth ? baseMenuInlineStyles : menuInlineStyles),
|
|
336
|
+
display: isWidgetOpen ? 'block' : 'none'
|
|
337
|
+
},
|
|
338
|
+
children: menuItems.map((menuItem, index) => {
|
|
339
|
+
const {
|
|
340
|
+
children: menuItemChildren,
|
|
341
|
+
counter,
|
|
342
|
+
'aria-current': ariaCurrent,
|
|
343
|
+
onSelect,
|
|
344
|
+
...menuItemProps
|
|
345
|
+
} = menuItem.props;
|
|
346
|
+
|
|
347
|
+
// This logic is used to pop the selected item out of the menu and into the list when the navigation is control externally
|
|
348
|
+
if (Boolean(ariaCurrent) && ariaCurrent !== 'false') {
|
|
349
|
+
const event = new MouseEvent('click');
|
|
350
|
+
!onlyMenuVisible && swapMenuItemWithListItem(menuItem, index,
|
|
351
|
+
// @ts-ignore - not a big deal because it is internally creating an event but ask help
|
|
352
|
+
event, updateListAndMenu);
|
|
353
|
+
}
|
|
354
|
+
return /*#__PURE__*/jsx(ActionList.LinkItem, {
|
|
355
|
+
style: menuItemStyles,
|
|
356
|
+
onClick: event => {
|
|
357
|
+
// When there are no items in the list, do not run the swap function as we want to keep everything in the menu.
|
|
358
|
+
!onlyMenuVisible && swapMenuItemWithListItem(menuItem, index, event, updateListAndMenu);
|
|
359
|
+
closeOverlay();
|
|
360
|
+
focusOnMoreMenuBtn();
|
|
361
|
+
// fire onSelect event that comes from the UnderlineNav.Item (if it is defined)
|
|
362
|
+
typeof onSelect === 'function' && onSelect(event);
|
|
363
|
+
},
|
|
364
|
+
...menuItemProps,
|
|
365
|
+
children: /*#__PURE__*/jsxs("span", {
|
|
366
|
+
className: classes.MenuItemContent,
|
|
367
|
+
children: [menuItemChildren, loadingCounters ? /*#__PURE__*/jsx(LoadingCounter, {}) : counter !== undefined && /*#__PURE__*/jsx("span", {
|
|
368
|
+
"data-component": "counter",
|
|
369
|
+
children: /*#__PURE__*/jsx(CounterLabel, {
|
|
370
|
+
children: counter
|
|
129
371
|
})
|
|
130
372
|
})]
|
|
131
|
-
}
|
|
132
|
-
})
|
|
373
|
+
})
|
|
374
|
+
}, menuItemChildren);
|
|
133
375
|
})
|
|
134
376
|
})]
|
|
135
377
|
})]
|
|
136
|
-
})
|
|
378
|
+
})
|
|
137
379
|
})]
|
|
138
380
|
});
|
|
139
381
|
});
|
|
140
382
|
UnderlineNav.displayName = 'UnderlineNav';
|
|
141
383
|
|
|
142
|
-
export { UnderlineNav, getValidChildren };
|
|
384
|
+
export { MORE_BTN_WIDTH, UnderlineNav, getValidChildren };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import './UnderlineNav-
|
|
1
|
+
import './UnderlineNav-4344d9b0.css';
|
|
2
2
|
|
|
3
|
-
var classes = {"
|
|
3
|
+
var classes = {"MenuItemContent":"prc-UnderlineNav-MenuItemContent-3J7gB","MoreButton":"prc-UnderlineNav-MoreButton-Y8soj"};
|
|
4
4
|
|
|
5
5
|
export { classes as default };
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const UnderlineNavContext:
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare const UnderlineNavContext: React.Context<{
|
|
3
|
+
setChildrenWidth: React.Dispatch<{
|
|
4
|
+
text: string;
|
|
5
|
+
width: number;
|
|
6
|
+
}>;
|
|
7
|
+
setNoIconChildrenWidth: React.Dispatch<{
|
|
8
|
+
text: string;
|
|
9
|
+
width: number;
|
|
10
|
+
}>;
|
|
3
11
|
loadingCounters: boolean;
|
|
4
|
-
|
|
5
|
-
unregisterItem: (id: string) => void;
|
|
12
|
+
iconsVisible: boolean;
|
|
6
13
|
}>;
|
|
7
14
|
//# sourceMappingURL=UnderlineNavContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,eAAO,MAAM,mBAAmB;sBACZ,KAAK,CAAC,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;4BACvC,KAAK,CAAC,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;qBACpD,OAAO;kBACV,OAAO;EAMrB,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
|
|
3
3
|
const UnderlineNavContext = /*#__PURE__*/createContext({
|
|
4
|
+
setChildrenWidth: () => null,
|
|
5
|
+
setNoIconChildrenWidth: () => null,
|
|
4
6
|
loadingCounters: false,
|
|
5
|
-
|
|
6
|
-
unregisterItem: () => {}
|
|
7
|
+
iconsVisible: true
|
|
7
8
|
});
|
|
8
9
|
|
|
9
10
|
export { UnderlineNavContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/UnderlineNav/UnderlineNavItem.module.css.js"],"names":[],"mappings":"AAAA,yCAGE,kBAAmB,CAFnB,YAAa,CACb,qBAEF","file":"UnderlineNavItem-b65e8fd3.css","sourcesContent":[".UnderlineNavItem {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAC3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAO/F,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACjF,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAExG;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAE5F;;;OAGG;IAEH,IAAI,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAElC;;QAEI;IACJ,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,GAAG,CAAA;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,SAAS,CAAA;AAEb,eAAO,MAAM,gBAAgB,EAgFxB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import { forwardRef, useRef, useContext
|
|
2
|
+
import { forwardRef, useRef, useContext } from 'react';
|
|
3
3
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
4
|
+
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
5
|
import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
|
|
5
6
|
import classes from './UnderlineNavItem.module.css.js';
|
|
6
7
|
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
|
-
const UnderlineNavItem = /*#__PURE__*/forwardRef((
|
|
9
|
+
const UnderlineNavItem = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
9
10
|
var _leadingVisual;
|
|
10
|
-
const $ = c(
|
|
11
|
+
const $ = c(32);
|
|
11
12
|
let Icon;
|
|
12
13
|
let ariaCurrent;
|
|
13
14
|
let children;
|
|
@@ -15,12 +16,12 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
15
16
|
let leadingVisual;
|
|
16
17
|
let onSelect;
|
|
17
18
|
let props;
|
|
18
|
-
let t0;
|
|
19
19
|
let t1;
|
|
20
|
-
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[0] !== t0) {
|
|
21
22
|
({
|
|
22
|
-
as:
|
|
23
|
-
href:
|
|
23
|
+
as: t1,
|
|
24
|
+
href: t2,
|
|
24
25
|
children,
|
|
25
26
|
counter,
|
|
26
27
|
onSelect,
|
|
@@ -28,8 +29,8 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
28
29
|
icon: Icon,
|
|
29
30
|
leadingVisual,
|
|
30
31
|
...props
|
|
31
|
-
} =
|
|
32
|
-
$[0] =
|
|
32
|
+
} = t0);
|
|
33
|
+
$[0] = t0;
|
|
33
34
|
$[1] = Icon;
|
|
34
35
|
$[2] = ariaCurrent;
|
|
35
36
|
$[3] = children;
|
|
@@ -37,8 +38,8 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
37
38
|
$[5] = leadingVisual;
|
|
38
39
|
$[6] = onSelect;
|
|
39
40
|
$[7] = props;
|
|
40
|
-
$[8] =
|
|
41
|
-
$[9] =
|
|
41
|
+
$[8] = t1;
|
|
42
|
+
$[9] = t2;
|
|
42
43
|
} else {
|
|
43
44
|
Icon = $[1];
|
|
44
45
|
ariaCurrent = $[2];
|
|
@@ -47,94 +48,80 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
47
48
|
leadingVisual = $[5];
|
|
48
49
|
onSelect = $[6];
|
|
49
50
|
props = $[7];
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
t1 = $[8];
|
|
52
|
+
t2 = $[9];
|
|
52
53
|
}
|
|
53
|
-
const Component =
|
|
54
|
-
const href =
|
|
54
|
+
const Component = t1 === undefined ? "a" : t1;
|
|
55
|
+
const href = t2 === undefined ? "#" : t2;
|
|
55
56
|
const backupRef = useRef(null);
|
|
56
57
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
57
58
|
const {
|
|
59
|
+
setChildrenWidth,
|
|
60
|
+
setNoIconChildrenWidth,
|
|
58
61
|
loadingCounters,
|
|
59
|
-
|
|
60
|
-
unregisterItem
|
|
62
|
+
iconsVisible
|
|
61
63
|
} = useContext(UnderlineNavContext);
|
|
62
|
-
const id = useId();
|
|
63
|
-
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
64
|
-
let t2;
|
|
65
64
|
let t3;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
|
|
65
|
+
let t4;
|
|
66
|
+
if ($[10] !== ref || $[11] !== setChildrenWidth || $[12] !== setNoIconChildrenWidth) {
|
|
67
|
+
t3 = () => {
|
|
68
|
+
if (ref.current) {
|
|
69
|
+
const domRect = ref.current.getBoundingClientRect();
|
|
70
|
+
const icon = Array.from(ref.current.children).find(_temp);
|
|
71
|
+
const content = Array.from(ref.current.children).find(_temp2);
|
|
72
|
+
const text = content.textContent;
|
|
73
|
+
const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
|
|
74
|
+
setChildrenWidth({
|
|
75
|
+
text,
|
|
76
|
+
width: domRect.width
|
|
77
|
+
});
|
|
78
|
+
setNoIconChildrenWidth({
|
|
79
|
+
text,
|
|
80
|
+
width: domRect.width - iconWidthWithMargin
|
|
81
|
+
});
|
|
71
82
|
}
|
|
72
|
-
const observer = new IntersectionObserver(() => {
|
|
73
|
-
const isOverflowing_0 = element.offsetTop > 0;
|
|
74
|
-
setIsOverflowing(isOverflowing_0);
|
|
75
|
-
registerItem(id, isOverflowing_0 ? allProps : null);
|
|
76
|
-
});
|
|
77
|
-
observer.observe(element);
|
|
78
|
-
return () => observer.disconnect();
|
|
79
83
|
};
|
|
80
|
-
|
|
81
|
-
$[10] =
|
|
82
|
-
$[11] =
|
|
83
|
-
$[12] =
|
|
84
|
-
$[13] =
|
|
85
|
-
$[14] =
|
|
86
|
-
$[15] = t3;
|
|
84
|
+
t4 = [ref, setChildrenWidth, setNoIconChildrenWidth];
|
|
85
|
+
$[10] = ref;
|
|
86
|
+
$[11] = setChildrenWidth;
|
|
87
|
+
$[12] = setNoIconChildrenWidth;
|
|
88
|
+
$[13] = t3;
|
|
89
|
+
$[14] = t4;
|
|
87
90
|
} else {
|
|
88
|
-
|
|
89
|
-
|
|
91
|
+
t3 = $[13];
|
|
92
|
+
t4 = $[14];
|
|
90
93
|
}
|
|
91
|
-
|
|
92
|
-
let t4;
|
|
94
|
+
useIsomorphicLayoutEffect(t3, t4);
|
|
93
95
|
let t5;
|
|
94
|
-
if ($[
|
|
95
|
-
|
|
96
|
-
t5 = [id, unregisterItem];
|
|
97
|
-
$[16] = id;
|
|
98
|
-
$[17] = unregisterItem;
|
|
99
|
-
$[18] = t4;
|
|
100
|
-
$[19] = t5;
|
|
101
|
-
} else {
|
|
102
|
-
t4 = $[18];
|
|
103
|
-
t5 = $[19];
|
|
104
|
-
}
|
|
105
|
-
useEffect(t4, t5);
|
|
106
|
-
let t6;
|
|
107
|
-
if ($[20] !== onSelect) {
|
|
108
|
-
t6 = event => {
|
|
96
|
+
if ($[15] !== onSelect) {
|
|
97
|
+
t5 = event => {
|
|
109
98
|
if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") {
|
|
110
99
|
onSelect(event);
|
|
111
100
|
}
|
|
112
101
|
};
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
102
|
+
$[15] = onSelect;
|
|
103
|
+
$[16] = t5;
|
|
115
104
|
} else {
|
|
116
|
-
|
|
105
|
+
t5 = $[16];
|
|
117
106
|
}
|
|
118
|
-
const keyDownHandler =
|
|
119
|
-
let
|
|
120
|
-
if ($[
|
|
121
|
-
|
|
107
|
+
const keyDownHandler = t5;
|
|
108
|
+
let t6;
|
|
109
|
+
if ($[17] !== onSelect) {
|
|
110
|
+
t6 = event_0 => {
|
|
122
111
|
if (!event_0.defaultPrevented && typeof onSelect === "function") {
|
|
123
112
|
onSelect(event_0);
|
|
124
113
|
}
|
|
125
114
|
};
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
115
|
+
$[17] = onSelect;
|
|
116
|
+
$[18] = t6;
|
|
128
117
|
} else {
|
|
129
|
-
|
|
118
|
+
t6 = $[18];
|
|
130
119
|
}
|
|
131
|
-
const clickHandler =
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if ($[24] !== Component || $[25] !== ariaCurrent || $[26] !== children || $[27] !== clickHandler || $[28] !== counter || $[29] !== href || $[30] !== keyDownHandler || $[31] !== loadingCounters || $[32] !== props || $[33] !== ref || $[34] !== t10 || $[35] !== t8 || $[36] !== t9) {
|
|
137
|
-
t11 = /*#__PURE__*/jsx("li", {
|
|
120
|
+
const clickHandler = t6;
|
|
121
|
+
const t7 = (_leadingVisual = leadingVisual) !== null && _leadingVisual !== void 0 ? _leadingVisual : Icon;
|
|
122
|
+
let t8;
|
|
123
|
+
if ($[19] !== Component || $[20] !== ariaCurrent || $[21] !== children || $[22] !== clickHandler || $[23] !== counter || $[24] !== href || $[25] !== iconsVisible || $[26] !== keyDownHandler || $[27] !== loadingCounters || $[28] !== props || $[29] !== ref || $[30] !== t7) {
|
|
124
|
+
t8 = /*#__PURE__*/jsx("li", {
|
|
138
125
|
className: classes.UnderlineNavItem,
|
|
139
126
|
children: /*#__PURE__*/jsx(UnderlineItem, {
|
|
140
127
|
ref: ref,
|
|
@@ -144,33 +131,37 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
|
|
|
144
131
|
onKeyDown: keyDownHandler,
|
|
145
132
|
onClick: clickHandler,
|
|
146
133
|
counter: counter,
|
|
147
|
-
icon:
|
|
134
|
+
icon: t7,
|
|
148
135
|
loadingCounters: loadingCounters,
|
|
136
|
+
iconsVisible: iconsVisible,
|
|
149
137
|
...props,
|
|
150
|
-
"aria-hidden": t9,
|
|
151
|
-
tabIndex: t10,
|
|
152
138
|
children: children
|
|
153
139
|
})
|
|
154
140
|
});
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[37] = t11;
|
|
141
|
+
$[19] = Component;
|
|
142
|
+
$[20] = ariaCurrent;
|
|
143
|
+
$[21] = children;
|
|
144
|
+
$[22] = clickHandler;
|
|
145
|
+
$[23] = counter;
|
|
146
|
+
$[24] = href;
|
|
147
|
+
$[25] = iconsVisible;
|
|
148
|
+
$[26] = keyDownHandler;
|
|
149
|
+
$[27] = loadingCounters;
|
|
150
|
+
$[28] = props;
|
|
151
|
+
$[29] = ref;
|
|
152
|
+
$[30] = t7;
|
|
153
|
+
$[31] = t8;
|
|
169
154
|
} else {
|
|
170
|
-
|
|
155
|
+
t8 = $[31];
|
|
171
156
|
}
|
|
172
|
-
return
|
|
157
|
+
return t8;
|
|
173
158
|
});
|
|
174
159
|
UnderlineNavItem.displayName = 'UnderlineNavItem';
|
|
160
|
+
function _temp(child) {
|
|
161
|
+
return child.getAttribute("data-component") === "icon";
|
|
162
|
+
}
|
|
163
|
+
function _temp2(child_0) {
|
|
164
|
+
return child_0.getAttribute("data-component") === "text";
|
|
165
|
+
}
|
|
175
166
|
|
|
176
167
|
export { UnderlineNavItem };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const dividerStyles: {
|
|
2
|
+
display: string;
|
|
3
|
+
borderLeft: string;
|
|
4
|
+
width: string;
|
|
5
|
+
borderLeftColor: string;
|
|
6
|
+
marginRight: string;
|
|
7
|
+
height: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const menuItemStyles: {
|
|
10
|
+
'& > span': {
|
|
11
|
+
display: string;
|
|
12
|
+
};
|
|
13
|
+
textDecoration: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const baseMenuMinWidth = 192;
|
|
16
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;CAOzB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;CAO1B,CAAA;AAED,eAAO,MAAM,gBAAgB,MAAM,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const dividerStyles = {
|
|
2
|
+
display: 'inline-block',
|
|
3
|
+
borderLeft: '1px solid',
|
|
4
|
+
width: '1px',
|
|
5
|
+
borderLeftColor: 'var(--borderColor-muted)',
|
|
6
|
+
marginRight: 'var(--base-size-4)',
|
|
7
|
+
height: '24px' // The height of the divider - reference from Figma
|
|
8
|
+
};
|
|
9
|
+
const menuItemStyles = {
|
|
10
|
+
// This is needed to hide the selected check icon on the menu item. https://github.com/primer/react/tree/main/packages/react/src/ActionList/Selection.tsx#L32
|
|
11
|
+
'& > span': {
|
|
12
|
+
display: 'none'
|
|
13
|
+
},
|
|
14
|
+
// To reset the style when the menu items are rendered as react router links
|
|
15
|
+
textDecoration: 'none'
|
|
16
|
+
};
|
|
17
|
+
const baseMenuMinWidth = 192;
|
|
18
|
+
|
|
19
|
+
export { baseMenuMinWidth, dividerStyles, menuItemStyles };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-components-UnderlineWrapper-eT-Yj{align-items:center;box-shadow:inset 0 -1px var(--borderColor-muted,var(--color-border-muted));display:flex;justify-content:flex-start;min-height:var(--control-xlarge-size,48px);overflow:visible;padding-inline:var(--stack-padding-normal,1rem)}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-measured=false]{overflow:hidden}.prc-components-UnderlineWrapper-eT-Yj[data-overflow-measured=true]{overflow:visible}.prc-components-UnderlineWrapper-eT-Yj[data-variant=flush]{padding-inline:unset}.prc-components-UnderlineItemList-xKlKC{display:flex;gap:8px;list-style:none;margin:0;padding:0;white-space:nowrap}.prc-components-UnderlineItem-7fP-n,.prc-components-UnderlineItemList-xKlKC{align-items:center;position:relative}.prc-components-UnderlineItem-7fP-n{appearance:none;background-color:transparent;border:0;border-radius:var(--borderRadius-medium,var(--borderRadius-small,.1875rem));color:var(--fgColor-default,var(--color-fg-default));cursor:pointer;display:inline-flex;font:inherit;font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-8,.5rem);text-align:center;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.prc-components-UnderlineItem-7fP-n:hover{background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle));-webkit-text-decoration:none;text-decoration:none;transition:background-color .12s ease-out}}.prc-components-UnderlineItem-7fP-n:focus{box-shadow:inset 0 0 0 2px var(--fgColor-accent,var(--color-accent-fg));outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n:focus:not(:focus-visible){box-shadow:none}.prc-components-UnderlineItem-7fP-n:focus-visible{box-shadow:inset 0 0 0 2px var(--fgColor-accent,var(--color-accent-fg));outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=icon]{align-items:center;color:var(--fgColor-muted,var(--color-fg-muted));display:inline-flex;margin-inline-end:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n [data-component=counter]{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n:after{background-color:transparent;border-radius:0;bottom:calc(50% - var(--control-xlarge-size, var(--base-size-48,3rem))/2 - 1px);content:"";height:2px;pointer-events:none;position:absolute;right:50%;transform:translate(50%,-50%);width:100%}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]) [data-component=text],.prc-components-UnderlineItem-7fP-n[aria-selected=true] [data-component=text]{font-weight:var(--base-text-weight-semibold,600)}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73))}@media (forced-colors:active){.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:LinkText}}.prc-components-LoadingCounter-dBuLy{animation:prc-components-loadingCounterKeyFrames-8tMlf 1.2s ease-in-out infinite alternate;background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle));border-color:var(--borderColor-default,var(--color-border-default));border-radius:20px;display:inline-block;height:1rem;width:1.5rem}@keyframes prc-components-loadingCounterKeyFrames-8tMlf{0%{opacity:1}to{opacity:.2}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineTabbedInterface-4197ee28.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/components/UnderlineTabbedInterface.module.css.js"],"names":[],"mappings":"AAAA,uCAKE,kBAAmB,CAOnB,0EAAiD,CAXjD,YAAa,CAGb,0BAA2B,CAI3B,0CAA4C,CAO5C,gBAAiB,CAZjB,+CA0BF,CAZE,qEACE,eACF,CAEA,oEACE,gBACF,CAEA,2DAEE,oBACF,CAGF,wCAEE,YAAa,CAMb,OAAQ,CAFR,eAAgB,CAFhB,QAAS,CADT,SAAU,CAEV,kBAIF,CAEA,4EAJE,kBAAmB,CANnB,iBAsCF,CA5BA,oCAgBE,eAAgB,CALhB,4BAA6B,CAC7B,QAAS,CACT,2EAAoE,CANpE,oDAA6B,CAG7B,cAAe,CAPf,mBAAoB,CACpB,YAAa,CACb,8CAAuC,CACvC,qDAAuD,CAYvD,wCAAiC,CADjC,uCAAkC,CATlC,iBAAkB,CAClB,4BAAqB,CAArB,oBAmBF,CAPE,qBACE,0CAEE,yEAA8C,CAD9C,4BAAqB,CAArB,oBAAqB,CAErB,yCACF,CACF,CAGF,0CAGE,uEAAiD,CAFjD,6BAQF,CAHE,8DACE,eACF,CAGF,kDAGE,uEAAiD,CAFjD,6BAGF,CAGA,0DAME,0BAA2B,CAL3B,aAAc,CAEd,gDAA6C,CAD7C,QAAS,CAGT,iBAAkB,CADlB,kBAGF,CAEA,0DAGE,kBAAmB,CADnB,gDAA2B,CAD3B,mBAAoB,CAGpB,0CACF,CAEA,6DAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAEA,0CAaE,4BAA6B,CAC7B,eAAgB,CANhB,+EAAmF,CAInF,UAAW,CAFX,UAAW,CACX,mBAAoB,CAVpB,iBAAkB,CAClB,SAAU,CAaV,6BAA+B,CAN/B,UAOF,CAEA,gLAEE,gDACF,CAEA,gJAGE,iGAMF,CAJE,8BALF,gJAOI,yBAEJ,CADE,CAGF,qCASE,0FAAsE,CAJtE,yEAA8C,CAC9C,mEAAwC,CAExC,kBAAmB,CAPnB,oBAAqB,CAErB,WAAY,CADZ,YAQF,CAEA,wDACE,GACE,SACF,CAEA,GACE,UACF,CACF","file":"UnderlineTabbedInterface-4197ee28.css","sourcesContent":[".UnderlineWrapper {\n display: flex;\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--stack-padding-normal);\n justify-content: flex-start;\n align-items: center;\n\n /* make space for the underline */\n min-height: var(--control-xlarge-size, 48px);\n\n /* using a box-shadow instead of a border to accommodate 'overflow-y: hidden' on UnderlinePanels */\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 -1px var(--borderColor-muted);\n\n /* Hide overflow until calculation is complete to prevent CLS */\n overflow: visible;\n\n &[data-overflow-measured='false'] {\n overflow: hidden;\n }\n\n &[data-overflow-measured='true'] {\n overflow: visible;\n }\n\n &[data-variant='flush'] {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: unset;\n }\n}\n\n.UnderlineItemList {\n position: relative;\n display: flex;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n list-style: none;\n align-items: center;\n gap: 8px;\n}\n\n.UnderlineItem {\n /* underline tab specific styles */\n position: relative;\n display: inline-flex;\n font: inherit;\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n color: var(--fgColor-default);\n text-align: center;\n text-decoration: none;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--borderRadius-medium, var(--borderRadius-small));\n\n /* button resets */\n appearance: none;\n padding-inline: var(--base-size-8);\n padding-block: var(--base-size-6);\n align-items: center;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: none;\n background-color: var(--bgColor-neutral-muted);\n transition: background-color 0.12s ease-out;\n }\n }\n}\n\n.UnderlineItem:focus {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n\n /* where focus-visible is supported, remove the focus box-shadow */\n &:not(:focus-visible) {\n box-shadow: none;\n }\n}\n\n.UnderlineItem:focus-visible {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n}\n\n/* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n.UnderlineItem [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold);\n white-space: nowrap;\n visibility: hidden;\n content: attr(data-content);\n}\n\n.UnderlineItem [data-component='icon'] {\n display: inline-flex;\n color: var(--fgColor-muted);\n align-items: center;\n margin-inline-end: var(--base-size-8);\n}\n\n.UnderlineItem [data-component='counter'] {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n}\n\n.UnderlineItem::after {\n position: absolute;\n right: 50%;\n\n /* TODO: see if we can simplify this positioning */\n\n /* 48px total height / 2 (24px) + 1px */\n /* stylelint-disable-next-line primer/spacing */\n bottom: calc(50% - calc(var(--control-xlarge-size, var(--base-size-48)) / 2 + 1px));\n width: 100%;\n height: 2px;\n pointer-events: none;\n content: '';\n background-color: transparent;\n border-radius: 0;\n transform: translate(50%, -50%);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false']) [data-component='text'],\n.UnderlineItem[aria-selected='true'] [data-component='text'] {\n font-weight: var(--base-text-weight-semibold);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false'])::after,\n.UnderlineItem[aria-selected='true']::after {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Window Force Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n}\n\n.LoadingCounter {\n display: inline-block;\n width: 1.5rem;\n height: 1rem;\n /* 16px */\n background-color: var(--bgColor-neutral-muted);\n border-color: var(--borderColor-default);\n /* stylelint-disable-next-line primer/borders */\n border-radius: 20px;\n animation: loadingCounterKeyFrames 1.2s ease-in-out infinite alternate;\n}\n\n@keyframes loadingCounterKeyFrames {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0.2;\n }\n}\n"]}
|
|
@@ -15,6 +15,7 @@ export declare const LoadingCounter: () => React.JSX.Element;
|
|
|
15
15
|
export type UnderlineItemProps<As extends React.ElementType> = {
|
|
16
16
|
as?: As | 'a' | 'button';
|
|
17
17
|
className?: string;
|
|
18
|
+
iconsVisible?: boolean;
|
|
18
19
|
loadingCounters?: boolean;
|
|
19
20
|
counter?: number | string;
|
|
20
21
|
icon?: FC<IconProps> | React.ReactElement<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineTabbedInterface.d.ts","sourceRoot":"","sources":["../../../src/internal/components/UnderlineTabbedInterface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAgC,KAAK,EAAE,EAA0B,KAAK,WAAW,EAAC,MAAM,OAAO,CAAA;AAEtG,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAErD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,yBAAyB,CAAA;AAMlG,eAAO,MAAM,GAAG,IAAI,CAAA;AAgBpB,KAAK,qBAAqB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"UnderlineTabbedInterface.d.ts","sourceRoot":"","sources":["../../../src/internal/components/UnderlineTabbedInterface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAgC,KAAK,EAAE,EAA0B,KAAK,WAAW,EAAC,MAAM,OAAO,CAAA;AAEtG,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAErD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,yBAAyB,CAAA;AAMlG,eAAO,MAAM,GAAG,IAAI,CAAA;AAgBpB,KAAK,qBAAqB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,EAAE,CAAA;IACP,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAWvB,8BAA8B,CAAC,WAAW,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAA;AAErF,eAAO,MAAM,iBAAiB,EAMxB,8BAA8B,CAAC,IAAI,CAAC,CAAA;AAE1C,eAAO,MAAM,cAAc,yBAE1B,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI;IAC7D,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAEzB,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAC9C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;CACzB,GAAG,KAAK,CAAC,wBAAwB,CAAC,EAAE,SAAS,GAAG,GAAG,GAAG,GAAG,EAAE,SAAS,QAAQ,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAA;AAE9F,eAAO,MAAM,aAAa,EAwBpB,8BAA8B,CAAC,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAA"}
|
|
@@ -6,6 +6,8 @@ import { clsx } from 'clsx';
|
|
|
6
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
import CounterLabel from '../../CounterLabel/CounterLabel.js';
|
|
8
8
|
|
|
9
|
+
const GAP = 8;
|
|
10
|
+
|
|
9
11
|
// Helper to extract direct text content from children for the data-content attribute.
|
|
10
12
|
// This is used by CSS to reserve space for bold text (preventing layout shift).
|
|
11
13
|
// Only extracts strings/numbers, not text from nested React elements (e.g., Popovers).
|
|
@@ -119,11 +121,12 @@ const LoadingCounter = () => {
|
|
|
119
121
|
return t0;
|
|
120
122
|
};
|
|
121
123
|
const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
122
|
-
const $ = c(
|
|
124
|
+
const $ = c(30);
|
|
123
125
|
let Icon;
|
|
124
126
|
let children;
|
|
125
127
|
let className;
|
|
126
128
|
let counter;
|
|
129
|
+
let iconsVisible;
|
|
127
130
|
let loadingCounters;
|
|
128
131
|
let rest;
|
|
129
132
|
let t0;
|
|
@@ -133,6 +136,7 @@ const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
133
136
|
children,
|
|
134
137
|
counter,
|
|
135
138
|
icon: Icon,
|
|
139
|
+
iconsVisible,
|
|
136
140
|
loadingCounters,
|
|
137
141
|
className,
|
|
138
142
|
...rest
|
|
@@ -142,62 +146,65 @@ const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
142
146
|
$[2] = children;
|
|
143
147
|
$[3] = className;
|
|
144
148
|
$[4] = counter;
|
|
145
|
-
$[5] =
|
|
146
|
-
$[6] =
|
|
147
|
-
$[7] =
|
|
149
|
+
$[5] = iconsVisible;
|
|
150
|
+
$[6] = loadingCounters;
|
|
151
|
+
$[7] = rest;
|
|
152
|
+
$[8] = t0;
|
|
148
153
|
} else {
|
|
149
154
|
Icon = $[1];
|
|
150
155
|
children = $[2];
|
|
151
156
|
className = $[3];
|
|
152
157
|
counter = $[4];
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
iconsVisible = $[5];
|
|
159
|
+
loadingCounters = $[6];
|
|
160
|
+
rest = $[7];
|
|
161
|
+
t0 = $[8];
|
|
156
162
|
}
|
|
157
163
|
const Component = t0 === undefined ? "a" : t0;
|
|
158
164
|
let t1;
|
|
159
|
-
if ($[
|
|
165
|
+
if ($[9] !== children) {
|
|
160
166
|
t1 = getTextContent(children);
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
167
|
+
$[9] = children;
|
|
168
|
+
$[10] = t1;
|
|
163
169
|
} else {
|
|
164
|
-
t1 = $[
|
|
170
|
+
t1 = $[10];
|
|
165
171
|
}
|
|
166
172
|
const textContent = t1;
|
|
167
173
|
let t2;
|
|
168
|
-
if ($[
|
|
174
|
+
if ($[11] !== className) {
|
|
169
175
|
t2 = clsx(classes.UnderlineItem, className);
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
176
|
+
$[11] = className;
|
|
177
|
+
$[12] = t2;
|
|
172
178
|
} else {
|
|
173
|
-
t2 = $[
|
|
179
|
+
t2 = $[12];
|
|
174
180
|
}
|
|
175
181
|
let t3;
|
|
176
|
-
if ($[
|
|
177
|
-
t3 = Icon && /*#__PURE__*/jsx("span", {
|
|
182
|
+
if ($[13] !== Icon || $[14] !== iconsVisible) {
|
|
183
|
+
t3 = iconsVisible && Icon && /*#__PURE__*/jsx("span", {
|
|
178
184
|
"data-component": "icon",
|
|
179
185
|
children: isElement(Icon) ? Icon : /*#__PURE__*/jsx(Icon, {})
|
|
180
186
|
});
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
187
|
+
$[13] = Icon;
|
|
188
|
+
$[14] = iconsVisible;
|
|
189
|
+
$[15] = t3;
|
|
183
190
|
} else {
|
|
184
|
-
t3 = $[
|
|
191
|
+
t3 = $[15];
|
|
185
192
|
}
|
|
186
193
|
let t4;
|
|
187
|
-
if ($[
|
|
194
|
+
if ($[16] !== children || $[17] !== textContent) {
|
|
188
195
|
t4 = children && /*#__PURE__*/jsx("span", {
|
|
189
196
|
"data-component": "text",
|
|
190
197
|
"data-content": textContent || undefined,
|
|
191
198
|
children: children
|
|
192
199
|
});
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
200
|
+
$[16] = children;
|
|
201
|
+
$[17] = textContent;
|
|
202
|
+
$[18] = t4;
|
|
196
203
|
} else {
|
|
197
|
-
t4 = $[
|
|
204
|
+
t4 = $[18];
|
|
198
205
|
}
|
|
199
206
|
let t5;
|
|
200
|
-
if ($[
|
|
207
|
+
if ($[19] !== counter || $[20] !== loadingCounters) {
|
|
201
208
|
t5 = counter !== undefined ? loadingCounters ? /*#__PURE__*/jsx("span", {
|
|
202
209
|
"data-component": "counter",
|
|
203
210
|
children: /*#__PURE__*/jsx(LoadingCounter, {})
|
|
@@ -207,32 +214,32 @@ const UnderlineItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
207
214
|
children: counter
|
|
208
215
|
})
|
|
209
216
|
}) : null;
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
217
|
+
$[19] = counter;
|
|
218
|
+
$[20] = loadingCounters;
|
|
219
|
+
$[21] = t5;
|
|
213
220
|
} else {
|
|
214
|
-
t5 = $[
|
|
221
|
+
t5 = $[21];
|
|
215
222
|
}
|
|
216
223
|
let t6;
|
|
217
|
-
if ($[
|
|
224
|
+
if ($[22] !== Component || $[23] !== ref || $[24] !== rest || $[25] !== t2 || $[26] !== t3 || $[27] !== t4 || $[28] !== t5) {
|
|
218
225
|
t6 = /*#__PURE__*/jsxs(Component, {
|
|
219
226
|
...rest,
|
|
220
227
|
ref: ref,
|
|
221
228
|
className: t2,
|
|
222
229
|
children: [t3, t4, t5]
|
|
223
230
|
});
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
231
|
+
$[22] = Component;
|
|
232
|
+
$[23] = ref;
|
|
233
|
+
$[24] = rest;
|
|
234
|
+
$[25] = t2;
|
|
235
|
+
$[26] = t3;
|
|
236
|
+
$[27] = t4;
|
|
237
|
+
$[28] = t5;
|
|
238
|
+
$[29] = t6;
|
|
232
239
|
} else {
|
|
233
|
-
t6 = $[
|
|
240
|
+
t6 = $[29];
|
|
234
241
|
}
|
|
235
242
|
return t6;
|
|
236
243
|
});
|
|
237
244
|
|
|
238
|
-
export { LoadingCounter, UnderlineItem, UnderlineItemList, UnderlineWrapper };
|
|
245
|
+
export { GAP, LoadingCounter, UnderlineItem, UnderlineItemList, UnderlineWrapper };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './UnderlineTabbedInterface-
|
|
1
|
+
import './UnderlineTabbedInterface-4197ee28.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"UnderlineWrapper":"prc-components-UnderlineWrapper-eT-Yj","UnderlineItemList":"prc-components-UnderlineItemList-xKlKC","UnderlineItem":"prc-components-UnderlineItem-7fP-n","LoadingCounter":"prc-components-LoadingCounter-dBuLy","loadingCounterKeyFrames":"prc-components-loadingCounterKeyFrames-8tMlf"};
|
|
4
4
|
|
|
@@ -1019,7 +1019,7 @@
|
|
|
1019
1019
|
},
|
|
1020
1020
|
{
|
|
1021
1021
|
"id": "components-autocomplete-features--rendering-the-menu-outside-an-overlay",
|
|
1022
|
-
"code": "() => {\n return (\n <form className={classes.FormPadding}>\n <FormControl>\n <FormControl.Label id=\"autocompleteLabel\">\n Default label\n </FormControl.Label>\n <Autocomplete>\n <Autocomplete.Input />\n <Autocomplete.Menu\n
|
|
1022
|
+
"code": "() => {\n const [query, setQuery] = useState('')\n return (\n <form className={classes.FormPadding}>\n <FormControl>\n <FormControl.Label id=\"autocompleteLabel\">\n Default label\n </FormControl.Label>\n <Autocomplete>\n <Autocomplete.Input\n value={query}\n onChange={(e) => setQuery(e.currentTarget.value)}\n />\n {query.length > 0 ? (\n <Autocomplete.Menu\n items={items}\n selectedItemIds={[]}\n aria-labelledby=\"autocompleteLabel\"\n />\n ) : null}\n </Autocomplete>\n </FormControl>\n </form>\n )\n}"
|
|
1023
1023
|
},
|
|
1024
1024
|
{
|
|
1025
1025
|
"id": "components-autocomplete-features--custom-overlay-menu-anchor",
|
|
@@ -1027,7 +1027,7 @@
|
|
|
1027
1027
|
},
|
|
1028
1028
|
{
|
|
1029
1029
|
"id": "components-autocomplete-features--in-overlay-with-custom-scroll-container-ref",
|
|
1030
|
-
"code": "() => {\n const scrollContainerRef = useRef<HTMLElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const [isOpen, setIsOpen] = useState(false)\n const [selectedItem, setSelectedItem] = useState<Datum>()\n const handleOpen = () => {\n setIsOpen(true)\n
|
|
1030
|
+
"code": "() => {\n const scrollContainerRef = useRef<HTMLElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const [isOpen, setIsOpen] = useState(false)\n const [selectedItem, setSelectedItem] = useState<Datum>()\n const [query, setQuery] = useState('')\n const [menuOpen, setMenuOpen] = useState(false)\n const handleOpen = () => {\n setIsOpen(true)\n setMenuOpen(false)\n setQuery('')\n }\n const selectChange = (item: Datum[] | Datum) => {\n setIsOpen(false)\n if (Array.isArray(item) && item.length) setSelectedItem(item[0])\n triggerRef.current?.focus()\n }\n return (\n <form className={classes.FormPadding}>\n <span id=\"selected-item-status\">\n Selected item: {selectedItem ? selectedItem.text : 'none'}\n </span>\n\n <AnchoredOverlay\n open={isOpen}\n onOpen={handleOpen}\n onClose={() => setIsOpen(false)}\n width=\"large\"\n focusTrapSettings={{\n initialFocusRef: inputRef,\n }}\n side=\"inside-top\"\n anchorRef={triggerRef}\n renderAnchor={(props) => (\n <Button {...props} aria-describedby=\"selected-item-status\">\n open overlay\n </Button>\n )}\n preventOverflow={false}\n >\n <Autocomplete>\n <div className={classes.OverlayFlexCol}>\n <div className={classes.OverlayInputBar}>\n <Autocomplete.Input\n ref={inputRef}\n className={classes.OverlayInput}\n block\n aria-label=\"Search\"\n value={query}\n onChange={(e) => {\n setQuery(e.currentTarget.value)\n setMenuOpen(true)\n }}\n onKeyDown={(e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp')\n setMenuOpen(true)\n if (e.key === 'Escape') setMenuOpen(false)\n }}\n />\n </div>\n\n <div\n ref={scrollContainerRef as RefObject<HTMLDivElement>}\n className={classes.OverlayScroll}\n >\n {menuOpen ? (\n <Autocomplete.Menu\n items={items}\n selectedItemIds={[]}\n customScrollContainerRef={scrollContainerRef}\n aria-labelledby=\"autocompleteLabel\"\n onSelectedChange={selectChange}\n />\n ) : null}\n </div>\n </div>\n </Autocomplete>\n </AnchoredOverlay>\n </form>\n )\n}"
|
|
1031
1031
|
},
|
|
1032
1032
|
{
|
|
1033
1033
|
"id": "components-autocomplete-features--in-a-dialog",
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-UnderlineNav-MoreButtonContainer-Dnrq6{align-items:center;display:flex;visibility:hidden}@container underline-wrapper scroll-state(scrollable: block){.prc-UnderlineNav-MoreButtonContainer-Dnrq6{visibility:visible}}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current] .prc-UnderlineNav-OverflowMenuItemLabel-F80v6{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-MoreButtonDivider-dN0a-{border-left:var(--borderWidth-default,.0625rem) solid var(--borderColor-muted,var(--color-border-muted));display:inline-block;height:var(--base-size-24,1.5rem);margin-right:var(--base-size-4,.25rem);width:0}.prc-UnderlineNav-MoreButton-Y8soj{background:transparent;border:0;box-shadow:none;font-weight:var(--base-text-weight-normal,400);margin:0;padding:var(--base-size-4,.25rem) var(--base-size-8,.5rem)}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}
|
|
2
|
-
/*# sourceMappingURL=UnderlineNav-e56ca858.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,4CAGE,kBAAmB,CAFnB,YAAa,CACb,iBAOF,CAHE,6DANF,4CAOI,kBAEJ,CADE,CAGF,sGACE,gDACF,CAEA,0CAEE,wGAAsE,CADtE,oBAAqB,CAIrB,iCAA2B,CAD3B,sCAAgC,CADhC,OAGF,CAGA,mCAGE,sBAAuB,CADvB,QAAS,CAGT,eAAgB,CADhB,8CAA2C,CAH3C,QAAS,CAQT,0DAKF,CAHE,mEACE,aACF","file":"UnderlineNav-e56ca858.css","sourcesContent":[".MoreButtonContainer {\n display: flex;\n visibility: hidden;\n align-items: center;\n\n /* Visibility is controlled by scroll-state query instead of React state so that it's known during SSR */\n @container underline-wrapper scroll-state(scrollable: block) {\n visibility: visible;\n }\n}\n\n.OverflowMenuItem [aria-current] .OverflowMenuItemLabel {\n font-weight: var(--base-text-weight-semibold);\n}\n\n.MoreButtonDivider {\n display: inline-block;\n border-left: var(--borderWidth-default) solid var(--borderColor-muted);\n width: 0;\n margin-right: var(--base-size-4);\n height: var(--base-size-24);\n}\n\n/* More button styles migrated from styles.ts (was moreBtnStyles) */\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n border: 0;\n background: transparent;\n font-weight: var(--base-text-weight-normal);\n box-shadow: none;\n padding-top: var(--base-size-4);\n padding-bottom: var(--base-size-4);\n padding-left: var(--base-size-8);\n padding-right: var(--base-size-8);\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/UnderlineNav/UnderlineNavItem.module.css.js"],"names":[],"mappings":"AAAA,yCAGE,kBAAmB,CAFnB,YAAa,CACb,qBAAsB,CAEtB,eACF","file":"UnderlineNavItem-db9dc5d0.css","sourcesContent":[".UnderlineNavItem {\n display: flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-components-UnderlineWrapper-eT-Yj{align-items:flex-start;box-shadow:inset 0 -1px var(--borderColor-muted,var(--color-border-muted));container:underline-wrapper/scroll-state;display:flex;height:var(--control-xlarge-size,48px);justify-content:space-between;overflow:hidden;padding-inline:var(--stack-padding-normal,1rem);padding-top:var(--base-size-8,.5rem)}.prc-components-UnderlineWrapper-eT-Yj[data-variant=flush]{padding-inline:unset}.prc-components-UnderlineWrapper-eT-Yj[data-hide-icons=true] [data-component=icon]{display:none}.prc-components-UnderlineItemList-xKlKC{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;overflow:hidden;padding:0;white-space:nowrap}.prc-components-UnderlineItem-7fP-n,.prc-components-UnderlineItemList-xKlKC{align-items:center;position:relative}.prc-components-UnderlineItem-7fP-n{appearance:none;background-color:transparent;border:0;border-radius:var(--borderRadius-medium,var(--borderRadius-small,.1875rem));color:var(--fgColor-default,var(--color-fg-default));cursor:pointer;display:inline-flex;font:inherit;font-size:var(--text-body-size-medium,.875rem);line-height:var(--text-body-lineHeight-medium,1.4285);max-width:100%;padding-block:var(--base-size-6,.375rem);padding-inline:var(--base-size-8,.5rem);text-align:center;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.prc-components-UnderlineItem-7fP-n:hover{background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle));-webkit-text-decoration:none;text-decoration:none;transition:background-color .12s ease-out}}.prc-components-UnderlineItem-7fP-n:focus{box-shadow:inset 0 0 0 2px var(--fgColor-accent,var(--color-accent-fg));outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n:focus:not(:focus-visible){box-shadow:none}.prc-components-UnderlineItem-7fP-n:focus-visible{box-shadow:inset 0 0 0 2px var(--fgColor-accent,var(--color-accent-fg));outline:2px solid transparent}.prc-components-UnderlineItem-7fP-n [data-content]:before{content:attr(data-content);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;visibility:hidden;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=icon]{align-items:center;color:var(--fgColor-muted,var(--color-fg-muted));display:inline-flex;margin-inline-end:var(--base-size-8,.5rem)}@container underline-wrapper scroll-state(scrollable: block){.prc-components-UnderlineItem-7fP-n [data-component=icon]{display:none}}.prc-components-UnderlineItem-7fP-n [data-component=text]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.prc-components-UnderlineItem-7fP-n [data-component=counter]{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-components-UnderlineItem-7fP-n:after{background-color:transparent;border-radius:0;bottom:calc(50% - var(--control-xlarge-size, var(--base-size-48,3rem))/2 - 1px);content:"";height:2px;pointer-events:none;position:absolute;right:50%;transform:translate(50%,-50%);width:100%}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]) [data-component=text],.prc-components-UnderlineItem-7fP-n[aria-selected=true] [data-component=text]{font-weight:var(--base-text-weight-semibold,600)}.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73))}@media (forced-colors:active){.prc-components-UnderlineItem-7fP-n[aria-current]:not([aria-current=false]):after,.prc-components-UnderlineItem-7fP-n[aria-selected=true]:after{background-color:LinkText}}.prc-components-LoadingCounter-dBuLy{animation:prc-components-loadingCounterKeyFrames-8tMlf 1.2s ease-in-out infinite alternate;background-color:var(--bgColor-neutral-muted,var(--color-neutral-subtle));border-color:var(--borderColor-default,var(--color-border-default));border-radius:20px;display:inline-block;height:1rem;width:1.5rem}@keyframes prc-components-loadingCounterKeyFrames-8tMlf{0%{opacity:1}to{opacity:.2}}
|
|
2
|
-
/*# sourceMappingURL=UnderlineTabbedInterface-b6e35b9d.css.map */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/components/UnderlineTabbedInterface.module.css.js"],"names":[],"mappings":"AAAA,uCAME,sBAAuB,CAUvB,0EAAiD,CAPjD,wCAA2C,CAR3C,YAAa,CAWb,sCAAwC,CAPxC,6BAA8B,CAE9B,eAAgB,CAJhB,+CAA2C,CAC3C,oCAsBF,CARE,2DAEE,oBACF,CAEA,mFACE,YACF,CAGF,wCAEE,YAAa,CAOb,cAAe,CADf,OAAQ,CAFR,eAAgB,CAFhB,QAAS,CAOT,eAAgB,CARhB,SAAU,CAEV,kBAOF,CAEA,4EAPE,kBAAmB,CANnB,iBA0CF,CA7BA,oCAiBE,eAAgB,CANhB,4BAA6B,CAC7B,QAAS,CACT,2EAAoE,CANpE,oDAA6B,CAG7B,cAAe,CAPf,mBAAoB,CACpB,YAAa,CACb,8CAAuC,CACvC,qDAAuD,CAQvD,cAAe,CAKf,wCAAiC,CADjC,uCAAkC,CAVlC,iBAAkB,CAClB,4BAAqB,CAArB,oBAoBF,CAPE,qBACE,0CAEE,yEAA8C,CAD9C,4BAAqB,CAArB,oBAAqB,CAErB,yCACF,CACF,CAGF,0CAGE,uEAAiD,CAFjD,6BAQF,CAHE,8DACE,eACF,CAGF,kDAGE,uEAAiD,CAFjD,6BAGF,CAGA,0DAME,0BAA2B,CAL3B,aAAc,CAEd,gDAA6C,CAD7C,QAAS,CAGT,iBAAkB,CADlB,kBAGF,CAEA,0DAGE,kBAAmB,CADnB,gDAA2B,CAD3B,mBAAoB,CAGpB,0CAMF,CAHE,6DAPF,0DAQI,YAEJ,CADE,CAIF,0DACE,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAEA,6DAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAEA,0CAaE,4BAA6B,CAC7B,eAAgB,CANhB,+EAAmF,CAInF,UAAW,CAFX,UAAW,CACX,mBAAoB,CAVpB,iBAAkB,CAClB,SAAU,CAaV,6BAA+B,CAN/B,UAOF,CAEA,gLAEE,gDACF,CAEA,gJAGE,iGAMF,CAJE,8BALF,gJAOI,yBAEJ,CADE,CAGF,qCASE,0FAAsE,CAJtE,yEAA8C,CAC9C,mEAAwC,CAExC,kBAAmB,CAPnB,oBAAqB,CAErB,WAAY,CADZ,YAQF,CAEA,wDACE,GACE,SACF,CAEA,GACE,UACF,CACF","file":"UnderlineTabbedInterface-b6e35b9d.css","sourcesContent":[".UnderlineWrapper {\n display: flex;\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--stack-padding-normal);\n padding-top: var(--base-size-8);\n justify-content: space-between;\n align-items: flex-start;\n overflow: hidden;\n /* stylelint-disable-next-line declaration-property-value-no-unknown */\n container: underline-wrapper / scroll-state;\n\n /* make space for the underline */\n height: var(--control-xlarge-size, 48px);\n\n /* using a box-shadow instead of a border to accommodate 'overflow-y: hidden' on UnderlinePanels */\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 -1px var(--borderColor-muted);\n\n &[data-variant='flush'] {\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: unset;\n }\n\n &[data-hide-icons='true'] [data-component='icon'] {\n display: none;\n }\n}\n\n.UnderlineItemList {\n position: relative;\n display: flex;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n list-style: none;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n /* Allows the menu to clip wrapped items to keep on shrinking */\n overflow: hidden;\n}\n\n.UnderlineItem {\n /* underline tab specific styles */\n position: relative;\n display: inline-flex;\n font: inherit;\n font-size: var(--text-body-size-medium);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n color: var(--fgColor-default);\n text-align: center;\n text-decoration: none;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--borderRadius-medium, var(--borderRadius-small));\n max-width: 100%;\n\n /* button resets */\n appearance: none;\n padding-inline: var(--base-size-8);\n padding-block: var(--base-size-6);\n align-items: center;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: none;\n background-color: var(--bgColor-neutral-muted);\n transition: background-color 0.12s ease-out;\n }\n }\n}\n\n.UnderlineItem:focus {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n\n /* where focus-visible is supported, remove the focus box-shadow */\n &:not(:focus-visible) {\n box-shadow: none;\n }\n}\n\n.UnderlineItem:focus-visible {\n outline: 2px solid transparent;\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: inset 0 0 0 2px var(--fgColor-accent);\n}\n\n/* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n.UnderlineItem [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold);\n white-space: nowrap;\n visibility: hidden;\n content: attr(data-content);\n}\n\n.UnderlineItem [data-component='icon'] {\n display: inline-flex;\n color: var(--fgColor-muted);\n align-items: center;\n margin-inline-end: var(--base-size-8);\n\n /* Hide via CSS when there's an overflow (for SSR; after initial render will control with React state) */\n @container underline-wrapper scroll-state(scrollable: block) {\n display: none;\n }\n}\n\n/* Only the first item will ever truncate, after all other items wrap */\n.UnderlineItem [data-component='text'] {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.UnderlineItem [data-component='counter'] {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n}\n\n.UnderlineItem::after {\n position: absolute;\n right: 50%;\n\n /* TODO: see if we can simplify this positioning */\n\n /* 48px total height / 2 (24px) + 1px */\n /* stylelint-disable-next-line primer/spacing */\n bottom: calc(50% - calc(var(--control-xlarge-size, var(--base-size-48)) / 2 + 1px));\n width: 100%;\n height: 2px;\n pointer-events: none;\n content: '';\n background-color: transparent;\n border-radius: 0;\n transform: translate(50%, -50%);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false']) [data-component='text'],\n.UnderlineItem[aria-selected='true'] [data-component='text'] {\n font-weight: var(--base-text-weight-semibold);\n}\n\n.UnderlineItem[aria-current]:not([aria-current='false'])::after,\n.UnderlineItem[aria-selected='true']::after {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Window Force Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n}\n\n.LoadingCounter {\n display: inline-block;\n width: 1.5rem;\n height: 1rem;\n /* 16px */\n background-color: var(--bgColor-neutral-muted);\n border-color: var(--borderColor-default);\n /* stylelint-disable-next-line primer/borders */\n border-radius: 20px;\n animation: loadingCounterKeyFrames 1.2s ease-in-out infinite alternate;\n}\n\n@keyframes loadingCounterKeyFrames {\n from {\n opacity: 1;\n }\n\n to {\n opacity: 0.2;\n }\n}\n"]}
|