@primer/react 0.0.0-20260413142532 → 0.0.0-20260413151131

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,6 +1,6 @@
1
1
  # @primer/react
2
2
 
3
- ## 0.0.0-20260413142532
3
+ ## 0.0.0-20260413151131
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -241,17 +241,19 @@ function getDefaultPosition(anchorElement, overlayWidth) {
241
241
  const rect = anchorElement.getBoundingClientRect();
242
242
  const vw = window.innerWidth;
243
243
  const viewportMargin = 8;
244
- const horizontal = vw - rect.right >= rect.left ? 'right' : 'left';
244
+ const spaceLeft = rect.left;
245
+ const spaceRight = vw - rect.right;
246
+ const horizontal = spaceLeft > spaceRight ? 'left' : 'right';
245
247
 
246
- // If there's no explicit overlay width, or the viewport is wide enough
248
+ // If there's no explicit overlay width, or either side has enough space
247
249
  // to contain the overlay, let CSS position-try-fallbacks handle positioning
248
- if (!overlayWidth || vw >= overlayWidth + viewportMargin * 2) {
250
+ if (!overlayWidth || spaceLeft >= overlayWidth + viewportMargin || spaceRight >= overlayWidth + viewportMargin) {
249
251
  return {
250
252
  horizontal
251
253
  };
252
254
  }
253
255
  const leftOffset = Math.max(0, overlayWidth - rect.right + viewportMargin);
254
- const rightOffset = Math.max(0, rect.right + overlayWidth - vw + viewportMargin);
256
+ const rightOffset = Math.max(0, rect.left + overlayWidth - vw + viewportMargin);
255
257
  return {
256
258
  horizontal,
257
259
  leftOffset,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "0.0.0-20260413142532",
4
+ "version": "0.0.0-20260413151131",
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",