@spark-ui/components
Version:
Spark (Leboncoin design system) components.
51 lines (49 loc) • 1.8 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/slot/index.ts
var slot_exports = {};
__export(slot_exports, {
Slot: () => Slot,
Slottable: () => Slottable,
wrapPolymorphicSlot: () => wrapPolymorphicSlot
});
module.exports = __toCommonJS(slot_exports);
// src/slot/Slot.tsx
var import_radix_ui = require("radix-ui");
var import_react = require("react");
var import_jsx_runtime = require("react/jsx-runtime");
var Slottable = import_radix_ui.Slot.Slottable;
var Slot = ({ ref, ...props }) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
};
var wrapPolymorphicSlot = (asChild, children, callback) => {
if (!asChild) return callback(children);
return (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(
children,
void 0,
callback(children.props.children)
) : null;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Slot,
Slottable,
wrapPolymorphicSlot
});
//# sourceMappingURL=index.js.map
;