@sanity/ui 3.0.0-static.32 → 3.0.0-static.33
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 +6 -3
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +7 -4
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +10 -0
- package/dist/_visual-editing.d.ts +10 -0
- package/dist/css/index.cjs +1 -1
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.js +1 -1
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/core/Root.tsx +2 -2
- package/src/core/primitives/popover/popover.tsx +30 -8
- package/src/css/primitives/root/root.css.ts +1 -1
- package/src/css/primitives/root/root.ts +1 -1
- package/dist/css/layers.css +0 -4
- package/dist/css/primitives/popover/popover.css +0 -4
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.33",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"@babel/preset-env": "^7.27.2",
|
|
118
118
|
"@babel/preset-react": "^7.27.1",
|
|
119
119
|
"@babel/preset-typescript": "^7.27.1",
|
|
120
|
-
"@commitlint/cli": "19.
|
|
121
|
-
"@commitlint/config-conventional": "19.
|
|
120
|
+
"@commitlint/cli": "^19.8.0",
|
|
121
|
+
"@commitlint/config-conventional": "^19.8.0",
|
|
122
122
|
"@eslint/js": "^9.29.0",
|
|
123
123
|
"@sanity/browserslist-config": "^1.0.5",
|
|
124
124
|
"@sanity/pkg-utils": "^7.2.6",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"eslint-plugin-import": "^2.31.0",
|
|
155
155
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
156
156
|
"eslint-plugin-react": "^7.37.5",
|
|
157
|
-
"eslint-plugin-react-hooks": "0.0.0-experimental-
|
|
157
|
+
"eslint-plugin-react-hooks": "0.0.0-experimental-12bc60f5-20250613",
|
|
158
158
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
159
159
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
160
160
|
"eslint-plugin-storybook": "^9.0.11",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
"cypress:dev": "run-p dev cypress:open",
|
|
207
207
|
"cypress:open": "cypress open",
|
|
208
208
|
"cypress:run": "cypress run",
|
|
209
|
-
"dev": "run-p workshop:
|
|
209
|
+
"dev": "run-p workshop:dev storybook:dev",
|
|
210
210
|
"figma:build": "pnpm run --filter 'figma-plugin-sanity-ui' build",
|
|
211
211
|
"format": "prettier --write --cache --ignore-unknown .",
|
|
212
212
|
"lint": "eslint .",
|
|
@@ -222,7 +222,7 @@
|
|
|
222
222
|
"watch": "pkg watch --strict",
|
|
223
223
|
"workshop:build": "workshop build",
|
|
224
224
|
"workshop:clean": "rimraf .workshop",
|
|
225
|
-
"workshop:dev": "workshop dev",
|
|
225
|
+
"workshop:dev": "run-s workshop:clean && workshop dev",
|
|
226
226
|
"workshop:preview": "workshop preview"
|
|
227
227
|
}
|
|
228
228
|
}
|
package/src/core/Root.tsx
CHANGED
|
@@ -27,11 +27,11 @@ export function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(pr
|
|
|
27
27
|
as: as = DEFAULT_ROOT_ELEMENT,
|
|
28
28
|
children,
|
|
29
29
|
className,
|
|
30
|
-
height,
|
|
30
|
+
height,
|
|
31
31
|
overflow = 'hidden',
|
|
32
32
|
ref: forwardedRef,
|
|
33
33
|
scheme = 'light',
|
|
34
|
-
tone = '
|
|
34
|
+
tone = 'default',
|
|
35
35
|
...rest
|
|
36
36
|
} = props as RootProps<typeof DEFAULT_ROOT_ELEMENT>
|
|
37
37
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
arrow,
|
|
3
|
+
autoPlacement,
|
|
3
4
|
autoUpdate,
|
|
4
5
|
flip,
|
|
5
6
|
hide,
|
|
@@ -99,6 +100,16 @@ export type PopoverOwnProps = Omit<LayerOwnProps, 'maxWidth'> & {
|
|
|
99
100
|
modal?: boolean
|
|
100
101
|
open?: boolean
|
|
101
102
|
placement?: Placement
|
|
103
|
+
/**
|
|
104
|
+
* When 'flip' (default), the placement is determined from the initial placement and the
|
|
105
|
+
* fallback placements in order. Whichever fits in the viewport first.
|
|
106
|
+
*
|
|
107
|
+
* When 'autoPlacement', the initial placement and all fallback placements are evaluated
|
|
108
|
+
* and the placement with the most viewport space available.
|
|
109
|
+
*
|
|
110
|
+
* Option is only relevant if either `constrainSize` or `preventOverflow` is `true`
|
|
111
|
+
*/
|
|
112
|
+
placementStrategy?: 'flip' | 'autoPlacement'
|
|
102
113
|
/** Whether or not to render the popover in a portal element. */
|
|
103
114
|
portal?: boolean | string
|
|
104
115
|
preventOverflow?: boolean
|
|
@@ -171,6 +182,7 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
171
182
|
overflow = 'hidden',
|
|
172
183
|
padding,
|
|
173
184
|
placement: placementProp = 'bottom',
|
|
185
|
+
placementStrategy = 'flip',
|
|
174
186
|
portal,
|
|
175
187
|
preventOverflow = true,
|
|
176
188
|
radius = 3,
|
|
@@ -205,14 +217,22 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
205
217
|
|
|
206
218
|
// Flip the floating element when leaving the boundary box
|
|
207
219
|
if (constrainSize || preventOverflow) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
220
|
+
if (placementStrategy === 'autoPlacement') {
|
|
221
|
+
ret.push(
|
|
222
|
+
autoPlacement({
|
|
223
|
+
allowedPlacements: [placementProp].concat(fallbackPlacements),
|
|
224
|
+
}),
|
|
225
|
+
)
|
|
226
|
+
} else {
|
|
227
|
+
ret.push(
|
|
228
|
+
flip({
|
|
229
|
+
boundary: floatingBoundary || undefined,
|
|
230
|
+
fallbackPlacements,
|
|
231
|
+
padding: DEFAULT_POPOVER_PADDING,
|
|
232
|
+
rootBoundary,
|
|
233
|
+
}),
|
|
234
|
+
)
|
|
235
|
+
}
|
|
216
236
|
}
|
|
217
237
|
|
|
218
238
|
// Define distance between reference and floating element
|
|
@@ -287,6 +307,8 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
287
307
|
constrainSize,
|
|
288
308
|
fallbackPlacements,
|
|
289
309
|
floatingBoundary,
|
|
310
|
+
placementProp,
|
|
311
|
+
placementStrategy,
|
|
290
312
|
margins,
|
|
291
313
|
matchReferenceWidth,
|
|
292
314
|
preventOverflow,
|
|
@@ -2,6 +2,7 @@ import {_style} from '../../_style.css'
|
|
|
2
2
|
import {layers} from '../../layers.css'
|
|
3
3
|
|
|
4
4
|
export const _root = _style(layers.primitives, {
|
|
5
|
+
WebkitFontSmoothing: 'antialiased',
|
|
5
6
|
// minWidth: `${320 / 16}rem`, // 320px
|
|
6
7
|
|
|
7
8
|
selectors: {
|
|
@@ -9,7 +10,6 @@ export const _root = _style(layers.primitives, {
|
|
|
9
10
|
MozTextSizeAdjust: 'none',
|
|
10
11
|
WebkitTextSizeAdjust: 'none',
|
|
11
12
|
textSizeAdjust: 'none',
|
|
12
|
-
WebkitFontSmoothing: 'antialiased',
|
|
13
13
|
},
|
|
14
14
|
|
|
15
15
|
'div.&': {
|
|
@@ -11,7 +11,7 @@ export function root(props: RootStyleProps) {
|
|
|
11
11
|
props.className,
|
|
12
12
|
themeClassName,
|
|
13
13
|
_root,
|
|
14
|
-
card({scheme: props.scheme ?? 'light', tone: props.tone ?? '
|
|
14
|
+
card({scheme: props.scheme ?? 'light', tone: props.tone ?? 'default'}),
|
|
15
15
|
height(props),
|
|
16
16
|
)
|
|
17
17
|
}
|
package/dist/css/layers.css
DELETED