@tapcart/mobile-components 0.8.42 → 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;AAyLD,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"}
@@ -94,87 +94,74 @@ const TablerIcon = ({ name, size }) => {
94
94
  const CustomIcon = ({ url, size, color, strokeColor, strokeWidth, fillColor, fillPercentage, secondaryFillColor, }) => {
95
95
  return (_jsx(ReactSVG, { src: url, beforeInjection: (svg) => {
96
96
  svg.setAttribute("style", `width: ${sizeMapping[size]}px; height: ${sizeMapping[size]}px`);
97
- const uniqueId = crypto.randomUUID();
98
- const fillGradientId = `fill-gradient-${uniqueId}`;
99
- const strokeGradientId = `stroke-gradient-${uniqueId}`;
100
- const percentage = Math.min(Math.max(fillPercentage, 0), 1);
101
- let defs = svg.querySelector("defs");
102
- if (!defs) {
103
- defs = document.createElementNS("http://www.w3.org/2000/svg", "defs");
104
- svg.prepend(defs);
105
- }
106
- if (percentage > 0 && percentage < 1) {
107
- const fillGradient = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");
108
- fillGradient.setAttribute("id", fillGradientId);
109
- fillGradient.setAttribute("x1", "0%");
110
- fillGradient.setAttribute("y1", "0%");
111
- fillGradient.setAttribute("x2", "100%");
112
- fillGradient.setAttribute("y2", "0%");
113
- const fillStop1 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
114
- fillStop1.setAttribute("offset", `${percentage * 100}%`);
115
- fillStop1.setAttribute("stop-color", color || fillColor || "currentColor");
116
- fillGradient.appendChild(fillStop1);
117
- const fillStop2 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
118
- fillStop2.setAttribute("offset", `${percentage * 100}%`);
119
- fillStop2.setAttribute("stop-color", secondaryFillColor || "transparent");
120
- fillGradient.appendChild(fillStop2);
121
- defs.appendChild(fillGradient);
122
- const strokeGradient = document.createElementNS("http://www.w3.org/2000/svg", "linearGradient");
123
- strokeGradient.setAttribute("id", strokeGradientId);
124
- strokeGradient.setAttribute("x1", "0%");
125
- strokeGradient.setAttribute("y1", "0%");
126
- strokeGradient.setAttribute("x2", "100%");
127
- strokeGradient.setAttribute("y2", "0%");
128
- const strokeStop1 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
129
- strokeStop1.setAttribute("offset", `${percentage * 100}%`);
130
- strokeStop1.setAttribute("stop-color", color || strokeColor || fillColor || "currentColor");
131
- strokeGradient.appendChild(strokeStop1);
132
- const strokeStop2 = document.createElementNS("http://www.w3.org/2000/svg", "stop");
133
- strokeStop2.setAttribute("offset", `${percentage * 100}%`);
134
- strokeStop2.setAttribute("stop-color", secondaryFillColor || "transparent");
135
- strokeGradient.appendChild(strokeStop2);
136
- defs.appendChild(strokeGradient);
137
- }
138
97
  const paths = svg.querySelectorAll("path");
139
98
  paths.forEach((path) => {
140
- if (path.hasAttribute("fill") &&
141
- path.getAttribute("fill") !== "none") {
142
- if (percentage === 1) {
143
- path.setAttribute("fill", color ||
144
- fillColor ||
145
- path.getAttribute("fill") ||
146
- "currentColor");
147
- }
148
- else if (percentage === 0) {
149
- path.setAttribute("fill", secondaryFillColor || "transparent");
150
- }
151
- else {
152
- path.setAttribute("fill", `url(#${fillGradientId})`);
99
+ if (color) {
100
+ if (path.hasAttribute("fill") && fillPercentage === 1) {
101
+ path.setAttribute("fill", color);
153
102
  }
103
+ path.setAttribute("stroke", color);
154
104
  }
155
- if (path.hasAttribute("stroke") &&
156
- path.getAttribute("stroke") !== "none") {
157
- if (percentage === 1) {
158
- path.setAttribute("stroke", color ||
159
- strokeColor ||
160
- path.getAttribute("stroke") ||
161
- "currentColor");
162
- }
163
- else if (percentage === 0) {
164
- path.setAttribute("stroke", secondaryFillColor || "transparent");
105
+ else {
106
+ if (fillColor &&
107
+ path.hasAttribute("fill") &&
108
+ fillPercentage === 1) {
109
+ path.setAttribute("fill", fillColor);
165
110
  }
166
- else {
167
- path.setAttribute("stroke", `url(#${strokeGradientId})`);
111
+ if (strokeColor) {
112
+ path.setAttribute("stroke", strokeColor);
168
113
  }
169
114
  }
170
- if (path.hasAttribute("stroke") &&
171
- path.getAttribute("stroke") !== "none") {
172
- if (strokeWidth != null) {
173
- path.setAttribute("stroke-width", strokeWidth.toString());
174
- }
175
- else {
176
- path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
115
+ if (path.hasAttribute("stroke")) {
116
+ path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
117
+ }
118
+ if (strokeWidth != null && path.hasAttribute("stroke")) {
119
+ path.setAttribute("stroke-width", strokeWidth.toString());
120
+ }
121
+ // Create a gradient fill based on the fillPercentage
122
+ if (fillPercentage && fillPercentage > 0 && fillPercentage < 1) {
123
+ const percentage = Math.min(Math.max(fillPercentage, 0), 1);
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);
177
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());
178
165
  }
179
166
  });
180
167
  } }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.8.42",
3
+ "version": "0.8.44",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",