@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
23 lines (22 loc) • 744 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import { useDialogRoot } from "./context.js";
import { useSlot } from "../../../hooks/use-slot/index.js";
function DialogCloseImpl({ render, ...props }, ref) {
const ctx = useDialogRoot();
const internalProps = {
"aria-label": "Close dialog",
onClick: () => ctx.onOpenChange(false),
};
const final = useSlot({
props: [internalProps, props, { "data-ln-dialog-close": true }],
ref: ref,
slot: render ?? _jsx("button", {}),
state: {
open: ctx.open,
openChange: ctx.onOpenChange,
},
});
return final;
}
export const DialogClose = forwardRef(DialogCloseImpl);