UNPKG

ivt

Version:

Ivt Components Library

90 lines (85 loc) 2.57 kB
import * as React from 'react'; import React__default from 'react'; import 'react-dom'; import { createSlot } from '@radix-ui/react-slot'; import { jsx } from 'react/jsx-runtime'; import { c as cn } from './utils-BDcRwQMd.mjs'; // src/primitive.tsx var NODES = [ "a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "select", "span", "svg", "ul" ]; var Primitive = NODES.reduce((primitive, node)=>{ const Slot = createSlot(`Primitive.${node}`); const Node = React.forwardRef((props, forwardedRef)=>{ const { asChild, ...primitiveProps } = props; const Comp = asChild ? Slot : node; if (typeof window !== "undefined") { window[Symbol.for("radix-ui")] = true; } return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef }); }); Node.displayName = `Primitive.${node}`; return { ...primitive, [node]: Node }; }, {}); // src/separator.tsx var NAME = "Separator"; var DEFAULT_ORIENTATION = "horizontal"; var ORIENTATIONS = [ "horizontal", "vertical" ]; var Separator$1 = React.forwardRef((props, forwardedRef)=>{ const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props; const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION; const ariaOrientation = orientation === "vertical" ? orientation : void 0; const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" }; return /* @__PURE__ */ jsx(Primitive.div, { "data-orientation": orientation, ...semanticProps, ...domProps, ref: forwardedRef }); }); Separator$1.displayName = NAME; function isValidOrientation(orientation) { return ORIENTATIONS.includes(orientation); } var Root = Separator$1; function Separator({ className, orientation = "horizontal", decorative = true, ...props }) { return /*#__PURE__*/ React__default.createElement(Root, { "data-slot": "separator-root", decorative: decorative, orientation: orientation, className: cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className), ...props }); } export { Separator as S }; //# sourceMappingURL=separator-DYyhdAi6.mjs.map