@foodpilot/foods 2.7.6 → 2.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,9 +3,9 @@ export type IconMapping = typeof iconMapping;
|
|
|
3
3
|
type Size = WidthHeight | number;
|
|
4
4
|
export type FoodsIconProps = {
|
|
5
5
|
size: Size;
|
|
6
|
-
icon: keyof IconMapping;
|
|
6
|
+
icon: keyof IconMapping | (string & {}) | undefined;
|
|
7
7
|
backgroundColor?: string;
|
|
8
8
|
color?: string;
|
|
9
9
|
};
|
|
10
|
-
export declare const FoodsIcon: (props: FoodsIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const FoodsIcon: (props: FoodsIconProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
11
|
export {};
|
|
@@ -3,9 +3,14 @@ import { Box } from "@mui/material";
|
|
|
3
3
|
import { iconMapping, computeSize } from "./iconConfig.js";
|
|
4
4
|
import { useTheme } from "@mui/material/styles";
|
|
5
5
|
const FoodsIcon = (props) => {
|
|
6
|
+
var _a;
|
|
6
7
|
const { icon, size, backgroundColor, color } = props;
|
|
7
|
-
const Icon = iconMapping[icon];
|
|
8
8
|
const theme = useTheme();
|
|
9
|
+
if (icon === void 0 || icon === "") {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const _Icon = (_a = iconMapping) == null ? void 0 : _a[icon];
|
|
13
|
+
const Icon = _Icon === void 0 ? iconMapping["default"] : _Icon;
|
|
9
14
|
const widthHeight = typeof size === "number" ? computeSize(size) : size;
|
|
10
15
|
return backgroundColor ? /* @__PURE__ */ jsx(
|
|
11
16
|
Box,
|