@trafilea/afrodita-components 6.58.2 → 6.59.0

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/build/index.js CHANGED
@@ -4146,6 +4146,11 @@ var getIconDimension = function (dimension) {
4146
4146
  return "".concat(dimension, "rem");
4147
4147
  };
4148
4148
 
4149
+ var transformImageProperties = function (_a) {
4150
+ var title = _a.title, name = _a.name, height = _a.height, width = _a.width, testId = _a.testId, rest = __rest(_a, ["title", "name", "height", "width", "testId"]);
4151
+ return __assign$1({ alt: title !== null && title !== void 0 ? title : name, 'data-testid': testId, height: height, width: width }, rest);
4152
+ };
4153
+
4149
4154
  var UnmemoIconFromExtSource = function (_a) {
4150
4155
  var height = _a.height, width = _a.width, title = _a.title, testId = _a.testId, fill = _a.fill, name = _a.name, svgProps = _a.svgProps, iconURL = _a.iconURL, svgId = _a.svgId, _b = _a.showTooltipTitle, showTooltipTitle = _b === void 0 ? true : _b, rest = __rest(_a, ["height", "width", "title", "testId", "fill", "name", "svgProps", "iconURL", "svgId", "showTooltipTitle"]);
4151
4156
  var _c = React$2.useState(false), error = _c[0], setError = _c[1];
@@ -4173,16 +4178,13 @@ var UnmemoIconFromExtSource = function (_a) {
4173
4178
  fetchIcon();
4174
4179
  }
4175
4180
  }, [iconURL]);
4176
- var imageProperties = __assign$1({ alt: title !== null && title !== void 0 ? title : name, 'data-testid': testId, height: height, width: width }, rest);
4177
4181
  if (error) {
4182
+ var imageProperties = transformImageProperties(__assign$1({ title: title, name: name, height: height, width: width, testId: testId }, rest));
4178
4183
  return jsxRuntime.jsx(StyledImageWrapper, __assign$1({}, imageProperties, { src: iconURL }), void 0);
4179
4184
  }
4180
4185
  if (!localSource) {
4181
4186
  return jsxRuntime.jsx(SkeletonBox, { width: width, height: height }, void 0);
4182
4187
  }
4183
- if (!fill && !svgProps) {
4184
- return jsxRuntime.jsx(StyledImageWrapper, __assign$1({}, imageProperties, rest, { src: localSource.src }), void 0);
4185
- }
4186
4188
  return (jsxRuntime.jsxs(StyledSvgWrapper, __assign$1({ "data-testid": testId, fill: fill, height: height, type: "image/svg+xml", width: width }, rest, svgProps, { showTooltipTitle: showTooltipTitle }, { children: [showTooltipTitle && jsxRuntime.jsx("title", { children: title !== null && title !== void 0 ? title : name }, void 0), jsxRuntime.jsx("use", { href: "".concat(localSource.src, "#").concat(svgId) }, void 0)] }), void 0));
4187
4189
  };
4188
4190
  var IconFromExtSource = React__default["default"].memo(UnmemoIconFromExtSource);
@@ -4199,6 +4201,10 @@ var UnmemoIcon = function (_a) {
4199
4201
  if (assets.isSameOriginIcons) {
4200
4202
  return (jsxRuntime.jsxs(StyledSvgWrapper, __assign$1({ "data-testid": testId, fill: fill, height: newHeight, type: "image/svg+xml", width: newWidth }, rest, svgProps, { showTooltipTitle: showTooltipTitle }, { children: [showTooltipTitle && jsxRuntime.jsx("title", { children: title !== null && title !== void 0 ? title : name }, void 0), jsxRuntime.jsx("use", { href: "".concat(iconURL, "#").concat(svgId) }, void 0)] }), void 0));
4201
4203
  }
4204
+ if (!fill && !svgProps) {
4205
+ var imageProperties = transformImageProperties(__assign$1({ title: title, name: name, height: newHeight, width: newWidth, testId: testId }, rest));
4206
+ return jsxRuntime.jsx(StyledImageWrapper, __assign$1({}, imageProperties, rest, { src: iconURL }), void 0);
4207
+ }
4202
4208
  return (jsxRuntime.jsx(IconFromExtSource, __assign$1({ svgId: svgId, iconURL: iconURL, testId: testId, fill: fill, height: newHeight, svgProps: svgProps, width: newWidth, name: name, title: title, showTooltipTitle: showTooltipTitle }, rest), void 0));
4203
4209
  };
4204
4210
  var Icon$1 = React__default["default"].memo(UnmemoIcon, function (prevProps, nextProps) { return prevProps.name !== nextProps.name; });