mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
29 lines
812 B
JavaScript
29 lines
812 B
JavaScript
"use client";
|
|
import { renderElement } from "../../utils/use-render.js";
|
|
import { useAlertDialogContext } from "./context.js";
|
|
import { forwardRef, useCallback } from "react";
|
|
//#region src/ui/alert-dialog/alert-dialog-close.tsx
|
|
const AlertDialogClose = forwardRef(function AlertDialogClose({ render, className, style, disabled, ...elementProps }, forwardedRef) {
|
|
const { dialog, state } = useAlertDialogContext();
|
|
const handleClick = useCallback(() => {
|
|
if (disabled) return;
|
|
dialog.close();
|
|
}, [dialog, disabled]);
|
|
return renderElement("button", {
|
|
render,
|
|
className,
|
|
style
|
|
}, {
|
|
state,
|
|
ref: [forwardedRef],
|
|
props: [{
|
|
type: "button",
|
|
disabled,
|
|
onClick: handleClick
|
|
}, elementProps]
|
|
});
|
|
});
|
|
//#endregion
|
|
export { AlertDialogClose };
|
|
|
|
//# sourceMappingURL=alert-dialog-close.js.map
|