Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to upstream @floating-ui/[email protected] #43

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

github-actions[bot]
Copy link
Contributor

Release
@floating-ui/[email protected]

Diff for packages/core

Diff
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index 5b768ef4..1fc1c124 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,5 +1,13 @@
 # @floating-ui/core
 
+## 1.6.8
+
+### Patch Changes
+
+- fix(size): fill viewport along an axis if shift is enabled on that axis
+- fix(offset): avoid NaN when mainAxis or crossAxis is undefined
+- Update dependencies: `@floating-ui/[email protected]`
+
 ## 1.6.7
 
 ### Patch Changes
diff --git a/packages/core/package.json b/packages/core/package.json
index 84235646..2ba005d7 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@floating-ui/core",
-  "version": "1.6.7",
+  "version": "1.6.8",
   "description": "Positioning library for floating elements: tooltips, popovers, dropdowns, and more",
   "publishConfig": {
     "access": "public"
diff --git a/packages/core/src/middleware/offset.ts b/packages/core/src/middleware/offset.ts
index d9e9f154..f44dec86 100644
--- a/packages/core/src/middleware/offset.ts
+++ b/packages/core/src/middleware/offset.ts
@@ -59,7 +59,11 @@ export async function convertValueToCoords(
   let {mainAxis, crossAxis, alignmentAxis} =
     typeof rawValue === 'number'
       ? {mainAxis: rawValue, crossAxis: 0, alignmentAxis: null}
-      : {mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...rawValue};
+      : {
+          mainAxis: rawValue.mainAxis || 0,
+          crossAxis: rawValue.crossAxis || 0,
+          alignmentAxis: rawValue.alignmentAxis,
+        };
 
   if (alignment && typeof alignmentAxis === 'number') {
     crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
diff --git a/packages/core/src/middleware/shift.ts b/packages/core/src/middleware/shift.ts
index 24234709..79065056 100644
--- a/packages/core/src/middleware/shift.ts
+++ b/packages/core/src/middleware/shift.ts
@@ -91,6 +91,10 @@ export const shift = (
       data: {
         x: limitedCoords.x - x,
         y: limitedCoords.y - y,
+        enabled: {
+          [mainAxis]: checkMainAxis,
+          [crossAxis]: checkCrossAxis,
+        },
       },
     };
   },
diff --git a/packages/core/src/middleware/size.ts b/packages/core/src/middleware/size.ts
index d9b13f0e..3ddc9a75 100644
--- a/packages/core/src/middleware/size.ts
+++ b/packages/core/src/middleware/size.ts
@@ -82,16 +82,11 @@ export const size = (
     let availableHeight = overflowAvailableHeight;
     let availableWidth = overflowAvailableWidth;
 
-    if (isYAxis) {
-      availableWidth =
-        alignment || noShift
-          ? min(overflowAvailableWidth, maximumClippingWidth)
-          : maximumClippingWidth;
-    } else {
-      availableHeight =
-        alignment || noShift
-          ? min(overflowAvailableHeight, maximumClippingHeight)
-          : maximumClippingHeight;
+    if (state.middlewareData.shift?.enabled.x) {
+      availableWidth = maximumClippingWidth;
+    }
+    if (state.middlewareData.shift?.enabled.y) {
+      availableHeight = maximumClippingHeight;
     }
 
     if (noShift && !alignment) {
diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts
index b29b8d3c..57d39532 100644
--- a/packages/core/src/types.ts
+++ b/packages/core/src/types.ts
@@ -1,4 +1,5 @@
 import type {
+  Axis,
   ClientRectObject,
   Coords,
   Dimensions,
@@ -77,7 +78,9 @@ export interface MiddlewareData {
     escapedOffsets?: SideObject;
   };
   offset?: Coords & {placement: Placement};
-  shift?: Coords;
+  shift?: Coords & {
+    enabled: {[key in Axis]: boolean};
+  };
 }
 
 export interface ComputePositionConfig {

Full diff
1.6.7...1.6.8.

@DanielleHuisman DanielleHuisman marked this pull request as ready for review September 17, 2024 17:12
@DanielleHuisman DanielleHuisman merged commit e85c64f into main Sep 17, 2024
2 of 3 checks passed
@DanielleHuisman DanielleHuisman deleted the upstream/core-1.6.8 branch September 17, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant