@xsolla/xui-image-thumbnail 0.124.0 → 0.126.0

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/native/index.js CHANGED
@@ -2829,6 +2829,7 @@ var Box = ({
2829
2829
  };
2830
2830
 
2831
2831
  // ../primitives-native/src/LinearGradient.tsx
2832
+ var import_react21 = require("react");
2832
2833
  var import_react_native14 = require("react-native");
2833
2834
 
2834
2835
  // ../../node_modules/react-native-svg/lib/module/elements/Shape.js
@@ -5287,6 +5288,22 @@ var err = console.error.bind(console);
5287
5288
 
5288
5289
  // ../primitives-native/src/LinearGradient.tsx
5289
5290
  var import_jsx_runtime2 = require("react/jsx-runtime");
5291
+ var gradientIdCounter = 0;
5292
+ function parseColor(color) {
5293
+ if (color === "transparent") {
5294
+ return { stopColor: "#000000", stopOpacity: 0 };
5295
+ }
5296
+ const rgbaMatch = color.match(
5297
+ /^rgba?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+)\s*\)$/i
5298
+ );
5299
+ if (rgbaMatch) {
5300
+ return {
5301
+ stopColor: `rgb(${rgbaMatch[1]}, ${rgbaMatch[2]}, ${rgbaMatch[3]})`,
5302
+ stopOpacity: parseFloat(rgbaMatch[4])
5303
+ };
5304
+ }
5305
+ return { stopColor: color, stopOpacity: 1 };
5306
+ }
5290
5307
  var LinearGradient2 = ({
5291
5308
  colors,
5292
5309
  start = { x: 0, y: 0 },
@@ -5320,9 +5337,19 @@ var LinearGradient2 = ({
5320
5337
  zIndex,
5321
5338
  ...style
5322
5339
  };
5340
+ const gradientId = (0, import_react21.useRef)(`xui-lg-${++gradientIdCounter}`).current;
5323
5341
  const stops = colors.map((color, index) => {
5324
5342
  const offset = locations ? locations[index] : index / (colors.length - 1);
5325
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Stop, { offset, stopColor: color }, index);
5343
+ const { stopColor, stopOpacity } = parseColor(color);
5344
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5345
+ Stop,
5346
+ {
5347
+ offset,
5348
+ stopColor,
5349
+ stopOpacity
5350
+ },
5351
+ index
5352
+ );
5326
5353
  });
5327
5354
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native14.View, { style: containerStyle, testID: dataTestId || testID, children: [
5328
5355
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -5335,7 +5362,7 @@ var LinearGradient2 = ({
5335
5362
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5336
5363
  LinearGradient,
5337
5364
  {
5338
- id: "grad",
5365
+ id: gradientId,
5339
5366
  x1: `${start.x * 100}%`,
5340
5367
  y1: `${start.y * 100}%`,
5341
5368
  x2: `${end.x * 100}%`,
@@ -5343,7 +5370,16 @@ var LinearGradient2 = ({
5343
5370
  children: stops
5344
5371
  }
5345
5372
  ) }),
5346
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#grad)" })
5373
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5374
+ Rect,
5375
+ {
5376
+ x: "0",
5377
+ y: "0",
5378
+ width: "100%",
5379
+ height: "100%",
5380
+ fill: `url(#${gradientId})`
5381
+ }
5382
+ )
5347
5383
  ]
5348
5384
  }
5349
5385
  ),