@sanity/ui 2.3.6-canary.0 → 2.3.6-canary.2
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/index.compiled.mjs +1262 -1009
- package/dist/index.compiled.mjs.map +1 -1
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +960 -979
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +965 -984
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +960 -979
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/core/components/autocomplete/autocomplete.tsx +2 -2
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/core/components/dialog/dialog.tsx +19 -10
- package/src/core/components/hotkeys/hotkeys.tsx +3 -3
- package/src/core/components/menu/menuGroup.tsx +5 -4
- package/src/core/components/menu/menuItem.tsx +6 -4
- package/src/core/components/skeleton/skeleton.tsx +5 -11
- package/src/core/components/skeleton/textSkeleton.tsx +6 -7
- package/src/core/hooks/useArrayProp.ts +11 -10
- package/src/core/primitives/avatar/avatar.tsx +4 -4
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -3
- package/src/core/primitives/avatar/avatarStack.tsx +2 -3
- package/src/core/primitives/badge/badge.tsx +7 -4
- package/src/core/primitives/box/box.tsx +53 -27
- package/src/core/primitives/button/button.tsx +11 -12
- package/src/core/primitives/card/card.tsx +17 -9
- package/src/core/primitives/code/code.tsx +4 -3
- package/src/core/primitives/container/container.tsx +4 -11
- package/src/core/primitives/flex/flex.tsx +13 -7
- package/src/core/primitives/grid/grid.tsx +19 -10
- package/src/core/primitives/heading/heading.tsx +7 -4
- package/src/core/primitives/inline/inline.tsx +3 -2
- package/src/core/primitives/kbd/kbd.tsx +4 -3
- package/src/core/primitives/label/label.tsx +7 -4
- package/src/core/primitives/popover/popover.tsx +7 -6
- package/src/core/primitives/select/select.tsx +12 -6
- package/src/core/primitives/stack/stack.tsx +4 -3
- package/src/core/primitives/text/text.tsx +7 -4
- package/src/core/primitives/textArea/textArea.tsx +12 -6
- package/src/core/primitives/textInput/textInput.tsx +6 -5
- package/src/core/primitives/tooltip/tooltip.tsx +6 -2
- package/src/core/theme/themeProvider.tsx +4 -6
- package/src/core/utils/layer/layerProvider.tsx +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {forwardRef} from 'react'
|
|
1
|
+
import {forwardRef, useMemo} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
|
-
import {
|
|
3
|
+
import {_getArrayProp} from '../../styles'
|
|
4
4
|
import {
|
|
5
5
|
flexItemStyle,
|
|
6
6
|
FlexItemStyleProps,
|
|
@@ -36,15 +36,21 @@ export const Flex = forwardRef(function Flex(
|
|
|
36
36
|
) {
|
|
37
37
|
const {align, as, direction = 'row', gap, justify, wrap, ...restProps} = props
|
|
38
38
|
|
|
39
|
+
const $align = useMemo(() => _getArrayProp(align), [align])
|
|
40
|
+
const $direction = useMemo(() => _getArrayProp(direction), [direction])
|
|
41
|
+
const $gap = useMemo(() => _getArrayProp(gap), [gap])
|
|
42
|
+
const $justify = useMemo(() => _getArrayProp(justify), [justify])
|
|
43
|
+
const $wrap = useMemo(() => _getArrayProp(wrap), [wrap])
|
|
44
|
+
|
|
39
45
|
return (
|
|
40
46
|
<Root
|
|
41
47
|
data-ui="Flex"
|
|
42
48
|
{...restProps}
|
|
43
|
-
$align={
|
|
44
|
-
$direction={
|
|
45
|
-
$gap={
|
|
46
|
-
$justify={
|
|
47
|
-
$wrap={
|
|
49
|
+
$align={$align}
|
|
50
|
+
$direction={$direction}
|
|
51
|
+
$gap={$gap}
|
|
52
|
+
$justify={$justify}
|
|
53
|
+
$wrap={$wrap}
|
|
48
54
|
forwardedAs={as}
|
|
49
55
|
ref={ref}
|
|
50
56
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {forwardRef} from 'react'
|
|
1
|
+
import {forwardRef, useMemo} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
|
-
import {
|
|
3
|
+
import {_getArrayProp} from '../../styles'
|
|
4
4
|
import {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
|
|
5
5
|
import {Box, BoxProps} from '../box'
|
|
6
6
|
import {ResponsiveGridProps} from '../types'
|
|
@@ -24,19 +24,28 @@ export const Grid = forwardRef(function Grid(
|
|
|
24
24
|
const {as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps} =
|
|
25
25
|
props
|
|
26
26
|
|
|
27
|
+
const $autoRows = useMemo(() => _getArrayProp(autoRows), [autoRows])
|
|
28
|
+
const $autoCols = useMemo(() => _getArrayProp(autoCols), [autoCols])
|
|
29
|
+
const $autoFlow = useMemo(() => _getArrayProp(autoFlow), [autoFlow])
|
|
30
|
+
const $columns = useMemo(() => _getArrayProp(columns), [columns])
|
|
31
|
+
const $gap = useMemo(() => _getArrayProp(gap), [gap])
|
|
32
|
+
const $gapX = useMemo(() => _getArrayProp(gapX), [gapX])
|
|
33
|
+
const $gapY = useMemo(() => _getArrayProp(gapY), [gapY])
|
|
34
|
+
const $rows = useMemo(() => _getArrayProp(rows), [rows])
|
|
35
|
+
|
|
27
36
|
return (
|
|
28
37
|
<Root
|
|
29
38
|
data-as={typeof as === 'string' ? as : undefined}
|
|
30
39
|
data-ui="Grid"
|
|
31
40
|
{...restProps}
|
|
32
|
-
$autoRows={
|
|
33
|
-
$autoCols={
|
|
34
|
-
$autoFlow={
|
|
35
|
-
$columns={
|
|
36
|
-
$gap={
|
|
37
|
-
$gapX={
|
|
38
|
-
$gapY={
|
|
39
|
-
$rows={
|
|
41
|
+
$autoRows={$autoRows}
|
|
42
|
+
$autoCols={$autoCols}
|
|
43
|
+
$autoFlow={$autoFlow}
|
|
44
|
+
$columns={$columns}
|
|
45
|
+
$gap={$gap}
|
|
46
|
+
$gapX={$gapX}
|
|
47
|
+
$gapY={$gapY}
|
|
48
|
+
$rows={$rows}
|
|
40
49
|
forwardedAs={as}
|
|
41
50
|
ref={ref}
|
|
42
51
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
2
|
+
import {forwardRef, useMemo} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {
|
|
6
6
|
ResponsiveFontStyleProps,
|
|
7
7
|
responsiveHeadingFont,
|
|
@@ -62,6 +62,9 @@ export const Heading = forwardRef(function Heading(
|
|
|
62
62
|
...restProps
|
|
63
63
|
} = props
|
|
64
64
|
|
|
65
|
+
const $size = useMemo(() => _getArrayProp(size), [size])
|
|
66
|
+
const $align = useMemo(() => _getArrayProp(align), [align])
|
|
67
|
+
|
|
65
68
|
let children = childrenProp
|
|
66
69
|
|
|
67
70
|
if (textOverflow === 'ellipsis') {
|
|
@@ -73,9 +76,9 @@ export const Heading = forwardRef(function Heading(
|
|
|
73
76
|
data-ui="Heading"
|
|
74
77
|
{...restProps}
|
|
75
78
|
$accent={accent}
|
|
76
|
-
$align={
|
|
79
|
+
$align={$align}
|
|
80
|
+
$size={$size}
|
|
77
81
|
$muted={muted}
|
|
78
|
-
$size={useArrayProp(size)}
|
|
79
82
|
$weight={weight}
|
|
80
83
|
ref={ref}
|
|
81
84
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {forwardRef, useMemo, Children} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
|
-
import {
|
|
3
|
+
import {_getArrayProp} from '../../styles'
|
|
4
4
|
import {Box, BoxProps} from '../box'
|
|
5
5
|
import {inlineBaseStyle, inlineSpaceStyle} from './styles'
|
|
6
6
|
import {ResponsiveInlineSpaceStyleProps} from './types'
|
|
@@ -26,6 +26,7 @@ export const Inline = forwardRef(function Inline(
|
|
|
26
26
|
) {
|
|
27
27
|
const {as, children: childrenProp, space, ...restProps} = props
|
|
28
28
|
|
|
29
|
+
const $space = useMemo(() => _getArrayProp(space), [space])
|
|
29
30
|
const children = useMemo(
|
|
30
31
|
() => Children.map(childrenProp, (child) => child && <div>{child}</div>),
|
|
31
32
|
[childrenProp],
|
|
@@ -35,7 +36,7 @@ export const Inline = forwardRef(function Inline(
|
|
|
35
36
|
<Root
|
|
36
37
|
data-ui="Inline"
|
|
37
38
|
{...restProps}
|
|
38
|
-
$space={
|
|
39
|
+
$space={$space}
|
|
39
40
|
forwardedAs={as}
|
|
40
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
42
|
ref={ref as any}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {forwardRef} from 'react'
|
|
1
|
+
import {forwardRef, useMemo} from 'react'
|
|
2
2
|
import {styled, css} from 'styled-components'
|
|
3
|
-
import {
|
|
3
|
+
import {_getArrayProp} from '../../styles'
|
|
4
4
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
5
5
|
import {Radius} from '../../types'
|
|
6
6
|
import {Box} from '../box'
|
|
@@ -46,9 +46,10 @@ export const KBD = forwardRef(function KBD(
|
|
|
46
46
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
47
47
|
) {
|
|
48
48
|
const {children, fontSize = 0, padding = 1, radius = 2, ...restProps} = props
|
|
49
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius])
|
|
49
50
|
|
|
50
51
|
return (
|
|
51
|
-
<Root data-ui="KBD" {...restProps} $radius={
|
|
52
|
+
<Root data-ui="KBD" {...restProps} $radius={$radius} ref={ref}>
|
|
52
53
|
<Box as="span" padding={padding}>
|
|
53
54
|
<Text as="span" size={fontSize} weight="semibold">
|
|
54
55
|
{children}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
2
|
+
import {forwardRef, useMemo} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
|
|
6
6
|
import {TextAlign} from '../../types'
|
|
7
7
|
import {labelBaseStyle} from './styles'
|
|
@@ -59,6 +59,9 @@ export const Label = forwardRef(function Label(
|
|
|
59
59
|
...restProps
|
|
60
60
|
} = props
|
|
61
61
|
|
|
62
|
+
const $size = useMemo(() => _getArrayProp(size), [size])
|
|
63
|
+
const $align = useMemo(() => _getArrayProp(align), [align])
|
|
64
|
+
|
|
62
65
|
let children = childrenProp
|
|
63
66
|
|
|
64
67
|
if (textOverflow === 'ellipsis') {
|
|
@@ -72,9 +75,9 @@ export const Label = forwardRef(function Label(
|
|
|
72
75
|
data-ui="Label"
|
|
73
76
|
{...restProps}
|
|
74
77
|
$accent={accent}
|
|
75
|
-
$align={
|
|
78
|
+
$align={$align}
|
|
79
|
+
$size={$size}
|
|
76
80
|
$muted={muted}
|
|
77
|
-
$size={useArrayProp(size)}
|
|
78
81
|
$weight={weight}
|
|
79
82
|
ref={ref}
|
|
80
83
|
>
|
|
@@ -23,8 +23,9 @@ import {
|
|
|
23
23
|
useMemo,
|
|
24
24
|
useRef,
|
|
25
25
|
} from 'react'
|
|
26
|
-
import {
|
|
26
|
+
import {useElementSize, useMediaIndex, usePrefersReducedMotion} from '../../hooks'
|
|
27
27
|
import {origin} from '../../middleware/origin'
|
|
28
|
+
import {_getArrayProp} from '../../styles'
|
|
28
29
|
import {useTheme_v2} from '../../theme'
|
|
29
30
|
import {BoxOverflow, CardTone, Placement, PopoverMargins} from '../../types'
|
|
30
31
|
import {
|
|
@@ -162,11 +163,11 @@ export const Popover = memo(
|
|
|
162
163
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
163
164
|
const animate = prefersReducedMotion ? false : _animate
|
|
164
165
|
const boundarySize = useElementSize(boundaryElement)?.border
|
|
165
|
-
const padding =
|
|
166
|
-
const radius =
|
|
167
|
-
const shadow =
|
|
168
|
-
const widthArrayProp =
|
|
169
|
-
const zOffset =
|
|
166
|
+
const padding = useMemo(() => _getArrayProp(paddingProp), [paddingProp])
|
|
167
|
+
const radius = useMemo(() => _getArrayProp(radiusProp), [radiusProp])
|
|
168
|
+
const shadow = useMemo(() => _getArrayProp(shadowProp), [shadowProp])
|
|
169
|
+
const widthArrayProp = useMemo(() => _getArrayProp(widthProp), [widthProp])
|
|
170
|
+
const zOffset = useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp])
|
|
170
171
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
171
172
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
172
173
|
const rootBoundary: RootBoundary = 'viewport'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
|
-
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
2
|
+
import {forwardRef, useImperativeHandle, useMemo, useRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
|
-
import {useCustomValidity
|
|
4
|
+
import {useCustomValidity} from '../../hooks'
|
|
5
|
+
import {_getArrayProp} from '../../styles'
|
|
5
6
|
import {Radius} from '../../types'
|
|
6
7
|
import {Box} from '../box'
|
|
7
8
|
import {Text} from '../text'
|
|
@@ -59,16 +60,21 @@ export const Select = forwardRef(function Select(
|
|
|
59
60
|
|
|
60
61
|
useCustomValidity(ref, customValidity)
|
|
61
62
|
|
|
63
|
+
const $fontSize = useMemo(() => _getArrayProp(fontSize), [fontSize])
|
|
64
|
+
const $padding = useMemo(() => _getArrayProp(padding), [padding])
|
|
65
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius])
|
|
66
|
+
const $space = useMemo(() => _getArrayProp(space), [space])
|
|
67
|
+
|
|
62
68
|
return (
|
|
63
69
|
<Root data-ui="Select">
|
|
64
70
|
<Input
|
|
65
71
|
data-read-only={!disabled && readOnly ? '' : undefined}
|
|
66
72
|
data-ui="Select"
|
|
67
73
|
{...restProps}
|
|
68
|
-
$fontSize={
|
|
69
|
-
$padding={
|
|
70
|
-
$radius={
|
|
71
|
-
$space={
|
|
74
|
+
$fontSize={$fontSize}
|
|
75
|
+
$padding={$padding}
|
|
76
|
+
$radius={$radius}
|
|
77
|
+
$space={$space}
|
|
72
78
|
disabled={disabled || readOnly}
|
|
73
79
|
ref={ref}
|
|
74
80
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {forwardRef} from 'react'
|
|
1
|
+
import {forwardRef, useMemo} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
|
-
import {
|
|
3
|
+
import {_getArrayProp} from '../../styles'
|
|
4
4
|
import {Box, BoxProps} from '../box'
|
|
5
5
|
import {stackBaseStyle, responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProps} from './styles'
|
|
6
6
|
|
|
@@ -24,13 +24,14 @@ export const Stack = forwardRef(function Stack(
|
|
|
24
24
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
25
25
|
) {
|
|
26
26
|
const {as, space, ...restProps} = props
|
|
27
|
+
const $space = useMemo(() => _getArrayProp(space), [space])
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
30
|
<Root
|
|
30
31
|
data-as={typeof as === 'string' ? as : undefined}
|
|
31
32
|
data-ui="Stack"
|
|
32
33
|
{...restProps}
|
|
33
|
-
$space={
|
|
34
|
+
$space={$space}
|
|
34
35
|
forwardedAs={as}
|
|
35
36
|
ref={ref}
|
|
36
37
|
/>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
2
|
+
import {forwardRef, useMemo} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
|
-
import {
|
|
4
|
+
import {_getArrayProp} from '../../styles'
|
|
5
5
|
import {
|
|
6
6
|
ResponsiveFontStyleProps,
|
|
7
7
|
responsiveTextAlignStyle,
|
|
@@ -63,6 +63,9 @@ export const Text = forwardRef(function Text(
|
|
|
63
63
|
...restProps
|
|
64
64
|
} = props
|
|
65
65
|
|
|
66
|
+
const $size = useMemo(() => _getArrayProp(size), [size])
|
|
67
|
+
const $align = useMemo(() => _getArrayProp(align), [align])
|
|
68
|
+
|
|
66
69
|
let children = childrenProp
|
|
67
70
|
|
|
68
71
|
if (textOverflow === 'ellipsis') {
|
|
@@ -74,10 +77,10 @@ export const Text = forwardRef(function Text(
|
|
|
74
77
|
data-ui="Text"
|
|
75
78
|
{...restProps}
|
|
76
79
|
$accent={accent}
|
|
77
|
-
$align={
|
|
80
|
+
$align={$align}
|
|
81
|
+
$size={$size}
|
|
78
82
|
$muted={muted}
|
|
79
83
|
ref={ref}
|
|
80
|
-
$size={useArrayProp(size)}
|
|
81
84
|
$weight={weight}
|
|
82
85
|
>
|
|
83
86
|
<span>{children}</span>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef, useImperativeHandle, useRef} from 'react'
|
|
2
|
+
import {forwardRef, useImperativeHandle, useMemo, useRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
|
-
import {useCustomValidity
|
|
4
|
+
import {useCustomValidity} from '../../hooks'
|
|
5
|
+
import {_getArrayProp} from '../../styles'
|
|
5
6
|
import {
|
|
6
7
|
responsiveInputPaddingStyle,
|
|
7
8
|
responsiveRadiusStyle,
|
|
@@ -80,6 +81,11 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
80
81
|
|
|
81
82
|
useCustomValidity(ref, customValidity)
|
|
82
83
|
|
|
84
|
+
const $radius = useMemo(() => _getArrayProp(radius), [radius])
|
|
85
|
+
const $fontSize = useMemo(() => _getArrayProp(fontSize), [fontSize])
|
|
86
|
+
const $padding = useMemo(() => _getArrayProp(padding), [padding])
|
|
87
|
+
const $space = useMemo(() => _getArrayProp(0), [])
|
|
88
|
+
|
|
83
89
|
return (
|
|
84
90
|
<Root data-ui="TextArea">
|
|
85
91
|
<InputRoot>
|
|
@@ -88,17 +94,17 @@ export const TextArea = forwardRef(function TextArea(
|
|
|
88
94
|
data-scheme={rootTheme.scheme}
|
|
89
95
|
data-tone={rootTheme.tone}
|
|
90
96
|
{...restProps}
|
|
91
|
-
$fontSize={
|
|
92
|
-
$padding={
|
|
97
|
+
$fontSize={$fontSize}
|
|
98
|
+
$padding={$padding}
|
|
99
|
+
$space={$space}
|
|
93
100
|
$scheme={rootTheme.scheme}
|
|
94
|
-
$space={useArrayProp(0)}
|
|
95
101
|
$tone={rootTheme.tone}
|
|
96
102
|
$weight={weight}
|
|
97
103
|
disabled={disabled}
|
|
98
104
|
ref={ref}
|
|
99
105
|
/>
|
|
100
106
|
<Presentation
|
|
101
|
-
$radius={
|
|
107
|
+
$radius={$radius}
|
|
102
108
|
$scheme={rootTheme.scheme}
|
|
103
109
|
$tone={rootTheme.tone}
|
|
104
110
|
data-border={border ? '' : undefined}
|
|
@@ -4,7 +4,8 @@ import {forwardRef, isValidElement, useCallback, useImperativeHandle, useMemo, u
|
|
|
4
4
|
import {isValidElementType} from 'react-is'
|
|
5
5
|
import {styled} from 'styled-components'
|
|
6
6
|
import {EMPTY_RECORD} from '../../constants'
|
|
7
|
-
import {
|
|
7
|
+
import {useCustomValidity} from '../../hooks'
|
|
8
|
+
import {_getArrayProp} from '../../styles'
|
|
8
9
|
import {
|
|
9
10
|
responsiveRadiusStyle,
|
|
10
11
|
ResponsiveRadiusStyleProps,
|
|
@@ -177,10 +178,10 @@ export const TextInput = forwardRef(function TextInput(
|
|
|
177
178
|
|
|
178
179
|
const rootTheme = useRootTheme()
|
|
179
180
|
|
|
180
|
-
const fontSize =
|
|
181
|
-
const padding =
|
|
182
|
-
const radius =
|
|
183
|
-
const space =
|
|
181
|
+
const fontSize = useMemo(() => _getArrayProp(fontSizeProp), [fontSizeProp])
|
|
182
|
+
const padding = useMemo(() => _getArrayProp(paddingProp), [paddingProp])
|
|
183
|
+
const radius = useMemo(() => _getArrayProp(radiusProp), [radiusProp])
|
|
184
|
+
const space = useMemo(() => _getArrayProp(spaceProp), [spaceProp])
|
|
184
185
|
|
|
185
186
|
// Transient properties
|
|
186
187
|
const $hasClearButton = Boolean(clearButton)
|
|
@@ -24,9 +24,10 @@ import {
|
|
|
24
24
|
useImperativeHandle,
|
|
25
25
|
} from 'react'
|
|
26
26
|
import {styled} from 'styled-components'
|
|
27
|
-
import {
|
|
27
|
+
import {usePrefersReducedMotion} from '../../hooks'
|
|
28
28
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
29
29
|
import {origin} from '../../middleware/origin'
|
|
30
|
+
import {_getArrayProp} from '../../styles'
|
|
30
31
|
import {useTheme_v2} from '../../theme'
|
|
31
32
|
import type {Placement} from '../../types'
|
|
32
33
|
import {
|
|
@@ -122,7 +123,10 @@ export const Tooltip = forwardRef(function Tooltip(
|
|
|
122
123
|
} = props
|
|
123
124
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
124
125
|
const animate = prefersReducedMotion ? false : _animate
|
|
125
|
-
const fallbackPlacements =
|
|
126
|
+
const fallbackPlacements = useMemo(
|
|
127
|
+
() => _getArrayProp(fallbackPlacementsProp),
|
|
128
|
+
[fallbackPlacementsProp],
|
|
129
|
+
)
|
|
126
130
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
127
131
|
const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)
|
|
128
132
|
const arrowRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -24,13 +24,11 @@ export interface ThemeProviderProps {
|
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
26
|
export function ThemeProvider(props: ThemeProviderProps): React.ReactElement {
|
|
27
|
+
const {children} = props
|
|
27
28
|
const parentTheme = useContext(ThemeContext)
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
theme: rootTheme = parentTheme?.theme || null,
|
|
32
|
-
tone = parentTheme?.tone || 'default',
|
|
33
|
-
} = props
|
|
29
|
+
const scheme = props.scheme ?? (parentTheme?.scheme || 'light')
|
|
30
|
+
const rootTheme = parentTheme?.theme || null
|
|
31
|
+
const tone = parentTheme?.tone || 'default'
|
|
34
32
|
|
|
35
33
|
const themeContext: ThemeContextValue | null = useMemo(() => {
|
|
36
34
|
if (!rootTheme) return null
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {useCallback, useContext, useEffect, useMemo, useState} from 'react'
|
|
2
|
-
import {useMediaIndex
|
|
2
|
+
import {useMediaIndex} from '../../hooks'
|
|
3
|
+
import {_getArrayProp} from '../../styles'
|
|
3
4
|
import {getLayerContext} from './getLayerContext'
|
|
4
5
|
import {LayerContext} from './layerContext'
|
|
5
6
|
import {LayerContextValue} from './types'
|
|
@@ -28,7 +29,7 @@ export function LayerProvider(props: LayerProviderProps): React.ReactElement {
|
|
|
28
29
|
const level = parentLevel + 1
|
|
29
30
|
|
|
30
31
|
// Get z-index offset
|
|
31
|
-
const zOffset =
|
|
32
|
+
const zOffset = useMemo(() => _getArrayProp(zOffsetProp), [zOffsetProp])
|
|
32
33
|
|
|
33
34
|
// Get responsive z-index value
|
|
34
35
|
const maxMediaIndex = zOffset.length - 1
|