@primer/react 0.0.0-20260313180314 → 0.0.0-20260313180903

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +6 -32
  2. package/dist/ActionList/Item.d.ts.map +1 -1
  3. package/dist/ActionList/Item.js +192 -628
  4. package/dist/ActionList/List.d.ts.map +1 -1
  5. package/dist/ActionList/List.js +5 -6
  6. package/dist/Banner/Banner-f672cdf9.css +2 -0
  7. package/dist/Banner/Banner-f672cdf9.css.map +1 -0
  8. package/dist/Banner/Banner.d.ts.map +1 -1
  9. package/dist/Banner/Banner.js +0 -1
  10. package/dist/Banner/Banner.module.css.js +1 -1
  11. package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  12. package/dist/Breadcrumbs/Breadcrumbs.js +1 -0
  13. package/dist/Button/{ButtonBase-6659abcf.css → ButtonBase-781fba8b.css} +2 -2
  14. package/dist/Button/{ButtonBase-6659abcf.css.map → ButtonBase-781fba8b.css.map} +1 -1
  15. package/dist/Button/ButtonBase.module.css.js +1 -1
  16. package/dist/Dialog/{Dialog-2de477b3.css → Dialog-2d417a89.css} +2 -2
  17. package/dist/Dialog/{Dialog-2de477b3.css.map → Dialog-2d417a89.css.map} +1 -1
  18. package/dist/Dialog/Dialog.d.ts.map +1 -1
  19. package/dist/Dialog/Dialog.js +1 -3
  20. package/dist/Dialog/Dialog.module.css.js +2 -2
  21. package/dist/Overlay/{Overlay-dbaa6b8c.css → Overlay-15519c09.css} +2 -2
  22. package/dist/Overlay/Overlay-15519c09.css.map +1 -0
  23. package/dist/Overlay/Overlay.module.css.js +1 -1
  24. package/dist/PageLayout/PageLayout.d.ts +20 -4
  25. package/dist/PageLayout/PageLayout.d.ts.map +1 -1
  26. package/dist/PageLayout/PageLayout.js +0 -12
  27. package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
  28. package/dist/SelectPanel/SelectPanel.js +29 -30
  29. package/dist/TextInput/TextInput.d.ts.map +1 -1
  30. package/dist/TextInput/TextInput.js +5 -31
  31. package/dist/Timeline/Timeline-19bef8c5.css +2 -0
  32. package/dist/Timeline/Timeline-19bef8c5.css.map +1 -0
  33. package/dist/Timeline/Timeline.d.ts +1 -1
  34. package/dist/Timeline/Timeline.d.ts.map +1 -1
  35. package/dist/Timeline/Timeline.js +14 -27
  36. package/dist/Timeline/Timeline.module.css.js +1 -1
  37. package/dist/TreeView/TreeView.d.ts.map +1 -1
  38. package/dist/TreeView/TreeView.js +59 -101
  39. package/dist/UnderlineNav/UnderlineNav-4c80468c.css +2 -0
  40. package/dist/UnderlineNav/UnderlineNav-4c80468c.css.map +1 -0
  41. package/dist/UnderlineNav/UnderlineNav.d.ts +1 -3
  42. package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
  43. package/dist/UnderlineNav/UnderlineNav.js +40 -342
  44. package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
  45. package/dist/UnderlineNav/UnderlineNavContext.d.ts +1 -11
  46. package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
  47. package/dist/UnderlineNav/UnderlineNavContext.js +1 -4
  48. package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
  49. package/dist/UnderlineNav/UnderlineNavItem.js +40 -37
  50. package/dist/UnderlineNav/index.d.ts +1 -1
  51. package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css +2 -0
  52. package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css.map +1 -0
  53. package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
  54. package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
  55. package/dist/internal/components/UnderlineTabbedInterface-7317470b.css +2 -0
  56. package/dist/internal/components/UnderlineTabbedInterface-7317470b.css.map +1 -0
  57. package/dist/internal/components/UnderlineTabbedInterface.d.ts +0 -1
  58. package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
  59. package/dist/internal/components/UnderlineTabbedInterface.js +66 -60
  60. package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
  61. package/dist/utils/character-counter.d.ts.map +1 -1
  62. package/dist/utils/character-counter.js +0 -1
  63. package/generated/components.json +5 -13
  64. package/package.json +1 -1
  65. package/dist/Banner/Banner-41040ab7.css +0 -2
  66. package/dist/Banner/Banner-41040ab7.css.map +0 -1
  67. package/dist/Overlay/Overlay-dbaa6b8c.css.map +0 -1
  68. package/dist/Timeline/Timeline-4d67684a.css +0 -2
  69. package/dist/Timeline/Timeline-4d67684a.css.map +0 -1
  70. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +0 -2
  71. package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +0 -1
  72. package/dist/UnderlineNav/styles.d.ts +0 -16
  73. package/dist/UnderlineNav/styles.d.ts.map +0 -1
  74. package/dist/UnderlineNav/styles.js +0 -19
  75. package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +0 -2
  76. package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +0 -1
  77. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +0 -2
  78. package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +0 -1
@@ -1,119 +1,15 @@
1
- import React, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
2
- import { UnderlineNavContext } from './UnderlineNavContext.js';
3
- import { useResizeObserver } from '../hooks/useResizeObserver.js';
1
+ import React, { forwardRef, useEffect, useState, useRef } from 'react';
4
2
  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';
11
- import { ActionList } from '../ActionList/index.js';
3
+ import { UnderlineWrapper, UnderlineItemList } from '../internal/components/UnderlineTabbedInterface.js';
12
4
  import { invariant } from '../utils/invariant.js';
13
5
  import classes from './UnderlineNav.module.css.js';
14
- import { getAnchoredPosition } from '@primer/behaviors';
15
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
16
- import { ButtonComponent } from '../Button/Button.js';
17
- import CounterLabel from '../CounterLabel/CounterLabel.js';
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;
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.
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;
6
+ import { UnderlineNavContext } from './UnderlineNavContext.js';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
52
8
 
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
- };
84
9
  const getValidChildren = children => {
85
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
11
  return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
87
12
  };
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
- };
117
13
  const UnderlineNav = /*#__PURE__*/forwardRef(({
118
14
  as = 'nav',
119
15
  'aria-label': ariaLabel,
@@ -122,42 +18,9 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
122
18
  className,
123
19
  children
124
20
  }, forwardedRef) => {
125
- var _listRef$current2;
126
- const backupRef = useRef(null);
127
- const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
128
- const listRef = useRef(null);
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);
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;
160
21
  if (process.env.NODE_ENV !== "production") {
22
+ const validChildren = getValidChildren(children);
23
+
161
24
  // Practically, this is not a conditional hook, it is just making sure this hook runs only on DEV not PROD.
162
25
  // eslint-disable-next-line react-hooks/rules-of-hooks
163
26
  useEffect(() => {
@@ -169,216 +32,51 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
169
32
  !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;
170
33
  });
171
34
  }
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);
35
+ const [hideIcons, setHideIcons] = useState(false);
36
+ const scrollContainer = useRef(null);
37
+ useEffect(() => {
38
+ if (hideIcons || !scrollContainer.current) return;
182
39
 
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;
40
+ // Putting the resizeobserver on the list ensures it runs if the contents change;
41
+ // the container is fullwidth but the list is elastic
42
+ const list = scrollContainer.current.querySelector('ul');
43
+ if (!list) return;
44
+ const observer = new ResizeObserver(() => {
45
+ if (scrollContainer.current.scrollWidth > scrollContainer.current.clientWidth) setHideIcons(true);
230
46
  });
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
- }
47
+ observer.observe(list);
48
+ return () => observer.disconnect();
49
+ }, [hideIcons]);
281
50
  return /*#__PURE__*/jsxs(UnderlineNavContext.Provider, {
282
51
  value: {
283
- setChildrenWidth,
284
- setNoIconChildrenWidth,
285
- loadingCounters,
286
- iconsVisible
52
+ loadingCounters
287
53
  },
288
54
  children: [ariaLabel && /*#__PURE__*/jsx(VisuallyHidden, {
289
55
  as: "h2",
290
56
  children: `${ariaLabel} navigation`
291
- }), /*#__PURE__*/jsx(UnderlineWrapper, {
292
- as: as,
293
- "aria-label": ariaLabel,
294
- className: className,
295
- ref: navRef,
296
- "data-variant": variant,
297
- "data-overflow-measured": isOverflowMeasured ? 'true' : 'false',
298
- children: /*#__PURE__*/jsxs(UnderlineItemList, {
299
- ref: listRef,
300
- role: "list",
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,
312
- className: classes.MoreButton,
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
- })
329
- })
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
371
- })
372
- })]
373
- })
374
- }, menuItemChildren);
375
- })
376
- })]
377
- })]
57
+ }), /*#__PURE__*/jsx("div", {
58
+ className: classes.ScrollContainer,
59
+ "data-hide-icons": hideIcons,
60
+ ref: scrollContainer,
61
+ "data-component": "underlinenav-scrollcontainer",
62
+ children: /*#__PURE__*/jsx(UnderlineWrapper, {
63
+ as: as,
64
+ "aria-label": ariaLabel,
65
+ className: className,
66
+ ref: forwardedRef,
67
+ "data-variant": variant,
68
+ "data-overflow-mode": "wrap",
69
+ style: {
70
+ minWidth: 'fit-content'
71
+ },
72
+ children: /*#__PURE__*/jsx(UnderlineItemList, {
73
+ role: "list",
74
+ children: children
75
+ })
378
76
  })
379
77
  })]
380
78
  });
381
79
  });
382
80
  UnderlineNav.displayName = 'UnderlineNav';
383
81
 
384
- export { MORE_BTN_WIDTH, UnderlineNav, getValidChildren };
82
+ export { UnderlineNav };
@@ -1,5 +1,5 @@
1
- import './UnderlineNav-4344d9b0.css';
1
+ import './UnderlineNav-4c80468c.css';
2
2
 
3
- var classes = {"MenuItemContent":"prc-UnderlineNav-MenuItemContent-3J7gB","MoreButton":"prc-UnderlineNav-MoreButton-Y8soj"};
3
+ var classes = {"ScrollContainer":"prc-UnderlineNav-ScrollContainer-kBvfS","detect-overflow":"prc-UnderlineNav-detect-overflow-6HuSH"};
4
4
 
5
5
  export { classes as default };
@@ -1,14 +1,4 @@
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
- }>;
1
+ export declare const UnderlineNavContext: import("react").Context<{
11
2
  loadingCounters: boolean;
12
- iconsVisible: boolean;
13
3
  }>;
14
4
  //# sourceMappingURL=UnderlineNavContext.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;qBACb,OAAO;EAGxB,CAAA"}
@@ -1,10 +1,7 @@
1
1
  import { createContext } from 'react';
2
2
 
3
3
  const UnderlineNavContext = /*#__PURE__*/createContext({
4
- setChildrenWidth: () => null,
5
- setNoIconChildrenWidth: () => null,
6
- loadingCounters: false,
7
- iconsVisible: true
4
+ loadingCounters: false
8
5
  });
9
6
 
10
7
  export { UnderlineNavContext };
@@ -1 +1 @@
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
+ {"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AAAA,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;AAsBb,eAAO,MAAM,gBAAgB,EA8DvB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA"}
@@ -1,46 +1,42 @@
1
1
  import React, { forwardRef, useRef, useContext } from 'react';
2
2
  import { UnderlineNavContext } from './UnderlineNavContext.js';
3
- import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
4
3
  import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
5
4
  import classes from './UnderlineNavItem.module.css.js';
5
+ import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
6
6
  import { jsx } from 'react/jsx-runtime';
7
7
 
8
- const UnderlineNavItem = /*#__PURE__*/forwardRef(({
9
- as: Component = 'a',
10
- href = '#',
11
- children,
12
- counter,
13
- onSelect,
14
- 'aria-current': ariaCurrent,
15
- icon: Icon,
16
- leadingVisual,
17
- ...props
18
- }, forwardedRef) => {
19
- const backupRef = useRef(null);
20
- const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
8
+ function scrollIntoViewHorizontally(container, descendant) {
9
+ // Walk up the offset parent chain to get the true left offset relative to `container`
10
+ let offsetLeft = 0;
11
+ let el = descendant;
12
+ while (el && el !== container) {
13
+ offsetLeft += el.offsetLeft;
14
+ el = el.offsetParent;
15
+ }
16
+
17
+ // scrollIntoView would be more convenient but would scroll the entire page unless we pass `options.container`,
18
+ // for which browser support is very limited
19
+ const descendantLeft = offsetLeft - container.scrollLeft;
20
+ const descendantRight = descendantLeft + descendant.offsetWidth;
21
+ const containerWidth = container.clientWidth;
22
+ if (descendantLeft < 0) container.scrollLeft += descendantLeft;else if (descendantRight > containerWidth) container.scrollLeft += descendantRight - containerWidth;
23
+ }
24
+ const UnderlineNavItem = /*#__PURE__*/forwardRef((allProps, forwardedRef) => {
25
+ const {
26
+ as: Component = 'a',
27
+ href = '#',
28
+ children,
29
+ counter,
30
+ onSelect,
31
+ 'aria-current': ariaCurrent,
32
+ icon: Icon,
33
+ leadingVisual,
34
+ ...props
35
+ } = allProps;
36
+ const ref = useRef(null);
21
37
  const {
22
- setChildrenWidth,
23
- setNoIconChildrenWidth,
24
- loadingCounters,
25
- iconsVisible
38
+ loadingCounters
26
39
  } = useContext(UnderlineNavContext);
27
- useIsomorphicLayoutEffect(() => {
28
- if (ref.current) {
29
- const domRect = ref.current.getBoundingClientRect();
30
- const icon = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'icon');
31
- const content = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'text');
32
- const text = content.textContent;
33
- const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
34
- setChildrenWidth({
35
- text,
36
- width: domRect.width
37
- });
38
- setNoIconChildrenWidth({
39
- text,
40
- width: domRect.width - iconWidthWithMargin
41
- });
42
- }
43
- }, [ref, setChildrenWidth, setNoIconChildrenWidth]);
44
40
  const keyDownHandler = React.useCallback(event => {
45
41
  if ((event.key === ' ' || event.key === 'Enter') && !event.defaultPrevented && typeof onSelect === 'function') {
46
42
  onSelect(event);
@@ -51,10 +47,18 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
51
47
  onSelect(event);
52
48
  }
53
49
  }, [onSelect]);
50
+ useIsomorphicLayoutEffect(() => {
51
+ if (ariaCurrent && ariaCurrent !== 'false' && ref.current) {
52
+ const scrollContainer = ref.current.closest('[data-component="underlinenav-scrollcontainer"]');
53
+ if (!(scrollContainer instanceof HTMLElement)) return;
54
+ scrollIntoViewHorizontally(scrollContainer, ref.current);
55
+ }
56
+ }, [ariaCurrent]);
54
57
  return /*#__PURE__*/jsx("li", {
55
58
  className: classes.UnderlineNavItem,
59
+ ref: ref,
56
60
  children: /*#__PURE__*/jsx(UnderlineItem, {
57
- ref: ref,
61
+ ref: forwardedRef,
58
62
  as: Component,
59
63
  href: href,
60
64
  "aria-current": ariaCurrent,
@@ -63,7 +67,6 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
63
67
  counter: counter,
64
68
  icon: leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : Icon,
65
69
  loadingCounters: loadingCounters,
66
- iconsVisible: iconsVisible,
67
70
  ...props,
68
71
  children: children
69
72
  })
@@ -1,6 +1,6 @@
1
1
  import type { UnderlineNavProps } from './UnderlineNav';
2
2
  import type { UnderlineNavItemProps } from './UnderlineNavItem';
3
- declare const UnderlineNav: import("react").ForwardRefExoticComponent<UnderlineNavProps & import("react").RefAttributes<unknown>> & {
3
+ declare const UnderlineNav: import("react").ForwardRefExoticComponent<UnderlineNavProps & import("react").RefAttributes<HTMLElement>> & {
4
4
  Item: import("../utils/polymorphic").ForwardRefComponent<"a", UnderlineNavItemProps>;
5
5
  };
6
6
  export { UnderlineNav };
@@ -0,0 +1,2 @@
1
+ .prc-UnderlinePanels-StyledUnderlineWrapper-aiLna{overflow-x:auto;overflow-y:hidden;width:100%;-webkit-overflow-scrolling:auto}
2
+ /*# sourceMappingURL=UnderlinePanels-162f9aed.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/experimental/UnderlinePanels/UnderlinePanels.module.css.js"],"names":[],"mappings":"AAAA,kDAEE,eAAgB,CAChB,iBAAkB,CAFlB,UAAW,CAGX,+BACF","file":"UnderlinePanels-162f9aed.css","sourcesContent":[".StyledUnderlineWrapper {\n width: 100%;\n overflow-x: auto;\n overflow-y: hidden;\n -webkit-overflow-scrolling: auto;\n}\n"]}
@@ -92,7 +92,7 @@ const UnderlinePanels = ({
92
92
  children: [/*#__PURE__*/jsx(UnderlineWrapper, {
93
93
  ref: wrapperRef,
94
94
  slot: "tablist-wrapper",
95
- "data-icons-visible": iconsVisible,
95
+ "data-hide-icons": !iconsVisible,
96
96
  className: clsx(className, classes.StyledUnderlineWrapper),
97
97
  ...props,
98
98
  children: /*#__PURE__*/jsx(UnderlineItemList, {
@@ -1,4 +1,4 @@
1
- import './UnderlinePanels-e4b325b9.css';
1
+ import './UnderlinePanels-162f9aed.css';
2
2
 
3
3
  var classes = {"StyledUnderlineWrapper":"prc-UnderlinePanels-StyledUnderlineWrapper-aiLna"};
4
4
 
@@ -0,0 +1,2 @@
1
+ .prc-components-UnderlineWrapper-eT-Yj{align-items:flex-start;box-shadow:inset 0 -1px var(--borderColor-muted,var(--color-border-muted));display:flex;justify-content:flex-start;min-height:var(--control-xlarge-size,3rem);padding-top:var(--base-size-8,.5rem);padding-inline:var(--stack-padding-normal,1rem);width:100%}.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;gap:var(--stack-gap-condensed,.5rem);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,.375rem);color:var(--fgColor-default,var(--color-fg-default));cursor:pointer;display:inline-flex;font:inherit;font-size:var(--text-body-size-medium,.875rem);height:32px;line-height:var(--text-body-lineHeight-medium,1.4285);margin-bottom:var(--base-size-8,.5rem);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)}.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;content:"";height:2px;inset:auto 0 0;margin-bottom:calc(var(--base-size-8,.5rem)*-1);pointer-events:none;position:absolute}.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-7317470b.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/components/UnderlineTabbedInterface.module.css.js"],"names":[],"mappings":"AAAA,uCAME,sBAAuB,CAQvB,0EAAiD,CAbjD,YAAa,CAIb,0BAA2B,CAK3B,0CAAsC,CARtC,oCAA+B,CAE/B,+CAA2C,CAG3C,UAiBF,CARE,2DAEE,oBACF,CAEA,mFACE,YACF,CAGF,wCAEE,YAAa,CAMb,oCAA+B,CAF/B,eAAgB,CAFhB,QAAS,CADT,SAAU,CAEV,kBAIF,CAEA,4EAJE,kBAAmB,CANnB,iBAyCF,CA/BA,oCAmBE,eAAgB,CARhB,4BAA6B,CAC7B,QAAS,CACT,gDAAyC,CANzC,oDAA6B,CAG7B,cAAe,CAPf,mBAAoB,CACpB,YAAa,CACb,8CAAuC,CAWvC,WAAY,CAVZ,qDAAuD,CASvD,sCAAiC,CADjC,cAAe,CAOf,wCAAiC,CADjC,uCAAkC,CAZlC,iBAAkB,CAClB,4BAAqB,CAArB,oBAsBF,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,0CAOE,4BAA6B,CAD7B,UAAW,CAFX,UAAW,CAFX,cAAe,CACf,+CAA4C,CAE5C,mBAAoB,CAJpB,iBAOF,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-7317470b.css","sourcesContent":[".UnderlineWrapper {\n display: flex;\n padding-top: var(--base-size-8);\n /* stylelint-disable-next-line primer/spacing */\n padding-inline: var(--stack-padding-normal);\n justify-content: flex-start;\n align-items: flex-start;\n width: 100%;\n\n /* make space for the underline */\n min-height: var(--control-xlarge-size);\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: var(--stack-gap-condensed);\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);\n max-width: 100%;\n margin-bottom: var(--base-size-8);\n height: 32px;\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 inset: auto 0 0;\n margin-bottom: calc(-1 * var(--base-size-8));\n height: 2px;\n pointer-events: none;\n content: '';\n background-color: transparent;\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,7 +15,6 @@ 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;
19
18
  loadingCounters?: boolean;
20
19
  counter?: number | string;
21
20
  icon?: FC<IconProps> | React.ReactElement<any>;