@sanity/ui 2.9.1 → 2.10.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.
Files changed (112) hide show
  1. package/dist/index.d.mts +29 -33
  2. package/dist/index.d.ts +29 -33
  3. package/dist/index.esm.js +44 -26
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +44 -26
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +44 -26
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/theme.d.mts +1 -1
  10. package/dist/theme.d.ts +1 -1
  11. package/dist/theme.esm.js.map +1 -1
  12. package/dist/theme.js.map +1 -1
  13. package/dist/theme.mjs.map +1 -1
  14. package/package.json +31 -25
  15. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
  16. package/src/core/components/autocomplete/autocomplete.tsx +4 -3
  17. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  18. package/src/core/components/dialog/dialog.tsx +1 -1
  19. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  20. package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
  21. package/src/core/components/menu/menu.test.tsx +0 -2
  22. package/src/core/components/menu/menuButton.tsx +2 -2
  23. package/src/core/components/menu/menuGroup.tsx +2 -2
  24. package/src/core/components/menu/menuItem.tsx +1 -0
  25. package/src/core/components/tab/tabList.tsx +2 -2
  26. package/src/core/components/toast/toast.test.tsx +0 -1
  27. package/src/core/components/toast/toast.tsx +1 -1
  28. package/src/core/components/toast/toastProvider.tsx +3 -2
  29. package/src/core/components/tree/tree.tsx +1 -1
  30. package/src/core/components/tree/treeGroup.tsx +1 -1
  31. package/src/core/components/tree/treeItem.tsx +1 -1
  32. package/src/core/hooks/useDelayedState.ts +1 -1
  33. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -1
  34. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -1
  35. package/src/core/lib/globalScope.ts +0 -1
  36. package/src/core/primitives/avatar/avatar.tsx +1 -1
  37. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  38. package/src/core/primitives/badge/badge.tsx +1 -1
  39. package/src/core/primitives/box/box.tsx +1 -1
  40. package/src/core/primitives/button/button.tsx +1 -1
  41. package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
  42. package/src/core/primitives/code/code.tsx +1 -2
  43. package/src/core/primitives/heading/heading.tsx +1 -1
  44. package/src/core/primitives/inline/inline.tsx +0 -1
  45. package/src/core/primitives/kbd/kbd.tsx +1 -1
  46. package/src/core/primitives/label/label.tsx +1 -1
  47. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -1
  48. package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
  49. package/src/core/primitives/popover/popover.tsx +4 -5
  50. package/src/core/primitives/stack/stack.tsx +1 -1
  51. package/src/core/primitives/text/text.tsx +1 -1
  52. package/src/core/primitives/tooltip/tooltip.tsx +1 -2
  53. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
  54. package/src/core/theme/__workshop__/build/story.tsx +1 -3
  55. package/src/core/theme/__workshop__/debug/story.tsx +0 -2
  56. package/src/core/theme/theme.test.tsx +0 -1
  57. package/src/core/theme/themeColorProvider.tsx +1 -1
  58. package/src/core/theme/themeProvider.tsx +1 -1
  59. package/src/core/utils/arrow/arrow.tsx +1 -1
  60. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -1
  61. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +3 -1
  62. package/src/core/utils/elementQuery/elementQuery.tsx +1 -1
  63. package/src/core/utils/layer/layer.test.tsx +0 -1
  64. package/src/core/utils/layer/layer.tsx +9 -1
  65. package/src/core/utils/layer/layerProvider.tsx +1 -1
  66. package/src/core/utils/portal/portal.test.tsx +0 -1
  67. package/src/core/utils/portal/portalProvider.tsx +1 -1
  68. package/src/core/utils/srOnly/srOnly.tsx +1 -1
  69. package/src/core/utils/virtualList/virtualList.tsx +10 -3
  70. package/src/theme/build/merge.ts +0 -2
  71. package/src/theme/system/css.ts +1 -2
  72. package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
  73. package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
  74. package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
  75. package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
  76. package/src/core/components/menu/__workshop__/.eslintrc +0 -5
  77. package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
  78. package/src/core/components/tab/__workshop__/.eslintrc +0 -5
  79. package/src/core/components/toast/__workshop__/.eslintrc +0 -5
  80. package/src/core/components/tree/__workshop__/.eslintrc +0 -5
  81. package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
  82. package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
  83. package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
  84. package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
  85. package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
  86. package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
  87. package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
  88. package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
  89. package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
  90. package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
  91. package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
  92. package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
  93. package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
  94. package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
  95. package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
  96. package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
  97. package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
  98. package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
  99. package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
  100. package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
  101. package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
  102. package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
  103. package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
  104. package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
  105. package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
  106. package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
  107. package/src/core/theme/__workshop__/.eslintrc +0 -5
  108. package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
  109. package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
  110. package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
  111. package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
  112. package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
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.4.0",
111
111
  "csstype": "^3.1.3",
112
- "framer-motion": "11.0.8",
112
+ "framer-motion": "^11.13.1",
113
113
  "react-compiler-runtime": "19.0.0-beta-df7b47d-20241124",
114
114
  "react-refractor": "^2.2.0",
115
115
  "use-effect-event": "^1.0.2"
@@ -122,24 +122,24 @@
122
122
  "@commitlint/cli": "^19.4.0",
123
123
  "@commitlint/config-conventional": "^19.2.2",
124
124
  "@juggle/resize-observer": "^3.4.0",
125
- "@sanity/pkg-utils": "^6.11.11",
125
+ "@sanity/pkg-utils": "^6.11.14",
126
126
  "@sanity/prettier-config": "^1.0.3",
127
127
  "@sanity/semantic-release-preset": "^5.0.0",
128
128
  "@sanity/ui-workshop": "^2.0.16",
129
- "@storybook/addon-a11y": "^8.4.5",
130
- "@storybook/addon-docs": "^8.4.5",
131
- "@storybook/addon-essentials": "^8.4.5",
132
- "@storybook/addon-interactions": "^8.4.5",
133
- "@storybook/addon-links": "^8.4.5",
134
- "@storybook/addon-mdx-gfm": "^8.4.5",
135
- "@storybook/addon-storysource": "^8.4.5",
136
- "@storybook/addon-themes": "^8.4.5",
137
- "@storybook/blocks": "^8.4.5",
138
- "@storybook/manager-api": "^8.4.5",
139
- "@storybook/react": "^8.4.5",
140
- "@storybook/react-vite": "^8.4.5",
141
- "@storybook/test": "^8.4.5",
142
- "@storybook/theming": "^8.4.5",
129
+ "@storybook/addon-a11y": "^8.4.7",
130
+ "@storybook/addon-docs": "^8.4.7",
131
+ "@storybook/addon-essentials": "^8.4.7",
132
+ "@storybook/addon-interactions": "^8.4.7",
133
+ "@storybook/addon-links": "^8.4.7",
134
+ "@storybook/addon-mdx-gfm": "^8.4.7",
135
+ "@storybook/addon-storysource": "^8.4.7",
136
+ "@storybook/addon-themes": "^8.4.7",
137
+ "@storybook/blocks": "^8.4.7",
138
+ "@storybook/manager-api": "^8.4.7",
139
+ "@storybook/react": "^8.4.7",
140
+ "@storybook/react-vite": "^8.4.7",
141
+ "@storybook/test": "^8.4.7",
142
+ "@storybook/theming": "^8.4.7",
143
143
  "@testing-library/dom": "^10.4.0",
144
144
  "@testing-library/jest-dom": "^6.6.2",
145
145
  "@testing-library/react": "^16.0.1",
@@ -147,9 +147,9 @@
147
147
  "@types/jest": "^29.5.12",
148
148
  "@types/jest-axe": "^3.5.9",
149
149
  "@types/node": "^20.12.7",
150
- "@types/react": "^18.3.12",
151
- "@types/react-dom": "^18.3.1",
152
- "@types/react-is": "^18.3.0",
150
+ "@types/react": "^19.0.1",
151
+ "@types/react-dom": "^19.0.1",
152
+ "@types/react-is": "^19.0.0",
153
153
  "@types/refractor": "^3.4.1",
154
154
  "@typescript-eslint/eslint-plugin": "^7.18.0",
155
155
  "@typescript-eslint/parser": "^7.18.0",
@@ -178,14 +178,14 @@
178
178
  "module-alias": "^2.2.3",
179
179
  "npm-run-all2": "^5.0.2",
180
180
  "prettier": "^3.3.3",
181
- "react": "^18.3.1",
182
- "react-dom": "^18.3.1",
183
- "react-is": "^18.3.1",
181
+ "react": "^19.0.0",
182
+ "react-dom": "^19.0.0",
183
+ "react-is": "^19.0.0",
184
184
  "refractor": "^4.8.1",
185
185
  "rimraf": "^5.0.5",
186
186
  "semantic-release": "^24.0.0",
187
187
  "start-server-and-test": "^2.0.5",
188
- "storybook": "^8.4.5",
188
+ "storybook": "^8.4.7",
189
189
  "styled-components": "^6.1.13",
190
190
  "tsconfig-paths": "^4.2.0",
191
191
  "typescript": "5.6.3",
@@ -207,7 +207,13 @@
207
207
  },
208
208
  "pnpm": {
209
209
  "overrides": {
210
- "conventional-changelog-conventionalcommits": ">= 8.0.0"
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"
211
217
  }
212
218
  },
213
219
  "esm.sh": {
@@ -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 | null
84
+ content: React.ReactElement<any> | null
85
85
  hidden: boolean
86
86
  inputElement: HTMLInputElement | null
87
87
  onMouseEnter: () => void
@@ -73,11 +73,11 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
73
73
  /** @beta */
74
74
  relatedElements?: HTMLElement[]
75
75
  /** The callback function for rendering each option. */
76
- renderOption?: (option: Option) => ReactElement
76
+ renderOption?: (option: Option) => ReactElement<any>
77
77
  /** @beta */
78
78
  renderPopover?: (
79
79
  props: {
80
- content: ReactElement | null
80
+ content: ReactElement<any> | null
81
81
  hidden: boolean
82
82
  inputElement: HTMLInputElement | null
83
83
  onMouseEnter: () => void
@@ -663,6 +663,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
663
663
  radius={radius}
664
664
  ref={resultsPopoverElementRef}
665
665
  referenceElement={inputElementRef.current}
666
+ // @ts-expect-error fix later
666
667
  {...popover}
667
668
  />
668
669
  )
@@ -724,4 +725,4 @@ export const Autocomplete = InnerAutocomplete as <Option extends BaseAutocomplet
724
725
  > & {
725
726
  ref?: Ref<HTMLInputElement>
726
727
  },
727
- ) => ReactElement
728
+ ) => ReactElement<any>
@@ -9,7 +9,7 @@ export interface AutocompleteOptionProps {
9
9
  value: string
10
10
  }
11
11
 
12
- export function AutocompleteOption(props: AutocompleteOptionProps): React.ReactElement {
12
+ export function AutocompleteOption(props: AutocompleteOptionProps): React.ReactElement<any> {
13
13
  const {children, id, onSelect, selected, value} = props
14
14
 
15
15
  const handleClick = useCallback(() => {
@@ -357,7 +357,7 @@ export const Dialog = forwardRef(function Dialog(
357
357
 
358
358
  const labelId = `${id}_label`
359
359
 
360
- const rootClickTimeoutRef = useRef<NodeJS.Timeout>()
360
+ const rootClickTimeoutRef = useRef<NodeJS.Timeout>(undefined)
361
361
 
362
362
  // If the resulting active element (a.k.a. focused element) is not withing scope when clicking
363
363
  // within the dialog, then we want to focus the previously interactive element in the dialog instead.
@@ -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 {
19
+ export function DialogProvider(props: DialogProviderProps): React.ReactElement<any> {
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 {
7
+ ): React.ReactElement<any> {
8
8
  const {children, req, ...restProps} = props
9
9
 
10
10
  return (
@@ -79,7 +79,6 @@ describe('components/menu', () => {
79
79
  }
80
80
 
81
81
  function Root() {
82
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
82
  const value: any = undefined
84
83
 
85
84
  return (
@@ -109,7 +108,6 @@ describe('components/menu', () => {
109
108
 
110
109
  function Root() {
111
110
  // NOTE: we’re testing this because the context value may be a function in the future
112
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
111
  const value: any = () => {
114
112
  return {version: 1}
115
113
  }
@@ -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
28
+ button: React.ReactElement<any>
29
29
  id: string
30
- menu?: React.ReactElement
30
+ menu?: React.ReactElement<any>
31
31
  onClose?: () => void
32
32
  onOpen?: () => void
33
33
  /**
@@ -1,5 +1,5 @@
1
1
  import {ChevronRightIcon} from '@sanity/icons'
2
- import {isValidElement, useCallback, useEffect, useState} from 'react'
2
+ import {isValidElement, useCallback, useEffect, useState, type JSX} 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'
@@ -30,7 +30,7 @@ export interface MenuGroupProps {
30
30
  export function MenuGroup(
31
31
  props: Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'popover' | 'ref' | 'tabIndex'> &
32
32
  MenuGroupProps,
33
- ): React.ReactElement {
33
+ ): React.ReactElement<any> {
34
34
  const {
35
35
  as = 'button',
36
36
  children,
@@ -7,6 +7,7 @@ import {
7
7
  useMemo,
8
8
  useRef,
9
9
  useState,
10
+ type JSX,
10
11
  } from 'react'
11
12
  import {isValidElementType} from 'react-is'
12
13
  import {useArrayProp} from '../../hooks'
@@ -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 | null | undefined | false>
9
+ children: Array<React.ReactElement<any> | 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[] = Children.toArray(childrenProp).filter(isValidElement)
32
+ const children: React.ReactElement<any>[] = Children.toArray(childrenProp).filter(isValidElement)
33
33
 
34
34
  const tabs = children.map((child, childIndex) =>
35
35
  cloneElement(child, {
@@ -1,5 +1,4 @@
1
1
  /** @jest-environment jsdom */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
 
4
3
  import {render} from '../../../../test'
5
4
  import {ToastContext} from './toastContext'
@@ -53,7 +53,7 @@ const Root = styled(Card)<{$duration?: number; tone: ThemeColorStateToneKey} & T
53
53
  */
54
54
  export function Toast(
55
55
  props: ToastProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'title'>,
56
- ): React.ReactElement {
56
+ ): React.ReactElement<any> {
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 {
52
+ export function ToastProvider(props: ToastProviderProps): React.ReactElement<any> {
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}}>({})
@@ -70,11 +70,12 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement {
70
70
  y: 0,
71
71
  scale: 1,
72
72
  },
73
+ // @ts-expect-error fix later
73
74
  exit: {
74
75
  opacity: [1, 1, 0],
75
76
  [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
76
77
  scale: 0.5,
77
- transition: prefersReducedMotion ? {duration: 0} : {duration: 0.2},
78
+ transition: {duration: prefersReducedMotion ? 0 : 0.2},
78
79
  },
79
80
  }),
80
81
  [prefersReducedMotion],
@@ -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 {
33
+ ): React.ReactElement<any> {
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 {
12
+ ): React.ReactElement<any> {
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 {
49
+ ): React.ReactElement<any> {
50
50
  const {
51
51
  children,
52
52
  expanded: expandedProp = false,
@@ -8,7 +8,7 @@ export function useDelayedState<S>(
8
8
  initialState: S | (() => S),
9
9
  ): [S, (nextState: SetStateAction<S>, delay?: number) => void] {
10
10
  const [state, setState] = useState(initialState)
11
- const delayedAction = useRef<NodeJS.Timeout | undefined>()
11
+ const delayedAction = useRef<NodeJS.Timeout | undefined>(undefined)
12
12
 
13
13
  const onStateChange = useCallback((nextState: SetStateAction<S>, delay?: number) => {
14
14
  const action = () => {
@@ -1,5 +1,4 @@
1
1
  /** @jest-environment jsdom */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  /**
4
3
  * As this hook is used for top-level theming it's likely to be called while server-rendering
5
4
  * and that's why it's worth it to have a testing suite for hydration
@@ -1,5 +1,4 @@
1
1
  /** @jest-environment jsdom */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  /**
4
3
  * As this hook is used for top-level theming it's likely to be called while server-rendering
5
4
  * and that's why it's worth it to have a testing suite for hydration
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  /**
3
2
  * Gets the global scope instance in a given environment.
4
3
  *
@@ -1,5 +1,5 @@
1
1
  import {ThemeColorAvatarColorKey} from '@sanity/ui/theme'
2
- import {forwardRef, useCallback, useEffect, useId, useMemo, useState} from 'react'
2
+ import {forwardRef, useCallback, useEffect, useId, useMemo, useState, type JSX} from 'react'
3
3
  import ReactIs from 'react-is'
4
4
  import {styled} from 'styled-components'
5
5
  import {useArrayProp} from '../../hooks'
@@ -65,7 +65,7 @@ export const AvatarStack = forwardRef(function AvatarStack(
65
65
  size: sizeProp = 1,
66
66
  ...restProps
67
67
  } = props
68
- const children: React.ReactElement[] = Children.toArray(childrenProp).filter(isValidElement)
68
+ const children: React.ReactElement<any>[] = Children.toArray(childrenProp).filter(isValidElement)
69
69
  const maxLength = Math.max(maxLengthProp, 0)
70
70
  const size = useArrayProp(sizeProp)
71
71
 
@@ -1,4 +1,4 @@
1
- import {forwardRef} from 'react'
1
+ import {forwardRef, type JSX} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
@@ -1,4 +1,4 @@
1
- import {forwardRef} from 'react'
1
+ import {forwardRef, type JSX} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {
@@ -1,4 +1,4 @@
1
- import {forwardRef, isValidElement, useMemo} from 'react'
1
+ import {forwardRef, isValidElement, useMemo, type JSX} from 'react'
2
2
  import {isValidElementType} from 'react-is'
3
3
  import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
@@ -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 {
7
+ ): React.ReactElement<any> {
8
8
  const {children, req, ...restProps} = props
9
9
 
10
10
  return (
@@ -1,5 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import {forwardRef} from 'react'
1
+ import {forwardRef, type JSX} from 'react'
3
2
  import Refractor from 'react-refractor'
4
3
  import {styled} from 'styled-components'
5
4
  import {useArrayProp} from '../../hooks'
@@ -1,5 +1,5 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
- import {forwardRef} from 'react'
2
+ import {forwardRef, type JSX} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {
@@ -37,7 +37,6 @@ export const Inline = forwardRef(function Inline(
37
37
  {...restProps}
38
38
  $space={useArrayProp(space)}
39
39
  forwardedAs={as}
40
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
40
  ref={ref as any}
42
41
  >
43
42
  {children}
@@ -1,4 +1,4 @@
1
- import {forwardRef} from 'react'
1
+ import {forwardRef, type JSX} from 'react'
2
2
  import {styled, css} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
@@ -1,5 +1,5 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
- import {forwardRef} from 'react'
2
+ import {forwardRef, type JSX} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
@@ -18,7 +18,7 @@ const SIDE_PANEL_WIDTH = {
18
18
  export default function SidePanelStory() {
19
19
  const sidePanelWidth = useSelect('Side panel width', SIDE_PANEL_WIDTH, SIDE_PANEL_WIDTH.md)
20
20
  const [sidePanel, setSidePanel] = useState<HTMLDivElement | null>(null)
21
- const updateRef = useRef<PopoverUpdateCallback>()
21
+ const updateRef = useRef<PopoverUpdateCallback>(undefined)
22
22
 
23
23
  useEffect(() => updateRef.current?.(), [sidePanelWidth])
24
24
 
@@ -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 {
15
+ export default function TestStory(): ReactElement<any> {
16
16
  const [portalElement, setPortalElement] = useState<HTMLDivElement | null>(null)
17
17
  const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
18
18
 
@@ -30,7 +30,7 @@ export default function TestStory(): ReactElement {
30
30
 
31
31
  const text = useText('Text', 'Test')
32
32
 
33
- const updateRef = useRef<PopoverUpdateCallback>()
33
+ const updateRef = useRef<PopoverUpdateCallback>(undefined)
34
34
 
35
35
  const button = (
36
36
  <Button text="reference" selected style={{width: referenceWide ? 300 : undefined}} />
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import {
3
2
  Middleware,
4
3
  RootBoundary,
@@ -60,7 +59,7 @@ export interface PopoverProps
60
59
  arrow?: boolean
61
60
  /** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */
62
61
  boundaryElement?: HTMLElement | null
63
- children?: React.ReactElement
62
+ children?: React.ReactElement<any>
64
63
  /**
65
64
  * When `true`, prevent overflow within the current boundary:
66
65
  * - by flipping on its side axis
@@ -118,7 +117,7 @@ export const Popover = memo(
118
117
  props: PopoverProps &
119
118
  Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>,
120
119
  forwardedRef: React.ForwardedRef<HTMLDivElement>,
121
- ): React.ReactElement {
120
+ ): React.ReactElement<any> {
122
121
  const {container, layer} = useTheme_v2()
123
122
  const boundaryElementContext = useBoundaryElement()
124
123
 
@@ -199,7 +198,7 @@ export const Popover = memo(
199
198
  }, [maxWidth])
200
199
 
201
200
  // Keep track of reference element width (see `size` middleware below)
202
- const referenceWidthRef = useRef<number>()
201
+ const referenceWidthRef = useRef<number>(undefined)
203
202
 
204
203
  // Force apply width & max width to floating element
205
204
  useEffect(() => {
@@ -449,7 +448,7 @@ Popover.displayName = 'Memo(ForwardRef(Popover))'
449
448
  // https://github.com/facebook/react/pull/28348
450
449
  //
451
450
  // Access the ref using the method that doesn't yield a warning.
452
- function getElementRef(element: React.ReactElement) {
451
+ function getElementRef(element: React.ReactElement<any>) {
453
452
  // React <=18 in DEV
454
453
  let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get
455
454
  let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
@@ -1,4 +1,4 @@
1
- import {forwardRef} from 'react'
1
+ import {forwardRef, type JSX} from 'react'
2
2
  import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Box, BoxProps} from '../box'
@@ -1,5 +1,5 @@
1
1
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
2
- import {forwardRef} from 'react'
2
+ import {forwardRef, type JSX} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import {
3
2
  arrow,
4
3
  autoUpdate,
@@ -48,7 +47,7 @@ export interface TooltipProps extends Omit<LayerProps, 'as'> {
48
47
  allowedAutoPlacements?: Placement[]
49
48
  arrow?: boolean
50
49
  boundaryElement?: HTMLElement | null
51
- children?: React.ReactElement
50
+ children?: React.ReactElement<any>
52
51
  content?: React.ReactNode
53
52
  disabled?: boolean
54
53
  fallbackPlacements?: Placement[]
@@ -28,7 +28,7 @@ export interface TooltipDelayGroupProviderProps {
28
28
  */
29
29
  export function TooltipDelayGroupProvider(
30
30
  props: TooltipDelayGroupProviderProps,
31
- ): React.ReactElement {
31
+ ): React.ReactElement<any> {
32
32
  const {children, delay} = props
33
33
  const [isGroupActive, setIsGroupActive] = useDelayedState(false)
34
34
  const [openTooltipId, setOpenTooltipId] = useDelayedState<string | null>(null)
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
1
  import {
4
2
  ThemeColorButtonTone_v2,
5
3
  ThemeColorCard_v2,
@@ -23,7 +21,7 @@ import {Root} from './Root'
23
21
 
24
22
  const theme = buildTheme()
25
23
 
26
- export default function BuildStory(): ReactElement {
24
+ export default function BuildStory(): ReactElement<any> {
27
25
  return (
28
26
  <Root>
29
27
  <div
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
1
  import {CropIcon} from '@sanity/icons'
4
2
  import {
5
3
  THEME_COLOR_BUTTON_MODES,
@@ -1,5 +1,4 @@
1
1
  /** @jest-environment jsdom */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
 
4
3
  import {buildTheme} from '@sanity/ui/theme'
5
4
  import {render} from '../../../test'
@@ -14,7 +14,7 @@ export interface ThemeColorProviderProps {
14
14
  /**
15
15
  * @public
16
16
  */
17
- export function ThemeColorProvider(props: ThemeColorProviderProps): React.ReactElement {
17
+ export function ThemeColorProvider(props: ThemeColorProviderProps): React.ReactElement<any> {
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 {
26
+ export function ThemeProvider(props: ThemeProviderProps): React.ReactElement<any> {
27
27
  const parentTheme = useContext(ThemeContext)
28
28
  const {children} = props
29
29
  const scheme = props.scheme ?? (parentTheme?.scheme || 'light')
@@ -68,7 +68,7 @@ export const Arrow = forwardRef(function Arrow(
68
68
  'width' | 'height'
69
69
  >,
70
70
  ref: ForwardedRef<HTMLDivElement>,
71
- ): ReactElement {
71
+ ): ReactElement<any> {
72
72
  const {width: w, height: h, radius = 0, ...restProps} = props
73
73
  const {card} = useTheme_v2()
74
74
  const strokeWidth = card.shadow.outline
@@ -1,5 +1,4 @@
1
1
  /** @jest-environment jsdom */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
 
4
3
  import {render} from '../../../../test'
5
4
  import {BoundaryElementContext} from './boundaryElementContext'