@tapcart/mobile-components 0.8.43 → 0.8.44

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.
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,EAwChB,MAAM,qBAAqB,CAAA;AAI5B,QAAA,MAAM,YAAY;;;mFAiBjB,CAAA;AA8DD,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AA0HD,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,IAAW,EACX,KAAK,EACL,GAAG,EACH,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,cAAc,EACd,GAAG,KAAK,EACT,EAAE,SAAS,2CAoBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,EAwChB,MAAM,qBAAqB,CAAA;AAI5B,QAAA,MAAM,YAAY;;;mFAiBjB,CAAA;AA8DD,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AA8KD,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,IAAW,EACX,KAAK,EACL,GAAG,EACH,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,cAAc,EACd,GAAG,KAAK,EACT,EAAE,SAAS,2CAoBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
@@ -121,23 +121,47 @@ const CustomIcon = ({ url, size, color, strokeColor, strokeWidth, fillColor, fil
121
121
  // Create a gradient fill based on the fillPercentage
122
122
  if (fillPercentage && fillPercentage > 0 && fillPercentage < 1) {
123
123
  const percentage = Math.min(Math.max(fillPercentage, 0), 1);
124
- const gradientId = `gradient-${Math.random()}`;
125
- const gradient = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");
126
- gradient.setAttribute("id", gradientId);
127
- gradient.setAttribute("x1", "0%");
128
- gradient.setAttribute("y1", "0%");
129
- gradient.setAttribute("x2", "100%");
130
- gradient.setAttribute("y2", "0%");
131
- const stop1 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
132
- stop1.setAttribute("offset", `${percentage * 100}%`);
133
- stop1.setAttribute("stop-color", color || fillColor || "currentColor");
134
- gradient.appendChild(stop1);
135
- const stop2 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
136
- stop2.setAttribute("offset", `${percentage * 100}%`);
137
- stop2.setAttribute("stop-color", secondaryFillColor || "transparent"); // Use secondary fill color
138
- gradient.appendChild(stop2);
139
- svg.appendChild(gradient);
140
- path.setAttribute("fill", `url(#${gradientId})`);
124
+ const uniqueId = crypto.randomUUID();
125
+ const fillGradientId = `fill-gradient-${uniqueId}`;
126
+ const strokeGradientId = `stroke-gradient-${uniqueId}`;
127
+ let defs = svg.querySelector("defs");
128
+ if (!defs) {
129
+ defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
130
+ svg.prepend(defs);
131
+ }
132
+ const fillGradient = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");
133
+ fillGradient.setAttribute("id", fillGradientId);
134
+ fillGradient.setAttribute("x1", "0%");
135
+ fillGradient.setAttribute("y1", "0%");
136
+ fillGradient.setAttribute("x2", "100%");
137
+ fillGradient.setAttribute("y2", "0%");
138
+ const fillStop1 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
139
+ fillStop1.setAttribute("offset", `${percentage * 100}%`);
140
+ fillStop1.setAttribute("stop-color", color || fillColor || "transparent");
141
+ fillGradient.appendChild(fillStop1);
142
+ const fillStop2 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
143
+ fillStop2.setAttribute("offset", `${percentage * 100}%`);
144
+ fillStop2.setAttribute("stop-color", secondaryFillColor || "transparent");
145
+ fillGradient.appendChild(fillStop2);
146
+ defs.appendChild(fillGradient);
147
+ const strokeGradient = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");
148
+ strokeGradient.setAttribute("id", strokeGradientId);
149
+ strokeGradient.setAttribute("x1", "0%");
150
+ strokeGradient.setAttribute("y1", "0%");
151
+ strokeGradient.setAttribute("x2", "100%");
152
+ strokeGradient.setAttribute("y2", "0%");
153
+ const strokeStop1 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
154
+ strokeStop1.setAttribute("offset", `${percentage * 100}%`);
155
+ strokeStop1.setAttribute("stop-color", color || strokeColor || fillColor || "currentColor");
156
+ strokeGradient.appendChild(strokeStop1);
157
+ const strokeStop2 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
158
+ strokeStop2.setAttribute("offset", `${percentage * 100}%`);
159
+ strokeStop2.setAttribute("stop-color", secondaryFillColor || "currentColor");
160
+ strokeGradient.appendChild(strokeStop2);
161
+ defs.appendChild(strokeGradient);
162
+ path.setAttribute("fill", `url(#${fillGradientId})`);
163
+ path.setAttribute("stroke", `url(#${strokeGradientId})`);
164
+ path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
141
165
  }
142
166
  });
143
167
  } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.8.43",
3
+ "version": "0.8.44",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",