@sanity/ui 2.8.9 → 2.8.10-canary.0
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 +41 -49
- 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-canary.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -51,32 +51,6 @@
|
|
|
51
51
|
"src",
|
|
52
52
|
"theme.js"
|
|
53
53
|
],
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
56
|
-
"clean": "rimraf .workshop dist",
|
|
57
|
-
"commit": "cz",
|
|
58
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
59
|
-
"cypress:open": "cypress open",
|
|
60
|
-
"cypress:run": "cypress run",
|
|
61
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
62
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
63
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
64
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
65
|
-
"pkg:build": "pkg build --strict",
|
|
66
|
-
"pkg:check": "pkg --strict",
|
|
67
|
-
"prepare": "husky install",
|
|
68
|
-
"prepack": "pnpm build",
|
|
69
|
-
"release": "semantic-release",
|
|
70
|
-
"storybook:build": "storybook build",
|
|
71
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
72
|
-
"test": "jest",
|
|
73
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
74
|
-
"ts:check": "tsc",
|
|
75
|
-
"watch": "pkg watch --strict",
|
|
76
|
-
"workshop:build": "workshop build",
|
|
77
|
-
"workshop:dev": "workshop dev",
|
|
78
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
79
|
-
},
|
|
80
54
|
"commitlint": {
|
|
81
55
|
"extends": [
|
|
82
56
|
"@commitlint/config-conventional"
|
|
@@ -125,20 +99,20 @@
|
|
|
125
99
|
"@sanity/prettier-config": "^1.0.2",
|
|
126
100
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
127
101
|
"@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.
|
|
102
|
+
"@storybook/addon-a11y": "^8.2.9",
|
|
103
|
+
"@storybook/addon-docs": "^8.2.9",
|
|
104
|
+
"@storybook/addon-essentials": "^8.2.9",
|
|
105
|
+
"@storybook/addon-interactions": "^8.2.9",
|
|
106
|
+
"@storybook/addon-links": "^8.2.9",
|
|
107
|
+
"@storybook/addon-mdx-gfm": "^8.2.9",
|
|
108
|
+
"@storybook/addon-storysource": "^8.2.9",
|
|
109
|
+
"@storybook/addon-themes": "^8.2.9",
|
|
110
|
+
"@storybook/blocks": "^8.2.9",
|
|
111
|
+
"@storybook/manager-api": "^8.2.9",
|
|
112
|
+
"@storybook/react": "^8.2.9",
|
|
113
|
+
"@storybook/react-vite": "^8.2.9",
|
|
114
|
+
"@storybook/test": "^8.2.9",
|
|
115
|
+
"@storybook/theming": "^8.2.9",
|
|
142
116
|
"@testing-library/dom": "^10.4.0",
|
|
143
117
|
"@testing-library/jest-dom": "^6.4.8",
|
|
144
118
|
"@testing-library/react": "^16.0.0",
|
|
@@ -182,7 +156,7 @@
|
|
|
182
156
|
"rimraf": "^5.0.5",
|
|
183
157
|
"semantic-release": "^24.0.0",
|
|
184
158
|
"start-server-and-test": "^2.0.5",
|
|
185
|
-
"storybook": "^8.2.
|
|
159
|
+
"storybook": "^8.2.9",
|
|
186
160
|
"styled-components": "^6.1.12",
|
|
187
161
|
"tsconfig-paths": "^4.2.0",
|
|
188
162
|
"typescript": "5.5.3",
|
|
@@ -195,19 +169,37 @@
|
|
|
195
169
|
"react-is": "^18",
|
|
196
170
|
"styled-components": "^5.2 || ^6"
|
|
197
171
|
},
|
|
198
|
-
"packageManager": "pnpm@9.7.0",
|
|
199
172
|
"engines": {
|
|
200
173
|
"node": ">=14.0.0"
|
|
201
174
|
},
|
|
202
175
|
"publishConfig": {
|
|
203
176
|
"access": "public"
|
|
204
177
|
},
|
|
205
|
-
"pnpm": {
|
|
206
|
-
"overrides": {
|
|
207
|
-
"conventional-changelog-conventionalcommits": ">= 8.0.0"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
178
|
"esm.sh": {
|
|
211
179
|
"bundle": false
|
|
180
|
+
},
|
|
181
|
+
"scripts": {
|
|
182
|
+
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
183
|
+
"clean": "rimraf .workshop dist",
|
|
184
|
+
"commit": "cz",
|
|
185
|
+
"cypress:dev": "run-p dev cypress:open",
|
|
186
|
+
"cypress:open": "cypress open",
|
|
187
|
+
"cypress:run": "cypress run",
|
|
188
|
+
"dev": "run-p storybook:dev workshop:dev",
|
|
189
|
+
"figma:pkg:build": "cd figma && pnpm build",
|
|
190
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
191
|
+
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
192
|
+
"pkg:build": "pkg build --strict",
|
|
193
|
+
"pkg:check": "pkg --strict",
|
|
194
|
+
"release": "semantic-release",
|
|
195
|
+
"storybook:build": "storybook build",
|
|
196
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
197
|
+
"test": "jest",
|
|
198
|
+
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
199
|
+
"ts:check": "tsc",
|
|
200
|
+
"watch": "pkg watch --strict",
|
|
201
|
+
"workshop:build": "workshop build",
|
|
202
|
+
"workshop:dev": "workshop dev",
|
|
203
|
+
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
212
204
|
}
|
|
213
|
-
}
|
|
205
|
+
}
|
|
@@ -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
|
+
}
|