@apexcura/ui-components 0.0.14-Beta36 → 0.0.14-Beta38
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 +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -380,10 +380,18 @@ var ButtonElement = (props) => {
|
|
|
380
380
|
const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
|
|
381
381
|
(0, import_react11.useEffect)(() => {
|
|
382
382
|
if (props.icon) {
|
|
383
|
-
fetch(props.icon).then((response) => response.text()).then((data) =>
|
|
383
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
384
|
+
const parser = new DOMParser();
|
|
385
|
+
const svgDocument = parser.parseFromString(data, "image/svg+xml");
|
|
386
|
+
const pathElement = svgDocument.querySelector("path");
|
|
387
|
+
if (pathElement) {
|
|
388
|
+
pathElement.setAttribute("fill", props.iconsClassName || "#A3A3A3");
|
|
389
|
+
}
|
|
390
|
+
const modifiedSvg = new XMLSerializer().serializeToString(svgDocument);
|
|
391
|
+
setSvgContent(modifiedSvg);
|
|
392
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
384
393
|
}
|
|
385
394
|
}, [props.icon]);
|
|
386
|
-
console.log(svgContent);
|
|
387
395
|
return /* @__PURE__ */ import_react11.default.createElement(
|
|
388
396
|
"button",
|
|
389
397
|
{
|
|
@@ -393,7 +401,6 @@ var ButtonElement = (props) => {
|
|
|
393
401
|
svgContent ? /* @__PURE__ */ import_react11.default.createElement(
|
|
394
402
|
"span",
|
|
395
403
|
{
|
|
396
|
-
className: props.iconsClassName,
|
|
397
404
|
dangerouslySetInnerHTML: { __html: svgContent }
|
|
398
405
|
}
|
|
399
406
|
) : props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon }),
|
package/dist/index.mjs
CHANGED
|
@@ -321,10 +321,18 @@ var ButtonElement = (props) => {
|
|
|
321
321
|
const [svgContent, setSvgContent] = useState4(null);
|
|
322
322
|
useEffect(() => {
|
|
323
323
|
if (props.icon) {
|
|
324
|
-
fetch(props.icon).then((response) => response.text()).then((data) =>
|
|
324
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
325
|
+
const parser = new DOMParser();
|
|
326
|
+
const svgDocument = parser.parseFromString(data, "image/svg+xml");
|
|
327
|
+
const pathElement = svgDocument.querySelector("path");
|
|
328
|
+
if (pathElement) {
|
|
329
|
+
pathElement.setAttribute("fill", props.iconsClassName || "#A3A3A3");
|
|
330
|
+
}
|
|
331
|
+
const modifiedSvg = new XMLSerializer().serializeToString(svgDocument);
|
|
332
|
+
setSvgContent(modifiedSvg);
|
|
333
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
325
334
|
}
|
|
326
335
|
}, [props.icon]);
|
|
327
|
-
console.log(svgContent);
|
|
328
336
|
return /* @__PURE__ */ React11.createElement(
|
|
329
337
|
"button",
|
|
330
338
|
{
|
|
@@ -334,7 +342,6 @@ var ButtonElement = (props) => {
|
|
|
334
342
|
svgContent ? /* @__PURE__ */ React11.createElement(
|
|
335
343
|
"span",
|
|
336
344
|
{
|
|
337
|
-
className: props.iconsClassName,
|
|
338
345
|
dangerouslySetInnerHTML: { __html: svgContent }
|
|
339
346
|
}
|
|
340
347
|
) : props.icon && /* @__PURE__ */ React11.createElement("img", { className: props.iconsClassName, src: props.icon }),
|