@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.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",