@primer/react 38.32.0-rc.35f722e2e → 38.32.0-rc.3b269690b
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 +10 -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/PageHeader/PageHeader-b12247c8.css +2 -0
- package/dist/PageHeader/PageHeader-b12247c8.css.map +1 -0
- package/dist/PageHeader/PageHeader.js +64 -23
- package/dist/PageHeader/PageHeader.module.css.js +1 -1
- 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/PageHeader/PageHeader-5e969745.css +0 -2
- package/dist/PageHeader/PageHeader-5e969745.css.map +0 -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
|
@@ -3,7 +3,6 @@ import { IconButton } from "../Button/IconButton.js";
|
|
|
3
3
|
import { ButtonComponent } from "../Button/Button.js";
|
|
4
4
|
import { AnchoredOverlay } from "../AnchoredOverlay/AnchoredOverlay.js";
|
|
5
5
|
import LabelGroup_module_css_default from "./LabelGroup.module.css.js";
|
|
6
|
-
import { c } from "react-compiler-runtime";
|
|
7
6
|
import { clsx } from "clsx";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import React from "react";
|
|
@@ -14,108 +13,75 @@ const getOverlayWidth = (buttonClientRect, containerRef, overlayPaddingPx) => {
|
|
|
14
13
|
var _containerRef$current;
|
|
15
14
|
return overlayPaddingPx + buttonClientRect.right - (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect().left) || 0);
|
|
16
15
|
};
|
|
17
|
-
const InlineToggle = (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
const InlineToggle = ({ collapseButtonRef, collapseInlineExpandedChildren, expandButtonRef, hiddenItemIds, isOverflowShown, showAllTokensInline }) => isOverflowShown ? /*#__PURE__*/ jsx(ButtonComponent, {
|
|
17
|
+
ref: collapseButtonRef,
|
|
18
|
+
onClick: collapseInlineExpandedChildren,
|
|
19
|
+
size: "small",
|
|
20
|
+
variant: "invisible",
|
|
21
|
+
children: "Show less"
|
|
22
|
+
}) : hiddenItemIds.length ? /*#__PURE__*/ jsxs(ButtonComponent, {
|
|
23
|
+
ref: expandButtonRef,
|
|
24
|
+
variant: "invisible",
|
|
25
|
+
size: "small",
|
|
26
|
+
onClick: showAllTokensInline,
|
|
27
|
+
children: [/*#__PURE__*/ jsxs(VisuallyHidden, { children: [
|
|
28
|
+
"Show +",
|
|
29
|
+
hiddenItemIds.length,
|
|
30
|
+
" more"
|
|
31
|
+
] }), /*#__PURE__*/ jsxs("span", {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: ["+", hiddenItemIds.length]
|
|
34
|
+
})]
|
|
35
|
+
}) : null;
|
|
36
|
+
const OverlayToggle = ({ children, closeOverflowOverlay, expandButtonRef, hiddenItemIds, isOverflowShown, openOverflowOverlay, overlayPaddingPx, overlayWidth, totalLength }) => hiddenItemIds.length ? /*#__PURE__*/ jsx(AnchoredOverlay, {
|
|
37
|
+
open: isOverflowShown,
|
|
38
|
+
onOpen: openOverflowOverlay,
|
|
39
|
+
onClose: closeOverflowOverlay,
|
|
40
|
+
width: "auto",
|
|
41
|
+
height: "auto",
|
|
42
|
+
align: "start",
|
|
43
|
+
side: "inside-right",
|
|
44
|
+
anchorRef: expandButtonRef,
|
|
45
|
+
anchorOffset: overlayPaddingPx * -1,
|
|
46
|
+
alignmentOffset: overlayPaddingPx * -1,
|
|
47
|
+
renderAnchor: (props) => /*#__PURE__*/ jsxs(ButtonComponent, {
|
|
48
|
+
variant: "invisible",
|
|
49
|
+
size: "small",
|
|
50
|
+
...props,
|
|
51
|
+
ref: expandButtonRef,
|
|
52
|
+
children: [/*#__PURE__*/ jsxs(VisuallyHidden, { children: [
|
|
53
|
+
"Show +",
|
|
54
|
+
hiddenItemIds.length,
|
|
55
|
+
" more"
|
|
56
|
+
] }), /*#__PURE__*/ jsxs("span", {
|
|
57
|
+
"aria-hidden": "true",
|
|
58
|
+
children: ["+", hiddenItemIds.length]
|
|
59
|
+
})]
|
|
60
|
+
}),
|
|
61
|
+
focusZoneSettings: { disabled: true },
|
|
62
|
+
overlayProps: {
|
|
63
|
+
role: "dialog",
|
|
64
|
+
"aria-label": `All ${totalLength} labels`,
|
|
65
|
+
"aria-modal": true
|
|
66
|
+
},
|
|
67
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
68
|
+
className: LabelGroup_module_css_default.OverlayContainer,
|
|
69
|
+
style: {
|
|
70
|
+
width: overlayWidth,
|
|
71
|
+
padding: `${overlayPaddingPx}px`
|
|
72
|
+
},
|
|
73
|
+
children: [/*#__PURE__*/ jsx("div", {
|
|
74
|
+
className: LabelGroup_module_css_default.OverlayInner,
|
|
75
|
+
children
|
|
76
|
+
}), /*#__PURE__*/ jsx(IconButton, {
|
|
77
|
+
onClick: closeOverflowOverlay,
|
|
78
|
+
icon: XIcon,
|
|
79
|
+
"aria-label": "Close",
|
|
30
80
|
variant: "invisible",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
hiddenItemIds.length,
|
|
36
|
-
" more"
|
|
37
|
-
] }), /*#__PURE__*/ jsxs("span", {
|
|
38
|
-
"aria-hidden": "true",
|
|
39
|
-
children: ["+", hiddenItemIds.length]
|
|
40
|
-
})]
|
|
41
|
-
}) : null;
|
|
42
|
-
$[0] = collapseButtonRef;
|
|
43
|
-
$[1] = collapseInlineExpandedChildren;
|
|
44
|
-
$[2] = expandButtonRef;
|
|
45
|
-
$[3] = hiddenItemIds;
|
|
46
|
-
$[4] = isOverflowShown;
|
|
47
|
-
$[5] = showAllTokensInline;
|
|
48
|
-
$[6] = t1;
|
|
49
|
-
} else t1 = $[6];
|
|
50
|
-
return t1;
|
|
51
|
-
};
|
|
52
|
-
const OverlayToggle = (t0) => {
|
|
53
|
-
const $ = c(10);
|
|
54
|
-
const { children, closeOverflowOverlay, expandButtonRef, hiddenItemIds, isOverflowShown, openOverflowOverlay, overlayPaddingPx, overlayWidth, totalLength } = t0;
|
|
55
|
-
let t1;
|
|
56
|
-
if ($[0] !== children || $[1] !== closeOverflowOverlay || $[2] !== expandButtonRef || $[3] !== hiddenItemIds.length || $[4] !== isOverflowShown || $[5] !== openOverflowOverlay || $[6] !== overlayPaddingPx || $[7] !== overlayWidth || $[8] !== totalLength) {
|
|
57
|
-
t1 = hiddenItemIds.length ? /*#__PURE__*/ jsx(AnchoredOverlay, {
|
|
58
|
-
open: isOverflowShown,
|
|
59
|
-
onOpen: openOverflowOverlay,
|
|
60
|
-
onClose: closeOverflowOverlay,
|
|
61
|
-
width: "auto",
|
|
62
|
-
height: "auto",
|
|
63
|
-
align: "start",
|
|
64
|
-
side: "inside-right",
|
|
65
|
-
anchorRef: expandButtonRef,
|
|
66
|
-
anchorOffset: overlayPaddingPx * -1,
|
|
67
|
-
alignmentOffset: overlayPaddingPx * -1,
|
|
68
|
-
renderAnchor: (props) => /*#__PURE__*/ jsxs(ButtonComponent, {
|
|
69
|
-
variant: "invisible",
|
|
70
|
-
size: "small",
|
|
71
|
-
...props,
|
|
72
|
-
ref: expandButtonRef,
|
|
73
|
-
children: [/*#__PURE__*/ jsxs(VisuallyHidden, { children: [
|
|
74
|
-
"Show +",
|
|
75
|
-
hiddenItemIds.length,
|
|
76
|
-
" more"
|
|
77
|
-
] }), /*#__PURE__*/ jsxs("span", {
|
|
78
|
-
"aria-hidden": "true",
|
|
79
|
-
children: ["+", hiddenItemIds.length]
|
|
80
|
-
})]
|
|
81
|
-
}),
|
|
82
|
-
focusZoneSettings: { disabled: true },
|
|
83
|
-
overlayProps: {
|
|
84
|
-
role: "dialog",
|
|
85
|
-
"aria-label": `All ${totalLength} labels`,
|
|
86
|
-
"aria-modal": true
|
|
87
|
-
},
|
|
88
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
89
|
-
className: LabelGroup_module_css_default.OverlayContainer,
|
|
90
|
-
style: {
|
|
91
|
-
width: overlayWidth,
|
|
92
|
-
padding: `${overlayPaddingPx}px`
|
|
93
|
-
},
|
|
94
|
-
children: [/*#__PURE__*/ jsx("div", {
|
|
95
|
-
className: LabelGroup_module_css_default.OverlayInner,
|
|
96
|
-
children
|
|
97
|
-
}), /*#__PURE__*/ jsx(IconButton, {
|
|
98
|
-
onClick: closeOverflowOverlay,
|
|
99
|
-
icon: XIcon,
|
|
100
|
-
"aria-label": "Close",
|
|
101
|
-
variant: "invisible",
|
|
102
|
-
className: LabelGroup_module_css_default.CloseButton
|
|
103
|
-
})]
|
|
104
|
-
})
|
|
105
|
-
}) : null;
|
|
106
|
-
$[0] = children;
|
|
107
|
-
$[1] = closeOverflowOverlay;
|
|
108
|
-
$[2] = expandButtonRef;
|
|
109
|
-
$[3] = hiddenItemIds.length;
|
|
110
|
-
$[4] = isOverflowShown;
|
|
111
|
-
$[5] = openOverflowOverlay;
|
|
112
|
-
$[6] = overlayPaddingPx;
|
|
113
|
-
$[7] = overlayWidth;
|
|
114
|
-
$[8] = totalLength;
|
|
115
|
-
$[9] = t1;
|
|
116
|
-
} else t1 = $[9];
|
|
117
|
-
return t1;
|
|
118
|
-
};
|
|
81
|
+
className: LabelGroup_module_css_default.CloseButton
|
|
82
|
+
})]
|
|
83
|
+
})
|
|
84
|
+
}) : null;
|
|
119
85
|
const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as: Component = "ul", className }) => {
|
|
120
86
|
const containerRef = React.useRef(null);
|
|
121
87
|
const collapseButtonRef = React.useRef(null);
|
|
@@ -177,14 +143,14 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
177
143
|
if (!visibleChildCount || isOverflowShown) return;
|
|
178
144
|
if (visibleChildCount === "auto") {
|
|
179
145
|
const observer = new IntersectionObserver((entries) => {
|
|
180
|
-
const
|
|
146
|
+
const updatedEntries = {};
|
|
181
147
|
for (const entry of entries) {
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
148
|
+
const targetId = entry.target.getAttribute("data-index");
|
|
149
|
+
if (targetId) updatedEntries[targetId] = entry.isIntersecting;
|
|
184
150
|
}
|
|
185
151
|
setVisibilityMap((prev) => ({
|
|
186
152
|
...prev,
|
|
187
|
-
...
|
|
153
|
+
...updatedEntries
|
|
188
154
|
}));
|
|
189
155
|
}, {
|
|
190
156
|
root: containerRef.current,
|
|
@@ -230,10 +196,10 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
230
196
|
"data-list": isList || void 0,
|
|
231
197
|
className: clsx(className, LabelGroup_module_css_default.Container),
|
|
232
198
|
"data-component": "LabelGroup",
|
|
233
|
-
children: [React.Children.map(children, (
|
|
199
|
+
children: [React.Children.map(children, (child, index) => /*#__PURE__*/ jsx(ItemWrapperComponent, {
|
|
234
200
|
"data-index": index,
|
|
235
201
|
className: clsx(LabelGroup_module_css_default.ItemWrapper, { [LabelGroup_module_css_default["ItemWrapper--hidden"]]: hiddenItemIds.includes(index.toString()) }),
|
|
236
|
-
children:
|
|
202
|
+
children: child
|
|
237
203
|
}, index)), /*#__PURE__*/ jsx(ToggleWrapper, {
|
|
238
204
|
"data-component": "LabelGroup.Toggle",
|
|
239
205
|
children: overflowStyle === "inline" ? /*#__PURE__*/ jsx(InlineToggle, {
|
|
@@ -261,8 +227,8 @@ const LabelGroup = ({ children, visibleChildCount, overflowStyle = "overlay", as
|
|
|
261
227
|
"data-list": isList || void 0,
|
|
262
228
|
className: clsx(className, LabelGroup_module_css_default.Container),
|
|
263
229
|
"data-component": "LabelGroup",
|
|
264
|
-
children: isList ? React.Children.map(children, (
|
|
265
|
-
return /*#__PURE__*/ jsx("li", { children:
|
|
230
|
+
children: isList ? React.Children.map(children, (child, index) => {
|
|
231
|
+
return /*#__PURE__*/ jsx("li", { children: child }, index);
|
|
266
232
|
}) : children
|
|
267
233
|
});
|
|
268
234
|
};
|
package/dist/Overlay/Overlay.js
CHANGED
|
@@ -4,7 +4,6 @@ import { useOverlay } from "../hooks/useOverlay.js";
|
|
|
4
4
|
import Portal_default from "../Portal/index.js";
|
|
5
5
|
import { useFeatureFlag } from "../FeatureFlags/useFeatureFlag.js";
|
|
6
6
|
import Overlay_module_css_default from "./Overlay.module.css.js";
|
|
7
|
-
import { c } from "react-compiler-runtime";
|
|
8
7
|
import { clsx } from "clsx";
|
|
9
8
|
import { jsx } from "react/jsx-runtime";
|
|
10
9
|
import React, { useEffect, useRef } from "react";
|
|
@@ -82,179 +81,56 @@ const BaseOverlay = /*#__PURE__*/ React.forwardRef(({ visibility, height, width,
|
|
|
82
81
|
* @param width Sets the width of the `Overlay`, pick from our set list of widths, or pass `auto` to automatically set the width based on the content of the `Overlay`. `small` corresponds to `256px`, `medium` corresponds to `320px`, `large` corresponds to `480px`, `xlarge` corresponds to `640px`, `xxlarge` corresponds to `960px`.
|
|
83
82
|
|
|
84
83
|
*/
|
|
85
|
-
const Overlay = /*#__PURE__*/ React.forwardRef((
|
|
86
|
-
const $ = c(47);
|
|
87
|
-
let _PrivateDisablePortal;
|
|
88
|
-
let anchorSide;
|
|
89
|
-
let ignoreClickRefs;
|
|
90
|
-
let initialFocusRef;
|
|
91
|
-
let left;
|
|
92
|
-
let onClickOutside;
|
|
93
|
-
let onEscape;
|
|
94
|
-
let portalContainerName;
|
|
95
|
-
let preventFocusOnOpen;
|
|
96
|
-
let props;
|
|
97
|
-
let responsiveVariant;
|
|
98
|
-
let returnFocusRef;
|
|
99
|
-
let right;
|
|
100
|
-
let t1;
|
|
101
|
-
let t2;
|
|
102
|
-
let t3;
|
|
103
|
-
let t4;
|
|
104
|
-
let t5;
|
|
105
|
-
if ($[0] !== t0) {
|
|
106
|
-
({anchorSide, _PrivateDisablePortal, height: t1, ignoreClickRefs, initialFocusRef, left, onClickOutside, onEscape, portalContainerName, preventOverflow: t2, preventFocusOnOpen, returnFocusRef, right, role: t3, visibility: t4, width: t5, responsiveVariant, ...props} = t0);
|
|
107
|
-
$[0] = t0;
|
|
108
|
-
$[1] = _PrivateDisablePortal;
|
|
109
|
-
$[2] = anchorSide;
|
|
110
|
-
$[3] = ignoreClickRefs;
|
|
111
|
-
$[4] = initialFocusRef;
|
|
112
|
-
$[5] = left;
|
|
113
|
-
$[6] = onClickOutside;
|
|
114
|
-
$[7] = onEscape;
|
|
115
|
-
$[8] = portalContainerName;
|
|
116
|
-
$[9] = preventFocusOnOpen;
|
|
117
|
-
$[10] = props;
|
|
118
|
-
$[11] = responsiveVariant;
|
|
119
|
-
$[12] = returnFocusRef;
|
|
120
|
-
$[13] = right;
|
|
121
|
-
$[14] = t1;
|
|
122
|
-
$[15] = t2;
|
|
123
|
-
$[16] = t3;
|
|
124
|
-
$[17] = t4;
|
|
125
|
-
$[18] = t5;
|
|
126
|
-
} else {
|
|
127
|
-
_PrivateDisablePortal = $[1];
|
|
128
|
-
anchorSide = $[2];
|
|
129
|
-
ignoreClickRefs = $[3];
|
|
130
|
-
initialFocusRef = $[4];
|
|
131
|
-
left = $[5];
|
|
132
|
-
onClickOutside = $[6];
|
|
133
|
-
onEscape = $[7];
|
|
134
|
-
portalContainerName = $[8];
|
|
135
|
-
preventFocusOnOpen = $[9];
|
|
136
|
-
props = $[10];
|
|
137
|
-
responsiveVariant = $[11];
|
|
138
|
-
returnFocusRef = $[12];
|
|
139
|
-
right = $[13];
|
|
140
|
-
t1 = $[14];
|
|
141
|
-
t2 = $[15];
|
|
142
|
-
t3 = $[16];
|
|
143
|
-
t4 = $[17];
|
|
144
|
-
t5 = $[18];
|
|
145
|
-
}
|
|
146
|
-
const height = t1 === void 0 ? "auto" : t1;
|
|
147
|
-
const preventOverflow = t2 === void 0 ? true : t2;
|
|
148
|
-
const role = t3 === void 0 ? "none" : t3;
|
|
149
|
-
const visibility = t4 === void 0 ? "visible" : t4;
|
|
150
|
-
const width = t5 === void 0 ? "auto" : t5;
|
|
84
|
+
const Overlay = /*#__PURE__*/ React.forwardRef(({ anchorSide, _PrivateDisablePortal, height = "auto", ignoreClickRefs, initialFocusRef, left, onClickOutside, onEscape, portalContainerName, preventOverflow = true, preventFocusOnOpen, returnFocusRef, right, role = "none", visibility = "visible", width = "auto", responsiveVariant, ...props }, forwardedRef) => {
|
|
151
85
|
const overlayRef = useRef(null);
|
|
152
86
|
const mergedOverlayRef = useMergedRefs(forwardedRef, overlayRef);
|
|
87
|
+
const slideAnimationDistance = 8;
|
|
88
|
+
const slideAnimationEasing = "cubic-bezier(0.33, 1, 0.68, 1)";
|
|
153
89
|
const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
$
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
$
|
|
169
|
-
|
|
170
|
-
$
|
|
171
|
-
$
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
let t7;
|
|
175
|
-
let t8;
|
|
176
|
-
if ($[26] !== height) {
|
|
177
|
-
t7 = () => {
|
|
178
|
-
var _overlayRef$current;
|
|
179
|
-
if (height === "initial" && (_overlayRef$current = overlayRef.current) !== null && _overlayRef$current !== void 0 && _overlayRef$current.clientHeight) overlayRef.current.style.height = `${overlayRef.current.clientHeight}px`;
|
|
180
|
-
};
|
|
181
|
-
t8 = [height];
|
|
182
|
-
$[26] = height;
|
|
183
|
-
$[27] = t7;
|
|
184
|
-
$[28] = t8;
|
|
185
|
-
} else {
|
|
186
|
-
t7 = $[27];
|
|
187
|
-
t8 = $[28];
|
|
188
|
-
}
|
|
189
|
-
useEffect(t7, t8);
|
|
190
|
-
let t10;
|
|
191
|
-
let t9;
|
|
192
|
-
if ($[29] !== anchorSide || $[30] !== visibility) {
|
|
193
|
-
t9 = () => {
|
|
194
|
-
var _overlayRef$current2;
|
|
195
|
-
const { x, y } = getSlideAnimationStartingVector(anchorSide);
|
|
196
|
-
if (!x && !y || !((_overlayRef$current2 = overlayRef.current) !== null && _overlayRef$current2 !== void 0 && _overlayRef$current2.animate) || visibility === "hidden") return;
|
|
197
|
-
overlayRef.current.animate({ transform: [`translate(${8 * x}px, ${8 * y}px)`, "translate(0, 0)"] }, {
|
|
198
|
-
duration: animationDuration,
|
|
199
|
-
easing: "cubic-bezier(0.33, 1, 0.68, 1)"
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
t10 = [
|
|
203
|
-
anchorSide,
|
|
204
|
-
8,
|
|
205
|
-
"cubic-bezier(0.33, 1, 0.68, 1)",
|
|
206
|
-
visibility
|
|
207
|
-
];
|
|
208
|
-
$[29] = anchorSide;
|
|
209
|
-
$[30] = visibility;
|
|
210
|
-
$[31] = t10;
|
|
211
|
-
$[32] = t9;
|
|
212
|
-
} else {
|
|
213
|
-
t10 = $[31];
|
|
214
|
-
t9 = $[32];
|
|
215
|
-
}
|
|
216
|
-
useIsomorphicLayoutEffect(t9, t10);
|
|
217
|
-
const leftPosition = left === void 0 && right === void 0 ? 0 : left;
|
|
218
|
-
const t11 = !preventOverflow ? true : void 0;
|
|
219
|
-
let t12;
|
|
220
|
-
if ($[33] !== height || $[34] !== leftPosition || $[35] !== mergedOverlayRef || $[36] !== props || $[37] !== responsiveVariant || $[38] !== right || $[39] !== role || $[40] !== t11 || $[41] !== visibility || $[42] !== width) {
|
|
221
|
-
t12 = /*#__PURE__*/ jsx(BaseOverlay, {
|
|
222
|
-
role,
|
|
223
|
-
width,
|
|
224
|
-
"data-reflow-container": t11,
|
|
225
|
-
ref: mergedOverlayRef,
|
|
226
|
-
left: leftPosition,
|
|
227
|
-
right,
|
|
228
|
-
height,
|
|
229
|
-
visibility,
|
|
230
|
-
"data-responsive": responsiveVariant,
|
|
231
|
-
...props
|
|
90
|
+
useOverlay({
|
|
91
|
+
overlayRef,
|
|
92
|
+
returnFocusRef,
|
|
93
|
+
onEscape,
|
|
94
|
+
ignoreClickRefs,
|
|
95
|
+
onClickOutside,
|
|
96
|
+
initialFocusRef,
|
|
97
|
+
preventFocusOnOpen
|
|
98
|
+
});
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
var _overlayRef$current;
|
|
101
|
+
if (height === "initial" && (_overlayRef$current = overlayRef.current) !== null && _overlayRef$current !== void 0 && _overlayRef$current.clientHeight) overlayRef.current.style.height = `${overlayRef.current.clientHeight}px`;
|
|
102
|
+
}, [height]);
|
|
103
|
+
useIsomorphicLayoutEffect(() => {
|
|
104
|
+
var _overlayRef$current2;
|
|
105
|
+
const { x, y } = getSlideAnimationStartingVector(anchorSide);
|
|
106
|
+
if (!x && !y || !((_overlayRef$current2 = overlayRef.current) !== null && _overlayRef$current2 !== void 0 && _overlayRef$current2.animate) || visibility === "hidden") return;
|
|
107
|
+
overlayRef.current.animate({ transform: [`translate(${slideAnimationDistance * x}px, ${slideAnimationDistance * y}px)`, `translate(0, 0)`] }, {
|
|
108
|
+
duration: animationDuration,
|
|
109
|
+
easing: slideAnimationEasing
|
|
232
110
|
});
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
111
|
+
}, [
|
|
112
|
+
anchorSide,
|
|
113
|
+
slideAnimationDistance,
|
|
114
|
+
slideAnimationEasing,
|
|
115
|
+
visibility
|
|
116
|
+
]);
|
|
117
|
+
const overlayContent = /*#__PURE__*/ jsx(BaseOverlay, {
|
|
118
|
+
role,
|
|
119
|
+
width,
|
|
120
|
+
"data-reflow-container": !preventOverflow ? true : void 0,
|
|
121
|
+
ref: mergedOverlayRef,
|
|
122
|
+
left: left === void 0 && right === void 0 ? 0 : left,
|
|
123
|
+
right,
|
|
124
|
+
height,
|
|
125
|
+
visibility,
|
|
126
|
+
"data-responsive": responsiveVariant,
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
246
129
|
if (_PrivateDisablePortal && cssAnchorPositioning) return overlayContent;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
children: overlayContent
|
|
252
|
-
});
|
|
253
|
-
$[44] = overlayContent;
|
|
254
|
-
$[45] = portalContainerName;
|
|
255
|
-
$[46] = t13;
|
|
256
|
-
} else t13 = $[46];
|
|
257
|
-
return t13;
|
|
130
|
+
return /*#__PURE__*/ jsx(Portal_default, {
|
|
131
|
+
containerName: portalContainerName,
|
|
132
|
+
children: overlayContent
|
|
133
|
+
});
|
|
258
134
|
});
|
|
259
135
|
//#endregion
|
|
260
136
|
export { BaseOverlay, Overlay as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-PageHeader-PageHeader-YLwBQ{--grid-row-order-context-area:1;--grid-row-order-leading-action:2;--grid-row-order-breadcrumbs:2;--grid-row-order-title-area:2;--grid-row-order-trailing-action:2;--grid-row-order-actions:2;--grid-row-order-description:3;--grid-row-order-navigation:4;--title-area-region-order-leading-visual:0;--title-area-region-order-title:1;--title-area-region-order-trailing-visual:2;--context-area-region-order-parent-link:0;--context-area-region-order-context-bar:1;--context-area-region-order-context-area-actions:2;display:grid;grid-template-areas:"context-area context-area context-area context-area context-area" "leading-action breadcrumbs title-area trailing-action actions" "description description description description description" "navigation navigation navigation navigation navigation";grid-template-columns:auto auto auto auto 1fr}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant=large]{font-size:var(--custom-font-size,var(--text-title-size-large,2rem));font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400));line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant=medium]{font-weight:var(--custom-font-weight,var(--base-text-weight-semibold,600))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant=medium],.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant=subtitle]{font-size:var(--custom-font-size,var(--text-title-size-medium,1.25rem));line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant=subtitle]{font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400))}@media (max-width:calc(48rem - 0.02px)){.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-narrow=large]{font-size:var(--custom-font-size,var(--text-title-size-large,2rem));font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400));line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-narrow=medium]{font-weight:var(--custom-font-weight,var(--base-text-weight-semibold,600))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-narrow=medium],.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-narrow=subtitle]{font-size:var(--custom-font-size,var(--text-title-size-medium,1.25rem));line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-narrow=subtitle]{font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400))}}@media (min-width:48rem){.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-regular=large]{font-size:var(--custom-font-size,var(--text-title-size-large,2rem));font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400));line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-regular=medium]{font-weight:var(--custom-font-weight,var(--base-text-weight-semibold,600))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-regular=medium],.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-regular=subtitle]{font-size:var(--custom-font-size,var(--text-title-size-medium,1.25rem));line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-regular=subtitle]{font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400))}}@media (min-width:87.5rem){.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-wide=large]{font-size:var(--custom-font-size,var(--text-title-size-large,2rem));font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400));line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-large,1.5))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-wide=medium]{font-weight:var(--custom-font-weight,var(--base-text-weight-semibold,600))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-wide=medium],.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-wide=subtitle]{font-size:var(--custom-font-size,var(--text-title-size-medium,1.25rem));line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6));--title-line-height:var(--custom-line-height,var(--text-title-lineHeight-medium,1.6))}.prc-PageHeader-PageHeader-YLwBQ[data-title-size-variant-wide=subtitle]{font-weight:var(--custom-font-weight,var(--base-text-weight-normal,400))}}.prc-PageHeader-PageHeader-YLwBQ[data-has-border=true]:not([data-has-nav]),.prc-PageHeader-PageHeader-YLwBQ[data-has-border=true][data-nav-hidden-all]{border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);padding-block-end:var(--base-size-8,.5rem)}@media (max-width:calc(48rem - 0.02px)){.prc-PageHeader-PageHeader-YLwBQ[data-has-border=true][data-nav-hidden-narrow]{border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);padding-block-end:var(--base-size-8,.5rem)}}@media (min-width:48rem){.prc-PageHeader-PageHeader-YLwBQ[data-has-border=true][data-nav-hidden-regular]{border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);padding-block-end:var(--base-size-8,.5rem)}}@media (min-width:87.5rem){.prc-PageHeader-PageHeader-YLwBQ[data-has-border=true][data-nav-hidden-wide]{border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);padding-block-end:var(--base-size-8,.5rem)}}.prc-PageHeader-PageHeader-YLwBQ [data-component=PH_Actions],.prc-PageHeader-PageHeader-YLwBQ [data-component=PH_LeadingAction],.prc-PageHeader-PageHeader-YLwBQ [data-component=PH_LeadingVisual],.prc-PageHeader-PageHeader-YLwBQ [data-component=PH_TrailingAction],.prc-PageHeader-PageHeader-YLwBQ [data-component=PH_TrailingVisual]{height:calc(var(--title-line-height)*1em)}.prc-PageHeader-PageHeader-YLwBQ [data-hidden-all]{display:none}@media (max-width:calc(48rem - 0.02px)){.prc-PageHeader-PageHeader-YLwBQ [data-hidden-narrow]{display:none}}@media (min-width:48rem){.prc-PageHeader-PageHeader-YLwBQ [data-hidden-regular]{display:none}}@media (min-width:87.5rem){.prc-PageHeader-PageHeader-YLwBQ [data-hidden-wide]{display:none}}.prc-PageHeader-ContextArea-ueeWv{flex-direction:row;font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-normal,400);grid-area:context-area;grid-row:var(--grid-row-order-context-area);line-height:var(--text-body-lineHeight-medium,1.4285);padding-bottom:var(--base-size-8,.5rem)}.prc-PageHeader-ContextArea-ueeWv,.prc-PageHeader-ParentLink-AJ9VB{align-items:center;display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-PageHeader-ParentLink-AJ9VB{order:var(--context-area-region-order-parent-link)}.prc-PageHeader-ContextBar-8AoJ5{display:flex;order:var(--context-area-region-order-context-bar)}.prc-PageHeader-ContextAreaActions-DLQP5{align-items:center;flex-grow:1;justify-content:flex-end;order:var(--context-area-region-order-context-area-actions)}.prc-PageHeader-ContextAreaActions-DLQP5,.prc-PageHeader-TitleArea-2n2J0{display:flex;flex-direction:row;gap:var(--stack-gap-condensed,.5rem)}.prc-PageHeader-TitleArea-2n2J0{align-items:flex-start;grid-area:title-area;grid-row:var(--grid-row-order-title-area)}.prc-PageHeader-LeadingAction-4NMe9{grid-area:leading-action;grid-row:var(--grid-row-order-leading-action)}.prc-PageHeader-Breadcrumbs-FGVQU,.prc-PageHeader-LeadingAction-4NMe9{align-items:center;display:flex;padding-right:var(--base-size-8,.5rem)}.prc-PageHeader-Breadcrumbs-FGVQU{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-normal,400);grid-area:breadcrumbs;grid-row:var(--grid-row-order-breadcrumbs);line-height:var(--text-body-lineHeight-medium,1.4285)}.prc-PageHeader-LeadingVisual-njece{align-items:center;display:flex;order:var(--title-area-region-order-leading-visual)}.prc-PageHeader-Title-p0Mgh{display:block;font-size:inherit;font-weight:inherit;order:var(--title-area-region-order-title)}.prc-PageHeader-Title-p0Mgh:where([data-hidden=true]){display:none}.prc-PageHeader-TrailingVisual-Zb96K{align-items:center;display:flex;order:var(--title-area-region-order-trailing-visual)}.prc-PageHeader-TrailingAction-xqlZJ{grid-area:trailing-action;grid-row:var(--grid-row-order-trailing-action)}.prc-PageHeader-Actions-wawWm,.prc-PageHeader-TrailingAction-xqlZJ{align-items:center;display:flex;padding-left:var(--base-size-8,.5rem)}.prc-PageHeader-Actions-wawWm{flex-direction:row;gap:var(--stack-gap-condensed,.5rem);grid-area:actions;grid-row:var(--grid-row-order-actions);justify-content:flex-end;min-width:max-content}.prc-PageHeader-Description-w-ejP{align-items:center;display:flex;flex-direction:row;gap:var(--stack-gap-condensed,.5rem);grid-area:description;grid-row:var(--grid-row-order-description)}.prc-PageHeader-Description-w-ejP,.prc-PageHeader-Navigation--uLav{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-normal,400);line-height:var(--text-body-lineHeight-medium,1.4285);padding-top:var(--base-size-8,.5rem)}.prc-PageHeader-Navigation--uLav{display:block;grid-area:navigation;grid-row:var(--grid-row-order-navigation)}
|
|
2
|
+
/*# sourceMappingURL=PageHeader-b12247c8.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/PageHeader/PageHeader.module.css.js"],"names":[],"mappings":"AAAA,iCAEE,+BAAgC,CAChC,iCAAkC,CAClC,8BAA+B,CAC/B,6BAA8B,CAC9B,kCAAmC,CACnC,0BAA2B,CAC3B,8BAA+B,CAC/B,6BAA8B,CAG9B,0CAA2C,CAC3C,iCAAkC,CAClC,2CAA4C,CAG5C,yCAA0C,CAC1C,yCAA0C,CAC1C,kDAAmD,CAEnD,YAAa,CAIb,6QAI0D,CAL1D,6CA+KF,CA/JE,gEACE,mEAAsE,CACtE,wEAA2E,CAC3E,4EAA+E,CAE/E,oFACF,CAEA,iEAEE,0EAIF,CAEA,oIAPE,uEAA0E,CAE1E,6EAAgF,CAEhF,qFASF,CANA,mEAEE,wEAIF,CAGA,wCACE,uEACE,mEAAsE,CACtE,wEAA2E,CAC3E,4EAA+E,CAE/E,oFACF,CAEA,wEAEE,0EAIF,CAEA,kJAPE,uEAA0E,CAE1E,6EAAgF,CAEhF,qFASF,CANA,0EAEE,wEAIF,CACF,CAEA,yBACE,wEACE,mEAAsE,CACtE,wEAA2E,CAC3E,4EAA+E,CAE/E,oFACF,CAEA,yEAEE,0EAIF,CAEA,oJAPE,uEAA0E,CAE1E,6EAAgF,CAEhF,qFASF,CANA,2EAEE,wEAIF,CACF,CAEA,2BACE,qEACE,mEAAsE,CACtE,wEAA2E,CAC3E,4EAA+E,CAE/E,oFACF,CAEA,sEAEE,0EAIF,CAEA,8IAPE,uEAA0E,CAE1E,6EAAgF,CAEhF,qFASF,CANA,wEAEE,wEAIF,CACF,CAEA,uJAEE,0FAA0E,CAC1E,0CACF,CAEA,wCACE,+EACE,0FAA0E,CAC1E,0CACF,CACF,CAEA,yBACE,gFACE,0FAA0E,CAC1E,0CACF,CACF,CAEA,2BACE,6EACE,0FAA0E,CAC1E,0CACF,CACF,CAEA,2UAKE,yCACF,CAEA,mDACE,YACF,CAGE,wCADF,sDAEI,YAEJ,CADE,CAIA,yBADF,uDAEI,YAEJ,CADE,CAIA,2BADF,oDAEI,YAEJ,CADE,CAIJ,kCAME,kBAAmB,CAHnB,8CAAiD,CACjD,8CAA2C,CAI3C,sBAAuB,CADvB,2CAA4C,CAF5C,qDAAuD,CAHvD,uCASF,CAEA,mEAJE,kBAAmB,CARnB,YAAa,CASb,oCAQF,CALA,iCAGE,kDAEF,CAEA,iCACE,YAAa,CACb,kDACF,CAEA,yCAIE,kBAAmB,CAEnB,WAAY,CACZ,wBAAyB,CAJzB,2DAKF,CAEA,yEATE,YAAa,CACb,kBAAmB,CAGnB,oCAYF,CAPA,gCAME,sBAAuB,CAJvB,oBAAqB,CADrB,yCAMF,CAEA,oCAIE,wBAAyB,CADzB,6CAGF,CAEA,sEAHE,kBAAmB,CAJnB,YAAa,CACb,sCAeF,CATA,kCAGE,8CAAiD,CACjD,8CAA2C,CAG3C,qBAAsB,CADtB,0CAA2C,CAD3C,qDAIF,CAEA,oCAIE,kBAAmB,CAFnB,YAAa,CACb,mDAEF,CAEA,4BAEE,aAAc,CAEd,iBAAkB,CAClB,mBAAoB,CAFpB,0CAGF,CAEA,sDACE,YACF,CAEA,qCAIE,kBAAmB,CAFnB,YAAa,CACb,oDAEF,CAEA,qCAIE,yBAA0B,CAD1B,8CAGF,CAEA,mEAHE,kBAAmB,CAJnB,YAAa,CACb,qCAgBF,CAVA,8BAIE,kBAAmB,CAGnB,oCAA+B,CAD/B,iBAAkB,CADlB,sCAAuC,CAGvC,wBAAyB,CANzB,qBAQF,CAEA,kCASE,kBAAmB,CARnB,YAAa,CAKb,kBAAmB,CAInB,oCAA+B,CAF/B,qBAAsB,CADtB,0CAIF,CAEA,mEAVE,8CAAiD,CACjD,8CAA2C,CAC3C,qDAAuD,CAHvD,oCAmBF,CARA,iCACE,aAAc,CAMd,oBAAqB,CADrB,yCAEF","file":"PageHeader-b12247c8.css","sourcesContent":[".PageHeader {\n /* Grid Row Order */\n --grid-row-order-context-area: 1;\n --grid-row-order-leading-action: 2;\n --grid-row-order-breadcrumbs: 2;\n --grid-row-order-title-area: 2;\n --grid-row-order-trailing-action: 2;\n --grid-row-order-actions: 2;\n --grid-row-order-description: 3;\n --grid-row-order-navigation: 4;\n\n /* Title Area Region Order */\n --title-area-region-order-leading-visual: 0;\n --title-area-region-order-title: 1;\n --title-area-region-order-trailing-visual: 2;\n\n /* Context Area Region Order */\n --context-area-region-order-parent-link: 0;\n --context-area-region-order-context-bar: 1;\n --context-area-region-order-context-area-actions: 2;\n\n display: grid;\n\n /* We have max 5 columns. */\n grid-template-columns: auto auto auto auto 1fr;\n grid-template-areas:\n 'context-area context-area context-area context-area context-area'\n 'leading-action breadcrumbs title-area trailing-action actions'\n 'description description description description description'\n 'navigation navigation navigation navigation navigation';\n\n /*\n line-height is calculated with calc(height/font-size) and the below numbers are from @primer/primitives.\n --custom-font-size, --custom-line-height, --custom-font-weight are custom properties that can be used to override the below values.\n We don't want these values to be overridden but still want to allow consumers to override them if needed.\n\n Size + nav-visibility data attributes are hoisted to the root by the React\n component to keep selectors as plain attribute matches (cheap) rather than\n relying on `:has()` (per-descendant invalidation).\n */\n &[data-title-size-variant='large'] {\n font-size: var(--custom-font-size, var(--text-title-size-large, 2rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5)); /* calc(48/32) */\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n }\n\n &[data-title-size-variant='medium'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-semibold, 600));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6)); /* calc(32/20) */\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n\n &[data-title-size-variant='subtitle'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6)); /* calc(32/20) */\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n\n /* Responsive size variants */\n @media (--viewportRange-narrow) {\n &[data-title-size-variant-narrow='large'] {\n font-size: var(--custom-font-size, var(--text-title-size-large, 2rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n }\n\n &[data-title-size-variant-narrow='medium'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-semibold, 600));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n\n &[data-title-size-variant-narrow='subtitle'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-title-size-variant-regular='large'] {\n font-size: var(--custom-font-size, var(--text-title-size-large, 2rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n }\n\n &[data-title-size-variant-regular='medium'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-semibold, 600));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n\n &[data-title-size-variant-regular='subtitle'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-title-size-variant-wide='large'] {\n font-size: var(--custom-font-size, var(--text-title-size-large, 2rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-large, 1.5));\n }\n\n &[data-title-size-variant-wide='medium'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-semibold, 600));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n\n &[data-title-size-variant-wide='subtitle'] {\n font-size: var(--custom-font-size, var(--text-title-size-medium, 1.25rem));\n font-weight: var(--custom-font-weight, var(--base-text-weight-normal, 400));\n line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n\n --title-line-height: var(--custom-line-height, var(--text-title-lineHeight-medium, 1.6));\n }\n }\n\n &[data-has-border='true'][data-nav-hidden-all],\n &[data-has-border='true']:not([data-has-nav]) {\n border-block-end: var(--borderWidth-thin) solid var(--borderColor-default);\n padding-block-end: var(--base-size-8);\n }\n\n @media (--viewportRange-narrow) {\n &[data-has-border='true'][data-nav-hidden-narrow] {\n border-block-end: var(--borderWidth-thin) solid var(--borderColor-default);\n padding-block-end: var(--base-size-8);\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-has-border='true'][data-nav-hidden-regular] {\n border-block-end: var(--borderWidth-thin) solid var(--borderColor-default);\n padding-block-end: var(--base-size-8);\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-has-border='true'][data-nav-hidden-wide] {\n border-block-end: var(--borderWidth-thin) solid var(--borderColor-default);\n padding-block-end: var(--base-size-8);\n }\n }\n\n & [data-component='PH_LeadingAction'],\n & [data-component='PH_TrailingAction'],\n & [data-component='PH_Actions'],\n & [data-component='PH_LeadingVisual'],\n & [data-component='PH_TrailingVisual'] {\n height: calc(var(--title-line-height) * 1em);\n }\n\n & [data-hidden-all] {\n display: none;\n }\n\n & [data-hidden-narrow] {\n @media (--viewportRange-narrow) {\n display: none;\n }\n }\n\n & [data-hidden-regular] {\n @media (--viewportRange-regular) {\n display: none;\n }\n }\n\n & [data-hidden-wide] {\n @media (--viewportRange-wide) {\n display: none;\n }\n }\n}\n\n.ContextArea {\n display: flex;\n padding-bottom: var(--base-size-8);\n font-size: var(--text-body-size-medium, 0.875rem);\n font-weight: var(--base-text-weight-normal);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n flex-direction: row;\n grid-row: var(--grid-row-order-context-area);\n grid-area: context-area;\n align-items: center;\n gap: var(--stack-gap-condensed);\n}\n\n.ParentLink {\n display: flex;\n align-items: center;\n order: var(--context-area-region-order-parent-link);\n gap: var(--stack-gap-condensed);\n}\n\n.ContextBar {\n display: flex;\n order: var(--context-area-region-order-context-bar);\n}\n\n.ContextAreaActions {\n display: flex;\n flex-direction: row;\n order: var(--context-area-region-order-context-area-actions);\n align-items: center;\n gap: var(--stack-gap-condensed);\n flex-grow: 1;\n justify-content: flex-end;\n}\n\n.TitleArea {\n grid-row: var(--grid-row-order-title-area);\n grid-area: title-area;\n display: flex;\n gap: var(--stack-gap-condensed);\n flex-direction: row;\n align-items: flex-start;\n}\n\n.LeadingAction {\n display: flex;\n padding-right: var(--base-size-8);\n grid-row: var(--grid-row-order-leading-action);\n grid-area: leading-action;\n align-items: center;\n}\n\n.Breadcrumbs {\n display: flex;\n padding-right: var(--base-size-8);\n font-size: var(--text-body-size-medium, 0.875rem);\n font-weight: var(--base-text-weight-normal);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n grid-row: var(--grid-row-order-breadcrumbs);\n grid-area: breadcrumbs;\n align-items: center;\n}\n\n.LeadingVisual {\n /* using flex and order to display the leading visual in the title area. */\n display: flex;\n order: var(--title-area-region-order-leading-visual);\n align-items: center;\n}\n\n.Title {\n /* using flex and order to display the title in the title area. */\n display: block;\n order: var(--title-area-region-order-title);\n font-size: inherit;\n font-weight: inherit;\n}\n\n.Title:where([data-hidden='true']) {\n display: none;\n}\n\n.TrailingVisual {\n /* using flex and order to display the trailing visual in the title area. */\n display: flex;\n order: var(--title-area-region-order-trailing-visual);\n align-items: center;\n}\n\n.TrailingAction {\n display: flex;\n padding-left: var(--base-size-8);\n grid-row: var(--grid-row-order-trailing-action);\n grid-area: trailing-action;\n align-items: center;\n}\n\n.Actions {\n display: flex;\n min-width: max-content;\n padding-left: var(--base-size-8);\n flex-direction: row;\n grid-row: var(--grid-row-order-actions);\n grid-area: actions;\n gap: var(--stack-gap-condensed);\n justify-content: flex-end;\n align-items: center;\n}\n\n.Description {\n display: flex;\n padding-top: var(--base-size-8);\n font-size: var(--text-body-size-medium, 0.875rem);\n font-weight: var(--base-text-weight-normal);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n flex-direction: row;\n grid-row: var(--grid-row-order-description);\n grid-area: description;\n align-items: center;\n gap: var(--stack-gap-condensed);\n}\n\n.Navigation {\n display: block;\n padding-top: var(--base-size-8);\n font-size: var(--text-body-size-medium, 0.875rem);\n font-weight: var(--base-text-weight-normal);\n line-height: var(--text-body-lineHeight-medium, 1.4285);\n grid-row: var(--grid-row-order-navigation);\n grid-area: navigation;\n}\n"]}
|
|
@@ -24,10 +24,33 @@ const hiddenOnNarrow = {
|
|
|
24
24
|
wide: false
|
|
25
25
|
};
|
|
26
26
|
const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
27
|
-
const $ = c(
|
|
27
|
+
const $ = c(17);
|
|
28
28
|
const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
|
|
29
29
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
30
30
|
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
31
|
+
const hoistChildState = (nodes) => {
|
|
32
|
+
const result = { hasNavigation: false };
|
|
33
|
+
for (const child of React.Children.toArray(nodes)) {
|
|
34
|
+
if (!/*#__PURE__*/ React.isValidElement(child)) continue;
|
|
35
|
+
if (child.type === React.Fragment) {
|
|
36
|
+
const nested = hoistChildState(child.props.children);
|
|
37
|
+
if (nested.titleVariant !== void 0) result.titleVariant = nested.titleVariant;
|
|
38
|
+
if (nested.hasNavigation) {
|
|
39
|
+
result.hasNavigation = true;
|
|
40
|
+
result.navigationHidden = nested.navigationHidden;
|
|
41
|
+
}
|
|
42
|
+
} else if (child.type === TitleArea) {
|
|
43
|
+
var _variant;
|
|
44
|
+
result.titleVariant = (_variant = child.props.variant) !== null && _variant !== void 0 ? _variant : "medium";
|
|
45
|
+
} else if (child.type === Navigation) {
|
|
46
|
+
var _hidden;
|
|
47
|
+
result.hasNavigation = true;
|
|
48
|
+
result.navigationHidden = (_hidden = child.props.hidden) !== null && _hidden !== void 0 ? _hidden : false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
const { titleVariant, hasNavigation, navigationHidden } = hoistChildState(children);
|
|
31
54
|
const isInteractive = _temp;
|
|
32
55
|
let t2;
|
|
33
56
|
let t3;
|
|
@@ -38,11 +61,11 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
38
61
|
if (!rootRef.current || rootRef.current.children.length <= 0) return;
|
|
39
62
|
const titleArea = Array.from(rootRef.current.children).find(_temp2);
|
|
40
63
|
if (!titleArea) return;
|
|
41
|
-
for (const
|
|
42
|
-
if (/*#__PURE__*/ React.isValidElement(
|
|
43
|
-
if (/*#__PURE__*/ React.isValidElement(
|
|
64
|
+
for (const child_1 of React.Children.toArray(children)) {
|
|
65
|
+
if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === ContextArea || isSlot(child_1, ContextArea))) hasContextArea = true;
|
|
66
|
+
if (/*#__PURE__*/ React.isValidElement(child_1) && (child_1.type === LeadingAction || isSlot(child_1, LeadingAction))) hasLeadingAction = true;
|
|
44
67
|
}
|
|
45
|
-
warning(Array.from(titleArea.childNodes).some((
|
|
68
|
+
warning(Array.from(titleArea.childNodes).some((child_2) => child_2 instanceof HTMLElement && isInteractive(child_2) || Array.from(child_2.childNodes).some((child_3) => child_3 instanceof HTMLElement && isInteractive(child_3))) && (hasContextArea || hasLeadingAction), "When PageHeader.ContextArea or PageHeader.LeadingAction is present, we recommended not to include any interactive items in the PageHeader.TitleArea to make sure the focus order is logical.");
|
|
46
69
|
};
|
|
47
70
|
t3 = [children, rootRef];
|
|
48
71
|
$[0] = children;
|
|
@@ -60,14 +83,21 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
60
83
|
$[4] = className;
|
|
61
84
|
$[5] = t4;
|
|
62
85
|
} else t4 = $[5];
|
|
63
|
-
const t5 =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
const t5 = "PageHeader";
|
|
87
|
+
const t6 = hasBorder ? "true" : void 0;
|
|
88
|
+
const t7 = hasNavigation ? "" : void 0;
|
|
89
|
+
const t8 = getResponsiveAttributes("title-size-variant", titleVariant);
|
|
90
|
+
const t9 = getNavHiddenDataAttributes(navigationHidden);
|
|
91
|
+
let t10;
|
|
92
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t6 || $[13] !== t7 || $[14] !== t8 || $[15] !== t9) {
|
|
93
|
+
t10 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
67
94
|
ref: rootRef,
|
|
68
95
|
className: t4,
|
|
69
|
-
"data-component":
|
|
70
|
-
"data-has-border":
|
|
96
|
+
"data-component": t5,
|
|
97
|
+
"data-has-border": t6,
|
|
98
|
+
"data-has-nav": t7,
|
|
99
|
+
...t8,
|
|
100
|
+
...t9,
|
|
71
101
|
"aria-label": ariaLabel,
|
|
72
102
|
role,
|
|
73
103
|
children
|
|
@@ -78,10 +108,13 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
78
108
|
$[9] = role;
|
|
79
109
|
$[10] = rootRef;
|
|
80
110
|
$[11] = t4;
|
|
81
|
-
$[12] =
|
|
82
|
-
$[13] =
|
|
83
|
-
|
|
84
|
-
|
|
111
|
+
$[12] = t6;
|
|
112
|
+
$[13] = t7;
|
|
113
|
+
$[14] = t8;
|
|
114
|
+
$[15] = t9;
|
|
115
|
+
$[16] = t10;
|
|
116
|
+
} else t10 = $[16];
|
|
117
|
+
return t10;
|
|
85
118
|
});
|
|
86
119
|
const ContextArea = (t0) => {
|
|
87
120
|
const $ = c(8);
|
|
@@ -595,13 +628,17 @@ const Navigation = (t0) => {
|
|
|
595
628
|
} else t7 = $[10];
|
|
596
629
|
return t7;
|
|
597
630
|
};
|
|
598
|
-
function getHiddenDataAttributes(isHidden) {
|
|
631
|
+
function getHiddenDataAttributes(isHidden, prefix = "hidden") {
|
|
632
|
+
const all = `data-${prefix}-all`;
|
|
633
|
+
const narrow = `data-${prefix}-narrow`;
|
|
634
|
+
const regular = `data-${prefix}-regular`;
|
|
635
|
+
const wide = `data-${prefix}-wide`;
|
|
599
636
|
if (isResponsiveValue(isHidden)) {
|
|
600
637
|
const responsiveValue = isHidden;
|
|
601
|
-
const narrowMediaQuery = "narrow" in responsiveValue ? {
|
|
602
|
-
const regularMediaQuery = "regular" in responsiveValue ? {
|
|
603
|
-
const wideMediaQuery = "wide" in responsiveValue ? {
|
|
604
|
-
if (areAllValuesTheSame(responsiveValue)) return {
|
|
638
|
+
const narrowMediaQuery = "narrow" in responsiveValue ? { [narrow]: responsiveValue.narrow || void 0 } : {};
|
|
639
|
+
const regularMediaQuery = "regular" in responsiveValue ? { [regular]: responsiveValue.regular || void 0 } : {};
|
|
640
|
+
const wideMediaQuery = "wide" in responsiveValue ? { [wide]: responsiveValue.wide || void 0 } : {};
|
|
641
|
+
if (areAllValuesTheSame(responsiveValue)) return { [all]: responsiveValue.narrow || void 0 };
|
|
605
642
|
else if (haveRegularAndWideSameValue(responsiveValue)) return {
|
|
606
643
|
...narrowMediaQuery,
|
|
607
644
|
...regularMediaQuery
|
|
@@ -611,7 +648,11 @@ function getHiddenDataAttributes(isHidden) {
|
|
|
611
648
|
...regularMediaQuery,
|
|
612
649
|
...wideMediaQuery
|
|
613
650
|
};
|
|
614
|
-
} else return {
|
|
651
|
+
} else return { [all]: isHidden || void 0 };
|
|
652
|
+
}
|
|
653
|
+
function getNavHiddenDataAttributes(isHidden) {
|
|
654
|
+
if (isHidden === void 0) return void 0;
|
|
655
|
+
return getHiddenDataAttributes(isHidden, "nav-hidden");
|
|
615
656
|
}
|
|
616
657
|
const PageHeader = Object.assign(Root, {
|
|
617
658
|
ContextArea,
|
|
@@ -633,8 +674,8 @@ PageHeader.displayName = "PageHeader";
|
|
|
633
674
|
function _temp(element) {
|
|
634
675
|
return ["a", "button"].some((selector) => element.matches(selector)) || element.hasAttribute("role") && element.getAttribute("role") === "button" || element.hasAttribute("link") && element.getAttribute("role") === "link" || element.hasAttribute("tabindex");
|
|
635
676
|
}
|
|
636
|
-
function _temp2(
|
|
637
|
-
return
|
|
677
|
+
function _temp2(child_0) {
|
|
678
|
+
return child_0 instanceof HTMLElement && child_0.getAttribute("data-component") === "TitleArea";
|
|
638
679
|
}
|
|
639
680
|
//#endregion
|
|
640
681
|
export { PageHeader };
|