@sanity/ui 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.d.mts +18 -19
  2. package/dist/index.d.ts +18 -19
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +5 -5
  7. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
  8. package/src/core/components/autocomplete/autocomplete.tsx +3 -4
  9. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  10. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  11. package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
  12. package/src/core/components/menu/menuButton.tsx +2 -2
  13. package/src/core/components/menu/menuGroup.tsx +1 -1
  14. package/src/core/components/tab/tabList.tsx +2 -2
  15. package/src/core/components/toast/toast.tsx +1 -1
  16. package/src/core/components/toast/toastProvider.tsx +1 -1
  17. package/src/core/components/tree/tree.tsx +1 -1
  18. package/src/core/components/tree/treeGroup.tsx +1 -1
  19. package/src/core/components/tree/treeItem.tsx +1 -1
  20. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  21. package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
  22. package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
  23. package/src/core/primitives/popover/popover.tsx +3 -3
  24. package/src/core/primitives/tooltip/tooltip.tsx +1 -1
  25. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
  26. package/src/core/theme/__workshop__/build/story.tsx +1 -2
  27. package/src/core/theme/themeColorProvider.tsx +1 -1
  28. package/src/core/theme/themeProvider.tsx +1 -1
  29. package/src/core/utils/arrow/arrow.tsx +2 -2
  30. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +1 -3
  31. package/src/core/utils/layer/layerProvider.tsx +1 -1
  32. package/src/core/utils/portal/portalProvider.tsx +1 -1
  33. package/src/core/utils/virtualList/virtualList.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -109,7 +109,7 @@
109
109
  "@sanity/color": "^3.0.6",
110
110
  "@sanity/icons": "^3.5.7",
111
111
  "csstype": "^3.1.3",
112
- "framer-motion": "^11.15.0",
112
+ "framer-motion": "^11.16.0",
113
113
  "react-compiler-runtime": "19.0.0-beta-55955c9-20241229",
114
114
  "react-refractor": "^2.2.0",
115
115
  "use-effect-event": "^1.0.2"
@@ -122,10 +122,10 @@
122
122
  "@commitlint/cli": "^19.6.1",
123
123
  "@commitlint/config-conventional": "^19.6.0",
124
124
  "@juggle/resize-observer": "^3.4.0",
125
- "@sanity/pkg-utils": "^6.13.0",
125
+ "@sanity/pkg-utils": "^6.13.1",
126
126
  "@sanity/prettier-config": "^1.0.3",
127
127
  "@sanity/semantic-release-preset": "^5.0.0",
128
- "@sanity/ui-workshop": "^2.0.20",
128
+ "@sanity/ui-workshop": "^2.0.21",
129
129
  "@storybook/addon-a11y": "^8.4.7",
130
130
  "@storybook/addon-docs": "^8.4.7",
131
131
  "@storybook/addon-essentials": "^8.4.7",
@@ -147,7 +147,7 @@
147
147
  "@types/jest": "^29.5.14",
148
148
  "@types/jest-axe": "^3.5.9",
149
149
  "@types/node": "^20.12.7",
150
- "@types/react": "^19.0.2",
150
+ "@types/react": "^19.0.3",
151
151
  "@types/react-dom": "^19.0.2",
152
152
  "@types/react-is": "^19.0.0",
153
153
  "@types/refractor": "^3.4.1",
@@ -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.ReactElement<any> | null
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) => ReactElement<any>
75
+ renderOption?: (option: Option) => React.JSX.Element
77
76
  /** @beta */
78
77
  renderPopover?: (
79
78
  props: {
80
- content: ReactElement<any> | null
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
- ) => ReactElement<any>
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any>
28
+ button: React.JSX.Element
29
29
  id: string
30
- menu?: React.ReactElement<any>
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.ReactElement<any> {
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.ReactElement<any> | null | undefined | false>
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.ReactElement<any>[] = Children.toArray(childrenProp).filter(isValidElement)
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any>[] = Children.toArray(childrenProp).filter(isValidElement)
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.ReactElement<any> {
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 {ReactElement, useRef, useState} from 'react'
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(): ReactElement<any> {
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.ReactElement<any>
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.ReactElement<any> {
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.ReactElement<any>) {
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.ReactElement<any>
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.ReactElement<any> {
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(): ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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, ReactElement, forwardRef} from 'react'
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
- ): ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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.ReactElement<any> {
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)