@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
46 lines (45 loc) • 1.43 kB
JavaScript
"use client";
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 { useListContext } from "../List.context.mjs";
import List_module_default from "../List.module.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/List/ListItem/ListItem.tsx
const ListItem = factory((_props) => {
const { classNames, className, style, styles, vars, icon, children, mod, ...others } = useProps("ListItem", null, _props);
const ctx = useListContext();
const _icon = icon || ctx.icon;
const stylesApiProps = {
classNames,
styles
};
return /* @__PURE__ */ jsx(Box, {
...ctx.getStyles("item", {
...stylesApiProps,
className,
style
}),
component: "li",
mod: [{
"with-icon": !!_icon,
centered: ctx.center
}, mod],
...others,
children: /* @__PURE__ */ jsxs("div", {
...ctx.getStyles("itemWrapper", stylesApiProps),
children: [_icon && /* @__PURE__ */ jsx("span", {
...ctx.getStyles("itemIcon", stylesApiProps),
children: _icon
}), /* @__PURE__ */ jsx("span", {
...ctx.getStyles("itemLabel", stylesApiProps),
children
})]
})
});
});
ListItem.classes = List_module_default;
ListItem.displayName = "@mantine/core/ListItem";
//#endregion
export { ListItem };
//# sourceMappingURL=ListItem.mjs.map