Skip to content

feat: update to upstream @floating-ui/utils@0.2.12#365

Draft
rust-for-web[bot] wants to merge 1 commit into
mainfrom
upstream/utils-0.2.12
Draft

feat: update to upstream @floating-ui/utils@0.2.12#365
rust-for-web[bot] wants to merge 1 commit into
mainfrom
upstream/utils-0.2.12

Conversation

@rust-for-web

@rust-for-web rust-for-web Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Release
@floating-ui/utils@0.2.12

Diff for packages/utils

Diff
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index 24cb85d0..73f7a8ea 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -1,5 +1,13 @@
 # @floating-ui/utils
 
+## 0.2.12
+
+### Patch Changes
+
+- fix: support explicit `undefined` for optional properties with `exactOptionalPropertyTypes`
+- fix(getPaddingObject): coalesce explicit `undefined` padding members to `0`
+- perf(utils): reduce bundle size in `getNearestOverflowAncestor`
+
 ## 0.2.11
 
 ### Patch Changes
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 9e47ac84..4446c081 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@floating-ui/utils",
-  "version": "0.2.11",
+  "version": "0.2.12",
   "description": "Utilities for Floating UI",
   "publishConfig": {
     "access": "public"
@@ -36,7 +36,7 @@
   },
   "scripts": {
     "lint": "eslint .",
-    "format": "prettier --write .",
+    "format": "prettier --ignore-path ../../.gitignore --write .",
     "clean": "rimraf dist out-tsc dom react",
     "test": "vitest run --globals",
     "test:watch": "vitest watch --globals",
diff --git a/packages/utils/src/dom.ts b/packages/utils/src/dom.ts
index dbbbaec6..137088b2 100644
--- a/packages/utils/src/dom.ts
+++ b/packages/utils/src/dom.ts
@@ -190,9 +190,7 @@ export function getNearestOverflowAncestor(node: Node): HTMLElement {
   const parentNode = getParentNode(node);
 
   if (isLastTraversableNode(parentNode)) {
-    return node.ownerDocument
-      ? node.ownerDocument.body
-      : (node as Document).body;
+    return (node.ownerDocument || (node as Document)).body;
   }
 
   if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 9ab0b52d..b59f2651 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -13,7 +13,7 @@ export type Length = 'width' | 'height';
 export type Dimensions = {[key in Length]: number};
 export type SideObject = {[key in Side]: number};
 export type Rect = Prettify<Coords & Dimensions>;
-export type Padding = number | Prettify<Partial<SideObject>>;
+export type Padding = number | Prettify<{[K in Side]?: number | undefined}>;
 export type ClientRectObject = Prettify<Rect & SideObject>;
 
 export interface ElementRects {
@@ -27,7 +27,7 @@ export interface ElementRects {
  */
 export interface VirtualElement {
   getBoundingClientRect(): ClientRectObject;
-  getClientRects?(): Array<ClientRectObject>;
+  getClientRects?: (() => Array<ClientRectObject>) | undefined;
   contextElement?: any;
 }
 
@@ -174,8 +174,15 @@ export function getOppositePlacement<T extends string>(placement: T): T {
   return (oppositeSideMap[side] + placement.slice(side.length)) as T;
 }
 
-export function expandPaddingObject(padding: Partial<SideObject>): SideObject {
-  return {top: 0, right: 0, bottom: 0, left: 0, ...padding};
+export function expandPaddingObject(
+  padding: Exclude<Padding, number>,
+): SideObject {
+  return {
+    top: padding.top ?? 0,
+    right: padding.right ?? 0,
+    bottom: padding.bottom ?? 0,
+    left: padding.left ?? 0,
+  };
 }
 
 export function getPaddingObject(padding: Padding): SideObject {
diff --git a/packages/utils/tsconfig.lib.json b/packages/utils/tsconfig.lib.json
index 56ec989a..fe73194b 100644
--- a/packages/utils/tsconfig.lib.json
+++ b/packages/utils/tsconfig.lib.json
@@ -1,7 +1,9 @@
 {
   "extends": "config/tsconfig.base.json",
   "compilerOptions": {
-    "outDir": "out-tsc"
+    "outDir": "out-tsc",
+    // TODO: move to config/tsconfig.base.json after https://github.com/vitejs/vite/issues/21715 is resolved.
+    "exactOptionalPropertyTypes": true
   },
   "include": ["src"]
 }

Full diff
0.2.11...0.2.12.

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.

0 participants