@evergis/react 3.1.19 → 3.1.20

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.
package/dist/react.esm.js CHANGED
@@ -6465,16 +6465,22 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
6465
6465
  });
6466
6466
  const { options, style, children } = elementConfig || {};
6467
6467
  const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
6468
+ const iconElement = children?.find(({ id }) => id === "icon");
6468
6469
  const aliasElement = children?.find(({ id }) => id === "alias");
6469
6470
  const unitsElement = children?.find(({ id }) => id === "units");
6470
6471
  const valueElement = children?.find(({ id }) => id === "value");
6471
6472
  const value = renderElement({ id: "value" });
6472
6473
  const color = useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
6474
+ const renderIcon = useMemo(() => {
6475
+ if (!iconElement)
6476
+ return null;
6477
+ return (jsx(FlexSpan, { width: iconElement.options?.width || "1rem", alignItems: "center", mr: "0.5rem", children: renderElement({ id: "icon", wrap: false }) }));
6478
+ }, [iconElement, renderElement]);
6473
6479
  const renderAlias = useMemo(() => (jsx(ContainerAlias, { style: aliasElement?.style, children: jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement]);
6474
6480
  const renderValue = useMemo(() => (jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] })), [valueElement?.style, value, unitsElement, renderElement]);
6475
6481
  if (!value && hideEmpty)
6476
6482
  return null;
6477
- return (jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$big": big, "$bigIcon": bigIcon, children: [jsxs(ContainerIconValue, { children: [renderElement({ id: "icon", wrap: false }), big ? renderAlias : renderValue] }), big ? renderValue : renderAlias] }));
6483
+ return (jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$big": big, "$bigIcon": bigIcon, children: [jsxs(ContainerIconValue, { children: [renderIcon, big ? renderAlias : renderValue] }), big ? renderValue : renderAlias] }));
6478
6484
  });
6479
6485
 
6480
6486
  const AddFeatureContainer = memo(({ elementConfig }) => {