@sanity/ui 3.0.12-canary.2 → 3.0.13
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 +656 -852
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +658 -854
- 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 +144 -183
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -184
- package/dist/index.mjs.map +1 -1
- package/package.json +40 -26
- package/src/core/components/autocomplete/autocomplete.tsx +14 -10
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +2 -3
- package/src/core/components/dialog/dialog.tsx +14 -10
- package/src/core/components/hotkeys/hotkeys.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +4 -2
- package/src/core/components/menu/menuItem.tsx +4 -4
- package/src/core/components/skeleton/skeleton.tsx +4 -4
- package/src/core/components/skeleton/textSkeleton.tsx +5 -5
- package/src/core/components/tree/tree.tsx +1 -0
- package/src/core/hooks/index.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +17 -5
- package/src/core/hooks/useClickOutside.ts +1 -0
- package/src/core/primitives/avatar/avatar.tsx +17 -14
- package/src/core/primitives/avatar/avatarCounter.tsx +16 -14
- package/src/core/primitives/avatar/avatarStack.tsx +2 -2
- 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 -11
- package/src/core/primitives/card/card.tsx +8 -8
- package/src/core/primitives/code/code.tsx +2 -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 +6 -7
- package/src/core/primitives/select/select.tsx +5 -6
- 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 +5 -6
- package/src/core/primitives/textInput/textInput.tsx +5 -6
- package/src/core/primitives/tooltip/tooltip.tsx +3 -3
- package/src/core/utils/layer/layerProvider.tsx +2 -3
- package/src/core/utils/virtualList/virtualList.tsx +2 -0
|
@@ -3,7 +3,7 @@ import {forwardRef, isValidElement, useMemo} from 'react'
|
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
4
|
import {styled} from 'styled-components'
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {useArrayProp} from '../../hooks'
|
|
7
7
|
import {ThemeProps} from '../../styles'
|
|
8
8
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
9
9
|
import {useTheme_v2} from '../../theme'
|
|
@@ -97,16 +97,16 @@ export const Button = forwardRef(function Button(
|
|
|
97
97
|
} = props
|
|
98
98
|
const {button} = useTheme_v2()
|
|
99
99
|
|
|
100
|
-
const justify =
|
|
101
|
-
const padding =
|
|
102
|
-
const paddingX =
|
|
103
|
-
const paddingY =
|
|
104
|
-
const paddingTop =
|
|
105
|
-
const paddingBottom =
|
|
106
|
-
const paddingLeft =
|
|
107
|
-
const paddingRight =
|
|
108
|
-
const radius =
|
|
109
|
-
const space =
|
|
100
|
+
const justify = useArrayProp(justifyProp)
|
|
101
|
+
const padding = useArrayProp(paddingProp)
|
|
102
|
+
const paddingX = useArrayProp(paddingXProp)
|
|
103
|
+
const paddingY = useArrayProp(paddingYProp)
|
|
104
|
+
const paddingTop = useArrayProp(paddingTopProp)
|
|
105
|
+
const paddingBottom = useArrayProp(paddingBottomProp)
|
|
106
|
+
const paddingLeft = useArrayProp(paddingLeftProp)
|
|
107
|
+
const paddingRight = useArrayProp(paddingRightProp)
|
|
108
|
+
const radius = useArrayProp(radiusProp)
|
|
109
|
+
const space = useArrayProp(spaceProp)
|
|
110
110
|
|
|
111
111
|
const boxProps = useMemo(
|
|
112
112
|
() => ({
|
|
@@ -3,7 +3,7 @@ import {forwardRef} from 'react'
|
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
4
|
import {styled} from 'styled-components'
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {useArrayProp} from '../../hooks'
|
|
7
7
|
import {
|
|
8
8
|
responsiveBorderStyle,
|
|
9
9
|
ResponsiveBorderStyleProps,
|
|
@@ -93,16 +93,16 @@ export const Card = forwardRef(function Card(
|
|
|
93
93
|
data-ui="Card"
|
|
94
94
|
data-tone={tone}
|
|
95
95
|
{...restProps}
|
|
96
|
-
$border={
|
|
97
|
-
$borderTop={
|
|
98
|
-
$borderRight={
|
|
99
|
-
$borderBottom={
|
|
100
|
-
$borderLeft={
|
|
96
|
+
$border={useArrayProp(border)}
|
|
97
|
+
$borderTop={useArrayProp(borderTop)}
|
|
98
|
+
$borderRight={useArrayProp(borderRight)}
|
|
99
|
+
$borderBottom={useArrayProp(borderBottom)}
|
|
100
|
+
$borderLeft={useArrayProp(borderLeft)}
|
|
101
101
|
$checkered={checkered}
|
|
102
102
|
$focusRing={focusRing}
|
|
103
103
|
$muted={muted}
|
|
104
|
-
$radius={
|
|
105
|
-
$shadow={
|
|
104
|
+
$radius={useArrayProp(radius)}
|
|
105
|
+
$shadow={useArrayProp(shadow)}
|
|
106
106
|
$tone={tone}
|
|
107
107
|
data-checkered={checkered ? '' : undefined}
|
|
108
108
|
data-pressed={pressed ? '' : undefined}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef, lazy, Suspense} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
|
|
6
6
|
import {codeBaseStyle} from './styles'
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ export const Code = forwardRef(function Code(
|
|
|
30
30
|
const {children, language, size = 2, weight, ...restProps} = props
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<StyledCode data-ui="Code" {...restProps} $size={
|
|
33
|
+
<StyledCode data-ui="Code" {...restProps} $size={useArrayProp(size)} $weight={weight} ref={ref}>
|
|
34
34
|
<Suspense fallback={<code>{children}</code>}>
|
|
35
35
|
<LazyRefractor language={language} value={children} />
|
|
36
36
|
</Suspense>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {Box, BoxProps} from '../box'
|
|
6
6
|
import {ResponsiveWidthProps} from '../types'
|
|
7
7
|
import {containerBaseStyle, responsiveContainerWidthStyle} from './styles'
|
|
@@ -32,7 +32,7 @@ export const Container = forwardRef(function Container(
|
|
|
32
32
|
<StyledContainer
|
|
33
33
|
data-ui="Container"
|
|
34
34
|
{...restProps}
|
|
35
|
-
$width={
|
|
35
|
+
$width={useArrayProp(width)}
|
|
36
36
|
forwardedAs={as}
|
|
37
37
|
ref={ref}
|
|
38
38
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(align)}
|
|
45
|
+
$direction={useArrayProp(direction)}
|
|
46
|
+
$gap={useArrayProp(gap)}
|
|
47
|
+
$justify={useArrayProp(justify)}
|
|
48
|
+
$wrap={useArrayProp(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 {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(autoRows)}
|
|
34
|
+
$autoCols={useArrayProp(autoCols)}
|
|
35
|
+
$autoFlow={useArrayProp(autoFlow)}
|
|
36
|
+
$columns={useArrayProp(columns)}
|
|
37
|
+
$gap={useArrayProp(gap)}
|
|
38
|
+
$gapX={useArrayProp(gapX)}
|
|
39
|
+
$gapY={useArrayProp(gapY)}
|
|
40
|
+
$rows={useArrayProp(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 {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(align)}
|
|
71
71
|
$muted={muted}
|
|
72
|
-
$size={
|
|
72
|
+
$size={useArrayProp(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 {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(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 {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(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 {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(align)}
|
|
70
70
|
$muted={muted}
|
|
71
|
-
$size={
|
|
71
|
+
$size={useArrayProp(size)}
|
|
72
72
|
$weight={weight}
|
|
73
73
|
ref={ref}
|
|
74
74
|
>
|
|
@@ -24,8 +24,7 @@ import {
|
|
|
24
24
|
useState,
|
|
25
25
|
} from 'react'
|
|
26
26
|
|
|
27
|
-
import {useElementSize, useMediaIndex, usePrefersReducedMotion} from '../../hooks'
|
|
28
|
-
import {getArrayProp} from '../../hooks/useArrayProp'
|
|
27
|
+
import {useArrayProp, useElementSize, useMediaIndex, usePrefersReducedMotion} from '../../hooks'
|
|
29
28
|
import {origin} from '../../middleware/origin'
|
|
30
29
|
import {useTheme_v2} from '../../theme'
|
|
31
30
|
import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
|
|
@@ -186,11 +185,11 @@ export const Popover = forwardRef(function Popover(
|
|
|
186
185
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
187
186
|
const animate = prefersReducedMotion ? false : _animate
|
|
188
187
|
const boundarySize = useElementSize(boundaryElement)?.border
|
|
189
|
-
const padding =
|
|
190
|
-
const radius =
|
|
191
|
-
const shadow =
|
|
192
|
-
const widthArrayProp =
|
|
193
|
-
const zOffset =
|
|
188
|
+
const padding = useArrayProp(paddingProp)
|
|
189
|
+
const radius = useArrayProp(radiusProp)
|
|
190
|
+
const shadow = useArrayProp(shadowProp)
|
|
191
|
+
const widthArrayProp = useArrayProp(widthProp)
|
|
192
|
+
const zOffset = useArrayProp(zOffsetProp)
|
|
194
193
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
195
194
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
196
195
|
const rootBoundary: RootBoundary = 'viewport'
|
|
@@ -2,8 +2,7 @@ import {ChevronDownIcon} from '@sanity/icons'
|
|
|
2
2
|
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
|
|
5
|
-
import {useCustomValidity} from '../../hooks'
|
|
6
|
-
import {getArrayProp} from '../../hooks/useArrayProp'
|
|
5
|
+
import {useArrayProp, useCustomValidity} from '../../hooks'
|
|
7
6
|
import {Radius} from '../../types'
|
|
8
7
|
import {Box} from '../box'
|
|
9
8
|
import {Text} from '../text'
|
|
@@ -67,10 +66,10 @@ export const Select = forwardRef(function Select(
|
|
|
67
66
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
68
67
|
data-ui="Select"
|
|
69
68
|
{...restProps}
|
|
70
|
-
$fontSize={
|
|
71
|
-
$padding={
|
|
72
|
-
$radius={
|
|
73
|
-
$space={
|
|
69
|
+
$fontSize={useArrayProp(fontSize)}
|
|
70
|
+
$padding={useArrayProp(padding)}
|
|
71
|
+
$radius={useArrayProp(radius)}
|
|
72
|
+
$space={useArrayProp(space)}
|
|
74
73
|
disabled={disabled || readOnly}
|
|
75
74
|
ref={ref}
|
|
76
75
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(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 {useArrayProp} from '../../hooks'
|
|
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={useArrayProp(align)}
|
|
72
72
|
$muted={muted}
|
|
73
73
|
ref={ref}
|
|
74
|
-
$size={
|
|
74
|
+
$size={useArrayProp(size)}
|
|
75
75
|
$weight={weight}
|
|
76
76
|
>
|
|
77
77
|
<span>{children}</span>
|
|
@@ -2,8 +2,7 @@ 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 {useCustomValidity} from '../../hooks'
|
|
6
|
-
import {getArrayProp} from '../../hooks/useArrayProp'
|
|
5
|
+
import {useArrayProp, useCustomValidity} from '../../hooks'
|
|
7
6
|
import {
|
|
8
7
|
responsiveInputPaddingStyle,
|
|
9
8
|
responsiveRadiusStyle,
|
|
@@ -95,17 +94,17 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
95
94
|
data-scheme={rootTheme.scheme}
|
|
96
95
|
data-tone={rootTheme.tone}
|
|
97
96
|
{...restProps}
|
|
98
|
-
$fontSize={
|
|
99
|
-
$padding={
|
|
97
|
+
$fontSize={useArrayProp(fontSize)}
|
|
98
|
+
$padding={useArrayProp(padding)}
|
|
100
99
|
$scheme={rootTheme.scheme}
|
|
101
|
-
$space={
|
|
100
|
+
$space={useArrayProp(0)}
|
|
102
101
|
$tone={rootTheme.tone}
|
|
103
102
|
$weight={weight}
|
|
104
103
|
disabled={disabled}
|
|
105
104
|
ref={ref}
|
|
106
105
|
/>
|
|
107
106
|
<Presentation
|
|
108
|
-
$radius={
|
|
107
|
+
$radius={useArrayProp(radius)}
|
|
109
108
|
$unstableDisableFocusRing={__unstable_disableFocusRing}
|
|
110
109
|
$scheme={rootTheme.scheme}
|
|
111
110
|
$tone={rootTheme.tone}
|
|
@@ -5,8 +5,7 @@ import {isValidElementType} from 'react-is'
|
|
|
5
5
|
import {styled} from 'styled-components'
|
|
6
6
|
|
|
7
7
|
import {EMPTY_RECORD} from '../../constants'
|
|
8
|
-
import {useCustomValidity} from '../../hooks'
|
|
9
|
-
import {getArrayProp} from '../../hooks/useArrayProp'
|
|
8
|
+
import {useArrayProp, useCustomValidity} from '../../hooks'
|
|
10
9
|
import {
|
|
11
10
|
responsiveInputPaddingStyle,
|
|
12
11
|
responsiveRadiusStyle,
|
|
@@ -180,10 +179,10 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
180
179
|
|
|
181
180
|
const rootTheme = useRootTheme()
|
|
182
181
|
|
|
183
|
-
const fontSize =
|
|
184
|
-
const padding =
|
|
185
|
-
const radius =
|
|
186
|
-
const space =
|
|
182
|
+
const fontSize = useArrayProp(fontSizeProp)
|
|
183
|
+
const padding = useArrayProp(paddingProp)
|
|
184
|
+
const radius = useArrayProp(radiusProp)
|
|
185
|
+
const space = useArrayProp(spaceProp)
|
|
187
186
|
|
|
188
187
|
// Transient properties
|
|
189
188
|
const $hasClearButton = Boolean(clearButton)
|
|
@@ -25,8 +25,7 @@ import {
|
|
|
25
25
|
import {styled} from 'styled-components'
|
|
26
26
|
import {useEffectEvent} from 'use-effect-event'
|
|
27
27
|
|
|
28
|
-
import {usePrefersReducedMotion} from '../../hooks'
|
|
29
|
-
import {getArrayProp} from '../../hooks/useArrayProp'
|
|
28
|
+
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
30
29
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
31
30
|
import {origin} from '../../middleware/origin'
|
|
32
31
|
import {useTheme_v2} from '../../theme'
|
|
@@ -120,7 +119,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
120
119
|
const zOffset = _zOffset ?? layer.tooltip.zOffset
|
|
121
120
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
122
121
|
const animate = prefersReducedMotion ? false : _animate
|
|
123
|
-
const fallbackPlacements =
|
|
122
|
+
const fallbackPlacements = useArrayProp(fallbackPlacementsProp)
|
|
124
123
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
125
124
|
const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)
|
|
126
125
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -286,6 +285,7 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
286
285
|
portalElement?.offsetWidth || document.body.offsetWidth,
|
|
287
286
|
]
|
|
288
287
|
|
|
288
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
289
289
|
setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)
|
|
290
290
|
}, [boundaryElement, portalElement])
|
|
291
291
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {useCallback, useContext, useEffect, useMemo, useState} from 'react'
|
|
2
2
|
|
|
3
|
-
import {useMediaIndex} from '../../hooks'
|
|
4
|
-
import {getArrayProp} from '../../hooks/useArrayProp'
|
|
3
|
+
import {useArrayProp, useMediaIndex} from '../../hooks'
|
|
5
4
|
import {getLayerContext} from './getLayerContext'
|
|
6
5
|
import {LayerContext} from './layerContext'
|
|
7
6
|
import {LayerContextValue} from './types'
|
|
@@ -30,7 +29,7 @@ export function LayerProvider(props: LayerProviderProps): React.JSX.Element {
|
|
|
30
29
|
const level = parentLevel + 1
|
|
31
30
|
|
|
32
31
|
// Get z-index offset
|
|
33
|
-
const zOffset =
|
|
32
|
+
const zOffset = useArrayProp(zOffsetProp)
|
|
34
33
|
|
|
35
34
|
// Get responsive z-index value
|
|
36
35
|
const maxMediaIndex = zOffset.length - 1
|
|
@@ -66,6 +66,7 @@ export const VirtualList = forwardRef(function VirtualList(
|
|
|
66
66
|
const firstElement = wrapperRef.current.firstChild
|
|
67
67
|
|
|
68
68
|
if (firstElement instanceof HTMLElement) {
|
|
69
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
69
70
|
setItemHeight(firstElement.offsetHeight)
|
|
70
71
|
}
|
|
71
72
|
}, [renderItem])
|
|
@@ -111,6 +112,7 @@ export const VirtualList = forwardRef(function VirtualList(
|
|
|
111
112
|
window.addEventListener('scroll', handleScroll, {passive: true})
|
|
112
113
|
window.addEventListener('resize', handleResize)
|
|
113
114
|
|
|
115
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
114
116
|
setScrollHeight(window.innerHeight)
|
|
115
117
|
|
|
116
118
|
handleScroll()
|