UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

60 lines (59 loc) 1.99 kB
"use client"; import { getFontSize, getLineHeight, getSpacing } from "../../core/utils/get-size/get-size.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 { ListProvider } from "./List.context.mjs"; import List_module_default from "./List.module.mjs"; import { ListItem } from "./ListItem/ListItem.mjs"; import { jsx } from "react/jsx-runtime"; //#region packages/@mantine/core/src/components/List/List.tsx const defaultProps = { type: "unordered" }; const varsResolver = createVarsResolver((_, { size, spacing }) => ({ root: { "--list-fz": getFontSize(size), "--list-lh": getLineHeight(size), "--list-spacing": getSpacing(spacing) } })); const List = factory((_props) => { const props = useProps("List", defaultProps, _props); const { classNames, className, style, styles, unstyled, vars, children, type, withPadding, icon, spacing, center, listStyleType, mod, attributes, ...others } = props; const getStyles = useStyles({ name: "List", classes: List_module_default, props, className, style, classNames, styles, unstyled, attributes, vars, varsResolver }); return /* @__PURE__ */ jsx(ListProvider, { value: { center, icon, getStyles }, children: /* @__PURE__ */ jsx(Box, { ...getStyles("root", { style: { listStyleType } }), component: type === "unordered" ? "ul" : "ol", mod: [{ "with-padding": withPadding, type: icon ? "none" : listStyleType }, mod], ...others, children }) }); }); List.classes = List_module_default; List.varsResolver = varsResolver; List.displayName = "@mantine/core/List"; List.Item = ListItem; //#endregion export { List }; //# sourceMappingURL=List.mjs.map