@loke/ui
Version:
To install dependencies:
30 lines (28 loc) • 1.05 kB
JavaScript
"use client";
// src/components/separator/separator.tsx
import { Primitive } from "@loke/ui/primitive";
import {
forwardRef
} from "react";
import { jsx } from "react/jsx-runtime";
var NAME = "Separator", DEFAULT_ORIENTATION = "horizontal", ORIENTATIONS = ["horizontal", "vertical"], Separator = /* @__PURE__ */ Object.assign(/* @__PURE__ */ forwardRef((props, forwardedRef) => {
let {
decorative,
orientation: orientationProp = DEFAULT_ORIENTATION,
...domProps
} = props, orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION, semanticProps = decorative ? { role: "none" } : { "aria-orientation": orientation === "vertical" ? orientation : void 0, role: "separator" };
return /* @__PURE__ */ jsx(Primitive.div, {
"data-orientation": orientation,
...semanticProps,
...domProps,
ref: forwardedRef
});
}), { displayName: NAME });
function isValidOrientation(orientation) {
return ORIENTATIONS.includes(orientation);
}
var Root = Separator;
export {
Root,
Separator
};