@sanity/ui 2.11.0 → 2.11.2-canary.0
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.d.mts +18 -19
- package/dist/index.d.ts +18 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +34 -48
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +3 -4
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +1 -1
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/menuButton.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +1 -1
- package/src/core/components/tab/tabList.tsx +2 -2
- package/src/core/components/toast/toast.tsx +1 -1
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/tree.tsx +1 -1
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
- package/src/core/primitives/popover/popover.tsx +3 -3
- package/src/core/primitives/tooltip/tooltip.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
- package/src/core/theme/__workshop__/build/story.tsx +1 -2
- package/src/core/theme/themeColorProvider.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/utils/arrow/arrow.tsx +2 -2
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +1 -3
- package/src/core/utils/layer/layerProvider.tsx +1 -1
- package/src/core/utils/portal/portalProvider.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -399
- package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
- package/dist/index.esm.js +0 -7263
- package/dist/index.esm.js.map +0 -1
- package/dist/theme.esm.js +0 -3691
- package/dist/theme.esm.js.map +0 -1
- package/theme.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.11.0",
|
|
3
|
+
"version": "2.11.2-canary.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"sanity",
|
|
6
6
|
"ui",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"author": "Sanity.io <hello@sanity.io>",
|
|
22
22
|
"sideEffects": false,
|
|
23
|
+
"type": "commonjs",
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
25
26
|
"source": "./exports/index.ts",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
"./package.json": "./package.json"
|
|
37
38
|
},
|
|
38
39
|
"main": "./dist/index.js",
|
|
39
|
-
"module": "./dist/index.
|
|
40
|
+
"module": "./dist/index.mjs",
|
|
40
41
|
"types": "./dist/index.d.ts",
|
|
41
42
|
"typesVersions": {
|
|
42
43
|
"*": {
|
|
@@ -48,35 +49,8 @@
|
|
|
48
49
|
"files": [
|
|
49
50
|
"dist",
|
|
50
51
|
"exports",
|
|
51
|
-
"src"
|
|
52
|
-
"theme.js"
|
|
52
|
+
"src"
|
|
53
53
|
],
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
56
|
-
"clean": "rimraf .workshop dist",
|
|
57
|
-
"commit": "cz",
|
|
58
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
59
|
-
"cypress:open": "cypress open",
|
|
60
|
-
"cypress:run": "cypress run",
|
|
61
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
62
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
63
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
64
|
-
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
65
|
-
"pkg:build": "pkg build --strict",
|
|
66
|
-
"pkg:check": "pkg --strict",
|
|
67
|
-
"prepare": "husky install",
|
|
68
|
-
"prepack": "pnpm build",
|
|
69
|
-
"release": "semantic-release",
|
|
70
|
-
"storybook:build": "storybook build",
|
|
71
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
72
|
-
"test": "jest",
|
|
73
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
74
|
-
"ts:check": "tsc",
|
|
75
|
-
"watch": "pkg watch --strict",
|
|
76
|
-
"workshop:build": "workshop build",
|
|
77
|
-
"workshop:dev": "workshop dev",
|
|
78
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
79
|
-
},
|
|
80
54
|
"commitlint": {
|
|
81
55
|
"extends": [
|
|
82
56
|
"@commitlint/config-conventional"
|
|
@@ -109,7 +83,7 @@
|
|
|
109
83
|
"@sanity/color": "^3.0.6",
|
|
110
84
|
"@sanity/icons": "^3.5.7",
|
|
111
85
|
"csstype": "^3.1.3",
|
|
112
|
-
"framer-motion": "^11.
|
|
86
|
+
"framer-motion": "^11.16.0",
|
|
113
87
|
"react-compiler-runtime": "19.0.0-beta-55955c9-20241229",
|
|
114
88
|
"react-refractor": "^2.2.0",
|
|
115
89
|
"use-effect-event": "^1.0.2"
|
|
@@ -122,10 +96,10 @@
|
|
|
122
96
|
"@commitlint/cli": "^19.6.1",
|
|
123
97
|
"@commitlint/config-conventional": "^19.6.0",
|
|
124
98
|
"@juggle/resize-observer": "^3.4.0",
|
|
125
|
-
"@sanity/pkg-utils": "^
|
|
99
|
+
"@sanity/pkg-utils": "^7.0.1",
|
|
126
100
|
"@sanity/prettier-config": "^1.0.3",
|
|
127
101
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
128
|
-
"@sanity/ui-workshop": "^2.0.
|
|
102
|
+
"@sanity/ui-workshop": "^2.0.21",
|
|
129
103
|
"@storybook/addon-a11y": "^8.4.7",
|
|
130
104
|
"@storybook/addon-docs": "^8.4.7",
|
|
131
105
|
"@storybook/addon-essentials": "^8.4.7",
|
|
@@ -147,7 +121,7 @@
|
|
|
147
121
|
"@types/jest": "^29.5.14",
|
|
148
122
|
"@types/jest-axe": "^3.5.9",
|
|
149
123
|
"@types/node": "^20.12.7",
|
|
150
|
-
"@types/react": "^19.0.
|
|
124
|
+
"@types/react": "^19.0.4",
|
|
151
125
|
"@types/react-dom": "^19.0.2",
|
|
152
126
|
"@types/react-is": "^19.0.0",
|
|
153
127
|
"@types/refractor": "^3.4.1",
|
|
@@ -188,7 +162,7 @@
|
|
|
188
162
|
"storybook": "^8.4.7",
|
|
189
163
|
"styled-components": "^6.1.14",
|
|
190
164
|
"tsconfig-paths": "^4.2.0",
|
|
191
|
-
"typescript": "5.7.
|
|
165
|
+
"typescript": "5.7.3",
|
|
192
166
|
"vite": "^5.4.11",
|
|
193
167
|
"vite-tsconfig-paths": "^5.1.4"
|
|
194
168
|
},
|
|
@@ -198,25 +172,37 @@
|
|
|
198
172
|
"react-is": "^18 || >=19.0.0-0",
|
|
199
173
|
"styled-components": "^5.2 || ^6"
|
|
200
174
|
},
|
|
201
|
-
"packageManager": "pnpm@9.15.3",
|
|
202
175
|
"engines": {
|
|
203
176
|
"node": ">=14.0.0"
|
|
204
177
|
},
|
|
205
178
|
"publishConfig": {
|
|
206
179
|
"access": "public"
|
|
207
180
|
},
|
|
208
|
-
"pnpm": {
|
|
209
|
-
"overrides": {
|
|
210
|
-
"@types/react": "$@types/react",
|
|
211
|
-
"@types/react-dom": "$@types/react-dom",
|
|
212
|
-
"@types/react-is": "$@types/react-is",
|
|
213
|
-
"conventional-changelog-conventionalcommits": ">= 8.0.0",
|
|
214
|
-
"react": "$react",
|
|
215
|
-
"react-dom": "$react-dom",
|
|
216
|
-
"react-is": "$react-is"
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
181
|
"esm.sh": {
|
|
220
182
|
"bundle": false
|
|
183
|
+
},
|
|
184
|
+
"scripts": {
|
|
185
|
+
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
186
|
+
"clean": "rimraf .workshop dist",
|
|
187
|
+
"commit": "cz",
|
|
188
|
+
"cypress:dev": "run-p dev cypress:open",
|
|
189
|
+
"cypress:open": "cypress open",
|
|
190
|
+
"cypress:run": "cypress run",
|
|
191
|
+
"dev": "run-p storybook:dev workshop:dev",
|
|
192
|
+
"figma:pkg:build": "cd figma && pnpm build",
|
|
193
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
194
|
+
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx",
|
|
195
|
+
"pkg:build": "pkg build --strict",
|
|
196
|
+
"pkg:check": "pkg --strict",
|
|
197
|
+
"release": "semantic-release",
|
|
198
|
+
"storybook:build": "storybook build",
|
|
199
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
200
|
+
"test": "jest",
|
|
201
|
+
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
202
|
+
"ts:check": "tsc",
|
|
203
|
+
"watch": "pkg watch --strict",
|
|
204
|
+
"workshop:build": "workshop build",
|
|
205
|
+
"workshop:dev": "workshop dev",
|
|
206
|
+
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
221
207
|
}
|
|
222
|
-
}
|
|
208
|
+
}
|
|
@@ -81,7 +81,7 @@ function ConstrainedHeightExampleField({id, label}: {id: string; label: string})
|
|
|
81
81
|
const renderPopover: AutocompleteProps['renderPopover'] = useCallback(
|
|
82
82
|
(
|
|
83
83
|
popoverProps: {
|
|
84
|
-
content: React.
|
|
84
|
+
content: React.JSX.Element | null
|
|
85
85
|
hidden: boolean
|
|
86
86
|
inputElement: HTMLInputElement | null
|
|
87
87
|
onMouseEnter: () => void
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
HTMLProps,
|
|
7
7
|
KeyboardEvent,
|
|
8
8
|
MouseEvent,
|
|
9
|
-
ReactElement,
|
|
10
9
|
ReactNode,
|
|
11
10
|
Ref,
|
|
12
11
|
cloneElement,
|
|
@@ -73,11 +72,11 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
|
|
|
73
72
|
/** @beta */
|
|
74
73
|
relatedElements?: HTMLElement[]
|
|
75
74
|
/** The callback function for rendering each option. */
|
|
76
|
-
renderOption?: (option: Option) =>
|
|
75
|
+
renderOption?: (option: Option) => React.JSX.Element
|
|
77
76
|
/** @beta */
|
|
78
77
|
renderPopover?: (
|
|
79
78
|
props: {
|
|
80
|
-
content:
|
|
79
|
+
content: React.JSX.Element | null
|
|
81
80
|
hidden: boolean
|
|
82
81
|
inputElement: HTMLInputElement | null
|
|
83
82
|
onMouseEnter: () => void
|
|
@@ -726,4 +725,4 @@ export const Autocomplete = InnerAutocomplete as <Option extends BaseAutocomplet
|
|
|
726
725
|
> & {
|
|
727
726
|
ref?: Ref<HTMLInputElement>
|
|
728
727
|
},
|
|
729
|
-
) =>
|
|
728
|
+
) => React.JSX.Element
|
|
@@ -9,7 +9,7 @@ export interface AutocompleteOptionProps {
|
|
|
9
9
|
value: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export function AutocompleteOption(props: AutocompleteOptionProps): React.
|
|
12
|
+
export function AutocompleteOption(props: AutocompleteOptionProps): React.JSX.Element {
|
|
13
13
|
const {children, id, onSelect, selected, value} = props
|
|
14
14
|
|
|
15
15
|
const handleClick = useCallback(() => {
|
|
@@ -16,7 +16,7 @@ export interface DialogProviderProps {
|
|
|
16
16
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
17
17
|
* @beta
|
|
18
18
|
*/
|
|
19
|
-
export function DialogProvider(props: DialogProviderProps): React.
|
|
19
|
+
export function DialogProvider(props: DialogProviderProps): React.JSX.Element {
|
|
20
20
|
const {children, position, zOffset} = props
|
|
21
21
|
|
|
22
22
|
const contextValue: DialogContextValue = useMemo(
|
|
@@ -4,7 +4,7 @@ import {forwardRef} from 'react'
|
|
|
4
4
|
const CustomLink = forwardRef(function CustomLink(
|
|
5
5
|
props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
|
|
6
6
|
ref: React.ForwardedRef<HTMLAnchorElement>,
|
|
7
|
-
): React.
|
|
7
|
+
): React.JSX.Element {
|
|
8
8
|
const {children, req, ...restProps} = props
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -25,9 +25,9 @@ export interface MenuButtonProps {
|
|
|
25
25
|
* @deprecated Use `popover={{boundaryElement: element}}` instead.
|
|
26
26
|
*/
|
|
27
27
|
boundaryElement?: HTMLElement
|
|
28
|
-
button: React.
|
|
28
|
+
button: React.JSX.Element
|
|
29
29
|
id: string
|
|
30
|
-
menu?: React.
|
|
30
|
+
menu?: React.JSX.Element
|
|
31
31
|
onClose?: () => void
|
|
32
32
|
onOpen?: () => void
|
|
33
33
|
/**
|
|
@@ -41,7 +41,7 @@ export interface MenuGroupProps {
|
|
|
41
41
|
export function MenuGroup(
|
|
42
42
|
props: Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'popover' | 'ref' | 'tabIndex'> &
|
|
43
43
|
MenuGroupProps,
|
|
44
|
-
): React.
|
|
44
|
+
): React.JSX.Element {
|
|
45
45
|
const {
|
|
46
46
|
as = 'button',
|
|
47
47
|
children,
|
|
@@ -6,7 +6,7 @@ import {Inline, InlineProps} from '../../primitives'
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export interface TabListProps extends Omit<InlineProps, 'as' | 'height'> {
|
|
9
|
-
children: Array<React.
|
|
9
|
+
children: Array<React.JSX.Element | null | undefined | false>
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
//Limits the width of tabs in tablist
|
|
@@ -29,7 +29,7 @@ export const TabList = forwardRef(function TabList(
|
|
|
29
29
|
const {children: childrenProp, ...restProps} = props
|
|
30
30
|
const [focusedIndex, setFocusedIndex] = useState(-1)
|
|
31
31
|
|
|
32
|
-
const children: React.
|
|
32
|
+
const children: React.JSX.Element[] = Children.toArray(childrenProp).filter(isValidElement)
|
|
33
33
|
|
|
34
34
|
const tabs = children.map((child, childIndex) =>
|
|
35
35
|
cloneElement(child, {
|
|
@@ -53,7 +53,7 @@ const StyledToast = styled(Card)<{$duration?: number; tone: ThemeColorStateToneK
|
|
|
53
53
|
*/
|
|
54
54
|
export function Toast(
|
|
55
55
|
props: ToastProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'title'>,
|
|
56
|
-
): React.
|
|
56
|
+
): React.JSX.Element {
|
|
57
57
|
const {closable, description, duration, onClose, radius = 3, title, status, ...restProps} = props
|
|
58
58
|
const cardTone = status ? STATUS_CARD_TONE[status] : 'default'
|
|
59
59
|
const buttonTone = status ? BUTTON_TONE[status] : 'default'
|
|
@@ -49,7 +49,7 @@ const ToastContainer = styled.div`
|
|
|
49
49
|
/**
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
-
export function ToastProvider(props: ToastProviderProps): React.
|
|
52
|
+
export function ToastProvider(props: ToastProviderProps): React.JSX.Element {
|
|
53
53
|
const {children, padding = 4, paddingX, paddingY, zOffset} = props
|
|
54
54
|
const [state, _setState] = useState<ToastState>([])
|
|
55
55
|
const toastsRef = useRef<{[key: string]: {timeoutId: NodeJS.Timeout}}>({})
|
|
@@ -30,7 +30,7 @@ export const Tree = memo(
|
|
|
30
30
|
props: TreeProps &
|
|
31
31
|
Omit<React.HTMLProps<HTMLDivElement>, 'align' | 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
|
|
32
32
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
33
|
-
): React.
|
|
33
|
+
): React.JSX.Element {
|
|
34
34
|
const {children, space = 1, onFocus, ...restProps} = props
|
|
35
35
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
36
36
|
const [focusedElement, setFocusedElement] = useState<HTMLElement | null>(null)
|
|
@@ -9,7 +9,7 @@ export interface TreeGroupProps {
|
|
|
9
9
|
export const TreeGroup = memo(function TreeGroup(
|
|
10
10
|
props: TreeGroupProps &
|
|
11
11
|
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
|
|
12
|
-
): React.
|
|
12
|
+
): React.JSX.Element {
|
|
13
13
|
const {children, expanded = false, ...restProps} = props
|
|
14
14
|
const tree = useTree()
|
|
15
15
|
|
|
@@ -46,7 +46,7 @@ const ToggleArrowText = styled(Text)`
|
|
|
46
46
|
*/
|
|
47
47
|
export const TreeItem = memo(function TreeItem(
|
|
48
48
|
props: TreeItemProps & Omit<React.HTMLProps<HTMLLIElement>, 'as' | 'ref' | 'role'>,
|
|
49
|
-
): React.
|
|
49
|
+
): React.JSX.Element {
|
|
50
50
|
const {
|
|
51
51
|
children,
|
|
52
52
|
expanded: expandedProp = false,
|
|
@@ -68,7 +68,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
|
|
|
68
68
|
size: sizeProp = 1,
|
|
69
69
|
...restProps
|
|
70
70
|
} = props
|
|
71
|
-
const children: React.
|
|
71
|
+
const children: React.JSX.Element[] = Children.toArray(childrenProp).filter(isValidElement)
|
|
72
72
|
const maxLength = Math.max(maxLengthProp, 0)
|
|
73
73
|
const size = useArrayProp(sizeProp)
|
|
74
74
|
|
|
@@ -4,7 +4,7 @@ import {forwardRef} from 'react'
|
|
|
4
4
|
const CustomLink = forwardRef(function CustomLink(
|
|
5
5
|
props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
|
|
6
6
|
ref: React.ForwardedRef<HTMLAnchorElement>,
|
|
7
|
-
): React.
|
|
7
|
+
): React.JSX.Element {
|
|
8
8
|
const {children, req, ...restProps} = props
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
2
|
-
import {
|
|
2
|
+
import {useRef, useState} from 'react'
|
|
3
3
|
import {
|
|
4
4
|
WORKSHOP_CONTAINER_WIDTH_OPTIONS,
|
|
5
5
|
WORKSHOP_PLACEMENT_OPTIONS,
|
|
@@ -12,7 +12,7 @@ import {Text} from '../../text'
|
|
|
12
12
|
import {Popover} from '../popover'
|
|
13
13
|
import {PopoverUpdateCallback} from '../types'
|
|
14
14
|
|
|
15
|
-
export default function TestStory():
|
|
15
|
+
export default function TestStory(): React.JSX.Element {
|
|
16
16
|
const [portalElement, setPortalElement] = useState<HTMLDivElement | null>(null)
|
|
17
17
|
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
18
18
|
|
|
@@ -59,7 +59,7 @@ export interface PopoverProps
|
|
|
59
59
|
arrow?: boolean
|
|
60
60
|
/** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */
|
|
61
61
|
boundaryElement?: HTMLElement | null
|
|
62
|
-
children?: React.
|
|
62
|
+
children?: React.JSX.Element
|
|
63
63
|
/**
|
|
64
64
|
* When `true`, prevent overflow within the current boundary:
|
|
65
65
|
* - by flipping on its side axis
|
|
@@ -117,7 +117,7 @@ export const Popover = memo(
|
|
|
117
117
|
props: PopoverProps &
|
|
118
118
|
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>,
|
|
119
119
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
120
|
-
): React.
|
|
120
|
+
): React.JSX.Element {
|
|
121
121
|
const {container, layer} = useTheme_v2()
|
|
122
122
|
const boundaryElementContext = useBoundaryElement()
|
|
123
123
|
|
|
@@ -449,7 +449,7 @@ Popover.displayName = 'Memo(ForwardRef(Popover))'
|
|
|
449
449
|
// https://github.com/facebook/react/pull/28348
|
|
450
450
|
//
|
|
451
451
|
// Access the ref using the method that doesn't yield a warning.
|
|
452
|
-
function getElementRef(element: React.
|
|
452
|
+
function getElementRef(element: React.JSX.Element) {
|
|
453
453
|
// React <=18 in DEV
|
|
454
454
|
let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get
|
|
455
455
|
let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
|
|
@@ -47,7 +47,7 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
|
47
47
|
allowedAutoPlacements?: Placement[]
|
|
48
48
|
arrow?: boolean
|
|
49
49
|
boundaryElement?: HTMLElement | null
|
|
50
|
-
children?: React.
|
|
50
|
+
children?: React.JSX.Element
|
|
51
51
|
content?: React.ReactNode
|
|
52
52
|
disabled?: boolean
|
|
53
53
|
fallbackPlacements?: Placement[]
|
|
@@ -28,7 +28,7 @@ export interface TooltipDelayGroupProviderProps {
|
|
|
28
28
|
*/
|
|
29
29
|
export function TooltipDelayGroupProvider(
|
|
30
30
|
props: TooltipDelayGroupProviderProps,
|
|
31
|
-
): React.
|
|
31
|
+
): React.JSX.Element {
|
|
32
32
|
const {children, delay} = props
|
|
33
33
|
const [isGroupActive, setIsGroupActive] = useDelayedState(false)
|
|
34
34
|
const [openTooltipId, setOpenTooltipId] = useDelayedState<string | null>(null)
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
ThemeColorInputModeKey,
|
|
14
14
|
} from '@sanity/ui/theme'
|
|
15
15
|
import {buildTheme} from '@sanity/ui/theme'
|
|
16
|
-
import {ReactElement} from 'react'
|
|
17
16
|
import {rem} from '../../../styles'
|
|
18
17
|
import {useTheme_v2} from '../../useTheme'
|
|
19
18
|
import {getCSSProps} from './helpers'
|
|
@@ -21,7 +20,7 @@ import {Root} from './Root'
|
|
|
21
20
|
|
|
22
21
|
const theme = buildTheme()
|
|
23
22
|
|
|
24
|
-
export default function BuildStory():
|
|
23
|
+
export default function BuildStory(): React.JSX.Element {
|
|
25
24
|
return (
|
|
26
25
|
<Root>
|
|
27
26
|
<div
|
|
@@ -14,7 +14,7 @@ export interface ThemeColorProviderProps {
|
|
|
14
14
|
/**
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
export function ThemeColorProvider(props: ThemeColorProviderProps): React.
|
|
17
|
+
export function ThemeColorProvider(props: ThemeColorProviderProps): React.JSX.Element {
|
|
18
18
|
const {children, scheme, tone} = props
|
|
19
19
|
const root = useRootTheme()
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ export interface ThemeProviderProps {
|
|
|
23
23
|
/**
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
|
-
export function ThemeProvider(props: ThemeProviderProps): React.
|
|
26
|
+
export function ThemeProvider(props: ThemeProviderProps): React.JSX.Element {
|
|
27
27
|
const parentTheme = useContext(ThemeContext)
|
|
28
28
|
const {children} = props
|
|
29
29
|
const scheme = props.scheme ?? (parentTheme?.scheme || 'light')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ForwardedRef, HTMLProps,
|
|
1
|
+
import {ForwardedRef, HTMLProps, forwardRef} from 'react'
|
|
2
2
|
import {styled, css} from 'styled-components'
|
|
3
3
|
import {useTheme_v2} from '../../theme'
|
|
4
4
|
import {Point, compileCommands, getRoundedCommands} from './cmds'
|
|
@@ -68,7 +68,7 @@ export const Arrow = forwardRef(function Arrow(
|
|
|
68
68
|
'width' | 'height'
|
|
69
69
|
>,
|
|
70
70
|
ref: ForwardedRef<HTMLDivElement>,
|
|
71
|
-
):
|
|
71
|
+
): React.JSX.Element {
|
|
72
72
|
const {width: w, height: h, radius = 0, ...restProps} = props
|
|
73
73
|
const {card} = useTheme_v2()
|
|
74
74
|
const strokeWidth = card.shadow.outline
|
|
@@ -13,9 +13,7 @@ export interface BoundaryElementProviderProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export function BoundaryElementProvider(
|
|
17
|
-
props: BoundaryElementProviderProps,
|
|
18
|
-
): React.ReactElement<any> {
|
|
16
|
+
export function BoundaryElementProvider(props: BoundaryElementProviderProps): React.JSX.Element {
|
|
19
17
|
const {children, element} = props
|
|
20
18
|
const value: BoundaryElementContextValue = useMemo(() => ({version: 0.0, element}), [element])
|
|
21
19
|
|
|
@@ -15,7 +15,7 @@ export interface LayerProviderProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
-
export function LayerProvider(props: LayerProviderProps): React.
|
|
18
|
+
export function LayerProvider(props: LayerProviderProps): React.JSX.Element {
|
|
19
19
|
const {children, zOffset: zOffsetProp = 0} = props
|
|
20
20
|
|
|
21
21
|
// Get parent context values
|
|
@@ -21,7 +21,7 @@ export interface PortalProviderProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
export function PortalProvider(props: PortalProviderProps): React.
|
|
24
|
+
export function PortalProvider(props: PortalProviderProps): React.JSX.Element {
|
|
25
25
|
const {boundaryElement, children, element, __unstable_elements: elementsProp} = props
|
|
26
26
|
const elements = useUnique(elementsProp)
|
|
27
27
|
const fallbackElement = useSyncExternalStore(
|
|
@@ -47,7 +47,7 @@ export const VirtualList = forwardRef(function VirtualList(
|
|
|
47
47
|
StackProps &
|
|
48
48
|
Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'onChange' | 'ref'>,
|
|
49
49
|
forwardedRef: React.ForwardedRef<HTMLDivElement>,
|
|
50
|
-
): React.
|
|
50
|
+
): React.JSX.Element {
|
|
51
51
|
const {as = 'div', gap = 0, getItemKey, items = [], onChange, renderItem, ...restProps} = props
|
|
52
52
|
const {space} = useTheme_v2()
|
|
53
53
|
const ref = useRef<HTMLDivElement | null>(null)
|