UNPKG

@loke/ui

Version:
81 lines (78 loc) • 3.36 kB
"use client"; var __create = Object.create; var { getPrototypeOf: __getProtoOf, defineProperty: __defProp, getOwnPropertyNames: __getOwnPropNames, getOwnPropertyDescriptor: __getOwnPropDesc } = Object, __hasOwnProp = Object.prototype.hasOwnProperty; function __accessProp(key) { return this[key]; } var __toESMCache_node, __toESMCache_esm, __toESM = (mod, isNodeMode, target) => { var canCache = mod != null && typeof mod === "object"; if (canCache) { var cache = isNodeMode ? __toESMCache_node ??= /* @__PURE__ */ new WeakMap : __toESMCache_esm ??= /* @__PURE__ */ new WeakMap, cached = cache.get(mod); if (cached) return cached; } target = mod != null ? __create(__getProtoOf(mod)) : {}; let to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target; if (mod && typeof mod === "object" || typeof mod === "function") { for (let key of __getOwnPropNames(mod)) if (!__hasOwnProp.call(to, key)) __defProp(to, key, { get: __accessProp.bind(mod, key), enumerable: !0 }); } if (canCache) cache.set(mod, to); return to; }, __toCommonJS = (from) => { var entry = (__moduleCache ??= /* @__PURE__ */ new WeakMap).get(from), desc; if (entry) return entry; if (entry = __defProp({}, "__esModule", { value: !0 }), from && typeof from === "object" || typeof from === "function") { for (var key of __getOwnPropNames(from)) if (!__hasOwnProp.call(entry, key)) __defProp(entry, key, { get: __accessProp.bind(from, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return __moduleCache.set(from, entry), entry; }, __moduleCache; var __returnValue = (v) => v; function __exportSetter(name, newValue) { this[name] = __returnValue.bind(null, newValue); } var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0, configurable: !0, set: __exportSetter.bind(all, name) }); }; // src/components/separator/index.ts var exports_separator = {}; __export(exports_separator, { Root: () => Root, Separator: () => Separator }); module.exports = __toCommonJS(exports_separator); // src/components/separator/separator.tsx var import_primitive = require("@loke/ui/primitive"), import_react = require("react"), jsx_runtime = require("react/jsx-runtime"), NAME = "Separator", DEFAULT_ORIENTATION = "horizontal", ORIENTATIONS = ["horizontal", "vertical"], Separator = /* @__PURE__ */ Object.assign(/* @__PURE__ */ import_react.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_runtime.jsx(import_primitive.Primitive.div, { "data-orientation": orientation, ...semanticProps, ...domProps, ref: forwardedRef }); }), { displayName: NAME }); function isValidOrientation(orientation) { return ORIENTATIONS.includes(orientation); } var Root = Separator;