@primer/react 0.0.0-20260420144302 → 0.0.0-20260420145726
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
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260420145726
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- [#7760](https://github.com/primer/react/pull/7760) [`b2e0efd`](https://github.com/primer/react/commit/b2e0efd04c61e526d8e7db6bc773f9b4ab155d72) Thanks [@siddharthkp](https://github.com/siddharthkp)! - Deprecate the `useResponsiveValue` hook.
|
|
8
8
|
|
|
9
|
+
- [#7766](https://github.com/primer/react/pull/7766) [`6770095`](https://github.com/primer/react/commit/67700952bec8373c01843b88e39ccb6dfe5b108c) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: (Behind feature flag) Make popover API usage opt-in
|
|
10
|
+
|
|
9
11
|
### Patch Changes
|
|
10
12
|
|
|
11
13
|
- [#7754](https://github.com/primer/react/pull/7754) [`9e3fe4b`](https://github.com/primer/react/commit/9e3fe4b501ce5affb558bf92697e5c79341903ca) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - Breadcrumbs: On narrow viewports, only show the current page breadcrumb and the overflow menu when `overflow="menu"` is set.
|
|
@@ -14,8 +16,6 @@
|
|
|
14
16
|
|
|
15
17
|
- [#7757](https://github.com/primer/react/pull/7757) [`ed82a1e`](https://github.com/primer/react/commit/ed82a1e0399b98428d4b794239bb37649806b5cc) Thanks [@liuliu-dev](https://github.com/liuliu-dev)! - SelectPanel: Lock body scroll when modal variant is on.
|
|
16
18
|
|
|
17
|
-
- [#7766](https://github.com/primer/react/pull/7766) [`6770095`](https://github.com/primer/react/commit/67700952bec8373c01843b88e39ccb6dfe5b108c) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: (Behind feature flag) Make popover API usage opt-in
|
|
18
|
-
|
|
19
19
|
## 38.20.0
|
|
20
20
|
|
|
21
21
|
### Minor Changes
|
|
@@ -98,7 +98,7 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
|
|
|
98
98
|
* When `true`, uses the Popover API only if the CSS anchor positioning feature flag is enabled
|
|
99
99
|
* and the browser supports native CSS anchor positioning. Has no effect otherwise. Defaults to `false`.
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
renderAs?: 'portal' | 'popover';
|
|
102
102
|
}
|
|
103
103
|
export type AnchoredOverlayProps = AnchoredOverlayBaseProps & (AnchoredOverlayPropsWithAnchor | AnchoredOverlayPropsWithoutAnchor) & Partial<Pick<PositionSettings, 'align' | 'side' | 'anchorOffset' | 'alignmentOffset' | 'displayInViewport'>>;
|
|
104
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchoredOverlay.d.ts","sourceRoot":"","sources":["../../src/AnchoredOverlay/AnchoredOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAiC,KAAK,GAAG,EAAC,MAAM,OAAO,CAAA;AAE9D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAEhE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAA;AAIhE,OAAO,KAAK,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,WAAW,CAAA;AAO1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,cAAc,CAA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C,EAAE,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAC,KAAK,IAAI,CAAA;IACnE;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CAAC,8BAA8B,GAAG,iCAAiC,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,CAAC,CAAA;AAS9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAwOnF,CAAA"}
|
|
@@ -49,13 +49,13 @@ const AnchoredOverlay = ({
|
|
|
49
49
|
onPositionChange,
|
|
50
50
|
displayCloseButton = true,
|
|
51
51
|
closeButtonProps = defaultCloseButtonProps,
|
|
52
|
-
|
|
52
|
+
renderAs = 'portal'
|
|
53
53
|
}) => {
|
|
54
54
|
const cssAnchorPositioningFlag = useFeatureFlag('primer_react_css_anchor_positioning');
|
|
55
55
|
const supportsNativeCSSAnchorPositioning = useRef(false);
|
|
56
56
|
const cssAnchorPositioning = cssAnchorPositioningFlag && supportsNativeCSSAnchorPositioning.current;
|
|
57
|
-
// Only use Popover API when both CSS anchor positioning is enabled AND
|
|
58
|
-
const
|
|
57
|
+
// Only use Popover API when both CSS anchor positioning is enabled AND renderAs is true
|
|
58
|
+
const shouldRenderAs = cssAnchorPositioning && renderAs === 'popover';
|
|
59
59
|
const anchorRef = useProvidedRefOrCreate(externalAnchorRef);
|
|
60
60
|
const [overlayRef, updateOverlayRef] = useRenderForcingRef();
|
|
61
61
|
const anchorId = useId(externalAnchorId);
|
|
@@ -158,8 +158,8 @@ const AnchoredOverlay = ({
|
|
|
158
158
|
currentOverlay.style.setProperty(`--anchored-overlay-anchor-offset-${result.horizontal}`, `${offset || 0}px`);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
// Only call showPopover when
|
|
162
|
-
if (
|
|
161
|
+
// Only call showPopover when renderAs is enabled
|
|
162
|
+
if (shouldRenderAs) {
|
|
163
163
|
try {
|
|
164
164
|
if (!currentOverlay.matches(':popover-open')) {
|
|
165
165
|
currentOverlay.showPopover();
|
|
@@ -168,7 +168,7 @@ const AnchoredOverlay = ({
|
|
|
168
168
|
// Ignore if popover is already showing or not supported
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
}, [cssAnchorPositioning,
|
|
171
|
+
}, [cssAnchorPositioning, shouldRenderAs, open, overlayElement, id, overlayRef, anchorRef, width]);
|
|
172
172
|
const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
|
|
173
173
|
const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
|
|
174
174
|
const XButtonAriaLabel = closeButtonProps['aria-label'];
|
|
@@ -186,7 +186,7 @@ const AnchoredOverlay = ({
|
|
|
186
186
|
tabIndex: 0,
|
|
187
187
|
onClick: onAnchorClick,
|
|
188
188
|
onKeyDown: onAnchorKeyDown,
|
|
189
|
-
...(
|
|
189
|
+
...(shouldRenderAs ? {
|
|
190
190
|
popoverTarget: popoverId
|
|
191
191
|
} : {})
|
|
192
192
|
}), open ? /*#__PURE__*/jsxs(Overlay, {
|
|
@@ -206,11 +206,11 @@ const AnchoredOverlay = ({
|
|
|
206
206
|
preventOverflow: preventOverflow,
|
|
207
207
|
"data-component": "AnchoredOverlay",
|
|
208
208
|
_PrivateDisablePortal: _PrivateDisablePortal,
|
|
209
|
-
...(
|
|
209
|
+
...(shouldRenderAs ? {
|
|
210
210
|
popover: 'manual'
|
|
211
211
|
} : {}),
|
|
212
212
|
...restOverlayProps,
|
|
213
|
-
...(
|
|
213
|
+
...(shouldRenderAs ? {
|
|
214
214
|
id: popoverId
|
|
215
215
|
} : {}),
|
|
216
216
|
ref: node => {
|
package/package.json
CHANGED