@sanity/ui 1.7.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.esm.js +6 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -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/dist/index.esm.js
CHANGED
|
@@ -8960,6 +8960,7 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
|
|
|
8960
8960
|
const {
|
|
8961
8961
|
children,
|
|
8962
8962
|
space = 1,
|
|
8963
|
+
onFocus,
|
|
8963
8964
|
...restProps
|
|
8964
8965
|
} = props;
|
|
8965
8966
|
const forwardedRef = useForwardedRef(ref);
|
|
@@ -9091,6 +9092,10 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
|
|
|
9091
9092
|
return;
|
|
9092
9093
|
}
|
|
9093
9094
|
}, [itemElements]);
|
|
9095
|
+
const handleFocus = useCallback(event => {
|
|
9096
|
+
setFocusedElement(event.target);
|
|
9097
|
+
onFocus == null ? void 0 : onFocus(event);
|
|
9098
|
+
}, [onFocus]);
|
|
9094
9099
|
useEffect(() => {
|
|
9095
9100
|
if (!forwardedRef.current) return;
|
|
9096
9101
|
const _itemElements = Array.from(forwardedRef.current.querySelectorAll('[data-ui="TreeItem"]'));
|
|
@@ -9102,6 +9107,7 @@ const Tree = memo(forwardRef(function Tree2(props, ref) {
|
|
|
9102
9107
|
as: "ul",
|
|
9103
9108
|
"data-ui": "Tree",
|
|
9104
9109
|
...restProps,
|
|
9110
|
+
onFocus: handleFocus,
|
|
9105
9111
|
onKeyDown: handleKeyDown,
|
|
9106
9112
|
ref: forwardedRef,
|
|
9107
9113
|
role: "tree",
|