ivt
Version:
Ivt Components Library
49 lines (45 loc) • 1.73 kB
JavaScript
import * as React from 'react';
import React__default from 'react';
import { P as Primitive } from './index-DgKlJYZP.mjs';
import { jsx } from 'react/jsx-runtime';
import { c as cn } from './utils-05LlW3Cl.mjs';
// 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-StpvupIv.mjs.map