@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
96 lines (95 loc) • 3.27 kB
JavaScript
"use client";
import { getDefaultZIndex } from "../../core/utils/get-default-z-index/get-default-z-index.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { factory } from "../../core/factory/factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import { AppShellProvider } from "./AppShell.context.mjs";
import AppShell_module_default from "./AppShell.module.mjs";
import { AppShellAside } from "./AppShellAside/AppShellAside.mjs";
import { AppShellFooter } from "./AppShellFooter/AppShellFooter.mjs";
import { AppShellHeader } from "./AppShellHeader/AppShellHeader.mjs";
import { AppShellMain } from "./AppShellMain/AppShellMain.mjs";
import { AppShellMediaStyles } from "./AppShellMediaStyles/AppShellMediaStyles.mjs";
import { AppShellNavbar } from "./AppShellNavbar/AppShellNavbar.mjs";
import { AppShellSection } from "./AppShellSection/AppShellSection.mjs";
import { useResizing } from "./use-resizing/use-resizing.mjs";
import { useId } from "@mantine/hooks";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/AppShell/AppShell.tsx
const defaultProps = {
withBorder: true,
padding: 0,
transitionDuration: 200,
transitionTimingFunction: "ease",
zIndex: getDefaultZIndex("app"),
mode: "fixed"
};
const varsResolver = createVarsResolver((_, { transitionDuration, transitionTimingFunction }) => ({ root: {
"--app-shell-transition-duration": `${transitionDuration}ms`,
"--app-shell-transition-timing-function": transitionTimingFunction
} }));
const AppShell = factory((_props) => {
const props = useProps("AppShell", defaultProps, _props);
const { classNames, className, style, styles, unstyled, vars, navbar, withBorder, padding, transitionDuration, transitionTimingFunction, header, zIndex, layout, disabled, aside, footer, offsetScrollbars = true, mode, mod, attributes, id, ...others } = props;
const getStyles = useStyles({
name: "AppShell",
classes: AppShell_module_default,
props,
className,
style,
classNames,
styles,
unstyled,
attributes,
vars,
varsResolver
});
const resizing = useResizing({
disabled,
transitionDuration
});
const _id = useId(id);
return /* @__PURE__ */ jsxs(AppShellProvider, {
value: {
getStyles,
withBorder,
zIndex,
disabled,
offsetScrollbars,
mode
},
children: [/* @__PURE__ */ jsx(AppShellMediaStyles, {
navbar,
header,
aside,
footer,
padding,
mode,
selector: mode === "static" ? `#${_id}` : void 0
}), /* @__PURE__ */ jsx(Box, {
...getStyles("root"),
id: _id,
mod: [{
resizing,
layout,
disabled,
mode
}, mod],
...others
})]
});
});
AppShell.classes = AppShell_module_default;
AppShell.varsResolver = varsResolver;
AppShell.displayName = "@mantine/core/AppShell";
AppShell.Navbar = AppShellNavbar;
AppShell.Header = AppShellHeader;
AppShell.Main = AppShellMain;
AppShell.Aside = AppShellAside;
AppShell.Footer = AppShellFooter;
AppShell.Section = AppShellSection;
//#endregion
export { AppShell };
//# sourceMappingURL=AppShell.mjs.map