UNPKG

@alice-ui/react

Version:
36 lines (33 loc) 1.07 kB
import { InternalModalContext } from "./chunk-HKYLAWFX.mjs"; import { _CloseButton } from "./chunk-YUCFLMMG.mjs"; // src/modal/modal-close-button.tsx import { callAllHandlers, clsx } from "@alice-ui/shared-utils"; import { forwardRef, useContext } from "react"; import { OverlayTriggerStateContext } from "react-aria-components"; import { jsx } from "react/jsx-runtime"; function ModalCloseButton(props, ref) { const { children, className, onPress, ...otherProps } = props; const state = useContext(OverlayTriggerStateContext); const { slots, classNames } = useContext(InternalModalContext); return /* @__PURE__ */ jsx( _CloseButton, { ref, className: slots.closeButton({ class: clsx(classNames == null ? void 0 : classNames.closeButton, className) }), onPress: callAllHandlers(onPress, () => state == null ? void 0 : state.close()), radius: "full", variant: "light", size: "sm", ...otherProps, children } ); } var _ModalCloseButton = forwardRef(ModalCloseButton); export { _ModalCloseButton };