@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
23 lines • 1.38 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React, { forwardRef } from "react";
import { useRenameCSS } from "../../../theme/Theme.js";
import { useTabPanel } from "./useTabPanel.js";
const TabPanel = forwardRef((_a, ref) => {
var _b;
var { className, value, children, lazy = true, id } = _a, rest = __rest(_a, ["className", "value", "children", "lazy", "id"]);
const ctx = useTabPanel({ value });
const { cn } = useRenameCSS();
return (React.createElement("div", Object.assign({ ref: ref }, rest, { className: cn("navds-tabs__tabpanel", className), role: "tabpanel", tabIndex: 0, "aria-labelledby": (_b = rest["aria-labelledby"]) !== null && _b !== void 0 ? _b : ctx.labelledbyId, id: id !== null && id !== void 0 ? id : ctx.id, hidden: ctx.hidden, "data-state": !ctx.hidden ? "active" : "inactive" }), lazy && ctx.hidden ? null : children));
});
export default TabPanel;
//# sourceMappingURL=TabPanel.js.map