@apexcura/ui-components 0.0.14-Beta43 → 0.0.14-Beta44

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/index.js CHANGED
@@ -379,6 +379,7 @@ var import_react11 = __toESM(require("react"));
379
379
  var ButtonElement = (props) => {
380
380
  const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
381
381
  const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
382
+ const [originalFillColors, setOriginalFillColors] = (0, import_react11.useState)([]);
382
383
  (0, import_react11.useEffect)(() => {
383
384
  if (props.icon) {
384
385
  fetch(props.icon).then((response) => response.text()).then((data) => {
@@ -395,7 +396,11 @@ var ButtonElement = (props) => {
395
396
  const computedColor = getComputedStyle(tempSpan).color;
396
397
  document.body.removeChild(tempSpan);
397
398
  const paths = svgElement.querySelectorAll("path");
398
- paths.forEach((path) => path.setAttribute("fill", computedColor));
399
+ paths.forEach((path) => {
400
+ const originalFill = path.getAttribute("fill");
401
+ path.setAttribute("fill", computedColor);
402
+ setOriginalFillColors((prev) => [...prev, originalFill || ""]);
403
+ });
399
404
  }
400
405
  if (hoverColorClass) {
401
406
  const tempSpan = document.createElement("span");
@@ -422,7 +427,9 @@ var ButtonElement = (props) => {
422
427
  tempDiv.innerHTML = prevSvgContent;
423
428
  const svgElement = tempDiv.querySelector("svg");
424
429
  const paths = svgElement?.querySelectorAll("path");
425
- paths?.forEach((path) => path.setAttribute("fill", hoverColor));
430
+ paths?.forEach((path, index) => {
431
+ path.setAttribute("fill", hoverColor);
432
+ });
426
433
  return tempDiv.innerHTML;
427
434
  });
428
435
  }
@@ -436,7 +443,8 @@ var ButtonElement = (props) => {
436
443
  const svgElement = tempDiv.querySelector("svg");
437
444
  const paths = svgElement?.querySelectorAll("path");
438
445
  paths?.forEach((path, index) => {
439
- path.removeAttribute("fill");
446
+ const originalFill = originalFillColors[index];
447
+ path.setAttribute("fill", originalFill);
440
448
  });
441
449
  return tempDiv.innerHTML;
442
450
  });
package/dist/index.mjs CHANGED
@@ -320,6 +320,7 @@ import React11, { useEffect, useState as useState4 } from "react";
320
320
  var ButtonElement = (props) => {
321
321
  const [svgContent, setSvgContent] = useState4(null);
322
322
  const [hoverColor, setHoverColor] = useState4(null);
323
+ const [originalFillColors, setOriginalFillColors] = useState4([]);
323
324
  useEffect(() => {
324
325
  if (props.icon) {
325
326
  fetch(props.icon).then((response) => response.text()).then((data) => {
@@ -336,7 +337,11 @@ var ButtonElement = (props) => {
336
337
  const computedColor = getComputedStyle(tempSpan).color;
337
338
  document.body.removeChild(tempSpan);
338
339
  const paths = svgElement.querySelectorAll("path");
339
- paths.forEach((path) => path.setAttribute("fill", computedColor));
340
+ paths.forEach((path) => {
341
+ const originalFill = path.getAttribute("fill");
342
+ path.setAttribute("fill", computedColor);
343
+ setOriginalFillColors((prev) => [...prev, originalFill || ""]);
344
+ });
340
345
  }
341
346
  if (hoverColorClass) {
342
347
  const tempSpan = document.createElement("span");
@@ -363,7 +368,9 @@ var ButtonElement = (props) => {
363
368
  tempDiv.innerHTML = prevSvgContent;
364
369
  const svgElement = tempDiv.querySelector("svg");
365
370
  const paths = svgElement?.querySelectorAll("path");
366
- paths?.forEach((path) => path.setAttribute("fill", hoverColor));
371
+ paths?.forEach((path, index) => {
372
+ path.setAttribute("fill", hoverColor);
373
+ });
367
374
  return tempDiv.innerHTML;
368
375
  });
369
376
  }
@@ -377,7 +384,8 @@ var ButtonElement = (props) => {
377
384
  const svgElement = tempDiv.querySelector("svg");
378
385
  const paths = svgElement?.querySelectorAll("path");
379
386
  paths?.forEach((path, index) => {
380
- path.removeAttribute("fill");
387
+ const originalFill = originalFillColors[index];
388
+ path.setAttribute("fill", originalFill);
381
389
  });
382
390
  return tempDiv.innerHTML;
383
391
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.14-Beta43",
3
+ "version": "0.0.14-Beta44",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",