@sanity/ui 0.38.1 → 0.38.2-next.14

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 (197) hide show
  1. package/README.md +4 -5
  2. package/dist/sanity-ui.cjs +10101 -254
  3. package/dist/sanity-ui.cjs.map +1 -1
  4. package/dist/sanity-ui.js +9977 -254
  5. package/dist/sanity-ui.js.map +1 -1
  6. package/dist/types/src/index.d.ts +227 -239
  7. package/package.json +11 -12
  8. package/src/__workshop__/color/overview.tsx +1 -1
  9. package/src/components/autocomplete/__workshop__/async.tsx +1 -1
  10. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
  11. package/src/components/autocomplete/__workshop__/custom.tsx +1 -1
  12. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  13. package/src/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
  14. package/src/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  15. package/src/components/autocomplete/autocomplete.tsx +1 -1
  16. package/src/components/autocomplete/autocompleteOption.tsx +1 -1
  17. package/src/components/breadcrumbs/__workshop__/example.tsx +0 -1
  18. package/src/components/breadcrumbs/breadcrumbs.tsx +1 -9
  19. package/src/components/dialog/__workshop__/autoFocus.tsx +0 -1
  20. package/src/components/dialog/__workshop__/layering.tsx +0 -1
  21. package/src/components/dialog/__workshop__/nested.tsx +1 -1
  22. package/src/components/dialog/__workshop__/onScroll.tsx +1 -1
  23. package/src/components/dialog/__workshop__/position.tsx +0 -1
  24. package/src/components/dialog/__workshop__/props.tsx +1 -1
  25. package/src/components/dialog/__workshop__/provider.tsx +0 -1
  26. package/src/components/dialog/dialog.tsx +1 -1
  27. package/src/components/dialog/dialogProvider.tsx +1 -1
  28. package/src/components/hotkeys/__workshop__/plain.tsx +0 -1
  29. package/src/components/hotkeys/hotkeys.tsx +1 -1
  30. package/src/components/menu/__workshop__/asComponent.tsx +1 -1
  31. package/src/components/menu/__workshop__/closableMenuButton.tsx +1 -1
  32. package/src/components/menu/__workshop__/constrainedInBoundary.tsx +1 -1
  33. package/src/components/menu/__workshop__/customMenuItem.tsx +0 -1
  34. package/src/components/menu/__workshop__/disableFocusOnClose.tsx +0 -1
  35. package/src/components/menu/__workshop__/groups.tsx +0 -1
  36. package/src/components/menu/__workshop__/menuButton.tsx +0 -1
  37. package/src/components/menu/__workshop__/menuGroupRight.tsx +0 -1
  38. package/src/components/menu/__workshop__/nestedMenu.tsx +0 -1
  39. package/src/components/menu/__workshop__/onCloseMenuButton.tsx +1 -1
  40. package/src/components/menu/__workshop__/selectedItem.tsx +1 -1
  41. package/src/components/menu/__workshop__/tones.tsx +0 -1
  42. package/src/components/menu/__workshop__/withoutArrow.tsx +0 -1
  43. package/src/components/menu/menu.test.tsx +1 -1
  44. package/src/components/menu/menu.tsx +1 -1
  45. package/src/components/menu/menuButton.tsx +1 -9
  46. package/src/components/menu/menuGroup.tsx +1 -1
  47. package/src/components/menu/menuItem.tsx +1 -1
  48. package/src/components/menu/useMenuController.ts +1 -1
  49. package/src/components/skeleton/__workshop__/delay.tsx +0 -1
  50. package/src/components/skeleton/__workshop__/skeleton.tsx +0 -1
  51. package/src/components/skeleton/skeleton.tsx +1 -1
  52. package/src/components/skeleton/textSkeleton.tsx +1 -1
  53. package/src/components/tab/__workshop__/example.tsx +1 -1
  54. package/src/components/tab/tab.tsx +1 -1
  55. package/src/components/tab/tabList.tsx +1 -1
  56. package/src/components/tab/tabPanel.tsx +1 -1
  57. package/src/components/toast/__workshop__/hook.tsx +0 -1
  58. package/src/components/toast/__workshop__/toast.tsx +0 -1
  59. package/src/components/toast/toast.test.tsx +0 -1
  60. package/src/components/toast/toast.tsx +0 -1
  61. package/src/components/toast/toastProvider.tsx +1 -1
  62. package/src/components/tree/__workshop__/basic.tsx +1 -1
  63. package/src/components/tree/tree.tsx +1 -1
  64. package/src/components/tree/treeGroup.tsx +1 -1
  65. package/src/components/tree/treeItem.tsx +3 -3
  66. package/src/hooks/useElementRect/__workshop__/example.tsx +0 -1
  67. package/src/hooks/useForwardedRef.ts +1 -1
  68. package/src/hooks/useMediaIndex/__workshop__/test.tsx +0 -1
  69. package/src/icons/__workshop__/overview.tsx +1 -1
  70. package/src/primitives/avatar/__workshop__/asButton.tsx +0 -1
  71. package/src/primitives/avatar/__workshop__/stack.tsx +0 -1
  72. package/src/primitives/avatar/avatar.tsx +9 -4
  73. package/src/primitives/avatar/avatarCounter.tsx +1 -1
  74. package/src/primitives/avatar/avatarStack.tsx +1 -1
  75. package/src/primitives/badge/__workshop__/props.tsx +0 -1
  76. package/src/primitives/badge/__workshop__/tones.tsx +0 -1
  77. package/src/primitives/badge/badge.test.tsx +0 -1
  78. package/src/primitives/badge/badge.tsx +1 -1
  79. package/src/primitives/box/__workshop__/props.tsx +0 -1
  80. package/src/primitives/box/__workshop__/responsive.tsx +0 -1
  81. package/src/primitives/box/box.tsx +1 -1
  82. package/src/primitives/button/__workshop__/custom.tsx +0 -1
  83. package/src/primitives/button/__workshop__/customIcons.tsx +0 -1
  84. package/src/primitives/button/__workshop__/mixedChildren.tsx +0 -1
  85. package/src/primitives/button/__workshop__/props.tsx +0 -1
  86. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +0 -1
  87. package/src/primitives/button/__workshop__/stacked.tsx +0 -1
  88. package/src/primitives/button/__workshop__/styled1.tsx +0 -1
  89. package/src/primitives/button/__workshop__/styled2.tsx +0 -1
  90. package/src/primitives/button/__workshop__/uploadButton.tsx +1 -1
  91. package/src/primitives/button/button.test.tsx +0 -1
  92. package/src/primitives/button/button.tsx +1 -1
  93. package/src/primitives/card/__workshop__/allTones.tsx +0 -1
  94. package/src/primitives/card/__workshop__/asButton.tsx +0 -1
  95. package/src/primitives/card/__workshop__/asComponent.tsx +1 -1
  96. package/src/primitives/card/__workshop__/checkered.tsx +0 -1
  97. package/src/primitives/card/__workshop__/interactive.tsx +0 -1
  98. package/src/primitives/card/__workshop__/listNavigation.tsx +0 -1
  99. package/src/primitives/card/__workshop__/props.tsx +0 -1
  100. package/src/primitives/card/__workshop__/selected.tsx +0 -1
  101. package/src/primitives/card/__workshop__/styled.tsx +0 -1
  102. package/src/primitives/card/card.tsx +1 -1
  103. package/src/primitives/checkbox/__workshop__/example.tsx +1 -1
  104. package/src/primitives/checkbox/__workshop__/props.tsx +0 -1
  105. package/src/primitives/checkbox/__workshop__/readOnly.tsx +0 -1
  106. package/src/primitives/checkbox/__workshop__/tones.tsx +0 -1
  107. package/src/primitives/checkbox/checkbox.tsx +1 -1
  108. package/src/primitives/code/__workshop__/opticalAlignment.tsx +0 -1
  109. package/src/primitives/code/__workshop__/props.tsx +0 -1
  110. package/src/primitives/code/code.tsx +1 -1
  111. package/src/primitives/container/__workshop__/example.tsx +0 -1
  112. package/src/primitives/container/container.tsx +1 -1
  113. package/src/primitives/flex/__workshop__/example.tsx +0 -1
  114. package/src/primitives/flex/__workshop__/gap.tsx +0 -1
  115. package/src/primitives/flex/flex.tsx +1 -1
  116. package/src/primitives/grid/__workshop__/responsive.tsx +0 -1
  117. package/src/primitives/grid/grid.tsx +1 -1
  118. package/src/primitives/heading/__workshop__/opticalAlignment.tsx +0 -1
  119. package/src/primitives/heading/__workshop__/plain.tsx +0 -1
  120. package/src/primitives/heading/heading.tsx +1 -1
  121. package/src/primitives/inline/__workshop__/plain.tsx +0 -1
  122. package/src/primitives/inline/inline.tsx +1 -1
  123. package/src/primitives/kbd/__workshop__/plain.tsx +0 -1
  124. package/src/primitives/kbd/kbd.tsx +1 -1
  125. package/src/primitives/label/__workshop__/opticalAlignment.tsx +0 -1
  126. package/src/primitives/label/__workshop__/plain.tsx +0 -1
  127. package/src/primitives/label/label.tsx +1 -1
  128. package/src/primitives/popover/__workshop__/MarginsStory.tsx +0 -1
  129. package/src/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -1
  130. package/src/primitives/popover/__workshop__/PlainStory.tsx +1 -1
  131. package/src/primitives/popover/__workshop__/RecursiveStory.tsx +1 -1
  132. package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +1 -1
  133. package/src/primitives/popover/__workshop__/TestStory.tsx +1 -1
  134. package/src/primitives/popover/arrow.tsx +1 -1
  135. package/src/primitives/popover/popover.tsx +1 -9
  136. package/src/primitives/radio/__workshop__/example.tsx +1 -1
  137. package/src/primitives/radio/__workshop__/plain.tsx +0 -1
  138. package/src/primitives/radio/radio.tsx +1 -1
  139. package/src/primitives/select/__workshop__/plain.tsx +0 -1
  140. package/src/primitives/select/__workshop__/readOnly.tsx +0 -1
  141. package/src/primitives/select/select.tsx +1 -1
  142. package/src/primitives/spinner/__workshop__/Props.tsx +0 -1
  143. package/src/primitives/spinner/spinner.tsx +1 -1
  144. package/src/primitives/stack/__workshop__/plain.tsx +0 -1
  145. package/src/primitives/stack/stack.tsx +1 -1
  146. package/src/primitives/switch/__workshop__/example.tsx +1 -1
  147. package/src/primitives/switch/__workshop__/props.tsx +1 -1
  148. package/src/primitives/switch/switch.tsx +1 -1
  149. package/src/primitives/text/__workshop__/colored.tsx +0 -1
  150. package/src/primitives/text/__workshop__/example.tsx +0 -1
  151. package/src/primitives/text/__workshop__/opticalAlignment.tsx +0 -1
  152. package/src/primitives/text/text.tsx +1 -1
  153. package/src/primitives/textArea/__workshop__/plain.tsx +0 -1
  154. package/src/primitives/textArea/textArea.tsx +1 -1
  155. package/src/primitives/textInput/__workshop__/clearButton.tsx +1 -1
  156. package/src/primitives/textInput/__workshop__/customValidity.tsx +0 -1
  157. package/src/primitives/textInput/__workshop__/multipleTones.tsx +0 -1
  158. package/src/primitives/textInput/__workshop__/plain.tsx +1 -1
  159. package/src/primitives/textInput/__workshop__/readOnly.tsx +0 -1
  160. package/src/primitives/textInput/__workshop__/states.tsx +0 -1
  161. package/src/primitives/textInput/__workshop__/tones.tsx +0 -1
  162. package/src/primitives/textInput/__workshop__/typed.tsx +1 -1
  163. package/src/primitives/textInput/textInput.tsx +1 -1
  164. package/src/primitives/tooltip/__workshop__/props.tsx +0 -1
  165. package/src/primitives/tooltip/tooltip.tsx +1 -1
  166. package/src/primitives/tooltip/tooltipArrow.tsx +1 -1
  167. package/src/styles/font/responsiveFont.ts +13 -0
  168. package/src/theme/__workshop__/canvas.tsx +1 -1
  169. package/src/theme/__workshop__/color.tsx +0 -1
  170. package/src/theme/__workshop__/layer.tsx +1 -1
  171. package/src/theme/__workshop__/nestedProvider.tsx +0 -1
  172. package/src/theme/theme.test.tsx +0 -1
  173. package/src/theme/themeColorProvider.tsx +0 -1
  174. package/src/theme/themeProvider.tsx +1 -1
  175. package/src/utils/boundaryElement/__workshop__/plain.tsx +1 -1
  176. package/src/utils/boundaryElement/boundaryElement.test.tsx +0 -1
  177. package/src/utils/boundaryElement/boundaryElementProvider.tsx +1 -1
  178. package/src/utils/elementQuery/__workshop__/customMedia.tsx +0 -1
  179. package/src/utils/elementQuery/elementQuery.tsx +1 -1
  180. package/src/utils/errorBoundary.tsx +4 -4
  181. package/src/utils/layer/__workshop__/_debug.tsx +0 -1
  182. package/src/utils/layer/__workshop__/multipleRoots.tsx +0 -1
  183. package/src/utils/layer/__workshop__/plain.tsx +1 -1
  184. package/src/utils/layer/__workshop__/responsiveZOffset.tsx +0 -1
  185. package/src/utils/layer/layer.test.tsx +0 -1
  186. package/src/utils/layer/layer.tsx +1 -1
  187. package/src/utils/layer/layerProvider.tsx +1 -1
  188. package/src/utils/portal/__workshop__/named.tsx +1 -1
  189. package/src/utils/portal/portal.test.tsx +0 -1
  190. package/src/utils/portal/portal.ts +2 -3
  191. package/src/utils/portal/portalProvider.tsx +1 -1
  192. package/src/utils/srOnly/srOnly.tsx +1 -1
  193. package/src/utils/virtualList/__workshop__/changingProps.tsx +1 -1
  194. package/src/utils/virtualList/__workshop__/elementScroll.tsx +1 -1
  195. package/src/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
  196. package/src/utils/virtualList/__workshop__/windowScrolll.tsx +1 -1
  197. package/src/utils/virtualList/virtualList.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "0.38.1",
3
+ "version": "0.38.2-next.14+4e7fc734",
4
4
  "sideEffects": false,
5
5
  "source": "./src/index.ts",
6
6
  "module": "./dist/sanity-ui.js",
@@ -31,27 +31,26 @@
31
31
  "dependencies": {
32
32
  "@juggle/resize-observer": "^3.4.0",
33
33
  "@popperjs/core": "^2.11.6",
34
- "@reach/auto-id": "^0.17.0",
35
- "@sanity/color": "^2.1.15",
36
- "@sanity/icons": "^1.3.5",
37
- "framer-motion": "6.3.0",
34
+ "@sanity/color": "2.1.16-next.14+4e7fc734",
35
+ "@sanity/icons": "1.3.6-next.14+4e7fc734",
36
+ "framer-motion": "^7.3.2",
38
37
  "popper-max-size-modifier": "^0.2.0",
39
- "react-is": "^17.0.2",
38
+ "react-is": "^18.2.0",
40
39
  "react-popper": "^2.3.0",
41
40
  "react-refractor": "^2.1.7"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@testing-library/dom": "^8.17.1",
45
44
  "@testing-library/jest-dom": "^5.16.5",
46
- "@testing-library/react": "^12.1.5",
45
+ "@testing-library/react": "^13.4.0",
47
46
  "@types/refractor": "^3.0.2",
48
- "react": "^17.0.2",
49
- "react-dom": "^17.0.2",
47
+ "react": "^18.2.0",
48
+ "react-dom": "^18.2.0",
50
49
  "styled-components": "^5.3.5"
51
50
  },
52
51
  "peerDependencies": {
53
- "react": "^16.9 || ^17 || ^18",
54
- "react-dom": "^16.9 || ^17 || ^18",
52
+ "react": "^18",
53
+ "react-dom": "^18",
55
54
  "styled-components": "^5.2"
56
55
  },
57
56
  "repository": {
@@ -71,5 +70,5 @@
71
70
  "publishConfig": {
72
71
  "access": "public"
73
72
  },
74
- "gitHead": "18d4d339ca7de574829d021cafe5d04aca7eff7b"
73
+ "gitHead": "4e7fc73402390c60cb8b2f996bbce207465e9e90"
75
74
  }
@@ -1,6 +1,6 @@
1
1
  import {black, ColorTints, ColorValue, COLOR_HUES, hues, white} from '@sanity/color'
2
2
  import {Box, Card, Code, Flex, Grid, Heading, Stack, useToast} from '@sanity/ui'
3
- import React, {useCallback} from 'react'
3
+ import {useCallback} from 'react'
4
4
  import {hexToRgb, rgbToHsl} from '../../theme'
5
5
 
6
6
  function ucfirst(str: string) {
@@ -10,7 +10,7 @@ import {
10
10
  Stack,
11
11
  Text,
12
12
  } from '@sanity/ui'
13
- import React, {useCallback, useEffect, useRef, useState} from 'react'
13
+ import {useCallback, useEffect, useRef, useState} from 'react'
14
14
  import {countriesStore} from '../__mocks__/apiStore'
15
15
 
16
16
  export default function AsyncStory() {
@@ -7,7 +7,7 @@ import {
7
7
  Stack,
8
8
  Text,
9
9
  } from '@sanity/ui'
10
- import React, {useCallback, useState} from 'react'
10
+ import {useCallback, useState} from 'react'
11
11
  import {Popover} from '../../../primitives'
12
12
  import countries from '../__fixtures__/countries'
13
13
  import {AutocompleteProps} from '../autocomplete'
@@ -1,6 +1,6 @@
1
1
  import {Autocomplete, Box, Button, Card, Code, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
- import React, {useCallback, useState} from 'react'
3
+ import {useCallback, useState} from 'react'
4
4
  import {
5
5
  WORKSHOP_RADIUS_OPTIONS,
6
6
  WORKSHOP_SPACE_OPTIONS,
@@ -2,7 +2,7 @@ import {Autocomplete, Box, Card, Container, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
3
  import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop'
4
4
  import {fireEvent} from '@testing-library/dom'
5
- import React, {useCallback, useMemo, useState} from 'react'
5
+ import {useCallback, useMemo, useState} from 'react'
6
6
  import {
7
7
  WORKSHOP_CARD_TONE_OPTIONS,
8
8
  WORKSHOP_RADIUS_OPTIONS,
@@ -1,5 +1,5 @@
1
1
  import {Autocomplete, Box, Button, Card, Code, Stack} from '@sanity/ui'
2
- import React, {useCallback, useState} from 'react'
2
+ import {useCallback, useState} from 'react'
3
3
 
4
4
  export default function FocusAndBlurStory() {
5
5
  const [value, setValue] = useState('')
@@ -18,7 +18,7 @@ import {
18
18
  useToast,
19
19
  } from '@sanity/ui'
20
20
  import {useBoolean} from '@sanity/ui-workshop'
21
- import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
21
+ import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
22
22
  import {countriesStore} from '../__mocks__/apiStore'
23
23
 
24
24
  export default function Fullscreen() {
@@ -1,5 +1,5 @@
1
1
  import {ChevronDownIcon} from '@sanity/icons'
2
- import React, {
2
+ import {
3
3
  cloneElement,
4
4
  forwardRef,
5
5
  useCallback,
@@ -1,4 +1,4 @@
1
- import React, {useCallback} from 'react'
1
+ import {useCallback} from 'react'
2
2
  import {_isEnterToClickElement} from '../../helpers'
3
3
 
4
4
  export interface AutocompleteOptionProps {
@@ -1,6 +1,5 @@
1
1
  import {Breadcrumbs, Flex, Text} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  const BREADCRUMBS_MAX_LENGTH_OPTIONS = {
6
5
  '(none)': 0,
@@ -1,12 +1,4 @@
1
- import React, {
2
- Children,
3
- forwardRef,
4
- Fragment,
5
- isValidElement,
6
- useCallback,
7
- useMemo,
8
- useState,
9
- } from 'react'
1
+ import {Children, forwardRef, Fragment, isValidElement, useCallback, useMemo, useState} from 'react'
10
2
  import {useArrayProp, useClickOutside} from '../../hooks'
11
3
  import {Box, Popover, Stack, Text} from '../../primitives'
12
4
  import {ExpandButton, Root} from './breadcrumbs.styles'
@@ -1,6 +1,5 @@
1
1
  import {Box, Button, Dialog, Text} from '@sanity/ui'
2
2
  import {useAction, useBoolean} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function AutoFocusStory() {
6
5
  const autoFocus = useBoolean('Auto-focus', true, 'Props')
@@ -1,6 +1,5 @@
1
1
  import {Box, Card, Code, Dialog, Layer, LayerProvider, useLayer} from '@sanity/ui'
2
2
  import {useAction} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function LayeringStory() {
6
5
  return (
@@ -1,5 +1,5 @@
1
1
  import {Box, Button, Dialog, LayerProvider, Menu, MenuButton, MenuItem} from '@sanity/ui'
2
- import React, {useState} from 'react'
2
+ import {useState} from 'react'
3
3
 
4
4
  export default function NestedStory() {
5
5
  const [open1] = useState(true)
@@ -1,6 +1,6 @@
1
1
  import {Box, Dialog, LayerProvider, Text} from '@sanity/ui'
2
2
  import {useAction} from '@sanity/ui-workshop'
3
- import React, {useEffect, useRef} from 'react'
3
+ import {useEffect, useRef} from 'react'
4
4
 
5
5
  export default function OnScrollStory() {
6
6
  const ref = useRef<HTMLDivElement | null>(null)
@@ -1,7 +1,6 @@
1
1
  import {ArrowDownIcon, ArrowUpIcon} from '@sanity/icons'
2
2
  import {Box, Dialog, LayerProvider, Stack, Text} from '@sanity/ui'
3
3
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
4
- import React from 'react'
5
4
  import {WORKSHOP_DIALOG_POSITION_OPTIONS} from '../../../__workshop__/constants'
6
5
 
7
6
  export default function PositionStory() {
@@ -1,6 +1,6 @@
1
1
  import {Box, Button, Dialog, LayerProvider, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
- import React, {useCallback, useRef, useState} from 'react'
3
+ import {useCallback, useRef, useState} from 'react'
4
4
  import {WORKSHOP_WIDTH_OPTIONS} from '../../../__workshop__/constants'
5
5
 
6
6
  export default function PropsStory() {
@@ -1,5 +1,4 @@
1
1
  import {Dialog, DialogProvider} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function ProviderStory() {
5
4
  return (
@@ -1,5 +1,5 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
2
+ import {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
3
3
  import styled from 'styled-components'
4
4
  import {focusFirstDescendant, focusLastDescendant} from '../../helpers'
5
5
  import {useArrayProp, useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
@@ -1,4 +1,4 @@
1
- import React, {useMemo} from 'react'
1
+ import {useMemo} from 'react'
2
2
  import {DialogPosition} from '../../types'
3
3
  import {DialogContext, DialogContextValue} from './dialogContext'
4
4
 
@@ -1,5 +1,4 @@
1
1
  import {Flex, Hotkeys} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function PlainStory() {
5
4
  return (
@@ -1,4 +1,4 @@
1
- import React, {forwardRef} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Inline, KBD} from '../../primitives'
@@ -1,5 +1,5 @@
1
1
  import {Button, Flex, Menu, MenuButton, MenuItem, Text} from '@sanity/ui'
2
- import React, {forwardRef} from 'react'
2
+ import {forwardRef} from 'react'
3
3
 
4
4
  const CustomLink = forwardRef(function CustomLink(
5
5
  props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
@@ -1,6 +1,6 @@
1
1
  import {AddIcon} from '@sanity/icons'
2
2
  import {Box, Button, Menu, MenuButton, MenuItem, Stack} from '@sanity/ui'
3
- import React, {useRef} from 'react'
3
+ import {useRef} from 'react'
4
4
 
5
5
  export default function ClosableMenuButtonStory() {
6
6
  const ref = useRef<HTMLButtonElement | null>(null)
@@ -11,7 +11,7 @@ import {
11
11
  SelectableTone,
12
12
  Text,
13
13
  } from '@sanity/ui'
14
- import React, {useState} from 'react'
14
+ import {useState} from 'react'
15
15
  import {MenuButtonProps} from '../menuButton'
16
16
 
17
17
  const POPOVER_PROPS: MenuButtonProps['popover'] = {
@@ -1,5 +1,4 @@
1
1
  import {Box, Card, LayerProvider, Menu, MenuDivider, MenuItem, Stack, Text} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function CustomMenuItemStory() {
5
4
  return (
@@ -1,7 +1,6 @@
1
1
  import {SelectIcon} from '@sanity/icons'
2
2
  import {Button, Flex, Menu, MenuButton, MenuItem} from '@sanity/ui'
3
3
  import {useBoolean} from '@sanity/ui-workshop'
4
- import React from 'react'
5
4
 
6
5
  export default function DisableFocusOnCloseStory() {
7
6
  const disableRestoreFocusOnClose = useBoolean('Disable restore focus on close', false)
@@ -11,7 +11,6 @@ import {
11
11
  MenuItem,
12
12
  } from '@sanity/ui'
13
13
  import {useAction} from '@sanity/ui-workshop'
14
- import React from 'react'
15
14
 
16
15
  export default function GroupsStory() {
17
16
  return (
@@ -11,7 +11,6 @@ import {
11
11
  MenuItem,
12
12
  } from '@sanity/ui'
13
13
  import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
14
- import React from 'react'
15
14
  import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
16
15
 
17
16
  export default function MenuButtonStory() {
@@ -18,7 +18,6 @@ import {
18
18
  MenuGroup,
19
19
  MenuItem,
20
20
  } from '@sanity/ui'
21
- import React from 'react'
22
21
 
23
22
  export default function MenuGroupRightStory() {
24
23
  return (
@@ -1,5 +1,4 @@
1
1
  import {Box, Button, Menu, MenuButton, MenuDivider, MenuItem, Stack} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function NestedMenuItems() {
5
4
  return (
@@ -1,5 +1,5 @@
1
1
  import {Box, Button, Menu, MenuButton, MenuItem, Stack, useToast} from '@sanity/ui'
2
- import React, {useCallback} from 'react'
2
+ import {useCallback} from 'react'
3
3
 
4
4
  export default function OnCloseMenuButton() {
5
5
  const {push} = useToast()
@@ -1,6 +1,6 @@
1
1
  import {CheckmarkIcon, ClockIcon, ExpandIcon, SearchIcon} from '@sanity/icons'
2
2
  import {Box, Button, Code, Menu, MenuButton, MenuDivider, MenuItem, Stack} from '@sanity/ui'
3
- import React, {useState} from 'react'
3
+ import {useState} from 'react'
4
4
 
5
5
  export default function SelectedItemStory() {
6
6
  const [selectedIndex, setSelectedIndex] = useState(0)
@@ -1,7 +1,6 @@
1
1
  import {SearchIcon} from '@sanity/icons'
2
2
  import {Box, Card, LayerProvider, Menu, MenuItem} from '@sanity/ui'
3
3
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
4
- import React from 'react'
5
4
  import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
6
5
 
7
6
  export default function TonesStory() {
@@ -1,5 +1,4 @@
1
1
  import {Box, Button, Menu, MenuButton, MenuItem, Stack} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function WithoutArrowStory() {
5
4
  return (
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
 
3
- import React, {useCallback, useMemo} from 'react'
3
+ import {useCallback, useMemo} from 'react'
4
4
  import {render} from '../../../test'
5
5
  import {MenuContext, MenuContextValue} from './menuContext'
6
6
  import {useMenu} from './useMenu'
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, useCallback, useEffect, useMemo} from 'react'
1
+ import {forwardRef, useCallback, useEffect, useMemo} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
4
4
  import {Box, Stack} from '../../primitives'
@@ -1,12 +1,4 @@
1
- import React, {
2
- cloneElement,
3
- forwardRef,
4
- useCallback,
5
- useMemo,
6
- useState,
7
- useEffect,
8
- useRef,
9
- } from 'react'
1
+ import {cloneElement, forwardRef, useCallback, useMemo, useState, useEffect, useRef} from 'react'
10
2
  import {isElement} from 'react-is'
11
3
  import {Popover, PopoverProps} from '../../primitives'
12
4
  import {ThemeColorSchemeKey} from '../../theme'
@@ -1,5 +1,5 @@
1
1
  import {ChevronRightIcon} from '@sanity/icons'
2
- import React, {createElement, isValidElement, useCallback, useEffect, useRef, useState} from 'react'
2
+ import {createElement, isValidElement, useCallback, useEffect, useRef, 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'
@@ -1,4 +1,4 @@
1
- import React, {
1
+ import {
2
2
  createElement,
3
3
  forwardRef,
4
4
  isValidElement,
@@ -33,7 +33,7 @@ export function useMenuController(props: {
33
33
  const activeElement = elementsRef.current[activeIndex] || null
34
34
  const mounted = Boolean(rootElement)
35
35
 
36
- const setActiveIndex = useCallback((nextActiveIndex) => {
36
+ const setActiveIndex = useCallback((nextActiveIndex: number) => {
37
37
  _setActiveIndex(nextActiveIndex)
38
38
  activeIndexRef.current = nextActiveIndex
39
39
  }, [])
@@ -12,7 +12,6 @@ import {
12
12
  TextSkeleton,
13
13
  } from '@sanity/ui'
14
14
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
15
- import React from 'react'
16
15
  import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
17
16
 
18
17
  export default function SkeletonDelayStory() {
@@ -12,7 +12,6 @@ import {
12
12
  TextSkeleton,
13
13
  } from '@sanity/ui'
14
14
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
15
- import React from 'react'
16
15
  import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
17
16
 
18
17
  export default function SkeletonStory() {
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, useEffect, useState} from 'react'
1
+ import {forwardRef, useEffect, useState} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Box} from '../../primitives'
@@ -1,4 +1,4 @@
1
- import React, {forwardRef} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {_responsive} from '../../styles'
@@ -1,6 +1,6 @@
1
1
  import {OkHandIcon, RocketIcon, SunIcon} from '@sanity/icons'
2
2
  import {Box, Card, Tab, TabList, TabPanel, Text} from '@sanity/ui'
3
- import React, {useState} from 'react'
3
+ import {useState} from 'react'
4
4
 
5
5
  export default function ExampleStory() {
6
6
  const [tab, setTab] = useState('foo')
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, useCallback, useEffect, useRef} from 'react'
1
+ import {forwardRef, useCallback, useEffect, useRef} from 'react'
2
2
  import {useForwardedRef} from '../../hooks'
3
3
  import {Button} from '../../primitives'
4
4
  import {ButtonTone} from '../../types'
@@ -1,4 +1,4 @@
1
- import React, {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'
1
+ import {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'
2
2
  import {Inline, InlineProps} from '../../primitives'
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import React, {forwardRef} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import {Box, BoxProps} from '../../primitives'
3
3
 
4
4
  /**
@@ -1,5 +1,4 @@
1
1
  import {Box, Button, Inline, ToastProvider, useToast} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function HookStory() {
5
4
  const toast = useToast()
@@ -1,6 +1,5 @@
1
1
  import {Box, Container, Toast} from '@sanity/ui'
2
2
  import {useAction, useBoolean, useSelect, useString, useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_TOAST_STATUS_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function ToastStory() {
@@ -1,4 +1,3 @@
1
- import React from 'react'
2
1
  import {render} from '../../../test'
3
2
  import {ToastContext} from './toastContext'
4
3
  import {ToastContextValue} from './types'
@@ -1,5 +1,4 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import React from 'react'
3
2
  import styled from 'styled-components'
4
3
  import {Box, Button, Card, Flex, Stack, Text} from '../../primitives'
5
4
  import {ThemeColorToneKey} from '../../theme'
@@ -1,5 +1,5 @@
1
1
  import {AnimatePresence, motion} from 'framer-motion'
2
- import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
2
+ import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
3
3
  import styled from 'styled-components'
4
4
  import {Box} from '../../primitives'
5
5
  import {Layer} from '../../utils'
@@ -1,7 +1,7 @@
1
1
  import {LinkIcon} from '@sanity/icons'
2
2
  import {Box, Tree, TreeItem} from '@sanity/ui'
3
3
  import {usePerfTest} from '@sanity/ui-workshop'
4
- import React, {useCallback, useState} from 'react'
4
+ import {useCallback, useState} from 'react'
5
5
  import {perfTests} from './basic.perf'
6
6
 
7
7
  export default function BasicStory() {
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
1
+ import {forwardRef, memo, useCallback, useEffect, useMemo, useRef, useState} from 'react'
2
2
  import {useForwardedRef} from '../../hooks'
3
3
  import {Stack} from '../../primitives'
4
4
  import {_findNextItemElement, _findPrevItemElement, _focusItemElement} from './helpers'
@@ -1,4 +1,4 @@
1
- import React, {memo} from 'react'
1
+ import {memo} from 'react'
2
2
  import {Stack} from '../../primitives'
3
3
  import {useTree} from './useTree'
4
4
 
@@ -1,6 +1,5 @@
1
- import {useId} from '@reach/auto-id'
2
1
  import {ToggleArrowRightIcon} from '@sanity/icons'
3
- import React, {createElement, memo, useCallback, useEffect, useMemo, useRef} from 'react'
2
+ import {createElement, memo, useCallback, useEffect, useId, useMemo, useRef} from 'react'
4
3
  import styled from 'styled-components'
5
4
  import {Box, Flex, Text} from '../../primitives'
6
5
  import {ThemeFontWeightKey} from '../../theme'
@@ -64,7 +63,8 @@ export const TreeItem = memo(function TreeItem(
64
63
  const treeitemRef = useRef<HTMLDivElement | null>(null)
65
64
  const tree = useTree()
66
65
  const {path, registerItem, setExpanded, setFocusedElement} = tree
67
- const id = useId(idProp) || idProp
66
+ const _id = useId()
67
+ const id = idProp || _id
68
68
  const itemPath = useMemo(() => path.concat([id || '']), [id, path])
69
69
  const itemKey = itemPath.join('/')
70
70
  const itemState = tree.state[itemKey]
@@ -1,6 +1,5 @@
1
1
  import {Box, Card, Code, Container, Stack, Text, useElementRect} from '@sanity/ui'
2
2
  import {useMemo, useState} from 'react'
3
- import React from 'react'
4
3
  import {Grid} from '../../../primitives'
5
4
 
6
5
  export default function ExampleStory() {
@@ -1,4 +1,4 @@
1
- import React, {useRef} from 'react'
1
+ import {useRef} from 'react'
2
2
  import {useIsomorphicEffect} from './useIsomorphicEffect'
3
3
 
4
4
  /**
@@ -1,5 +1,4 @@
1
1
  import {Card, Stack, Text, useMediaIndex} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function TestStory() {
5
4
  const mediaIndex = useMediaIndex()
@@ -1,6 +1,6 @@
1
1
  import {Icon, icons, IconSymbol, SearchIcon} from '@sanity/icons'
2
2
  import {Box, Card, Code, Container, Flex, Heading, Stack, Text, TextInput} from '@sanity/ui'
3
- import React, {useCallback, useMemo, useState} from 'react'
3
+ import {useCallback, useMemo, useState} from 'react'
4
4
  import {packages} from '$packages'
5
5
 
6
6
  function ucfirst(str: string) {
@@ -1,6 +1,5 @@
1
1
  import {Avatar, Flex} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_AVATAR_SIZE_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function AsButtonStory() {
@@ -1,6 +1,5 @@
1
1
  import {Avatar, AvatarCounter, AvatarStack, Flex} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_AVATAR_SIZE_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function StackStory() {