@spark-ui/components
Version:
Spark (Leboncoin design system) components.
26 lines (25 loc) • 639 B
JavaScript
// src/slot/Slot.tsx
import { Slot as RadixSlot } from "radix-ui";
import {
cloneElement,
isValidElement
} from "react";
import { jsx } from "react/jsx-runtime";
var Slottable = RadixSlot.Slottable;
var Slot = ({ ref, ...props }) => {
return /* @__PURE__ */ jsx(RadixSlot.Root, { ref, ...props });
};
var wrapPolymorphicSlot = (asChild, children, callback) => {
if (!asChild) return callback(children);
return isValidElement(children) ? cloneElement(
children,
void 0,
callback(children.props.children)
) : null;
};
export {
Slottable,
Slot,
wrapPolymorphicSlot
};
//# sourceMappingURL=chunk-4F5DOL57.mjs.map