import { jsx as _jsx } from "react/jsx-runtime";
import { useContext, useEffect, useRef } from "react";
import { LayoutContext } from "./layoutContext";
import { Slot } from "@radix-ui/react-slot";
export const Sider = (props)=>{
    const ref = useRef(null);
    const { asChild, ...rest } = props;
    const { setSiderWidth } = useContext(LayoutContext);
    useEffect(()=>{
        const boundingClientRect = ref.current?.getBoundingClientRect();
        if (boundingClientRect && boundingClientRect.height) {
            setSiderWidth(boundingClientRect.width);
        }
    }, []);
    const Comp = asChild ? Slot : "div";
    return /*#__PURE__*/ _jsx(Comp, {
        ...rest,
        ref: ref
    });
};
Sider.displayName = "Sider";

//# sourceMappingURL=sider.js.map