message: feat: Support `toggleOnClick` prop as a function
diff: import { MouseEvent, useCallback, useRef, useState } from "react";
  import {
  + useBooleanEventCallback,
  useEventCallback,
  useForkRef,
  useSafeLayoutEffect,
  @@ -9,7 +10,7 @@ import {
  createElement,
  createHook,
  } from "ariakit-utils/system";
  -import { As, Props } from "ariakit-utils/types";
  +import { As, BooleanOrCallback, Props } from "ariakit-utils/types";
  import { ButtonOptions, useButton } from "../button/button";
  import { DisclosureState } from "./disclosure-state";
  @@ -30,8 +31,6 @@ export const useDisclosure = createHook<DisclosureOptions>(
  ({ state, toggleOnClick = true, ...props }) => {
  const ref = useRef<HTMLButtonElement>(null);
  const [expanded, setExpanded] = useState(false);
  - const onClickProp = useEventCallback(props.onClick);
  - const isDuplicate = "data-disclosure" in props;
  useSafeLayoutEffect(() => {
  if (!state.disclosureRef.current) {
  @@ -41,20 +40,24 @@ export const useDisclosure = createHook<DisclosureOptions>(
  setExpanded(state.visible && isCurrentDisclosure);
  }, [state.disclosureRef, state.visible]);
  + const onClickProp = useEventCallback(props.onClick);
  + const toggleOnClickProp = useBooleanEventCallback(toggleOnClick);
  + const isDuplicate = "data-disclosure" in props;
  +
  const onClick = useCallback(
  (event: MouseEvent<HTMLButtonElement>) => {
  state.disclosureRef.current = event.currentTarget;
  onClickProp(event);
  if (event.defaultPrevented) return;
  if (isDuplicate) return;
  - if (!toggleOnClick) return;
  + if (!toggleOnClickProp(event)) return;
  state.toggle();
  },
  [
  state.disclosureRef,
  onClickProp,
  isDuplicate,
  - toggleOnClick,
  + toggleOnClickProp,
  state.toggle,
  ]
  );
  @@ -100,7 +103,7 @@ export type DisclosureOptions<T extends As = "button"> = ButtonOptions<T> & {
  * if you want to handle the toggle logic yourself.
  * @default true
  */
  - toggleOnClick?: boolean;
  + toggleOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
  };
  export type DisclosureProps<T extends As = "button"> = Props<
  