@sanity/ui 2.8.9 → 2.8.10
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/dist/index.esm.js +5 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/core/primitives/popover/popover.tsx +28 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.10",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -125,20 +125,20 @@
|
|
|
125
125
|
"@sanity/prettier-config": "^1.0.2",
|
|
126
126
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
127
127
|
"@sanity/ui-workshop": "^2.0.16",
|
|
128
|
-
"@storybook/addon-a11y": "^8.2.
|
|
129
|
-
"@storybook/addon-docs": "^8.2.
|
|
130
|
-
"@storybook/addon-essentials": "^8.2.
|
|
131
|
-
"@storybook/addon-interactions": "^8.2.
|
|
132
|
-
"@storybook/addon-links": "^8.2.
|
|
133
|
-
"@storybook/addon-mdx-gfm": "^8.2.
|
|
134
|
-
"@storybook/addon-storysource": "^8.2.
|
|
135
|
-
"@storybook/addon-themes": "^8.2.
|
|
136
|
-
"@storybook/blocks": "^8.2.
|
|
137
|
-
"@storybook/manager-api": "^8.2.
|
|
138
|
-
"@storybook/react": "^8.2.
|
|
139
|
-
"@storybook/react-vite": "^8.2.
|
|
140
|
-
"@storybook/test": "^8.2.
|
|
141
|
-
"@storybook/theming": "^8.2.
|
|
128
|
+
"@storybook/addon-a11y": "^8.2.9",
|
|
129
|
+
"@storybook/addon-docs": "^8.2.9",
|
|
130
|
+
"@storybook/addon-essentials": "^8.2.9",
|
|
131
|
+
"@storybook/addon-interactions": "^8.2.9",
|
|
132
|
+
"@storybook/addon-links": "^8.2.9",
|
|
133
|
+
"@storybook/addon-mdx-gfm": "^8.2.9",
|
|
134
|
+
"@storybook/addon-storysource": "^8.2.9",
|
|
135
|
+
"@storybook/addon-themes": "^8.2.9",
|
|
136
|
+
"@storybook/blocks": "^8.2.9",
|
|
137
|
+
"@storybook/manager-api": "^8.2.9",
|
|
138
|
+
"@storybook/react": "^8.2.9",
|
|
139
|
+
"@storybook/react-vite": "^8.2.9",
|
|
140
|
+
"@storybook/test": "^8.2.9",
|
|
141
|
+
"@storybook/theming": "^8.2.9",
|
|
142
142
|
"@testing-library/dom": "^10.4.0",
|
|
143
143
|
"@testing-library/jest-dom": "^6.4.8",
|
|
144
144
|
"@testing-library/react": "^16.0.0",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"rimraf": "^5.0.5",
|
|
183
183
|
"semantic-release": "^24.0.0",
|
|
184
184
|
"start-server-and-test": "^2.0.5",
|
|
185
|
-
"storybook": "^8.2.
|
|
185
|
+
"storybook": "^8.2.9",
|
|
186
186
|
"styled-components": "^6.1.12",
|
|
187
187
|
"tsconfig-paths": "^4.2.0",
|
|
188
188
|
"typescript": "5.5.3",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import {
|
|
2
3
|
Middleware,
|
|
3
4
|
RootBoundary,
|
|
@@ -359,8 +360,7 @@ export const Popover = memo(
|
|
|
359
360
|
(node: HTMLElement | null) => {
|
|
360
361
|
refs.setReference(node)
|
|
361
362
|
|
|
362
|
-
|
|
363
|
-
const childRef = (childProp as any)?.ref
|
|
363
|
+
const childRef = getElementRef(childProp as any)
|
|
364
364
|
|
|
365
365
|
if (typeof childRef === 'function') {
|
|
366
366
|
childRef(node)
|
|
@@ -455,3 +455,29 @@ export const Popover = memo(
|
|
|
455
455
|
}),
|
|
456
456
|
)
|
|
457
457
|
Popover.displayName = 'Memo(ForwardRef(Popover))'
|
|
458
|
+
|
|
459
|
+
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
460
|
+
// After React 19 accessing `element.ref` does the opposite.
|
|
461
|
+
// https://github.com/facebook/react/pull/28348
|
|
462
|
+
//
|
|
463
|
+
// Access the ref using the method that doesn't yield a warning.
|
|
464
|
+
function getElementRef(element: React.ReactElement) {
|
|
465
|
+
// React <=18 in DEV
|
|
466
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get
|
|
467
|
+
let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
|
|
468
|
+
|
|
469
|
+
if (mayWarn) {
|
|
470
|
+
return (element as any).ref
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// React 19 in DEV
|
|
474
|
+
getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get
|
|
475
|
+
mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
|
|
476
|
+
|
|
477
|
+
if (mayWarn) {
|
|
478
|
+
return element.props.ref
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Not DEV
|
|
482
|
+
return element.props.ref || (element as any).ref
|
|
483
|
+
}
|