@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.
Files changed (47) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +656 -852
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-es/_visual-editing.mjs +658 -854
  4. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  5. package/dist/index.d.mts +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.js +144 -183
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +145 -184
  10. package/dist/index.mjs.map +1 -1
  11. package/package.json +40 -26
  12. package/src/core/components/autocomplete/autocomplete.tsx +14 -10
  13. package/src/core/components/breadcrumbs/breadcrumbs.tsx +2 -3
  14. package/src/core/components/dialog/dialog.tsx +14 -10
  15. package/src/core/components/hotkeys/hotkeys.tsx +2 -2
  16. package/src/core/components/menu/menuGroup.tsx +4 -2
  17. package/src/core/components/menu/menuItem.tsx +4 -4
  18. package/src/core/components/skeleton/skeleton.tsx +4 -4
  19. package/src/core/components/skeleton/textSkeleton.tsx +5 -5
  20. package/src/core/components/tree/tree.tsx +1 -0
  21. package/src/core/hooks/index.ts +1 -1
  22. package/src/core/hooks/useArrayProp.ts +17 -5
  23. package/src/core/hooks/useClickOutside.ts +1 -0
  24. package/src/core/primitives/avatar/avatar.tsx +17 -14
  25. package/src/core/primitives/avatar/avatarCounter.tsx +16 -14
  26. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  27. package/src/core/primitives/badge/badge.tsx +3 -3
  28. package/src/core/primitives/box/box.tsx +26 -26
  29. package/src/core/primitives/button/button.tsx +11 -11
  30. package/src/core/primitives/card/card.tsx +8 -8
  31. package/src/core/primitives/code/code.tsx +2 -2
  32. package/src/core/primitives/container/container.tsx +2 -2
  33. package/src/core/primitives/flex/flex.tsx +6 -6
  34. package/src/core/primitives/grid/grid.tsx +9 -9
  35. package/src/core/primitives/heading/heading.tsx +3 -3
  36. package/src/core/primitives/inline/inline.tsx +2 -2
  37. package/src/core/primitives/kbd/kbd.tsx +2 -2
  38. package/src/core/primitives/label/label.tsx +3 -3
  39. package/src/core/primitives/popover/popover.tsx +6 -7
  40. package/src/core/primitives/select/select.tsx +5 -6
  41. package/src/core/primitives/stack/stack.tsx +2 -2
  42. package/src/core/primitives/text/text.tsx +3 -3
  43. package/src/core/primitives/textArea/textArea.tsx +5 -6
  44. package/src/core/primitives/textInput/textInput.tsx +5 -6
  45. package/src/core/primitives/tooltip/tooltip.tsx +3 -3
  46. package/src/core/utils/layer/layerProvider.tsx +2 -3
  47. 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 {getArrayProp} from '../../hooks/useArrayProp'
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 = getArrayProp(justifyProp)
101
- const padding = getArrayProp(paddingProp)
102
- const paddingX = getArrayProp(paddingXProp)
103
- const paddingY = getArrayProp(paddingYProp)
104
- const paddingTop = getArrayProp(paddingTopProp)
105
- const paddingBottom = getArrayProp(paddingBottomProp)
106
- const paddingLeft = getArrayProp(paddingLeftProp)
107
- const paddingRight = getArrayProp(paddingRightProp)
108
- const radius = getArrayProp(radiusProp)
109
- const space = getArrayProp(spaceProp)
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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(border)}
97
- $borderTop={getArrayProp(borderTop)}
98
- $borderRight={getArrayProp(borderRight)}
99
- $borderBottom={getArrayProp(borderBottom)}
100
- $borderLeft={getArrayProp(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={getArrayProp(radius)}
105
- $shadow={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(size)} $weight={weight} ref={ref}>
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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(align)}
45
- $direction={getArrayProp(direction)}
46
- $gap={getArrayProp(gap)}
47
- $justify={getArrayProp(justify)}
48
- $wrap={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={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)}
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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(align)}
70
+ $align={useArrayProp(align)}
71
71
  $muted={muted}
72
- $size={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(radius)} ref={ref}>
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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(align)}
69
+ $align={useArrayProp(align)}
70
70
  $muted={muted}
71
- $size={getArrayProp(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 = getArrayProp(paddingProp)
190
- const radius = getArrayProp(radiusProp)
191
- const shadow = getArrayProp(shadowProp)
192
- const widthArrayProp = getArrayProp(widthProp)
193
- const zOffset = getArrayProp(zOffsetProp)
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={getArrayProp(fontSize)}
71
- $padding={getArrayProp(padding)}
72
- $radius={getArrayProp(radius)}
73
- $space={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(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 {getArrayProp} from '../../hooks/useArrayProp'
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={getArrayProp(align)}
71
+ $align={useArrayProp(align)}
72
72
  $muted={muted}
73
73
  ref={ref}
74
- $size={getArrayProp(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={getArrayProp(fontSize)}
99
- $padding={getArrayProp(padding)}
97
+ $fontSize={useArrayProp(fontSize)}
98
+ $padding={useArrayProp(padding)}
100
99
  $scheme={rootTheme.scheme}
101
- $space={getArrayProp(0)}
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={getArrayProp(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 = getArrayProp(fontSizeProp)
184
- const padding = getArrayProp(paddingProp)
185
- const radius = getArrayProp(radiusProp)
186
- const space = getArrayProp(spaceProp)
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 = getArrayProp(fallbackPlacementsProp)
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 = getArrayProp(zOffsetProp)
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()