@sanity/ui 0.37.5 → 0.37.6

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 (41) hide show
  1. package/lib/dts/components/autocomplete/autocomplete.d.ts.map +1 -1
  2. package/lib/dts/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
  3. package/lib/dts/components/menu/useMenuController.d.ts.map +1 -1
  4. package/lib/dts/components/tab/tab.d.ts +1 -1
  5. package/lib/dts/components/tab/tab.d.ts.map +1 -1
  6. package/lib/dts/components/tree/tree.d.ts +1 -1
  7. package/lib/dts/components/tree/tree.d.ts.map +1 -1
  8. package/lib/dts/components/tree/treeGroup.d.ts +1 -1
  9. package/lib/dts/components/tree/treeGroup.d.ts.map +1 -1
  10. package/lib/dts/components/tree/treeItem.d.ts +1 -1
  11. package/lib/dts/components/tree/treeItem.d.ts.map +1 -1
  12. package/lib/dts/hooks/usePrefersDark.d.ts.map +1 -1
  13. package/lib/dts/primitives/textInput/textInput.d.ts.map +1 -1
  14. package/lib/dts/styles/input/textInputStyle.d.ts.map +1 -1
  15. package/lib/dts/utils/errorBoundary.d.ts.map +1 -1
  16. package/lib/sanity-ui.js +64 -37
  17. package/lib/sanity-ui.js.map +1 -1
  18. package/lib/sanity-ui.modern.js +76 -38
  19. package/lib/sanity-ui.modern.js.map +1 -1
  20. package/lib/sanity-ui.module.js +65 -38
  21. package/lib/sanity-ui.module.js.map +1 -1
  22. package/package.json +10 -10
  23. package/src/components/autocomplete/__workshop__/custom.tsx +10 -4
  24. package/src/components/autocomplete/__workshop__/example.tsx +38 -15
  25. package/src/components/autocomplete/__workshop__/fullscreen.tsx +31 -30
  26. package/src/components/autocomplete/autocomplete.styles.tsx +1 -0
  27. package/src/components/autocomplete/autocomplete.tsx +24 -3
  28. package/src/components/menu/useMenuController.ts +4 -8
  29. package/src/components/tab/tab.tsx +1 -1
  30. package/src/components/tree/__workshop__/basic.perf.ts +32 -0
  31. package/src/components/tree/__workshop__/basic.tsx +92 -56
  32. package/src/components/tree/__workshop__/index.ts +6 -1
  33. package/src/components/tree/tree.tsx +168 -144
  34. package/src/components/tree/treeGroup.tsx +3 -3
  35. package/src/components/tree/treeItem.tsx +4 -4
  36. package/src/hooks/usePrefersDark.ts +10 -4
  37. package/src/primitives/textInput/__workshop__/plain.tsx +49 -18
  38. package/src/primitives/textInput/textInput.tsx +23 -3
  39. package/src/styles/input/textInputStyle.ts +2 -0
  40. package/src/theme/{themeContext.ts → ThemeContext.ts} +0 -0
  41. package/src/utils/errorBoundary.tsx +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "0.37.5",
3
+ "version": "0.37.6",
4
4
  "sideEffects": false,
5
5
  "source": "./src/index.ts",
6
6
  "exports": {
@@ -29,24 +29,24 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@juggle/resize-observer": "^3.3.1",
32
- "@popperjs/core": "^2.11.2",
32
+ "@popperjs/core": "^2.11.4",
33
33
  "@reach/auto-id": "^0.16.0",
34
34
  "@sanity/color": "^2.1.8",
35
- "@sanity/icons": "^1.2.5",
36
- "framer-motion": "6.2.1",
35
+ "@sanity/icons": "^1.2.6",
36
+ "framer-motion": "6.2.8",
37
37
  "popper-max-size-modifier": "^0.2.0",
38
38
  "react-is": "^17.0.2",
39
39
  "react-popper": "^2.2.5",
40
- "react-refractor": "^2.1.5"
40
+ "react-refractor": "^2.1.6"
41
41
  },
42
42
  "devDependencies": {
43
- "@testing-library/dom": "^8.11.2",
44
- "@testing-library/jest-dom": "^5.16.1",
45
- "@testing-library/react": "^12.1.2",
43
+ "@testing-library/dom": "^8.12.0",
44
+ "@testing-library/jest-dom": "^5.16.3",
45
+ "@testing-library/react": "^12.1.3",
46
46
  "@types/refractor": "^3.0.2",
47
47
  "react": "^17.0.2",
48
48
  "react-dom": "^17.0.2",
49
- "styled-components": "^5.3.3"
49
+ "styled-components": "^5.3.5"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^16.9 || ^17",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "76a63b3f77763f28121655ef15485e6fb0f92786"
73
+ "gitHead": "d537879301eb41b50e56045bf4d7772720bf58d3"
74
74
  }
@@ -1,7 +1,11 @@
1
1
  import {Autocomplete, Box, Button, Card, Code, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect} from '@sanity/ui-workshop'
3
3
  import React, {useCallback, useState} from 'react'
4
- import {WORKSHOP_RADIUS_OPTIONS, WORKSHOP_TEXT_SIZE_OPTIONS} from '../../../__workshop__/constants'
4
+ import {
5
+ WORKSHOP_RADIUS_OPTIONS,
6
+ WORKSHOP_SPACE_OPTIONS,
7
+ WORKSHOP_TEXT_SIZE_OPTIONS,
8
+ } from '../../../__workshop__/constants'
5
9
  import countries from '../__fixtures__/countries'
6
10
  import {ExampleOption} from './types'
7
11
 
@@ -11,6 +15,7 @@ export default function CustomStory() {
11
15
  const disabled = useBoolean('Disabled', false, 'Props')
12
16
  const fontSize = Number(useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props'))
13
17
  const openButton = useBoolean('Open button', true, 'Props')
18
+ const padding = useSelect('Padding', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
14
19
  const radius = Number(useSelect('Radius', WORKSHOP_RADIUS_OPTIONS, 2, 'Props'))
15
20
  const readOnly = useBoolean('Read only', false, 'Props')
16
21
  const [value, setValue] = useState('')
@@ -23,13 +28,13 @@ export default function CustomStory() {
23
28
  href="#"
24
29
  key={option.value}
25
30
  onClick={(event) => event.preventDefault()}
26
- padding={3}
31
+ padding={padding}
27
32
  radius={radius - 1}
28
33
  >
29
- <Text>{option.title}</Text>
34
+ <Text size={fontSize}>{option.title}</Text>
30
35
  </Card>
31
36
  ),
32
- [radius]
37
+ [fontSize, padding, radius]
33
38
  )
34
39
 
35
40
  const renderValue = useCallback((currentValue: string, option?: ExampleOption) => {
@@ -58,6 +63,7 @@ export default function CustomStory() {
58
63
  onChange={setValue}
59
64
  openButton={openButton}
60
65
  options={options}
66
+ padding={padding}
61
67
  placeholder="Search"
62
68
  radius={radius}
63
69
  readOnly={readOnly}
@@ -1,5 +1,7 @@
1
1
  import {Autocomplete, Box, Card, Container, Stack, Text} from '@sanity/ui'
2
2
  import {useBoolean, useSelect, useText} from '@sanity/ui-workshop'
3
+ import {PerfTestProps, usePerfTest} from '@sanity/ui-workshop'
4
+ import {fireEvent} from '@testing-library/dom'
3
5
  import React, {useCallback, useMemo, useState} from 'react'
4
6
  import {
5
7
  WORKSHOP_CARD_TONE_OPTIONS,
@@ -9,7 +11,25 @@ import {
9
11
  } from '../../../__workshop__/constants'
10
12
  import countries from '../__fixtures__/countries'
11
13
 
14
+ const typingPerfTest: PerfTestProps<HTMLInputElement> = {
15
+ name: 'typing',
16
+ title: 'Typing',
17
+ description: 'This test types one character at a time',
18
+ run({target}) {
19
+ const text = 'Hello, world & Hello, world & Hello, world'
20
+ const len = text.length
21
+
22
+ for (let i = 0; i < len; i += 1) {
23
+ const value = text.slice(0, i + 1)
24
+
25
+ fireEvent.change(target, {target: {value}})
26
+ }
27
+ },
28
+ }
29
+
12
30
  export default function ExampleStory() {
31
+ const {ref, Wrapper} = usePerfTest(typingPerfTest)
32
+
13
33
  const layoutTone = useSelect('Layout tone', WORKSHOP_CARD_TONE_OPTIONS, 'default', 'Layout')
14
34
  const options = useMemo(() => countries.map((country) => ({value: country.code})), [])
15
35
  const border = useBoolean('Border', true, 'Props')
@@ -32,21 +52,24 @@ export default function ExampleStory() {
32
52
  <Text as="label" htmlFor="default" size={1} weight="semibold">
33
53
  Country code
34
54
  </Text>
35
- <Autocomplete
36
- border={border}
37
- customValidity={customValidity}
38
- disabled={disabled}
39
- fontSize={fontSize}
40
- onChange={handleChange}
41
- id="default"
42
- openButton={openButton}
43
- options={options}
44
- padding={padding}
45
- placeholder="Search"
46
- radius={radius}
47
- readOnly={readOnly}
48
- value={value}
49
- />
55
+ <Wrapper>
56
+ <Autocomplete
57
+ border={border}
58
+ customValidity={customValidity}
59
+ disabled={disabled}
60
+ fontSize={fontSize}
61
+ onChange={handleChange}
62
+ id="default"
63
+ openButton={openButton}
64
+ options={options}
65
+ padding={padding}
66
+ placeholder="Search"
67
+ radius={radius}
68
+ readOnly={readOnly}
69
+ ref={ref}
70
+ value={value}
71
+ />
72
+ </Wrapper>
50
73
  </Stack>
51
74
  </Box>
52
75
  </Container>
@@ -183,7 +183,7 @@ export default function Fullscreen() {
183
183
  <Button
184
184
  aria-label="Open search"
185
185
  icon={SearchIcon}
186
- mode="bleed"
186
+ mode="ghost"
187
187
  onClick={handleOpen}
188
188
  ref={openSearchButtonElementRef}
189
189
  />
@@ -191,35 +191,36 @@ export default function Fullscreen() {
191
191
  </Card>
192
192
  <Layer hidden={!open} style={{position: 'sticky', top: 0}}>
193
193
  <Card padding={2} shadow={1}>
194
- <Flex align="center">
195
- <Box flex={1} paddingRight={2}>
196
- <Autocomplete
197
- filterOption={filterOption}
198
- icon={SearchIcon}
199
- id="fullsceen-example"
200
- listBox={{padding: 2}}
201
- loading={loading}
202
- onQueryChange={handleQueryChange}
203
- onSelect={handleSelect}
204
- options={options}
205
- placeholder="Search"
206
- radius={2}
207
- ref={inputRef}
208
- relatedElements={relatedElements}
209
- renderOption={renderOption}
210
- renderPopover={renderPopover}
211
- renderValue={renderValue}
212
- value={value}
213
- />
214
- </Box>
215
- <Button
216
- aria-label="Close search"
217
- icon={CloseIcon}
218
- onClick={handleClose}
219
- mode="bleed"
220
- ref={setCloseSearchButtonElement}
221
- />
222
- </Flex>
194
+ <Autocomplete
195
+ filterOption={filterOption}
196
+ icon={SearchIcon}
197
+ id="fullsceen-example"
198
+ listBox={{padding: 2}}
199
+ loading={loading}
200
+ onQueryChange={handleQueryChange}
201
+ onSelect={handleSelect}
202
+ options={options}
203
+ placeholder="Search"
204
+ radius={2}
205
+ ref={inputRef}
206
+ relatedElements={relatedElements}
207
+ renderOption={renderOption}
208
+ renderPopover={renderPopover}
209
+ renderValue={renderValue}
210
+ suffix={
211
+ <Box padding={1}>
212
+ <Button
213
+ aria-label="Close search"
214
+ icon={CloseIcon}
215
+ onClick={handleClose}
216
+ padding={2}
217
+ mode="bleed"
218
+ ref={setCloseSearchButtonElement}
219
+ />
220
+ </Box>
221
+ }
222
+ value={value}
223
+ />
223
224
  </Card>
224
225
  </Layer>
225
226
  <Card flex={1} hidden={!open} ref={setPortalElement} style={{position: 'relative'}} />
@@ -7,6 +7,7 @@ import {Box, Popover} from '../../primitives'
7
7
  */
8
8
  export const Root = styled.div`
9
9
  /* position: relative; */
10
+ line-height: 0;
10
11
  `
11
12
 
12
13
  /**
@@ -134,6 +134,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
134
134
  renderOption: renderOptionProp,
135
135
  renderPopover,
136
136
  renderValue = defaultRenderValue,
137
+ suffix,
137
138
  value: valueProp,
138
139
  ...restProps
139
140
  } = props
@@ -429,8 +430,28 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
429
430
  return undefined
430
431
  }, [disabled, handleClearButtonFocus, loading, value])
431
432
 
432
- const openButtonBoxPadding = useMemo(() => padding.map((v) => v - 2), [padding])
433
- const openButtonPadding = useMemo(() => padding.map((v) => v - 1), [padding])
433
+ const openButtonBoxPadding = useMemo(
434
+ () =>
435
+ padding.map((v) => {
436
+ if (v === 0) return 0
437
+ if (v === 1) return 1
438
+ if (v === 2) return 1
439
+
440
+ return v - 2
441
+ }),
442
+ [padding]
443
+ )
444
+ const openButtonPadding = useMemo(
445
+ () =>
446
+ padding.map((v) => {
447
+ if (v === 0) return 0
448
+ if (v === 1) return 0
449
+ if (v === 2) return 1
450
+
451
+ return v - 1
452
+ }),
453
+ [padding]
454
+ )
434
455
  const openButtonProps: AutocompleteOpenButtonProps = useMemo(
435
456
  () => (typeof openButton === 'object' ? openButton : EMPTY_RECORD),
436
457
  [openButton]
@@ -520,7 +541,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
520
541
  ref={setRef}
521
542
  role="combobox"
522
543
  spellCheck={false}
523
- suffix={openButtonNode}
544
+ suffix={suffix || openButtonNode}
524
545
  value={inputValue}
525
546
  />
526
547
  )
@@ -26,15 +26,11 @@ export function useMenuController(props: {
26
26
  shouldFocus: 'first' | 'last' | null
27
27
  }): MenuController {
28
28
  const {onKeyDown, originElement, shouldFocus} = props
29
-
30
29
  const elementsRef = useRef<HTMLElement[]>([])
31
-
32
30
  const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)
33
31
  const [activeIndex, _setActiveIndex] = useState(-1)
34
-
35
- const activeElement = elementsRef.current[activeIndex] || null
36
32
  const activeIndexRef = useRef(activeIndex)
37
-
33
+ const activeElement = elementsRef.current[activeIndex] || null
38
34
  const mounted = Boolean(rootElement)
39
35
 
40
36
  const setActiveIndex = useCallback((nextActiveIndex) => {
@@ -122,7 +118,7 @@ export function useMenuController(props: {
122
118
 
123
119
  if (focusableLen === 0) return
124
120
 
125
- const focusedElement = elementsRef.current[activeIndex]
121
+ const focusedElement = elementsRef.current[activeIndexRef.current]
126
122
 
127
123
  let focusedIndex = focusableElements.indexOf(focusedElement)
128
124
 
@@ -145,7 +141,7 @@ export function useMenuController(props: {
145
141
 
146
142
  if (focusableLen === 0) return
147
143
 
148
- const focusedElement = elementsRef.current[activeIndex]
144
+ const focusedElement = elementsRef.current[activeIndexRef.current]
149
145
 
150
146
  let focusedIndex = focusableElements.indexOf(focusedElement)
151
147
 
@@ -163,7 +159,7 @@ export function useMenuController(props: {
163
159
  onKeyDown(event)
164
160
  }
165
161
  },
166
- [activeIndex, onKeyDown, originElement, setActiveIndex]
162
+ [onKeyDown, originElement, setActiveIndex]
167
163
  )
168
164
 
169
165
  const handleItemMouseEnter = useCallback(
@@ -26,7 +26,7 @@ export interface TabProps {
26
26
  */
27
27
  export const Tab = forwardRef(function Tab(
28
28
  props: TabProps &
29
- Omit<React.HTMLProps<HTMLButtonElement>, 'aria-controls' | 'as' | 'id' | 'type'>,
29
+ Omit<React.HTMLProps<HTMLButtonElement>, 'aria-controls' | 'as' | 'id' | 'label' | 'type'>,
30
30
  forwardedRef: React.ForwardedRef<HTMLButtonElement>
31
31
  ) {
32
32
  const {
@@ -0,0 +1,32 @@
1
+ import {PerfTestProps, PerfTestRunFn} from '@sanity/ui-workshop'
2
+ import {findByTestId, fireEvent} from '@testing-library/dom'
3
+
4
+ // // function delay(ms: number) {
5
+ // // return new Promise((resolve) => setTimeout(resolve, ms))
6
+ // // }
7
+
8
+ function test<ElementType = unknown>(
9
+ title: string,
10
+ run: PerfTestRunFn<ElementType>
11
+ ): PerfTestProps<ElementType> {
12
+ return {name: title, run}
13
+ }
14
+
15
+ // export const toggleTreeGroupsTest = perfTest(
16
+ // 'Toggle tree groups',
17
+ // async ({target}: {target: HTMLDivElement}) => {
18
+
19
+ // }
20
+ // )
21
+
22
+ export const perfTests = [
23
+ test('Toggle tree groups', async ({target}: {target: HTMLDivElement}) => {
24
+ // await delay(50)
25
+
26
+ const apples = await findByTestId(target, 'apples')
27
+ const oranges = await findByTestId(target, 'oranges')
28
+
29
+ fireEvent.click(apples)
30
+ fireEvent.click(oranges)
31
+ }),
32
+ ]
@@ -1,68 +1,104 @@
1
1
  import {LinkIcon} from '@sanity/icons'
2
2
  import {Box, Tree, TreeItem} from '@sanity/ui'
3
- import React from 'react'
3
+ import {usePerfTest} from '@sanity/ui-workshop'
4
+ import React, {useCallback, useState} from 'react'
5
+ import {perfTests} from './basic.perf'
4
6
 
5
7
  export default function BasicStory() {
8
+ const {ref, Wrapper} = usePerfTest(perfTests[0])
9
+
10
+ const [id, setId] = useState('')
11
+
12
+ const handleClick = useCallback((event: React.MouseEvent) => {
13
+ event.preventDefault()
14
+
15
+ const testid = event.currentTarget.getAttribute('data-testid')
16
+
17
+ if (testid) setId(testid)
18
+ }, [])
19
+
6
20
  return (
7
21
  <Box padding={[4, 5, 6]}>
8
- <Tree space={1}>
9
- <TreeItem expanded text="Fruit">
10
- <TreeItem text="Oranges" />
11
- <TreeItem text="Pineapple" selected />
12
- <TreeItem text="Apples">
13
- <TreeItem href="#apples-macintosh" icon={LinkIcon} text="Macintosh" />
14
- <TreeItem text="Granny Smith" />
15
- <TreeItem text="Fuji" />
16
- </TreeItem>
17
- <TreeItem text="Bananas" />
18
- <TreeItem text="Pears">
19
- <TreeItem text="Anjou" />
20
- <TreeItem text="Bartlett" />
21
- <TreeItem text="Bosc" />
22
- <TreeItem text="Concorde" />
23
- <TreeItem text="Seckel" />
24
- <TreeItem text="Starkrimson" />
25
- </TreeItem>
26
- </TreeItem>
27
- <TreeItem text="Vegetables">
28
- <TreeItem text="Podded vegetables">
29
- <TreeItem text="Lentil" />
30
- <TreeItem text="Pea" />
31
- <TreeItem text="Peanut" />
32
- </TreeItem>
33
- <TreeItem text="Bulb and stem vegetables">
34
- <TreeItem text="Asparagus" />
35
- <TreeItem text="Celery" />
36
- <TreeItem text="Leek" />
37
- <TreeItem text="Onion" />
38
- </TreeItem>
39
- <TreeItem text="Root and tuberous vegetables">
40
- <TreeItem text="Carrot" />
41
- <TreeItem text="Ginger" />
42
- <TreeItem text="Parsnip" />
43
- <TreeItem text="Potato" />
44
- </TreeItem>
45
- </TreeItem>
46
- <TreeItem text="Grains">
47
- <TreeItem text="Cereal grains">
48
- <TreeItem text="Barley" />
49
- <TreeItem text="Oats" />
50
- <TreeItem text="Rice" />
22
+ <Wrapper>
23
+ <Tree ref={ref} space={1}>
24
+ <TreeItem onClick={handleClick} expanded text="Fruit">
25
+ <TreeItem
26
+ data-testid="oranges"
27
+ onClick={handleClick}
28
+ selected={id === 'oranges'}
29
+ text="Oranges"
30
+ />
31
+ <TreeItem
32
+ data-testid="pineapples"
33
+ onClick={handleClick}
34
+ text="Pineapples"
35
+ selected={id === 'pineapples'}
36
+ />
37
+ <TreeItem data-testid="apples" onClick={handleClick} text="Apples">
38
+ <TreeItem
39
+ data-testid="apples/macintosh"
40
+ onClick={handleClick}
41
+ href="/apples/macintosh"
42
+ icon={LinkIcon}
43
+ text="Macintosh"
44
+ />
45
+ <TreeItem
46
+ data-testid="apples/granny-smith"
47
+ onClick={handleClick}
48
+ text="Granny Smith"
49
+ />
50
+ <TreeItem data-testid="apples/fuji" onClick={handleClick} text="Fuji" />
51
+ </TreeItem>
52
+ <TreeItem onClick={handleClick} text="Bananas" />
53
+ <TreeItem onClick={handleClick} text="Pears">
54
+ <TreeItem onClick={handleClick} text="Anjou" />
55
+ <TreeItem onClick={handleClick} text="Bartlett" />
56
+ <TreeItem onClick={handleClick} text="Bosc" />
57
+ <TreeItem onClick={handleClick} text="Concorde" />
58
+ <TreeItem onClick={handleClick} text="Seckel" />
59
+ <TreeItem onClick={handleClick} text="Starkrimson" />
60
+ </TreeItem>
51
61
  </TreeItem>
52
- <TreeItem text="Pseudocereal grains">
53
- <TreeItem text="Amaranth" />
54
- <TreeItem text="Buckwheat" />
55
- <TreeItem text="Chia" />
56
- <TreeItem text="Quinoa" />
62
+ <TreeItem onClick={handleClick} text="Vegetables">
63
+ <TreeItem onClick={handleClick} text="Podded vegetables">
64
+ <TreeItem onClick={handleClick} text="Lentil" />
65
+ <TreeItem onClick={handleClick} text="Pea" />
66
+ <TreeItem onClick={handleClick} text="Peanut" />
67
+ </TreeItem>
68
+ <TreeItem onClick={handleClick} text="Bulb and stem vegetables">
69
+ <TreeItem onClick={handleClick} text="Asparagus" />
70
+ <TreeItem onClick={handleClick} text="Celery" />
71
+ <TreeItem onClick={handleClick} text="Leek" />
72
+ <TreeItem onClick={handleClick} text="Onion" />
73
+ </TreeItem>
74
+ <TreeItem onClick={handleClick} text="Root and tuberous vegetables">
75
+ <TreeItem onClick={handleClick} text="Carrot" />
76
+ <TreeItem onClick={handleClick} text="Ginger" />
77
+ <TreeItem onClick={handleClick} text="Parsnip" />
78
+ <TreeItem onClick={handleClick} text="Potato" />
79
+ </TreeItem>
57
80
  </TreeItem>
58
- <TreeItem text="Oilseeds">
59
- <TreeItem text="India mustard" />
60
- <TreeItem text="Safflower" />
61
- <TreeItem text="Flax seed" />
62
- <TreeItem text="Poppy seed" />
81
+ <TreeItem onClick={handleClick} text="Grains">
82
+ <TreeItem onClick={handleClick} text="Cereal grains">
83
+ <TreeItem onClick={handleClick} text="Barley" />
84
+ <TreeItem onClick={handleClick} text="Oats" />
85
+ <TreeItem onClick={handleClick} text="Rice" />
86
+ </TreeItem>
87
+ <TreeItem onClick={handleClick} text="Pseudocereal grains">
88
+ <TreeItem onClick={handleClick} text="Amaranth" />
89
+ <TreeItem onClick={handleClick} text="Buckwheat" />
90
+ <TreeItem onClick={handleClick} text="Chia" />
91
+ <TreeItem onClick={handleClick} text="Quinoa" />
92
+ </TreeItem>
93
+ <TreeItem onClick={handleClick} text="Oilseeds">
94
+ <TreeItem onClick={handleClick} text="India mustard" />
95
+ <TreeItem onClick={handleClick} text="Safflower" />
96
+ <TreeItem onClick={handleClick} text="Flax seed" />
97
+ <TreeItem onClick={handleClick} text="Poppy seed" />
98
+ </TreeItem>
63
99
  </TreeItem>
64
- </TreeItem>
65
- </Tree>
100
+ </Tree>
101
+ </Wrapper>
66
102
  </Box>
67
103
  )
68
104
  }
@@ -2,5 +2,10 @@ import {defineScope} from '@sanity/ui-workshop'
2
2
  import {lazy} from 'react'
3
3
 
4
4
  export default defineScope('components/tree', 'Tree', [
5
- {name: 'basic', title: 'Basic', component: lazy(() => import('./basic'))},
5
+ {
6
+ name: 'basic',
7
+ title: 'Basic',
8
+ component: lazy(() => import('./basic')),
9
+ // options: {perfTests: () => import('./basic.perf')},
10
+ },
6
11
  ])