@sanity/ui 3.0.13 → 3.0.14
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 +805 -609
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +807 -611
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +182 -142
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -143
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +10 -14
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/core/components/dialog/dialog.tsx +10 -14
- package/src/core/components/hotkeys/hotkeys.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +2 -2
- package/src/core/components/menu/menuItem.tsx +4 -4
- package/src/core/components/skeleton/skeleton.tsx +2 -2
- package/src/core/components/skeleton/textSkeleton.tsx +5 -6
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +3 -17
- package/src/core/primitives/avatar/avatar.tsx +14 -16
- package/src/core/primitives/avatar/avatarCounter.tsx +14 -17
- package/src/core/primitives/avatar/avatarStack.tsx +2 -3
- package/src/core/primitives/badge/badge.tsx +3 -3
- package/src/core/primitives/box/box.tsx +26 -26
- package/src/core/primitives/button/button.tsx +11 -12
- package/src/core/primitives/card/card.tsx +8 -8
- package/src/core/primitives/code/code.tsx +8 -2
- package/src/core/primitives/container/container.tsx +2 -2
- package/src/core/primitives/flex/flex.tsx +6 -6
- package/src/core/primitives/grid/grid.tsx +9 -9
- package/src/core/primitives/heading/heading.tsx +3 -3
- package/src/core/primitives/inline/inline.tsx +2 -2
- package/src/core/primitives/kbd/kbd.tsx +2 -2
- package/src/core/primitives/label/label.tsx +3 -3
- package/src/core/primitives/popover/popover.tsx +7 -6
- package/src/core/primitives/select/select.tsx +6 -5
- package/src/core/primitives/stack/stack.tsx +2 -2
- package/src/core/primitives/text/text.tsx +3 -3
- package/src/core/primitives/textArea/textArea.tsx +6 -5
- package/src/core/primitives/textInput/textInput.tsx +6 -5
- package/src/core/primitives/tooltip/tooltip.tsx +3 -2
- package/src/core/utils/layer/layerProvider.tsx +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {
|
|
6
6
|
flexItemStyle,
|
|
7
7
|
FlexItemStyleProps,
|
|
@@ -41,11 +41,11 @@ export const Flex = forwardRef(function Flex(
|
|
|
41
41
|
<StyledFlex
|
|
42
42
|
data-ui="Flex"
|
|
43
43
|
{...restProps}
|
|
44
|
-
$align={
|
|
45
|
-
$direction={
|
|
46
|
-
$gap={
|
|
47
|
-
$justify={
|
|
48
|
-
$wrap={
|
|
44
|
+
$align={_getArrayProp(align)}
|
|
45
|
+
$direction={_getArrayProp(direction)}
|
|
46
|
+
$gap={_getArrayProp(gap)}
|
|
47
|
+
$justify={_getArrayProp(justify)}
|
|
48
|
+
$wrap={_getArrayProp(wrap)}
|
|
49
49
|
forwardedAs={as}
|
|
50
50
|
ref={ref}
|
|
51
51
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
|
|
6
6
|
import {Box, BoxProps} from '../box'
|
|
7
7
|
import {ResponsiveGridProps} from '../types'
|
|
@@ -30,14 +30,14 @@ export const Grid = forwardRef(function Grid(
|
|
|
30
30
|
data-as={typeof as === 'string' ? as : undefined}
|
|
31
31
|
data-ui="Grid"
|
|
32
32
|
{...restProps}
|
|
33
|
-
$autoRows={
|
|
34
|
-
$autoCols={
|
|
35
|
-
$autoFlow={
|
|
36
|
-
$columns={
|
|
37
|
-
$gap={
|
|
38
|
-
$gapX={
|
|
39
|
-
$gapY={
|
|
40
|
-
$rows={
|
|
33
|
+
$autoRows={_getArrayProp(autoRows)}
|
|
34
|
+
$autoCols={_getArrayProp(autoCols)}
|
|
35
|
+
$autoFlow={_getArrayProp(autoFlow)}
|
|
36
|
+
$columns={_getArrayProp(columns)}
|
|
37
|
+
$gap={_getArrayProp(gap)}
|
|
38
|
+
$gapX={_getArrayProp(gapX)}
|
|
39
|
+
$gapY={_getArrayProp(gapY)}
|
|
40
|
+
$rows={_getArrayProp(rows)}
|
|
41
41
|
forwardedAs={as}
|
|
42
42
|
ref={ref}
|
|
43
43
|
>
|
|
@@ -2,7 +2,7 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
|
2
2
|
import {forwardRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {_getArrayProp} from '../../styles'
|
|
6
6
|
import {
|
|
7
7
|
ResponsiveFontStyleProps,
|
|
8
8
|
responsiveHeadingFont,
|
|
@@ -67,9 +67,9 @@ export const Heading = forwardRef(function Heading(
|
|
|
67
67
|
data-ui="Heading"
|
|
68
68
|
{...restProps}
|
|
69
69
|
$accent={accent}
|
|
70
|
-
$align={
|
|
70
|
+
$align={_getArrayProp(align)}
|
|
71
71
|
$muted={muted}
|
|
72
|
-
$size={
|
|
72
|
+
$size={_getArrayProp(size)}
|
|
73
73
|
$weight={weight}
|
|
74
74
|
ref={ref}
|
|
75
75
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Children, forwardRef, useMemo} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {Box, BoxProps} from '../box'
|
|
6
6
|
import {inlineBaseStyle, inlineSpaceStyle} from './styles'
|
|
7
7
|
import {ResponsiveInlineSpaceStyleProps} from './types'
|
|
@@ -36,7 +36,7 @@ export const Inline = forwardRef(function Inline(
|
|
|
36
36
|
<StyledInline
|
|
37
37
|
data-ui="Inline"
|
|
38
38
|
{...restProps}
|
|
39
|
-
$space={
|
|
39
|
+
$space={_getArrayProp(space)}
|
|
40
40
|
forwardedAs={as}
|
|
41
41
|
ref={ref as any}
|
|
42
42
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {css, styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
6
6
|
import {Radius} from '../../types'
|
|
7
7
|
import {Box} from '../box'
|
|
@@ -49,7 +49,7 @@ export const KBD = forwardRef(function KBD(
|
|
|
49
49
|
const {children, fontSize = 0, padding = 1, radius = 2, ...restProps} = props
|
|
50
50
|
|
|
51
51
|
return (
|
|
52
|
-
<StyledKBD data-ui="KBD" {...restProps} $radius={
|
|
52
|
+
<StyledKBD data-ui="KBD" {...restProps} $radius={_getArrayProp(radius)} ref={ref}>
|
|
53
53
|
<Box as="span" padding={padding}>
|
|
54
54
|
<Text as="span" size={fontSize} weight="semibold">
|
|
55
55
|
{children}
|
|
@@ -2,7 +2,7 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
|
2
2
|
import {forwardRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {_getArrayProp} from '../../styles'
|
|
6
6
|
import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
|
|
7
7
|
import {TextAlign} from '../../types'
|
|
8
8
|
import {SpanWithTextOverflow} from '../../utils/spanWithTextOverflow'
|
|
@@ -66,9 +66,9 @@ export const Label = forwardRef(function Label(
|
|
|
66
66
|
data-ui="Label"
|
|
67
67
|
{...restProps}
|
|
68
68
|
$accent={accent}
|
|
69
|
-
$align={
|
|
69
|
+
$align={_getArrayProp(align)}
|
|
70
70
|
$muted={muted}
|
|
71
|
-
$size={
|
|
71
|
+
$size={_getArrayProp(size)}
|
|
72
72
|
$weight={weight}
|
|
73
73
|
ref={ref}
|
|
74
74
|
>
|
|
@@ -24,8 +24,9 @@ import {
|
|
|
24
24
|
useState,
|
|
25
25
|
} from 'react'
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import {useElementSize, useMediaIndex, usePrefersReducedMotion} from '../../hooks'
|
|
28
28
|
import {origin} from '../../middleware/origin'
|
|
29
|
+
import {_getArrayProp} from '../../styles'
|
|
29
30
|
import {useTheme_v2} from '../../theme'
|
|
30
31
|
import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
|
|
31
32
|
import {LayerProps, LayerProvider, Portal, useBoundaryElement, useLayer} from '../../utils'
|
|
@@ -185,11 +186,11 @@ export const Popover = forwardRef(function Popover(
|
|
|
185
186
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
186
187
|
const animate = prefersReducedMotion ? false : _animate
|
|
187
188
|
const boundarySize = useElementSize(boundaryElement)?.border
|
|
188
|
-
const padding =
|
|
189
|
-
const radius =
|
|
190
|
-
const shadow =
|
|
191
|
-
const widthArrayProp =
|
|
192
|
-
const zOffset =
|
|
189
|
+
const padding = _getArrayProp(paddingProp)
|
|
190
|
+
const radius = _getArrayProp(radiusProp)
|
|
191
|
+
const shadow = _getArrayProp(shadowProp)
|
|
192
|
+
const widthArrayProp = _getArrayProp(widthProp)
|
|
193
|
+
const zOffset = _getArrayProp(zOffsetProp)
|
|
193
194
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
194
195
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
195
196
|
const rootBoundary: RootBoundary = 'viewport'
|
|
@@ -2,7 +2,8 @@ import {ChevronDownIcon} from '@sanity/icons'
|
|
|
2
2
|
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {useCustomValidity} from '../../hooks'
|
|
6
|
+
import {_getArrayProp} from '../../styles'
|
|
6
7
|
import {Radius} from '../../types'
|
|
7
8
|
import {Box} from '../box'
|
|
8
9
|
import {Text} from '../text'
|
|
@@ -66,10 +67,10 @@ export const Select = forwardRef(function Select(
|
|
|
66
67
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
67
68
|
data-ui="Select"
|
|
68
69
|
{...restProps}
|
|
69
|
-
$fontSize={
|
|
70
|
-
$padding={
|
|
71
|
-
$radius={
|
|
72
|
-
$space={
|
|
70
|
+
$fontSize={_getArrayProp(fontSize)}
|
|
71
|
+
$padding={_getArrayProp(padding)}
|
|
72
|
+
$radius={_getArrayProp(radius)}
|
|
73
|
+
$space={_getArrayProp(space)}
|
|
73
74
|
disabled={disabled || readOnly}
|
|
74
75
|
ref={ref}
|
|
75
76
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {Box, BoxProps} from '../box'
|
|
6
6
|
import {responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps, stackBaseStyle} from './styles'
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ export const Stack = forwardRef(function Stack(
|
|
|
34
34
|
data-as={typeof as === 'string' ? as : undefined}
|
|
35
35
|
data-ui="Stack"
|
|
36
36
|
{...restProps}
|
|
37
|
-
$space={
|
|
37
|
+
$space={_getArrayProp(space)}
|
|
38
38
|
forwardedAs={as}
|
|
39
39
|
ref={ref}
|
|
40
40
|
/>
|
|
@@ -2,7 +2,7 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
|
2
2
|
import {forwardRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {_getArrayProp} from '../../styles'
|
|
6
6
|
import {
|
|
7
7
|
ResponsiveFontStyleProps,
|
|
8
8
|
responsiveTextAlignStyle,
|
|
@@ -68,10 +68,10 @@ export const Text = forwardRef(function Text(
|
|
|
68
68
|
data-ui="Text"
|
|
69
69
|
{...restProps}
|
|
70
70
|
$accent={accent}
|
|
71
|
-
$align={
|
|
71
|
+
$align={_getArrayProp(align)}
|
|
72
72
|
$muted={muted}
|
|
73
73
|
ref={ref}
|
|
74
|
-
$size={
|
|
74
|
+
$size={_getArrayProp(size)}
|
|
75
75
|
$weight={weight}
|
|
76
76
|
>
|
|
77
77
|
<span>{children}</span>
|
|
@@ -2,7 +2,8 @@ import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
|
2
2
|
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {useCustomValidity} from '../../hooks'
|
|
6
|
+
import {_getArrayProp} from '../../styles'
|
|
6
7
|
import {
|
|
7
8
|
responsiveInputPaddingStyle,
|
|
8
9
|
responsiveRadiusStyle,
|
|
@@ -94,17 +95,17 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
94
95
|
data-scheme={rootTheme.scheme}
|
|
95
96
|
data-tone={rootTheme.tone}
|
|
96
97
|
{...restProps}
|
|
97
|
-
$fontSize={
|
|
98
|
-
$padding={
|
|
98
|
+
$fontSize={_getArrayProp(fontSize)}
|
|
99
|
+
$padding={_getArrayProp(padding)}
|
|
99
100
|
$scheme={rootTheme.scheme}
|
|
100
|
-
$space={
|
|
101
|
+
$space={_getArrayProp(0)}
|
|
101
102
|
$tone={rootTheme.tone}
|
|
102
103
|
$weight={weight}
|
|
103
104
|
disabled={disabled}
|
|
104
105
|
ref={ref}
|
|
105
106
|
/>
|
|
106
107
|
<Presentation
|
|
107
|
-
$radius={
|
|
108
|
+
$radius={_getArrayProp(radius)}
|
|
108
109
|
$unstableDisableFocusRing={__unstable_disableFocusRing}
|
|
109
110
|
$scheme={rootTheme.scheme}
|
|
110
111
|
$tone={rootTheme.tone}
|
|
@@ -5,7 +5,8 @@ import {isValidElementType} from 'react-is'
|
|
|
5
5
|
import {styled} from 'styled-components'
|
|
6
6
|
|
|
7
7
|
import {EMPTY_RECORD} from '../../constants'
|
|
8
|
-
import {
|
|
8
|
+
import {useCustomValidity} from '../../hooks'
|
|
9
|
+
import {_getArrayProp} from '../../styles'
|
|
9
10
|
import {
|
|
10
11
|
responsiveInputPaddingStyle,
|
|
11
12
|
responsiveRadiusStyle,
|
|
@@ -179,10 +180,10 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
179
180
|
|
|
180
181
|
const rootTheme = useRootTheme()
|
|
181
182
|
|
|
182
|
-
const fontSize =
|
|
183
|
-
const padding =
|
|
184
|
-
const radius =
|
|
185
|
-
const space =
|
|
183
|
+
const fontSize = _getArrayProp(fontSizeProp)
|
|
184
|
+
const padding = _getArrayProp(paddingProp)
|
|
185
|
+
const radius = _getArrayProp(radiusProp)
|
|
186
|
+
const space = _getArrayProp(spaceProp)
|
|
186
187
|
|
|
187
188
|
// Transient properties
|
|
188
189
|
const $hasClearButton = Boolean(clearButton)
|
|
@@ -25,9 +25,10 @@ import {
|
|
|
25
25
|
import {styled} from 'styled-components'
|
|
26
26
|
import {useEffectEvent} from 'use-effect-event'
|
|
27
27
|
|
|
28
|
-
import {
|
|
28
|
+
import {usePrefersReducedMotion} from '../../hooks'
|
|
29
29
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
30
30
|
import {origin} from '../../middleware/origin'
|
|
31
|
+
import {_getArrayProp} from '../../styles'
|
|
31
32
|
import {useTheme_v2} from '../../theme'
|
|
32
33
|
import type {Placement} from '../../types'
|
|
33
34
|
import {Layer, type LayerProps, Portal, useBoundaryElement, usePortal} from '../../utils'
|
|
@@ -119,7 +120,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
119
120
|
const zOffset = _zOffset ?? layer.tooltip.zOffset
|
|
120
121
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
121
122
|
const animate = prefersReducedMotion ? false : _animate
|
|
122
|
-
const fallbackPlacements =
|
|
123
|
+
const fallbackPlacements = _getArrayProp(fallbackPlacementsProp)
|
|
123
124
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
124
125
|
const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)
|
|
125
126
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {useCallback, useContext, useEffect, useMemo, useState} from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {useMediaIndex} from '../../hooks'
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
4
5
|
import {getLayerContext} from './getLayerContext'
|
|
5
6
|
import {LayerContext} from './layerContext'
|
|
6
7
|
import {LayerContextValue} from './types'
|
|
@@ -29,7 +30,7 @@ export function LayerProvider(props: LayerProviderProps): React.JSX.Element {
|
|
|
29
30
|
const level = parentLevel + 1
|
|
30
31
|
|
|
31
32
|
// Get z-index offset
|
|
32
|
-
const zOffset =
|
|
33
|
+
const zOffset = _getArrayProp(zOffsetProp)
|
|
33
34
|
|
|
34
35
|
// Get responsive z-index value
|
|
35
36
|
const maxMediaIndex = zOffset.length - 1
|