@sanity/ui 0.38.2 → 0.38.3-next.18

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 (201) hide show
  1. package/README.md +4 -5
  2. package/dist/sanity-ui.js +1 -1320
  3. package/dist/sanity-ui.js.map +1 -1
  4. package/dist/sanity-ui.mjs +2 -0
  5. package/dist/sanity-ui.mjs.map +1 -0
  6. package/dist/types/src/index.d.ts +228 -239
  7. package/package.json +23 -20
  8. package/src/__workshop__/color/overview.tsx +1 -1
  9. package/src/__workshop__/constants.ts +1 -0
  10. package/src/components/autocomplete/__workshop__/async.tsx +1 -1
  11. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
  12. package/src/components/autocomplete/__workshop__/custom.tsx +1 -1
  13. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  14. package/src/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
  15. package/src/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  16. package/src/components/autocomplete/autocomplete.tsx +31 -33
  17. package/src/components/autocomplete/autocompleteOption.tsx +1 -1
  18. package/src/components/autocomplete/autocompleteReducer.ts +0 -3
  19. package/src/components/breadcrumbs/__workshop__/example.tsx +0 -1
  20. package/src/components/breadcrumbs/breadcrumbs.tsx +1 -9
  21. package/src/components/dialog/__workshop__/autoFocus.tsx +0 -1
  22. package/src/components/dialog/__workshop__/layering.tsx +0 -1
  23. package/src/components/dialog/__workshop__/nested.tsx +1 -1
  24. package/src/components/dialog/__workshop__/onScroll.tsx +1 -1
  25. package/src/components/dialog/__workshop__/position.tsx +0 -1
  26. package/src/components/dialog/__workshop__/props.tsx +1 -1
  27. package/src/components/dialog/__workshop__/provider.tsx +0 -1
  28. package/src/components/dialog/dialog.tsx +1 -1
  29. package/src/components/dialog/dialogProvider.tsx +1 -1
  30. package/src/components/hotkeys/__workshop__/plain.tsx +0 -1
  31. package/src/components/hotkeys/hotkeys.tsx +1 -1
  32. package/src/components/menu/__workshop__/asComponent.tsx +1 -1
  33. package/src/components/menu/__workshop__/closableMenuButton.tsx +1 -1
  34. package/src/components/menu/__workshop__/constrainedInBoundary.tsx +1 -1
  35. package/src/components/menu/__workshop__/customMenuItem.tsx +0 -1
  36. package/src/components/menu/__workshop__/disableFocusOnClose.tsx +0 -1
  37. package/src/components/menu/__workshop__/groups.tsx +0 -1
  38. package/src/components/menu/__workshop__/menuButton.tsx +0 -1
  39. package/src/components/menu/__workshop__/menuGroupRight.tsx +0 -1
  40. package/src/components/menu/__workshop__/nestedMenu.tsx +0 -1
  41. package/src/components/menu/__workshop__/onCloseMenuButton.tsx +1 -1
  42. package/src/components/menu/__workshop__/selectedItem.tsx +1 -1
  43. package/src/components/menu/__workshop__/tones.tsx +0 -1
  44. package/src/components/menu/__workshop__/withoutArrow.tsx +0 -1
  45. package/src/components/menu/menu.test.tsx +3 -4
  46. package/src/components/menu/menu.tsx +1 -1
  47. package/src/components/menu/menuButton.tsx +1 -9
  48. package/src/components/menu/menuGroup.tsx +2 -2
  49. package/src/components/menu/menuItem.tsx +3 -3
  50. package/src/components/menu/useMenuController.ts +1 -1
  51. package/src/components/skeleton/__workshop__/delay.tsx +0 -1
  52. package/src/components/skeleton/__workshop__/skeleton.tsx +0 -1
  53. package/src/components/skeleton/skeleton.tsx +1 -1
  54. package/src/components/skeleton/textSkeleton.tsx +1 -1
  55. package/src/components/tab/__workshop__/example.tsx +1 -1
  56. package/src/components/tab/tab.tsx +2 -2
  57. package/src/components/tab/tabList.tsx +1 -1
  58. package/src/components/tab/tabPanel.tsx +1 -1
  59. package/src/components/toast/__workshop__/hook.tsx +0 -1
  60. package/src/components/toast/__workshop__/toast.tsx +0 -1
  61. package/src/components/toast/toast.test.tsx +3 -5
  62. package/src/components/toast/toast.tsx +0 -1
  63. package/src/components/toast/toastProvider.tsx +1 -1
  64. package/src/components/tree/__workshop__/basic.tsx +1 -1
  65. package/src/components/tree/tree.tsx +1 -1
  66. package/src/components/tree/treeGroup.tsx +1 -1
  67. package/src/components/tree/treeItem.tsx +4 -4
  68. package/src/hooks/useElementRect/__workshop__/example.tsx +0 -1
  69. package/src/hooks/useForwardedRef.ts +1 -1
  70. package/src/hooks/useMediaIndex/__workshop__/test.tsx +0 -1
  71. package/src/icons/__workshop__/overview.tsx +1 -1
  72. package/src/primitives/avatar/__workshop__/asButton.tsx +0 -1
  73. package/src/primitives/avatar/__workshop__/stack.tsx +0 -1
  74. package/src/primitives/avatar/avatar.tsx +2 -3
  75. package/src/primitives/avatar/avatarCounter.tsx +1 -1
  76. package/src/primitives/avatar/avatarStack.tsx +1 -1
  77. package/src/primitives/badge/__workshop__/props.tsx +0 -1
  78. package/src/primitives/badge/__workshop__/tones.tsx +0 -1
  79. package/src/primitives/badge/badge.test.tsx +13 -0
  80. package/src/primitives/badge/badge.tsx +1 -1
  81. package/src/primitives/box/__workshop__/props.tsx +0 -1
  82. package/src/primitives/box/__workshop__/responsive.tsx +0 -1
  83. package/src/primitives/box/box.tsx +1 -1
  84. package/src/primitives/button/__workshop__/custom.tsx +0 -1
  85. package/src/primitives/button/__workshop__/customIcons.tsx +0 -1
  86. package/src/primitives/button/__workshop__/mixedChildren.tsx +0 -1
  87. package/src/primitives/button/__workshop__/props.tsx +0 -1
  88. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +0 -1
  89. package/src/primitives/button/__workshop__/stacked.tsx +0 -1
  90. package/src/primitives/button/__workshop__/styled1.tsx +0 -1
  91. package/src/primitives/button/__workshop__/styled2.tsx +0 -1
  92. package/src/primitives/button/__workshop__/uploadButton.tsx +1 -1
  93. package/src/primitives/button/button.test.tsx +41 -0
  94. package/src/primitives/button/button.tsx +3 -3
  95. package/src/primitives/card/__workshop__/allTones.tsx +0 -1
  96. package/src/primitives/card/__workshop__/asButton.tsx +0 -1
  97. package/src/primitives/card/__workshop__/asComponent.tsx +1 -1
  98. package/src/primitives/card/__workshop__/checkered.tsx +0 -1
  99. package/src/primitives/card/__workshop__/interactive.tsx +0 -1
  100. package/src/primitives/card/__workshop__/listNavigation.tsx +0 -1
  101. package/src/primitives/card/__workshop__/props.tsx +0 -1
  102. package/src/primitives/card/__workshop__/selected.tsx +0 -1
  103. package/src/primitives/card/__workshop__/styled.tsx +0 -1
  104. package/src/primitives/card/card.tsx +1 -1
  105. package/src/primitives/checkbox/__workshop__/example.tsx +1 -1
  106. package/src/primitives/checkbox/__workshop__/props.tsx +0 -1
  107. package/src/primitives/checkbox/__workshop__/readOnly.tsx +0 -1
  108. package/src/primitives/checkbox/__workshop__/tones.tsx +0 -1
  109. package/src/primitives/checkbox/checkbox.tsx +1 -1
  110. package/src/primitives/code/__workshop__/opticalAlignment.tsx +0 -1
  111. package/src/primitives/code/__workshop__/props.tsx +0 -1
  112. package/src/primitives/code/code.tsx +1 -1
  113. package/src/primitives/container/__workshop__/example.tsx +0 -1
  114. package/src/primitives/container/container.tsx +1 -1
  115. package/src/primitives/flex/__workshop__/example.tsx +0 -1
  116. package/src/primitives/flex/__workshop__/gap.tsx +0 -1
  117. package/src/primitives/flex/flex.tsx +1 -1
  118. package/src/primitives/grid/__workshop__/responsive.tsx +0 -1
  119. package/src/primitives/grid/grid.tsx +1 -1
  120. package/src/primitives/heading/__workshop__/opticalAlignment.tsx +0 -1
  121. package/src/primitives/heading/__workshop__/plain.tsx +0 -1
  122. package/src/primitives/heading/heading.tsx +1 -1
  123. package/src/primitives/inline/__workshop__/plain.tsx +0 -1
  124. package/src/primitives/inline/inline.tsx +1 -1
  125. package/src/primitives/kbd/__workshop__/plain.tsx +0 -1
  126. package/src/primitives/kbd/kbd.tsx +1 -1
  127. package/src/primitives/label/__workshop__/opticalAlignment.tsx +0 -1
  128. package/src/primitives/label/__workshop__/plain.tsx +0 -1
  129. package/src/primitives/label/label.tsx +1 -1
  130. package/src/primitives/popover/__workshop__/MarginsStory.tsx +0 -1
  131. package/src/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -1
  132. package/src/primitives/popover/__workshop__/PlainStory.tsx +1 -1
  133. package/src/primitives/popover/__workshop__/RecursiveStory.tsx +1 -1
  134. package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +1 -1
  135. package/src/primitives/popover/__workshop__/TestStory.tsx +1 -1
  136. package/src/primitives/popover/arrow.tsx +1 -1
  137. package/src/primitives/popover/popover.tsx +1 -9
  138. package/src/primitives/radio/__workshop__/example.tsx +1 -1
  139. package/src/primitives/radio/__workshop__/plain.tsx +0 -1
  140. package/src/primitives/radio/radio.tsx +1 -1
  141. package/src/primitives/select/__workshop__/plain.tsx +0 -1
  142. package/src/primitives/select/__workshop__/readOnly.tsx +0 -1
  143. package/src/primitives/select/select.tsx +1 -1
  144. package/src/primitives/spinner/__workshop__/Props.tsx +0 -1
  145. package/src/primitives/spinner/spinner.tsx +1 -1
  146. package/src/primitives/stack/__workshop__/plain.tsx +0 -1
  147. package/src/primitives/stack/stack.tsx +1 -1
  148. package/src/primitives/switch/__workshop__/example.tsx +1 -1
  149. package/src/primitives/switch/__workshop__/props.tsx +1 -1
  150. package/src/primitives/switch/switch.tsx +1 -1
  151. package/src/primitives/text/__workshop__/colored.tsx +0 -1
  152. package/src/primitives/text/__workshop__/example.tsx +0 -1
  153. package/src/primitives/text/__workshop__/opticalAlignment.tsx +0 -1
  154. package/src/primitives/text/text.tsx +1 -1
  155. package/src/primitives/textArea/__workshop__/plain.tsx +0 -1
  156. package/src/primitives/textArea/textArea.tsx +1 -1
  157. package/src/primitives/textInput/__workshop__/clearButton.tsx +1 -1
  158. package/src/primitives/textInput/__workshop__/customValidity.tsx +0 -1
  159. package/src/primitives/textInput/__workshop__/multipleTones.tsx +0 -1
  160. package/src/primitives/textInput/__workshop__/plain.tsx +1 -1
  161. package/src/primitives/textInput/__workshop__/readOnly.tsx +0 -1
  162. package/src/primitives/textInput/__workshop__/states.tsx +0 -1
  163. package/src/primitives/textInput/__workshop__/tones.tsx +0 -1
  164. package/src/primitives/textInput/__workshop__/typed.tsx +1 -1
  165. package/src/primitives/textInput/textInput.tsx +4 -3
  166. package/src/primitives/tooltip/__workshop__/props.tsx +0 -1
  167. package/src/primitives/tooltip/tooltip.tsx +1 -1
  168. package/src/primitives/tooltip/tooltipArrow.tsx +1 -1
  169. package/src/styles/font/responsiveFont.ts +13 -0
  170. package/src/theme/__workshop__/canvas.tsx +1 -1
  171. package/src/theme/__workshop__/color.tsx +0 -1
  172. package/src/theme/__workshop__/layer.tsx +1 -1
  173. package/src/theme/__workshop__/nestedProvider.tsx +0 -1
  174. package/src/theme/theme.test.tsx +3 -5
  175. package/src/theme/themeColorProvider.tsx +0 -1
  176. package/src/theme/themeProvider.tsx +1 -1
  177. package/src/utils/boundaryElement/__workshop__/plain.tsx +1 -1
  178. package/src/utils/boundaryElement/boundaryElement.test.tsx +3 -5
  179. package/src/utils/boundaryElement/boundaryElementProvider.tsx +1 -1
  180. package/src/utils/elementQuery/__workshop__/customMedia.tsx +0 -1
  181. package/src/utils/elementQuery/elementQuery.tsx +1 -1
  182. package/src/utils/errorBoundary.tsx +4 -4
  183. package/src/utils/layer/__workshop__/_debug.tsx +0 -1
  184. package/src/utils/layer/__workshop__/multipleRoots.tsx +0 -1
  185. package/src/utils/layer/__workshop__/plain.tsx +1 -1
  186. package/src/utils/layer/__workshop__/responsiveZOffset.tsx +0 -1
  187. package/src/utils/layer/layer.test.tsx +3 -5
  188. package/src/utils/layer/layer.tsx +1 -1
  189. package/src/utils/layer/layerProvider.tsx +1 -1
  190. package/src/utils/portal/__workshop__/named.tsx +1 -1
  191. package/src/utils/portal/portal.test.tsx +3 -5
  192. package/src/utils/portal/portal.ts +2 -3
  193. package/src/utils/portal/portalProvider.tsx +1 -1
  194. package/src/utils/srOnly/srOnly.tsx +1 -1
  195. package/src/utils/virtualList/__workshop__/changingProps.tsx +1 -1
  196. package/src/utils/virtualList/__workshop__/elementScroll.tsx +1 -1
  197. package/src/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
  198. package/src/utils/virtualList/__workshop__/windowScrolll.tsx +1 -1
  199. package/src/utils/virtualList/virtualList.tsx +1 -1
  200. package/dist/sanity-ui.cjs +0 -1321
  201. package/dist/sanity-ui.cjs.map +0 -1
@@ -1,6 +1,5 @@
1
1
  import {Card, Code, Flex} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import styled from 'styled-components'
5
4
  import {WORKSHOP_FLEX_DIRECTION_OPTIONS} from '../../../__workshop__/constants'
6
5
 
@@ -1,5 +1,4 @@
1
1
  import {Card, Flex, Text} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function GapStory() {
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 {
@@ -1,5 +1,4 @@
1
1
  import {Card, Code, Container, Flex, Grid} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function ResponsiveStory() {
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 {responsiveGridStyle, ResponsiveGridStyleProps} from '../../styles/internal'
@@ -1,6 +1,5 @@
1
1
  import {AddCircleIcon} from '@sanity/icons'
2
2
  import {Box, Card, Flex, Heading, Stack} from '@sanity/ui'
3
- import React from 'react'
4
3
 
5
4
  export default function OpticalAlignment() {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import {Flex, Heading} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {
5
4
  WORKSHOP_HEADING_FONT_SIZE_OPTIONS,
6
5
  WORKSHOP_FONT_WEIGHT_OPTIONS,
@@ -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 {
@@ -1,6 +1,5 @@
1
1
  import {Card, Flex, Inline, Text} from '@sanity/ui'
2
2
  import {useAction, useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_SPACE_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function PlainStory() {
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, useMemo} from 'react'
1
+ import {forwardRef, useMemo} 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,4 @@
1
1
  import {Flex, KBD} 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, {css} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
@@ -1,6 +1,5 @@
1
1
  import {AddCircleIcon} from '@sanity/icons'
2
2
  import {Box, Card, Flex, Label, Stack} from '@sanity/ui'
3
- import React from 'react'
4
3
 
5
4
  export default function OpticalAlignment() {
6
5
  return (
@@ -1,6 +1,5 @@
1
1
  import {Flex, Label} from '@sanity/ui'
2
2
  import {useSelect, useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {
5
4
  WORKSHOP_LABEL_FONT_SIZE_OPTIONS,
6
5
  WORKSHOP_FONT_WEIGHT_OPTIONS,
@@ -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 {responsiveLabelFont, responsiveTextAlignStyle} from '../../styles/internal'
@@ -1,5 +1,4 @@
1
1
  import {Box, Card, Container, Flex, Popover, Text} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function MarginsStory() {
5
4
  return (
@@ -1,6 +1,5 @@
1
1
  import {Box, Button, Container, Flex, Popover, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function MatchReferenceWidthStory() {
@@ -1,6 +1,6 @@
1
1
  import {Button, Card, Popover, PortalProvider, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
- import React, {useState} from 'react'
3
+ import {useState} from 'react'
4
4
  import {
5
5
  WORKSHOP_CONTAINER_WIDTH_OPTIONS,
6
6
  WORKSHOP_PLACEMENT_OPTIONS,
@@ -7,7 +7,7 @@ import {
7
7
  ThemeColorToneKey,
8
8
  useLayer,
9
9
  } from '@sanity/ui'
10
- import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
10
+ import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
11
11
 
12
12
  export default function RecursiveStory() {
13
13
  return (
@@ -1,7 +1,7 @@
1
1
  import {EllipsisVerticalIcon} from '@sanity/icons'
2
2
  import {Button, Card, Flex, Popover, Text, useClickOutside} from '@sanity/ui'
3
3
  import {useBoolean} from '@sanity/ui-workshop'
4
- import React, {useCallback, useState} from 'react'
4
+ import {useCallback, useState} from 'react'
5
5
 
6
6
  export default function RightAlignedStory() {
7
7
  const constrainSize = useBoolean('Constrain size', false)
@@ -1,5 +1,5 @@
1
1
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
2
- import React, {ReactElement, useState} from 'react'
2
+ import {ReactElement, useState} from 'react'
3
3
  import {
4
4
  WORKSHOP_CONTAINER_WIDTH_OPTIONS,
5
5
  WORKSHOP_PLACEMENT_OPTIONS,
@@ -1,4 +1,4 @@
1
- import React, {forwardRef} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
 
4
4
  const Root = styled.div`
@@ -1,12 +1,4 @@
1
- import React, {
2
- cloneElement,
3
- forwardRef,
4
- useCallback,
5
- useEffect,
6
- useMemo,
7
- useRef,
8
- useState,
9
- } from 'react'
1
+ import {cloneElement, forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react'
10
2
  import {usePopper} from 'react-popper'
11
3
  import styled, {css} from 'styled-components'
12
4
  import {EMPTY_RECORD} from '../../constants'
@@ -1,6 +1,6 @@
1
1
  import {Box, Container, Flex, Radio, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean} from '@sanity/ui-workshop'
3
- import React, {useCallback, useState} from 'react'
3
+ import {useCallback, useState} from 'react'
4
4
 
5
5
  export default function ExampleStory() {
6
6
  const [value, setValue] = useState('first-option')
@@ -1,6 +1,5 @@
1
1
  import {Flex, Radio} from '@sanity/ui'
2
2
  import {useAction, useBoolean} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function PlainStory() {
6
5
  const checked = useBoolean('Checked?', false, 'Props')
@@ -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 {useForwardedRef, useCustomValidity} from '../../hooks'
4
4
  import {radioBaseStyle, inputElementStyle} from './styles'
@@ -1,6 +1,5 @@
1
1
  import {Card, Container, Label, Select, Stack} from '@sanity/ui'
2
2
  import {useBoolean} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function PlainStory() {
6
5
  const disabled = useBoolean('Disabled', false, 'Props')
@@ -1,5 +1,4 @@
1
1
  import {Card, Container, Label, Select, Stack} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function ReadOnlyStory() {
5
4
  return (
@@ -1,5 +1,5 @@
1
1
  import {SelectIcon} from '@sanity/icons'
2
- import React, {forwardRef} from 'react'
2
+ import {forwardRef} from 'react'
3
3
  import styled from 'styled-components'
4
4
  import {useForwardedRef, useCustomValidity, useArrayProp} from '../../hooks'
5
5
  import {Box} from '../box'
@@ -1,6 +1,5 @@
1
1
  import {Flex, Spinner} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_TEXT_SIZE_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function Props() {
@@ -1,5 +1,5 @@
1
1
  import {SpinnerIcon} from '@sanity/icons'
2
- import React, {forwardRef} from 'react'
2
+ import {forwardRef} from 'react'
3
3
  import styled, {keyframes} from 'styled-components'
4
4
  import {Text} from '../text'
5
5
 
@@ -1,6 +1,5 @@
1
1
  import {Card, Container, Flex, Stack, Text} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_SPACE_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function PlainStory() {
@@ -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 {Box, BoxProps} from '../box'
@@ -1,5 +1,5 @@
1
1
  import {Box, Flex, Switch, Text} from '@sanity/ui'
2
- import React, {useCallback, useState} from 'react'
2
+ import {useCallback, useState} from 'react'
3
3
 
4
4
  export default function ExampleStory() {
5
5
  const [checked, setChecked] = useState<boolean | undefined>(undefined)
@@ -1,6 +1,6 @@
1
1
  import {Flex, Switch, useTheme} from '@sanity/ui'
2
2
  import {useBoolean, useNumber} from '@sanity/ui-workshop'
3
- import React, {useCallback, useMemo} from 'react'
3
+ import {useCallback, useMemo} from 'react'
4
4
  import {ThemeProvider} from 'styled-components'
5
5
 
6
6
  export default function PropsStory() {
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, useEffect} from 'react'
1
+ import {forwardRef, useEffect} from 'react'
2
2
  import styled from 'styled-components'
3
3
  import {useForwardedRef} from '../../hooks'
4
4
  import {
@@ -1,6 +1,5 @@
1
1
  import {Flex, Text, Theme, ThemeColorSpotKey, useTheme} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import styled, {css} from 'styled-components'
5
4
  import {WORKSHOP_SPOT_COLOR_OPTIONS} from '../../../__workshop__/constants'
6
5
 
@@ -1,6 +1,5 @@
1
1
  import {Card, Container, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {
5
4
  WORKSHOP_TEXT_ALIGN_OPTIONS,
6
5
  WORKSHOP_TEXT_OVERFLOW_OPTIONS,
@@ -1,6 +1,5 @@
1
1
  import {AddCircleIcon} from '@sanity/icons'
2
2
  import {Box, Card, Flex, Stack, Text} from '@sanity/ui'
3
- import React from 'react'
4
3
 
5
4
  export default function OpticalAlignment() {
6
5
  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 {
@@ -1,6 +1,5 @@
1
1
  import {Card, Container, Flex, Stack, Text, TextArea} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {
5
4
  WORKSHOP_CARD_TONE_OPTIONS,
6
5
  WORKSHOP_FONT_WEIGHT_OPTIONS,
@@ -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 {useForwardedRef, useCustomValidity, useArrayProp} from '../../hooks'
4
4
  import {
@@ -1,6 +1,6 @@
1
1
  import {Box, TextInput} from '@sanity/ui'
2
2
  import {useText} from '@sanity/ui-workshop'
3
- import React, {useCallback, useState} from 'react'
3
+ import {useCallback, useState} from 'react'
4
4
 
5
5
  export default function ClearButtonStory() {
6
6
  const customValidity = useText('Custom validitiy')
@@ -1,6 +1,5 @@
1
1
  import {Button, Card, Container, Stack, TextInput} from '@sanity/ui'
2
2
  import {useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function CustomValidityStory() {
6
5
  const customValidity = useText('Custom validity', 'Invalid value', 'Props') || undefined
@@ -1,5 +1,4 @@
1
1
  import {Card, Stack, TextInput} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function MultipleTonesStory() {
5
4
  return (
@@ -2,7 +2,7 @@ import {icons, IconSymbol} from '@sanity/icons'
2
2
  import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
3
3
  import {PerfTestProps, useBoolean, usePerfTest, useSelect, useText} from '@sanity/ui-workshop'
4
4
  import {fireEvent} from '@testing-library/dom'
5
- import React, {useCallback, useState} from 'react'
5
+ import {useCallback, useState} from 'react'
6
6
  import {
7
7
  WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
8
8
  WORKSHOP_FONT_WEIGHT_OPTIONS,
@@ -1,5 +1,4 @@
1
1
  import {TextInput} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function ReadOnlyStory() {
5
4
  return <TextInput id="text-input-example" readOnly />
@@ -1,6 +1,5 @@
1
1
  import {Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
2
2
  import {useAction} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function StatesStory() {
6
5
  const onChange = useAction('onChange')
@@ -1,6 +1,5 @@
1
1
  import {Box, Card, Container, Flex, Stack, Text, TextInput} from '@sanity/ui'
2
2
  import {useBoolean} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
 
5
4
  export default function TonesStory() {
6
5
  const transparentTone = useBoolean('Transparent', true)
@@ -1,6 +1,6 @@
1
1
  import {Box, Container, TextInput} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import React, {useCallback, useState} from 'react'
3
+ import {useCallback, useState} from 'react'
4
4
  import {WORKSHOP_TEXT_INPUT_TYPE_OPTIONS} from '../../../__workshop__/constants'
5
5
 
6
6
  export default function TypedStory() {
@@ -1,5 +1,5 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import React, {createElement, forwardRef, isValidElement, useCallback, useMemo} from 'react'
2
+ import {createElement, forwardRef, isValidElement, useCallback, useMemo} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
4
  import styled from 'styled-components'
5
5
  import {EMPTY_RECORD} from '../../constants'
@@ -43,6 +43,7 @@ export type TextInputType =
43
43
  | 'time'
44
44
  | 'text'
45
45
  | 'week'
46
+ | 'color'
46
47
 
47
48
  /**
48
49
  * @public
@@ -55,8 +56,8 @@ export interface TextInputProps {
55
56
  clearButton?: boolean | TextInputClearButtonProps
56
57
  customValidity?: string
57
58
  fontSize?: number | number[]
58
- icon?: React.ComponentType | React.ReactNode
59
- iconRight?: React.ComponentType | React.ReactNode
59
+ icon?: React.ElementType | React.ReactNode
60
+ iconRight?: React.ElementType | React.ReactNode
60
61
  /**
61
62
  * @beta
62
63
  */
@@ -1,6 +1,5 @@
1
1
  import {Box, Button, Card, Flex, Text, Tooltip} from '@sanity/ui'
2
2
  import {useSelect, useText} from '@sanity/ui-workshop'
3
- import React from 'react'
4
3
  import {WORKSHOP_PLACEMENT_OPTIONS} from '../../../__workshop__/constants'
5
4
 
6
5
  export default function PropsStory() {
@@ -1,4 +1,4 @@
1
- import React, {cloneElement, forwardRef, useCallback, useEffect, useRef, useState} from 'react'
1
+ import {cloneElement, forwardRef, useCallback, useEffect, useRef, useState} from 'react'
2
2
  import {usePopper} from 'react-popper'
3
3
  import styled from 'styled-components'
4
4
  import {useArrayProp, useForwardedRef} from '../../hooks'
@@ -1,4 +1,4 @@
1
- import React, {forwardRef} from 'react'
1
+ import {forwardRef} from 'react'
2
2
  import styled from 'styled-components'
3
3
 
4
4
  const Root = styled.div`
@@ -48,6 +48,19 @@ export function responsiveFont(
48
48
  },
49
49
  }
50
50
 
51
+ // @TODO fix the real condition that is causing $size to be undefined sometimes
52
+ if (!$size) {
53
+ // @ts-expect-error: `warned` isn't typed, the underlying issue should be solved rather than typing it
54
+ if (!responsiveFont.warned) {
55
+ // eslint-disable-next-line no-console
56
+ console.warn('No size specified for responsive font', {fontKey, $size, props, base})
57
+ // @ts-expect-error: `warned` isn't typed, the underlying issue should be solved rather than typing it
58
+ responsiveFont.warned = true
59
+ }
60
+
61
+ return [base]
62
+ }
63
+
51
64
  const resp = _responsive(media, $size, (sizeIndex) => fontSize(sizes[sizeIndex] || defaultSize))
52
65
 
53
66
  return [base, ...resp]
@@ -22,7 +22,7 @@ import {
22
22
  useRootTheme,
23
23
  } from '@sanity/ui'
24
24
  import {useBoolean} from '@sanity/ui-workshop'
25
- import React, {createContext, useContext} from 'react'
25
+ import {createContext, useContext} from 'react'
26
26
  import {ThemeColorCard} from '../lib/theme'
27
27
 
28
28
  interface Features {
@@ -1,5 +1,4 @@
1
1
  import {Box, Card, Tree, TreeItem, useRootTheme} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function ColorStory() {
5
4
  const {theme} = useRootTheme()
@@ -1,5 +1,5 @@
1
1
  import {Box, Button, Container, Dialog, Flex, Popover, Stack, Text, Tooltip} from '@sanity/ui'
2
- import React, {useCallback, useState} from 'react'
2
+ import {useCallback, useState} from 'react'
3
3
 
4
4
  export default function LayerStory() {
5
5
  const [dialogOpen, setDialogOpen] = useState(false)
@@ -1,5 +1,4 @@
1
1
  import {Card, Flex, Text, ThemeProvider} from '@sanity/ui'
2
- import React from 'react'
3
2
 
4
3
  export default function NestedProviderStory() {
5
4
  return (
@@ -1,5 +1,3 @@
1
- import React from 'react'
2
- import {vi} from 'vitest'
3
1
  import {render} from '../../test'
4
2
  import {studioTheme} from './studioTheme'
5
3
  import {ThemeContext} from './themeContext'
@@ -9,7 +7,7 @@ import {useRootTheme} from './useRootTheme'
9
7
  describe('theme', () => {
10
8
  describe('useRootTheme', () => {
11
9
  it('should get context value', async () => {
12
- const log = vi.fn()
10
+ const log = jest.fn()
13
11
 
14
12
  function Debug() {
15
13
  const rootTheme = useRootTheme()
@@ -42,7 +40,7 @@ describe('theme', () => {
42
40
  })
43
41
 
44
42
  it('should fail when no context value is provided', async () => {
45
- const log = vi.fn()
43
+ const log = jest.fn()
46
44
 
47
45
  function Debug() {
48
46
  try {
@@ -70,7 +68,7 @@ describe('theme', () => {
70
68
  })
71
69
 
72
70
  it('should fail when context value is not compatible', async () => {
73
- const log = vi.fn()
71
+ const log = jest.fn()
74
72
 
75
73
  function Debug() {
76
74
  try {
@@ -1,4 +1,3 @@
1
- import React from 'react'
2
1
  import {ThemeColorName, ThemeColorSchemeKey} from './lib/theme'
3
2
  import {ThemeProvider} from './themeProvider'
4
3
  import {useRootTheme} from './useRootTheme'
@@ -1,4 +1,4 @@
1
- import React, {useContext, useMemo} from 'react'
1
+ import {useContext, useMemo} from 'react'
2
2
  import {ThemeProvider as StyledThemeProvider} from 'styled-components'
3
3
  import {DEFAULT_THEME_LAYER} from './defaults'
4
4
  import {ThemeColorSchemeKey, ThemeColorName} from './lib/theme'
@@ -1,5 +1,5 @@
1
1
  import {Box, BoundaryElementProvider, Button, Card, Text, Tooltip} from '@sanity/ui'
2
- import React, {useState} from 'react'
2
+ import {useState} from 'react'
3
3
 
4
4
  export default function PlainStory() {
5
5
  const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
@@ -1,5 +1,3 @@
1
- import React from 'react'
2
- import {vi} from 'vitest'
3
1
  import {render} from '../../../test'
4
2
  import {BoundaryElementContext} from './boundaryElementContext'
5
3
  import {BoundaryElementContextValue} from './types'
@@ -8,7 +6,7 @@ import {useBoundaryElement} from './useBoundaryElement'
8
6
  describe('utils/boundaryElement', () => {
9
7
  describe('useBoundaryElement', () => {
10
8
  it('should get context value', async () => {
11
- const log = vi.fn()
9
+ const log = jest.fn()
12
10
 
13
11
  function Debug() {
14
12
  const rootBoundaryElement = useBoundaryElement()
@@ -38,7 +36,7 @@ describe('utils/boundaryElement', () => {
38
36
  })
39
37
 
40
38
  it('should provide default value when no context value is provided', async () => {
41
- const log = vi.fn()
39
+ const log = jest.fn()
42
40
 
43
41
  function Debug() {
44
42
  const rootBoundaryElement = useBoundaryElement()
@@ -65,7 +63,7 @@ describe('utils/boundaryElement', () => {
65
63
  })
66
64
 
67
65
  it('should fail when context value is not compatible', async () => {
68
- const log = vi.fn()
66
+ const log = jest.fn()
69
67
 
70
68
  function Debug() {
71
69
  try {
@@ -1,4 +1,4 @@
1
- import React, {useMemo} from 'react'
1
+ import {useMemo} from 'react'
2
2
  import {BoundaryElementContext} from './boundaryElementContext'
3
3
  import {BoundaryElementContextValue} from './types'
4
4
 
@@ -1,5 +1,4 @@
1
1
  import {Box, Card, ElementQuery, Text} from '@sanity/ui'
2
- import React from 'react'
3
2
  import styled from 'styled-components'
4
3
 
5
4
  const TestCard = styled(Card)`
@@ -1,4 +1,4 @@
1
- import React, {forwardRef, useCallback, useMemo, useState} from 'react'
1
+ import {forwardRef, useCallback, useMemo, useState} from 'react'
2
2
  import {useElementSize, useForwardedRef} from '../../hooks'
3
3
  import {useTheme} from '../../theme'
4
4
  import {findMaxBreakpoints, findMinBreakpoints} from './helpers'