@apexcura/ui-components 0.0.15-Beta2 → 0.0.15-Beta3

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
@@ -382,6 +382,7 @@ var ButtonElement = (props) => {
382
382
  const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
383
383
  const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(null);
384
384
  const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
385
+ const [defaultColor, setDefaultColor] = (0, import_react11.useState)(null);
385
386
  (0, import_react11.useEffect)(() => {
386
387
  if (props.icon) {
387
388
  fetch(props.icon).then((response) => response.text()).then((data) => {
@@ -399,6 +400,7 @@ var ButtonElement = (props) => {
399
400
  document.body.removeChild(tempSpan);
400
401
  const paths = svgElement.querySelectorAll("path");
401
402
  paths.forEach((path) => path.setAttribute("fill", computedColor));
403
+ setDefaultColor(computedColor);
402
404
  }
403
405
  if (hoverColorClass) {
404
406
  const tempSpan = document.createElement("span");
@@ -429,8 +431,13 @@ var ButtonElement = (props) => {
429
431
  }
430
432
  };
431
433
  const handleMouseLeave = () => {
432
- if (originalSvgContent) {
433
- setSvgContent(originalSvgContent);
434
+ if (defaultColor && originalSvgContent) {
435
+ const tempDiv = document.createElement("div");
436
+ tempDiv.innerHTML = originalSvgContent;
437
+ const svgElement = tempDiv.querySelector("svg");
438
+ const paths = svgElement?.querySelectorAll("path");
439
+ paths?.forEach((path) => path.setAttribute("fill", defaultColor));
440
+ setSvgContent(tempDiv.innerHTML);
434
441
  }
435
442
  };
436
443
  return /* @__PURE__ */ import_react11.default.createElement(
@@ -440,9 +447,9 @@ var ButtonElement = (props) => {
440
447
  className: `${props.className ? props.className : ""}`,
441
448
  onMouseEnter: handleMouseEnter,
442
449
  onMouseLeave: handleMouseLeave,
443
- disabled: props.loading
450
+ disabled: props.isLoading
444
451
  },
445
- props.loading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ import_react11.default.createElement(
452
+ props.isLoading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ import_react11.default.createElement(
446
453
  "span",
447
454
  {
448
455
  dangerouslySetInnerHTML: { __html: svgContent }
package/dist/index.mjs CHANGED
@@ -321,6 +321,7 @@ var ButtonElement = (props) => {
321
321
  const [svgContent, setSvgContent] = useState4(null);
322
322
  const [originalSvgContent, setOriginalSvgContent] = useState4(null);
323
323
  const [hoverColor, setHoverColor] = useState4(null);
324
+ const [defaultColor, setDefaultColor] = useState4(null);
324
325
  useEffect(() => {
325
326
  if (props.icon) {
326
327
  fetch(props.icon).then((response) => response.text()).then((data) => {
@@ -338,6 +339,7 @@ var ButtonElement = (props) => {
338
339
  document.body.removeChild(tempSpan);
339
340
  const paths = svgElement.querySelectorAll("path");
340
341
  paths.forEach((path) => path.setAttribute("fill", computedColor));
342
+ setDefaultColor(computedColor);
341
343
  }
342
344
  if (hoverColorClass) {
343
345
  const tempSpan = document.createElement("span");
@@ -368,8 +370,13 @@ var ButtonElement = (props) => {
368
370
  }
369
371
  };
370
372
  const handleMouseLeave = () => {
371
- if (originalSvgContent) {
372
- setSvgContent(originalSvgContent);
373
+ if (defaultColor && originalSvgContent) {
374
+ const tempDiv = document.createElement("div");
375
+ tempDiv.innerHTML = originalSvgContent;
376
+ const svgElement = tempDiv.querySelector("svg");
377
+ const paths = svgElement?.querySelectorAll("path");
378
+ paths?.forEach((path) => path.setAttribute("fill", defaultColor));
379
+ setSvgContent(tempDiv.innerHTML);
373
380
  }
374
381
  };
375
382
  return /* @__PURE__ */ React11.createElement(
@@ -379,9 +386,9 @@ var ButtonElement = (props) => {
379
386
  className: `${props.className ? props.className : ""}`,
380
387
  onMouseEnter: handleMouseEnter,
381
388
  onMouseLeave: handleMouseLeave,
382
- disabled: props.loading
389
+ disabled: props.isLoading
383
390
  },
384
- props.loading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ React11.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ React11.createElement(
391
+ props.isLoading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ React11.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ React11.createElement(
385
392
  "span",
386
393
  {
387
394
  dangerouslySetInnerHTML: { __html: svgContent }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.15-Beta2",
3
+ "version": "0.0.15-Beta3",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",