@sanity/ui 3.0.0-static.30 → 3.0.0-static.31
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/_chunks-cjs/_visual-editing.cjs +13 -14
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/refractor.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +13 -14
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +7227 -7227
- package/dist/css/index.d.ts +7227 -7227
- package/dist/index.cjs +11 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.js.map +1 -1
- package/package.json +25 -25
- package/src/core/__DEV__.ts +0 -1
- package/src/core/_compat/theme/theme.test.tsx +4 -3
- package/src/core/components/dialog/dialogCard.tsx +9 -2
- package/src/core/components/menu/menu.test.tsx +8 -7
- package/src/core/components/toast/toast.test.tsx +8 -7
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +1 -1
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +1 -1
- package/src/core/lib/createGlobalScopedContext.ts +5 -2
- package/src/core/lib/globalScope.ts +1 -1
- package/src/core/primitives/code/refractor.tsx +1 -1
- package/src/core/primitives/layer/layer.test.tsx +8 -7
- package/src/core/primitives/popover/popover.tsx +4 -29
- package/src/core/primitives/textArea/textArea.tsx +0 -2
- package/src/core/primitives/types.ts +11 -11
- package/src/core/types/props.ts +1 -0
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +8 -7
- package/src/core/utils/getElementRef.ts +2 -0
- package/src/core/utils/portal/portal.test.tsx +8 -7
- package/src/core/utils/portal/portalContext.ts +10 -7
- package/src/css/components/dialog/dialog.css.ts +2 -2
- package/src/css/primitives/button/button.css.ts +0 -2
- package/src/theme/v0/css.ts +2 -0
- package/src/theme/v2/build/merge.ts +2 -0
- package/src/theme/v3/merge.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "3.0.0-static.
|
|
3
|
+
"version": "3.0.0-static.31",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -99,45 +99,45 @@
|
|
|
99
99
|
"extends": "@sanity/semantic-release-preset"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@floating-ui/react-dom": "^2.1.
|
|
102
|
+
"@floating-ui/react-dom": "^2.1.3",
|
|
103
103
|
"@juggle/resize-observer": "^3.4.0",
|
|
104
104
|
"@sanity/color": "^3.0.6",
|
|
105
105
|
"@sanity/icons": "^3.7.0",
|
|
106
|
-
"@vanilla-extract/css": "^1.17.
|
|
107
|
-
"@vanilla-extract/dynamic": "^2.1.
|
|
106
|
+
"@vanilla-extract/css": "^1.17.4",
|
|
107
|
+
"@vanilla-extract/dynamic": "^2.1.5",
|
|
108
108
|
"csstype": "^3.1.3",
|
|
109
|
-
"framer-motion": "^12.
|
|
109
|
+
"framer-motion": "^12.18.1",
|
|
110
110
|
"gzip-size": "^7.0.0",
|
|
111
111
|
"react-compiler-runtime": "19.1.0-rc.2",
|
|
112
112
|
"react-refractor": "^2.2.0",
|
|
113
113
|
"use-effect-event": "^1.0.2"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@babel/core": "^7.27.
|
|
117
|
-
"@babel/preset-env": "^7.27.
|
|
116
|
+
"@babel/core": "^7.27.4",
|
|
117
|
+
"@babel/preset-env": "^7.27.2",
|
|
118
118
|
"@babel/preset-react": "^7.27.1",
|
|
119
119
|
"@babel/preset-typescript": "^7.27.1",
|
|
120
120
|
"@commitlint/cli": "19.5.0",
|
|
121
121
|
"@commitlint/config-conventional": "19.5.0",
|
|
122
|
-
"@eslint/js": "^9.
|
|
122
|
+
"@eslint/js": "^9.29.0",
|
|
123
123
|
"@sanity/browserslist-config": "^1.0.5",
|
|
124
|
-
"@sanity/pkg-utils": "^7.2.
|
|
125
|
-
"@sanity/prettier-config": "^1.0.
|
|
124
|
+
"@sanity/pkg-utils": "^7.2.6",
|
|
125
|
+
"@sanity/prettier-config": "^1.0.4",
|
|
126
126
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
127
127
|
"@sanity/ui-workshop": "^3.0.0",
|
|
128
128
|
"@testing-library/dom": "^10.4.0",
|
|
129
129
|
"@testing-library/jest-dom": "^6.6.3",
|
|
130
130
|
"@testing-library/react": "^16.3.0",
|
|
131
131
|
"@testing-library/user-event": "^14.6.1",
|
|
132
|
-
"@types/node": "^
|
|
133
|
-
"@types/react": "^19.1.
|
|
134
|
-
"@types/react-dom": "^19.1.
|
|
132
|
+
"@types/node": "^24.0.3",
|
|
133
|
+
"@types/react": "^19.1.8",
|
|
134
|
+
"@types/react-dom": "^19.1.6",
|
|
135
135
|
"@types/react-is": "^19.0.0",
|
|
136
136
|
"@types/refractor": "^3.4.1",
|
|
137
|
-
"@vanilla-extract/rollup-plugin": "^1.3.
|
|
138
|
-
"@vanilla-extract/vite-plugin": "^5.0.
|
|
139
|
-
"@vitejs/plugin-react": "^4.
|
|
140
|
-
"@vitest/browser": "^3.
|
|
137
|
+
"@vanilla-extract/rollup-plugin": "^1.3.17",
|
|
138
|
+
"@vanilla-extract/vite-plugin": "^5.0.6",
|
|
139
|
+
"@vitejs/plugin-react": "^4.5.2",
|
|
140
|
+
"@vitest/browser": "^3.2.3",
|
|
141
141
|
"autoprefixer": "^10.4.21",
|
|
142
142
|
"babel-plugin-react-compiler": "19.1.0-rc.2",
|
|
143
143
|
"cac": "^6.7.14",
|
|
@@ -147,8 +147,8 @@
|
|
|
147
147
|
"cypress-real-events": "^1.14.0",
|
|
148
148
|
"cz-conventional-changelog": "^3.3.0",
|
|
149
149
|
"dotenv-flow": "^4.1.0",
|
|
150
|
-
"eslint": "^9.
|
|
151
|
-
"eslint-config-prettier": "^10.1.
|
|
150
|
+
"eslint": "^9.29.0",
|
|
151
|
+
"eslint-config-prettier": "^10.1.5",
|
|
152
152
|
"eslint-formatter-compact": "^8.40.0",
|
|
153
153
|
"eslint-plugin-boundaries": "^5.0.1",
|
|
154
154
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -157,15 +157,15 @@
|
|
|
157
157
|
"eslint-plugin-react-hooks": "0.0.0-experimental-4448b187-20250515",
|
|
158
158
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
159
159
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
160
|
-
"eslint-plugin-storybook": "^9.0.
|
|
161
|
-
"globals": "^16.
|
|
160
|
+
"eslint-plugin-storybook": "^9.0.11",
|
|
161
|
+
"globals": "^16.2.0",
|
|
162
162
|
"husky": "^8.0.3",
|
|
163
163
|
"lightningcss": "^1.30.1",
|
|
164
164
|
"lint-staged": "^14.0.1",
|
|
165
165
|
"mkdirp": "^3.0.1",
|
|
166
166
|
"npm-run-all2": "^8.0.4",
|
|
167
|
-
"postcss": "^8.5.
|
|
168
|
-
"postcss-preset-env": "^10.2.
|
|
167
|
+
"postcss": "^8.5.6",
|
|
168
|
+
"postcss-preset-env": "^10.2.3",
|
|
169
169
|
"prettier": "^3.5.3",
|
|
170
170
|
"prettier-plugin-packagejson": "^2.5.15",
|
|
171
171
|
"react": "^19.1.0",
|
|
@@ -178,10 +178,10 @@
|
|
|
178
178
|
"styled-components": "^6.1.17",
|
|
179
179
|
"tsconfig-paths": "^4.2.0",
|
|
180
180
|
"typescript": "5.8.3",
|
|
181
|
-
"typescript-eslint": "^8.
|
|
181
|
+
"typescript-eslint": "^8.34.1",
|
|
182
182
|
"vite": "^6.3.5",
|
|
183
183
|
"vite-tsconfig-paths": "^5.1.4",
|
|
184
|
-
"vitest": "^3.2.
|
|
184
|
+
"vitest": "^3.2.3",
|
|
185
185
|
"vitest-axe": "1.0.0-pre.5"
|
|
186
186
|
},
|
|
187
187
|
"peerDependencies": {
|
package/src/core/__DEV__.ts
CHANGED
|
@@ -55,10 +55,11 @@ describe('theme', () => {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function Root() {
|
|
58
|
-
const value = undefined
|
|
59
|
-
|
|
60
58
|
return (
|
|
61
|
-
<ThemeContext.Provider
|
|
59
|
+
<ThemeContext.Provider
|
|
60
|
+
// @ts-expect-error - we want to test the error case
|
|
61
|
+
value={undefined}
|
|
62
|
+
>
|
|
62
63
|
<Debug />
|
|
63
64
|
</ThemeContext.Provider>
|
|
64
65
|
)
|
|
@@ -96,6 +96,8 @@ export function DialogCard<E extends DialogCardElementType = typeof DEFAULT_DIAL
|
|
|
96
96
|
const showCloseButton = Boolean(onClose) && hideCloseButton === false
|
|
97
97
|
const showHeader = Boolean(header) || showCloseButton
|
|
98
98
|
const [scrollTop, setScrollTop] = useState(0)
|
|
99
|
+
const [scrollHeight, setScrollHeight] = useState(0)
|
|
100
|
+
const scrollBottom = scrollHeight - scrollTop
|
|
99
101
|
|
|
100
102
|
useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)
|
|
101
103
|
useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(
|
|
@@ -156,8 +158,8 @@ export function DialogCard<E extends DialogCardElementType = typeof DEFAULT_DIAL
|
|
|
156
158
|
if (!el) return
|
|
157
159
|
|
|
158
160
|
const handleScroll = () => {
|
|
159
|
-
// console.log('scroll', el.scrollTop)
|
|
160
161
|
setScrollTop(el.scrollTop)
|
|
162
|
+
setScrollHeight(el.scrollHeight - el.offsetHeight)
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
el.addEventListener('scroll', handleScroll, {passive: true})
|
|
@@ -213,7 +215,12 @@ export function DialogCard<E extends DialogCardElementType = typeof DEFAULT_DIAL
|
|
|
213
215
|
{children}
|
|
214
216
|
</Box>
|
|
215
217
|
|
|
216
|
-
{footer &&
|
|
218
|
+
{footer && (
|
|
219
|
+
<div
|
|
220
|
+
className={dialogScrollerShadowBottom()}
|
|
221
|
+
style={{opacity: Math.min(scrollBottom, 32) / 32}}
|
|
222
|
+
/>
|
|
223
|
+
)}
|
|
217
224
|
</Box>
|
|
218
225
|
|
|
219
226
|
{footer && (
|
|
@@ -79,10 +79,11 @@ describe('components/menu', () => {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
function Root() {
|
|
82
|
-
const value: any = undefined
|
|
83
|
-
|
|
84
82
|
return (
|
|
85
|
-
<MenuContext.Provider
|
|
83
|
+
<MenuContext.Provider
|
|
84
|
+
// @ts-expect-error - we want to test the error case
|
|
85
|
+
value={undefined}
|
|
86
|
+
>
|
|
86
87
|
<Debug />
|
|
87
88
|
</MenuContext.Provider>
|
|
88
89
|
)
|
|
@@ -108,12 +109,12 @@ describe('components/menu', () => {
|
|
|
108
109
|
|
|
109
110
|
function Root() {
|
|
110
111
|
// NOTE: we’re testing this because the context value may be a function in the future
|
|
111
|
-
const value: any = () => {
|
|
112
|
-
return {version: 1}
|
|
113
|
-
}
|
|
114
112
|
|
|
115
113
|
return (
|
|
116
|
-
<MenuContext.Provider
|
|
114
|
+
<MenuContext.Provider
|
|
115
|
+
// @ts-expect-error - we want to test the error case
|
|
116
|
+
value={() => ({version: 1})}
|
|
117
|
+
>
|
|
117
118
|
<Debug />
|
|
118
119
|
</MenuContext.Provider>
|
|
119
120
|
)
|
|
@@ -51,10 +51,11 @@ describe('components/toast', () => {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function Root() {
|
|
54
|
-
const value = undefined
|
|
55
|
-
|
|
56
54
|
return (
|
|
57
|
-
<ToastContext.Provider
|
|
55
|
+
<ToastContext.Provider
|
|
56
|
+
// @ts-expect-error - we want to test the error case
|
|
57
|
+
value={undefined}
|
|
58
|
+
>
|
|
58
59
|
<Debug />
|
|
59
60
|
</ToastContext.Provider>
|
|
60
61
|
)
|
|
@@ -80,12 +81,12 @@ describe('components/toast', () => {
|
|
|
80
81
|
|
|
81
82
|
function Root() {
|
|
82
83
|
// NOTE: we’re testing this because the context value may be a function in the future
|
|
83
|
-
const value = () => {
|
|
84
|
-
return {version: 1}
|
|
85
|
-
}
|
|
86
84
|
|
|
87
85
|
return (
|
|
88
|
-
<ToastContext.Provider
|
|
86
|
+
<ToastContext.Provider
|
|
87
|
+
// @ts-expect-error - we want to test the error case
|
|
88
|
+
value={() => ({version: 1})}
|
|
89
|
+
>
|
|
89
90
|
<Debug />
|
|
90
91
|
</ToastContext.Provider>
|
|
91
92
|
)
|
|
@@ -28,7 +28,10 @@ export function createGlobalScopedContext<ContextType, const T extends ContextTy
|
|
|
28
28
|
return createContext<ContextType>(defaultValue)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
// Use the global scope as a map of symbols to contexts
|
|
32
|
+
const symbolMap = globalScope as Record<symbol, Context<ContextType>>
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
symbolMap[symbol] = symbolMap[symbol] || createContext<T>(defaultValue)
|
|
35
|
+
|
|
36
|
+
return symbolMap[symbol]
|
|
34
37
|
}
|
|
@@ -7,7 +7,7 @@ export default function LazyRefractor(
|
|
|
7
7
|
) {
|
|
8
8
|
const {language: languageProp, value} = props
|
|
9
9
|
const language = typeof languageProp === 'string' ? languageProp : undefined
|
|
10
|
-
const registered = language ? Refractor.hasLanguage(language
|
|
10
|
+
const registered = language ? Refractor.hasLanguage(language) : false
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<>
|
|
@@ -58,10 +58,11 @@ describe('primitives/layer', () => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function Root() {
|
|
61
|
-
const value = undefined
|
|
62
|
-
|
|
63
61
|
return (
|
|
64
|
-
<LayerContext.Provider
|
|
62
|
+
<LayerContext.Provider
|
|
63
|
+
// @ts-expect-error - we want to test the error case
|
|
64
|
+
value={undefined}
|
|
65
|
+
>
|
|
65
66
|
<Debug />
|
|
66
67
|
</LayerContext.Provider>
|
|
67
68
|
)
|
|
@@ -87,12 +88,12 @@ describe('primitives/layer', () => {
|
|
|
87
88
|
|
|
88
89
|
function Root() {
|
|
89
90
|
// NOTE: we’re testing this because the context value may be a function in the future
|
|
90
|
-
const value = () => {
|
|
91
|
-
return {version: 1}
|
|
92
|
-
}
|
|
93
91
|
|
|
94
92
|
return (
|
|
95
|
-
<LayerContext.Provider
|
|
93
|
+
<LayerContext.Provider
|
|
94
|
+
// @ts-expect-error - we want to test the error case
|
|
95
|
+
value={() => ({version: 1})}
|
|
96
|
+
>
|
|
96
97
|
<Debug />
|
|
97
98
|
</LayerContext.Provider>
|
|
98
99
|
)
|
|
@@ -31,6 +31,7 @@ import {origin} from '../../middleware/origin'
|
|
|
31
31
|
import type {Placement} from '../../types/placement'
|
|
32
32
|
import type {ComponentType, Props} from '../../types/props'
|
|
33
33
|
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
34
|
+
import {getElementRef} from '../../utils/getElementRef'
|
|
34
35
|
import {Portal} from '../../utils/portal/portal'
|
|
35
36
|
import {CardProvider} from '../card/cardProvider'
|
|
36
37
|
import {useCard} from '../card/useCard'
|
|
@@ -327,7 +328,9 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
327
328
|
(node: HTMLElement | null) => {
|
|
328
329
|
refs.setReference(node)
|
|
329
330
|
|
|
330
|
-
|
|
331
|
+
if (!childProp) return
|
|
332
|
+
|
|
333
|
+
const childRef = getElementRef(childProp)
|
|
331
334
|
|
|
332
335
|
if (typeof childRef === 'function') {
|
|
333
336
|
childRef(node)
|
|
@@ -423,31 +426,3 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
423
426
|
</>
|
|
424
427
|
)
|
|
425
428
|
}
|
|
426
|
-
|
|
427
|
-
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
428
|
-
// After React 19 accessing `element.ref` does the opposite.
|
|
429
|
-
// https://github.com/facebook/react/pull/28348
|
|
430
|
-
//
|
|
431
|
-
// Access the ref using the method that doesn't yield a warning.
|
|
432
|
-
function getElementRef(
|
|
433
|
-
element: ReactElement<{ref: ForwardedRef<HTMLElement>}>,
|
|
434
|
-
): ForwardedRef<HTMLElement> {
|
|
435
|
-
// React <=18 in DEV
|
|
436
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get
|
|
437
|
-
let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
|
|
438
|
-
|
|
439
|
-
if (mayWarn) {
|
|
440
|
-
return (element as any).ref
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
// React 19 in DEV
|
|
444
|
-
getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get
|
|
445
|
-
mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
|
|
446
|
-
|
|
447
|
-
if (mayWarn) {
|
|
448
|
-
return element.props.ref
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// Not DEV
|
|
452
|
-
return element.props.ref || (element as any).ref
|
|
453
|
-
}
|
|
@@ -23,7 +23,7 @@ import type {BoxDisplay} from './box/types'
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @public
|
|
26
|
-
* @deprecated
|
|
26
|
+
* @deprecated No longer used.
|
|
27
27
|
*/
|
|
28
28
|
export interface ResponsiveBorderProps {
|
|
29
29
|
border?: boolean | boolean[]
|
|
@@ -35,7 +35,7 @@ export interface ResponsiveBorderProps {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @public
|
|
38
|
-
* @deprecated
|
|
38
|
+
* @deprecated No longer used.
|
|
39
39
|
*/
|
|
40
40
|
export interface ResponsiveBoxProps {
|
|
41
41
|
display?: BoxDisplay | BoxDisplay[]
|
|
@@ -46,7 +46,7 @@ export interface ResponsiveBoxProps {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* @public
|
|
49
|
-
* @deprecated
|
|
49
|
+
* @deprecated No longer used.
|
|
50
50
|
*/
|
|
51
51
|
export interface ResponsiveFlexProps {
|
|
52
52
|
align?: AlignItems | AlignItems[]
|
|
@@ -57,7 +57,7 @@ export interface ResponsiveFlexProps {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* @public
|
|
60
|
-
* @deprecated
|
|
60
|
+
* @deprecated No longer used.
|
|
61
61
|
*/
|
|
62
62
|
export interface ResponsiveFlexItemProps {
|
|
63
63
|
/** Sets the flex CSS attribute. The property is responsive. */
|
|
@@ -66,7 +66,7 @@ export interface ResponsiveFlexItemProps {
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @public
|
|
69
|
-
* @deprecated
|
|
69
|
+
* @deprecated No longer used.
|
|
70
70
|
*/
|
|
71
71
|
export interface ResponsiveGridProps {
|
|
72
72
|
autoRows?: GridAutoRows | GridAutoRows[]
|
|
@@ -78,7 +78,7 @@ export interface ResponsiveGridProps {
|
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* @public
|
|
81
|
-
* @deprecated
|
|
81
|
+
* @deprecated No longer used.
|
|
82
82
|
*/
|
|
83
83
|
export interface ResponsiveGridItemProps {
|
|
84
84
|
column?: GridItemColumn | GridItemColumn[]
|
|
@@ -91,7 +91,7 @@ export interface ResponsiveGridItemProps {
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* @public
|
|
94
|
-
* @deprecated
|
|
94
|
+
* @deprecated No longer used.
|
|
95
95
|
*/
|
|
96
96
|
export interface ResponsiveMarginProps {
|
|
97
97
|
/** Applies margins to all sides. The property is responsive. */
|
|
@@ -108,7 +108,7 @@ export interface ResponsiveMarginProps {
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* @public
|
|
111
|
-
* @deprecated
|
|
111
|
+
* @deprecated No longer used.
|
|
112
112
|
*/
|
|
113
113
|
export interface ResponsivePaddingProps {
|
|
114
114
|
padding?: number | number[]
|
|
@@ -122,7 +122,7 @@ export interface ResponsivePaddingProps {
|
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* @public
|
|
125
|
-
* @deprecated
|
|
125
|
+
* @deprecated No longer used.
|
|
126
126
|
*/
|
|
127
127
|
export interface ResponsiveRadiusProps {
|
|
128
128
|
radius?: Radius | Radius[]
|
|
@@ -130,7 +130,7 @@ export interface ResponsiveRadiusProps {
|
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* @public
|
|
133
|
-
* @deprecated
|
|
133
|
+
* @deprecated No longer used.
|
|
134
134
|
*/
|
|
135
135
|
export interface ResponsiveShadowProps {
|
|
136
136
|
shadow?: number | number[]
|
|
@@ -138,7 +138,7 @@ export interface ResponsiveShadowProps {
|
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* @public
|
|
141
|
-
* @deprecated
|
|
141
|
+
* @deprecated No longer used.
|
|
142
142
|
*/
|
|
143
143
|
export interface ResponsiveWidthProps {
|
|
144
144
|
width?: number | 'auto' | (number | 'auto')[]
|
package/src/core/types/props.ts
CHANGED
|
@@ -49,10 +49,11 @@ describe('utils/boundaryElement', () => {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function Root() {
|
|
52
|
-
const value = undefined
|
|
53
|
-
|
|
54
52
|
return (
|
|
55
|
-
<BoundaryElementContext.Provider
|
|
53
|
+
<BoundaryElementContext.Provider
|
|
54
|
+
// @ts-expect-error - we want to test the error case
|
|
55
|
+
value={undefined}
|
|
56
|
+
>
|
|
56
57
|
<Debug />
|
|
57
58
|
</BoundaryElementContext.Provider>
|
|
58
59
|
)
|
|
@@ -79,12 +80,12 @@ describe('utils/boundaryElement', () => {
|
|
|
79
80
|
|
|
80
81
|
function Root() {
|
|
81
82
|
// NOTE: we’re testing this because the context value may be a function in the future
|
|
82
|
-
const value = () => {
|
|
83
|
-
return {version: 1}
|
|
84
|
-
}
|
|
85
83
|
|
|
86
84
|
return (
|
|
87
|
-
<BoundaryElementContext.Provider
|
|
85
|
+
<BoundaryElementContext.Provider
|
|
86
|
+
// @ts-expect-error - we want to test the error case
|
|
87
|
+
value={() => ({version: 1})}
|
|
88
|
+
>
|
|
88
89
|
<Debug />
|
|
89
90
|
</BoundaryElementContext.Provider>
|
|
90
91
|
)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
1
3
|
/** @internal */
|
|
2
4
|
// Based on https://github.com/radix-ui/primitives/blob/0bade6a704e5821b90a6da0f3d8cfa8a7711127d/packages/react/slot/src/Slot.tsx#L128-L150
|
|
3
5
|
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
@@ -53,10 +53,11 @@ describe('utils/portal', () => {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function Root() {
|
|
56
|
-
const value = undefined
|
|
57
|
-
|
|
58
56
|
return (
|
|
59
|
-
<PortalContext.Provider
|
|
57
|
+
<PortalContext.Provider
|
|
58
|
+
// @ts-expect-error - we want to test the error case
|
|
59
|
+
value={undefined}
|
|
60
|
+
>
|
|
60
61
|
<Debug />
|
|
61
62
|
</PortalContext.Provider>
|
|
62
63
|
)
|
|
@@ -82,12 +83,12 @@ describe('utils/portal', () => {
|
|
|
82
83
|
|
|
83
84
|
function Root() {
|
|
84
85
|
// NOTE: we’re testing this because the context value may be a function in the future
|
|
85
|
-
const value = () => {
|
|
86
|
-
return {version: 1}
|
|
87
|
-
}
|
|
88
86
|
|
|
89
87
|
return (
|
|
90
|
-
<PortalContext.Provider
|
|
88
|
+
<PortalContext.Provider
|
|
89
|
+
// @ts-expect-error - we want to test the error case
|
|
90
|
+
value={() => ({version: 1})}
|
|
91
|
+
>
|
|
91
92
|
<Debug />
|
|
92
93
|
</PortalContext.Provider>
|
|
93
94
|
)
|
|
@@ -5,7 +5,10 @@ import type {PortalContextValue} from './types'
|
|
|
5
5
|
const key = '@sanity/ui/context/portal'
|
|
6
6
|
const elementKey = Symbol.for(`${key}/element`)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// Use the global scope as a map of symbols to elements
|
|
9
|
+
const elementMap = globalScope as Record<symbol, HTMLDivElement | null>
|
|
10
|
+
|
|
11
|
+
elementMap[elementKey] = null
|
|
9
12
|
|
|
10
13
|
export const defaultContextValue: PortalContextValue = {
|
|
11
14
|
version: 0.0,
|
|
@@ -15,16 +18,16 @@ export const defaultContextValue: PortalContextValue = {
|
|
|
15
18
|
return null
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
21
|
+
if (elementMap[elementKey]) {
|
|
22
|
+
return elementMap[elementKey]
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
elementMap[elementKey] = document.createElement('div')
|
|
26
|
+
elementMap[elementKey].setAttribute('data-portal', '')
|
|
24
27
|
|
|
25
|
-
document.body.appendChild(
|
|
28
|
+
document.body.appendChild(elementMap[elementKey])
|
|
26
29
|
|
|
27
|
-
return
|
|
30
|
+
return elementMap[elementKey]
|
|
28
31
|
},
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -75,7 +75,7 @@ export const scrollerShadowTop = _style(layers.components, {
|
|
|
75
75
|
top: 0,
|
|
76
76
|
left: 0,
|
|
77
77
|
right: 0,
|
|
78
|
-
height:
|
|
78
|
+
height: 4,
|
|
79
79
|
background: `linear-gradient(to top, color-mix(in srgb,transparent, ${vars.color.shadow.penumbra} 0%) 0%, color-mix(in srgb, ${vars.color.shadow.umbra} 100%, transparent 100%) 100%)`,
|
|
80
80
|
boxShadow: `inset 0 0.5px 0 color-mix(in srgb, transparent, ${vars.color.shadow.outline} 50%)`,
|
|
81
81
|
pointerEvents: 'none',
|
|
@@ -86,7 +86,7 @@ export const scrollerShadowBottom = _style(layers.components, {
|
|
|
86
86
|
bottom: 0,
|
|
87
87
|
left: 0,
|
|
88
88
|
right: 0,
|
|
89
|
-
height:
|
|
89
|
+
height: 4,
|
|
90
90
|
background: `linear-gradient(to bottom, color-mix(in srgb,transparent, ${vars.color.shadow.penumbra} 0%) 0%, color-mix(in srgb, ${vars.color.shadow.umbra} 100%, transparent 100%) 100%)`,
|
|
91
91
|
boxShadow: `inset 0 -0.5px 0 color-mix(in srgb, transparent, ${vars.color.shadow.outline} 50%)`,
|
|
92
92
|
pointerEvents: 'none',
|
package/src/theme/v0/css.ts
CHANGED