kaleido-ui 0.1.49 → 0.1.51

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.
@@ -234,7 +234,7 @@ function KaleidoThemeProvider({
234
234
  var import_wdk_uikit_react_native2 = require("@tetherto/wdk-uikit-react-native");
235
235
 
236
236
  // src/native/components/qr-code.tsx
237
- var import_react = require("react");
237
+ var import_react = __toESM(require("react"), 1);
238
238
  var import_react_native = require("react-native");
239
239
  var import_react_native_svg = __toESM(require("react-native-svg"), 1);
240
240
  var import_qr = __toESM(require("qr"), 1);
@@ -308,7 +308,7 @@ var LogoPaths = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_r
308
308
  ),
309
309
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_svg.Path, { d: "M274.479 0.104797H411.786L274.533 137.411H137.226L274.479 0.104797Z", fill: "#17B581" })
310
310
  ] });
311
- function QrCode({
311
+ function QrCodeImpl({
312
312
  value,
313
313
  size = 160,
314
314
  color = "#040404",
@@ -327,6 +327,9 @@ function QrCode({
327
327
  const logoZoneSize = logoModules % 2 === 0 ? logoModules + 1 : logoModules;
328
328
  const els = [];
329
329
  const dotRadius = moduleSize * 0.42;
330
+ const r = Math.round(dotRadius * 100) / 100;
331
+ const d2r = r * 2;
332
+ let dataPath = "";
330
333
  for (let row = 0; row < n; row++) {
331
334
  for (let col = 0; col < n; col++) {
332
335
  if (isFinderPattern(row, col, n)) continue;
@@ -334,23 +337,26 @@ function QrCode({
334
337
  if (!matrix[row][col]) continue;
335
338
  const cx = quietZone + col * moduleSize + moduleSize / 2;
336
339
  const cy = quietZone + row * moduleSize + moduleSize / 2;
337
- els.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_svg.Circle, { cx, cy, r: dotRadius, fill: fg }, `d-${row}-${col}`));
340
+ dataPath += `M${cx - r} ${cy}a${r} ${r} 0 1 0 ${d2r} 0a${r} ${r} 0 1 0 ${-d2r} 0Z`;
338
341
  }
339
342
  }
343
+ if (dataPath) {
344
+ els.push(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_svg.Path, { d: dataPath, fill: fg }, "data"));
345
+ }
340
346
  const finderPositions = [
341
347
  [0, 0],
342
348
  [0, n - 7],
343
349
  [n - 7, 0]
344
350
  ];
345
- for (const [r, c] of finderPositions) {
351
+ for (const [r2, c] of finderPositions) {
346
352
  els.push(
347
353
  ...renderFinderPattern(
348
354
  quietZone + c * moduleSize,
349
- quietZone + r * moduleSize,
355
+ quietZone + r2 * moduleSize,
350
356
  moduleSize,
351
357
  fg,
352
358
  bg,
353
- `fp-${r}-${c}`
359
+ `fp-${r2}-${c}`
354
360
  )
355
361
  );
356
362
  }
@@ -372,6 +378,7 @@ function QrCode({
372
378
  }
373
379
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native.View, { style: { width: size, height: size }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_svg.default, { width: size, height: size, viewBox: `0 0 ${svgSize} ${svgSize}`, children: elements }) });
374
380
  }
381
+ var QrCode = import_react.default.memo(QrCodeImpl);
375
382
 
376
383
  // src/native/components/status-badge.tsx
377
384
  var import_react_native2 = require("react-native");
@@ -65,7 +65,8 @@ interface QrCodeProps {
65
65
  /** Background color used for finder eyes + logo disc. Default white. */
66
66
  backgroundColor?: string;
67
67
  }
68
- declare function QrCode({ value, size, color, backgroundColor, }: QrCodeProps): react_jsx_runtime.JSX.Element;
68
+ declare function QrCodeImpl({ value, size, color, backgroundColor, }: QrCodeProps): react_jsx_runtime.JSX.Element;
69
+ declare const QrCode: React.MemoExoticComponent<typeof QrCodeImpl>;
69
70
 
70
71
  type StatusType = 'success' | 'pending' | 'failed' | 'completed' | 'error';
71
72
  interface StatusBadgeProps {
@@ -65,7 +65,8 @@ interface QrCodeProps {
65
65
  /** Background color used for finder eyes + logo disc. Default white. */
66
66
  backgroundColor?: string;
67
67
  }
68
- declare function QrCode({ value, size, color, backgroundColor, }: QrCodeProps): react_jsx_runtime.JSX.Element;
68
+ declare function QrCodeImpl({ value, size, color, backgroundColor, }: QrCodeProps): react_jsx_runtime.JSX.Element;
69
+ declare const QrCode: React.MemoExoticComponent<typeof QrCodeImpl>;
69
70
 
70
71
  type StatusType = 'success' | 'pending' | 'failed' | 'completed' | 'error';
71
72
  interface StatusBadgeProps {
@@ -171,7 +171,7 @@ import {
171
171
  } from "@tetherto/wdk-uikit-react-native";
172
172
 
173
173
  // src/native/components/qr-code.tsx
174
- import { useMemo } from "react";
174
+ import React, { useMemo } from "react";
175
175
  import { View } from "react-native";
176
176
  import Svg, { Rect, Circle, G, Path } from "react-native-svg";
177
177
  import encodeQR from "qr";
@@ -245,7 +245,7 @@ var LogoPaths = () => /* @__PURE__ */ jsxs(Fragment, { children: [
245
245
  ),
246
246
  /* @__PURE__ */ jsx2(Path, { d: "M274.479 0.104797H411.786L274.533 137.411H137.226L274.479 0.104797Z", fill: "#17B581" })
247
247
  ] });
248
- function QrCode({
248
+ function QrCodeImpl({
249
249
  value,
250
250
  size = 160,
251
251
  color = "#040404",
@@ -264,6 +264,9 @@ function QrCode({
264
264
  const logoZoneSize = logoModules % 2 === 0 ? logoModules + 1 : logoModules;
265
265
  const els = [];
266
266
  const dotRadius = moduleSize * 0.42;
267
+ const r = Math.round(dotRadius * 100) / 100;
268
+ const d2r = r * 2;
269
+ let dataPath = "";
267
270
  for (let row = 0; row < n; row++) {
268
271
  for (let col = 0; col < n; col++) {
269
272
  if (isFinderPattern(row, col, n)) continue;
@@ -271,23 +274,26 @@ function QrCode({
271
274
  if (!matrix[row][col]) continue;
272
275
  const cx = quietZone + col * moduleSize + moduleSize / 2;
273
276
  const cy = quietZone + row * moduleSize + moduleSize / 2;
274
- els.push(/* @__PURE__ */ jsx2(Circle, { cx, cy, r: dotRadius, fill: fg }, `d-${row}-${col}`));
277
+ dataPath += `M${cx - r} ${cy}a${r} ${r} 0 1 0 ${d2r} 0a${r} ${r} 0 1 0 ${-d2r} 0Z`;
275
278
  }
276
279
  }
280
+ if (dataPath) {
281
+ els.push(/* @__PURE__ */ jsx2(Path, { d: dataPath, fill: fg }, "data"));
282
+ }
277
283
  const finderPositions = [
278
284
  [0, 0],
279
285
  [0, n - 7],
280
286
  [n - 7, 0]
281
287
  ];
282
- for (const [r, c] of finderPositions) {
288
+ for (const [r2, c] of finderPositions) {
283
289
  els.push(
284
290
  ...renderFinderPattern(
285
291
  quietZone + c * moduleSize,
286
- quietZone + r * moduleSize,
292
+ quietZone + r2 * moduleSize,
287
293
  moduleSize,
288
294
  fg,
289
295
  bg,
290
- `fp-${r}-${c}`
296
+ `fp-${r2}-${c}`
291
297
  )
292
298
  );
293
299
  }
@@ -309,6 +315,7 @@ function QrCode({
309
315
  }
310
316
  return /* @__PURE__ */ jsx2(View, { style: { width: size, height: size }, children: /* @__PURE__ */ jsx2(Svg, { width: size, height: size, viewBox: `0 0 ${svgSize} ${svgSize}`, children: elements }) });
311
317
  }
318
+ var QrCode = React.memo(QrCodeImpl);
312
319
 
313
320
  // src/native/components/status-badge.tsx
314
321
  import { View as View2, Text, StyleSheet } from "react-native";