@sanity/ui 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tree/treeItem.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ToggleArrowRightIcon} from '@sanity/icons'
|
|
2
2
|
import {createElement, memo, useCallback, useEffect, useId, useMemo, useRef} from 'react'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
|
-
import {Box, Flex, Text} from '../../primitives'
|
|
4
|
+
import {Box, BoxProps, Flex, Text} from '../../primitives'
|
|
5
5
|
import {ThemeFontWeightKey} from '../../theme'
|
|
6
6
|
import {
|
|
7
7
|
treeItemRootStyle,
|
|
@@ -20,6 +20,10 @@ export interface TreeItemProps {
|
|
|
20
20
|
expanded?: boolean
|
|
21
21
|
fontSize?: number | number[]
|
|
22
22
|
icon?: React.ElementType
|
|
23
|
+
/**
|
|
24
|
+
* Allows passing a custom element type to the link component
|
|
25
|
+
*/
|
|
26
|
+
linkAs?: BoxProps['as']
|
|
23
27
|
padding?: number | number[]
|
|
24
28
|
space?: number | number[]
|
|
25
29
|
text?: React.ReactNode
|
|
@@ -50,6 +54,7 @@ export const TreeItem = memo(function TreeItem(
|
|
|
50
54
|
href,
|
|
51
55
|
icon,
|
|
52
56
|
id: idProp,
|
|
57
|
+
linkAs,
|
|
53
58
|
muted,
|
|
54
59
|
onClick,
|
|
55
60
|
padding = 3,
|
|
@@ -152,6 +157,7 @@ export const TreeItem = memo(function TreeItem(
|
|
|
152
157
|
<TreeItemBox
|
|
153
158
|
$level={tree.level}
|
|
154
159
|
aria-expanded={expanded}
|
|
160
|
+
as={linkAs}
|
|
155
161
|
data-ui="TreeItem__box"
|
|
156
162
|
href={href}
|
|
157
163
|
ref={treeitemRef}
|