UNPKG

@spark-ui/components

Version:

Spark (Leboncoin design system) components.

77 lines (71 loc) 2.45 kB
import { Slot } from "../chunk-6QCEPQ3U.mjs"; // src/collapsible/Content.tsx import { Collapsible } from "@base-ui-components/react/collapsible"; import { cx } from "class-variance-authority"; // src/collapsible/useRenderSlot.tsx import { jsx } from "react/jsx-runtime"; function useRenderSlot(asChild, defaultTag) { const Component = asChild ? Slot : defaultTag; return asChild ? ({ ...props }) => /* @__PURE__ */ jsx(Component, { ...props }) : void 0; } // src/collapsible/Content.tsx import { jsx as jsx2 } from "react/jsx-runtime"; var Content = ({ asChild = false, className, children, hiddenUntilFound = true, ...props }) => { const renderSlot = useRenderSlot(asChild, "div"); return /* @__PURE__ */ jsx2( Collapsible.Panel, { "data-spark-component": "collapsible-content", className: cx( "overflow-hidden", "h-[var(--collapsible-panel-height)]", "transition-all duration-200", "motion-reduce:transition-none", "data-[starting-style]:h-0", "data-[ending-style]:h-0", className ), render: renderSlot, hiddenUntilFound, ...props, children } ); }; Content.displayName = "Collapsible.Content"; // src/collapsible/Root.tsx import { Collapsible as Collapsible2 } from "@base-ui-components/react/collapsible"; import { jsx as jsx3 } from "react/jsx-runtime"; var Root = ({ asChild = false, children, ...props }) => { const renderSlot = useRenderSlot(asChild, "div"); return /* @__PURE__ */ jsx3(Collapsible2.Root, { "data-spark-component": "collapsible", render: renderSlot, ...props, children }); }; Root.displayName = "Collapsible"; // src/collapsible/Trigger.tsx import { Collapsible as Collapsible3 } from "@base-ui-components/react/collapsible"; import { jsx as jsx4 } from "react/jsx-runtime"; var Trigger = ({ asChild = false, children, ...props }) => { const renderSlot = useRenderSlot(asChild, "button"); return /* @__PURE__ */ jsx4(Collapsible3.Trigger, { "data-spark-component": "collapsible-trigger", render: renderSlot, ...props, children }); }; Trigger.displayName = "Collapsible.Trigger"; // src/collapsible/index.ts var Collapsible4 = Object.assign(Root, { Trigger, Content }); Collapsible4.displayName = "Collapsible"; Trigger.displayName = "Collapsible.Trigger"; Content.displayName = "Collapsible.Content"; export { Collapsible4 as Collapsible }; //# sourceMappingURL=index.mjs.map