@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
40 lines (38 loc) • 1.29 kB
JavaScript
import {
useTabsContext
} from "./chunk-KQITCS3U.mjs";
import {
__objRest,
__spreadProps,
__spreadValues
} from "./chunk-YOSPWY5K.mjs";
// src/tabs/tabs-content.tsx
import { forwardRef } from "react";
import { clsx } from "@postenbring/hedwig-css/typed-classname";
import { Slot } from "@radix-ui/react-slot";
import { jsx } from "react/jsx-runtime";
var TabsContents = forwardRef(
(_a, ref) => {
var _b = _a, { asChild, children } = _b, rest = __objRest(_b, ["asChild", "children"]);
const Component = asChild ? Slot : "div";
return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({ ref, className: clsx("hds-tabs__contents") }, rest), { children }));
}
);
TabsContents.displayName = "Tabs.Contents";
var TabsContent = forwardRef(
(_a, ref) => {
var _b = _a, { asChild, forTabId, children } = _b, rest = __objRest(_b, ["asChild", "forTabId", "children"]);
const context = useTabsContext();
const Component = asChild ? Slot : "div";
if (context.activeTabId === forTabId) {
return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({}, rest), { ref, children }));
}
return null;
}
);
TabsContent.displayName = "Tabs.Content";
export {
TabsContents,
TabsContent
};
//# sourceMappingURL=chunk-35QRZSEV.mjs.map