@lglab/react-qr-code 1.4.2 → 1.4.3

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { JSX } from 'react/jsx-runtime';
1
+ import { ForwardRefExoticComponent } from 'react';
2
+ import { RefAttributes } from 'react';
2
3
 
3
4
  /**
4
5
  * ReactQRCode props.
@@ -218,10 +219,7 @@ declare namespace qrcodegen.QrSegment {
218
219
  {};
219
220
  }
220
221
 
221
- export declare const ReactQRCode: {
222
- (props: ReactQRCodeProps): JSX.Element;
223
- displayName: string;
224
- };
222
+ export declare const ReactQRCode: ForwardRefExoticComponent<Omit<ReactQRCodeProps, "ref"> & RefAttributes<ReactQRCodeRef>>;
225
223
 
226
224
  export declare interface ReactQRCodeProps {
227
225
  ref?: React.Ref<ReactQRCodeRef>;
package/dist/index.es.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as C, jsxs as K, Fragment as st } from "react/jsx-runtime";
2
- import { useMemo as v, useCallback as it, useId as at, useRef as ct, useImperativeHandle as lt } from "react";
3
- const ht = /\.?0+$/;
4
- function ut(o) {
5
- return o.toFixed(7).replace(ht, "");
2
+ import { useMemo as v, useCallback as it, useId as at, forwardRef as ct, useRef as lt, useImperativeHandle as ht } from "react";
3
+ const ut = /\.?0+$/;
4
+ function dt(o) {
5
+ return o.toFixed(7).replace(ut, "");
6
6
  }
7
7
  const W = (o) => {
8
8
  const a = o % 360 * (Math.PI / 180), c = Math.max(0, Math.min(100, 50 - 50 * Math.cos(a))), i = Math.max(0, Math.min(100, 50 - 50 * Math.sin(a))), r = Math.max(0, Math.min(100, 50 + 50 * Math.cos(a))), u = Math.max(0, Math.min(100, 50 + 50 * Math.sin(a)));
@@ -165,10 +165,10 @@ const W = (o) => {
165
165
  1,
166
166
  0.3262506,
167
167
  "z"
168
- ].map((u) => typeof u == "string" ? (r = 0, i = u.toUpperCase() == u, u) : (r++, u = u * c, i && (u += r % 2 == 1 ? o : a), ut(u))).join(" ");
168
+ ].map((u) => typeof u == "string" ? (r = 0, i = u.toUpperCase() == u, u) : (r++, u = u * c, i && (u += r % 2 == 1 ? o : a), dt(u))).join(" ");
169
169
  }, Q = {
170
170
  "data-testid": "background"
171
- }, dt = ({ background: o, bgGradientId: a, numCells: c }) => {
171
+ }, $t = ({ background: o, bgGradientId: a, numCells: c }) => {
172
172
  var r, u;
173
173
  if (!o)
174
174
  return null;
@@ -743,12 +743,12 @@ var S;
743
743
  a.Mode = c;
744
744
  })(o.QrSegment || (o.QrSegment = {}));
745
745
  })(S || (S = {}));
746
- const U = S, $t = {
746
+ const U = S, ft = {
747
747
  L: U.QrCode.Ecc.LOW,
748
748
  M: U.QrCode.Ecc.MEDIUM,
749
749
  Q: U.QrCode.Ecc.QUARTILE,
750
750
  H: U.QrCode.Ecc.HIGH
751
- }, ft = 128, pt = "M", mt = 1, Et = 4, nt = 5, H = "#000000", Mt = "square", Rt = "square", gt = "square", Nt = "react-qr-code", It = "react-qr-code-gradient", Ct = "react-qr-code-bg-gradient", wt = 0.1, N = 7, T = 3, y = [
751
+ }, pt = 128, mt = "M", Et = 1, Mt = 4, nt = 5, H = "#000000", Rt = "square", gt = "square", Nt = "square", It = "react-qr-code", Ct = "react-qr-code-gradient", wt = "react-qr-code-bg-gradient", At = 0.1, N = 7, T = 3, y = [
752
752
  [1, 1, 1, 1, 1, 1, 1],
753
753
  [1, 0, 0, 0, 0, 0, 1],
754
754
  [1, 0, 0, 0, 0, 0, 1],
@@ -803,7 +803,7 @@ const U = S, $t = {
803
803
  [0, 0, 1, 1, 1, 0, 0],
804
804
  [0, 0, 0, 0, 0, 0, 0],
805
805
  [0, 0, 0, 0, 0, 0, 0]
806
- ], At = (o) => o === "square" || o === "pinched-square" || o === "circle" || o === "star" || o === "heart" || o === "diamond" || o === "hashtag", Pt = (o, a) => o === "square-sm" ? 0.75 : a ? Math.random() * (1 - 0.75) + 0.75 : 1, D = (o, a, c) => {
806
+ ], Pt = (o) => o === "square" || o === "pinched-square" || o === "circle" || o === "star" || o === "heart" || o === "diamond" || o === "hashtag", Ot = (o, a) => o === "square-sm" ? 0.75 : a ? Math.random() * (1 - 0.75) + 0.75 : 1, D = (o, a, c) => {
807
807
  const i = {
808
808
  left: o === 0 ? !1 : c[a][o - 1],
809
809
  right: o === c[a].length - 1 ? !1 : c[a][o + 1],
@@ -814,7 +814,7 @@ const U = S, $t = {
814
814
  ...i,
815
815
  count: Object.values(i).filter(Boolean).length
816
816
  };
817
- }, b = (o, a, c) => `M${o},${a}h${c}v${c}h-${c}Z`, F = (o, a, c) => `M${o},${a + c / 2}a${c / 2},${c / 2} 0 1,0 ${c},0a${c / 2},${c / 2} 0 1,0 -${c},0Z`, Ot = (o, a, c) => `M${o},${a + c / 2}l${c / 2},-${c / 2}l${c / 2},${c / 2}l-${c / 2},${c / 2}Z`, Tt = (o, a) => `M ${o} ${a}
817
+ }, b = (o, a, c) => `M${o},${a}h${c}v${c}h-${c}Z`, F = (o, a, c) => `M${o},${a + c / 2}a${c / 2},${c / 2} 0 1,0 ${c},0a${c / 2},${c / 2} 0 1,0 -${c},0Z`, Tt = (o, a, c) => `M${o},${a + c / 2}l${c / 2},-${c / 2}l${c / 2},${c / 2}l-${c / 2},${c / 2}Z`, Lt = (o, a) => `M ${o} ${a}
818
818
  v 1
819
819
  h 1
820
820
  v -0.5
@@ -827,7 +827,7 @@ const U = S, $t = {
827
827
  h 0.5
828
828
  a 0.5 0.5, 0, 0, 0, 0.5 -0.5
829
829
  v -0.5
830
- h -1`, Lt = (o, a) => `M ${o + 1} ${a}
830
+ h -1`, vt = (o, a) => `M ${o + 1} ${a}
831
831
  v 1
832
832
  h -0.5
833
833
  a 0.5 0.5, 0, 0, 1, -0.5 -0.5
@@ -844,66 +844,66 @@ const U = S, $t = {
844
844
  a 0.5 0.5, 0, 0, 0, -1 0`, Z = (o, a) => `M ${o} ${a}
845
845
  h 1
846
846
  v 0.5
847
- a 0.5 0.5, 0, 0, 1, -1 0`, vt = (o, a, c) => `M ${o + 1} ${a}h -${c / 2}a ${c / 2.5} ${c / 2.5}, 0, 0, 0, ${-c / 2.5} ${c / 2.5}v ${c / 2}h ${c / 2}a ${c / 2.5} ${c / 2.5}, 0, 0, 0, ${c / 2.5} ${-c / 2.5}`, St = ({
847
+ a 0.5 0.5, 0, 0, 1, -1 0`, St = (o, a, c) => `M ${o + 1} ${a}h -${c / 2}a ${c / 2.5} ${c / 2.5}, 0, 0, 0, ${-c / 2.5} ${c / 2.5}v ${c / 2}h ${c / 2}a ${c / 2.5} ${c / 2.5}, 0, 0, 0, ${c / 2.5} ${-c / 2.5}`, Ut = ({
848
848
  x: o,
849
849
  y: a,
850
850
  numCells: c
851
851
  }) => {
852
852
  var i, r, u;
853
853
  return !!((i = B[o]) != null && i[a] || (r = B[o - c + 7]) != null && r[a] || (u = B[o]) != null && u[a - c + 7]);
854
- }, Ut = ({
854
+ }, bt = ({
855
855
  x: o,
856
856
  y: a,
857
857
  radius: c
858
858
  }) => {
859
859
  const i = T - c, r = c / 2, u = T - r;
860
860
  return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}H ${o}z`;
861
- }, bt = ({
861
+ }, Dt = ({
862
862
  x: o,
863
863
  y: a,
864
864
  radius: c
865
865
  }) => {
866
866
  const i = T - c, r = c / 2, u = T - r;
867
867
  return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${r}`;
868
- }, Dt = ({
868
+ }, Ft = ({
869
869
  x: o,
870
870
  y: a,
871
871
  numCells: c
872
872
  }) => {
873
873
  var i, r, u;
874
874
  return !!((i = y[o]) != null && i[a] || (r = y[o - c + 7]) != null && r[a] || (u = y[o]) != null && u[a - c + 7]);
875
- }, Ft = ({
875
+ }, yt = ({
876
876
  x: o,
877
877
  y: a,
878
878
  radius: c
879
879
  }) => {
880
880
  const i = N - c, r = c / 2;
881
881
  return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${i}a ${r} ${r}, 0, 0, 0, ${r} ${-r}v ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${r}M ${o + r} ${a + 1}h ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${r - 1}v ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${r - 1}h ${-i}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${-(r - 1)}v ${-i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${-(r - 1)}`;
882
- }, yt = ({
882
+ }, Bt = ({
883
883
  x: o,
884
884
  y: a,
885
885
  radius: c
886
886
  }) => {
887
887
  const i = N - c, r = c / 2, u = N - r;
888
888
  return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}H ${o}zM ${o + r} ${a + 1}h ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${r - 1}v ${u - 1}h ${-(u - 1)}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${-(r - 1)}v ${-(u - 1)}z`;
889
- }, Bt = ({
889
+ }, Ht = ({
890
890
  x: o,
891
891
  y: a,
892
892
  radius: c
893
893
  }) => {
894
894
  const i = N - c, r = c / 2, u = N - r;
895
895
  return `M ${o} ${a + r}v ${i}a ${r} ${r}, 0, 0, 0, ${r} ${r}h ${u}v ${-u}a ${r} ${r}, 0, 0, 0, ${-r} ${-r}h ${-i}a ${r} ${r}, 0, 0, 0, ${-r} ${r}M ${o + r} ${a + 1}h ${i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${r - 1}v ${u - 1}h ${-(u - 1)}a ${r - 1} ${r - 1}, 0, 0, 1, ${-(r - 1)} ${-(r - 1)}v ${-i}a ${r - 1} ${r - 1}, 0, 0, 1, ${r - 1} ${-(r - 1)}`;
896
- }, Ht = (o) => ({
896
+ }, _t = (o) => ({
897
897
  color: (o == null ? void 0 : o.color) || H,
898
- style: (o == null ? void 0 : o.style) || gt,
898
+ style: (o == null ? void 0 : o.style) || Nt,
899
899
  randomSize: (o == null ? void 0 : o.randomSize) || !1
900
- }), _t = (o) => ({
901
- color: (o == null ? void 0 : o.color) || H,
902
- style: (o == null ? void 0 : o.style) || Mt
903
900
  }), zt = (o) => ({
904
901
  color: (o == null ? void 0 : o.color) || H,
905
902
  style: (o == null ? void 0 : o.style) || Rt
906
- }), Qt = ({
903
+ }), Qt = (o) => ({
904
+ color: (o == null ? void 0 : o.color) || H,
905
+ style: (o == null ? void 0 : o.style) || gt
906
+ }), kt = ({
907
907
  modules: o,
908
908
  margin: a,
909
909
  settings: c,
@@ -911,15 +911,15 @@ const U = S, $t = {
911
911
  gradientId: r
912
912
  }) => {
913
913
  const { color: u, style: l, randomSize: p } = v(
914
- () => Ht(c),
914
+ () => _t(c),
915
915
  [c]
916
- ), f = [], e = o.length, n = At(l) && p, t = it(
917
- () => Pt(l, n),
916
+ ), f = [], e = o.length, n = Pt(l) && p, t = it(
917
+ () => Ot(l, n),
918
918
  [l, n]
919
919
  );
920
920
  return o.forEach((s, h) => {
921
921
  s.forEach(($, d) => {
922
- if (Dt({ x: d, y: h, numCells: e }) || St({ x: d, y: h, numCells: e }))
922
+ if (Ft({ x: d, y: h, numCells: e }) || Ut({ x: d, y: h, numCells: e }))
923
923
  return;
924
924
  const R = t(), E = 1 * R, A = (1 - 1 * R) / 2, M = d + a + A, m = h + a + A;
925
925
  if ($) {
@@ -930,7 +930,7 @@ const U = S, $t = {
930
930
  else if (l === "circle")
931
931
  f.push(F(M, m, E));
932
932
  else if (l === "diamond")
933
- f.push(Ot(M, m, E));
933
+ f.push(Tt(M, m, E));
934
934
  else if (l === "star")
935
935
  f.push(
936
936
  J(M + E / 2, m + E / 2, E * 1.1, nt)
@@ -941,11 +941,11 @@ const U = S, $t = {
941
941
  f.push(et(M, m, E));
942
942
  else if (l === "rounded") {
943
943
  const { left: g, right: I, top: w, bottom: P, count: O } = D(d, h, o);
944
- O === 0 ? f.push(F(M, m, 1)) : O > 2 || g && I || w && P ? f.push(b(M, m, 1)) : O === 2 ? g && w ? f.push(G(M, m)) : w && I ? f.push(Lt(M, m)) : I && P ? f.push(Y(M, m)) : f.push(Tt(M, m)) : w ? f.push(Z(M, m)) : I ? f.push(V(M, m)) : P ? f.push(X(M, m)) : f.push(j(M, m));
944
+ O === 0 ? f.push(F(M, m, 1)) : O > 2 || g && I || w && P ? f.push(b(M, m, 1)) : O === 2 ? g && w ? f.push(G(M, m)) : w && I ? f.push(vt(M, m)) : I && P ? f.push(Y(M, m)) : f.push(Lt(M, m)) : w ? f.push(Z(M, m)) : I ? f.push(V(M, m)) : P ? f.push(X(M, m)) : f.push(j(M, m));
945
945
  } else if (l === "leaf") {
946
946
  const { left: g, right: I, top: w, bottom: P, count: O } = D(d, h, o);
947
947
  if (O === 0)
948
- f.push(vt(M, m, E));
948
+ f.push(St(M, m, E));
949
949
  else if (!g && !w) {
950
950
  f.push(Y(M, m));
951
951
  return;
@@ -970,7 +970,7 @@ const U = S, $t = {
970
970
  );
971
971
  }, L = {
972
972
  "data-testid": "finder-patterns-inner"
973
- }, kt = ({
973
+ }, qt = ({
974
974
  modules: o,
975
975
  margin: a,
976
976
  settings: c,
@@ -978,7 +978,7 @@ const U = S, $t = {
978
978
  gradientId: r
979
979
  }) => {
980
980
  const { color: u, style: l } = v(
981
- () => zt(c),
981
+ () => Qt(c),
982
982
  [c]
983
983
  ), p = i ? `url(#${r})` : u, f = v(
984
984
  () => [
@@ -1032,7 +1032,7 @@ const U = S, $t = {
1032
1032
  );
1033
1033
  });
1034
1034
  if (l === "inpoint-sm" || l === "inpoint" || l === "inpoint-lg" || l === "outpoint-sm" || l === "outpoint" || l === "outpoint-lg" || l === "leaf-sm" || l === "leaf" || l === "leaf-lg") {
1035
- const n = l === "leaf-sm" || l === "leaf" || l === "leaf-lg" ? Ut : bt;
1035
+ const n = l === "leaf-sm" || l === "leaf" || l === "leaf-lg" ? bt : Dt;
1036
1036
  return f.map((t, s) => ({
1037
1037
  ...t,
1038
1038
  rotation: rt[l][s]
@@ -1080,7 +1080,7 @@ const U = S, $t = {
1080
1080
  });
1081
1081
  }, x = {
1082
1082
  "data-testid": "finder-patterns-outer"
1083
- }, qt = ({
1083
+ }, Yt = ({
1084
1084
  modules: o,
1085
1085
  margin: a,
1086
1086
  settings: c,
@@ -1088,7 +1088,7 @@ const U = S, $t = {
1088
1088
  gradientId: r
1089
1089
  }) => {
1090
1090
  const { style: u, color: l } = v(
1091
- () => _t(c),
1091
+ () => zt(c),
1092
1092
  [c]
1093
1093
  ), p = i ? `url(#${r})` : l, f = [], e = v(
1094
1094
  () => [
@@ -1109,7 +1109,7 @@ const U = S, $t = {
1109
1109
  for (const n of e) {
1110
1110
  const { x: t, y: s } = n;
1111
1111
  u === "rounded-sm" || u === "rounded" || u === "rounded-lg" ? f.push(
1112
- Ft({
1112
+ yt({
1113
1113
  x: t,
1114
1114
  y: s,
1115
1115
  radius: k[u]
@@ -1125,7 +1125,7 @@ const U = S, $t = {
1125
1125
  return /* @__PURE__ */ C("path", { fill: p, d: f.join(""), ...x });
1126
1126
  }
1127
1127
  if (u === "inpoint-sm" || u === "inpoint" || u === "inpoint-lg" || u === "outpoint-sm" || u === "outpoint" || u === "outpoint-lg" || u === "leaf-sm" || u === "leaf" || u === "leaf-lg") {
1128
- const n = u === "leaf-sm" || u === "leaf" || u === "leaf-lg" ? yt : Bt;
1128
+ const n = u === "leaf-sm" || u === "leaf" || u === "leaf-lg" ? Bt : Ht;
1129
1129
  return e.map((t, s) => ({
1130
1130
  ...t,
1131
1131
  rotation: rt[u][s]
@@ -1151,7 +1151,7 @@ const U = S, $t = {
1151
1151
  );
1152
1152
  });
1153
1153
  }
1154
- }, Yt = ({ gradient: o, gradientId: a }) => {
1154
+ }, Gt = ({ gradient: o, gradientId: a }) => {
1155
1155
  var i, r;
1156
1156
  if (!o)
1157
1157
  return null;
@@ -1167,16 +1167,16 @@ const U = S, $t = {
1167
1167
  children: (r = o.stops) == null ? void 0 : r.map((u, l) => /* @__PURE__ */ C("stop", { offset: u.offset, stopColor: u.color }, l))
1168
1168
  }
1169
1169
  ) });
1170
- }, Gt = () => {
1170
+ }, jt = () => {
1171
1171
  const o = at();
1172
1172
  return {
1173
- gradientId: `${It}-${o}`,
1174
- bgGradientId: `${Ct}-${o}`
1173
+ gradientId: `${Ct}-${o}`,
1174
+ bgGradientId: `${wt}-${o}`
1175
1175
  };
1176
- }, jt = (o, a) => o.slice().map((c, i) => i < a.y || i >= a.y + a.h ? c : c.map((r, u) => u < a.x || u >= a.x + a.w ? r : !1)), Vt = (o, a, c, i) => {
1176
+ }, Vt = (o, a) => o.slice().map((c, i) => i < a.y || i >= a.y + a.h ? c : c.map((r, u) => u < a.x || u >= a.x + a.w ? r : !1)), Xt = (o, a, c, i) => {
1177
1177
  if (i == null)
1178
1178
  return null;
1179
- const r = o.length + c * 2, u = Math.floor(a * wt), l = r / a, p = (i.width || u) * l, f = (i.height || u) * l, e = i.x == null ? o.length / 2 - p / 2 : i.x * l, n = i.y == null ? o.length / 2 - f / 2 : i.y * l, t = i.opacity == null ? 1 : i.opacity;
1179
+ const r = o.length + c * 2, u = Math.floor(a * At), l = r / a, p = (i.width || u) * l, f = (i.height || u) * l, e = i.x == null ? o.length / 2 - p / 2 : i.x * l, n = i.y == null ? o.length / 2 - f / 2 : i.y * l, t = i.opacity == null ? 1 : i.opacity;
1180
1180
  let s = null;
1181
1181
  if (i.excavate) {
1182
1182
  const $ = Math.floor(e), d = Math.floor(n), R = Math.ceil(p + e - $), E = Math.ceil(f + n - d);
@@ -1184,7 +1184,7 @@ const U = S, $t = {
1184
1184
  }
1185
1185
  const h = i.crossOrigin;
1186
1186
  return { x: e, y: n, h: f, w: p, excavation: s, opacity: t, crossOrigin: h };
1187
- }, Xt = (o) => o != null ? Math.max(Math.floor(o), 0) : Et, Zt = ({
1187
+ }, Zt = (o) => o != null ? Math.max(Math.floor(o), 0) : Mt, xt = ({
1188
1188
  value: o,
1189
1189
  level: a,
1190
1190
  minVersion: c,
@@ -1197,14 +1197,14 @@ const U = S, $t = {
1197
1197
  const h = (Array.isArray(o) ? o : [o]).reduce(($, d) => ($.push(...U.QrSegment.makeSegments(d)), $), []);
1198
1198
  return U.QrCode.encodeSegments(
1199
1199
  h,
1200
- $t[a],
1200
+ ft[a],
1201
1201
  c,
1202
1202
  void 0,
1203
1203
  void 0,
1204
1204
  l
1205
1205
  );
1206
1206
  }, [o, a, c, l]), { cells: f, margin: e, numCells: n, calculatedImageSettings: t } = v(() => {
1207
- const s = p.getModules(), h = Xt(i), $ = s.length + h * 2, d = Vt(s, u, h, r);
1207
+ const s = p.getModules(), h = Zt(i), $ = s.length + h * 2, d = Xt(s, u, h, r);
1208
1208
  return {
1209
1209
  cells: s,
1210
1210
  margin: h,
@@ -1219,7 +1219,7 @@ const U = S, $t = {
1219
1219
  numCells: n,
1220
1220
  calculatedImageSettings: t
1221
1221
  };
1222
- }, xt = ({ svgRef: o, fileSize: a, fileName: c }) => {
1222
+ }, Kt = ({ svgRef: o, fileSize: a, fileName: c }) => {
1223
1223
  if (!o.current) return;
1224
1224
  const i = o.current.cloneNode(!0);
1225
1225
  i.setAttribute("width", a.toString()), i.setAttribute("height", a.toString());
@@ -1227,7 +1227,7 @@ const U = S, $t = {
1227
1227
  type: "image/svg+xml"
1228
1228
  }), l = URL.createObjectURL(u), p = document.createElement("a");
1229
1229
  p.href = l, p.download = `${c}.svg`, document.body.appendChild(p), p.click(), document.body.removeChild(p), URL.revokeObjectURL(l);
1230
- }, Kt = ({
1230
+ }, Wt = ({
1231
1231
  svgRef: o,
1232
1232
  fileSize: a,
1233
1233
  fileName: c,
@@ -1257,15 +1257,14 @@ const U = S, $t = {
1257
1257
  R.href = e.toDataURL(d), R.download = `${c}.${i}`, document.body.appendChild(R), R.click(), document.body.removeChild(R);
1258
1258
  }
1259
1259
  }, $.onerror = (d) => console.error("Error loading QR code:", d);
1260
- }, Wt = (o) => {
1260
+ }, Jt = ct((o, a) => {
1261
1261
  const {
1262
- ref: a,
1263
1262
  value: c,
1264
- size: i = ft,
1265
- level: r = pt,
1263
+ size: i = pt,
1264
+ level: r = mt,
1266
1265
  background: u,
1267
1266
  gradient: l,
1268
- minVersion: p = mt,
1267
+ minVersion: p = Et,
1269
1268
  boostLevel: f,
1270
1269
  marginSize: e,
1271
1270
  finderPatternOuterSettings: n,
@@ -1273,7 +1272,7 @@ const U = S, $t = {
1273
1272
  dataModulesSettings: s,
1274
1273
  imageSettings: h,
1275
1274
  svgProps: $
1276
- } = o, d = ct(null), { gradientId: R, bgGradientId: E } = Gt(), { margin: A, cells: M, numCells: m, calculatedImageSettings: g } = Zt({
1275
+ } = o, d = lt(null), { gradientId: R, bgGradientId: E } = jt(), { margin: A, cells: M, numCells: m, calculatedImageSettings: g } = xt({
1277
1276
  value: c,
1278
1277
  level: r,
1279
1278
  minVersion: p,
@@ -1282,14 +1281,14 @@ const U = S, $t = {
1282
1281
  imageSettings: h,
1283
1282
  size: i
1284
1283
  });
1285
- lt(a, () => ({
1284
+ ht(a, () => ({
1286
1285
  svg: d.current,
1287
1286
  download: ({
1288
- name: O = Nt,
1287
+ name: O = It,
1289
1288
  format: _ = "svg",
1290
1289
  size: z = 500
1291
1290
  }) => {
1292
- d.current && (_ === "svg" ? xt({ svgRef: d, fileSize: z, fileName: O }) : Kt({
1291
+ d.current && (_ === "svg" ? Kt({ svgRef: d, fileSize: z, fileName: O }) : Wt({
1293
1292
  svgRef: d,
1294
1293
  fileSize: z,
1295
1294
  fileName: O,
@@ -1303,7 +1302,7 @@ const U = S, $t = {
1303
1302
  }
1304
1303
  }));
1305
1304
  let I = M, w = null;
1306
- h != null && g != null && (g.excavation != null && (I = jt(M, g.excavation)), w = /* @__PURE__ */ C(
1305
+ h != null && g != null && (g.excavation != null && (I = Vt(M, g.excavation)), w = /* @__PURE__ */ C(
1307
1306
  "image",
1308
1307
  {
1309
1308
  href: h.src,
@@ -1333,24 +1332,24 @@ const U = S, $t = {
1333
1332
  "aria-label": ($ == null ? void 0 : $["aria-label"]) || "QR Code",
1334
1333
  ...$,
1335
1334
  children: [
1336
- /* @__PURE__ */ C(Yt, { gradient: l, gradientId: R }),
1335
+ /* @__PURE__ */ C(Gt, { gradient: l, gradientId: R }),
1337
1336
  /* @__PURE__ */ C(
1338
- dt,
1337
+ $t,
1339
1338
  {
1340
1339
  background: u,
1341
1340
  bgGradientId: E,
1342
1341
  numCells: m
1343
1342
  }
1344
1343
  ),
1345
- /* @__PURE__ */ C(qt, { settings: n, ...P }),
1346
- /* @__PURE__ */ C(kt, { settings: t, ...P }),
1347
- /* @__PURE__ */ C(Qt, { settings: s, ...P }),
1344
+ /* @__PURE__ */ C(Yt, { settings: n, ...P }),
1345
+ /* @__PURE__ */ C(qt, { settings: t, ...P }),
1346
+ /* @__PURE__ */ C(kt, { settings: s, ...P }),
1348
1347
  w
1349
1348
  ]
1350
1349
  }
1351
1350
  );
1352
- };
1353
- Wt.displayName = "ReactQRCode";
1351
+ });
1352
+ Jt.displayName = "ReactQRCode";
1354
1353
  export {
1355
- Wt as ReactQRCode
1354
+ Jt as ReactQRCode
1356
1355
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lglab/react-qr-code",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "React library to generate QR codes",
5
5
  "author": "LGLab",
6
6
  "license": "MIT",
@@ -46,16 +46,16 @@
46
46
  "react": "^18 || ^19"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "^22.13.4",
50
- "@types/react": "^19.0.8",
51
- "@types/react-dom": "^19.0.3",
49
+ "@types/node": "^22.13.5",
50
+ "@types/react": "^19.0.10",
51
+ "@types/react-dom": "^19.0.4",
52
52
  "@vitejs/plugin-react": "^4.3.4",
53
- "globals": "^15.15.0",
53
+ "globals": "^16.0.0",
54
54
  "react": "^19.0.0",
55
55
  "react-dom": "^19.0.0",
56
56
  "typescript": "~5.7.3",
57
- "typescript-eslint": "^8.24.0",
58
- "vite": "^6.1.0",
57
+ "typescript-eslint": "^8.25.0",
58
+ "vite": "^6.2.0",
59
59
  "vite-plugin-dts": "^4.5.0"
60
60
  },
61
61
  "scripts": {