@sanity/ui 3.0.0-static.4 → 3.0.0-static.6
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.js +81 -31
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +82 -32
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +14 -11
- package/dist/_visual-editing.d.ts +14 -11
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +144 -852
- package/dist/css.d.ts +144 -852
- package/dist/css.js +155 -141
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +154 -141
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -6
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +54 -49
- package/dist/theme.js +271 -33
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +252 -16
- package/dist/theme.mjs.map +1 -1
- package/package.json +2 -2
- package/src/css/aspects/flex/flexJustify.style.ts +3 -3
- package/src/css/aspects/grid/types.ts +2 -2
- package/src/css/index.ts +2 -2
- package/src/css/primitives/_input/__workshop__/index.ts +1 -1
- package/src/css/primitives/button/button.style.ts +6 -4
- package/src/css/primitives/stack/index.ts +1 -0
- package/src/css/primitives/stack/stack.style.ts +9 -0
- package/src/css/primitives/stack/stack.ts +6 -0
- package/src/css/system.style.ts +2 -0
- package/src/theme/v3/defaults.ts +1 -1
- package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
- package/src/ui/components/dialog/dialog.tsx +3 -4
- package/src/ui/constants.ts +6 -0
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +0 -2
- package/src/ui/primitives/box/box.tsx +6 -0
- package/src/ui/primitives/button/button.tsx +11 -10
- package/src/ui/primitives/code/code.tsx +1 -1
- package/src/ui/primitives/popover/popover.tsx +5 -75
- package/src/ui/primitives/stack/stack.tsx +10 -5
- package/src/ui/primitives/textInput/textInput.tsx +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +2 -3
- package/dist/_chunks-cjs/v3_v2.js +0 -251
- package/dist/_chunks-cjs/v3_v2.js.map +0 -1
- package/dist/_chunks-es/v3_v2.mjs +0 -252
- package/dist/_chunks-es/v3_v2.mjs.map +0 -1
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.6",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"@rollup/plugin-replace": "^6.0.2",
|
|
126
126
|
"@sanity/pkg-utils": "^7.2.2",
|
|
127
127
|
"@sanity/prettier-config": "^1.0.3",
|
|
128
|
-
"@sanity/ui-workshop": "^2.1.
|
|
128
|
+
"@sanity/ui-workshop": "^2.1.3",
|
|
129
129
|
"@storybook/addon-a11y": "^8.6.12",
|
|
130
130
|
"@storybook/addon-docs": "^8.6.12",
|
|
131
131
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -6,8 +6,8 @@ const util: StyleRules = {}
|
|
|
6
6
|
_responsiveRule(util, 'flex-justify-flex-start', {justifyContent: 'flex-start'})
|
|
7
7
|
_responsiveRule(util, 'flex-justify-flex-end', {justifyContent: 'flex-end'})
|
|
8
8
|
_responsiveRule(util, 'flex-justify-center', {justifyContent: 'center'})
|
|
9
|
-
_responsiveRule(util, 'flex-justify-between', {justifyContent: 'space-between'})
|
|
10
|
-
_responsiveRule(util, 'flex-justify-around', {justifyContent: 'space-around'})
|
|
11
|
-
_responsiveRule(util, 'flex-justify-evenly', {justifyContent: 'space-evenly'})
|
|
9
|
+
_responsiveRule(util, 'flex-justify-space-between', {justifyContent: 'space-between'})
|
|
10
|
+
_responsiveRule(util, 'flex-justify-space-around', {justifyContent: 'space-around'})
|
|
11
|
+
_responsiveRule(util, 'flex-justify-space-evenly', {justifyContent: 'space-evenly'})
|
|
12
12
|
|
|
13
13
|
export const flexJustifyStyle: Style = {layers: {util}}
|
|
@@ -15,9 +15,9 @@ export type GridAutoCols = 'auto' | 'min' | 'max' | 'fr'
|
|
|
15
15
|
*/
|
|
16
16
|
export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense'
|
|
17
17
|
|
|
18
|
-
export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
|
|
18
|
+
export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
|
19
19
|
|
|
20
|
-
export type Rows = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12
|
|
20
|
+
export type Rows = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
|
21
21
|
|
|
22
22
|
/** @public */
|
|
23
23
|
export interface GridStyleProps {
|
package/src/css/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './aspects'
|
|
2
2
|
export * from './compile/compilePalette'
|
|
3
3
|
export * from './compile/compileSystem'
|
|
4
4
|
export * from './compile/compileTheme'
|
|
@@ -27,13 +27,13 @@ export * from './primitives/popover'
|
|
|
27
27
|
export * from './primitives/radio'
|
|
28
28
|
export * from './primitives/select'
|
|
29
29
|
export * from './primitives/spinner'
|
|
30
|
+
export * from './primitives/stack'
|
|
30
31
|
export * from './primitives/switch'
|
|
31
32
|
export * from './primitives/text'
|
|
32
33
|
export * from './primitives/textArea'
|
|
33
34
|
export * from './primitives/textInput'
|
|
34
35
|
export * from './primitives/tooltip'
|
|
35
36
|
export * from './scopeClassName'
|
|
36
|
-
export * from './aspects'
|
|
37
37
|
export * from './types'
|
|
38
38
|
export * from './util'
|
|
39
39
|
export * from './utils/srOnly'
|
|
@@ -24,6 +24,8 @@ const primitive: StyleRules = {
|
|
|
24
24
|
'backgroundColor': vars.color.bg,
|
|
25
25
|
'color': vars.color.fg,
|
|
26
26
|
'boxShadow': 'var(--button-box-shadow)',
|
|
27
|
+
'alignItems': 'center',
|
|
28
|
+
// 'justifyContent': 'center',
|
|
27
29
|
|
|
28
30
|
'@nest': {
|
|
29
31
|
'&::-moz-focus-inner': {
|
|
@@ -101,28 +103,28 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
101
103
|
// mode: ghost
|
|
102
104
|
primitive[`.button.${variantMap.ghost}.${toneMap[tone]}`] = {
|
|
103
105
|
[varNames.color.bg]: tinted.bg[1],
|
|
104
|
-
[varNames.color.border]: tinted.border[
|
|
106
|
+
[varNames.color.border]: tinted.border[0],
|
|
105
107
|
[varNames.color.fg]: tinted.fg[2],
|
|
106
108
|
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
107
109
|
|
|
108
110
|
'@nest': {
|
|
109
111
|
'&:not([data-disabled]):hover': {
|
|
110
112
|
[varNames.color.bg]: tinted.bg[2],
|
|
111
|
-
[varNames.color.border]: tinted.border[
|
|
113
|
+
[varNames.color.border]: tinted.border[1],
|
|
112
114
|
[varNames.color.fg]: tinted.fg[1],
|
|
113
115
|
// '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
114
116
|
},
|
|
115
117
|
|
|
116
118
|
'&:not([data-disabled]):active': {
|
|
117
119
|
[varNames.color.bg]: tinted.bg[3],
|
|
118
|
-
[varNames.color.border]: tinted.border[
|
|
120
|
+
[varNames.color.border]: tinted.border[2],
|
|
119
121
|
[varNames.color.fg]: tinted.fg[1],
|
|
120
122
|
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
121
123
|
},
|
|
122
124
|
|
|
123
125
|
'&:not([data-disabled])[data-selected]': {
|
|
124
126
|
[varNames.color.bg]: tinted.bg[3],
|
|
125
|
-
[varNames.color.border]: tinted.border[
|
|
127
|
+
[varNames.color.border]: tinted.border[2],
|
|
126
128
|
[varNames.color.fg]: tinted.fg[1],
|
|
127
129
|
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
128
130
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stack'
|
package/src/css/system.style.ts
CHANGED
|
@@ -56,6 +56,7 @@ import {popoverStyle} from './primitives/popover/popover.style'
|
|
|
56
56
|
import {radioStyle} from './primitives/radio/radio.style'
|
|
57
57
|
import {selectStyle} from './primitives/select/select.style'
|
|
58
58
|
import {spinnerStyle} from './primitives/spinner/spinner.style'
|
|
59
|
+
import {stackStyle} from './primitives/stack/stack.style'
|
|
59
60
|
import {switchStyle} from './primitives/switch/switch.style'
|
|
60
61
|
import {textStyle} from './primitives/text/text.style'
|
|
61
62
|
import {textAreaStyle} from './primitives/textArea/textArea.style'
|
|
@@ -136,6 +137,7 @@ export const systemStyle: Style = _mergeStyles([
|
|
|
136
137
|
radioStyle,
|
|
137
138
|
selectStyle,
|
|
138
139
|
spinnerStyle,
|
|
140
|
+
stackStyle,
|
|
139
141
|
switchStyle,
|
|
140
142
|
textAreaStyle,
|
|
141
143
|
textInputStyle,
|
package/src/theme/v3/defaults.ts
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
useRef,
|
|
27
27
|
} from 'react'
|
|
28
28
|
|
|
29
|
-
import {
|
|
29
|
+
import {Z_OFFSETS} from '../../constants'
|
|
30
30
|
import {
|
|
31
31
|
containsOrEqualsElement,
|
|
32
32
|
focusFirstDescendant,
|
|
@@ -282,7 +282,6 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
282
282
|
ref: ForwardedRef<HTMLDivElement>,
|
|
283
283
|
) {
|
|
284
284
|
const context = useDialog()
|
|
285
|
-
const {layer} = useTheme_v2()
|
|
286
285
|
const {
|
|
287
286
|
__unstable_autoFocus: autoFocus = true,
|
|
288
287
|
__unstable_hideCloseButton: hideCloseButton = false,
|
|
@@ -309,8 +308,8 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
309
308
|
tone,
|
|
310
309
|
...restProps
|
|
311
310
|
} = props
|
|
312
|
-
const positionProp = _positionProp ??
|
|
313
|
-
const zOffsetProp = _zOffsetProp ??
|
|
311
|
+
const positionProp = _positionProp ?? context.position ?? 'fixed'
|
|
312
|
+
const zOffsetProp = _zOffsetProp ?? context.zOffset ?? Z_OFFSETS.dialog
|
|
314
313
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
315
314
|
const animate = prefersReducedMotion ? false : _animate
|
|
316
315
|
const portal = usePortal()
|
package/src/ui/constants.ts
CHANGED
|
@@ -96,8 +96,6 @@ function getServerSnapshot() {
|
|
|
96
96
|
* @beta
|
|
97
97
|
*/
|
|
98
98
|
export function useMediaIndex(): number {
|
|
99
|
-
// const {media} = useTheme_v2()
|
|
100
|
-
// const media = MEDIA
|
|
101
99
|
const store = useMemo(() => _createMediaStore(), [])
|
|
102
100
|
|
|
103
101
|
return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot)
|
|
@@ -32,6 +32,9 @@ export const Box = forwardRef(function Box(
|
|
|
32
32
|
const {
|
|
33
33
|
align,
|
|
34
34
|
as: As = 'div',
|
|
35
|
+
autoCols,
|
|
36
|
+
autoFlow,
|
|
37
|
+
autoRows,
|
|
35
38
|
border,
|
|
36
39
|
borderTop,
|
|
37
40
|
borderRight,
|
|
@@ -93,6 +96,9 @@ export const Box = forwardRef(function Box(
|
|
|
93
96
|
className,
|
|
94
97
|
box({
|
|
95
98
|
align,
|
|
99
|
+
autoCols,
|
|
100
|
+
autoFlow,
|
|
101
|
+
autoRows,
|
|
96
102
|
border,
|
|
97
103
|
borderTop,
|
|
98
104
|
borderRight,
|
|
@@ -113,11 +113,12 @@ export const Button = forwardRef(function Button(
|
|
|
113
113
|
>
|
|
114
114
|
{Boolean(loading) && (
|
|
115
115
|
<Box
|
|
116
|
+
align="center"
|
|
116
117
|
as="span"
|
|
117
118
|
className={buttonLoadingBox()}
|
|
118
119
|
display="flex"
|
|
119
120
|
flex={1}
|
|
120
|
-
justify=
|
|
121
|
+
justify="center"
|
|
121
122
|
width="fill"
|
|
122
123
|
>
|
|
123
124
|
<Spinner size={fontSize} />
|
|
@@ -126,8 +127,8 @@ export const Button = forwardRef(function Button(
|
|
|
126
127
|
|
|
127
128
|
{(IconComponent || text || IconRightComponent) && (
|
|
128
129
|
<Box
|
|
130
|
+
// align={align}
|
|
129
131
|
as="span"
|
|
130
|
-
align={align}
|
|
131
132
|
direction={direction}
|
|
132
133
|
display="flex"
|
|
133
134
|
flex={1}
|
|
@@ -142,8 +143,8 @@ export const Button = forwardRef(function Button(
|
|
|
142
143
|
paddingBottom={paddingBottom}
|
|
143
144
|
paddingLeft={paddingLeft}
|
|
144
145
|
paddingRight={paddingRight}
|
|
145
|
-
width="fill"
|
|
146
|
-
wrap={wrap}
|
|
146
|
+
// width="fill"
|
|
147
|
+
// wrap={wrap}
|
|
147
148
|
>
|
|
148
149
|
{IconComponent && (
|
|
149
150
|
<Text as="span" flex="none" muted size={fontSize}>
|
|
@@ -177,15 +178,15 @@ export const Button = forwardRef(function Button(
|
|
|
177
178
|
|
|
178
179
|
{children && (
|
|
179
180
|
<Box
|
|
180
|
-
align={align}
|
|
181
|
+
// align={align}
|
|
181
182
|
as="span"
|
|
182
|
-
direction={direction}
|
|
183
|
-
display="flex"
|
|
183
|
+
// direction={direction}
|
|
184
|
+
// display="flex"
|
|
184
185
|
flex={1}
|
|
185
186
|
gap={gap}
|
|
186
187
|
gapX={gapX}
|
|
187
188
|
gapY={gapY}
|
|
188
|
-
justify={justify}
|
|
189
|
+
// justify={justify}
|
|
189
190
|
padding={padding}
|
|
190
191
|
paddingX={paddingX}
|
|
191
192
|
paddingY={paddingY}
|
|
@@ -193,8 +194,8 @@ export const Button = forwardRef(function Button(
|
|
|
193
194
|
paddingBottom={paddingBottom}
|
|
194
195
|
paddingLeft={paddingLeft}
|
|
195
196
|
paddingRight={paddingRight}
|
|
196
|
-
width="fill"
|
|
197
|
-
wrap={wrap}
|
|
197
|
+
// width="fill"
|
|
198
|
+
// wrap={wrap}
|
|
198
199
|
>
|
|
199
200
|
{children}
|
|
200
201
|
</Box>
|
|
@@ -26,13 +26,8 @@ import {
|
|
|
26
26
|
useRef,
|
|
27
27
|
} from 'react'
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
import {
|
|
31
|
-
useArrayProp,
|
|
32
|
-
// useElementSize,
|
|
33
|
-
// useMediaIndex,
|
|
34
|
-
usePrefersReducedMotion,
|
|
35
|
-
} from '../../hooks'
|
|
29
|
+
import {Z_OFFSETS} from '../../constants'
|
|
30
|
+
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
36
31
|
import {origin} from '../../middleware/origin'
|
|
37
32
|
import {Placement, PopoverMargins, Props} from '../../types'
|
|
38
33
|
import {LayerProps, LayerProvider, Portal, useBoundaryElement, useLayer} from '../../utils'
|
|
@@ -44,7 +39,6 @@ import {
|
|
|
44
39
|
DEFAULT_POPOVER_PADDING,
|
|
45
40
|
} from './constants'
|
|
46
41
|
import {size} from './floating-ui/size'
|
|
47
|
-
// import {calcCurrentWidth, calcMaxWidth} from './helpers'
|
|
48
42
|
import {PopoverCard} from './popoverCard'
|
|
49
43
|
import {PopoverUpdateCallback} from './types'
|
|
50
44
|
|
|
@@ -67,7 +61,7 @@ export interface PopoverProps extends CardProps, LayerProps {
|
|
|
67
61
|
* When `true`, prevent overflow within the current boundary:
|
|
68
62
|
* - by flipping on its side axis
|
|
69
63
|
* - by resizing
|
|
70
|
-
|
|
64
|
+
*
|
|
71
65
|
* Note that:
|
|
72
66
|
* - setting `preventOverflow` to `true` also prevents overflow on its side axis
|
|
73
67
|
* - setting `matchReferenceWidth` to `true` also causes the popover to resize
|
|
@@ -128,13 +122,13 @@ export const Popover = memo(
|
|
|
128
122
|
props: Props<PopoverProps, 'div'>,
|
|
129
123
|
forwardedRef: ForwardedRef<HTMLDivElement>,
|
|
130
124
|
): ReactElement {
|
|
131
|
-
// const {container, layer} = useTheme_v2()
|
|
132
125
|
const boundaryElementContext = useBoundaryElement()
|
|
133
126
|
|
|
134
127
|
const {
|
|
135
128
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
136
129
|
animate: _animate = false,
|
|
137
130
|
arrow: arrowProp = false,
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
138
132
|
boundaryElement = boundaryElementContext.element,
|
|
139
133
|
children: childProp,
|
|
140
134
|
constrainSize = false,
|
|
@@ -161,17 +155,12 @@ export const Popover = memo(
|
|
|
161
155
|
tone = 'inherit',
|
|
162
156
|
width: widthProp = 'auto',
|
|
163
157
|
// zOffset: zOffsetProp = layer.popover.zOffset,
|
|
164
|
-
zOffset: zOffsetProp,
|
|
158
|
+
zOffset: zOffsetProp = Z_OFFSETS.popover,
|
|
165
159
|
updateRef,
|
|
166
160
|
...restProps
|
|
167
161
|
} = props
|
|
168
162
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
169
163
|
const animate = prefersReducedMotion ? false : _animate
|
|
170
|
-
// const boundarySize = useElementSize(boundaryElement)?.border
|
|
171
|
-
// const padding = useArrayProp(paddingProp)
|
|
172
|
-
// const radius = useArrayProp(radiusProp)
|
|
173
|
-
// const shadow = useArrayProp(shadowProp)
|
|
174
|
-
// const widthArrayProp = useArrayProp(widthProp)
|
|
175
164
|
const zOffset = useArrayProp(zOffsetProp)
|
|
176
165
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
177
166
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -182,57 +171,9 @@ export const Popover = memo(
|
|
|
182
171
|
() => ref.current,
|
|
183
172
|
)
|
|
184
173
|
|
|
185
|
-
// const mediaIndex = useMediaIndex()
|
|
186
|
-
// const boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : undefined
|
|
187
|
-
|
|
188
|
-
// Update width when
|
|
189
|
-
// - media index changes
|
|
190
|
-
// - `width` property changes
|
|
191
|
-
// const width = calcCurrentWidth({
|
|
192
|
-
// container,
|
|
193
|
-
// mediaIndex,
|
|
194
|
-
// width: widthArrayProp,
|
|
195
|
-
// })
|
|
196
|
-
// const widthRef = useRef(width)
|
|
197
|
-
|
|
198
|
-
// useEffect(() => {
|
|
199
|
-
// widthRef.current = width
|
|
200
|
-
// }, [width])
|
|
201
|
-
|
|
202
|
-
// Update max width when
|
|
203
|
-
// - boundary width changes
|
|
204
|
-
// - `width` property changes
|
|
205
|
-
// const maxWidth = calcMaxWidth({boundaryWidth, currentWidth: width})
|
|
206
|
-
// const maxWidthRef = useRef(maxWidth)
|
|
207
|
-
|
|
208
|
-
// useEffect(() => {
|
|
209
|
-
// maxWidthRef.current = maxWidth
|
|
210
|
-
// }, [maxWidth])
|
|
211
|
-
|
|
212
174
|
// Keep track of reference element width (see `size` middleware below)
|
|
213
175
|
const referenceWidthRef = useRef<number>(undefined)
|
|
214
176
|
|
|
215
|
-
// // Force apply width & max width to floating element
|
|
216
|
-
// useEffect(() => {
|
|
217
|
-
// const floatingElement = ref.current
|
|
218
|
-
|
|
219
|
-
// if (!open || !floatingElement) return
|
|
220
|
-
|
|
221
|
-
// const referenceWidth = referenceWidthRef.current
|
|
222
|
-
|
|
223
|
-
// if (matchReferenceWidth) {
|
|
224
|
-
// if (referenceWidth !== undefined) {
|
|
225
|
-
// floatingElement.style.width = `${referenceWidth}px`
|
|
226
|
-
// }
|
|
227
|
-
// } else if (width !== undefined) {
|
|
228
|
-
// floatingElement.style.width = `${width}px`
|
|
229
|
-
// }
|
|
230
|
-
|
|
231
|
-
// if (typeof maxWidth === 'number') {
|
|
232
|
-
// floatingElement.style.maxWidth = `${maxWidth}px`
|
|
233
|
-
// }
|
|
234
|
-
// }, [width, matchReferenceWidth, maxWidth, open])
|
|
235
|
-
|
|
236
177
|
const middleware = useMemo(() => {
|
|
237
178
|
const ret: Middleware[] = []
|
|
238
179
|
|
|
@@ -260,22 +201,11 @@ export const Popover = memo(
|
|
|
260
201
|
|
|
261
202
|
referenceWidthRef.current = referenceWidth
|
|
262
203
|
|
|
263
|
-
// const _currentWidth = widthRef.current
|
|
264
|
-
// const _maxWidth = maxWidthRef.current
|
|
265
|
-
|
|
266
204
|
if (matchReferenceWidth) {
|
|
267
205
|
elements.floating.style.width = `${referenceWidth}px`
|
|
268
206
|
}
|
|
269
|
-
// else if (_currentWidth !== undefined) {
|
|
270
|
-
// elements.floating.style.width = `${_currentWidth}px`
|
|
271
|
-
// }
|
|
272
207
|
|
|
273
208
|
if (constrainSize) {
|
|
274
|
-
// elements.floating.style.maxWidth = `${Math.min(
|
|
275
|
-
// availableWidth,
|
|
276
|
-
// _maxWidth ?? Infinity,
|
|
277
|
-
// )}px`
|
|
278
|
-
|
|
279
209
|
elements.floating.style.maxWidth = `${availableWidth}px`
|
|
280
210
|
elements.floating.style.maxHeight = `${availableHeight}px`
|
|
281
211
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ResponsiveProp} from '@sanity/ui/css'
|
|
1
|
+
import {composeClassNames, ResponsiveProp, stack} from '@sanity/ui/css'
|
|
2
2
|
import {Space} from '@sanity/ui/theme'
|
|
3
3
|
import {ForwardedRef, forwardRef} from 'react'
|
|
4
4
|
|
|
@@ -8,7 +8,11 @@ import {Box, BoxProps} from '../box'
|
|
|
8
8
|
/**
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
export interface StackProps
|
|
11
|
+
export interface StackProps
|
|
12
|
+
extends Omit<
|
|
13
|
+
BoxProps,
|
|
14
|
+
'align' | 'columns' | 'direction' | 'display' | 'gapX' | 'gapY' | 'justify'
|
|
15
|
+
> {
|
|
12
16
|
/** @deprecated Use `gap` instead. */
|
|
13
17
|
space?: ResponsiveProp<Space>
|
|
14
18
|
}
|
|
@@ -22,15 +26,16 @@ export const Stack = forwardRef(function Stack(
|
|
|
22
26
|
props: Props<StackProps, 'div'>,
|
|
23
27
|
ref: ForwardedRef<HTMLDivElement>,
|
|
24
28
|
) {
|
|
25
|
-
const {as, gap, space, ...restProps} = props
|
|
29
|
+
const {as, className, gap, space, ...restProps} = props
|
|
26
30
|
|
|
27
31
|
return (
|
|
28
32
|
<Box
|
|
29
33
|
data-ui="Stack"
|
|
30
34
|
{...restProps}
|
|
31
35
|
as={as}
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
autoRows="min"
|
|
37
|
+
className={composeClassNames(className, stack())}
|
|
38
|
+
display="grid"
|
|
34
39
|
gap={gap ?? space}
|
|
35
40
|
ref={ref}
|
|
36
41
|
/>
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from 'react'
|
|
29
29
|
import {useEffectEvent} from 'use-effect-event'
|
|
30
30
|
|
|
31
|
-
import {
|
|
31
|
+
import {Z_OFFSETS} from '../../constants'
|
|
32
32
|
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
33
33
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
34
34
|
import {origin} from '../../middleware/origin'
|
|
@@ -91,7 +91,6 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
91
91
|
forwardedRef: ForwardedRef<HTMLDivElement>,
|
|
92
92
|
) {
|
|
93
93
|
const boundaryElementContext = useBoundaryElement()
|
|
94
|
-
const {layer} = useTheme_v2()
|
|
95
94
|
const {
|
|
96
95
|
animate: _animate = false,
|
|
97
96
|
arrow: arrowProp = false,
|
|
@@ -109,7 +108,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
109
108
|
radius = 3,
|
|
110
109
|
scheme,
|
|
111
110
|
shadow = 2,
|
|
112
|
-
zOffset =
|
|
111
|
+
zOffset = Z_OFFSETS.tooltip,
|
|
113
112
|
tone,
|
|
114
113
|
...restProps
|
|
115
114
|
} = props
|