UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

43 lines (42 loc) 1.63 kB
"use client"; import { useMantineEnv } from "../../../core/MantineProvider/Mantine.context.mjs"; import { useProps } from "../../../core/MantineProvider/use-props/use-props.mjs"; import { factory } from "../../../core/factory/factory.mjs"; import { Box } from "../../../core/Box/Box.mjs"; import { useTabsContext } from "../Tabs.context.mjs"; import Tabs_module_default from "../Tabs.module.mjs"; import { Activity } from "react"; import { jsx } from "react/jsx-runtime"; //#region packages/@mantine/core/src/components/Tabs/TabsPanel/TabsPanel.tsx const TabsPanel = factory((_props) => { const props = useProps("TabsPanel", null, _props); const { children, className, value, classNames, styles, style, mod, keepMounted, ...others } = props; const env = useMantineEnv(); const ctx = useTabsContext(); const active = ctx.value === value; const shouldKeepMounted = ctx.keepMounted || keepMounted; const content = shouldKeepMounted && env !== "test" ? /* @__PURE__ */ jsx(Activity, { mode: active ? "visible" : "hidden", children }) : shouldKeepMounted ? children : active ? children : null; return /* @__PURE__ */ jsx(Box, { ...ctx.getStyles("panel", { className, classNames, styles, style: [style, !active ? { display: "none" } : void 0], props }), mod: [{ orientation: ctx.orientation }, mod], role: "tabpanel", id: ctx.getPanelId(value), "aria-labelledby": ctx.getTabId(value), ...others, children: content }); }); TabsPanel.classes = Tabs_module_default; TabsPanel.displayName = "@mantine/core/TabsPanel"; //#endregion export { TabsPanel }; //# sourceMappingURL=TabsPanel.mjs.map