@primer/react 38.32.0-rc.68e0ffa22 → 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 +12 -0
- package/dist/ActionBar/ActionBar.js +130 -424
- package/dist/ActionList/{ActionList-65f7daac.css → ActionList-1ff5220c.css} +2 -2
- package/dist/ActionList/ActionList-1ff5220c.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/Breadcrumbs/{Breadcrumbs-54395fc6.css → Breadcrumbs-16d81430.css} +2 -2
- package/dist/Breadcrumbs/{Breadcrumbs-54395fc6.css.map → Breadcrumbs-16d81430.css.map} +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +1 -0
- package/dist/Breadcrumbs/Breadcrumbs.module.css.js +2 -2
- 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/SegmentedControl/SegmentedControl-a004561f.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-a004561f.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.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/SelectPanel2/SelectPanel-917fdaef.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-608e207e.css.map → SelectPanel-917fdaef.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -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/ActionList/ActionList-65f7daac.css.map +0 -1
- package/dist/PageHeader/PageHeader-5e969745.css +0 -2
- package/dist/PageHeader/PageHeader-5e969745.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-622e61a4.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-608e207e.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -1
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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-SegmentedControl-SegmentedControl-lqIXp{--segmented-control-icon-width:32px;background-color:var(--controlTrack-bgColor-rest,#e6eaef);border:var(--borderWidth-thin,.0625rem) solid var(--controlTrack-borderColor-rest,transparent);border-radius:var(--borderRadius-medium,.375rem);display:inline-flex;font-size:var(--text-body-size-medium,.875rem);height:32px;margin:0;padding:0}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-narrow=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=true]{display:flex;width:100%;--segmented-control-icon-width:100%}.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-regular=true]:not([data-full-width-wide=true]),.prc-SegmentedControl-SegmentedControl-lqIXp[data-full-width-wide=false]{display:inline-flex;width:auto;--segmented-control-icon-width:32px}}.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-narrow=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}@media (min-width:48rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-regular=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}@media (min-width:87.5rem){.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=dropdown],.prc-SegmentedControl-SegmentedControl-lqIXp[data-variant-wide=hideLabels] .prc-SegmentedControl-Text-7S2y2{display:none}}.prc-SegmentedControl-SegmentedControl-lqIXp:where([data-size=small]){font-size:var(--text-body-size-small,.75rem);height:28px}.prc-SegmentedControl-DropdownContainer-ZaPMn{display:none}.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant=dropdown]{display:block}@media (max-width:calc(48rem - 0.02px)){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-narrow=dropdown]{display:block}}@media (min-width:48rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-regular=dropdown]{display:block}}@media (min-width:87.5rem){.prc-SegmentedControl-DropdownContainer-ZaPMn[data-variant-wide=dropdown]{display:block}}.prc-SegmentedControl-Item-tSCQh{display:block;flex-grow:1;margin-bottom:-1px;margin-top:-1px;position:relative}.prc-SegmentedControl-Item-tSCQh:not(:last-child){margin-right:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):after{background-color:var(--borderColor-default,#d1d9e0);bottom:var(--base-size-8,.5rem);content:"";position:absolute;right:calc(var(--base-size-2,.125rem)*-1);top:var(--base-size-8,.5rem);width:1px}.prc-SegmentedControl-Item-tSCQh:not(:last-child):has(+[data-selected]):after,.prc-SegmentedControl-Item-tSCQh:not(:last-child):where([data-selected]):after{background-color:transparent}.prc-SegmentedControl-Item-tSCQh:first-child{margin-left:-1px}.prc-SegmentedControl-Item-tSCQh:last-child{margin-right:-1px}.prc-SegmentedControl-Item-tSCQh .prc-SegmentedControl-Counter-GmZOI{align-items:center;display:flex;margin-inline-start:var(--base-size-8,.5rem)}.prc-SegmentedControl-Button-E48xz{--segmented-control-button-inner-padding:12px;--segmented-control-button-bg-inset:4px;--segmented-control-outer-radius:var(--borderRadius-medium,0.375rem);background-color:transparent;border-color:transparent;border-radius:var(--segmented-control-outer-radius);border-width:0;color:currentColor;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:var(--base-text-weight-normal,400);height:100%;padding:var(--segmented-control-button-bg-inset);width:100%}.prc-SegmentedControl-Button-E48xz svg{fill:var(--fgColor-muted,#59636e);color:var(--fgColor-muted,#59636e)}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:not(:disabled):not(:focus-visible){outline:1px solid transparent}.prc-SegmentedControl-Button-E48xz:focus-visible:not(:disabled){box-shadow:none;outline:var(--base-size-2,.125rem) solid var(--fgColor-accent,#0969da);outline-offset:-1px}.prc-SegmentedControl-Button-E48xz:focus:focus-visible:not(:last-child):after{width:0}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-current=true]){background-color:transparent;color:var(--fgColor-disabled,#818b98);cursor:not-allowed}.prc-SegmentedControl-Button-E48xz[aria-disabled=true]:not([aria-current=true]) svg{fill:var(--fgColor-disabled,#818b98);color:var(--fgColor-disabled,#818b98)}@media (pointer:coarse){.prc-SegmentedControl-Button-E48xz:before{content:"";left:0;min-height:44px;position:absolute;right:0;top:50%;transform:translateY(-50%)}}.prc-SegmentedControl-IconButton-tlzDE{width:var(--segmented-control-icon-width,32px)}.prc-SegmentedControl-Content-1COlk{align-items:center;border-color:transparent;border-radius:calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset)/2);border-style:solid;border-width:var(--borderWidth-thin,.0625rem);display:flex;height:100%;justify-content:center;padding-left:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));padding-right:calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset))}.prc-SegmentedControl-Button-E48xz[aria-current=true]{font-weight:var(--base-text-weight-semibold,600);padding:0}.prc-SegmentedControl-Button-E48xz[aria-current=true] .prc-SegmentedControl-Content-1COlk{background-color:var(--controlKnob-bgColor-rest,#fff);border-color:var(--controlKnob-borderColor-rest,#d1d9e0);border-radius:var(--segmented-control-outer-radius);padding-left:var(--segmented-control-button-inner-padding);padding-right:var(--segmented-control-button-inner-padding)}.prc-SegmentedControl-Button-E48xz:not([aria-current=true],[aria-disabled=true]):hover .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-hover,#e0e6eb)}.prc-SegmentedControl-Button-E48xz:not([aria-current=true],[aria-disabled=true]):active .prc-SegmentedControl-Content-1COlk{background-color:var(--controlTrack-bgColor-active,#dae0e7)}.prc-SegmentedControl-Text-7S2y2:after{content:attr(data-text);display:block;font-weight:var(--base-text-weight-semibold,600);height:0;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none;visibility:hidden}.prc-SegmentedControl-LeadingIcon-74n5s{margin-right:var(--base-size-4,.25rem)}
|
|
2
|
+
/*# sourceMappingURL=SegmentedControl-a004561f.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/SegmentedControl/SegmentedControl.module.css.js"],"names":[],"mappings":"AAAA,6CAEE,mCAAoC,CASpC,yDAAkD,CAClD,8FAAuF,CACvF,gDAAyC,CATzC,mBAAoB,CAMpB,8CAAuC,CAHvC,WAAY,CAEZ,QAAS,CADT,SA0HF,CAlHE,mEACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,oEACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CAEA,wCACE,0EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,2EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,yBACE,2EACE,YAAa,CACb,UAAW,CAEX,mCACF,CAEA,4EACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAEA,2BACE,wEACE,YAAa,CACb,UAAW,CAEX,mCACF,CASA,qLACE,mBAAoB,CACpB,UAAW,CAEX,mCACF,CACF,CAQA,2KACE,YACF,CAEA,wCAKE,yLACE,YACF,CACF,CAEA,yBAKE,2LACE,YACF,CACF,CAEA,2BAKE,qLACE,YACF,CACF,CAEA,sEAGE,4CAAsC,CADtC,WAEF,CAGF,8CACE,YAwBF,CArBE,qEACE,aACF,CAEA,wCACE,4EACE,aACF,CACF,CAEA,yBACE,6EACE,aACF,CACF,CAEA,2BACE,0EACE,aACF,CACF,CAGF,iCAEE,aAAc,CAKd,WAAY,CADZ,kBAAmB,CAFnB,eAAgB,CAHhB,iBA6CF,CArCE,kDAEE,gBAkBF,CAhBE,wDAQE,mDAA4C,CAJ5C,+BAA0B,CAE1B,UAAW,CALX,iBAAkB,CAElB,yCAAoC,CADpC,4BAAuB,CAGvB,SAIF,CAGA,6JAEE,4BACF,CAGF,6CAEE,gBACF,CAEA,4CAEE,iBACF,CAEA,qEAGE,kBAAmB,CADnB,YAAa,CADb,4CAGF,CAGF,mCAEE,6CAA8C,CAC9C,uCAAwC,CACxC,oEAA4D,CAW5D,4BAA6B,CAC7B,wBAAyB,CAGzB,mDAAoD,CAFpD,cAAe,CAJf,kBAAmB,CACnB,cAAe,CAJf,mBAAoB,CACpB,iBAAkB,CAClB,8CAA2C,CAL3C,WAAY,CAEZ,gDAAiD,CAHjD,UAmEF,CApDE,uCACE,iCAA0B,CAC1B,kCACF,CAGA,wDAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAOF,CAHE,4EACE,6BACF,CAIF,gEAGE,eAAgB,CAFhB,sEAAuD,CACvD,mBAEF,CAGA,8EAEE,OACF,CAEA,gFAGE,4BAA6B,CAD7B,qCAA8B,CAD9B,kBAQF,CAJE,oFACE,oCAA6B,CAC7B,qCACF,CAGF,wBACE,0CAME,UAAW,CAFX,MAAO,CACP,eAAgB,CAJhB,iBAAkB,CAElB,OAAQ,CADR,OAAQ,CAKR,0BACF,CACF,CAGF,uCACE,8CACF,CAEA,oCAiBE,kBAAmB,CAVnB,wBAAyB,CASzB,sGAAyG,CARzG,kBAAmB,CACnB,6CAAqC,CARrC,YAAa,CACb,WAAY,CAgBZ,sBAAuB,CAZvB,2GAA4G,CAF5G,4GAeF,CAEA,sDAEE,gDAA6C,CAD7C,SAaF,CAVE,0FAKE,qDAAiD,CACjD,wDAAiD,CAEjD,mDAAoD,CAJpD,0DAA2D,CAF3D,2DAOF,CAIA,2HACE,0DACF,CAEA,4HACE,2DACF,CAGF,uCAOE,uBAAwB,CANxB,aAAc,CAGd,gDAA6C,CAF7C,QAAS,CACT,eAAgB,CAEhB,mBAAoB,CAGpB,wBAAiB,CAAjB,gBAAiB,CAFjB,iBAGF,CAEA,wCACE,sCACF","file":"SegmentedControl-a004561f.css","sourcesContent":[".SegmentedControl {\n /* TODO: use primitive `control.medium.size` when it is available instead of '32px' */\n --segmented-control-icon-width: 32px;\n\n display: inline-flex;\n\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 32px;\n padding: 0;\n margin: 0;\n font-size: var(--text-body-size-medium);\n background-color: var(--controlTrack-bgColor-rest);\n border: var(--borderWidth-thin) solid var(--controlTrack-borderColor-rest, transparent);\n border-radius: var(--borderRadius-medium);\n\n /* Responsive full-width */\n &[data-full-width='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n @media (--viewportRange-narrow) {\n &[data-full-width-narrow='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-narrow='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-full-width-regular='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-regular='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-full-width-wide='true'] {\n display: flex;\n width: 100%;\n\n --segmented-control-icon-width: 100%;\n }\n\n &[data-full-width-wide='false'] {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n\n &[data-full-width-regular='true']:not([data-full-width-wide='true']) {\n display: inline-flex;\n width: auto;\n\n --segmented-control-icon-width: 32px;\n }\n }\n\n /* Hide when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: none;\n }\n\n /* Handle hideLabels variant - hide button text */\n &[data-variant='hideLabels'] .Text {\n display: none;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: none;\n }\n\n &[data-variant-narrow='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: none;\n }\n\n &[data-variant-regular='hideLabels'] .Text {\n display: none;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: none;\n }\n\n &[data-variant-wide='hideLabels'] .Text {\n display: none;\n }\n }\n\n &:where([data-size='small']) {\n /* TODO: use primitive `control.{small|medium}.size` when it is available */\n height: 28px;\n font-size: var(--text-body-size-small);\n }\n}\n\n.DropdownContainer {\n display: none;\n\n /* Show when dropdown variant is active */\n &[data-variant='dropdown'] {\n display: block;\n }\n\n @media (--viewportRange-narrow) {\n &[data-variant-narrow='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-regular) {\n &[data-variant-regular='dropdown'] {\n display: block;\n }\n }\n\n @media (--viewportRange-wide) {\n &[data-variant-wide='dropdown'] {\n display: block;\n }\n }\n}\n\n.Item {\n position: relative;\n display: block;\n /* stylelint-disable-next-line primer/spacing */\n margin-top: -1px;\n /* stylelint-disable-next-line primer/spacing */\n margin-bottom: -1px;\n flex-grow: 1;\n\n &:not(:last-child) {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: 1px;\n\n &::after {\n position: absolute;\n top: var(--base-size-8);\n right: calc(-1 * var(--base-size-2));\n bottom: var(--base-size-8);\n width: 1px;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--borderColor-default);\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-disallowed-list -- scoped to CSS Module, audited (github/github-ui#17224) */\n &:has(+ [data-selected])::after,\n &:where([data-selected])::after {\n background-color: transparent;\n }\n }\n\n &:first-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-left: -1px;\n }\n\n &:last-child {\n /* stylelint-disable-next-line primer/spacing */\n margin-right: -1px;\n }\n\n .Counter {\n margin-inline-start: var(--base-size-8);\n display: flex;\n align-items: center;\n }\n}\n\n.Button {\n /* TODO: use primitive `primer.control.medium.paddingInline.normal` when it is available */\n --segmented-control-button-inner-padding: 12px;\n --segmented-control-button-bg-inset: 4px;\n --segmented-control-outer-radius: var(--borderRadius-medium);\n\n width: 100%;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding: var(--segmented-control-button-bg-inset);\n font-family: inherit;\n font-size: inherit;\n font-weight: var(--base-text-weight-normal);\n color: currentColor;\n cursor: pointer;\n background-color: transparent;\n border-color: transparent;\n border-width: 0;\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n\n & svg {\n fill: var(--fgColor-muted);\n color: var(--fgColor-muted);\n }\n\n /* fallback :focus state */\n &:focus:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n }\n\n /* default focus state */\n &:focus-visible:not(:disabled) {\n outline: var(--base-size-2) solid var(--fgColor-accent);\n outline-offset: -1px;\n box-shadow: none;\n }\n\n /* stylelint-disable-next-line selector-max-specificity */\n &:focus:focus-visible:not(:last-child)::after {\n /* fixes an issue where the focus outline shows over the pseudo-element */\n width: 0;\n }\n\n &[aria-disabled='true']:not([aria-current='true']) {\n cursor: not-allowed;\n color: var(--fgColor-disabled);\n background-color: transparent;\n\n & svg {\n fill: var(--fgColor-disabled);\n color: var(--fgColor-disabled);\n }\n }\n\n @media (pointer: coarse) {\n &::before {\n position: absolute;\n top: 50%;\n right: 0;\n left: 0;\n min-height: 44px;\n content: '';\n transform: translateY(-50%);\n }\n }\n}\n\n.IconButton {\n width: var(--segmented-control-icon-width, 32px);\n}\n\n.Content {\n display: flex;\n height: 100%;\n /* stylelint-disable-next-line primer/spacing */\n padding-right: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n /* stylelint-disable-next-line primer/spacing */\n padding-left: calc(var(--segmented-control-button-inner-padding) - var(--segmented-control-button-bg-inset));\n border-color: transparent;\n border-style: solid;\n border-width: var(--borderWidth-thin);\n\n /*\n innerRadius = outerRadius - distance/2\n https://stackoverflow.com/questions/2932146/math-problem-determine-the-corner-radius-of-an-inner-border-based-on-outer-corn\n */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--segmented-control-outer-radius) - var(--segmented-control-button-bg-inset) / 2);\n align-items: center;\n justify-content: center;\n}\n\n.Button[aria-current='true'] {\n padding: 0;\n font-weight: var(--base-text-weight-semibold);\n\n .Content {\n /* stylelint-disable-next-line primer/spacing */\n padding-right: var(--segmented-control-button-inner-padding);\n /* stylelint-disable-next-line primer/spacing */\n padding-left: var(--segmented-control-button-inner-padding);\n background-color: var(--controlKnob-bgColor-rest);\n border-color: var(--controlKnob-borderColor-rest);\n /* stylelint-disable-next-line primer/borders */\n border-radius: var(--segmented-control-outer-radius);\n }\n}\n\n.Button:not([aria-current='true'], [aria-disabled='true']) {\n &:hover .Content {\n background-color: var(--controlTrack-bgColor-hover);\n }\n\n &:active .Content {\n background-color: var(--controlTrack-bgColor-active);\n }\n}\n\n.Text::after {\n display: block;\n height: 0;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n pointer-events: none;\n visibility: hidden;\n content: attr(data-text);\n user-select: none;\n}\n\n.LeadingIcon {\n margin-right: var(--base-size-4);\n}\n"]}
|
|
@@ -38,17 +38,17 @@ const TextInput = /*#__PURE__*/ React.forwardRef(({ icon: IconComponent, leading
|
|
|
38
38
|
const trailingVisualId = useId();
|
|
39
39
|
const loadingId = useId();
|
|
40
40
|
const inputDescribedBy = clsx(inputProps["aria-describedby"], LeadingVisual && leadingVisualId, TrailingVisual && trailingVisualId, loading && loadingId) || void 0;
|
|
41
|
-
const handleInputFocus = useCallback((
|
|
41
|
+
const handleInputFocus = useCallback((e) => {
|
|
42
42
|
setIsInputFocused(true);
|
|
43
|
-
onFocus && onFocus(
|
|
43
|
+
onFocus && onFocus(e);
|
|
44
44
|
}, [onFocus]);
|
|
45
|
-
const handleInputBlur = useCallback((
|
|
45
|
+
const handleInputBlur = useCallback((e) => {
|
|
46
46
|
setIsInputFocused(false);
|
|
47
|
-
onBlur && onBlur(
|
|
47
|
+
onBlur && onBlur(e);
|
|
48
48
|
}, [onBlur]);
|
|
49
|
-
const handleInputChange = useCallback((
|
|
50
|
-
if (characterLimit && !isControlled) setUncontrolledLength(
|
|
51
|
-
onChange === null || onChange === void 0 || onChange(
|
|
49
|
+
const handleInputChange = useCallback((e) => {
|
|
50
|
+
if (characterLimit && !isControlled) setUncontrolledLength(e.target.value.length);
|
|
51
|
+
onChange === null || onChange === void 0 || onChange(e);
|
|
52
52
|
}, [
|
|
53
53
|
onChange,
|
|
54
54
|
characterLimit,
|