@xsolla/xui-image-thumbnail 0.123.0 → 0.125.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.mjs CHANGED
@@ -2825,6 +2825,7 @@ var Box = ({
2825
2825
  };
2826
2826
 
2827
2827
  // ../primitives-native/src/LinearGradient.tsx
2828
+ import { useRef } from "react";
2828
2829
  import { View as View2 } from "react-native";
2829
2830
 
2830
2831
  // ../../node_modules/react-native-svg/lib/module/elements/Shape.js
@@ -5283,6 +5284,22 @@ var err = console.error.bind(console);
5283
5284
 
5284
5285
  // ../primitives-native/src/LinearGradient.tsx
5285
5286
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
5287
+ var gradientIdCounter = 0;
5288
+ function parseColor(color) {
5289
+ if (color === "transparent") {
5290
+ return { stopColor: "#000000", stopOpacity: 0 };
5291
+ }
5292
+ const rgbaMatch = color.match(
5293
+ /^rgba?\(\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+%?)\s*,\s*([\d.]+)\s*\)$/i
5294
+ );
5295
+ if (rgbaMatch) {
5296
+ return {
5297
+ stopColor: `rgb(${rgbaMatch[1]}, ${rgbaMatch[2]}, ${rgbaMatch[3]})`,
5298
+ stopOpacity: parseFloat(rgbaMatch[4])
5299
+ };
5300
+ }
5301
+ return { stopColor: color, stopOpacity: 1 };
5302
+ }
5286
5303
  var LinearGradient2 = ({
5287
5304
  colors,
5288
5305
  start = { x: 0, y: 0 },
@@ -5316,9 +5333,19 @@ var LinearGradient2 = ({
5316
5333
  zIndex,
5317
5334
  ...style
5318
5335
  };
5336
+ const gradientId = useRef(`xui-lg-${++gradientIdCounter}`).current;
5319
5337
  const stops = colors.map((color, index) => {
5320
5338
  const offset = locations ? locations[index] : index / (colors.length - 1);
5321
- return /* @__PURE__ */ jsx2(Stop, { offset, stopColor: color }, index);
5339
+ const { stopColor, stopOpacity } = parseColor(color);
5340
+ return /* @__PURE__ */ jsx2(
5341
+ Stop,
5342
+ {
5343
+ offset,
5344
+ stopColor,
5345
+ stopOpacity
5346
+ },
5347
+ index
5348
+ );
5322
5349
  });
5323
5350
  return /* @__PURE__ */ jsxs(View2, { style: containerStyle, testID: dataTestId || testID, children: [
5324
5351
  /* @__PURE__ */ jsxs(
@@ -5331,7 +5358,7 @@ var LinearGradient2 = ({
5331
5358
  /* @__PURE__ */ jsx2(Defs, { children: /* @__PURE__ */ jsx2(
5332
5359
  LinearGradient,
5333
5360
  {
5334
- id: "grad",
5361
+ id: gradientId,
5335
5362
  x1: `${start.x * 100}%`,
5336
5363
  y1: `${start.y * 100}%`,
5337
5364
  x2: `${end.x * 100}%`,
@@ -5339,7 +5366,16 @@ var LinearGradient2 = ({
5339
5366
  children: stops
5340
5367
  }
5341
5368
  ) }),
5342
- /* @__PURE__ */ jsx2(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#grad)" })
5369
+ /* @__PURE__ */ jsx2(
5370
+ Rect,
5371
+ {
5372
+ x: "0",
5373
+ y: "0",
5374
+ width: "100%",
5375
+ height: "100%",
5376
+ fill: `url(#${gradientId})`
5377
+ }
5378
+ )
5343
5379
  ]
5344
5380
  }
5345
5381
  ),