@sanity/ui 2.10.16 → 2.10.17
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 +17 -18
- package/dist/index.d.ts +17 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/menu/menuGroup.tsx +2 -2
- package/src/core/components/menu/menuItem.tsx +1 -2
- package/src/core/primitives/avatar/avatar.tsx +2 -2
- package/src/core/primitives/badge/badge.tsx +2 -2
- package/src/core/primitives/box/box.tsx +3 -3
- package/src/core/primitives/button/button.tsx +2 -2
- package/src/core/primitives/code/code.tsx +2 -2
- package/src/core/primitives/heading/heading.tsx +2 -2
- package/src/core/primitives/kbd/kbd.tsx +2 -2
- package/src/core/primitives/label/label.tsx +2 -2
- package/src/core/primitives/stack/stack.tsx +2 -2
- package/src/core/primitives/text/text.tsx +2 -2
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
- package/src/core/utils/layer/layer.tsx +3 -11
- package/src/core/utils/srOnly/srOnly.tsx +2 -2
- package/src/core/utils/virtualList/virtualList.tsx +2 -10
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ChevronRightIcon} from '@sanity/icons'
|
|
2
|
-
import {isValidElement, useCallback, useEffect, useState
|
|
2
|
+
import {isValidElement, useCallback, useEffect, useState} from 'react'
|
|
3
3
|
import {isValidElementType} from 'react-is'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
|
|
@@ -13,7 +13,7 @@ import {useMenu} from './useMenu'
|
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
15
|
export interface MenuGroupProps {
|
|
16
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
16
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
17
17
|
fontSize?: number | number[]
|
|
18
18
|
icon?: React.ElementType | React.ReactNode
|
|
19
19
|
padding?: number | number[]
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useMemo,
|
|
8
8
|
useRef,
|
|
9
9
|
useState,
|
|
10
|
-
type JSX,
|
|
11
10
|
} from 'react'
|
|
12
11
|
import {isValidElementType} from 'react-is'
|
|
13
12
|
import {useArrayProp} from '../../hooks'
|
|
@@ -23,7 +22,7 @@ import {useMenu} from './useMenu'
|
|
|
23
22
|
* @public
|
|
24
23
|
*/
|
|
25
24
|
export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
|
|
26
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
25
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
27
26
|
fontSize?: number | number[]
|
|
28
27
|
hotkeys?: string[]
|
|
29
28
|
icon?: React.ElementType | React.ReactNode
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ThemeColorAvatarColorKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef, useCallback, useEffect, useId, useMemo, useState
|
|
2
|
+
import {forwardRef, useCallback, useEffect, useId, useMemo, useState} from 'react'
|
|
3
3
|
import ReactIs from 'react-is'
|
|
4
4
|
import {styled} from 'styled-components'
|
|
5
5
|
import {useArrayProp} from '../../hooks'
|
|
@@ -16,7 +16,7 @@ export interface AvatarProps {
|
|
|
16
16
|
__unstable_hideInnerStroke?: boolean
|
|
17
17
|
animateArrowFrom?: AvatarPosition
|
|
18
18
|
arrowPosition?: AvatarPosition
|
|
19
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
19
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
20
20
|
color?: ThemeColorAvatarColorKey
|
|
21
21
|
initials?: string
|
|
22
22
|
onImageLoadError?: (event: Error) => void
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
import {useArrayProp} from '../../hooks'
|
|
4
4
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
@@ -13,7 +13,7 @@ import {BadgeStyleProps} from './types'
|
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
15
|
export interface BadgeProps extends BoxProps, ResponsiveRadiusProps {
|
|
16
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
16
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
17
17
|
fontSize?: number | number[]
|
|
18
18
|
/** @deprecated No longer used. */
|
|
19
19
|
mode?: BadgeMode
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
import {useArrayProp} from '../../hooks'
|
|
4
4
|
import {
|
|
@@ -31,8 +31,8 @@ export interface BoxProps
|
|
|
31
31
|
ResponsiveGridItemProps,
|
|
32
32
|
ResponsiveMarginProps,
|
|
33
33
|
ResponsivePaddingProps {
|
|
34
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
35
|
-
forwardedAs?: React.ElementType | keyof JSX.IntrinsicElements
|
|
34
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
35
|
+
forwardedAs?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const Root = styled.div<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef, isValidElement, useMemo
|
|
1
|
+
import {forwardRef, isValidElement, useMemo} from 'react'
|
|
2
2
|
import {isValidElementType} from 'react-is'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
@@ -17,7 +17,7 @@ import {buttonBaseStyles, buttonColorStyles} from './styles'
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
|
|
20
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
20
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
21
21
|
fontSize?: number | number[]
|
|
22
22
|
mode?: ButtonMode
|
|
23
23
|
icon?: React.ElementType | React.ReactNode
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import Refractor from 'react-refractor'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
@@ -9,7 +9,7 @@ import {codeBaseStyle} from './styles'
|
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface CodeProps {
|
|
12
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
12
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
13
13
|
/** Define the language to use for syntax highlighting. */
|
|
14
14
|
language?: string
|
|
15
15
|
size?: number | number[]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef
|
|
2
|
+
import {forwardRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {
|
|
@@ -18,7 +18,7 @@ import {HeadingStyleProps} from './types'
|
|
|
18
18
|
export interface HeadingProps {
|
|
19
19
|
accent?: boolean
|
|
20
20
|
align?: TextAlign | TextAlign[]
|
|
21
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
21
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
22
22
|
muted?: boolean
|
|
23
23
|
size?: number | number[]
|
|
24
24
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import {styled, css} from 'styled-components'
|
|
3
3
|
import {useArrayProp} from '../../hooks'
|
|
4
4
|
import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
|
|
@@ -10,7 +10,7 @@ import {Text} from '../text'
|
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export interface KBDProps {
|
|
13
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
13
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
14
14
|
fontSize?: number | number[]
|
|
15
15
|
padding?: number | number[]
|
|
16
16
|
radius?: Radius | Radius[]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef
|
|
2
|
+
import {forwardRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
|
|
@@ -12,7 +12,7 @@ import {labelBaseStyle} from './styles'
|
|
|
12
12
|
export interface LabelProps {
|
|
13
13
|
accent?: boolean
|
|
14
14
|
align?: TextAlign | TextAlign[]
|
|
15
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
15
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
16
16
|
muted?: boolean
|
|
17
17
|
size?: number | number[]
|
|
18
18
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
import {useArrayProp} from '../../hooks'
|
|
4
4
|
import {Box, BoxProps} from '../box'
|
|
@@ -8,7 +8,7 @@ import {stackBaseStyle, responsiveStackSpaceStyle, ResponsiveStackSpaceStyleProp
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export interface StackProps extends BoxProps {
|
|
11
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
11
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
12
12
|
space?: number | number[]
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ThemeFontWeightKey} from '@sanity/ui/theme'
|
|
2
|
-
import {forwardRef
|
|
2
|
+
import {forwardRef} from 'react'
|
|
3
3
|
import {styled} from 'styled-components'
|
|
4
4
|
import {useArrayProp} from '../../hooks'
|
|
5
5
|
import {
|
|
@@ -16,7 +16,7 @@ import {textBaseStyle} from './styles'
|
|
|
16
16
|
export interface TextProps {
|
|
17
17
|
accent?: boolean
|
|
18
18
|
align?: TextAlign | TextAlign[]
|
|
19
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
19
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
20
20
|
/** When `true` the text color will be muted. */
|
|
21
21
|
muted?: boolean
|
|
22
22
|
size?: number | number[]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {forwardRef, useImperativeHandle, useMemo, useState
|
|
1
|
+
import {forwardRef, useImperativeHandle, useMemo, useState} from 'react'
|
|
2
2
|
import {useElementSize} from '../../hooks'
|
|
3
3
|
import {useTheme_v2} from '../../theme'
|
|
4
4
|
import {findMaxBreakpoints, findMinBreakpoints} from './helpers'
|
|
@@ -8,7 +8,7 @@ import {findMaxBreakpoints, findMinBreakpoints} from './helpers'
|
|
|
8
8
|
* @beta
|
|
9
9
|
*/
|
|
10
10
|
export interface MediaQueryProps {
|
|
11
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
11
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
12
12
|
media?: number[]
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FocusEvent,
|
|
3
|
-
forwardRef,
|
|
4
|
-
useCallback,
|
|
5
|
-
useEffect,
|
|
6
|
-
useImperativeHandle,
|
|
7
|
-
useRef,
|
|
8
|
-
type JSX,
|
|
9
|
-
} from 'react'
|
|
1
|
+
import {FocusEvent, forwardRef, useCallback, useEffect, useImperativeHandle, useRef} from 'react'
|
|
10
2
|
import {styled} from 'styled-components'
|
|
11
3
|
import {EMPTY_RECORD} from '../../constants'
|
|
12
4
|
import {containsOrEqualsElement, isHTMLElement} from '../../helpers'
|
|
@@ -17,14 +9,14 @@ import {useLayer} from './useLayer'
|
|
|
17
9
|
* @public
|
|
18
10
|
*/
|
|
19
11
|
export interface LayerProps {
|
|
20
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
12
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
21
13
|
/** A callback that fires when the layer becomes the top layer when it was not the top layer before. */
|
|
22
14
|
onActivate?: (props: {activeElement: HTMLElement | null}) => void
|
|
23
15
|
zOffset?: number | number[]
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
interface LayerChildrenProps {
|
|
27
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
19
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
28
20
|
onActivate?: LayerProps['onActivate']
|
|
29
21
|
}
|
|
30
22
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {forwardRef
|
|
1
|
+
import {forwardRef} from 'react'
|
|
2
2
|
import {styled} from 'styled-components'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export interface SrOnlyProps {
|
|
8
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
8
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
9
9
|
children?: React.ReactNode
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useEffect,
|
|
4
|
-
useImperativeHandle,
|
|
5
|
-
useMemo,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
type JSX,
|
|
9
|
-
} from 'react'
|
|
1
|
+
import {forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'
|
|
10
2
|
import {styled} from 'styled-components'
|
|
11
3
|
import {_isScrollable} from '../../helpers'
|
|
12
4
|
import {_ResizeObserver} from '../../observers'
|
|
@@ -29,7 +21,7 @@ export interface VirtualListChangeOpts {
|
|
|
29
21
|
* @beta
|
|
30
22
|
*/
|
|
31
23
|
export interface VirtualListProps<Item = any> {
|
|
32
|
-
as?: React.ElementType | keyof JSX.IntrinsicElements
|
|
24
|
+
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
33
25
|
gap?: number
|
|
34
26
|
getItemKey?: (item: Item, itemIndex: number) => string
|
|
35
27
|
items?: Item[]
|