@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
58 lines (57 loc) • 2.15 kB
JavaScript
"use client";
import { rem } from "../../core/utils/units-converters/rem.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 { ScrollArea } from "../ScrollArea/ScrollArea.mjs";
import Table_module_default from "./Table.module.mjs";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Table/TableScrollContainer.tsx
const defaultProps = { type: "scrollarea" };
const varsResolver = createVarsResolver((_, { minWidth, maxHeight, type }) => ({ scrollContainer: {
"--table-min-width": rem(minWidth),
"--table-max-height": rem(maxHeight),
"--table-overflow": type === "native" ? "auto" : void 0
} }));
const TableScrollContainer = factory((_props) => {
const props = useProps("TableScrollContainer", defaultProps, _props);
const { classNames, className, style, styles, unstyled, vars, children, minWidth, maxHeight, type, scrollAreaProps, attributes, ...others } = props;
const getStyles = useStyles({
name: "TableScrollContainer",
classes: Table_module_default,
props,
className,
style,
classNames,
styles,
unstyled,
attributes,
vars,
varsResolver,
rootSelector: "scrollContainer"
});
return /* @__PURE__ */ jsx(Box, {
component: type === "scrollarea" ? ScrollArea : "div",
...type === "scrollarea" ? maxHeight ? {
offsetScrollbars: "xy",
...scrollAreaProps
} : {
offsetScrollbars: "x",
...scrollAreaProps
} : {},
...getStyles("scrollContainer"),
...others,
children: /* @__PURE__ */ jsx("div", {
...getStyles("scrollContainerInner"),
children
})
});
});
TableScrollContainer.classes = Table_module_default;
TableScrollContainer.varsResolver = varsResolver;
TableScrollContainer.displayName = "@mantine/core/TableScrollContainer";
//#endregion
export { TableScrollContainer };
//# sourceMappingURL=TableScrollContainer.mjs.map