@sanity/ui 2.1.6 → 2.1.7

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.1.6",
3
+ "version": "2.1.7",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -119,9 +119,9 @@
119
119
  "@commitlint/cli": "^19.3.0",
120
120
  "@commitlint/config-conventional": "^19.2.2",
121
121
  "@juggle/resize-observer": "^3.4.0",
122
- "@sanity/pkg-utils": "^6.8.10",
122
+ "@sanity/pkg-utils": "^6.8.13",
123
123
  "@sanity/semantic-release-preset": "^4.1.7",
124
- "@sanity/ui-workshop": "^2.0.12",
124
+ "@sanity/ui-workshop": "^2.0.13",
125
125
  "@storybook/addon-a11y": "^8.0.8",
126
126
  "@storybook/addon-docs": "^8.0.8",
127
127
  "@storybook/addon-essentials": "^8.0.8",
@@ -180,7 +180,7 @@
180
180
  "semantic-release": "^23.0.8",
181
181
  "start-server-and-test": "^2.0.3",
182
182
  "storybook": "^8.0.8",
183
- "styled-components": "^6.1.8",
183
+ "styled-components": "^6.1.10",
184
184
  "tsconfig-paths": "^4.2.0",
185
185
  "typescript": "5.4.5",
186
186
  "vite": "^5.2.11",
@@ -192,7 +192,7 @@
192
192
  "react-is": "^18",
193
193
  "styled-components": "^5.2 || ^6"
194
194
  },
195
- "packageManager": "pnpm@9.0.6",
195
+ "packageManager": "pnpm@9.1.0",
196
196
  "engines": {
197
197
  "node": ">=14.0.0"
198
198
  },
@@ -1,6 +1,5 @@
1
1
  import {ThemeColorSchemeKey} from '@sanity/ui/theme'
2
2
  import {cloneElement, forwardRef, useCallback, useMemo, useState, useEffect, useRef} from 'react'
3
- import {isElement} from 'react-is'
4
3
  import {Popover, PopoverProps} from '../../primitives'
5
4
  import {Placement, Radius} from '../../types'
6
5
  import {MenuProps} from './menu'
@@ -218,7 +217,7 @@ export const MenuButton = forwardRef(function MenuButton(
218
217
  ],
219
218
  )
220
219
 
221
- const menu = isElement(menuProp) ? cloneElement(menuProp, menuProps) : null
220
+ const menu = menuProp && cloneElement(menuProp, menuProps)
222
221
 
223
222
  const setButtonRef = useCallback(
224
223
  (el: HTMLButtonElement | null) => {
@@ -235,19 +234,18 @@ export const MenuButton = forwardRef(function MenuButton(
235
234
 
236
235
  const button = useMemo(
237
236
  () =>
238
- isElement(buttonProp)
239
- ? cloneElement(buttonProp, {
240
- 'data-ui': 'MenuButton',
241
- id,
242
- onClick: handleButtonClick,
243
- onKeyDown: handleButtonKeyDown,
244
- onMouseDown: handleMouseDown,
245
- 'aria-haspopup': true,
246
- 'aria-expanded': open,
247
- ref: setButtonRef,
248
- selected: open,
249
- })
250
- : null,
237
+ buttonProp &&
238
+ cloneElement(buttonProp, {
239
+ 'data-ui': 'MenuButton',
240
+ id,
241
+ onClick: handleButtonClick,
242
+ onKeyDown: handleButtonKeyDown,
243
+ onMouseDown: handleMouseDown,
244
+ 'aria-haspopup': true,
245
+ 'aria-expanded': open,
246
+ ref: setButtonRef,
247
+ selected: open,
248
+ }),
251
249
  [buttonProp, handleButtonClick, handleButtonKeyDown, handleMouseDown, id, open, setButtonRef],
252
250
  )
253
251