import * as r from "react";
function f(l) {
  const {
    focusableWhenDisabled: e,
    disabled: o,
    composite: t = !1,
    tabIndex: i = 0,
    isNativeButton: s
  } = l, n = t && e !== !1, b = t && e === !1;
  return {
    props: r.useMemo(() => {
      const a = {
        // allow Tabbing away from focusableWhenDisabled elements
        onKeyDown(d) {
          o && e && d.key !== "Tab" && d.preventDefault();
        }
      };
      return t || (a.tabIndex = i, !s && o && (a.tabIndex = e ? i : -1)), (s && (e || n) || !s && o) && (a["aria-disabled"] = o), s && (!e || b) && (a.disabled = o), a;
    }, [t, o, e, n, b, s, i])
  };
}
export {
  f as useFocusableWhenDisabled
};
