@primer/react 38.32.0-rc.7fd08e0cc → 38.32.0-rc.85de10233
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/ActionBar/ActionBar.js +130 -424
- package/dist/FilteredActionList/FilteredActionList.js +66 -155
- package/dist/FilteredActionList/useAnnouncements.js +66 -138
- package/dist/LabelGroup/LabelGroup.js +76 -110
- package/dist/Overlay/Overlay.js +45 -169
- package/dist/TextInput/TextInput.js +7 -7
- package/dist/ToggleSwitch/ToggleSwitch.js +167 -186
- package/dist/TreeView/TreeView.js +309 -814
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-a06bbc74.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +5 -0
- package/dist/UnderlineNav/UnderlineNav.js +136 -129
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +38 -95
- package/dist/hooks/useControllableState.js +3 -3
- package/dist/hooks/useMedia.js +44 -43
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/internal/components/ValidationAnimationContainer.js +40 -34
- package/package.json +3 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-UnderlineNav-UnderlineWrapper-GWONT{animation:prc-UnderlineNav-detect-overflow-6HuSH linear;animation-timeline:scroll(self block);container-type:inline-size;--UnderlineNav_moreButton-display:none}.prc-UnderlineNav-UnderlineWrapper-GWONT[data-has-overflow=true]{--UnderlineNav_moreButton-display:flex}@keyframes prc-UnderlineNav-detect-overflow-6HuSH{0%,to{--UnderlineNav_moreButton-display:flex}}@container (width < 20rem){.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons-breakpoint=xsmall] .prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:none}}@container (width < 34rem){.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons-breakpoint=small] .prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:none}}@container (width < 48rem){.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons-breakpoint=medium] .prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:none}}@container (width < 63.25rem){.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons-breakpoint=large] .prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:none}}@container (width < 80rem){.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons-breakpoint=xlarge] .prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:none}}@container (width < 87.5rem){.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons-breakpoint=xxlarge] .prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:none}}.prc-UnderlineNav-WrapSpacer--aLgz{margin-inline-end:calc(var(--stack-gap-condensed,.5rem)*-1)}.prc-UnderlineNav-MoreButtonContainer-Dnrq6{align-items:center;display:var(--UnderlineNav_moreButton-display,flex)}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current]{position:relative}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current] .prc-UnderlineNav-OverflowMenuItemLabel-F80v6{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current]:after{background:var(--underlineNav-borderColor-active,#fd8c73);content:"";inset:var(--base-size-2,.125rem) auto var(--base-size-2,.125rem) 0;position:absolute;width:var(--base-size-2,.125rem)}.prc-UnderlineNav-MoreButtonDivider-dN0a-{border-left:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);display:inline-block;height:var(--base-size-24,1.5rem);margin-inline:var(--base-size-4,.25rem);width:0}.prc-UnderlineNav-MoreButton-Y8soj{font-weight:var(--base-text-weight-normal,400);margin:0;position:relative}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73));content:"";height:2px;inset:auto 0 0;margin-bottom:calc((var(--base-size-8,.5rem) + var(--borderWidth-thin,.0625rem))*-1);pointer-events:none;position:absolute}@media (forced-colors:active){.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:LinkText}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineNav-a06bbc74.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,yCAIE,uDAAiC,CACjC,qCAAsC,CACtC,0BAA2B,CAE3B,sCAKF,CAHE,iEACE,sCACF,CAIF,kDACE,MAEE,sCACF,CACF,CAGE,2BACE,oIACE,YACF,CACF,CAIA,2BACE,mIACE,YACF,CACF,CAIA,2BACE,oIACE,YACF,CACF,CAIA,8BACE,mIACE,YACF,CACF,CAIA,2BACE,oIACE,YACF,CACF,CAIA,6BACE,qIACE,YACF,CACF,CAGF,mCAGE,2DACF,CAEA,4CAEE,kBAAmB,CADnB,mDAEF,CAEA,wDACE,iBAcF,CAZE,sGACE,gDACF,CAEA,8DAME,yDAAkD,CALlD,UAAW,CAGX,kEAAmD,CADnD,iBAAkB,CADlB,gCAKF,CAGF,0CAEE,qFAAmE,CADnE,oBAAqB,CAIrB,iCAA2B,CAD3B,uCAAiC,CADjC,OAGF,CAEA,mCAEE,8CAA2C,CAD3C,QAAS,CAET,iBA6BF,CA3BE,mEACE,aACF,CAIA,sDACE,gDAmBF,CAjBE,4DAUE,iGAAoG,CAFpG,UAAW,CAFX,UAAW,CAJX,cAAe,CAGf,oFAAwE,CAExE,mBAAoB,CANpB,iBAeF,CAJE,8BAZF,4DAcI,yBAEJ,CADE","file":"UnderlineNav-a06bbc74.css","sourcesContent":[".UnderlineWrapper {\n /* Progressive enhancement: Detect overflow using scroll-based animations.\n The idiomatic way would be a scroll-state container query but browser support\n is slightly better for animations. */\n animation: detect-overflow linear;\n animation-timeline: scroll(self block);\n container-type: inline-size;\n\n --UnderlineNav_moreButton-display: none;\n\n &[data-has-overflow='true'] {\n --UnderlineNav_moreButton-display: flex;\n }\n}\n\n/* Set overflow button visibility with pure CSS to avoid a layout shift on hydration */\n@keyframes detect-overflow {\n 0%,\n 100% {\n --UnderlineNav_moreButton-display: flex;\n }\n}\n\n.UnderlineWrapper[data-hide-icons-breakpoint='xsmall'] {\n @container (width < 20rem) {\n .ItemsList [data-component='icon'] {\n display: none;\n }\n }\n}\n\n.UnderlineWrapper[data-hide-icons-breakpoint='small'] {\n @container (width < 34rem) {\n .ItemsList [data-component='icon'] {\n display: none;\n }\n }\n}\n\n.UnderlineWrapper[data-hide-icons-breakpoint='medium'] {\n @container (width < 48rem) {\n .ItemsList [data-component='icon'] {\n display: none;\n }\n }\n}\n\n.UnderlineWrapper[data-hide-icons-breakpoint='large'] {\n @container (width < 63.25rem) {\n .ItemsList [data-component='icon'] {\n display: none;\n }\n }\n}\n\n.UnderlineWrapper[data-hide-icons-breakpoint='xlarge'] {\n @container (width < 80rem) {\n .ItemsList [data-component='icon'] {\n display: none;\n }\n }\n}\n\n.UnderlineWrapper[data-hide-icons-breakpoint='xxlarge'] {\n @container (width < 87.5rem) {\n .ItemsList [data-component='icon'] {\n display: none;\n }\n }\n}\n\n.WrapSpacer {\n /* Cancel out the flex gap so the first real item has no leading gap */\n /* stylelint-disable-next-line primer/spacing -- negative margin required to cancel the flex gap from the list */\n margin-inline-end: calc(-1 * var(--stack-gap-condensed));\n}\n\n.MoreButtonContainer {\n display: var(--UnderlineNav_moreButton-display, flex);\n align-items: center;\n}\n\n.OverflowMenuItem [aria-current] {\n position: relative;\n\n .OverflowMenuItemLabel {\n font-weight: var(--base-text-weight-semibold);\n }\n\n &::after {\n content: '';\n width: var(--base-size-2);\n position: absolute;\n inset: var(--base-size-2) auto var(--base-size-2) 0;\n /* stylelint-disable-next-line primer/colors */\n background: var(--underlineNav-borderColor-active);\n }\n}\n\n.MoreButtonDivider {\n display: inline-block;\n border-left: var(--borderWidth-thin) solid var(--borderColor-muted);\n width: 0;\n margin-inline: var(--base-size-4);\n height: var(--base-size-24);\n}\n\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n font-weight: var(--base-text-weight-normal);\n position: relative;\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n\n /* When the current item has overflowed into the menu, style the overflow\n anchor so it looks like the current item (semibold text + active underline). */\n &[data-current='true'] {\n font-weight: var(--base-text-weight-semibold);\n\n &::after {\n position: absolute;\n inset: auto 0 0;\n /* Pull down same amount as the item-level decoration, plus the border width of the button */\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: calc(-1 * (var(--base-size-8) + var(--borderWidth-thin)));\n height: 2px;\n pointer-events: none;\n content: '';\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 Windows Forced Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n }\n }\n}\n"]}
|
|
@@ -16,6 +16,11 @@ type UnderlineNavProps = {
|
|
|
16
16
|
* Setting this to `flush` will remove the horizontal padding on the items.
|
|
17
17
|
*/
|
|
18
18
|
variant?: 'inset' | 'flush';
|
|
19
|
+
/**
|
|
20
|
+
* Customize when the icons are hidden to save space. Set to `null` to always show icons.
|
|
21
|
+
* Defaults to `xxlarge`; if you know there won't be very many tabs you might set this to a smaller value.
|
|
22
|
+
*/
|
|
23
|
+
hideIconsBreakpoint?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | null;
|
|
19
24
|
};
|
|
20
25
|
//#endregion
|
|
21
26
|
export { UnderlineNavProps };
|
|
@@ -18,143 +18,150 @@ import { forwardRef, useRef, useState } from "react";
|
|
|
18
18
|
//#region src/UnderlineNav/UnderlineNav.tsx
|
|
19
19
|
const UnderlineNav = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
20
20
|
const $ = c(52);
|
|
21
|
-
const { as: t1, "aria-label": ariaLabel, loadingCounters: t2, variant: t3, className, children } = t0;
|
|
21
|
+
const { as: t1, "aria-label": ariaLabel, loadingCounters: t2, variant: t3, className, children, hideIconsBreakpoint: t4 } = t0;
|
|
22
22
|
const as = t1 === void 0 ? "nav" : t1;
|
|
23
23
|
const loadingCounters = t2 === void 0 ? false : t2;
|
|
24
24
|
const variant = t3 === void 0 ? "inset" : t3;
|
|
25
|
+
const hideIconsBreakpoint = t4 === void 0 ? "xxlarge" : t4;
|
|
25
26
|
const backupRef = useRef(null);
|
|
26
27
|
const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
27
28
|
const listRef = useRef(null);
|
|
28
|
-
const [hasEverOverflowed, setHasOverflowed] = useState(false);
|
|
29
29
|
const [registeredItems, setRegisteredItems] = UnderlineNavItemsRegistry.useRegistryState();
|
|
30
30
|
let isOverflowing;
|
|
31
31
|
let overflowMenuItems;
|
|
32
|
-
let
|
|
33
|
-
if ($[0] !==
|
|
32
|
+
let t5;
|
|
33
|
+
if ($[0] !== registeredItems) {
|
|
34
34
|
var _registeredItems$entr;
|
|
35
35
|
overflowMenuItems = Array.from((_registeredItems$entr = registeredItems === null || registeredItems === void 0 ? void 0 : registeredItems.entries()) !== null && _registeredItems$entr !== void 0 ? _registeredItems$entr : []).filter(_temp);
|
|
36
36
|
isOverflowing = overflowMenuItems.length > 0;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
$[
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[3] = overflowMenuItems;
|
|
43
|
-
$[4] = t4;
|
|
37
|
+
t5 = overflowMenuItems.some(_temp2);
|
|
38
|
+
$[0] = registeredItems;
|
|
39
|
+
$[1] = isOverflowing;
|
|
40
|
+
$[2] = overflowMenuItems;
|
|
41
|
+
$[3] = t5;
|
|
44
42
|
} else {
|
|
45
|
-
isOverflowing = $[
|
|
46
|
-
overflowMenuItems = $[
|
|
47
|
-
|
|
43
|
+
isOverflowing = $[1];
|
|
44
|
+
overflowMenuItems = $[2];
|
|
45
|
+
t5 = $[3];
|
|
48
46
|
}
|
|
49
|
-
const overflowingCurrentItem =
|
|
50
|
-
let t5;
|
|
51
|
-
if ($[5] !== children) {
|
|
52
|
-
t5 = getValidChildren(children);
|
|
53
|
-
$[5] = children;
|
|
54
|
-
$[6] = t5;
|
|
55
|
-
} else t5 = $[6];
|
|
56
|
-
const validChildren = t5;
|
|
47
|
+
const overflowingCurrentItem = t5;
|
|
57
48
|
let t6;
|
|
49
|
+
if ($[4] !== children) {
|
|
50
|
+
t6 = getValidChildren(children);
|
|
51
|
+
$[4] = children;
|
|
52
|
+
$[5] = t6;
|
|
53
|
+
} else t6 = $[5];
|
|
54
|
+
const validChildren = t6;
|
|
58
55
|
let t7;
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
let t8;
|
|
57
|
+
if ($[6] !== ariaLabel || $[7] !== validChildren) {
|
|
58
|
+
t7 = () => {
|
|
61
59
|
!(validChildren.filter(_temp3).length <= 1) && invariant(false, "Only one current element is allowed");
|
|
62
60
|
!ariaLabel && invariant(false, "Use the `aria-label` prop to provide an accessible label for assistive technology");
|
|
63
61
|
};
|
|
64
|
-
|
|
65
|
-
$[
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
62
|
+
t8 = [validChildren, ariaLabel];
|
|
63
|
+
$[6] = ariaLabel;
|
|
64
|
+
$[7] = validChildren;
|
|
65
|
+
$[8] = t7;
|
|
66
|
+
$[9] = t8;
|
|
69
67
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
t7 = $[8];
|
|
69
|
+
t8 = $[9];
|
|
72
70
|
}
|
|
73
|
-
useDevOnlyEffect(
|
|
74
|
-
let
|
|
75
|
-
if ($[
|
|
76
|
-
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
} else
|
|
80
|
-
const contextValue =
|
|
71
|
+
useDevOnlyEffect(t7, t8);
|
|
72
|
+
let t9;
|
|
73
|
+
if ($[10] !== loadingCounters) {
|
|
74
|
+
t9 = { loadingCounters };
|
|
75
|
+
$[10] = loadingCounters;
|
|
76
|
+
$[11] = t9;
|
|
77
|
+
} else t9 = $[11];
|
|
78
|
+
const contextValue = t9;
|
|
81
79
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
82
80
|
if (menuOpen && !isOverflowing) setMenuOpen(false);
|
|
83
|
-
let
|
|
84
|
-
if ($[
|
|
85
|
-
|
|
81
|
+
let t10;
|
|
82
|
+
if ($[12] !== ariaLabel) {
|
|
83
|
+
t10 = ariaLabel && /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
86
84
|
as: "h2",
|
|
87
85
|
children: `${ariaLabel} navigation`
|
|
88
86
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
} else
|
|
92
|
-
let
|
|
93
|
-
if ($[
|
|
94
|
-
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
} else
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
let
|
|
87
|
+
$[12] = ariaLabel;
|
|
88
|
+
$[13] = t10;
|
|
89
|
+
} else t10 = $[13];
|
|
90
|
+
let t11;
|
|
91
|
+
if ($[14] !== className) {
|
|
92
|
+
t11 = clsx(UnderlineNav_module_css_default.UnderlineWrapper, className);
|
|
93
|
+
$[14] = className;
|
|
94
|
+
$[15] = t11;
|
|
95
|
+
} else t11 = $[15];
|
|
96
|
+
const t12 = hideIconsBreakpoint !== null && hideIconsBreakpoint !== void 0 ? hideIconsBreakpoint : void 0;
|
|
97
|
+
const t13 = isOverflowing ? "true" : void 0;
|
|
98
|
+
let t14;
|
|
99
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
100
|
+
t14 = /*#__PURE__*/ jsx("li", {
|
|
101
|
+
role: "presentation",
|
|
102
|
+
"aria-hidden": true,
|
|
103
|
+
className: UnderlineNav_module_css_default.WrapSpacer
|
|
104
|
+
});
|
|
105
|
+
$[16] = t14;
|
|
106
|
+
} else t14 = $[16];
|
|
107
|
+
let t15;
|
|
101
108
|
if ($[17] !== children || $[18] !== setRegisteredItems) {
|
|
102
|
-
|
|
109
|
+
t15 = /*#__PURE__*/ jsx(UnderlineNavItemsRegistry.Provider, {
|
|
103
110
|
setRegistry: setRegisteredItems,
|
|
104
111
|
children
|
|
105
112
|
});
|
|
106
113
|
$[17] = children;
|
|
107
114
|
$[18] = setRegisteredItems;
|
|
108
|
-
$[19] =
|
|
109
|
-
} else
|
|
110
|
-
let
|
|
111
|
-
if ($[20] !== navRef || $[21] !==
|
|
112
|
-
|
|
115
|
+
$[19] = t15;
|
|
116
|
+
} else t15 = $[19];
|
|
117
|
+
let t16;
|
|
118
|
+
if ($[20] !== navRef || $[21] !== t15) {
|
|
119
|
+
t16 = /*#__PURE__*/ jsxs(UnderlineItemList, {
|
|
113
120
|
ref: listRef,
|
|
114
121
|
role: "list",
|
|
115
122
|
className: UnderlineNav_module_css_default.ItemsList,
|
|
116
|
-
children: /*#__PURE__*/ jsx(OverflowObserverProvider, {
|
|
123
|
+
children: [t14, /*#__PURE__*/ jsx(OverflowObserverProvider, {
|
|
117
124
|
rootRef: navRef,
|
|
118
|
-
children:
|
|
119
|
-
})
|
|
125
|
+
children: t15
|
|
126
|
+
})]
|
|
120
127
|
});
|
|
121
128
|
$[20] = navRef;
|
|
122
|
-
$[21] =
|
|
123
|
-
$[22] =
|
|
124
|
-
} else
|
|
125
|
-
let
|
|
129
|
+
$[21] = t15;
|
|
130
|
+
$[22] = t16;
|
|
131
|
+
} else t16 = $[22];
|
|
132
|
+
let t17;
|
|
126
133
|
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
127
|
-
|
|
128
|
-
$[23] =
|
|
129
|
-
} else
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
let
|
|
134
|
+
t17 = /*#__PURE__*/ jsx("div", { className: UnderlineNav_module_css_default.MoreButtonDivider });
|
|
135
|
+
$[23] = t17;
|
|
136
|
+
} else t17 = $[23];
|
|
137
|
+
const t18 = overflowingCurrentItem ? "true" : void 0;
|
|
138
|
+
const t19 = overflowingCurrentItem ? "More items, including current item" : void 0;
|
|
139
|
+
let t20;
|
|
133
140
|
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
134
|
-
|
|
141
|
+
t20 = /*#__PURE__*/ jsxs("span", { children: ["More", /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
135
142
|
as: "span",
|
|
136
143
|
children: " items"
|
|
137
144
|
})] });
|
|
138
|
-
$[24] =
|
|
139
|
-
} else
|
|
140
|
-
let
|
|
141
|
-
if ($[25] !==
|
|
142
|
-
|
|
145
|
+
$[24] = t20;
|
|
146
|
+
} else t20 = $[24];
|
|
147
|
+
let t21;
|
|
148
|
+
if ($[25] !== t18 || $[26] !== t19) {
|
|
149
|
+
t21 = /*#__PURE__*/ jsx(ActionMenu.Button, {
|
|
143
150
|
className: UnderlineNav_module_css_default.MoreButton,
|
|
144
151
|
variant: "invisible",
|
|
145
152
|
"data-component": "overflow-menu-button",
|
|
146
|
-
"data-current":
|
|
147
|
-
"aria-label":
|
|
148
|
-
children:
|
|
153
|
+
"data-current": t18,
|
|
154
|
+
"aria-label": t19,
|
|
155
|
+
children: t20
|
|
149
156
|
});
|
|
150
|
-
$[25] =
|
|
151
|
-
$[26] =
|
|
152
|
-
$[27] =
|
|
153
|
-
} else
|
|
154
|
-
let
|
|
157
|
+
$[25] = t18;
|
|
158
|
+
$[26] = t19;
|
|
159
|
+
$[27] = t21;
|
|
160
|
+
} else t21 = $[27];
|
|
161
|
+
let t22;
|
|
155
162
|
if ($[28] !== loadingCounters || $[29] !== overflowMenuItems || $[30] !== registeredItems) {
|
|
156
|
-
|
|
157
|
-
const [key, allProps] =
|
|
163
|
+
t22 = registeredItems === void 0 ? /*#__PURE__*/ jsx(ActionList.Item, { children: /*#__PURE__*/ jsx(SkeletonText, {}) }) : overflowMenuItems.map((t23) => {
|
|
164
|
+
const [key, allProps] = t23;
|
|
158
165
|
const { children: menuItemChildren, counter, onSelect, ...menuItemProps } = allProps;
|
|
159
166
|
return /*#__PURE__*/ jsxs(ActionList.LinkItem, {
|
|
160
167
|
onClick: (event) => onSelect === null || onSelect === void 0 ? void 0 : onSelect(event),
|
|
@@ -172,65 +179,65 @@ const UnderlineNav = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
|
172
179
|
$[28] = loadingCounters;
|
|
173
180
|
$[29] = overflowMenuItems;
|
|
174
181
|
$[30] = registeredItems;
|
|
175
|
-
$[31] =
|
|
176
|
-
} else
|
|
177
|
-
let
|
|
178
|
-
if ($[32] !==
|
|
179
|
-
|
|
180
|
-
$[32] =
|
|
181
|
-
$[33] =
|
|
182
|
-
} else
|
|
183
|
-
let
|
|
184
|
-
if ($[34] !== menuOpen || $[35] !==
|
|
185
|
-
|
|
182
|
+
$[31] = t22;
|
|
183
|
+
} else t22 = $[31];
|
|
184
|
+
let t23;
|
|
185
|
+
if ($[32] !== t22) {
|
|
186
|
+
t23 = /*#__PURE__*/ jsx(ActionMenu.Overlay, { children: /*#__PURE__*/ jsx(ActionList, { children: t22 }) });
|
|
187
|
+
$[32] = t22;
|
|
188
|
+
$[33] = t23;
|
|
189
|
+
} else t23 = $[33];
|
|
190
|
+
let t24;
|
|
191
|
+
if ($[34] !== menuOpen || $[35] !== t21 || $[36] !== t23) {
|
|
192
|
+
t24 = /*#__PURE__*/ jsxs("div", {
|
|
186
193
|
className: UnderlineNav_module_css_default.MoreButtonContainer,
|
|
187
|
-
children: [
|
|
194
|
+
children: [t17, /*#__PURE__*/ jsxs(ActionMenu, {
|
|
188
195
|
open: menuOpen,
|
|
189
196
|
onOpenChange: setMenuOpen,
|
|
190
|
-
children: [
|
|
197
|
+
children: [t21, t23]
|
|
191
198
|
})]
|
|
192
199
|
});
|
|
193
200
|
$[34] = menuOpen;
|
|
194
|
-
$[35] =
|
|
195
|
-
$[36] =
|
|
196
|
-
$[37] =
|
|
197
|
-
} else
|
|
198
|
-
let
|
|
199
|
-
if ($[38] !== ariaLabel || $[39] !== as || $[40] !== navRef || $[41] !==
|
|
200
|
-
|
|
201
|
+
$[35] = t21;
|
|
202
|
+
$[36] = t23;
|
|
203
|
+
$[37] = t24;
|
|
204
|
+
} else t24 = $[37];
|
|
205
|
+
let t25;
|
|
206
|
+
if ($[38] !== ariaLabel || $[39] !== as || $[40] !== navRef || $[41] !== t11 || $[42] !== t12 || $[43] !== t13 || $[44] !== t16 || $[45] !== t24 || $[46] !== variant) {
|
|
207
|
+
t25 = /*#__PURE__*/ jsxs(UnderlineWrapper, {
|
|
201
208
|
as,
|
|
202
209
|
"aria-label": ariaLabel,
|
|
203
|
-
className:
|
|
210
|
+
className: t11,
|
|
204
211
|
ref: navRef,
|
|
205
212
|
"data-variant": variant,
|
|
206
213
|
"data-overflow-mode": "wrap",
|
|
207
|
-
"data-hide-icons":
|
|
208
|
-
"data-has-overflow":
|
|
209
|
-
children: [
|
|
214
|
+
"data-hide-icons-breakpoint": t12,
|
|
215
|
+
"data-has-overflow": t13,
|
|
216
|
+
children: [t16, t24]
|
|
210
217
|
});
|
|
211
218
|
$[38] = ariaLabel;
|
|
212
219
|
$[39] = as;
|
|
213
220
|
$[40] = navRef;
|
|
214
|
-
$[41] =
|
|
215
|
-
$[42] =
|
|
216
|
-
$[43] =
|
|
217
|
-
$[44] =
|
|
218
|
-
$[45] =
|
|
221
|
+
$[41] = t11;
|
|
222
|
+
$[42] = t12;
|
|
223
|
+
$[43] = t13;
|
|
224
|
+
$[44] = t16;
|
|
225
|
+
$[45] = t24;
|
|
219
226
|
$[46] = variant;
|
|
220
|
-
$[47] =
|
|
221
|
-
} else
|
|
222
|
-
let
|
|
223
|
-
if ($[48] !== contextValue || $[49] !==
|
|
224
|
-
|
|
227
|
+
$[47] = t25;
|
|
228
|
+
} else t25 = $[47];
|
|
229
|
+
let t26;
|
|
230
|
+
if ($[48] !== contextValue || $[49] !== t10 || $[50] !== t25) {
|
|
231
|
+
t26 = /*#__PURE__*/ jsxs(UnderlineNavContext.Provider, {
|
|
225
232
|
value: contextValue,
|
|
226
|
-
children: [
|
|
233
|
+
children: [t10, t25]
|
|
227
234
|
});
|
|
228
235
|
$[48] = contextValue;
|
|
229
|
-
$[49] =
|
|
230
|
-
$[50] =
|
|
231
|
-
$[51] =
|
|
232
|
-
} else
|
|
233
|
-
return
|
|
236
|
+
$[49] = t10;
|
|
237
|
+
$[50] = t25;
|
|
238
|
+
$[51] = t26;
|
|
239
|
+
} else t26 = $[51];
|
|
240
|
+
return t26;
|
|
234
241
|
});
|
|
235
242
|
UnderlineNav.displayName = "UnderlineNav";
|
|
236
243
|
function _temp(entry) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./UnderlineNav-
|
|
1
|
+
import "./UnderlineNav-a06bbc74.css";
|
|
2
2
|
//#region src/UnderlineNav/UnderlineNav.module.css.js
|
|
3
3
|
var UnderlineNav_module_css_default = {
|
|
4
4
|
"UnderlineWrapper": "prc-UnderlineNav-UnderlineWrapper-GWONT",
|
|
5
5
|
"detect-overflow": "prc-UnderlineNav-detect-overflow-6HuSH",
|
|
6
6
|
"ItemsList": "prc-UnderlineNav-ItemsList-oj8gN",
|
|
7
|
+
"WrapSpacer": "prc-UnderlineNav-WrapSpacer--aLgz",
|
|
7
8
|
"MoreButtonContainer": "prc-UnderlineNav-MoreButtonContainer-Dnrq6",
|
|
8
9
|
"OverflowMenuItem": "prc-UnderlineNav-OverflowMenuItem-7SG7M",
|
|
9
10
|
"OverflowMenuItemLabel": "prc-UnderlineNav-OverflowMenuItemLabel-F80v6",
|
|
@@ -6,7 +6,6 @@ import { isSlot } from "../../utils/is-slot.js";
|
|
|
6
6
|
import { createComponent } from "../../utils/create-component.js";
|
|
7
7
|
import { UnderlineItem, UnderlineItemList, UnderlineWrapper } from "../../internal/components/UnderlineTabbedInterface.js";
|
|
8
8
|
import UnderlinePanels_module_css_default from "./UnderlinePanels.module.css.js";
|
|
9
|
-
import { c } from "react-compiler-runtime";
|
|
10
9
|
import { clsx } from "clsx";
|
|
11
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import React, { Children, cloneElement, createContext, isValidElement, useContext, useMemo, useRef, useState } from "react";
|
|
@@ -22,7 +21,7 @@ const UnderlinePanels = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabel
|
|
|
22
21
|
const wrapperRef = useRef(null);
|
|
23
22
|
const listRef = useRef(null);
|
|
24
23
|
const parentId = useId$1(props.id);
|
|
25
|
-
const [
|
|
24
|
+
const [tabs, tabPanels, tabsHaveIcons] = useMemo(() => {
|
|
26
25
|
let tabIndex = 0;
|
|
27
26
|
let panelIndex = 0;
|
|
28
27
|
const childrenWithProps = Children.map(children, (child) => {
|
|
@@ -32,10 +31,10 @@ const UnderlinePanels = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabel
|
|
|
32
31
|
});
|
|
33
32
|
const tabs = [];
|
|
34
33
|
const tabPanels = [];
|
|
35
|
-
for (const
|
|
36
|
-
if (!/*#__PURE__*/ isValidElement(
|
|
37
|
-
if (
|
|
38
|
-
else if (
|
|
34
|
+
for (const child of Children.toArray(childrenWithProps)) {
|
|
35
|
+
if (!/*#__PURE__*/ isValidElement(child)) continue;
|
|
36
|
+
if (child.type === Tab || isSlot(child, Tab)) tabs.push(child);
|
|
37
|
+
else if (child.type === Panel || isSlot(child, Panel)) tabPanels.push(child);
|
|
39
38
|
}
|
|
40
39
|
return [
|
|
41
40
|
tabs,
|
|
@@ -53,20 +52,20 @@ const UnderlinePanels = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabel
|
|
|
53
52
|
}, [iconsVisible]);
|
|
54
53
|
const listWidthRef = useRef(0);
|
|
55
54
|
useResizeObserver((entries) => {
|
|
56
|
-
if (!
|
|
55
|
+
if (!tabsHaveIcons) return;
|
|
57
56
|
if (!iconsVisibleRef.current) return;
|
|
58
57
|
listWidthRef.current = entries[0].contentRect.width;
|
|
59
58
|
}, listRef, []);
|
|
60
59
|
useResizeObserver((resizeObserverEntries) => {
|
|
61
|
-
if (!
|
|
60
|
+
if (!tabsHaveIcons) return;
|
|
62
61
|
const wrapperWidth = resizeObserverEntries[0].contentRect.width;
|
|
63
62
|
setIconsVisible(wrapperWidth > listWidthRef.current);
|
|
64
63
|
}, wrapperRef, []);
|
|
65
|
-
!(
|
|
66
|
-
const ariaSelected = /*#__PURE__*/ React.isValidElement(
|
|
64
|
+
!(tabs.filter((tab) => {
|
|
65
|
+
const ariaSelected = /*#__PURE__*/ React.isValidElement(tab) && tab.props["aria-selected"];
|
|
67
66
|
return ariaSelected === true || ariaSelected === "true";
|
|
68
67
|
}).length <= 1) && invariant(false, "Only one tab can be selected at a time.");
|
|
69
|
-
!(
|
|
68
|
+
!(tabs.length === tabPanels.length) && invariant(false, `The number of tabs and panels must be equal. Counted ${tabs.length} tabs and ${tabPanels.length} panels.`);
|
|
70
69
|
return /*#__PURE__*/ jsx(UnderlinePanelsContext.Provider, {
|
|
71
70
|
value: contextValue,
|
|
72
71
|
children: /*#__PURE__*/ jsxs(TabContainerComponent, { children: [/*#__PURE__*/ jsx(UnderlineWrapper, {
|
|
@@ -80,100 +79,44 @@ const UnderlinePanels = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabel
|
|
|
80
79
|
"aria-label": ariaLabel,
|
|
81
80
|
"aria-labelledby": ariaLabelledBy,
|
|
82
81
|
role: "tablist",
|
|
83
|
-
children:
|
|
82
|
+
children: tabs
|
|
84
83
|
})
|
|
85
|
-
}),
|
|
84
|
+
}), tabPanels] })
|
|
86
85
|
});
|
|
87
86
|
};
|
|
88
87
|
UnderlinePanels.displayName = "UnderlinePanels";
|
|
89
|
-
const TabImpl = (
|
|
90
|
-
const $ = c(15);
|
|
91
|
-
let ariaSelected;
|
|
92
|
-
let onSelect;
|
|
93
|
-
let props;
|
|
94
|
-
if ($[0] !== t0) {
|
|
95
|
-
({"aria-selected": ariaSelected, onSelect, ...props} = t0);
|
|
96
|
-
$[0] = t0;
|
|
97
|
-
$[1] = ariaSelected;
|
|
98
|
-
$[2] = onSelect;
|
|
99
|
-
$[3] = props;
|
|
100
|
-
} else {
|
|
101
|
-
ariaSelected = $[1];
|
|
102
|
-
onSelect = $[2];
|
|
103
|
-
props = $[3];
|
|
104
|
-
}
|
|
88
|
+
const TabImpl = ({ "aria-selected": ariaSelected, onSelect, ...props }) => {
|
|
105
89
|
const { loadingCounters } = useContext(UnderlinePanelsContext);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
const keyDownHandler = t2;
|
|
124
|
-
const t3 = ariaSelected ? 0 : -1;
|
|
125
|
-
let t4;
|
|
126
|
-
if ($[8] !== ariaSelected || $[9] !== clickHandler || $[10] !== keyDownHandler || $[11] !== loadingCounters || $[12] !== props || $[13] !== t3) {
|
|
127
|
-
t4 = /*#__PURE__*/ jsx(UnderlineItem, {
|
|
128
|
-
as: "button",
|
|
129
|
-
role: "tab",
|
|
130
|
-
tabIndex: t3,
|
|
131
|
-
"aria-selected": ariaSelected,
|
|
132
|
-
type: "button",
|
|
133
|
-
onClick: clickHandler,
|
|
134
|
-
onKeyDown: keyDownHandler,
|
|
135
|
-
loadingCounters,
|
|
136
|
-
...props
|
|
137
|
-
});
|
|
138
|
-
$[8] = ariaSelected;
|
|
139
|
-
$[9] = clickHandler;
|
|
140
|
-
$[10] = keyDownHandler;
|
|
141
|
-
$[11] = loadingCounters;
|
|
142
|
-
$[12] = props;
|
|
143
|
-
$[13] = t3;
|
|
144
|
-
$[14] = t4;
|
|
145
|
-
} else t4 = $[14];
|
|
146
|
-
return t4;
|
|
90
|
+
const clickHandler = React.useCallback((event) => {
|
|
91
|
+
if (!event.defaultPrevented && typeof onSelect === "function") onSelect(event);
|
|
92
|
+
}, [onSelect]);
|
|
93
|
+
const keyDownHandler = React.useCallback((event) => {
|
|
94
|
+
if ((event.key === " " || event.key === "Enter") && !event.defaultPrevented && typeof onSelect === "function") onSelect(event);
|
|
95
|
+
}, [onSelect]);
|
|
96
|
+
return /*#__PURE__*/ jsx(UnderlineItem, {
|
|
97
|
+
as: "button",
|
|
98
|
+
role: "tab",
|
|
99
|
+
tabIndex: ariaSelected ? 0 : -1,
|
|
100
|
+
"aria-selected": ariaSelected,
|
|
101
|
+
type: "button",
|
|
102
|
+
onClick: clickHandler,
|
|
103
|
+
onKeyDown: keyDownHandler,
|
|
104
|
+
loadingCounters,
|
|
105
|
+
...props
|
|
106
|
+
});
|
|
147
107
|
};
|
|
108
|
+
TabImpl.displayName = "TabImpl";
|
|
148
109
|
TabImpl.displayName = "UnderlinePanels.Tab";
|
|
149
110
|
const Tab = /*#__PURE__*/ React.memo(TabImpl);
|
|
150
111
|
Tab.displayName = "UnderlinePanels.Tab";
|
|
151
|
-
const Panel = (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
$[0] = t0;
|
|
158
|
-
$[1] = children;
|
|
159
|
-
$[2] = rest;
|
|
160
|
-
} else {
|
|
161
|
-
children = $[1];
|
|
162
|
-
rest = $[2];
|
|
163
|
-
}
|
|
164
|
-
let t1;
|
|
165
|
-
if ($[3] !== children || $[4] !== rest) {
|
|
166
|
-
t1 = /*#__PURE__*/ jsx("div", {
|
|
167
|
-
role: "tabpanel",
|
|
168
|
-
...rest,
|
|
169
|
-
children
|
|
170
|
-
});
|
|
171
|
-
$[3] = children;
|
|
172
|
-
$[4] = rest;
|
|
173
|
-
$[5] = t1;
|
|
174
|
-
} else t1 = $[5];
|
|
175
|
-
return t1;
|
|
112
|
+
const Panel = ({ children, ...rest }) => {
|
|
113
|
+
return /*#__PURE__*/ jsx("div", {
|
|
114
|
+
role: "tabpanel",
|
|
115
|
+
...rest,
|
|
116
|
+
children
|
|
117
|
+
});
|
|
176
118
|
};
|
|
119
|
+
Panel.displayName = "Panel";
|
|
177
120
|
Panel.displayName = "UnderlinePanels.Panel";
|
|
178
121
|
var UnderlinePanels_default = Object.assign(UnderlinePanels, {
|
|
179
122
|
Panel,
|
|
@@ -21,9 +21,9 @@ function useControllableState({ name = "custom", defaultValue, value, onChange }
|
|
|
21
21
|
if (controlled.current === null) controlled.current = value !== void 0;
|
|
22
22
|
const setState = React.useCallback((stateOrUpdater) => {
|
|
23
23
|
var _stableOnChange$curre;
|
|
24
|
-
const
|
|
25
|
-
if (controlled.current === false) internalSetState(
|
|
26
|
-
(_stableOnChange$curre = stableOnChange.current) === null || _stableOnChange$curre === void 0 || _stableOnChange$curre.call(stableOnChange,
|
|
24
|
+
const value = typeof stateOrUpdater === "function" ? stateOrUpdater(state) : stateOrUpdater;
|
|
25
|
+
if (controlled.current === false) internalSetState(value);
|
|
26
|
+
(_stableOnChange$curre = stableOnChange.current) === null || _stableOnChange$curre === void 0 || _stableOnChange$curre.call(stableOnChange, value);
|
|
27
27
|
}, [state]);
|
|
28
28
|
React.useEffect(() => {
|
|
29
29
|
const controlledValue = value !== void 0;
|