@sanity/ui 2.16.13 → 2.16.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.16.13",
3
+ "version": "2.16.15",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -70,7 +70,7 @@
70
70
  "dev": "run-p storybook:dev workshop:dev",
71
71
  "figma:pkg:build": "cd figma && pnpm build",
72
72
  "format": "prettier --write --cache --ignore-unknown .",
73
- "lint": "eslint .",
73
+ "lint": "eslint --cache .",
74
74
  "prepack": "pnpm build",
75
75
  "pkg:build": "pkg build --strict",
76
76
  "pkg:check": "pkg --strict",
@@ -106,7 +106,7 @@
106
106
  },
107
107
  "main",
108
108
  {
109
- "name": "static",
109
+ "name": "v4",
110
110
  "channel": "static",
111
111
  "prerelease": true
112
112
  }
@@ -119,8 +119,8 @@
119
119
  "@sanity/color": "^3.0.6",
120
120
  "@sanity/icons": "^3.7.4",
121
121
  "csstype": "^3.1.3",
122
- "framer-motion": "^12.23.12",
123
- "react-compiler-runtime": "19.1.0-rc.2",
122
+ "framer-motion": "^12.23.15",
123
+ "react-compiler-runtime": "19.1.0-rc.3",
124
124
  "react-refractor": "^2.2.0",
125
125
  "use-effect-event": "^2.0.3"
126
126
  },
@@ -132,7 +132,7 @@
132
132
  "@commitlint/cli": "^19.8.1",
133
133
  "@commitlint/config-conventional": "^19.8.1",
134
134
  "@eslint/js": "^9.34.0",
135
- "@sanity/pkg-utils": "^8.1.0",
135
+ "@sanity/pkg-utils": "^8.1.5",
136
136
  "@sanity/prettier-config": "^2.0.1",
137
137
  "@sanity/semantic-release-preset": "^5.0.0",
138
138
  "@sanity/ui-workshop": "^2.1.6",
@@ -156,12 +156,12 @@
156
156
  "@testing-library/user-event": "^14.6.1",
157
157
  "@types/jest": "^30.0.0",
158
158
  "@types/jest-axe": "^3.5.9",
159
- "@types/node": "^22.18.0",
160
- "@types/react": "^19.1.11",
161
- "@types/react-dom": "^19.1.8",
159
+ "@types/node": "^22.18.1",
160
+ "@types/react": "^19.1.13",
161
+ "@types/react-dom": "^19.1.9",
162
162
  "@types/react-is": "^19.0.0",
163
- "@vitejs/plugin-react": "^5.0.1",
164
- "babel-plugin-react-compiler": "19.1.0-rc.2",
163
+ "@vitejs/plugin-react": "^5.0.3",
164
+ "babel-plugin-react-compiler": "19.1.0-rc.3",
165
165
  "babel-plugin-styled-components": "^2.1.4",
166
166
  "commitizen": "^4.3.1",
167
167
  "cypress": "^13.17.0",
@@ -169,22 +169,22 @@
169
169
  "cz-conventional-changelog": "^3.3.0",
170
170
  "eslint": "^9.34.0",
171
171
  "eslint-config-prettier": "^10.1.8",
172
- "eslint-formatter-compact": "^8.40.0",
172
+ "eslint-formatter-gha": "^1.6.0",
173
173
  "eslint-plugin-boundaries": "^5.0.1",
174
174
  "eslint-plugin-import": "^2.32.0",
175
175
  "eslint-plugin-jsx-a11y": "^6.10.2",
176
176
  "eslint-plugin-react": "^7.37.5",
177
- "eslint-plugin-react-compiler": "19.1.0-rc.2",
178
- "eslint-plugin-react-hooks": "0.0.0-experimental-edac0dde-20250723",
177
+ "eslint-plugin-react-hooks": "6.0.0-rc.2",
178
+ "eslint-plugin-react-hooks-with-use-effect-event": "npm:eslint-plugin-react-hooks@0.0.0-experimental-3302d1f7-20250903",
179
179
  "eslint-plugin-react-refresh": "^0.4.20",
180
180
  "eslint-plugin-simple-import-sort": "^12.1.1",
181
181
  "eslint-plugin-storybook": "^0.12.0",
182
182
  "globals": "^16.3.0",
183
183
  "http-server": "^14.1.1",
184
184
  "husky": "^8.0.3",
185
- "jest": "^30.0.5",
185
+ "jest": "^30.1.3",
186
186
  "jest-axe": "^10.0.0",
187
- "jest-environment-jsdom": "^30.0.5",
187
+ "jest-environment-jsdom": "^30.1.2",
188
188
  "lint-staged": "^14.0.1",
189
189
  "module-alias": "^2.2.3",
190
190
  "npm-run-all2": "^5.0.2",
@@ -195,12 +195,12 @@
195
195
  "refractor": "^4.9.0",
196
196
  "rimraf": "^5.0.5",
197
197
  "semantic-release": "^24.2.7",
198
- "start-server-and-test": "^2.0.13",
198
+ "start-server-and-test": "^2.1.0",
199
199
  "storybook": "^8.6.14",
200
200
  "styled-components": "^6.1.19",
201
201
  "tsconfig-paths": "^4.2.0",
202
202
  "typescript": "5.9.2",
203
- "typescript-eslint": "^8.41.0",
203
+ "typescript-eslint": "^8.42.0",
204
204
  "vite": "^5.4.19",
205
205
  "vite-tsconfig-paths": "^5.1.4"
206
206
  },
@@ -225,7 +225,8 @@
225
225
  "conventional-changelog-conventionalcommits": ">= 8.0.0",
226
226
  "react": "$react",
227
227
  "react-dom": "$react-dom",
228
- "react-is": "$react-is"
228
+ "react-is": "$react-is",
229
+ "styled-components": "npm:@sanity/styled-components@6.1.22"
229
230
  }
230
231
  },
231
232
  "esm.sh": {
@@ -633,13 +633,16 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
633
633
  const results = useMemo(() => {
634
634
  if (renderPopover) {
635
635
  return renderPopover(
636
+ // eslint-disable-next-line react-hooks/refs
636
637
  {
637
638
  content,
638
639
  hidden: !expanded,
640
+ // eslint-disable-next-line react-hooks/refs
639
641
  inputElement: inputElementRef.current,
640
642
  onMouseEnter: handlePopoverMouseEnter,
641
643
  onMouseLeave: handlePopoverMouseLeave,
642
644
  },
645
+ // eslint-disable-next-line react-hooks/refs
643
646
  resultsPopoverElementRef,
644
647
  )
645
648
  }
@@ -663,6 +666,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
663
666
  portal
664
667
  radius={radius}
665
668
  ref={resultsPopoverElementRef}
669
+ // eslint-disable-next-line react-hooks/refs
666
670
  referenceElement={inputElementRef.current}
667
671
  {...popover}
668
672
  />
@@ -122,11 +122,13 @@ export function MenuGroup(
122
122
 
123
123
  // Close child menu when a sibling item becomes active
124
124
  useEffect(() => {
125
+ // eslint-disable-next-line react-hooks/set-state-in-effect
125
126
  if (!active) setOpen(false)
126
127
  }, [active])
127
128
 
128
129
  // Update state when child menu is no longer open
129
130
  useEffect(() => {
131
+ // eslint-disable-next-line react-hooks/set-state-in-effect
130
132
  if (!open) setWithinMenu(false)
131
133
  }, [open])
132
134
 
@@ -29,7 +29,9 @@ export function useMenuController(props: {
29
29
  const elementsRef = useRef<HTMLElement[]>([])
30
30
  const [activeIndex, _setActiveIndex] = useState(-1)
31
31
  const activeIndexRef = useRef(activeIndex)
32
+ // eslint-disable-next-line react-hooks/refs
32
33
  const activeElement = useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex])
34
+ // eslint-disable-next-line react-hooks/refs
33
35
  const mounted = Boolean(rootElementRef.current)
34
36
 
35
37
  const setActiveIndex = useCallback((nextActiveIndex: number) => {
@@ -220,7 +222,9 @@ export function useMenuController(props: {
220
222
  return () => cancelAnimationFrame(rafId)
221
223
  }, [activeIndex, mounted, setActiveIndex, shouldFocus])
222
224
 
225
+ // eslint-disable-next-line react-hooks/refs
223
226
  return {
227
+ // eslint-disable-next-line react-hooks/refs
224
228
  activeElement,
225
229
  activeIndex,
226
230
  handleItemMouseEnter,
@@ -32,6 +32,7 @@ export const Skeleton = forwardRef(function Skeleton(
32
32
 
33
33
  useEffect(() => {
34
34
  if (!delay) {
35
+ // eslint-disable-next-line react-hooks/set-state-in-effect
35
36
  return setVisible(true)
36
37
  }
37
38
 
@@ -213,6 +213,7 @@ export const Tree = memo(
213
213
  ref.current.querySelectorAll('[data-ui="TreeItem"]'),
214
214
  ) as HTMLElement[]
215
215
 
216
+ // eslint-disable-next-line react-hooks/set-state-in-effect
216
217
  setItemElements(_itemElements)
217
218
  }, [children])
218
219
 
@@ -74,8 +74,10 @@ export const TreeItem = memo(function TreeItem(
74
74
  const itemPath = useMemo(() => path.concat([id || '']), [id, path])
75
75
  const itemKey = itemPath.join('/')
76
76
  const itemState = tree.state[itemKey]
77
+ // eslint-disable-next-line react-hooks/refs
77
78
  const focused = tree.focusedElement === rootRef.current
78
79
  const expanded = itemState?.expanded === undefined ? expandedProp : itemState?.expanded || false
80
+ // eslint-disable-next-line react-hooks/refs
79
81
  const tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1
80
82
  const contextValue = useMemo(
81
83
  () => ({...tree, level: tree.level + 1, path: itemPath}),
@@ -441,7 +441,7 @@ describe('useClickOutside', () => {
441
441
  const useBoundaryElementFromRef = (ref: React.MutableRefObject<HTMLElement | null>) => {
442
442
  const [element, setElement] = useState(() => ref.current)
443
443
 
444
- // eslint-disable-next-line react-hooks/exhaustive-deps
444
+ // eslint-disable-next-line react-hooks-with-use-effect-event/exhaustive-deps
445
445
  useEffect(() => {
446
446
  // If the ref has mutated since the last render, update the state and schedule a re-render
447
447
  if (ref.current !== element) {
@@ -58,6 +58,7 @@ export function useClickOutside(
58
58
  const nextElements = _getElements(element, elementsArg)
59
59
 
60
60
  if (prevElements.length !== nextElements.length) {
61
+ // eslint-disable-next-line react-hooks/set-state-in-effect
61
62
  setElements(nextElements)
62
63
  elementsRef.current = nextElements
63
64
 
@@ -77,6 +77,7 @@ export const Avatar = forwardRef(function Avatar(
77
77
  const as = ReactIs.isValidElementType(asProp) ? asProp : 'div'
78
78
  const size = useArrayProp(sizeProp)
79
79
 
80
+ // eslint-disable-next-line no-warning-comments
80
81
  // @todo: remove this
81
82
  const avatarSize = avatar.sizes[size[0]] || avatar.sizes[0]
82
83
  const _sizeRem = avatarSize.size
@@ -101,6 +102,7 @@ export const Avatar = forwardRef(function Avatar(
101
102
  }, [arrowPosition, arrowPositionProp])
102
103
 
103
104
  useEffect(() => {
105
+ // eslint-disable-next-line react-hooks/set-state-in-effect
104
106
  if (src) setImageFailed(false)
105
107
  }, [src])
106
108
 
@@ -83,6 +83,7 @@ export const Card = forwardRef(function Card(
83
83
  const rootTheme = useRootTheme()
84
84
  const tone = toneProp === 'inherit' ? rootTheme.tone : toneProp
85
85
 
86
+ // eslint-disable-next-line no-warning-comments
86
87
  // todo: Consider adding the wrapper approach for nested cards in which the tones are not changing, avoid unnecessary ThemeColorProvider
87
88
  return (
88
89
  <ThemeColorProvider scheme={scheme} tone={tone}>
@@ -1,6 +1,7 @@
1
1
  /** @beta */
2
2
  export type PopoverUpdateCallback = () => void
3
3
 
4
- /** @public */
4
+ // eslint-disable-next-line no-warning-comments
5
5
  // todo: remove `auto` from PopoverWidth
6
+ /** @public */
6
7
  export type PopoverWidth = number | 'auto'
@@ -17,6 +17,7 @@ export function responsiveFont(
17
17
  const {family, sizes, weights} = font[fontKey]
18
18
  const fontWeight = ($weight && weights[$weight]) || weights.regular
19
19
 
20
+ // eslint-disable-next-line no-warning-comments
20
21
  // @todo: make this configurable
21
22
  const defaultSize = sizes[2]
22
23
 
@@ -48,6 +49,7 @@ export function responsiveFont(
48
49
  },
49
50
  }
50
51
 
52
+ // eslint-disable-next-line no-warning-comments
51
53
  // @TODO fix the real condition that is causing $size to be undefined sometimes
52
54
  if (!$size) {
53
55
  // @ts-expect-error: `warned` isn't typed, the underlying issue should be solved rather than typing it
@@ -124,6 +124,7 @@ function Color(props: {color: ThemeColorCard_v2; tone: CardTone}) {
124
124
 
125
125
  {/* {features.muted && <ColorMuted color={color.muted} />} */}
126
126
 
127
+ {/* eslint-disable-next-line no-warning-comments */}
127
128
  {/* @todo: remove use of `muted` here */}
128
129
  {features.selectable && <ColorSelectable color={color.selectable || color.muted} />}
129
130
 
@@ -54,10 +54,13 @@ const emptySubscribe = () => () => {}
54
54
  function useUnique<ValueType extends Comparable = Comparable>(value: ValueType): ValueType {
55
55
  const valueRef = useRef<ValueType>(value)
56
56
 
57
+ // eslint-disable-next-line react-hooks/refs
57
58
  if (!_isEqual(valueRef.current, value)) {
59
+ // eslint-disable-next-line react-hooks/refs
58
60
  valueRef.current = value
59
61
  }
60
62
 
63
+ // eslint-disable-next-line react-hooks/refs
61
64
  return valueRef.current
62
65
  }
63
66
 
@@ -66,6 +66,7 @@ export const VirtualList = forwardRef(function VirtualList(
66
66
  const firstElement = wrapperRef.current.firstChild
67
67
 
68
68
  if (firstElement instanceof HTMLElement) {
69
+ // eslint-disable-next-line react-hooks/set-state-in-effect
69
70
  setItemHeight(firstElement.offsetHeight)
70
71
  }
71
72
  }, [renderItem])
@@ -111,6 +112,7 @@ export const VirtualList = forwardRef(function VirtualList(
111
112
  window.addEventListener('scroll', handleScroll, {passive: true})
112
113
  window.addEventListener('resize', handleResize)
113
114
 
115
+ // eslint-disable-next-line react-hooks/set-state-in-effect
114
116
  setScrollHeight(window.innerHeight)
115
117
 
116
118
  handleScroll()