@sanity/ui 1.6.0 → 1.7.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.
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +8 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tree/__workshop__/index.ts +6 -0
- package/src/components/tree/__workshop__/tabFromElement.tsx +83 -0
- package/src/components/tree/tree.tsx +12 -1
- package/src/components/tree/treeItem.tsx +7 -1
package/dist/index.js
CHANGED
|
@@ -8973,6 +8973,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
8973
8973
|
const {
|
|
8974
8974
|
children,
|
|
8975
8975
|
space = 1,
|
|
8976
|
+
onFocus,
|
|
8976
8977
|
...restProps
|
|
8977
8978
|
} = props;
|
|
8978
8979
|
const forwardedRef = useForwardedRef(ref);
|
|
@@ -9104,6 +9105,10 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
9104
9105
|
return;
|
|
9105
9106
|
}
|
|
9106
9107
|
}, [itemElements]);
|
|
9108
|
+
const handleFocus = react.useCallback(event => {
|
|
9109
|
+
setFocusedElement(event.target);
|
|
9110
|
+
onFocus == null ? void 0 : onFocus(event);
|
|
9111
|
+
}, [onFocus]);
|
|
9107
9112
|
react.useEffect(() => {
|
|
9108
9113
|
if (!forwardedRef.current) return;
|
|
9109
9114
|
const _itemElements = Array.from(forwardedRef.current.querySelectorAll('[data-ui="TreeItem"]'));
|
|
@@ -9115,6 +9120,7 @@ const Tree = react.memo(react.forwardRef(function Tree2(props, ref) {
|
|
|
9115
9120
|
as: "ul",
|
|
9116
9121
|
"data-ui": "Tree",
|
|
9117
9122
|
...restProps,
|
|
9123
|
+
onFocus: handleFocus,
|
|
9118
9124
|
onKeyDown: handleKeyDown,
|
|
9119
9125
|
ref: forwardedRef,
|
|
9120
9126
|
role: "tree",
|
|
@@ -9188,6 +9194,7 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9188
9194
|
href,
|
|
9189
9195
|
icon,
|
|
9190
9196
|
id: idProp,
|
|
9197
|
+
linkAs,
|
|
9191
9198
|
muted,
|
|
9192
9199
|
onClick,
|
|
9193
9200
|
padding = 3,
|
|
@@ -9285,6 +9292,7 @@ const TreeItem = react.memo(function TreeItem2(props) {
|
|
|
9285
9292
|
children: [/* @__PURE__ */jsxRuntime.jsx(TreeItemBox, {
|
|
9286
9293
|
$level: tree.level,
|
|
9287
9294
|
"aria-expanded": expanded,
|
|
9295
|
+
as: linkAs,
|
|
9288
9296
|
"data-ui": "TreeItem__box",
|
|
9289
9297
|
href,
|
|
9290
9298
|
ref: treeitemRef,
|