@sanity/ui 0.37.12 → 0.37.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/lib/dts/src/components/autocomplete/autocomplete.d.ts +2 -2
- package/lib/dts/src/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/lib/dts/src/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
- package/lib/dts/src/components/autocomplete/constants.d.ts +0 -4
- package/lib/dts/src/components/autocomplete/constants.d.ts.map +1 -1
- package/lib/dts/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/lib/dts/src/components/dialog/dialog.d.ts.map +1 -1
- package/lib/dts/src/components/dialog/styles.d.ts +1 -1
- package/lib/dts/src/components/dialog/styles.d.ts.map +1 -1
- package/lib/dts/src/components/hotkeys/hotkeys.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuButton.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuGroup.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuItem.d.ts.map +1 -1
- package/lib/dts/src/components/skeleton/skeleton.d.ts.map +1 -1
- package/lib/dts/src/hooks/_internal/useUnique.d.ts +2 -3
- package/lib/dts/src/hooks/_internal/useUnique.d.ts.map +1 -1
- package/lib/dts/src/hooks/index.d.ts +2 -1
- package/lib/dts/src/hooks/index.d.ts.map +1 -1
- package/lib/dts/src/hooks/useArrayProp.d.ts +7 -0
- package/lib/dts/src/hooks/useArrayProp.d.ts.map +1 -0
- package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts +1 -1
- package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts.map +1 -1
- package/lib/dts/src/hooks/useElementSize.d.ts +7 -0
- package/lib/dts/src/hooks/useElementSize.d.ts.map +1 -0
- package/lib/dts/src/index.d.ts +1 -0
- package/lib/dts/src/index.d.ts.map +1 -1
- package/lib/dts/src/observers/elementSizeObserver.d.ts +37 -0
- package/lib/dts/src/observers/elementSizeObserver.d.ts.map +1 -0
- package/lib/dts/src/observers/index.d.ts +3 -0
- package/lib/dts/src/observers/index.d.ts.map +1 -0
- package/lib/dts/src/observers/resizeObserver.d.ts +5 -0
- package/lib/dts/src/observers/resizeObserver.d.ts.map +1 -0
- package/lib/dts/src/primitives/_selectable/selectable.d.ts +1 -2
- package/lib/dts/src/primitives/_selectable/selectable.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatar.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatarCounter.d.ts +1 -0
- package/lib/dts/src/primitives/avatar/avatarCounter.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatarStack.d.ts +1 -0
- package/lib/dts/src/primitives/avatar/avatarStack.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/badge/badge.d.ts.map +1 -1
- package/lib/dts/src/primitives/box/box.d.ts.map +1 -1
- package/lib/dts/src/primitives/button/button.d.ts.map +1 -1
- package/lib/dts/src/primitives/card/card.d.ts.map +1 -1
- package/lib/dts/src/primitives/code/code.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/container.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/types.d.ts +1 -1
- package/lib/dts/src/primitives/container/types.d.ts.map +1 -1
- package/lib/dts/src/primitives/flex/flex.d.ts.map +1 -1
- package/lib/dts/src/primitives/grid/grid.d.ts.map +1 -1
- package/lib/dts/src/primitives/heading/heading.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/inline.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/types.d.ts +1 -1
- package/lib/dts/src/primitives/inline/types.d.ts.map +1 -1
- package/lib/dts/src/primitives/kbd/kbd.d.ts.map +1 -1
- package/lib/dts/src/primitives/label/label.d.ts.map +1 -1
- package/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
- package/lib/dts/src/primitives/select/styles.d.ts +5 -1
- package/lib/dts/src/primitives/select/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/stack/stack.d.ts.map +1 -1
- package/lib/dts/src/primitives/stack/styles.d.ts +1 -1
- package/lib/dts/src/primitives/stack/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/text/text.d.ts.map +1 -1
- package/lib/dts/src/primitives/textArea/textArea.d.ts.map +1 -1
- package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
- package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
- package/lib/dts/src/primitives/types.d.ts +1 -1
- package/lib/dts/src/primitives/types.d.ts.map +1 -1
- package/lib/dts/src/styles/border/types.d.ts +5 -5
- package/lib/dts/src/styles/border/types.d.ts.map +1 -1
- package/lib/dts/src/styles/box/types.d.ts +4 -4
- package/lib/dts/src/styles/box/types.d.ts.map +1 -1
- package/lib/dts/src/styles/flex/flexItemStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/flex/types.d.ts +6 -6
- package/lib/dts/src/styles/flex/types.d.ts.map +1 -1
- package/lib/dts/src/styles/font/responsiveFont.d.ts +1 -1
- package/lib/dts/src/styles/font/responsiveFont.d.ts.map +1 -1
- package/lib/dts/src/styles/font/types.d.ts +3 -3
- package/lib/dts/src/styles/font/types.d.ts.map +1 -1
- package/lib/dts/src/styles/grid/types.d.ts +14 -14
- package/lib/dts/src/styles/grid/types.d.ts.map +1 -1
- package/lib/dts/src/styles/helpers.d.ts +4 -4
- package/lib/dts/src/styles/helpers.d.ts.map +1 -1
- package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts +12 -12
- package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts +4 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/margin/types.d.ts +7 -7
- package/lib/dts/src/styles/margin/types.d.ts.map +1 -1
- package/lib/dts/src/styles/padding/types.d.ts +7 -7
- package/lib/dts/src/styles/padding/types.d.ts.map +1 -1
- package/lib/dts/src/styles/radius/types.d.ts +1 -1
- package/lib/dts/src/styles/radius/types.d.ts.map +1 -1
- package/lib/dts/src/styles/shadow/shadowStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/shadow/types.d.ts +1 -1
- package/lib/dts/src/styles/shadow/types.d.ts.map +1 -1
- package/lib/dts/src/theme/lib/theme/fonts.d.ts +1 -3
- package/lib/dts/src/theme/lib/theme/fonts.d.ts.map +1 -1
- package/lib/dts/src/theme/studioTheme/fonts.d.ts.map +1 -1
- package/lib/dts/src/types/index.d.ts +2 -1
- package/lib/dts/src/types/index.d.ts.map +1 -1
- package/lib/dts/src/types/placement.d.ts +7 -0
- package/lib/dts/src/types/placement.d.ts.map +1 -0
- package/lib/dts/src/types/text.d.ts +5 -0
- package/lib/dts/src/types/text.d.ts.map +1 -0
- package/lib/dts/src/utils/elementQuery/elementQuery.d.ts.map +1 -1
- package/lib/dts/src/utils/index.d.ts +0 -1
- package/lib/dts/src/utils/index.d.ts.map +1 -1
- package/lib/dts/src/utils/virtualList/virtualList.d.ts.map +1 -1
- package/lib/sanity-ui.js +738 -627
- package/lib/sanity-ui.js.map +1 -1
- package/lib/{sanity-ui.modern.js → sanity-ui.modern.mjs} +736 -616
- package/lib/sanity-ui.modern.mjs.map +1 -0
- package/lib/sanity-ui.module.js +732 -623
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +11 -11
- package/src/__workshop__/color/overview.tsx +9 -11
- package/src/components/autocomplete/__workshop__/async.tsx +14 -12
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +36 -0
- package/src/components/autocomplete/autocomplete.styles.tsx +0 -1
- package/src/components/autocomplete/autocomplete.tsx +14 -7
- package/src/components/autocomplete/constants.ts +0 -5
- package/src/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/components/dialog/dialog.tsx +17 -9
- package/src/components/dialog/styles.ts +3 -3
- package/src/components/hotkeys/hotkeys.tsx +3 -1
- package/src/components/menu/__workshop__/constrainedInBoundary.tsx +11 -14
- package/src/components/menu/__workshop__/groups.tsx +1 -1
- package/src/components/menu/menuButton.tsx +21 -13
- package/src/components/menu/menuGroup.tsx +3 -2
- package/src/components/menu/menuItem.tsx +4 -5
- package/src/components/skeleton/skeleton.tsx +10 -1
- package/src/components/skeleton/textSkeleton.tsx +7 -7
- package/src/hooks/_internal/useUnique.ts +4 -5
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useArrayProp.ts +23 -0
- package/src/hooks/useElementRect/useElementRect.ts +4 -16
- package/src/hooks/useElementSize.ts +18 -0
- package/src/index.ts +1 -0
- package/src/observers/elementSizeObserver.ts +116 -0
- package/src/observers/index.ts +2 -0
- package/src/{utils → observers}/resizeObserver.ts +1 -4
- package/src/primitives/_selectable/selectable.tsx +5 -4
- package/src/primitives/avatar/avatar.tsx +7 -5
- package/src/primitives/avatar/avatarCounter.tsx +14 -12
- package/src/primitives/avatar/avatarStack.tsx +19 -13
- package/src/primitives/avatar/styles.ts +2 -2
- package/src/primitives/badge/badge.tsx +3 -2
- package/src/primitives/box/box.tsx +27 -26
- package/src/primitives/button/button.tsx +22 -10
- package/src/primitives/card/card.tsx +13 -11
- package/src/primitives/checkbox/__workshop__/example.tsx +4 -2
- package/src/primitives/checkbox/__workshop__/props.tsx +4 -2
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +4 -2
- package/src/primitives/code/__workshop__/props.tsx +1 -1
- package/src/primitives/code/code.tsx +2 -1
- package/src/primitives/container/container.tsx +10 -1
- package/src/primitives/container/styles.ts +2 -2
- package/src/primitives/container/types.ts +1 -1
- package/src/primitives/flex/flex.tsx +6 -5
- package/src/primitives/grid/__workshop__/responsive.tsx +13 -12
- package/src/primitives/grid/grid.tsx +9 -8
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +19 -7
- package/src/primitives/heading/heading.tsx +3 -2
- package/src/primitives/inline/inline.tsx +12 -6
- package/src/primitives/inline/styles.ts +2 -2
- package/src/primitives/inline/types.ts +1 -1
- package/src/primitives/kbd/kbd.tsx +2 -1
- package/src/primitives/label/label.tsx +4 -3
- package/src/primitives/popover/__workshop__/{margins.tsx → MarginsStory.tsx} +1 -1
- package/src/primitives/popover/__workshop__/{matchReferenceWidth.tsx → MatchReferenceWidthStory.tsx} +0 -0
- package/src/primitives/popover/__workshop__/{plain.tsx → PlainStory.tsx} +12 -14
- package/src/primitives/popover/__workshop__/{recursive.tsx → RecursiveStory.tsx} +4 -1
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +60 -0
- package/src/primitives/popover/__workshop__/TestStory.tsx +79 -0
- package/src/primitives/popover/__workshop__/index.ts +10 -5
- package/src/primitives/popover/popover.tsx +5 -3
- package/src/primitives/select/select.tsx +9 -9
- package/src/primitives/select/styles.ts +10 -4
- package/src/primitives/stack/stack.tsx +2 -1
- package/src/primitives/stack/styles.ts +3 -3
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +15 -5
- package/src/primitives/text/text.tsx +3 -2
- package/src/primitives/textArea/__workshop__/plain.tsx +23 -18
- package/src/primitives/textArea/textArea.tsx +17 -5
- package/src/primitives/textInput/__workshop__/clearButton.tsx +14 -8
- package/src/primitives/textInput/__workshop__/index.ts +2 -2
- package/src/primitives/textInput/__workshop__/plain.tsx +39 -32
- package/src/primitives/textInput/__workshop__/tones.tsx +97 -75
- package/src/primitives/textInput/__workshop__/typed.tsx +8 -2
- package/src/primitives/textInput/textInput.tsx +43 -12
- package/src/primitives/tooltip/__workshop__/props.tsx +5 -1
- package/src/primitives/tooltip/tooltip.tsx +3 -2
- package/src/primitives/types.ts +1 -1
- package/src/styles/border/borderStyle.ts +6 -6
- package/src/styles/border/types.ts +5 -5
- package/src/styles/box/boxStyle.ts +5 -5
- package/src/styles/box/types.ts +4 -4
- package/src/styles/flex/flexItemStyle.ts +5 -4
- package/src/styles/flex/flexStyle.ts +6 -6
- package/src/styles/flex/types.ts +6 -6
- package/src/styles/font/responsiveFont.ts +7 -27
- package/src/styles/font/textAlignStyle.ts +2 -2
- package/src/styles/font/types.ts +4 -3
- package/src/styles/grid/gridItemStyle.ts +7 -7
- package/src/styles/grid/gridStyle.ts +9 -9
- package/src/styles/grid/types.ts +14 -14
- package/src/styles/helpers.ts +9 -9
- package/src/styles/input/responsiveInputPaddingStyle.ts +24 -27
- package/src/styles/input/textInputStyle.ts +89 -79
- package/src/styles/margin/marginStyle.ts +8 -8
- package/src/styles/margin/marginsStyle.test.ts +1 -1
- package/src/styles/margin/types.ts +7 -7
- package/src/styles/padding/paddingStyle.test.ts +1 -1
- package/src/styles/padding/paddingStyle.ts +8 -8
- package/src/styles/padding/types.ts +7 -7
- package/src/styles/radius/radiusStyle.ts +2 -2
- package/src/styles/radius/types.ts +1 -1
- package/src/styles/shadow/shadowStyle.ts +2 -5
- package/src/styles/shadow/types.ts +1 -1
- package/src/theme/lib/theme/fonts.ts +1 -3
- package/src/theme/studioTheme/fonts.ts +5 -9
- package/src/types/index.ts +2 -2
- package/src/types/placement.ts +18 -0
- package/src/types/text.ts +4 -0
- package/src/utils/elementQuery/elementQuery.tsx +5 -18
- package/src/utils/index.ts +0 -1
- package/src/utils/layer/layer.tsx +1 -1
- package/src/utils/layer/layerProvider.tsx +2 -2
- package/src/utils/virtualList/virtualList.tsx +8 -7
- package/lib/dts/src/hooks/useResponsiveProp.d.ts +0 -6
- package/lib/dts/src/hooks/useResponsiveProp.d.ts.map +0 -1
- package/lib/dts/src/types/common.d.ts +0 -11
- package/lib/dts/src/types/common.d.ts.map +0 -1
- package/lib/dts/src/utils/resizeObserver.d.ts +0 -6
- package/lib/dts/src/utils/resizeObserver.d.ts.map +0 -1
- package/lib/sanity-ui.modern.js.map +0 -1
- package/src/hooks/useResponsiveProp.ts +0 -10
- package/src/primitives/popover/__workshop__/rightAligned.tsx +0 -57
- package/src/types/common.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.13",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "run-s build:microbundle",
|
|
22
|
-
"build:microbundle": "microbundle --format modern,esm,cjs --jsx React.createElement --jsxImportSource react --no-compress --tsconfig tsconfig.lib.json",
|
|
22
|
+
"build:microbundle": "microbundle --format modern,esm,cjs --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react --no-compress --tsconfig tsconfig.lib.json",
|
|
23
23
|
"clean": "rimraf lib",
|
|
24
24
|
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx --quiet",
|
|
25
25
|
"prebuild": "yarn clean",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
"watch:es": "tsc --preserveWatchOutput -w --module ES6 --outDir lib/esm --project tsconfig.lib.json --rootDir src --target ES6"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@juggle/resize-observer": "^3.
|
|
34
|
-
"@popperjs/core": "^2.11.
|
|
35
|
-
"@reach/auto-id": "^0.
|
|
36
|
-
"@sanity/color": "^2.1.
|
|
37
|
-
"@sanity/icons": "^1.3.
|
|
33
|
+
"@juggle/resize-observer": "^3.4.0",
|
|
34
|
+
"@popperjs/core": "^2.11.6",
|
|
35
|
+
"@reach/auto-id": "^0.17.0",
|
|
36
|
+
"@sanity/color": "^2.1.12",
|
|
37
|
+
"@sanity/icons": "^1.3.2",
|
|
38
38
|
"framer-motion": "6.3.0",
|
|
39
39
|
"popper-max-size-modifier": "^0.2.0",
|
|
40
40
|
"react-is": "^17.0.2",
|
|
41
|
-
"react-popper": "^2.
|
|
41
|
+
"react-popper": "^2.3.0",
|
|
42
42
|
"react-refractor": "^2.1.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@testing-library/dom": "^8.
|
|
46
|
-
"@testing-library/jest-dom": "^5.16.
|
|
45
|
+
"@testing-library/dom": "^8.17.1",
|
|
46
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
47
47
|
"@testing-library/react": "^12.1.5",
|
|
48
48
|
"@types/refractor": "^3.0.2",
|
|
49
49
|
"react": "^17.0.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "de7619d53b2635f9bb667564cafb7110945c1ed2"
|
|
76
76
|
}
|
|
@@ -19,7 +19,7 @@ const clipboard = {
|
|
|
19
19
|
|
|
20
20
|
export default function ColorOverviewStory(): React.ReactElement {
|
|
21
21
|
return (
|
|
22
|
-
<Grid columns={[1, 1, 2, 3]} gapX={[
|
|
22
|
+
<Grid columns={[1, 1, 2, 3]} gapX={[4, 4, 5]} gapY={[5, 5, 6]} padding={[4, 5, 6]}>
|
|
23
23
|
{COLOR_HUES.map((hueKey) => (
|
|
24
24
|
<ColorHuePreview tints={hues[hueKey]} hueKey={hueKey} key={hueKey} />
|
|
25
25
|
))}
|
|
@@ -32,7 +32,7 @@ function ColorHuePreview(props: {hueKey: string; tints: ColorTints}) {
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<Box>
|
|
35
|
-
<Heading as="h2" size={
|
|
35
|
+
<Heading as="h2" size={1}>
|
|
36
36
|
{ucfirst(hueKey)}
|
|
37
37
|
</Heading>
|
|
38
38
|
|
|
@@ -78,22 +78,20 @@ function ColorTintPreview(props: {tint: ColorValue}) {
|
|
|
78
78
|
as="button"
|
|
79
79
|
onClick={handleClick}
|
|
80
80
|
radius={2}
|
|
81
|
-
style={
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} as any
|
|
87
|
-
}
|
|
81
|
+
style={{
|
|
82
|
+
['--card-bg-color' as any]: tint.hex,
|
|
83
|
+
['--card-fg-color' as any]: hsl.l < 50 ? white.hex : black.hex,
|
|
84
|
+
cursor: 'pointer',
|
|
85
|
+
}}
|
|
88
86
|
>
|
|
89
87
|
<Flex padding={3}>
|
|
90
88
|
<Box flex={1}>
|
|
91
|
-
<Code size={
|
|
89
|
+
<Code size={1} style={{color: 'inherit'}}>
|
|
92
90
|
{tint.title}
|
|
93
91
|
</Code>
|
|
94
92
|
</Box>
|
|
95
93
|
<Box>
|
|
96
|
-
<Code size={
|
|
94
|
+
<Code size={1} style={{color: 'inherit'}}>
|
|
97
95
|
{tint.hex}
|
|
98
96
|
</Code>
|
|
99
97
|
</Box>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {EarthAmericasIcon, SearchIcon} from '@sanity/icons'
|
|
2
2
|
import {
|
|
3
3
|
Autocomplete,
|
|
4
4
|
BaseAutocompleteOption,
|
|
5
5
|
Box,
|
|
6
|
-
Button,
|
|
7
6
|
Card,
|
|
8
7
|
Code,
|
|
8
|
+
Flex,
|
|
9
9
|
LayerProvider,
|
|
10
10
|
Stack,
|
|
11
11
|
Text,
|
|
@@ -88,6 +88,7 @@ export default function AsyncStory() {
|
|
|
88
88
|
<Autocomplete
|
|
89
89
|
disabled={loadingCurrentRef}
|
|
90
90
|
filterOption={filterOption}
|
|
91
|
+
icon={value ? EarthAmericasIcon : SearchIcon}
|
|
91
92
|
id="async"
|
|
92
93
|
loading={loading}
|
|
93
94
|
onChange={setValue}
|
|
@@ -95,11 +96,6 @@ export default function AsyncStory() {
|
|
|
95
96
|
openButton={{onClick: handleOpenButtonClick}}
|
|
96
97
|
options={options}
|
|
97
98
|
placeholder="Search"
|
|
98
|
-
prefix={
|
|
99
|
-
<Box padding={1}>
|
|
100
|
-
<Button disabled={!value} icon={LinkIcon} mode="bleed" padding={2} />
|
|
101
|
-
</Box>
|
|
102
|
-
}
|
|
103
99
|
radius={1}
|
|
104
100
|
renderOption={renderOption}
|
|
105
101
|
renderValue={renderValue}
|
|
@@ -140,13 +136,19 @@ function AsyncOption(props: {
|
|
|
140
136
|
selected={selected}
|
|
141
137
|
tabIndex={tabIndex}
|
|
142
138
|
>
|
|
143
|
-
{
|
|
144
|
-
<Text
|
|
145
|
-
|
|
139
|
+
<Flex gap={3}>
|
|
140
|
+
<Text>
|
|
141
|
+
<EarthAmericasIcon />
|
|
146
142
|
</Text>
|
|
147
|
-
)}
|
|
148
143
|
|
|
149
|
-
|
|
144
|
+
{loading && (
|
|
145
|
+
<Text muted>
|
|
146
|
+
<>Loading…</>
|
|
147
|
+
</Text>
|
|
148
|
+
)}
|
|
149
|
+
|
|
150
|
+
{!loading && <Text muted={!data}>{data ? data.title : <>Untitled</>}</Text>}
|
|
151
|
+
</Flex>
|
|
150
152
|
</Card>
|
|
151
153
|
)
|
|
152
154
|
}
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
Text,
|
|
9
9
|
} from '@sanity/ui'
|
|
10
10
|
import React, {useCallback, useState} from 'react'
|
|
11
|
+
import {Popover} from '../../../primitives'
|
|
11
12
|
import countries from '../__fixtures__/countries'
|
|
13
|
+
import {AutocompleteProps} from '../autocomplete'
|
|
12
14
|
import {ExampleOption} from './types'
|
|
13
15
|
|
|
14
16
|
export default function ConstrainedHeightStory() {
|
|
@@ -71,6 +73,38 @@ function ConstrainedHeightExampleField({id, label}: {id: string; label: string})
|
|
|
71
73
|
|
|
72
74
|
const options = countries.map((item) => ({value: item.code, title: item.name}))
|
|
73
75
|
|
|
76
|
+
const renderPopover: AutocompleteProps['renderPopover'] = useCallback(
|
|
77
|
+
(
|
|
78
|
+
popoverProps: {
|
|
79
|
+
content: React.ReactElement | null
|
|
80
|
+
hidden: boolean
|
|
81
|
+
inputElement: HTMLInputElement | null
|
|
82
|
+
onMouseEnter: () => void
|
|
83
|
+
onMouseLeave: () => void
|
|
84
|
+
},
|
|
85
|
+
popoverRef: React.Ref<HTMLDivElement>
|
|
86
|
+
) => {
|
|
87
|
+
const {hidden, inputElement, ...restProps} = popoverProps
|
|
88
|
+
|
|
89
|
+
if (hidden) return null
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Popover
|
|
93
|
+
{...restProps}
|
|
94
|
+
arrow={false}
|
|
95
|
+
constrainSize
|
|
96
|
+
matchReferenceWidth
|
|
97
|
+
open
|
|
98
|
+
placement="bottom"
|
|
99
|
+
radius={1}
|
|
100
|
+
ref={popoverRef}
|
|
101
|
+
referenceElement={inputElement}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
[]
|
|
106
|
+
)
|
|
107
|
+
|
|
74
108
|
return (
|
|
75
109
|
<Stack space={3}>
|
|
76
110
|
<Text size={1} weight="medium">
|
|
@@ -84,8 +118,10 @@ function ConstrainedHeightExampleField({id, label}: {id: string; label: string})
|
|
|
84
118
|
openButton
|
|
85
119
|
options={options}
|
|
86
120
|
placeholder="Search"
|
|
121
|
+
// popover={{allowedAutoPlacements: ['bottom-start', 'top-start']}}
|
|
87
122
|
radius={1}
|
|
88
123
|
renderOption={renderOption}
|
|
124
|
+
renderPopover={renderPopover}
|
|
89
125
|
renderValue={renderValue}
|
|
90
126
|
value={value}
|
|
91
127
|
/>
|
|
@@ -9,15 +9,14 @@ import React, {
|
|
|
9
9
|
useRef,
|
|
10
10
|
useState,
|
|
11
11
|
} from 'react'
|
|
12
|
-
import {EMPTY_ARRAY} from '../../constants'
|
|
12
|
+
import {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'
|
|
13
13
|
import {_hasFocus, _raf, focusFirstDescendant} from '../../helpers'
|
|
14
|
-
import {useForwardedRef,
|
|
14
|
+
import {useForwardedRef, useArrayProp} from '../../hooks'
|
|
15
15
|
import {Box, BoxProps, Button, Card, PopoverProps, Stack, Text, TextInput} from '../../primitives'
|
|
16
16
|
import {AnimatedSpinnerIcon, ListBox, ResultsPopover, Root} from './autocomplete.styles'
|
|
17
17
|
import {AutocompleteOption} from './autocompleteOption'
|
|
18
18
|
import {autocompleteReducer} from './autocompleteReducer'
|
|
19
19
|
import {
|
|
20
|
-
EMPTY_RECORD,
|
|
21
20
|
AUTOCOMPLETE_LISTBOX_IGNORE_KEYS,
|
|
22
21
|
AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,
|
|
23
22
|
AUTOCOMPLETE_POPOVER_MARGINS,
|
|
@@ -28,7 +27,7 @@ import {AutocompleteOpenButtonProps, BaseAutocompleteOption} from './types'
|
|
|
28
27
|
/**
|
|
29
28
|
* @public
|
|
30
29
|
*/
|
|
31
|
-
export interface AutocompleteProps<Option extends BaseAutocompleteOption> {
|
|
30
|
+
export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseAutocompleteOption> {
|
|
32
31
|
border?: boolean
|
|
33
32
|
customValidity?: string
|
|
34
33
|
filterOption?: (query: string, option: Option) => boolean
|
|
@@ -49,7 +48,8 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption> {
|
|
|
49
48
|
openButton?: boolean | AutocompleteOpenButtonProps
|
|
50
49
|
options?: Option[]
|
|
51
50
|
padding?: number | number[]
|
|
52
|
-
popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'>
|
|
51
|
+
popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'> &
|
|
52
|
+
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'ref' | 'width'>
|
|
53
53
|
prefix?: React.ReactNode
|
|
54
54
|
radius?: number | number[]
|
|
55
55
|
/**
|
|
@@ -175,7 +175,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
175
175
|
const popoverMouseWithinRef = useRef(false)
|
|
176
176
|
const listBoxId = `${id}-listbox`
|
|
177
177
|
const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY
|
|
178
|
-
const padding =
|
|
178
|
+
const padding = useArrayProp(paddingProp)
|
|
179
179
|
const currentOption = useMemo(
|
|
180
180
|
() => (value !== null ? options.find((o) => o.value === value) : undefined),
|
|
181
181
|
[options, value]
|
|
@@ -560,10 +560,17 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
560
560
|
if (filteredOptions.length === 0) return null
|
|
561
561
|
|
|
562
562
|
return (
|
|
563
|
-
<ListBox
|
|
563
|
+
<ListBox
|
|
564
|
+
data-ui="AutoComplete__results"
|
|
565
|
+
onKeyDown={handleListBoxKeyDown}
|
|
566
|
+
padding={1}
|
|
567
|
+
{...listBox}
|
|
568
|
+
tabIndex={-1}
|
|
569
|
+
>
|
|
564
570
|
<Stack
|
|
565
571
|
as="ul"
|
|
566
572
|
aria-multiselectable={false}
|
|
573
|
+
data-ui="AutoComplete__resultsList"
|
|
567
574
|
id={listBoxId}
|
|
568
575
|
ref={listBoxElementRef}
|
|
569
576
|
role="listbox"
|
|
@@ -7,7 +7,7 @@ import React, {
|
|
|
7
7
|
useMemo,
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react'
|
|
10
|
-
import {useClickOutside} from '../../hooks'
|
|
10
|
+
import {useArrayProp, useClickOutside} from '../../hooks'
|
|
11
11
|
import {Box, Popover, Stack, Text} from '../../primitives'
|
|
12
12
|
import {ExpandButton, Root} from './breadcrumbs.styles'
|
|
13
13
|
|
|
@@ -27,7 +27,8 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
27
27
|
props: BreadcrumbsProps & Omit<React.HTMLProps<HTMLOListElement>, 'as' | 'ref' | 'type'>,
|
|
28
28
|
ref: React.ForwardedRef<HTMLOListElement>
|
|
29
29
|
) {
|
|
30
|
-
const {children, maxLength, separator, space = 2, ...restProps} = props
|
|
30
|
+
const {children, maxLength, separator, space: spaceRaw = 2, ...restProps} = props
|
|
31
|
+
const space = useArrayProp(spaceRaw)
|
|
31
32
|
const [open, setOpen] = useState(false)
|
|
32
33
|
const [expandElement, setExpandElement] = useState<HTMLButtonElement | null>(null)
|
|
33
34
|
const [popoverElement, setPopoverElement] = useState<HTMLDivElement | null>(null)
|
|
@@ -2,7 +2,7 @@ import {CloseIcon} from '@sanity/icons'
|
|
|
2
2
|
import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import {focusFirstDescendant, focusLastDescendant} from '../../helpers'
|
|
5
|
-
import {useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
|
|
5
|
+
import {useArrayProp, useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
|
|
6
6
|
import {Box, Button, Card, Container, Flex, Text} from '../../primitives'
|
|
7
7
|
import {ResponsivePaddingProps, ResponsiveWidthProps} from '../../primitives/types'
|
|
8
8
|
import {responsivePaddingStyle, ResponsivePaddingStyleProps} from '../../styles/internal'
|
|
@@ -138,11 +138,14 @@ const DialogCard = forwardRef(function DialogCard(
|
|
|
138
138
|
id,
|
|
139
139
|
onClickOutside,
|
|
140
140
|
onClose,
|
|
141
|
-
radius,
|
|
141
|
+
radius: radiusProp,
|
|
142
142
|
scheme,
|
|
143
|
-
shadow,
|
|
144
|
-
width,
|
|
143
|
+
shadow: shadowProp,
|
|
144
|
+
width: widthProp,
|
|
145
145
|
} = props
|
|
146
|
+
const radius = useArrayProp(radiusProp)
|
|
147
|
+
const shadow = useArrayProp(shadowProp)
|
|
148
|
+
const width = useArrayProp(widthProp)
|
|
146
149
|
const forwardedRef = useForwardedRef(ref)
|
|
147
150
|
const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)
|
|
148
151
|
const localContentRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -255,7 +258,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
255
258
|
const {
|
|
256
259
|
__unstable_autoFocus: autoFocus = true,
|
|
257
260
|
__unstable_hideCloseButton: hideCloseButton = false,
|
|
258
|
-
cardRadius = 3,
|
|
261
|
+
cardRadius: cardRadiusProp = 3,
|
|
259
262
|
cardShadow = 4,
|
|
260
263
|
children,
|
|
261
264
|
contentRef,
|
|
@@ -264,14 +267,19 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
264
267
|
id,
|
|
265
268
|
onClickOutside,
|
|
266
269
|
onClose,
|
|
267
|
-
padding = 4,
|
|
270
|
+
padding: paddingProp = 4,
|
|
268
271
|
portal,
|
|
269
|
-
position = dialog.position || 'fixed',
|
|
272
|
+
position: positionProp = dialog.position || 'fixed',
|
|
270
273
|
scheme,
|
|
271
|
-
width = 0,
|
|
272
|
-
zOffset = dialog.zOffset || theme.sanity.layer?.dialog.zOffset,
|
|
274
|
+
width: widthProp = 0,
|
|
275
|
+
zOffset: zOffsetProp = dialog.zOffset || theme.sanity.layer?.dialog.zOffset,
|
|
273
276
|
...restProps
|
|
274
277
|
} = props
|
|
278
|
+
const cardRadius = useArrayProp(cardRadiusProp)
|
|
279
|
+
const padding = useArrayProp(paddingProp)
|
|
280
|
+
const position = useArrayProp(positionProp)
|
|
281
|
+
const width = useArrayProp(widthProp)
|
|
282
|
+
const zOffset = useArrayProp(zOffsetProp)
|
|
275
283
|
const preDivRef = useRef<HTMLDivElement | null>(null)
|
|
276
284
|
const postDivRef = useRef<HTMLDivElement | null>(null)
|
|
277
285
|
const cardRef = useRef<HTMLDivElement | null>(null)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {CSSObject} from 'styled-components'
|
|
2
|
-
import {
|
|
2
|
+
import {_responsive, ThemeProps} from '../../styles'
|
|
3
3
|
import {DialogPosition} from '../../types'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export interface ResponsiveDialogPositionStyleProps {
|
|
9
|
-
$position: DialogPosition
|
|
9
|
+
$position: DialogPosition[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function dialogStyle({theme}: ThemeProps): CSSObject {
|
|
@@ -34,5 +34,5 @@ export function responsiveDialogPositionStyle(
|
|
|
34
34
|
const {theme} = props
|
|
35
35
|
const {media} = theme.sanity
|
|
36
36
|
|
|
37
|
-
return
|
|
37
|
+
return _responsive(media, props.$position, (position) => ({'&&': {position}}))
|
|
38
38
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, {forwardRef} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
|
+
import {useArrayProp} from '../../hooks'
|
|
3
4
|
import {Inline, KBD} from '../../primitives'
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -33,7 +34,8 @@ export const Hotkeys = forwardRef(function Hotkeys(
|
|
|
33
34
|
props: HotkeysProps & Omit<React.HTMLProps<HTMLElement>, 'as' | 'ref' | 'size'>,
|
|
34
35
|
ref: React.Ref<HTMLElement>
|
|
35
36
|
) {
|
|
36
|
-
const {fontSize, keys, padding, radius, space = 1, ...restProps} = props
|
|
37
|
+
const {fontSize, keys, padding, radius, space: spaceProp = 1, ...restProps} = props
|
|
38
|
+
const space = useArrayProp(spaceProp)
|
|
37
39
|
|
|
38
40
|
if (!keys || keys.length === 0) {
|
|
39
41
|
return <></>
|
|
@@ -8,11 +8,19 @@ import {
|
|
|
8
8
|
Menu,
|
|
9
9
|
MenuButton,
|
|
10
10
|
MenuItem,
|
|
11
|
-
PopoverProps,
|
|
12
11
|
SelectableTone,
|
|
13
12
|
Text,
|
|
14
13
|
} from '@sanity/ui'
|
|
15
|
-
import React, {
|
|
14
|
+
import React, {useState} from 'react'
|
|
15
|
+
import {MenuButtonProps} from '../menuButton'
|
|
16
|
+
|
|
17
|
+
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
18
|
+
constrainSize: true,
|
|
19
|
+
placement: 'bottom',
|
|
20
|
+
portal: true,
|
|
21
|
+
// preventOverflow: true,
|
|
22
|
+
// width: 1,
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
const items: {tone: SelectableTone; message: string}[] = [
|
|
18
26
|
{
|
|
@@ -88,17 +96,6 @@ const items: {tone: SelectableTone; message: string}[] = [
|
|
|
88
96
|
export default function ConstrainedInBoundaryStory() {
|
|
89
97
|
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
90
98
|
|
|
91
|
-
const popoverProps: PopoverProps = useMemo(
|
|
92
|
-
() => ({
|
|
93
|
-
constrainSize: true,
|
|
94
|
-
placement: 'bottom',
|
|
95
|
-
portal: true,
|
|
96
|
-
preventOverflow: true,
|
|
97
|
-
width: 1,
|
|
98
|
-
}),
|
|
99
|
-
[]
|
|
100
|
-
)
|
|
101
|
-
|
|
102
99
|
return (
|
|
103
100
|
<Box height="fill" padding={[4, 5, 6]} sizing="border">
|
|
104
101
|
<Card height="fill" shadow={1}>
|
|
@@ -129,7 +126,7 @@ export default function ConstrainedInBoundaryStory() {
|
|
|
129
126
|
})}
|
|
130
127
|
</Menu>
|
|
131
128
|
}
|
|
132
|
-
popover={
|
|
129
|
+
popover={POPOVER_PROPS}
|
|
133
130
|
/>
|
|
134
131
|
</BoundaryElementProvider>
|
|
135
132
|
</Box>
|
|
@@ -62,17 +62,17 @@ export const MenuButton = forwardRef(function MenuButton(
|
|
|
62
62
|
) {
|
|
63
63
|
const {
|
|
64
64
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = false,
|
|
65
|
-
boundaryElement,
|
|
65
|
+
boundaryElement: deprecated_boundaryElement,
|
|
66
66
|
button: buttonProp,
|
|
67
67
|
id,
|
|
68
68
|
menu: menuProp,
|
|
69
69
|
onClose,
|
|
70
|
-
placement,
|
|
71
|
-
popoverScheme,
|
|
72
|
-
portal,
|
|
70
|
+
placement: deprecated_placement,
|
|
71
|
+
popoverScheme: deprecated_popoverScheme,
|
|
72
|
+
portal: deprecated_portal = true,
|
|
73
73
|
popover,
|
|
74
|
-
popoverRadius,
|
|
75
|
-
preventOverflow,
|
|
74
|
+
popoverRadius: deprecated_popoverRadius,
|
|
75
|
+
preventOverflow: deprecated_preventOverflow,
|
|
76
76
|
} = props
|
|
77
77
|
const [open, setOpen] = useState(false)
|
|
78
78
|
const [shouldFocus, setShouldFocus] = useState<'first' | 'last' | null>(null)
|
|
@@ -238,15 +238,23 @@ export const MenuButton = forwardRef(function MenuButton(
|
|
|
238
238
|
|
|
239
239
|
const popoverProps: PopoverProps = useMemo(() => {
|
|
240
240
|
return {
|
|
241
|
-
boundaryElement,
|
|
242
|
-
placement,
|
|
243
|
-
portal,
|
|
244
|
-
radius:
|
|
245
|
-
|
|
246
|
-
scheme:
|
|
241
|
+
boundaryElement: deprecated_boundaryElement,
|
|
242
|
+
placement: deprecated_placement,
|
|
243
|
+
portal: deprecated_portal,
|
|
244
|
+
radius: deprecated_popoverRadius,
|
|
245
|
+
preventOverflow: deprecated_preventOverflow,
|
|
246
|
+
scheme: deprecated_popoverScheme,
|
|
247
247
|
...(popover || {}),
|
|
248
248
|
}
|
|
249
|
-
}, [
|
|
249
|
+
}, [
|
|
250
|
+
deprecated_boundaryElement,
|
|
251
|
+
deprecated_preventOverflow,
|
|
252
|
+
deprecated_placement,
|
|
253
|
+
popover,
|
|
254
|
+
deprecated_popoverRadius,
|
|
255
|
+
deprecated_portal,
|
|
256
|
+
deprecated_popoverScheme,
|
|
257
|
+
])
|
|
250
258
|
|
|
251
259
|
return (
|
|
252
260
|
<Popover {...popoverProps} content={menu} data-ui="MenuButton__popover" open={open}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {ChevronRightIcon} from '@sanity/icons'
|
|
2
2
|
import React, {createElement, isValidElement, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
|
+
import {useArrayProp} from '../../hooks'
|
|
4
5
|
import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
|
|
5
6
|
import {Selectable} from '../../primitives/_selectable'
|
|
6
7
|
import {SelectableTone} from '../../types/selectable'
|
|
@@ -36,7 +37,7 @@ export function MenuGroup(
|
|
|
36
37
|
icon,
|
|
37
38
|
onClick,
|
|
38
39
|
padding = 3,
|
|
39
|
-
popover
|
|
40
|
+
popover,
|
|
40
41
|
radius = 2,
|
|
41
42
|
space = 3,
|
|
42
43
|
text,
|
|
@@ -163,7 +164,7 @@ export function MenuGroup(
|
|
|
163
164
|
aria-pressed={as === 'button' ? withinMenu : undefined}
|
|
164
165
|
data-pressed={as !== 'button' ? withinMenu : undefined}
|
|
165
166
|
data-selected={!withinMenu && active ? '' : undefined}
|
|
166
|
-
$radius={radius}
|
|
167
|
+
$radius={useArrayProp(radius)}
|
|
167
168
|
$tone={tone}
|
|
168
169
|
onClick={handleClick}
|
|
169
170
|
onKeyDown={handleKeyDown}
|
|
@@ -8,7 +8,7 @@ import React, {
|
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react'
|
|
10
10
|
import {isValidElementType} from 'react-is'
|
|
11
|
-
import {useForwardedRef} from '../../hooks'
|
|
11
|
+
import {useArrayProp, useForwardedRef} from '../../hooks'
|
|
12
12
|
import {Box, Flex, Text} from '../../primitives'
|
|
13
13
|
import {Selectable} from '../../primitives/_selectable'
|
|
14
14
|
import {ResponsivePaddingProps, ResponsiveRadiusProps} from '../../primitives/types'
|
|
@@ -111,21 +111,20 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
111
111
|
|
|
112
112
|
return (
|
|
113
113
|
<Selectable
|
|
114
|
-
data-as={as}
|
|
115
114
|
data-ui="MenuItem"
|
|
116
|
-
forwardedAs={as}
|
|
117
115
|
{...restProps}
|
|
118
116
|
aria-pressed={as === 'button' && pressed}
|
|
119
117
|
data-pressed={as !== 'button' && pressed ? '' : undefined}
|
|
120
118
|
data-selected={active ? '' : undefined}
|
|
121
119
|
data-disabled={disabled ? '' : undefined}
|
|
122
|
-
|
|
120
|
+
forwardedAs={as}
|
|
121
|
+
$radius={useArrayProp(radius)}
|
|
122
|
+
$padding={useArrayProp(0)}
|
|
123
123
|
$tone={tone}
|
|
124
124
|
disabled={disabled}
|
|
125
125
|
onClick={handleClick}
|
|
126
126
|
onMouseEnter={onItemMouseEnter}
|
|
127
127
|
onMouseLeave={onItemMouseLeave}
|
|
128
|
-
padding={0}
|
|
129
128
|
ref={setRef}
|
|
130
129
|
role="menuitem"
|
|
131
130
|
tabIndex={-1}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, {forwardRef, useEffect, useState} from 'react'
|
|
2
2
|
import styled from 'styled-components'
|
|
3
|
+
import {useArrayProp} from '../../hooks'
|
|
3
4
|
import {Box} from '../../primitives'
|
|
4
5
|
import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
|
|
5
6
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
@@ -44,5 +45,13 @@ export const Skeleton = forwardRef(function Skeleton(
|
|
|
44
45
|
}
|
|
45
46
|
}, [delay])
|
|
46
47
|
|
|
47
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
<Root
|
|
50
|
+
{...restProps}
|
|
51
|
+
$animated={animated}
|
|
52
|
+
$radius={useArrayProp(radius)}
|
|
53
|
+
$visible={visible}
|
|
54
|
+
ref={ref}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
48
57
|
})
|