@sanity/ui 1.0.0-next.3 → 1.0.1

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 (146) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -2
  3. package/dist/{types/src/index.d.ts → index.d.ts} +4450 -4398
  4. package/dist/{sanity-ui.esm.js → index.esm.js} +889 -2678
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/{sanity-ui.js → index.js} +883 -2688
  7. package/dist/index.js.map +1 -0
  8. package/package.json +114 -23
  9. package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  10. package/src/components/autocomplete/__workshop__/example.tsx +1 -1
  11. package/src/components/autocomplete/__workshop__/index.ts +36 -32
  12. package/src/components/autocomplete/autocomplete.styles.tsx +22 -28
  13. package/src/components/autocomplete/autocomplete.tsx +1 -2
  14. package/src/components/autocomplete/constants.ts +3 -8
  15. package/src/components/breadcrumbs/__workshop__/index.ts +11 -7
  16. package/src/components/breadcrumbs/breadcrumbs.styles.ts +13 -18
  17. package/src/components/dialog/__workshop__/index.ts +13 -9
  18. package/src/components/dialog/dialog.tsx +53 -67
  19. package/src/components/hotkeys/__workshop__/index.ts +11 -3
  20. package/src/components/hotkeys/hotkeys.tsx +12 -16
  21. package/src/components/menu/__workshop__/index.ts +71 -67
  22. package/src/components/menu/menu.tsx +5 -7
  23. package/src/components/menu/menuButton.tsx +16 -14
  24. package/src/components/menu/menuDivider.ts +8 -10
  25. package/src/components/skeleton/__workshop__/index.ts +8 -4
  26. package/src/components/skeleton/skeleton.tsx +4 -6
  27. package/src/components/skeleton/styles.ts +13 -9
  28. package/src/components/skeleton/textSkeleton.tsx +12 -14
  29. package/src/components/tab/__workshop__/index.ts +11 -3
  30. package/src/components/toast/__workshop__/index.ts +16 -4
  31. package/src/components/toast/toast.tsx +6 -11
  32. package/src/components/toast/toastProvider.tsx +18 -22
  33. package/src/components/tree/__workshop__/basic.perf.ts +1 -14
  34. package/src/components/tree/__workshop__/basic.tsx +1 -1
  35. package/src/components/tree/__workshop__/index.ts +12 -8
  36. package/src/components/tree/style.ts +78 -76
  37. package/src/components/tree/treeItem.tsx +7 -12
  38. package/src/global.ts +6 -0
  39. package/src/hooks/useElementRect/__workshop__/index.ts +11 -3
  40. package/src/hooks/useMediaIndex/__workshop__/index.ts +11 -3
  41. package/src/primitives/_selectable/selectable.tsx +4 -7
  42. package/src/primitives/_selectable/style.ts +85 -82
  43. package/src/primitives/avatar/__workshop__/index.ts +16 -12
  44. package/src/primitives/avatar/avatar.tsx +9 -12
  45. package/src/primitives/avatar/avatarCounter.tsx +22 -24
  46. package/src/primitives/avatar/avatarStack.tsx +16 -14
  47. package/src/primitives/avatar/styles.ts +1 -1
  48. package/src/primitives/badge/__workshop__/index.ts +16 -12
  49. package/src/primitives/badge/__workshop__/tones.tsx +1 -1
  50. package/src/primitives/badge/badge.tsx +6 -5
  51. package/src/primitives/box/__workshop__/index.ts +16 -4
  52. package/src/primitives/box/box.tsx +21 -49
  53. package/src/primitives/button/__workshop__/index.ts +51 -47
  54. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +19 -20
  55. package/src/primitives/button/__workshop__/styled1.tsx +6 -6
  56. package/src/primitives/button/button.tsx +20 -26
  57. package/src/primitives/button/styles.ts +30 -29
  58. package/src/primitives/card/__workshop__/index.ts +15 -11
  59. package/src/primitives/card/card.tsx +9 -25
  60. package/src/primitives/card/styles.ts +119 -114
  61. package/src/primitives/checkbox/__workshop__/index.ts +10 -6
  62. package/src/primitives/checkbox/checkbox.tsx +4 -4
  63. package/src/primitives/checkbox/styles.ts +71 -69
  64. package/src/primitives/code/__workshop__/index.ts +16 -12
  65. package/src/primitives/code/code.tsx +3 -5
  66. package/src/primitives/code/styles.ts +20 -18
  67. package/src/primitives/container/__workshop__/index.ts +5 -3
  68. package/src/primitives/container/container.tsx +5 -4
  69. package/src/primitives/flex/__workshop__/index.ts +8 -4
  70. package/src/primitives/flex/flex.tsx +7 -23
  71. package/src/primitives/grid/__workshop__/index.ts +7 -3
  72. package/src/primitives/grid/grid.tsx +4 -27
  73. package/src/primitives/heading/__workshop__/index.ts +16 -12
  74. package/src/primitives/heading/heading.tsx +10 -17
  75. package/src/primitives/heading/styles.ts +45 -36
  76. package/src/primitives/inline/__workshop__/index.ts +5 -3
  77. package/src/primitives/inline/inline.tsx +3 -5
  78. package/src/primitives/kbd/__workshop__/index.ts +5 -3
  79. package/src/primitives/kbd/kbd.tsx +12 -13
  80. package/src/primitives/label/__workshop__/index.ts +16 -12
  81. package/src/primitives/label/label.tsx +13 -18
  82. package/src/primitives/label/styles.ts +24 -18
  83. package/src/primitives/popover/__workshop__/PlainStory.tsx +0 -1
  84. package/src/primitives/popover/__workshop__/TestStory.tsx +0 -1
  85. package/src/primitives/popover/__workshop__/index.ts +36 -32
  86. package/src/primitives/popover/constants.ts +0 -3
  87. package/src/primitives/popover/floating-ui/size.ts +40 -25
  88. package/src/primitives/popover/popover.tsx +220 -196
  89. package/src/primitives/popover/popoverArrow.tsx +42 -48
  90. package/src/primitives/popover/popoverCard.tsx +12 -22
  91. package/src/primitives/radio/__workshop__/index.ts +8 -4
  92. package/src/primitives/radio/radio.tsx +3 -3
  93. package/src/primitives/radio/styles.ts +73 -73
  94. package/src/primitives/select/__workshop__/index.ts +8 -4
  95. package/src/primitives/select/select.tsx +9 -11
  96. package/src/primitives/select/styles.ts +77 -77
  97. package/src/primitives/spinner/__workshop__/index.ts +11 -7
  98. package/src/primitives/spinner/spinner.tsx +2 -5
  99. package/src/primitives/stack/__workshop__/index.ts +11 -7
  100. package/src/primitives/stack/stack.tsx +3 -5
  101. package/src/primitives/switch/__workshop__/index.ts +8 -4
  102. package/src/primitives/switch/styles.ts +119 -112
  103. package/src/primitives/switch/switch.tsx +6 -6
  104. package/src/primitives/text/__workshop__/index.ts +21 -17
  105. package/src/primitives/text/styles.ts +51 -45
  106. package/src/primitives/text/text.tsx +11 -16
  107. package/src/primitives/textArea/__workshop__/index.ts +11 -7
  108. package/src/primitives/textArea/textArea.tsx +15 -22
  109. package/src/primitives/textInput/__workshop__/index.ts +46 -42
  110. package/src/primitives/textInput/__workshop__/plain.tsx +2 -1
  111. package/src/primitives/textInput/textInput.tsx +50 -69
  112. package/src/primitives/tooltip/__workshop__/index.ts +11 -7
  113. package/src/primitives/tooltip/tooltip.tsx +3 -6
  114. package/src/primitives/tooltip/tooltipArrow.tsx +69 -59
  115. package/src/styles/border/borderStyle.ts +10 -18
  116. package/src/styles/box/boxStyle.ts +14 -18
  117. package/src/styles/flex/flexItemStyle.ts +7 -1
  118. package/src/styles/flex/flexStyle.ts +14 -9
  119. package/src/styles/grid/gridItemStyle.ts +18 -30
  120. package/src/styles/grid/gridStyle.ts +25 -33
  121. package/src/styles/helpers.ts +2 -2
  122. package/src/styles/index.ts +0 -1
  123. package/src/styles/input/textInputStyle.ts +127 -123
  124. package/src/styles/margin/marginStyle.ts +11 -10
  125. package/src/styles/margin/marginsStyle.test.ts +12 -10
  126. package/src/styles/padding/paddingStyle.test.ts +12 -10
  127. package/src/styles/padding/paddingStyle.ts +9 -10
  128. package/src/theme/__workshop__/index.ts +26 -22
  129. package/src/theme/{ThemeContext.ts → themeContext.ts} +0 -0
  130. package/src/utils/boundaryElement/__workshop__/index.ts +11 -7
  131. package/src/utils/elementQuery/__workshop__/index.ts +11 -7
  132. package/src/utils/layer/__workshop__/index.ts +21 -17
  133. package/src/utils/layer/layer.tsx +4 -6
  134. package/src/utils/portal/__workshop__/index.ts +11 -7
  135. package/src/utils/srOnly/srOnly.tsx +8 -10
  136. package/src/utils/virtualList/__workshop__/index.ts +26 -22
  137. package/src/utils/virtualList/virtualList.tsx +10 -14
  138. package/dist/sanity-ui.esm.js.map +0 -1
  139. package/dist/sanity-ui.js.map +0 -1
  140. package/src/__workshop__/color/overview.tsx +0 -101
  141. package/src/__workshop__/index.ts +0 -10
  142. package/src/icons/__workshop__/.eslintrc +0 -5
  143. package/src/icons/__workshop__/index.tsx +0 -6
  144. package/src/icons/__workshop__/overview.tsx +0 -76
  145. package/src/styles/compose.ts +0 -35
  146. package/src/utils/srOnly/__workshop__/.eslintrc +0 -5
@@ -1,4 +1,4 @@
1
- import {forwardRef, memo} 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'
@@ -14,22 +14,18 @@ export interface HotkeysProps {
14
14
  keys?: string[]
15
15
  }
16
16
 
17
- const Root = memo(
18
- styled.kbd({
19
- '&:not([hidden])': {
20
- display: 'block',
21
- },
22
- font: 'inherit',
23
- })
24
- )
17
+ const Root = styled.kbd`
18
+ &:not([hidden]) {
19
+ display: block;
20
+ }
21
+ font: inherit;
22
+ `
25
23
 
26
- const Key = memo(
27
- styled(KBD)({
28
- '&:not([hidden])': {
29
- display: 'block',
30
- },
31
- })
32
- )
24
+ const Key = styled(KBD)`
25
+ &:not([hidden]) {
26
+ display: block;
27
+ }
28
+ `
33
29
 
34
30
  /**
35
31
  * @public
@@ -1,70 +1,74 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/menu', 'Menu', [
5
- {
6
- name: 'menu-button',
7
- title: 'MenuButton',
8
- component: lazy(() => import('./menuButton')),
9
- },
10
- {
11
- name: 'nested-menu-items',
12
- title: 'Nested MenuItems',
13
- component: lazy(() => import('./nestedMenu')),
14
- },
15
- {
16
- name: 'custom-menu-item',
17
- title: 'Custom MenuItem',
18
- component: lazy(() => import('./customMenuItem')),
19
- },
20
- {
21
- name: 'groups',
22
- title: 'Groups',
23
- component: lazy(() => import('./groups')),
24
- },
25
- {
26
- name: 'menu-group-right',
27
- title: 'Menu group (right)',
28
- component: lazy(() => import('./menuGroupRight')),
29
- },
30
- {
31
- name: 'tones',
32
- title: 'Tones',
33
- component: lazy(() => import('./tones')),
34
- },
35
- {
36
- name: 'selected-item',
37
- title: 'Selected item',
38
- component: lazy(() => import('./selectedItem')),
39
- },
40
- {
41
- name: 'closable',
42
- title: 'Closeable',
43
- component: lazy(() => import('./closableMenuButton')),
44
- },
45
- {
46
- name: 'without-arrow',
47
- title: 'Without arrow',
48
- component: lazy(() => import('./withoutArrow')),
49
- },
50
- {
51
- name: 'constrained-in-boundary',
52
- title: 'Constrained in boundary',
53
- component: lazy(() => import('./constrainedInBoundary')),
54
- },
55
- {
56
- name: 'as-component',
57
- title: 'As component',
58
- component: lazy(() => import('./asComponent')),
59
- },
60
- {
61
- name: 'disable-focus-on-close',
62
- title: 'Disable focus on close',
63
- component: lazy(() => import('./disableFocusOnClose')),
64
- },
65
- {
66
- name: 'menu-button-with-on-close',
67
- title: 'MenuButton with on close',
68
- component: lazy(() => import('./onCloseMenuButton')),
69
- },
70
- ])
4
+ export default defineScope({
5
+ name: 'components/menu',
6
+ title: 'Menu',
7
+ stories: [
8
+ {
9
+ name: 'menu-button',
10
+ title: 'MenuButton',
11
+ component: lazy(() => import('./menuButton')),
12
+ },
13
+ {
14
+ name: 'nested-menu-items',
15
+ title: 'Nested MenuItems',
16
+ component: lazy(() => import('./nestedMenu')),
17
+ },
18
+ {
19
+ name: 'custom-menu-item',
20
+ title: 'Custom MenuItem',
21
+ component: lazy(() => import('./customMenuItem')),
22
+ },
23
+ {
24
+ name: 'groups',
25
+ title: 'Groups',
26
+ component: lazy(() => import('./groups')),
27
+ },
28
+ {
29
+ name: 'menu-group-right',
30
+ title: 'Menu group (right)',
31
+ component: lazy(() => import('./menuGroupRight')),
32
+ },
33
+ {
34
+ name: 'tones',
35
+ title: 'Tones',
36
+ component: lazy(() => import('./tones')),
37
+ },
38
+ {
39
+ name: 'selected-item',
40
+ title: 'Selected item',
41
+ component: lazy(() => import('./selectedItem')),
42
+ },
43
+ {
44
+ name: 'closable',
45
+ title: 'Closeable',
46
+ component: lazy(() => import('./closableMenuButton')),
47
+ },
48
+ {
49
+ name: 'without-arrow',
50
+ title: 'Without arrow',
51
+ component: lazy(() => import('./withoutArrow')),
52
+ },
53
+ {
54
+ name: 'constrained-in-boundary',
55
+ title: 'Constrained in boundary',
56
+ component: lazy(() => import('./constrainedInBoundary')),
57
+ },
58
+ {
59
+ name: 'as-component',
60
+ title: 'As component',
61
+ component: lazy(() => import('./asComponent')),
62
+ },
63
+ {
64
+ name: 'disable-focus-on-close',
65
+ title: 'Disable focus on close',
66
+ component: lazy(() => import('./disableFocusOnClose')),
67
+ },
68
+ {
69
+ name: 'menu-button-with-on-close',
70
+ title: 'MenuButton with on close',
71
+ component: lazy(() => import('./onCloseMenuButton')),
72
+ },
73
+ ],
74
+ })
@@ -1,4 +1,4 @@
1
- import {forwardRef, memo, 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'
@@ -29,12 +29,10 @@ export interface MenuProps extends ResponsivePaddingProps {
29
29
  space?: number | number[]
30
30
  }
31
31
 
32
- const Root = memo(
33
- styled(Box)({
34
- outline: 'none',
35
- overflow: 'auto',
36
- })
37
- )
32
+ const Root = styled(Box)`
33
+ outline: none;
34
+ overflow: auto;
35
+ `
38
36
 
39
37
  /**
40
38
  * @public
@@ -228,28 +228,30 @@ export const MenuButton = forwardRef(function MenuButton(
228
228
  [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]
229
229
  )
230
230
 
231
- const popoverProps: PopoverProps = useMemo(() => {
232
- return {
231
+ const popoverProps: MenuButtonProps['popover'] = useMemo(
232
+ () => ({
233
233
  boundaryElement: deprecated_boundaryElement,
234
+ overflow: 'auto',
234
235
  placement: deprecated_placement,
235
236
  portal: deprecated_portal,
236
- radius: deprecated_popoverRadius,
237
237
  preventOverflow: deprecated_preventOverflow,
238
+ radius: deprecated_popoverRadius,
238
239
  scheme: deprecated_popoverScheme,
239
240
  ...(popover || {}),
240
- }
241
- }, [
242
- deprecated_boundaryElement,
243
- deprecated_preventOverflow,
244
- deprecated_placement,
245
- popover,
246
- deprecated_popoverRadius,
247
- deprecated_portal,
248
- deprecated_popoverScheme,
249
- ])
241
+ }),
242
+ [
243
+ deprecated_boundaryElement,
244
+ deprecated_placement,
245
+ deprecated_popoverRadius,
246
+ deprecated_popoverScheme,
247
+ deprecated_portal,
248
+ deprecated_preventOverflow,
249
+ popover,
250
+ ]
251
+ )
250
252
 
251
253
  return (
252
- <Popover {...popoverProps} content={menu} data-ui="MenuButton__popover" open={open}>
254
+ <Popover data-ui="MenuButton__popover" {...popoverProps} content={menu} open={open}>
253
255
  {button || <></>}
254
256
  </Popover>
255
257
  )
@@ -1,14 +1,12 @@
1
- import {memo} from 'react'
2
- import styled from 'styled-components'
1
+ import styled, {StyledComponent} from 'styled-components'
2
+ import {Theme} from '../../theme'
3
3
 
4
4
  /**
5
5
  * @public
6
6
  */
7
- export const MenuDivider = memo(
8
- styled.hr({
9
- height: '1px',
10
- border: 0,
11
- background: 'var(--card-hairline-soft-color)',
12
- margin: 0,
13
- })
14
- )
7
+ export const MenuDivider: StyledComponent<'hr', Theme> = styled.hr`
8
+ height: 1px;
9
+ border: 0;
10
+ background: var(--card-hairline-soft-color);
11
+ margin: 0;
12
+ `
@@ -1,7 +1,11 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/skeleton', 'Skeleton', [
5
- {name: 'skeleton', title: 'Skeleton', component: lazy(() => import('./skeleton'))},
6
- {name: 'skeleton-delay', title: 'Skeleton delay', component: lazy(() => import('./delay'))},
7
- ])
4
+ export default defineScope({
5
+ name: 'components/skeleton',
6
+ title: 'Skeleton',
7
+ stories: [
8
+ {name: 'skeleton', title: 'Skeleton', component: lazy(() => import('./skeleton'))},
9
+ {name: 'skeleton-delay', title: 'Skeleton delay', component: lazy(() => import('./delay'))},
10
+ ],
11
+ })
@@ -1,4 +1,4 @@
1
- import {forwardRef, memo, 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'
@@ -6,11 +6,9 @@ import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
6
6
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
7
7
  import {skeletonStyle} from './styles'
8
8
 
9
- const Root = memo(
10
- styled(Box)<{$animated: boolean; $visible: boolean} & ResponsiveRadiusStyleProps>(
11
- responsiveRadiusStyle,
12
- skeletonStyle
13
- )
9
+ const Root = styled(Box)<{$animated: boolean; $visible: boolean} & ResponsiveRadiusStyleProps>(
10
+ responsiveRadiusStyle,
11
+ skeletonStyle
14
12
  )
15
13
 
16
14
  /**
@@ -1,13 +1,13 @@
1
1
  import {css, keyframes} from 'styled-components'
2
2
 
3
- const keyframe = keyframes({
4
- '0%': {
5
- backgroundPosition: '100%',
6
- },
7
- '100%': {
8
- backgroundPosition: '-100%',
9
- },
10
- })
3
+ const keyframe = keyframes`
4
+ 0% {
5
+ background-position: 100%;
6
+ }
7
+ 100% {
8
+ background-position: -100%;
9
+ }
10
+ `
11
11
 
12
12
  const animation = css`
13
13
  background-image: linear-gradient(
@@ -37,7 +37,11 @@ export const skeletonStyle = css<{$animated: boolean; $visible: boolean}>`
37
37
 
38
38
  @media screen and (prefers-reduced-motion: no-preference) {
39
39
  ${({$animated}) =>
40
- $animated ? animation : {backgroundColor: 'var(--card-skeleton-color-from)'}}
40
+ $animated
41
+ ? animation
42
+ : css`
43
+ background-color: var(--card-skeleton-color-from);
44
+ `}
41
45
  }
42
46
 
43
47
  @media screen and (prefers-reduced-motion: reduce) {
@@ -1,26 +1,24 @@
1
- import {forwardRef, memo} 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'
5
5
  import {Theme, ThemeFontKey} from '../../theme'
6
6
  import {Skeleton, SkeletonProps} from './skeleton'
7
7
 
8
- const Root = memo(
9
- styled(Skeleton)<{$size: number[]; $style: ThemeFontKey}>(
10
- ({$size, $style, theme}: {$size: number[]; $style: ThemeFontKey; theme: Theme}) => {
11
- const {media} = theme.sanity
12
- const font = theme.sanity.fonts[$style]
8
+ const Root = styled(Skeleton)<{$size: number[]; $style: ThemeFontKey}>(
9
+ ({$size, $style, theme}: {$size: number[]; $style: ThemeFontKey; theme: Theme}) => {
10
+ const {media} = theme.sanity
11
+ const font = theme.sanity.fonts[$style]
13
12
 
14
- const styles = _responsive(media, $size, (sizeIndex) => {
15
- const fontSize = font.sizes[sizeIndex]
16
- const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight
13
+ const styles = _responsive(media, $size, (sizeIndex) => {
14
+ const fontSize = font.sizes[sizeIndex]
15
+ const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight
17
16
 
18
- return {height: capHeight}
19
- })
17
+ return {height: capHeight}
18
+ })
20
19
 
21
- return styles
22
- }
23
- )
20
+ return styles
21
+ }
24
22
  )
25
23
 
26
24
  /**
@@ -1,6 +1,14 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/tab', 'Tab', [
5
- {name: 'example', title: 'Example', component: lazy(() => import('./example'))},
6
- ])
4
+ export default defineScope({
5
+ name: 'components/tab',
6
+ title: 'Tab',
7
+ stories: [
8
+ {
9
+ name: 'example',
10
+ title: 'Example',
11
+ component: lazy(() => import('./example')),
12
+ },
13
+ ],
14
+ })
@@ -1,7 +1,19 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/toast', 'Toast', [
5
- {name: 'toast', title: 'Toast', component: lazy(() => import('./toast'))},
6
- {name: 'hook', title: 'Hook', component: lazy(() => import('./hook'))},
7
- ])
4
+ export default defineScope({
5
+ name: 'components/toast',
6
+ title: 'Toast',
7
+ stories: [
8
+ {
9
+ name: 'toast',
10
+ title: 'Toast',
11
+ component: lazy(() => import('./toast')),
12
+ },
13
+ {
14
+ name: 'hook',
15
+ title: 'Hook',
16
+ component: lazy(() => import('./hook')),
17
+ },
18
+ ],
19
+ })
@@ -1,5 +1,4 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import {memo} 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'
@@ -29,17 +28,13 @@ const ROLES = {
29
28
  info: 'alert',
30
29
  }
31
30
 
32
- const Root = memo(
33
- styled(Card)({
34
- pointerEvents: 'all',
35
- })
36
- )
31
+ const Root = styled(Card)`
32
+ pointer-events: all;
33
+ `
37
34
 
38
- const TextBox = memo(
39
- styled(Flex)({
40
- overflowX: 'auto',
41
- })
42
- )
35
+ const TextBox = styled(Flex)`
36
+ overflow-x: auto;
37
+ `
43
38
 
44
39
  /**
45
40
  * @public
@@ -1,5 +1,5 @@
1
1
  import {AnimatePresence, motion} from 'framer-motion'
2
- import {memo, 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'
@@ -26,27 +26,23 @@ export interface ToastProviderProps {
26
26
  zOffset?: number | number[]
27
27
  }
28
28
 
29
- const Root = memo(
30
- styled(Layer)({
31
- position: 'fixed',
32
- top: 0,
33
- left: 0,
34
- right: 0,
35
- bottom: 0,
36
- pointerEvents: 'none',
37
- })
38
- )
39
-
40
- const ToastContainer = memo(
41
- styled.div({
42
- boxSizing: 'border-box',
43
- position: 'absolute',
44
- right: 0,
45
- bottom: 0,
46
- maxWidth: '420px',
47
- width: '100%',
48
- })
49
- )
29
+ const Root = styled(Layer)`
30
+ position: fixed;
31
+ top: 0;
32
+ left: 0;
33
+ right: 0;
34
+ bottom: 0;
35
+ pointer-events: none;
36
+ `
37
+
38
+ const ToastContainer = styled.div`
39
+ box-sizing: border-box;
40
+ position: absolute;
41
+ right: 0;
42
+ bottom: 0;
43
+ max-width: 420px;
44
+ width: 100%;
45
+ `
50
46
 
51
47
  let toastId = 0
52
48
 
@@ -1,10 +1,6 @@
1
- import {PerfTestProps, PerfTestRunFn} from '@sanity/ui-workshop'
1
+ import {PerfTestProps, PerfTestRunFn} from '@sanity/ui-workshop/plugin-perf'
2
2
  import {findByTestId, fireEvent} from '@testing-library/dom'
3
3
 
4
- // // function delay(ms: number) {
5
- // // return new Promise((resolve) => setTimeout(resolve, ms))
6
- // // }
7
-
8
4
  function test<ElementType = unknown>(
9
5
  title: string,
10
6
  run: PerfTestRunFn<ElementType>
@@ -12,17 +8,8 @@ function test<ElementType = unknown>(
12
8
  return {name: title, run}
13
9
  }
14
10
 
15
- // export const toggleTreeGroupsTest = perfTest(
16
- // 'Toggle tree groups',
17
- // async ({target}: {target: HTMLDivElement}) => {
18
-
19
- // }
20
- // )
21
-
22
11
  export const perfTests = [
23
12
  test('Toggle tree groups', async ({target}: {target: HTMLDivElement}) => {
24
- // await delay(50)
25
-
26
13
  const apples = await findByTestId(target, 'apples')
27
14
  const oranges = await findByTestId(target, 'oranges')
28
15
 
@@ -1,6 +1,6 @@
1
1
  import {LinkIcon} from '@sanity/icons'
2
2
  import {Box, Tree, TreeItem} from '@sanity/ui'
3
- import {usePerfTest} from '@sanity/ui-workshop'
3
+ import {usePerfTest} from '@sanity/ui-workshop/plugin-perf'
4
4
  import {useCallback, useState} from 'react'
5
5
  import {perfTests} from './basic.perf'
6
6
 
@@ -1,11 +1,15 @@
1
1
  import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
- export default defineScope('components/tree', 'Tree', [
5
- {
6
- name: 'basic',
7
- title: 'Basic',
8
- component: lazy(() => import('./basic')),
9
- // options: {perfTests: () => import('./basic.perf')},
10
- },
11
- ])
4
+ export default defineScope({
5
+ name: 'components/tree',
6
+ title: 'Tree',
7
+ stories: [
8
+ {
9
+ name: 'basic',
10
+ title: 'Basic',
11
+ component: lazy(() => import('./basic')),
12
+ // options: {perfTests: () => import('./basic.perf')},
13
+ },
14
+ ],
15
+ })