@primer/react 38.19.0-rc.0b59e8271 → 38.19.0-rc.f3b0d9cc2

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
@@ -6,6 +6,17 @@
6
6
 
7
7
  - [#7686](https://github.com/primer/react/pull/7686) [`6cd13c0`](https://github.com/primer/react/commit/6cd13c03a0293732af6d9499f1f925bf7d95d82b) Thanks [@JelloBagel](https://github.com/JelloBagel)! - StateLabel: Add new type: `archived`
8
8
 
9
+ - [#7677](https://github.com/primer/react/pull/7677) [`c1a81b1`](https://github.com/primer/react/commit/c1a81b178742ba547b85a3df3ed3c27bcff6b7c5) Thanks [@TylerJDev](https://github.com/TylerJDev)! - AnchoredOverlay: Add Popover API to AnchoredOverlay (behind `primer_react_css_anchor_positioning` feature flag)
10
+
11
+ ### Patch Changes
12
+
13
+ - [#7695](https://github.com/primer/react/pull/7695) [`780fc3d`](https://github.com/primer/react/commit/780fc3d7b52fd0f9b63f313af6355398180a0118) Thanks [@mattcosta7](https://github.com/mattcosta7)! - perf(ThemeProvider): Reduce unnecessary renders and effect cascades
14
+
15
+ - Replace `useState` + `useEffect` SSR hydration handoff with `useSyncExternalStore` — eliminates post-hydration re-render
16
+ - Replace `useState` + `useEffect` in `useSystemColorMode` with `useSyncExternalStore` — eliminates effect gap and stale-then-update flicker
17
+ - Cache `getServerHandoff` DOM read + JSON.parse per ID (runs once, not on every call)
18
+ - Memoize context value object to prevent unnecessary re-renders of all consumers
19
+
9
20
  ## 38.18.0
10
21
 
11
22
  ### Minor Changes
@@ -0,0 +1,2 @@
1
+ .prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed!important;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[popover]{border:0;inset:auto;margin:0;max-height:none;max-width:none;padding:0}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
2
+ /*# sourceMappingURL=AnchoredOverlay-647c7065.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,2CACE,oEAGwB,CACxB,mCAAoC,CAEpC,wBAA0B,CAD1B,WAmCF,CAhCE,oDAIE,QAAS,CAHT,UAAW,CACX,QAAS,CAGT,eAAgB,CAChB,cAAe,CAHf,SAIF,CAEA,qEAGE,iBAAkB,CADlB,oDAEF,CAEA,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAGF,CAEA,mEAGE,sCAAgC,CAFhC,kBAAmB,CACnB,eAEF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,eAEF","file":"AnchoredOverlay-647c7065.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.AnchoredOverlay {\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed !important;\n\n &[popover] {\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n max-height: none;\n max-width: none;\n }\n\n &[data-side='outside-bottom'] {\n /* stylelint-disable primer/spacing */\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n top: anchor(top);\n margin-right: var(--base-size-4);\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: anchor(top);\n margin-left: var(--base-size-4);\n }\n}\n"]}
@@ -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;AAC9D,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;AAM1D,UAAU,8BAA8B;IACtC;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,KAAK,C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ACH,iBAAiB,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAElD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAA;IAChE;;OAEG;IACH,gBAAgB,CAAC,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;CAC5C;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;AAoB9G;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAwNnF,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useRef, useEffect } from 'react';
2
+ import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
2
3
  import { useFocusTrap } from '../hooks/useFocusTrap.js';
3
4
  import { useFocusZone } from '../hooks/useFocusZone.js';
4
5
  import { useId } from '../hooks/useId.js';
@@ -77,12 +78,17 @@ const AnchoredOverlay = ({
77
78
  if (event_0.defaultPrevented || event_0.button !== 0) {
78
79
  return;
79
80
  }
81
+ // Prevent the browser's native popovertarget toggle so React
82
+ // stays the single source of truth for popover visibility.
83
+ if (cssAnchorPositioning) {
84
+ event_0.preventDefault();
85
+ }
80
86
  if (!open) {
81
87
  onOpen === null || onOpen === void 0 ? void 0 : onOpen('anchor-click');
82
88
  } else {
83
89
  onClose === null || onClose === void 0 ? void 0 : onClose('anchor-click');
84
90
  }
85
- }, [open, onOpen, onClose]);
91
+ }, [open, onOpen, onClose, cssAnchorPositioning]);
86
92
  const positionChange = position => {
87
93
  if (onPositionChange && position) {
88
94
  onPositionChange({
@@ -124,14 +130,48 @@ const AnchoredOverlay = ({
124
130
  disabled: !open || !position_0,
125
131
  ...focusTrapSettings
126
132
  });
133
+ const popoverId = useId();
134
+ const id = popoverId.replaceAll(':', '_'); // popoverId can contain colons which are invalid in CSS custom property names, so we replace them with underscores
135
+
136
+ useEffect(() => {
137
+ if (!cssAnchorPositioning || !anchorRef.current) return;
138
+ const anchor = anchorRef.current;
139
+ const overlay = overlayRef.current;
140
+ anchor.style.setProperty('anchor-name', `--anchored-overlay-anchor-${id}`);
141
+ return () => {
142
+ anchor.style.removeProperty('anchor-name');
143
+ if (overlay) {
144
+ overlay.style.removeProperty('position-anchor');
145
+ }
146
+ };
147
+ }, [cssAnchorPositioning, anchorRef, overlayRef, id]);
148
+
149
+ // Track the overlay element so we can re-run the effect when it changes.
150
+ // The overlay unmounts when closed, so each open creates a new DOM node -
151
+ // that needs showPopover() called.
152
+ const overlayElement = overlayRef.current;
153
+ useIsomorphicLayoutEffect(() => {
154
+ // Read ref inside effect to get the value after child refs are attached
155
+ const currentOverlay = overlayRef.current;
156
+ if (!cssAnchorPositioning || !open || !currentOverlay) return;
157
+ currentOverlay.style.setProperty('position-anchor', `--anchored-overlay-anchor-${id}`);
158
+ try {
159
+ if (!currentOverlay.matches(':popover-open')) {
160
+ currentOverlay.showPopover();
161
+ }
162
+ } catch {
163
+ // Ignore if popover is already showing or not supported
164
+ }
165
+ }, [cssAnchorPositioning, open, overlayElement, id, overlayRef]);
127
166
  const showXIcon = onClose && variant.narrow === 'fullscreen' && displayCloseButton;
128
167
  const XButtonAriaLabelledBy = closeButtonProps['aria-labelledby'];
129
168
  const XButtonAriaLabel = closeButtonProps['aria-label'];
130
169
  const {
131
170
  className: overlayClassName,
171
+ _PrivateDisablePortal,
132
172
  ...restOverlayProps
133
173
  } = overlayProps || {};
134
- const innerContent = /*#__PURE__*/jsxs(Fragment, {
174
+ return /*#__PURE__*/jsxs(Fragment, {
135
175
  children: [renderAnchor && renderAnchor({
136
176
  ref: anchorRef,
137
177
  id: anchorId,
@@ -141,7 +181,7 @@ const AnchoredOverlay = ({
141
181
  onClick: onAnchorClick,
142
182
  onKeyDown: onAnchorKeyDown,
143
183
  ...(cssAnchorPositioning ? {
144
- className: classes.Anchor
184
+ popoverTarget: popoverId
145
185
  } : {})
146
186
  }), open ? /*#__PURE__*/jsxs(Overlay, {
147
187
  returnFocusRef: anchorRef,
@@ -159,7 +199,14 @@ const AnchoredOverlay = ({
159
199
  className: clsx(className, overlayClassName, cssAnchorPositioning ? classes.AnchoredOverlay : undefined),
160
200
  preventOverflow: preventOverflow,
161
201
  "data-component": "AnchoredOverlay",
202
+ _PrivateDisablePortal: _PrivateDisablePortal,
203
+ ...(cssAnchorPositioning ? {
204
+ popover: 'manual'
205
+ } : {}),
162
206
  ...restOverlayProps,
207
+ ...(cssAnchorPositioning ? {
208
+ id: popoverId
209
+ } : {}),
163
210
  ref: node => {
164
211
  if (overlayProps !== null && overlayProps !== void 0 && overlayProps.ref) {
165
212
  assignRef(overlayProps.ref, node);
@@ -190,13 +237,6 @@ const AnchoredOverlay = ({
190
237
  }) : null, children]
191
238
  }) : null]
192
239
  });
193
- if (cssAnchorPositioning) {
194
- return /*#__PURE__*/jsx("div", {
195
- className: classes.Wrapper,
196
- children: innerContent
197
- });
198
- }
199
- return innerContent;
200
240
  };
201
241
  function assignRef(ref, value) {
202
242
  if (typeof ref === 'function') {
@@ -1,5 +1,5 @@
1
- import './AnchoredOverlay-0f6f45b5.css';
1
+ import './AnchoredOverlay-647c7065.css';
2
2
 
3
- var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","Wrapper":"prc-AnchoredOverlay-Wrapper-w6jU3","Anchor":"prc-AnchoredOverlay-Anchor-DWRfK","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
3
+ var classes = {"ResponsiveCloseButtonContainer":"prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium","ResponsiveCloseButton":"prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx","AnchoredOverlay":"prc-AnchoredOverlay-AnchoredOverlay-fYg9Z"};
4
4
 
5
5
  export { classes as default };
@@ -61,6 +61,7 @@ type OwnOverlayProps = Merge<StyledOverlayProps, BaseOverlayProps>;
61
61
  export declare const BaseOverlay: PolymorphicForwardRefComponent<"div", OwnOverlayProps>;
62
62
  type ContainerProps = {
63
63
  anchorSide?: AnchorSide;
64
+ _PrivateDisablePortal?: boolean;
64
65
  ignoreClickRefs?: React.RefObject<HTMLElement | null>[];
65
66
  initialFocusRef?: React.RefObject<HTMLElement | null>;
66
67
  onClickOutside: (e: TouchOrMouseEvent) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAe,MAAM,OAAO,CAAA;AAC9D,OAAO,KAA0B,MAAM,OAAO,CAAA;AAE9C,OAAO,KAAK,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAA;AAI/C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAK/F,KAAK,kBAAkB,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Ref((t0, forwardedRef) => {
119
- const $ = c(48);
119
+ const $ = c(49);
120
+ let _PrivateDisablePortal;
120
121
  let anchorSide;
121
122
  let ignoreClickRefs;
122
123
  let initialFocusRef;
@@ -137,6 +138,7 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
137
138
  if ($[0] !== t0) {
138
139
  ({
139
140
  anchorSide,
141
+ _PrivateDisablePortal,
140
142
  height: t1,
141
143
  ignoreClickRefs,
142
144
  initialFocusRef,
@@ -155,53 +157,55 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
155
157
  ...props
156
158
  } = t0);
157
159
  $[0] = t0;
158
- $[1] = anchorSide;
159
- $[2] = ignoreClickRefs;
160
- $[3] = initialFocusRef;
161
- $[4] = left;
162
- $[5] = onClickOutside;
163
- $[6] = onEscape;
164
- $[7] = portalContainerName;
165
- $[8] = preventFocusOnOpen;
166
- $[9] = props;
167
- $[10] = responsiveVariant;
168
- $[11] = returnFocusRef;
169
- $[12] = right;
170
- $[13] = t1;
171
- $[14] = t2;
172
- $[15] = t3;
173
- $[16] = t4;
174
- $[17] = t5;
160
+ $[1] = _PrivateDisablePortal;
161
+ $[2] = anchorSide;
162
+ $[3] = ignoreClickRefs;
163
+ $[4] = initialFocusRef;
164
+ $[5] = left;
165
+ $[6] = onClickOutside;
166
+ $[7] = onEscape;
167
+ $[8] = portalContainerName;
168
+ $[9] = preventFocusOnOpen;
169
+ $[10] = props;
170
+ $[11] = responsiveVariant;
171
+ $[12] = returnFocusRef;
172
+ $[13] = right;
173
+ $[14] = t1;
174
+ $[15] = t2;
175
+ $[16] = t3;
176
+ $[17] = t4;
177
+ $[18] = t5;
175
178
  } else {
176
- anchorSide = $[1];
177
- ignoreClickRefs = $[2];
178
- initialFocusRef = $[3];
179
- left = $[4];
180
- onClickOutside = $[5];
181
- onEscape = $[6];
182
- portalContainerName = $[7];
183
- preventFocusOnOpen = $[8];
184
- props = $[9];
185
- responsiveVariant = $[10];
186
- returnFocusRef = $[11];
187
- right = $[12];
188
- t1 = $[13];
189
- t2 = $[14];
190
- t3 = $[15];
191
- t4 = $[16];
192
- t5 = $[17];
179
+ _PrivateDisablePortal = $[1];
180
+ anchorSide = $[2];
181
+ ignoreClickRefs = $[3];
182
+ initialFocusRef = $[4];
183
+ left = $[5];
184
+ onClickOutside = $[6];
185
+ onEscape = $[7];
186
+ portalContainerName = $[8];
187
+ preventFocusOnOpen = $[9];
188
+ props = $[10];
189
+ responsiveVariant = $[11];
190
+ returnFocusRef = $[12];
191
+ right = $[13];
192
+ t1 = $[14];
193
+ t2 = $[15];
194
+ t3 = $[16];
195
+ t4 = $[17];
196
+ t5 = $[18];
193
197
  }
194
198
  const height = t1 === undefined ? "auto" : t1;
195
199
  const preventOverflow = t2 === undefined ? true : t2;
196
200
  const role = t3 === undefined ? "none" : t3;
197
201
  const visibility = t4 === undefined ? "visible" : t4;
198
202
  const width = t5 === undefined ? "auto" : t5;
199
- const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
200
203
  const featureFlagMaxHeightClampToViewport = useFeatureFlag("primer_react_overlay_max_height_clamp_to_viewport");
201
204
  const overlayRef = useRef(null);
202
205
  useRefObjectAsForwardedRef(forwardedRef, overlayRef);
206
+ const cssAnchorPositioning = useFeatureFlag("primer_react_css_anchor_positioning");
203
207
  let t6;
204
- if ($[18] !== ignoreClickRefs || $[19] !== initialFocusRef || $[20] !== onClickOutside || $[21] !== onEscape || $[22] !== preventFocusOnOpen || $[23] !== returnFocusRef) {
208
+ if ($[19] !== ignoreClickRefs || $[20] !== initialFocusRef || $[21] !== onClickOutside || $[22] !== onEscape || $[23] !== preventFocusOnOpen || $[24] !== returnFocusRef) {
205
209
  t6 = {
206
210
  overlayRef,
207
211
  returnFocusRef,
@@ -211,20 +215,20 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
211
215
  initialFocusRef,
212
216
  preventFocusOnOpen
213
217
  };
214
- $[18] = ignoreClickRefs;
215
- $[19] = initialFocusRef;
216
- $[20] = onClickOutside;
217
- $[21] = onEscape;
218
- $[22] = preventFocusOnOpen;
219
- $[23] = returnFocusRef;
220
- $[24] = t6;
218
+ $[19] = ignoreClickRefs;
219
+ $[20] = initialFocusRef;
220
+ $[21] = onClickOutside;
221
+ $[22] = onEscape;
222
+ $[23] = preventFocusOnOpen;
223
+ $[24] = returnFocusRef;
224
+ $[25] = t6;
221
225
  } else {
222
- t6 = $[24];
226
+ t6 = $[25];
223
227
  }
224
228
  useOverlay(t6);
225
229
  let t7;
226
230
  let t8;
227
- if ($[25] !== height) {
231
+ if ($[26] !== height) {
228
232
  t7 = () => {
229
233
  var _overlayRef$current;
230
234
  if (height === "initial" && (_overlayRef$current = overlayRef.current) !== null && _overlayRef$current !== void 0 && _overlayRef$current.clientHeight) {
@@ -232,17 +236,17 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
232
236
  }
233
237
  };
234
238
  t8 = [height];
235
- $[25] = height;
236
- $[26] = t7;
237
- $[27] = t8;
239
+ $[26] = height;
240
+ $[27] = t7;
241
+ $[28] = t8;
238
242
  } else {
239
- t7 = $[26];
240
- t8 = $[27];
243
+ t7 = $[27];
244
+ t8 = $[28];
241
245
  }
242
246
  useEffect(t7, t8);
243
247
  let t10;
244
248
  let t9;
245
- if ($[28] !== anchorSide || $[29] !== visibility) {
249
+ if ($[29] !== anchorSide || $[30] !== visibility) {
246
250
  t9 = () => {
247
251
  var _overlayRef$current2;
248
252
  const {
@@ -260,29 +264,29 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
260
264
  });
261
265
  };
262
266
  t10 = [anchorSide, 8, "cubic-bezier(0.33, 1, 0.68, 1)", visibility];
263
- $[28] = anchorSide;
264
- $[29] = visibility;
265
- $[30] = t10;
266
- $[31] = t9;
267
+ $[29] = anchorSide;
268
+ $[30] = visibility;
269
+ $[31] = t10;
270
+ $[32] = t9;
267
271
  } else {
268
- t10 = $[30];
269
- t9 = $[31];
272
+ t10 = $[31];
273
+ t9 = $[32];
270
274
  }
271
275
  useIsomorphicLayoutEffect(t9, t10);
272
276
  const leftPosition = left === undefined && right === undefined ? 0 : left;
273
277
  const t11 = !preventOverflow ? true : undefined;
274
278
  let t12;
275
- if ($[32] !== featureFlagMaxHeightClampToViewport) {
279
+ if ($[33] !== featureFlagMaxHeightClampToViewport) {
276
280
  t12 = featureFlagMaxHeightClampToViewport ? {
277
281
  "data-max-height-clamp-to-viewport": ""
278
282
  } : {};
279
- $[32] = featureFlagMaxHeightClampToViewport;
280
- $[33] = t12;
283
+ $[33] = featureFlagMaxHeightClampToViewport;
284
+ $[34] = t12;
281
285
  } else {
282
- t12 = $[33];
286
+ t12 = $[34];
283
287
  }
284
288
  let t13;
285
- if ($[34] !== height || $[35] !== leftPosition || $[36] !== props || $[37] !== responsiveVariant || $[38] !== right || $[39] !== role || $[40] !== t11 || $[41] !== t12 || $[42] !== visibility || $[43] !== width) {
289
+ if ($[35] !== height || $[36] !== leftPosition || $[37] !== props || $[38] !== responsiveVariant || $[39] !== right || $[40] !== role || $[41] !== t11 || $[42] !== t12 || $[43] !== visibility || $[44] !== width) {
286
290
  t13 = /*#__PURE__*/jsx(BaseOverlay, {
287
291
  role: role,
288
292
  width: width,
@@ -296,35 +300,35 @@ const Overlay = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
296
300
  ...t12,
297
301
  ...props
298
302
  });
299
- $[34] = height;
300
- $[35] = leftPosition;
301
- $[36] = props;
302
- $[37] = responsiveVariant;
303
- $[38] = right;
304
- $[39] = role;
305
- $[40] = t11;
306
- $[41] = t12;
307
- $[42] = visibility;
308
- $[43] = width;
309
- $[44] = t13;
303
+ $[35] = height;
304
+ $[36] = leftPosition;
305
+ $[37] = props;
306
+ $[38] = responsiveVariant;
307
+ $[39] = right;
308
+ $[40] = role;
309
+ $[41] = t11;
310
+ $[42] = t12;
311
+ $[43] = visibility;
312
+ $[44] = width;
313
+ $[45] = t13;
310
314
  } else {
311
- t13 = $[44];
315
+ t13 = $[45];
312
316
  }
313
317
  const overlayContent = t13;
314
- if (cssAnchorPositioning) {
318
+ if (_PrivateDisablePortal && cssAnchorPositioning) {
315
319
  return overlayContent;
316
320
  }
317
321
  let t14;
318
- if ($[45] !== overlayContent || $[46] !== portalContainerName) {
322
+ if ($[46] !== overlayContent || $[47] !== portalContainerName) {
319
323
  t14 = /*#__PURE__*/jsx(Portal, {
320
324
  containerName: portalContainerName,
321
325
  children: overlayContent
322
326
  });
323
- $[45] = overlayContent;
324
- $[46] = portalContainerName;
325
- $[47] = t14;
327
+ $[46] = overlayContent;
328
+ $[47] = portalContainerName;
329
+ $[48] = t14;
326
330
  } else {
327
- t14 = $[47];
331
+ t14 = $[48];
328
332
  }
329
333
  return t14;
330
334
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AAKrC,MAAM,MAAM,KAAK,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,CAAA;AACxC,KAAK,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AACnD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAAA;AAElD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AA8BD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAsF/E,CAAA;AAED,wBAAgB,QAAQ;YAnHd,KAAK;kBACC,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BAChB,MAAM;kBACJ,MAAM;kBACN,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;kBACvD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oBAC1C,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;EAmH7D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,UAG1F;AAqED,eAAe,aAAa,CAAA"}
@@ -1,6 +1,5 @@
1
1
  import { c } from 'react-compiler-runtime';
2
2
  import React from 'react';
3
- import ReactDOM from 'react-dom';
4
3
  import theme from './theme.js';
5
4
  import deepmerge from 'deepmerge';
6
5
  import { useSyncedState } from './hooks/useSyncedState.js';
@@ -20,71 +19,115 @@ const ThemeContext = /*#__PURE__*/React.createContext({
20
19
  });
21
20
 
22
21
  // inspired from __NEXT_DATA__, we use application/json to avoid CSRF policy with inline scripts
22
+ const serverHandoffCache = new Map();
23
+ const emptyHandoff = {};
23
24
  const getServerHandoff = id => {
25
+ if (typeof document === 'undefined') return emptyHandoff;
26
+ const cached = serverHandoffCache.get(id);
27
+ if (cached !== undefined) return cached;
24
28
  try {
25
29
  var _document$getElementB;
26
30
  const serverData = (_document$getElementB = document.getElementById(`__PRIMER_DATA_${id}__`)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.textContent;
27
- if (serverData) return JSON.parse(serverData);
31
+ if (serverData) {
32
+ const parsed = JSON.parse(serverData);
33
+ serverHandoffCache.set(id, parsed);
34
+ return parsed;
35
+ }
28
36
  } catch (_error) {
29
37
  // if document/element does not exist or JSON is invalid, suppress error
30
38
  }
31
- return {};
39
+ const empty = {};
40
+ serverHandoffCache.set(id, empty);
41
+ return empty;
32
42
  };
33
- const ThemeProvider = ({
34
- children,
35
- ...props
36
- }) => {
43
+ const emptySubscribe = () => () => {};
44
+ const ThemeProvider = t0 => {
37
45
  var _ref, _props$colorMode, _ref2, _props$dayScheme, _ref3, _props$nightScheme;
38
- // Get fallback values from parent ThemeProvider (if exists)
46
+ const $ = c(42);
47
+ let children;
48
+ let props;
49
+ if ($[0] !== t0) {
50
+ ({
51
+ children,
52
+ ...props
53
+ } = t0);
54
+ $[0] = t0;
55
+ $[1] = children;
56
+ $[2] = props;
57
+ } else {
58
+ children = $[1];
59
+ props = $[2];
60
+ }
39
61
  const {
40
62
  theme: fallbackTheme,
41
63
  colorMode: fallbackColorMode,
42
64
  dayScheme: fallbackDayScheme,
43
65
  nightScheme: fallbackNightScheme
44
66
  } = useTheme();
45
-
46
- // Initialize state
47
67
  const theme$1 = fallbackTheme !== null && fallbackTheme !== void 0 ? fallbackTheme : theme;
48
68
  const uniqueDataId = useId();
49
- const {
50
- resolvedServerColorMode
51
- } = getServerHandoff(uniqueDataId);
52
- const resolvedColorModePassthrough = React.useRef(resolvedServerColorMode);
53
69
  const [colorMode, setColorMode] = useSyncedState((_ref = (_props$colorMode = props.colorMode) !== null && _props$colorMode !== void 0 ? _props$colorMode : fallbackColorMode) !== null && _ref !== void 0 ? _ref : defaultColorMode);
54
70
  const [dayScheme, setDayScheme] = useSyncedState((_ref2 = (_props$dayScheme = props.dayScheme) !== null && _props$dayScheme !== void 0 ? _props$dayScheme : fallbackDayScheme) !== null && _ref2 !== void 0 ? _ref2 : defaultDayScheme);
55
71
  const [nightScheme, setNightScheme] = useSyncedState((_ref3 = (_props$nightScheme = props.nightScheme) !== null && _props$nightScheme !== void 0 ? _props$nightScheme : fallbackNightScheme) !== null && _ref3 !== void 0 ? _ref3 : defaultNightScheme);
56
72
  const systemColorMode = useSystemColorMode();
57
- // eslint-disable-next-line react-hooks/refs
58
- const resolvedColorMode = resolvedColorModePassthrough.current || resolveColorMode(colorMode, systemColorMode);
59
- const colorScheme = chooseColorScheme(resolvedColorMode, dayScheme, nightScheme);
73
+ let t1;
74
+ if ($[3] !== colorMode || $[4] !== systemColorMode) {
75
+ t1 = resolveColorMode(colorMode, systemColorMode);
76
+ $[3] = colorMode;
77
+ $[4] = systemColorMode;
78
+ $[5] = t1;
79
+ } else {
80
+ t1 = $[5];
81
+ }
82
+ const clientColorMode = t1;
83
+ let t2;
84
+ if ($[6] !== clientColorMode) {
85
+ t2 = () => clientColorMode;
86
+ $[6] = clientColorMode;
87
+ $[7] = t2;
88
+ } else {
89
+ t2 = $[7];
90
+ }
91
+ let t3;
92
+ if ($[8] !== clientColorMode || $[9] !== uniqueDataId) {
93
+ t3 = () => {
94
+ var _getServerHandoff$res;
95
+ return (_getServerHandoff$res = getServerHandoff(uniqueDataId).resolvedServerColorMode) !== null && _getServerHandoff$res !== void 0 ? _getServerHandoff$res : clientColorMode;
96
+ };
97
+ $[8] = clientColorMode;
98
+ $[9] = uniqueDataId;
99
+ $[10] = t3;
100
+ } else {
101
+ t3 = $[10];
102
+ }
103
+ const resolvedColorMode = React.useSyncExternalStore(emptySubscribe, t2, t3);
104
+ let t4;
105
+ if ($[11] !== dayScheme || $[12] !== nightScheme || $[13] !== resolvedColorMode) {
106
+ t4 = chooseColorScheme(resolvedColorMode, dayScheme, nightScheme);
107
+ $[11] = dayScheme;
108
+ $[12] = nightScheme;
109
+ $[13] = resolvedColorMode;
110
+ $[14] = t4;
111
+ } else {
112
+ t4 = $[14];
113
+ }
114
+ const colorScheme = t4;
115
+ let t5;
116
+ if ($[15] !== colorScheme || $[16] !== theme$1) {
117
+ t5 = applyColorScheme(theme$1, colorScheme);
118
+ $[15] = colorScheme;
119
+ $[16] = theme$1;
120
+ $[17] = t5;
121
+ } else {
122
+ t5 = $[17];
123
+ }
60
124
  const {
61
125
  resolvedTheme,
62
126
  resolvedColorScheme
63
- } = React.useMemo(() => applyColorScheme(theme$1, colorScheme), [theme$1, colorScheme]);
64
-
65
- // this effect will only run on client
66
- React.useEffect(function updateColorModeAfterServerPassthrough() {
67
- const resolvedColorModeOnClient = resolveColorMode(colorMode, systemColorMode);
68
- if (resolvedColorModePassthrough.current) {
69
- // if the resolved color mode passed on from the server is not the resolved color mode on client, change it!
70
- if (resolvedColorModePassthrough.current !== resolvedColorModeOnClient) {
71
- window.setTimeout(() => {
72
- // use ReactDOM.flushSync to prevent automatic batching of state updates since React 18
73
- // ref: https://github.com/reactwg/react-18/discussions/21
74
- ReactDOM.flushSync(() => {
75
- // override colorMode to whatever is resolved on the client to get a re-render
76
- setColorMode(resolvedColorModeOnClient);
77
- });
78
-
79
- // immediately after that, set the colorMode to what the user passed to respond to system color mode changes
80
- setColorMode(colorMode);
81
- });
82
- }
83
- resolvedColorModePassthrough.current = null;
84
- }
85
- }, [colorMode, systemColorMode, setColorMode]);
86
- return /*#__PURE__*/jsx(ThemeContext.Provider, {
87
- value: {
127
+ } = t5;
128
+ let t6;
129
+ if ($[18] !== colorMode || $[19] !== colorScheme || $[20] !== dayScheme || $[21] !== nightScheme || $[22] !== resolvedColorMode || $[23] !== resolvedColorScheme || $[24] !== resolvedTheme || $[25] !== setColorMode || $[26] !== setDayScheme || $[27] !== setNightScheme) {
130
+ t6 = {
88
131
  theme: resolvedTheme,
89
132
  colorScheme,
90
133
  colorMode,
@@ -95,24 +138,72 @@ const ThemeProvider = ({
95
138
  setColorMode,
96
139
  setDayScheme,
97
140
  setNightScheme
98
- },
99
- children: /*#__PURE__*/jsxs("div", {
100
- "data-color-mode": colorMode === 'auto' ? 'auto' : colorScheme.includes('dark') ? 'dark' : 'light',
141
+ };
142
+ $[18] = colorMode;
143
+ $[19] = colorScheme;
144
+ $[20] = dayScheme;
145
+ $[21] = nightScheme;
146
+ $[22] = resolvedColorMode;
147
+ $[23] = resolvedColorScheme;
148
+ $[24] = resolvedTheme;
149
+ $[25] = setColorMode;
150
+ $[26] = setDayScheme;
151
+ $[27] = setNightScheme;
152
+ $[28] = t6;
153
+ } else {
154
+ t6 = $[28];
155
+ }
156
+ const contextValue = t6;
157
+ const t7 = colorMode === "auto" ? "auto" : colorScheme.includes("dark") ? "dark" : "light";
158
+ let t8;
159
+ if ($[29] !== props.preventSSRMismatch || $[30] !== resolvedColorMode || $[31] !== uniqueDataId) {
160
+ t8 = props.preventSSRMismatch ? /*#__PURE__*/jsx("script", {
161
+ type: "application/json",
162
+ id: `__PRIMER_DATA_${uniqueDataId}__`,
163
+ dangerouslySetInnerHTML: {
164
+ __html: JSON.stringify({
165
+ resolvedServerColorMode: resolvedColorMode
166
+ })
167
+ }
168
+ }) : null;
169
+ $[29] = props.preventSSRMismatch;
170
+ $[30] = resolvedColorMode;
171
+ $[31] = uniqueDataId;
172
+ $[32] = t8;
173
+ } else {
174
+ t8 = $[32];
175
+ }
176
+ let t9;
177
+ if ($[33] !== children || $[34] !== dayScheme || $[35] !== nightScheme || $[36] !== t7 || $[37] !== t8) {
178
+ t9 = /*#__PURE__*/jsxs("div", {
179
+ "data-color-mode": t7,
101
180
  "data-light-theme": dayScheme,
102
181
  "data-dark-theme": nightScheme,
103
- children: [children, props.preventSSRMismatch ? /*#__PURE__*/jsx("script", {
104
- type: "application/json",
105
- id: `__PRIMER_DATA_${uniqueDataId}__`,
106
- dangerouslySetInnerHTML: {
107
- __html: JSON.stringify({
108
- resolvedServerColorMode: resolvedColorMode
109
- })
110
- }
111
- }) : null]
112
- })
113
- });
182
+ children: [children, t8]
183
+ });
184
+ $[33] = children;
185
+ $[34] = dayScheme;
186
+ $[35] = nightScheme;
187
+ $[36] = t7;
188
+ $[37] = t8;
189
+ $[38] = t9;
190
+ } else {
191
+ t9 = $[38];
192
+ }
193
+ let t10;
194
+ if ($[39] !== contextValue || $[40] !== t9) {
195
+ t10 = /*#__PURE__*/jsx(ThemeContext.Provider, {
196
+ value: contextValue,
197
+ children: t9
198
+ });
199
+ $[39] = contextValue;
200
+ $[40] = t9;
201
+ $[41] = t10;
202
+ } else {
203
+ t10 = $[41];
204
+ }
205
+ return t10;
114
206
  };
115
- ThemeProvider.displayName = "ThemeProvider";
116
207
  function useTheme() {
117
208
  return React.useContext(ThemeContext);
118
209
  }
@@ -124,57 +215,25 @@ function useColorSchemeVar(values, fallback) {
124
215
  const colorScheme = t0 === undefined ? "" : t0;
125
216
  return (_values$colorScheme = values[colorScheme]) !== null && _values$colorScheme !== void 0 ? _values$colorScheme : fallback;
126
217
  }
218
+ function subscribeToSystemColorMode(callback) {
219
+ var _window, _window$matchMedia;
220
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
221
+ const media = (_window = window) === null || _window === void 0 ? void 0 : (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, '(prefers-color-scheme: dark)');
222
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
223
+ media === null || media === void 0 ? void 0 : media.addEventListener('change', callback);
224
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
225
+ return () => media === null || media === void 0 ? void 0 : media.removeEventListener('change', callback);
226
+ }
127
227
  function useSystemColorMode() {
128
- const $ = c(2);
129
- const [systemColorMode, setSystemColorMode] = React.useState(getSystemColorMode);
130
- let t0;
131
- let t1;
132
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
133
- t0 = () => {
134
- var _window, _window$matchMedia;
135
- const media = (_window = window) === null || _window === void 0 ? void 0 : (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-color-scheme: dark)");
136
- const matchesMediaToColorMode = function matchesMediaToColorMode(matches) {
137
- return matches ? "night" : "day";
138
- };
139
- const handleChange = function handleChange(event) {
140
- const isNight = event.matches;
141
- setSystemColorMode(matchesMediaToColorMode(isNight));
142
- };
143
- if (media) {
144
- const isNight_0 = media.matches;
145
- setSystemColorMode(matchesMediaToColorMode(isNight_0));
146
- if (media.addEventListener !== undefined) {
147
- media.addEventListener("change", handleChange);
148
- return function cleanup() {
149
- media.removeEventListener("change", handleChange);
150
- };
151
- } else {
152
- if (media.addListener !== undefined) {
153
- media.addListener(handleChange);
154
- return function cleanup() {
155
- media.removeListener(handleChange);
156
- };
157
- }
158
- }
159
- }
160
- };
161
- t1 = [];
162
- $[0] = t0;
163
- $[1] = t1;
164
- } else {
165
- t0 = $[0];
166
- t1 = $[1];
167
- }
168
- React.useEffect(t0, t1);
169
- return systemColorMode;
228
+ return React.useSyncExternalStore(subscribeToSystemColorMode, getSystemColorMode, _temp);
229
+ }
230
+ function _temp() {
231
+ return "day";
170
232
  }
171
233
  function getSystemColorMode() {
172
- var _window$matchMedia2, _window2, _window$matchMedia2$c;
234
+ var _window2, _window2$matchMedia, _window2$matchMedia$c;
173
235
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
174
- if (typeof window !== 'undefined' && (_window$matchMedia2 = (_window2 = window).matchMedia) !== null && _window$matchMedia2 !== void 0 && (_window$matchMedia2$c = _window$matchMedia2.call(_window2, '(prefers-color-scheme: dark)')) !== null && _window$matchMedia2$c !== void 0 && _window$matchMedia2$c.matches) {
175
- return 'night';
176
- }
177
- return 'day';
236
+ return (_window2 = window) !== null && _window2 !== void 0 && (_window2$matchMedia = _window2.matchMedia) !== null && _window2$matchMedia !== void 0 && (_window2$matchMedia$c = _window2$matchMedia.call(_window2, '(prefers-color-scheme: dark)')) !== null && _window2$matchMedia$c !== void 0 && _window2$matchMedia$c.matches ? 'night' : 'day';
178
237
  }
179
238
  function resolveColorMode(colorMode, systemColorMode) {
180
239
  switch (colorMode) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.19.0-rc.0b59e8271",
4
+ "version": "38.19.0-rc.f3b0d9cc2",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "build": "./script/build",
40
40
  "clean": "rimraf dist generated",
41
41
  "start": "concurrently npm:start:*",
42
- "start:storybook": "STORYBOOK=true storybook dev -p 6006",
42
+ "start:storybook": "STORYBOOK=true storybook dev -p 6006 --no-open",
43
43
  "build:storybook": "storybook build",
44
44
  "build:docs": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs",
45
45
  "build:docs:preview": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs preview",
@@ -115,11 +115,12 @@
115
115
  "@rollup/plugin-node-resolve": "16.0.3",
116
116
  "@rollup/plugin-typescript": "12.3.0",
117
117
  "@rollup/plugin-virtual": "3.0.2",
118
- "@storybook/addon-a11y": "^10.1.11",
119
- "@storybook/addon-docs": "^10.1.11",
120
- "@storybook/addon-links": "^10.1.11",
118
+ "@storybook/addon-a11y": "^10.3.3",
119
+ "@storybook/addon-docs": "^10.3.3",
120
+ "@storybook/addon-links": "^10.3.3",
121
+ "@storybook/addon-mcp": "^0.4.2",
121
122
  "@storybook/icons": "^2.0.1",
122
- "@storybook/react-vite": "^10.1.11",
123
+ "@storybook/react-vite": "^10.3.3",
123
124
  "@testing-library/dom": "^10.4.0",
124
125
  "@testing-library/jest-dom": "^6.4.5",
125
126
  "@testing-library/react": "^16.3.0",
@@ -173,7 +174,7 @@
173
174
  "rimraf": "5.0.5",
174
175
  "rollup": "4.59.0",
175
176
  "rollup-plugin-import-css": "^0.0.0",
176
- "storybook": "^10.1.11",
177
+ "storybook": "^10.3.3",
177
178
  "terser": "5.36.0",
178
179
  "ts-toolbelt": "9.6.0",
179
180
  "tsx": "4.20.3",
@@ -1,2 +0,0 @@
1
- .prc-AnchoredOverlay-ResponsiveCloseButtonContainer-nuium{position:relative}.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:none;position:absolute;right:var(--base-size-8,.5rem);top:var(--base-size-8,.5rem)}@media screen and (max-width:calc(48rem - 0.02px)){.prc-AnchoredOverlay-ResponsiveCloseButton-z-2rx{display:inline-grid}}.prc-AnchoredOverlay-Wrapper-w6jU3{anchor-scope:--anchored-overlay-anchor}.prc-AnchoredOverlay-Anchor-DWRfK{anchor-name:--anchored-overlay-anchor}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z{position-anchor:--anchored-overlay-anchor;position-try-fallbacks:flip-block,flip-inline,flip-block flip-inline;position-visibility:anchors-visible;position:fixed;z-index:100}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-bottom]{left:anchor(left);top:calc(anchor(bottom) + var(--base-size-4,.25rem))}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-top]{bottom:anchor(top);left:anchor(left);margin-bottom:var(--base-size-4,.25rem)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-left]{margin-right:var(--base-size-4,.25rem);right:anchor(left);top:anchor(top)}.prc-AnchoredOverlay-AnchoredOverlay-fYg9Z[data-side=outside-right]{left:anchor(right);margin-left:var(--base-size-4,.25rem);top:anchor(top)}
2
- /*# sourceMappingURL=AnchoredOverlay-0f6f45b5.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/AnchoredOverlay/AnchoredOverlay.module.css.js"],"names":[],"mappings":"AAAA,0DACE,iBACF,CAEA,iDAIE,YAAa,CAHb,iBAAkB,CAElB,8BAAyB,CADzB,4BAOF,CAHE,mDANF,iDAOI,mBAEJ,CADE,CAGF,mCACE,sCACF,CAEA,kCAEE,qCACF,CAEA,2CAEE,yCAA0C,CAC1C,oEAGwB,CACxB,mCAAoC,CAEpC,cAAe,CADf,WA0BF,CAvBE,qEAGE,iBAAkB,CADlB,oDAEF,CAEA,kEAEE,kBAAmB,CACnB,iBAAkB,CAFlB,uCAGF,CAEA,mEAGE,sCAAgC,CAFhC,kBAAmB,CACnB,eAEF,CAEA,oEACE,kBAAmB,CAEnB,qCAA+B,CAD/B,eAEF","file":"AnchoredOverlay-0f6f45b5.css","sourcesContent":[".ResponsiveCloseButtonContainer {\n position: relative;\n}\n\n.ResponsiveCloseButton {\n position: absolute;\n top: var(--base-size-8);\n right: var(--base-size-8);\n display: none;\n\n @media screen and (--viewportRange-narrow) {\n display: inline-grid;\n }\n}\n\n.Wrapper {\n anchor-scope: --anchored-overlay-anchor;\n}\n\n.Anchor {\n /* Anchor name, this is currently tied to `renderAnchor` */\n anchor-name: --anchored-overlay-anchor;\n}\n\n.AnchoredOverlay {\n /* Anchor position, this is currently tied to `<Overlay>` */\n position-anchor: --anchored-overlay-anchor;\n position-try-fallbacks:\n flip-block,\n flip-inline,\n flip-block flip-inline;\n position-visibility: anchors-visible;\n z-index: 100;\n position: fixed;\n\n &[data-side='outside-bottom'] {\n /* stylelint-disable primer/spacing */\n top: calc(anchor(bottom) + var(--base-size-4));\n left: anchor(left);\n }\n\n &[data-side='outside-top'] {\n margin-bottom: var(--base-size-4);\n bottom: anchor(top);\n left: anchor(left);\n }\n\n &[data-side='outside-left'] {\n right: anchor(left);\n top: anchor(top);\n margin-right: var(--base-size-4);\n }\n\n &[data-side='outside-right'] {\n left: anchor(right);\n top: anchor(top);\n margin-left: var(--base-size-4);\n }\n}\n"]}