@sanity/ui 3.0.0-static.10 → 3.0.0-static.3
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 +105 -143
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +1 -1
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-cjs/v3_v2.js +251 -0
- package/dist/_chunks-cjs/v3_v2.js.map +1 -0
- package/dist/_chunks-es/_visual-editing.mjs +106 -144
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/v3_v2.mjs +252 -0
- package/dist/_chunks-es/v3_v2.mjs.map +1 -0
- package/dist/_visual-editing.d.mts +11 -14
- package/dist/_visual-editing.d.ts +11 -14
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +1006 -282
- package/dist/css.d.ts +1006 -282
- package/dist/css.js +743 -852
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +743 -852
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -19
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +9 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1023 -1448
- package/dist/theme.d.mts +119 -85
- package/dist/theme.d.ts +119 -85
- package/dist/theme.js +219 -432
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +202 -413
- package/dist/theme.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cli/buildCommand.ts +2 -2
- package/src/css/_comp.ts +0 -1
- package/src/css/aspects/flex/flexJustify.style.ts +3 -3
- package/src/css/aspects/grid/types.ts +2 -2
- package/src/css/aspects/index.ts +0 -1
- package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
- package/src/css/compile/compilePalette.ts +41 -8
- package/src/css/compile/compileRule.ts +0 -1
- package/src/css/compile/compileStyle.ts +1 -1
- package/src/css/compile/compileTheme_v3.ts +55 -46
- package/src/css/index.ts +2 -2
- package/src/css/primitives/_input/__workshop__/index.ts +1 -1
- package/src/css/primitives/_selectable/_contants.ts +1 -1
- package/src/css/primitives/badge/badge.style.ts +1 -1
- package/src/css/primitives/box/box.style.ts +1 -1
- package/src/css/primitives/box/box.ts +0 -2
- package/src/css/primitives/box/types.ts +0 -2
- package/src/css/primitives/button/_constants.ts +1 -1
- package/src/css/primitives/button/button.style.ts +13 -32
- package/src/css/primitives/card/_constants.ts +2 -2
- package/src/css/primitives/card/card.style.ts +44 -116
- package/src/css/primitives/card/card.ts +1 -1
- package/src/css/primitives/card/rules.ts +473 -0
- package/src/css/primitives/card/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.style.ts +1 -1
- package/src/css/primitives/popover/popover.ts +0 -4
- package/src/css/primitives/switch/switch.style.ts +83 -8
- package/src/css/primitives/text/text.style.ts +3 -11
- package/src/css/system.style.ts +0 -4
- package/src/css/types.ts +188 -202
- package/src/css/varNames.ts +76 -110
- package/src/css/vars.ts +76 -109
- package/src/theme/defaults/config.ts +2 -2
- package/src/theme/defaults/fonts.ts +4 -4
- package/src/theme/palette/constants.ts +3 -1
- package/src/theme/palette/types.ts +12 -0
- package/src/theme/v3/buildTheme_v3.ts +2 -1
- package/src/theme/v3/color/buildColor_v3.ts +38 -43
- package/src/theme/v3/color/card.ts +38 -43
- package/src/theme/v3/color/color.ts +38 -42
- package/src/theme/v3/defaults.ts +72 -69
- package/src/theme/v3/resolveTokens.ts +38 -43
- package/src/theme/v3/types.ts +3 -0
- package/src/theme/versioning/themeColor_v3_v2.ts +1 -1
- package/src/ui/StyleTags.tsx +1 -1
- package/src/ui/components/autocomplete/__workshop__/async.tsx +1 -0
- package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
- package/src/ui/components/autocomplete/autocomplete.tsx +11 -2
- package/src/ui/components/dialog/dialog.tsx +4 -3
- package/src/ui/constants.ts +0 -6
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +2 -0
- package/src/ui/primitives/box/box.tsx +2 -9
- package/src/ui/primitives/button/button.tsx +11 -12
- package/src/ui/primitives/card/card.tsx +5 -4
- package/src/ui/primitives/code/code.tsx +1 -1
- package/src/ui/primitives/heading/heading.tsx +1 -1
- package/src/ui/primitives/kbd/kbd.tsx +2 -2
- package/src/ui/primitives/popover/popover.tsx +75 -5
- package/src/ui/primitives/popover/popoverCard.tsx +39 -45
- package/src/ui/primitives/select/select.tsx +3 -3
- package/src/ui/primitives/stack/stack.tsx +5 -10
- package/src/ui/primitives/text/text.tsx +1 -1
- package/src/ui/primitives/textInput/textInput.tsx +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +3 -2
- package/src/css/aspects/minWidth/index.ts +0 -2
- package/src/css/aspects/minWidth/minWidth.style.ts +0 -13
- package/src/css/aspects/minWidth/minWidth.ts +0 -6
- package/src/css/aspects/minWidth/types.ts +0 -7
- package/src/css/primitives/stack/index.ts +0 -1
- package/src/css/primitives/stack/stack.style.ts +0 -9
- package/src/css/primitives/stack/stack.ts +0 -6
|
@@ -14,6 +14,7 @@ import {FontTextSize, Space} from '@sanity/ui/theme'
|
|
|
14
14
|
import {ElementType, ForwardedRef, forwardRef, isValidElement, ReactNode} from 'react'
|
|
15
15
|
import {isValidElementType} from 'react-is'
|
|
16
16
|
|
|
17
|
+
// import {useTheme_v2} from '../../_compat'
|
|
17
18
|
import {ButtonMode, ButtonTextAlign, ButtonTone, Props} from '../../types'
|
|
18
19
|
import {Box} from '../box'
|
|
19
20
|
import {Spinner} from '../spinner'
|
|
@@ -83,7 +84,7 @@ export const Button = forwardRef(function Button(
|
|
|
83
84
|
paddingBottom,
|
|
84
85
|
paddingLeft,
|
|
85
86
|
paddingRight,
|
|
86
|
-
radius =
|
|
87
|
+
radius = 3,
|
|
87
88
|
selected,
|
|
88
89
|
space = props.gap ?? props.space ?? props.padding ?? 3, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
89
90
|
text,
|
|
@@ -113,12 +114,12 @@ export const Button = forwardRef(function Button(
|
|
|
113
114
|
>
|
|
114
115
|
{Boolean(loading) && (
|
|
115
116
|
<Box
|
|
116
|
-
align=
|
|
117
|
+
align={align}
|
|
117
118
|
as="span"
|
|
118
119
|
className={buttonLoadingBox()}
|
|
119
120
|
display="flex"
|
|
120
121
|
flex={1}
|
|
121
|
-
justify=
|
|
122
|
+
justify={justify}
|
|
122
123
|
width="fill"
|
|
123
124
|
>
|
|
124
125
|
<Spinner size={fontSize} />
|
|
@@ -127,7 +128,6 @@ export const Button = forwardRef(function Button(
|
|
|
127
128
|
|
|
128
129
|
{(IconComponent || text || IconRightComponent) && (
|
|
129
130
|
<Box
|
|
130
|
-
// align={align}
|
|
131
131
|
as="span"
|
|
132
132
|
direction={direction}
|
|
133
133
|
display="flex"
|
|
@@ -143,8 +143,8 @@ export const Button = forwardRef(function Button(
|
|
|
143
143
|
paddingBottom={paddingBottom}
|
|
144
144
|
paddingLeft={paddingLeft}
|
|
145
145
|
paddingRight={paddingRight}
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
width="fill"
|
|
147
|
+
wrap={wrap}
|
|
148
148
|
>
|
|
149
149
|
{IconComponent && (
|
|
150
150
|
<Text as="span" flex="none" muted size={fontSize}>
|
|
@@ -161,6 +161,7 @@ export const Button = forwardRef(function Button(
|
|
|
161
161
|
muted={muted}
|
|
162
162
|
size={fontSize}
|
|
163
163
|
textOverflow={textOverflow}
|
|
164
|
+
// weight={textWeight ?? buttonTheme.textWeight}
|
|
164
165
|
weight={textWeight}
|
|
165
166
|
>
|
|
166
167
|
{text}
|
|
@@ -178,15 +179,13 @@ export const Button = forwardRef(function Button(
|
|
|
178
179
|
|
|
179
180
|
{children && (
|
|
180
181
|
<Box
|
|
181
|
-
// align={align}
|
|
182
182
|
as="span"
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
direction={direction}
|
|
184
|
+
display="flex"
|
|
185
185
|
flex={1}
|
|
186
186
|
gap={gap}
|
|
187
187
|
gapX={gapX}
|
|
188
188
|
gapY={gapY}
|
|
189
|
-
// justify={justify}
|
|
190
189
|
padding={padding}
|
|
191
190
|
paddingX={paddingX}
|
|
192
191
|
paddingY={paddingY}
|
|
@@ -194,8 +193,8 @@ export const Button = forwardRef(function Button(
|
|
|
194
193
|
paddingBottom={paddingBottom}
|
|
195
194
|
paddingLeft={paddingLeft}
|
|
196
195
|
paddingRight={paddingRight}
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
width="fill"
|
|
197
|
+
wrap={wrap}
|
|
199
198
|
>
|
|
200
199
|
{children}
|
|
201
200
|
</Box>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {card, CardStyleProps, composeClassNames} from '@sanity/ui/css'
|
|
1
|
+
import {_selectable, card, CardStyleProps, composeClassNames} from '@sanity/ui/css'
|
|
2
2
|
import {createElement, ForwardedRef, forwardRef} from 'react'
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
4
|
|
|
@@ -46,11 +46,11 @@ export const Card = forwardRef(function Card(
|
|
|
46
46
|
pressed,
|
|
47
47
|
radius = 0,
|
|
48
48
|
scheme: schemeProp,
|
|
49
|
-
|
|
49
|
+
selectable,
|
|
50
50
|
selected,
|
|
51
51
|
shadow,
|
|
52
52
|
style,
|
|
53
|
-
tone: toneProp = '
|
|
53
|
+
tone: toneProp = 'inherit',
|
|
54
54
|
...restProps
|
|
55
55
|
} = props
|
|
56
56
|
|
|
@@ -76,8 +76,9 @@ export const Card = forwardRef(function Card(
|
|
|
76
76
|
card({
|
|
77
77
|
scheme: scheme === context.scheme ? undefined : scheme,
|
|
78
78
|
shadow,
|
|
79
|
-
tone,
|
|
79
|
+
tone: tone === context.tone ? undefined : tone,
|
|
80
80
|
}),
|
|
81
|
+
selectable && _selectable({radius}),
|
|
81
82
|
)}
|
|
82
83
|
data-checkered={checkered ? '' : undefined}
|
|
83
84
|
data-focus-ring={focusRing ? '' : undefined}
|
|
@@ -28,7 +28,7 @@ export const KBD = forwardRef(function KBD(
|
|
|
28
28
|
children,
|
|
29
29
|
className,
|
|
30
30
|
display = 'inline-block',
|
|
31
|
-
fontSize =
|
|
31
|
+
fontSize = 1,
|
|
32
32
|
padding = 1,
|
|
33
33
|
radius = 2,
|
|
34
34
|
...restProps
|
|
@@ -45,7 +45,7 @@ export const KBD = forwardRef(function KBD(
|
|
|
45
45
|
padding={padding}
|
|
46
46
|
ref={ref}
|
|
47
47
|
>
|
|
48
|
-
<Text as="span" muted size={fontSize}
|
|
48
|
+
<Text as="span" muted size={fontSize}>
|
|
49
49
|
{children}
|
|
50
50
|
</Text>
|
|
51
51
|
</Box>
|
|
@@ -26,8 +26,13 @@ import {
|
|
|
26
26
|
useRef,
|
|
27
27
|
} from 'react'
|
|
28
28
|
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
// import {useTheme_v2} from '../../_compat'
|
|
30
|
+
import {
|
|
31
|
+
useArrayProp,
|
|
32
|
+
// useElementSize,
|
|
33
|
+
// useMediaIndex,
|
|
34
|
+
usePrefersReducedMotion,
|
|
35
|
+
} from '../../hooks'
|
|
31
36
|
import {origin} from '../../middleware/origin'
|
|
32
37
|
import {Placement, PopoverMargins, Props} from '../../types'
|
|
33
38
|
import {LayerProps, LayerProvider, Portal, useBoundaryElement, useLayer} from '../../utils'
|
|
@@ -39,6 +44,7 @@ import {
|
|
|
39
44
|
DEFAULT_POPOVER_PADDING,
|
|
40
45
|
} from './constants'
|
|
41
46
|
import {size} from './floating-ui/size'
|
|
47
|
+
// import {calcCurrentWidth, calcMaxWidth} from './helpers'
|
|
42
48
|
import {PopoverCard} from './popoverCard'
|
|
43
49
|
import {PopoverUpdateCallback} from './types'
|
|
44
50
|
|
|
@@ -61,7 +67,7 @@ export interface PopoverProps extends CardProps, LayerProps {
|
|
|
61
67
|
* When `true`, prevent overflow within the current boundary:
|
|
62
68
|
* - by flipping on its side axis
|
|
63
69
|
* - by resizing
|
|
64
|
-
|
|
70
|
+
/*
|
|
65
71
|
* Note that:
|
|
66
72
|
* - setting `preventOverflow` to `true` also prevents overflow on its side axis
|
|
67
73
|
* - setting `matchReferenceWidth` to `true` also causes the popover to resize
|
|
@@ -122,13 +128,13 @@ export const Popover = memo(
|
|
|
122
128
|
props: Props<PopoverProps, 'div'>,
|
|
123
129
|
forwardedRef: ForwardedRef<HTMLDivElement>,
|
|
124
130
|
): ReactElement {
|
|
131
|
+
// const {container, layer} = useTheme_v2()
|
|
125
132
|
const boundaryElementContext = useBoundaryElement()
|
|
126
133
|
|
|
127
134
|
const {
|
|
128
135
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
129
136
|
animate: _animate = false,
|
|
130
137
|
arrow: arrowProp = false,
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
138
|
boundaryElement = boundaryElementContext.element,
|
|
133
139
|
children: childProp,
|
|
134
140
|
constrainSize = false,
|
|
@@ -155,12 +161,17 @@ export const Popover = memo(
|
|
|
155
161
|
tone = 'inherit',
|
|
156
162
|
width: widthProp = 'auto',
|
|
157
163
|
// zOffset: zOffsetProp = layer.popover.zOffset,
|
|
158
|
-
zOffset: zOffsetProp
|
|
164
|
+
zOffset: zOffsetProp,
|
|
159
165
|
updateRef,
|
|
160
166
|
...restProps
|
|
161
167
|
} = props
|
|
162
168
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
163
169
|
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)
|
|
164
175
|
const zOffset = useArrayProp(zOffsetProp)
|
|
165
176
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
166
177
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -171,9 +182,57 @@ export const Popover = memo(
|
|
|
171
182
|
() => ref.current,
|
|
172
183
|
)
|
|
173
184
|
|
|
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
|
+
|
|
174
212
|
// Keep track of reference element width (see `size` middleware below)
|
|
175
213
|
const referenceWidthRef = useRef<number>(undefined)
|
|
176
214
|
|
|
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
|
+
|
|
177
236
|
const middleware = useMemo(() => {
|
|
178
237
|
const ret: Middleware[] = []
|
|
179
238
|
|
|
@@ -201,11 +260,22 @@ export const Popover = memo(
|
|
|
201
260
|
|
|
202
261
|
referenceWidthRef.current = referenceWidth
|
|
203
262
|
|
|
263
|
+
// const _currentWidth = widthRef.current
|
|
264
|
+
// const _maxWidth = maxWidthRef.current
|
|
265
|
+
|
|
204
266
|
if (matchReferenceWidth) {
|
|
205
267
|
elements.floating.style.width = `${referenceWidth}px`
|
|
206
268
|
}
|
|
269
|
+
// else if (_currentWidth !== undefined) {
|
|
270
|
+
// elements.floating.style.width = `${_currentWidth}px`
|
|
271
|
+
// }
|
|
207
272
|
|
|
208
273
|
if (constrainSize) {
|
|
274
|
+
// elements.floating.style.maxWidth = `${Math.min(
|
|
275
|
+
// availableWidth,
|
|
276
|
+
// _maxWidth ?? Infinity,
|
|
277
|
+
// )}px`
|
|
278
|
+
|
|
209
279
|
elements.floating.style.maxWidth = `${availableWidth}px`
|
|
210
280
|
elements.floating.style.maxHeight = `${availableHeight}px`
|
|
211
281
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {Strategy} from '@floating-ui/react-dom'
|
|
2
|
-
import {popoverCard} from '@sanity/ui/css'
|
|
3
2
|
import {motion, MotionProps} from 'framer-motion'
|
|
4
3
|
import {CSSProperties, ForwardedRef, forwardRef, memo, useMemo} from 'react'
|
|
5
4
|
|
|
6
5
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
7
6
|
import {Placement, PopoverMargins, Props} from '../../types'
|
|
8
7
|
import {Arrow, useLayer} from '../../utils'
|
|
9
|
-
import {Card, CardProps
|
|
8
|
+
import {Card, CardProps} from '../card'
|
|
10
9
|
import {Flex} from '../flex'
|
|
11
10
|
import {
|
|
12
11
|
DEFAULT_POPOVER_ARROW_HEIGHT,
|
|
@@ -70,8 +69,6 @@ export const PopoverCard = memo(
|
|
|
70
69
|
...restProps
|
|
71
70
|
} = props
|
|
72
71
|
|
|
73
|
-
const card = useCard()
|
|
74
|
-
|
|
75
72
|
const layer = useLayer()
|
|
76
73
|
|
|
77
74
|
// Get margins: [top, right, bottom, left]
|
|
@@ -110,51 +107,48 @@ export const PopoverCard = memo(
|
|
|
110
107
|
)
|
|
111
108
|
|
|
112
109
|
return (
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
<MotionCard
|
|
111
|
+
className="popover-card"
|
|
112
|
+
data-ui="Popover"
|
|
113
|
+
{...(restProps as CardProps & MotionProps)}
|
|
114
|
+
data-placement={placement}
|
|
115
|
+
direction="column"
|
|
116
|
+
display="flex"
|
|
117
|
+
radius={radius}
|
|
118
|
+
ref={ref}
|
|
119
|
+
scheme={scheme}
|
|
120
|
+
shadow={shadow}
|
|
121
|
+
sizing="border"
|
|
122
|
+
style={rootStyle}
|
|
123
|
+
tone={tone}
|
|
124
|
+
variants={POPOVER_MOTION_PROPS.card}
|
|
125
|
+
transition={POPOVER_MOTION_PROPS.transition}
|
|
126
|
+
initial={animate ? ['hidden', 'initial'] : undefined}
|
|
127
|
+
animate={animate ? ['visible', 'scaleIn'] : undefined}
|
|
128
|
+
exit={animate ? ['hidden', 'scaleOut'] : undefined}
|
|
129
|
+
>
|
|
130
|
+
<Flex
|
|
131
|
+
data-ui="Popover__wrapper"
|
|
120
132
|
direction="column"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
scheme={scheme}
|
|
125
|
-
shadow={shadow}
|
|
126
|
-
sizing="border"
|
|
127
|
-
style={rootStyle}
|
|
128
|
-
tone={tone}
|
|
129
|
-
variants={POPOVER_MOTION_PROPS.card}
|
|
130
|
-
transition={POPOVER_MOTION_PROPS.transition}
|
|
131
|
-
initial={animate ? ['hidden', 'initial'] : undefined}
|
|
132
|
-
animate={animate ? ['visible', 'scaleIn'] : undefined}
|
|
133
|
-
exit={animate ? ['hidden', 'scaleOut'] : undefined}
|
|
133
|
+
flex={1}
|
|
134
|
+
maxWidth={maxWidth}
|
|
135
|
+
overflow={overflow}
|
|
134
136
|
>
|
|
135
|
-
<Flex
|
|
136
|
-
|
|
137
|
-
direction="column"
|
|
138
|
-
flex={1}
|
|
139
|
-
maxWidth={maxWidth}
|
|
140
|
-
overflow={overflow}
|
|
141
|
-
>
|
|
142
|
-
<Flex direction="column" flex={1} padding={padding}>
|
|
143
|
-
{children}
|
|
144
|
-
</Flex>
|
|
137
|
+
<Flex direction="column" flex={1} padding={padding}>
|
|
138
|
+
{children}
|
|
145
139
|
</Flex>
|
|
140
|
+
</Flex>
|
|
146
141
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
</CardProvider>
|
|
142
|
+
{arrow && (
|
|
143
|
+
<Arrow
|
|
144
|
+
ref={arrowRef}
|
|
145
|
+
style={arrowStyle}
|
|
146
|
+
width={DEFAULT_POPOVER_ARROW_WIDTH}
|
|
147
|
+
height={DEFAULT_POPOVER_ARROW_HEIGHT}
|
|
148
|
+
radius={DEFAULT_POPOVER_ARROW_RADIUS}
|
|
149
|
+
/>
|
|
150
|
+
)}
|
|
151
|
+
</MotionCard>
|
|
158
152
|
)
|
|
159
153
|
}),
|
|
160
154
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import {Space} from '@sanity/ui/theme'
|
|
3
3
|
import {ForwardedRef, forwardRef} from 'react'
|
|
4
4
|
|
|
@@ -8,11 +8,7 @@ import {Box, BoxProps} from '../box'
|
|
|
8
8
|
/**
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
export interface StackProps
|
|
12
|
-
extends Omit<
|
|
13
|
-
BoxProps,
|
|
14
|
-
'align' | 'columns' | 'direction' | 'display' | 'gapX' | 'gapY' | 'justify'
|
|
15
|
-
> {
|
|
11
|
+
export interface StackProps extends Omit<BoxProps, 'direction' | 'display' | 'gapX' | 'gapY'> {
|
|
16
12
|
/** @deprecated Use `gap` instead. */
|
|
17
13
|
space?: ResponsiveProp<Space>
|
|
18
14
|
}
|
|
@@ -26,16 +22,15 @@ export const Stack = forwardRef(function Stack(
|
|
|
26
22
|
props: Props<StackProps, 'div'>,
|
|
27
23
|
ref: ForwardedRef<HTMLDivElement>,
|
|
28
24
|
) {
|
|
29
|
-
const {as,
|
|
25
|
+
const {as, gap, space, ...restProps} = props
|
|
30
26
|
|
|
31
27
|
return (
|
|
32
28
|
<Box
|
|
33
29
|
data-ui="Stack"
|
|
34
30
|
{...restProps}
|
|
35
31
|
as={as}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
display="grid"
|
|
32
|
+
direction="column"
|
|
33
|
+
display="flex"
|
|
39
34
|
gap={gap ?? space}
|
|
40
35
|
ref={ref}
|
|
41
36
|
/>
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from 'react'
|
|
29
29
|
import {useEffectEvent} from 'use-effect-event'
|
|
30
30
|
|
|
31
|
-
import {
|
|
31
|
+
import {useTheme_v2} from '../../_compat'
|
|
32
32
|
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
33
33
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
34
34
|
import {origin} from '../../middleware/origin'
|
|
@@ -91,6 +91,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
91
91
|
forwardedRef: ForwardedRef<HTMLDivElement>,
|
|
92
92
|
) {
|
|
93
93
|
const boundaryElementContext = useBoundaryElement()
|
|
94
|
+
const {layer} = useTheme_v2()
|
|
94
95
|
const {
|
|
95
96
|
animate: _animate = false,
|
|
96
97
|
arrow: arrowProp = false,
|
|
@@ -108,7 +109,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
108
109
|
radius = 3,
|
|
109
110
|
scheme,
|
|
110
111
|
shadow = 2,
|
|
111
|
-
zOffset =
|
|
112
|
+
zOffset = layer.tooltip.zOffset,
|
|
112
113
|
tone,
|
|
113
114
|
...restProps
|
|
114
115
|
} = props
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {_responsiveRule} from '../../_responsiveRule'
|
|
2
|
-
import type {Style, StyleRules} from '../../types'
|
|
3
|
-
|
|
4
|
-
const util: StyleRules = {}
|
|
5
|
-
|
|
6
|
-
_responsiveRule(util, 'min-w-0', {minWidth: '0'})
|
|
7
|
-
_responsiveRule(util, 'min-w-auto', {minWidth: 'auto'})
|
|
8
|
-
_responsiveRule(util, 'min-w-full', {minWidth: '100%'})
|
|
9
|
-
_responsiveRule(util, 'min-w-min', {minWidth: 'min-content'})
|
|
10
|
-
_responsiveRule(util, 'min-w-max', {minWidth: 'max-content'})
|
|
11
|
-
_responsiveRule(util, 'min-w-fit', {minWidth: 'fit-content'})
|
|
12
|
-
|
|
13
|
-
export const minWidthStyle: Style = {layers: {util}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './stack'
|