33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
// packages/react/separator/src/Separator.tsx
|
|
import * as React from "react";
|
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
import { jsx } from "react/jsx-runtime";
|
|
var NAME = "Separator";
|
|
var DEFAULT_ORIENTATION = "horizontal";
|
|
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
var Separator = 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.displayName = NAME;
|
|
function isValidOrientation(orientation) {
|
|
return ORIENTATIONS.includes(orientation);
|
|
}
|
|
var Root = Separator;
|
|
export {
|
|
Root,
|
|
Separator
|
|
};
|
|
//# sourceMappingURL=index.mjs.map
|