@ledgerhq/lumen-ui-react 0.1.62 → 0.1.64

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.
Files changed (179) hide show
  1. package/ai-rules/RULES.md +1 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +80 -78
  5. package/dist/lib/Components/core/AddressInput/AddressInput.js +1 -1
  6. package/dist/lib/Components/core/AmountDisplay/AmountDisplay.js +1 -1
  7. package/dist/lib/Components/core/AmountInput/AmountInput.js +22 -22
  8. package/dist/lib/Components/core/Avatar/Avatar.js +7 -7
  9. package/dist/lib/Components/core/AvatarButton/AvatarButton.js +8 -8
  10. package/dist/lib/Components/core/Banner/Banner.js +1 -1
  11. package/dist/lib/Components/core/Button/Button.js +6 -6
  12. package/dist/lib/Components/core/Card/Card.js +17 -17
  13. package/dist/lib/Components/core/ContentBanner/ContentBanner.d.ts +1 -1
  14. package/dist/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
  15. package/dist/lib/Components/core/DataTable/DataTable.js +45 -45
  16. package/dist/lib/Components/core/Dialog/DialogHeader/DialogHeader.js +1 -1
  17. package/dist/lib/Components/core/Divider/Divider.js +4 -4
  18. package/dist/lib/Components/core/DotCount/DotCount.js +3 -3
  19. package/dist/lib/Components/core/DotIcon/DotIcon.js +4 -4
  20. package/dist/lib/Components/core/DotSymbol/DotSymbol.js +18 -18
  21. package/dist/lib/Components/core/Link/Link.d.ts.map +1 -1
  22. package/dist/lib/Components/core/Link/Link.js +25 -24
  23. package/dist/lib/Components/core/ListItem/ListItem.d.ts +1 -1
  24. package/dist/lib/Components/core/ListItem/ListItem.js +4 -4
  25. package/dist/lib/Components/core/MediaBanner/MediaBanner.js +16 -16
  26. package/dist/lib/Components/core/MediaButton/MediaButton.js +2 -2
  27. package/dist/lib/Components/core/MediaCard/MediaCard.js +1 -1
  28. package/dist/lib/Components/core/MediaImage/MediaImage.js +5 -5
  29. package/dist/lib/Components/core/Menu/Menu.js +25 -25
  30. package/dist/lib/Components/core/NavBar/CoinCapsule.js +4 -4
  31. package/dist/lib/Components/core/NavBar/NavBar.js +3 -3
  32. package/dist/lib/Components/core/PageIndicator/PageIndicator.js +5 -5
  33. package/dist/lib/Components/core/Pagination/Pagination.js +15 -15
  34. package/dist/lib/Components/core/Popover/Popover.js +13 -13
  35. package/dist/lib/Components/core/SearchInput/SearchInput.js +5 -5
  36. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  37. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +78 -82
  38. package/dist/lib/Components/core/Select/Select.d.ts.map +1 -1
  39. package/dist/lib/Components/core/Select/Select.js +105 -104
  40. package/dist/lib/Components/core/SideBar/SideBar.js +28 -28
  41. package/dist/lib/Components/core/Spinner/Spinner.js +5 -5
  42. package/dist/lib/Components/core/Spot/Spot.d.ts +7 -25
  43. package/dist/lib/Components/core/Spot/Spot.d.ts.map +1 -1
  44. package/dist/lib/Components/core/Spot/Spot.js +33 -102
  45. package/dist/lib/Components/core/Spot/SpotNumber.d.ts +16 -0
  46. package/dist/lib/Components/core/Spot/SpotNumber.d.ts.map +1 -0
  47. package/dist/lib/Components/core/Spot/SpotNumber.js +46 -0
  48. package/dist/lib/Components/core/Spot/index.d.ts +1 -0
  49. package/dist/lib/Components/core/Spot/index.d.ts.map +1 -1
  50. package/dist/lib/Components/core/Spot/styles.d.ts +14 -0
  51. package/dist/lib/Components/core/Spot/styles.d.ts.map +1 -0
  52. package/dist/lib/Components/core/Spot/styles.js +275 -0
  53. package/dist/lib/Components/core/Spot/types.d.ts +27 -38
  54. package/dist/lib/Components/core/Spot/types.d.ts.map +1 -1
  55. package/dist/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
  56. package/dist/lib/Components/core/Stepper/Stepper.js +51 -48
  57. package/dist/lib/Components/core/Subheader/Subheader.d.ts.map +1 -1
  58. package/dist/lib/Components/core/Subheader/Subheader.js +33 -29
  59. package/dist/lib/Components/core/Switch/Switch.js +5 -5
  60. package/dist/lib/Components/core/Table/Table.d.ts.map +1 -1
  61. package/dist/lib/Components/core/Table/Table.js +64 -63
  62. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.js +6 -6
  63. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts +1 -1
  64. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts.map +1 -1
  65. package/dist/lib/Components/core/Tile/Tile.d.ts +2 -2
  66. package/dist/lib/Components/core/TileButton/TileButton.js +8 -8
  67. package/dist/lib/Components/core/Timeline/Timeline.js +16 -16
  68. package/dist/lib/Components/core/Toast/Toast.js +4 -4
  69. package/dist/lib/Components/core/Toast/Toaster.js +9 -9
  70. package/dist/lib/Components/core/Trend/Trend.js +3 -3
  71. package/dist/lib/Components/internal/BaseButton/BaseButton.js +9 -9
  72. package/dist/lib/Components/internal/BaseInput/BaseInput.js +21 -21
  73. package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.js +4 -4
  74. package/dist/lib/Components/internal/BaseTag/BaseTag.js +4 -4
  75. package/dist/lib/Components/symbols/Icon/Icon.js +4 -4
  76. package/dist/lib/Components/symbols/Icon/createIcon.js +5 -5
  77. package/dist/lib/Components/symbols/icons/AiBubble.d.ts +29 -0
  78. package/dist/lib/Components/symbols/icons/AiBubble.d.ts.map +1 -0
  79. package/dist/lib/Components/symbols/icons/AiBubble.js +30 -0
  80. package/dist/lib/Components/symbols/icons/ArrowBottomLeft.d.ts +29 -0
  81. package/dist/lib/Components/symbols/icons/ArrowBottomLeft.d.ts.map +1 -0
  82. package/dist/lib/Components/symbols/icons/ArrowBottomLeft.js +27 -0
  83. package/dist/lib/Components/symbols/icons/Bug.js +3 -3
  84. package/dist/lib/Components/symbols/icons/Hourglass.d.ts +29 -0
  85. package/dist/lib/Components/symbols/icons/Hourglass.d.ts.map +1 -0
  86. package/dist/lib/Components/symbols/icons/Hourglass.js +27 -0
  87. package/dist/lib/Components/symbols/icons/Repeat.d.ts +29 -0
  88. package/dist/lib/Components/symbols/icons/Repeat.d.ts.map +1 -0
  89. package/dist/lib/Components/symbols/icons/Repeat.js +27 -0
  90. package/dist/lib/Components/symbols/icons/Robot.d.ts +29 -0
  91. package/dist/lib/Components/symbols/icons/Robot.d.ts.map +1 -0
  92. package/dist/lib/Components/symbols/icons/Robot.js +29 -0
  93. package/dist/lib/Components/symbols/icons/Switch.d.ts.map +1 -1
  94. package/dist/lib/Components/symbols/icons/Switch.js +24 -12
  95. package/dist/lib/Components/symbols/icons/Wifi.d.ts +29 -0
  96. package/dist/lib/Components/symbols/icons/Wifi.d.ts.map +1 -0
  97. package/dist/lib/Components/symbols/icons/Wifi.js +36 -0
  98. package/dist/lib/Components/symbols/index.d.ts +6 -0
  99. package/dist/lib/Components/symbols/index.d.ts.map +1 -1
  100. package/dist/lib/Components/symbols/index.js +610 -598
  101. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -1
  102. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.js +36 -35
  103. package/dist/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
  104. package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -1
  105. package/dist/lib/Components/visualization/DonutChart/DonutChart.js +31 -31
  106. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +4 -4
  107. package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -1
  108. package/dist/lib/Components/visualization/DonutChart/DonutRing.js +13 -12
  109. package/dist/lib/Components/visualization/DonutChart/donutSizeContext.js +2 -2
  110. package/dist/lib/Components/visualization/DonutChart/types.d.ts +1 -1
  111. package/dist/lib/Components/visualization/Legend/Legend.d.ts +1 -1
  112. package/dist/lib/Components/visualization/Legend/Legend.d.ts.map +1 -1
  113. package/dist/lib/Components/visualization/Legend/Legend.js +7 -11
  114. package/dist/lib/Components/visualization/Legend/types.d.ts +2 -2
  115. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts +1 -1
  116. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -1
  117. package/dist/lib/Components/visualization/LineChart/LineChart.js +90 -84
  118. package/dist/lib/Components/visualization/LineChart/types.d.ts +1 -1
  119. package/dist/lib/Components/visualization/LineChart/utils.d.ts +2 -1
  120. package/dist/lib/Components/visualization/LineChart/utils.d.ts.map +1 -1
  121. package/dist/lib/Components/visualization/LineChart/utils.js +23 -22
  122. package/dist/lib/Components/visualization/config.d.ts +0 -3
  123. package/dist/lib/Components/visualization/config.d.ts.map +1 -1
  124. package/dist/lib/Components/visualization/config.js +3 -6
  125. package/dist/libs/utils-shared/dist/index.js +191 -143
  126. package/dist/package.json +4 -6
  127. package/dist/translations/index.d.ts +3 -0
  128. package/dist/translations/index.d.ts.map +1 -0
  129. package/dist/{i18n → translations}/languages.d.ts +0 -5
  130. package/dist/translations/languages.d.ts.map +1 -0
  131. package/dist/{i18n → translations}/languages.js +1 -2
  132. package/dist/{i18n → translations}/locales/en.json.d.ts +11 -0
  133. package/dist/{i18n → translations}/locales/en.json.js +2 -2
  134. package/dist/translations/translations.d.ts +727 -0
  135. package/dist/translations/translations.d.ts.map +1 -0
  136. package/dist/translations/translations.js +22 -0
  137. package/package.json +4 -6
  138. package/dist/_virtual/dynamic-import-helper.js +0 -9
  139. package/dist/i18n/I18nProvider.d.ts +0 -8
  140. package/dist/i18n/I18nProvider.d.ts.map +0 -1
  141. package/dist/i18n/I18nProvider.js +0 -14
  142. package/dist/i18n/i18n.d.ts +0 -12
  143. package/dist/i18n/i18n.d.ts.map +0 -1
  144. package/dist/i18n/i18n.js +0 -42
  145. package/dist/i18n/index.d.ts +0 -4
  146. package/dist/i18n/index.d.ts.map +0 -1
  147. package/dist/i18n/languages.d.ts.map +0 -1
  148. package/dist/i18n/useCommonTranslation.d.ts +0 -2
  149. package/dist/i18n/useCommonTranslation.d.ts.map +0 -1
  150. package/dist/i18n/useCommonTranslation.js +0 -6
  151. package/dist/node_modules/i18next/dist/esm/i18next.js +0 -1479
  152. package/dist/node_modules/react-i18next/dist/es/I18nextProvider.js +0 -19
  153. package/dist/node_modules/react-i18next/dist/es/context.js +0 -17
  154. package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
  155. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -8
  156. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -11
  157. package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -25
  158. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -65
  159. package/dist/node_modules/react-i18next/dist/es/utils.js +0 -57
  160. /package/dist/{i18n → translations}/locales/de.json.d.ts +0 -0
  161. /package/dist/{i18n → translations}/locales/de.json.js +0 -0
  162. /package/dist/{i18n → translations}/locales/es.json.d.ts +0 -0
  163. /package/dist/{i18n → translations}/locales/es.json.js +0 -0
  164. /package/dist/{i18n → translations}/locales/fr.json.d.ts +0 -0
  165. /package/dist/{i18n → translations}/locales/fr.json.js +0 -0
  166. /package/dist/{i18n → translations}/locales/ja.json.d.ts +0 -0
  167. /package/dist/{i18n → translations}/locales/ja.json.js +0 -0
  168. /package/dist/{i18n → translations}/locales/ko.json.d.ts +0 -0
  169. /package/dist/{i18n → translations}/locales/ko.json.js +0 -0
  170. /package/dist/{i18n → translations}/locales/pt.json.d.ts +0 -0
  171. /package/dist/{i18n → translations}/locales/pt.json.js +0 -0
  172. /package/dist/{i18n → translations}/locales/ru.json.d.ts +0 -0
  173. /package/dist/{i18n → translations}/locales/ru.json.js +0 -0
  174. /package/dist/{i18n → translations}/locales/th.json.d.ts +0 -0
  175. /package/dist/{i18n → translations}/locales/th.json.js +0 -0
  176. /package/dist/{i18n → translations}/locales/tr.json.d.ts +0 -0
  177. /package/dist/{i18n → translations}/locales/tr.json.js +0 -0
  178. /package/dist/{i18n → translations}/locales/zh.json.d.ts +0 -0
  179. /package/dist/{i18n → translations}/locales/zh.json.js +0 -0
@@ -1,41 +1,41 @@
1
- import { jsx as K } from "react/jsx-runtime";
2
- import { useMemo as W, createContext as G, useRef as y, useEffect as I, useContext as V } from "react";
3
- import { clsx as X } from "clsx";
4
- import { twMerge as Y } from "tailwind-merge";
5
- function H(e) {
1
+ import { jsx as q } from "react/jsx-runtime";
2
+ import { useMemo as I, createContext as F, useContext as _, useRef as y, useEffect as k } from "react";
3
+ import { clsx as J } from "clsx";
4
+ import { twMerge as Q } from "tailwind-merge";
5
+ function V(e) {
6
6
  let t = 0;
7
7
  for (let r = 0; r < e.length; r++)
8
8
  t = Math.imul(t, 31) + e.charCodeAt(r) | 0;
9
9
  return t;
10
10
  }
11
- const J = {
11
+ const Z = {
12
12
  md: { max: 48, min: 17, scale: 2, startAt: 0 },
13
13
  sm: { max: 28, min: 12, scale: 2, startAt: 6 }
14
14
  };
15
- function Se(e, t = "md") {
16
- const { max: r, min: n, scale: a, startAt: s } = J[t], o = e.replace(/\D/g, "").length;
15
+ function Ce(e, t = "md") {
16
+ const { max: r, min: n, scale: a, startAt: s } = Z[t], o = e.replace(/\D/g, "").length;
17
17
  return Math.max(n, r - Math.max(0, o - s) * a);
18
18
  }
19
- function Q(e, t = !0) {
19
+ function H(e, t = !0) {
20
20
  if (!e) return "";
21
21
  const r = e.includes("."), [n, a] = e.split("."), s = n.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
22
22
  return r && t ? a ? `${s}.${a}` : `${s}.` : s;
23
23
  }
24
- const Z = (e) => e.replaceAll(",", ".").replaceAll(/[^\d.]/g, ""), ee = (e) => e.replace(/^0+(?=\d)/, ""), S = (e, t) => t > 0 ? e.slice(0, t) : e, te = (e, t) => S(e.replaceAll(/\D/g, ""), t), re = (e, t, r) => {
24
+ const ee = (e) => e.replaceAll(",", ".").replaceAll(/[^\d.]/g, ""), te = (e) => e.replace(/^0+(?=\d)/, ""), M = (e, t) => t > 0 ? e.slice(0, t) : e, re = (e, t) => M(e.replaceAll(/\D/g, ""), t), ne = (e, t, r) => {
25
25
  if (e === ".") return "0.";
26
26
  const n = e.indexOf(".");
27
- if (n === -1) return S(e, t);
28
- const a = S(e.slice(0, n), t) || "0", s = e.slice(n + 1).replaceAll(".", "").slice(0, r);
27
+ if (n === -1) return M(e, t);
28
+ const a = M(e.slice(0, n), t) || "0", s = e.slice(n + 1).replaceAll(".", "").slice(0, r);
29
29
  return s.length > 0 ? `${a}.${s}` : e.endsWith(".") ? `${a}.` : a;
30
30
  };
31
- function Oe(e, t = {}) {
31
+ function Ee(e, t = {}) {
32
32
  const {
33
33
  allowDecimals: r = !0,
34
34
  thousandsSeparator: n = !0,
35
35
  maxIntegerLength: a = 9,
36
36
  maxDecimalLength: s = 9,
37
37
  decimalSeparator: o = "."
38
- } = t, i = ee(Z(e)), l = r ? re(i, a, s) : te(i, a), c = n ? Q(l) : l;
38
+ } = t, i = te(ee(e)), l = r ? ne(i, a, s) : re(i, a), c = n ? H(l) : l;
39
39
  return o === "." ? c : c.replaceAll(".", o);
40
40
  }
41
41
  const P = [
@@ -48,28 +48,28 @@ const P = [
48
48
  "turquoise",
49
49
  "pink"
50
50
  ];
51
- function Ie(e) {
52
- const t = (H(e) % P.length + P.length) % P.length;
51
+ function Le(e) {
52
+ const t = (V(e) % P.length + P.length) % P.length;
53
53
  return P[t];
54
54
  }
55
- function ne(e, t) {
55
+ function ae(e, t) {
56
56
  if (Object.is(e, t)) return !0;
57
57
  const r = e, n = t, a = Object.keys(r), s = Object.keys(n);
58
58
  return a.length !== s.length ? !1 : a.every(
59
59
  (o) => Object.prototype.hasOwnProperty.call(n, o) && Object.is(r[o], n[o])
60
60
  );
61
61
  }
62
- function ae(e, t) {
63
- const r = G(t), n = ({ children: s, value: o }) => {
62
+ function se(e, t) {
63
+ const r = F(t), n = ({ children: s, value: o }) => {
64
64
  const i = y(o);
65
- return ne(i.current, o) || (i.current = o), /* @__PURE__ */ K(r.Provider, { value: i.current, children: s });
65
+ return ae(i.current, o) || (i.current = o), /* @__PURE__ */ q(r.Provider, { value: i.current, children: s });
66
66
  };
67
67
  n.displayName = e + "Provider";
68
68
  function a({
69
69
  consumerName: s,
70
70
  contextRequired: o
71
71
  }) {
72
- const i = V(r);
72
+ const i = _(r);
73
73
  if (i)
74
74
  return i;
75
75
  if (o)
@@ -80,27 +80,27 @@ function ae(e, t) {
80
80
  }
81
81
  return [n, a];
82
82
  }
83
- const [Ce, se] = ae("Disabled", { disabled: !1 }), ke = ({
83
+ const [Re, oe] = se("Disabled", { disabled: !1 }), Ne = ({
84
84
  consumerName: e,
85
85
  contextRequired: t,
86
86
  mergeWith: r
87
87
  }) => {
88
- const n = se({
88
+ const n = oe({
89
89
  consumerName: e,
90
90
  contextRequired: t ?? !1
91
91
  });
92
92
  return !!(r?.disabled || n.disabled);
93
93
  };
94
- function Ee(...e) {
95
- return Y(X(e));
94
+ function We(...e) {
95
+ return Q(J(e));
96
96
  }
97
- const k = (e) => typeof e == "string" || typeof e == "number", Re = (e) => Array.isArray(e) ? e.every(k) : k(e);
97
+ const C = (e) => typeof e == "string" || typeof e == "number", qe = (e) => Array.isArray(e) ? e.every(C) : C(e);
98
98
  function E(e, t) {
99
99
  if (typeof e == "function")
100
100
  return e(t);
101
101
  typeof e == "object" && e !== null && "current" in e && (e.current = t);
102
102
  }
103
- function oe(...e) {
103
+ function ie(...e) {
104
104
  const t = /* @__PURE__ */ new Map();
105
105
  return (r) => {
106
106
  if (r === null) {
@@ -116,35 +116,44 @@ function oe(...e) {
116
116
  });
117
117
  };
118
118
  }
119
- function Ne(...e) {
120
- return W(() => oe(...e), e);
119
+ function Fe(...e) {
120
+ return I(() => ie(...e), e);
121
121
  }
122
- function je(e) {
122
+ const le = (e, t) => {
123
+ let r = e;
124
+ for (const n of t) {
125
+ if (r == null)
126
+ return;
127
+ r = r[n];
128
+ }
129
+ return r;
130
+ };
131
+ function _e(e) {
123
132
  return function(t, r) {
124
133
  return e[t][r];
125
134
  };
126
135
  }
127
- const We = ({
136
+ const Be = ({
128
137
  currentStep: e,
129
138
  totalSteps: t,
130
139
  size: r,
131
140
  label: n,
132
141
  strokeWidth: a = 4
133
142
  }) => {
134
- const s = Math.min(Math.max(e, 0), t), o = n ?? `${s}/${t}`, i = t <= 0 ? 0 : s / t, l = (r - a) / 2, c = r / 2, g = r / 2, p = 2 * Math.PI * l, m = t <= 1 ? 0 : 12 / 360 * p + a, h = t <= 1 ? p : Math.max(p / t - m, 0), A = `${h} ${m}`, x = `${p} ${p}`, M = p * (1 - i), v = h + m / 2;
143
+ const s = Math.min(Math.max(e, 0), t), o = n ?? `${s}/${t}`, i = t <= 0 ? 0 : s / t, l = (r - a) / 2, c = r / 2, p = r / 2, d = 2 * Math.PI * l, g = t <= 1 ? 0 : 12 / 360 * d + a, h = t <= 1 ? d : Math.max(d / t - g, 0), v = `${h} ${g}`, b = `${d} ${d}`, S = d * (1 - i), w = h + g / 2;
135
144
  return {
136
145
  displayLabel: o,
137
146
  progress: i,
138
147
  r: l,
139
148
  cx: c,
140
- cy: g,
141
- circumference: p,
142
- progressDashArray: A,
143
- progressMaskDashArray: x,
144
- progressDashOffset: M,
145
- dashPatternOffset: v
149
+ cy: p,
150
+ circumference: d,
151
+ progressDashArray: v,
152
+ progressMaskDashArray: b,
153
+ progressDashOffset: S,
154
+ dashPatternOffset: w
146
155
  };
147
- }, Le = (e) => W(
156
+ }, Ke = (e) => I(
148
157
  () => ({
149
158
  integerPart: Array.from(e.integerPart, (t) => ({
150
159
  value: t,
@@ -156,24 +165,24 @@ const We = ({
156
165
  })) : []
157
166
  }),
158
167
  [e.integerPart, e.decimalPart]
159
- ), Fe = (e, t, r) => {
168
+ ), Ue = (e, t, r) => {
160
169
  if (t) return r;
161
170
  const n = e.decimalPart ? `${e.decimalSeparator}${e.decimalPart}` : "", a = `${e.integerPart}${n}`;
162
171
  return e.currencyPosition === "end" ? `${a} ${e.currencyText}` : `${e.currencyText} ${a}`;
163
172
  };
164
- let R = 0;
165
- const ie = {
173
+ let L = 0;
174
+ const ce = {
166
175
  info: 5e3,
167
176
  success: 5e3,
168
177
  warning: 0,
169
178
  error: 0
170
- }, le = 3, L = [], qe = (e) => Number.isInteger(e) && e >= 1 ? e : le, Be = (e, t) => {
179
+ }, ue = 3, B = [], ze = (e) => Number.isInteger(e) && e >= 1 ? e : ue, Xe = (e, t) => {
171
180
  if (e.duration !== void 0)
172
181
  return e.duration === 0 ? 1 / 0 : e.duration;
173
182
  if (e.loading) return 1 / 0;
174
- const r = t?.[e.appearance] ?? ie[e.appearance];
183
+ const r = t?.[e.appearance] ?? ce[e.appearance];
175
184
  return r === 0 ? 1 / 0 : r;
176
- }, ue = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (R += 1, `toast-${Date.now()}-${R}`), ce = (e, t) => ({
185
+ }, de = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (L += 1, `toast-${Date.now()}-${L}`), pe = (e, t) => ({
177
186
  id: e,
178
187
  appearance: t.appearance ?? "info",
179
188
  loading: t.loading ?? !1,
@@ -181,59 +190,59 @@ const ie = {
181
190
  duration: t.duration,
182
191
  dismissible: t.dismissible ?? !0,
183
192
  action: t.action
184
- }), de = (e) => {
193
+ }), fe = (e) => {
185
194
  const t = {};
186
195
  for (const r of Object.keys(e))
187
196
  (e[r] !== void 0 || r === "action") && Object.assign(t, { [r]: e[r] });
188
197
  return t;
189
198
  };
190
- let d = L;
199
+ let f = B;
191
200
  const O = /* @__PURE__ */ new Set();
192
201
  let $ = 0;
193
202
  const D = () => {
194
203
  for (const e of O) e();
195
- }, pe = (e) => (O.add(e), () => O.delete(e)), fe = () => d, me = () => L, ge = (e) => {
196
- const t = ue();
197
- return d = [...d, ce(t, e)], D(), t;
198
- }, he = (e, t) => {
199
- const r = d.findIndex((o) => o.id === e);
204
+ }, me = (e) => (O.add(e), () => O.delete(e)), ge = () => f, he = () => B, ye = (e) => {
205
+ const t = de();
206
+ return f = [...f, pe(t, e)], D(), t;
207
+ }, be = (e, t) => {
208
+ const r = f.findIndex((o) => o.id === e);
200
209
  if (r === -1) return;
201
- const n = de(t), a = n.duration !== void 0 || n.loading !== void 0 || n.appearance !== void 0, s = {
202
- ...d[r],
210
+ const n = fe(t), a = n.duration !== void 0 || n.loading !== void 0 || n.appearance !== void 0, s = {
211
+ ...f[r],
203
212
  ...n,
204
213
  ...a && { duration: n.duration }
205
214
  };
206
- d = d.map((o, i) => i === r ? s : o), D();
207
- }, ye = (e) => {
208
- const t = d.findIndex((r) => r.id === e);
209
- t !== -1 && (d = d[t].exiting ? d.filter((r) => r.id !== e) : d.map(
215
+ f = f.map((o, i) => i === r ? s : o), D();
216
+ }, xe = (e) => {
217
+ const t = f.findIndex((r) => r.id === e);
218
+ t !== -1 && (f = f[t].exiting ? f.filter((r) => r.id !== e) : f.map(
210
219
  (r) => r.id === e ? { ...r, exiting: !0 } : r
211
220
  ), D());
212
- }, xe = () => {
213
- d.length !== 0 && (d = d.map((e) => ({ ...e, exiting: !0 })), D());
214
- }, be = () => ($ += 1, $ > 1 && console.warn(
221
+ }, Te = () => {
222
+ f.length !== 0 && (f = f.map((e) => ({ ...e, exiting: !0 })), D());
223
+ }, ve = () => ($ += 1, $ > 1 && console.warn(
215
224
  `[Toaster] ${$} <Toaster /> instances are mounted at once. Every toast will render once per instance. Mount a single <Toaster /> for the whole app.`
216
225
  ), () => {
217
226
  $ -= 1;
218
- }), F = {
219
- subscribe: pe,
220
- getSnapshot: fe,
221
- getServerSnapshot: me,
222
- registerRenderer: be,
223
- add: ge,
224
- update: he,
225
- dismiss: ye,
226
- dismissAll: xe
227
- }, Ue = (e, t) => {
227
+ }), K = {
228
+ subscribe: me,
229
+ getSnapshot: ge,
230
+ getServerSnapshot: he,
231
+ registerRenderer: ve,
232
+ add: ye,
233
+ update: be,
234
+ dismiss: xe,
235
+ dismissAll: Te
236
+ }, Ye = (e, t) => {
228
237
  const r = y(/* @__PURE__ */ new Set());
229
- return I(() => {
238
+ return k(() => {
230
239
  r.current = new Set(
231
240
  e.filter(
232
241
  (n, a) => a >= t || r.current.has(n.id)
233
242
  ).map((n) => n.id)
234
- ), e.slice(t).filter((n) => n.exiting).forEach((n) => F.dismiss(n.id));
243
+ ), e.slice(t).filter((n) => n.exiting).forEach((n) => K.dismiss(n.id));
235
244
  }, [e, t]), (n) => r.current.has(n);
236
- }, Te = ({
245
+ }, we = ({
237
246
  durationMs: e,
238
247
  paused: t,
239
248
  exiting: r,
@@ -242,7 +251,7 @@ const D = () => {
242
251
  const a = y(n);
243
252
  a.current = n;
244
253
  const s = y(e), o = y(e), i = y(null);
245
- I(() => {
254
+ k(() => {
246
255
  if (r || (e !== o.current && (o.current = e, s.current = e), t || !Number.isFinite(s.current))) return;
247
256
  i.current = Date.now();
248
257
  const l = setTimeout(
@@ -253,15 +262,15 @@ const D = () => {
253
262
  clearTimeout(l), i.current !== null && (s.current -= Date.now() - i.current, i.current = null);
254
263
  };
255
264
  }, [t, r, e]);
256
- }, Ae = 300, _e = ({
265
+ }, Ae = 300, Ge = ({
257
266
  durationMs: e,
258
267
  paused: t,
259
268
  exiting: r,
260
269
  onDismiss: n
261
270
  }) => {
262
- Te({ durationMs: e, paused: t, exiting: r, onExpire: n });
271
+ we({ durationMs: e, paused: t, exiting: r, onExpire: n });
263
272
  const a = y(n);
264
- a.current = n, I(() => {
273
+ a.current = n, k(() => {
265
274
  if (!r) return;
266
275
  const s = setTimeout(
267
276
  () => a.current(),
@@ -269,7 +278,7 @@ const D = () => {
269
278
  );
270
279
  return () => clearTimeout(s);
271
280
  }, [r]);
272
- }, N = (e, t) => typeof e == "function" ? e(t) : e, ve = ({
281
+ }, R = (e, t) => typeof e == "function" ? e(t) : e, Pe = ({
273
282
  add: e,
274
283
  update: t,
275
284
  dismiss: r,
@@ -296,7 +305,7 @@ const D = () => {
296
305
  });
297
306
  return s.then(
298
307
  (l) => {
299
- const c = N(o.success, l);
308
+ const c = R(o.success, l);
300
309
  t(i, {
301
310
  ...c,
302
311
  appearance: "success",
@@ -306,7 +315,7 @@ const D = () => {
306
315
  });
307
316
  },
308
317
  (l) => {
309
- const c = N(o.error, l);
318
+ const c = R(o.error, l);
310
319
  t(i, {
311
320
  ...c,
312
321
  appearance: "error",
@@ -318,53 +327,53 @@ const D = () => {
318
327
  ), { id: i };
319
328
  }
320
329
  };
321
- }, ze = ve(F);
322
- function we(e, t, r = {}) {
330
+ }, Je = Pe(K);
331
+ function $e(e, t, r = {}) {
323
332
  const { leading: n = !1, trailing: a = !0, maxWait: s } = r;
324
- let o = null, i = null, l = null, c = 0, g = null, p = null, m;
325
- const h = s !== void 0, A = h ? Math.max(s, t) : 0, x = (u) => {
333
+ let o = null, i = null, l = null, c = 0, p = null, d = null, g;
334
+ const h = s !== void 0, v = h ? Math.max(s, t) : 0, b = (u) => {
326
335
  c = u;
327
- const f = g ?? [], T = p;
328
- return g = null, p = null, m = e.apply(T, f), m;
329
- }, M = (u) => {
330
- const f = l ? u - l : 0;
331
- return t - f;
332
- }, v = (u) => {
333
- const f = l ? u - l : t, T = u - c;
334
- return l === null || f >= t || f < 0 || h && T >= A;
335
- }, C = (u) => (o = null, a && g ? x(u) : (g = null, p = null, m)), b = () => {
336
+ const m = p ?? [], T = d;
337
+ return p = null, d = null, g = e.apply(T, m), g;
338
+ }, S = (u) => {
339
+ const m = l ? u - l : 0;
340
+ return t - m;
341
+ }, w = (u) => {
342
+ const m = l ? u - l : t, T = u - c;
343
+ return l === null || m >= t || m < 0 || h && T >= v;
344
+ }, j = (u) => (o = null, a && p ? b(u) : (p = null, d = null, g)), x = () => {
336
345
  const u = Date.now();
337
- if (v(u)) {
338
- C(u);
346
+ if (w(u)) {
347
+ j(u);
339
348
  return;
340
349
  }
341
- o = setTimeout(b, M(u));
342
- }, q = () => {
350
+ o = setTimeout(x, S(u));
351
+ }, U = () => {
343
352
  const u = Date.now();
344
- i = null, g && (x(u), o !== null && (clearTimeout(o), o = setTimeout(b, t)));
345
- }, B = (u) => (c = u, o = setTimeout(b, t), h && (i = setTimeout(q, A)), n ? x(u) : m), U = () => {
346
- o !== null && clearTimeout(o), i !== null && clearTimeout(i), c = 0, g = null, p = null, l = null, o = null, i = null;
347
- }, _ = () => o === null && i === null ? m : C(Date.now()), z = () => o !== null || i !== null, w = function(...u) {
348
- const f = Date.now(), T = v(f);
349
- if (g = u, p = this, l = f, T) {
353
+ i = null, p && (b(u), o !== null && (clearTimeout(o), o = setTimeout(x, t)));
354
+ }, z = (u) => (c = u, o = setTimeout(x, t), h && (i = setTimeout(U, v)), n ? b(u) : g), X = () => {
355
+ o !== null && clearTimeout(o), i !== null && clearTimeout(i), c = 0, p = null, d = null, l = null, o = null, i = null;
356
+ }, Y = () => o === null && i === null ? g : j(Date.now()), G = () => o !== null || i !== null, A = function(...u) {
357
+ const m = Date.now(), T = w(m);
358
+ if (p = u, d = this, l = m, T) {
350
359
  if (o === null)
351
- return B(f);
360
+ return z(m);
352
361
  if (h)
353
- return clearTimeout(o), o = setTimeout(b, t), x(f);
362
+ return clearTimeout(o), o = setTimeout(x, t), b(m);
354
363
  }
355
- return o === null && (o = setTimeout(b, t)), m;
364
+ return o === null && (o = setTimeout(x, t)), g;
356
365
  };
357
- return w.cancel = U, w.flush = _, w.pending = z, w;
366
+ return A.cancel = X, A.flush = Y, A.pending = G, A;
358
367
  }
359
- function Ke(e, t, r = {}) {
368
+ function Qe(e, t, r = {}) {
360
369
  const { leading: n = !0, trailing: a = !0 } = r;
361
- return we(e, t, {
370
+ return $e(e, t, {
362
371
  leading: n,
363
372
  trailing: a,
364
373
  maxWait: t
365
374
  });
366
375
  }
367
- const Ge = ({
376
+ const Ve = ({
368
377
  onClick: e,
369
378
  disabled: t
370
379
  }) => e ? t ? {
@@ -378,50 +387,89 @@ const Ge = ({
378
387
  (r.key === "Enter" || r.key === " ") && (r.preventDefault(), e?.(r));
379
388
  },
380
389
  onClick: e
381
- } : void 0, j = " ", Ve = ({
390
+ } : void 0, N = " ", Ze = ({
382
391
  label: e,
383
392
  placeholder: t
384
393
  }) => {
385
394
  const r = typeof t == "string" && t.trim().length > 0 ? t : void 0;
386
395
  return e ? {
387
- inputPlaceholder: r ?? j,
396
+ inputPlaceholder: r ?? N,
388
397
  labelStaysFloatedWithPlaceholder: r !== void 0
389
398
  } : {
390
- inputPlaceholder: t ?? j,
399
+ inputPlaceholder: t ?? N,
391
400
  labelStaysFloatedWithPlaceholder: !1
392
401
  };
402
+ }, De = /\{\{\s*(\w+)\s*\}\}/g, Se = (e, t) => t ? e.replace(
403
+ De,
404
+ (r, n) => Object.hasOwn(t, n) ? String(t[n]) : r
405
+ ) : e, Me = (e, t, r) => {
406
+ if (!e)
407
+ return r;
408
+ const n = e.toLowerCase().replaceAll("_", "-"), a = (s) => t.find((o) => o.toLowerCase() === s);
409
+ return a(n) ?? a(n.split("-")[0]) ?? r;
410
+ }, W = (e, t) => {
411
+ const r = le(e ?? {}, t.split("."));
412
+ return typeof r == "string" ? r : void 0;
413
+ }, He = ({
414
+ dictionaries: e,
415
+ defaultLocale: t,
416
+ fallbackLocale: r = t
417
+ }) => {
418
+ const n = Object.keys(e), a = (l, c, p) => {
419
+ const d = W(e[l], c) ?? W(e[r], c) ?? c;
420
+ return Se(d, p);
421
+ }, s = (l) => ({
422
+ locale: l,
423
+ t: (c, p) => a(l, c, p)
424
+ }), o = F({ locale: t, t: (l) => l }), i = ({
425
+ locale: l,
426
+ children: c
427
+ }) => {
428
+ const p = Me(
429
+ l,
430
+ n,
431
+ t
432
+ ), d = I(
433
+ () => s(p),
434
+ [p]
435
+ );
436
+ return /* @__PURE__ */ q(o.Provider, { value: d, children: c });
437
+ };
438
+ return i.displayName = "TranslationsProvider", { TranslationsProvider: i, useTranslations: () => _(o), translate: a };
393
439
  };
394
440
  export {
395
441
  P as AVATAR_COLOR_KEYS,
396
- Ce as DisabledProvider,
442
+ Re as DisabledProvider,
397
443
  Ae as EXIT_ANIMATION_MS,
398
444
  E as assignRef,
399
- Fe as buildAriaLabel,
400
- Ee as cn,
401
- je as createPropsResolver,
402
- ae as createSafeContext,
403
- ve as createToastController,
404
- we as debounce,
405
- Q as formatThousands,
406
- Ge as getButtonA11yProps,
407
- Se as getFontSize,
408
- We as getStepperCalculations,
409
- H as hashString,
410
- Re as isTextChildren,
411
- oe as mergeRefs,
412
- Ie as resolveAvatarColorKey,
413
- Ve as resolveBaseInputPlaceholder,
414
- Be as resolveDurationMs,
415
- qe as resolveMaxItems,
416
- ne as shallowEqual,
417
- Oe as textFormatter,
418
- Ke as throttle,
419
- ze as toast,
420
- F as toastStore,
421
- ke as useDisabledContext,
422
- Ne as useMergedRef,
423
- Le as useSplitText,
424
- Ue as useToastBacklog,
425
- _e as useToastLifecycle,
426
- Te as useToastTimer
445
+ Ue as buildAriaLabel,
446
+ We as cn,
447
+ _e as createPropsResolver,
448
+ se as createSafeContext,
449
+ Pe as createToastController,
450
+ He as createTranslations,
451
+ $e as debounce,
452
+ H as formatThousands,
453
+ Ve as getButtonA11yProps,
454
+ Ce as getFontSize,
455
+ le as getObjectPath,
456
+ Be as getStepperCalculations,
457
+ V as hashString,
458
+ qe as isTextChildren,
459
+ ie as mergeRefs,
460
+ Le as resolveAvatarColorKey,
461
+ Ze as resolveBaseInputPlaceholder,
462
+ Xe as resolveDurationMs,
463
+ ze as resolveMaxItems,
464
+ ae as shallowEqual,
465
+ Ee as textFormatter,
466
+ Qe as throttle,
467
+ Je as toast,
468
+ K as toastStore,
469
+ Ne as useDisabledContext,
470
+ Fe as useMergedRef,
471
+ Ke as useSplitText,
472
+ Ye as useToastBacklog,
473
+ Ge as useToastLifecycle,
474
+ we as useToastTimer
427
475
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
@@ -47,13 +47,11 @@
47
47
  ]
48
48
  },
49
49
  "dependencies": {
50
- "@ledgerhq/lumen-utils-shared": "0.1.14",
50
+ "@ledgerhq/lumen-utils-shared": "0.1.16",
51
51
  "@types/d3-scale": "^4.0.9",
52
52
  "@types/d3-shape": "^3.1.8",
53
53
  "d3-scale": "^4.0.2",
54
- "d3-shape": "^3.2.0",
55
- "i18next": "^23.7.0",
56
- "react-i18next": "^14.0.0"
54
+ "d3-shape": "^3.2.0"
57
55
  },
58
56
  "peerDependencies": {
59
57
  "@base-ui/react": "^1.3.0",
@@ -64,7 +62,7 @@
64
62
  "@radix-ui/react-tooltip": "^1.2.8",
65
63
  "class-variance-authority": "^0.7.1",
66
64
  "@tanstack/react-table": "^8.21.3",
67
- "@ledgerhq/lumen-design-core": "0.1.30",
65
+ "@ledgerhq/lumen-design-core": "0.1.31",
68
66
  "clsx": "^2.1.1",
69
67
  "react": "^18.0.0 || ^19.0.0",
70
68
  "react-dom": "^18.0.0 || ^19.0.0",
@@ -0,0 +1,3 @@
1
+ export { type SupportedLocale, Languages } from './languages';
2
+ export { TranslationsProvider, useCommonTranslation } from './translations';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -44,9 +44,4 @@ export declare const DEFAULT_LANGUAGE: "en";
44
44
  * Supported locales type
45
45
  */
46
46
  export type SupportedLocale = keyof typeof Languages;
47
- /**
48
- * Default namespace for i18n
49
- * Currently there is only one namespace
50
- */
51
- export declare const I18N_DEFAULT_NAMESPACE = "common";
52
47
  //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/translations/languages.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC6B,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,gBAAgB,MAAkB,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,SAAS,CAAC"}
@@ -32,9 +32,8 @@ const d = {
32
32
  zh: {
33
33
  id: "zh"
34
34
  }
35
- }, i = d.en.id, t = "common";
35
+ }, i = d.en.id;
36
36
  export {
37
37
  i as DEFAULT_LANGUAGE,
38
- t as I18N_DEFAULT_NAMESPACE,
39
38
  d as Languages
40
39
  };
@@ -53,6 +53,17 @@ declare const _default: {
53
53
  "positiveAriaLabel": "Trend up {{value}}",
54
54
  "negativeAriaLabel": "Trend down {{value}}",
55
55
  "neutralAriaLabel": "Neutral trend {{value}}"
56
+ },
57
+ "chart": {
58
+ "emptyLabel": "No data",
59
+ "loadingAriaLabel": "Loading chart",
60
+ "defaultAriaLabel": "Chart"
61
+ },
62
+ "select": {
63
+ "searchPlaceholder": "Search"
64
+ },
65
+ "subheader": {
66
+ "moreInfoAriaLabel": "More information"
56
67
  }
57
68
  }
58
69
  }
@@ -1,9 +1,9 @@
1
- const a = { closeAriaLabel: "Close" }, e = { addressInput: { qrCodeAriaLabel: "Scan QR code" }, amountDisplay: { amountHiddenAriaLabel: "Amount hidden" }, avatar: { defaultAriaLabel: "User avatar" }, baseInput: { clearInputAriaLabel: "Clear input" }, spinner: { loadingAriaLabel: "Loading" }, dialogHeader: { goBackAriaLabel: "Go back", closeAriaLabel: "Close" }, banner: { closeAriaLabel: "Close" }, link: { opensInNewTabAriaLabel: "(opens in a new tab)" }, navBar: { goBackAriaLabel: "Go back" }, sideBar: { navigationAriaLabel: "Sidebar navigation", collapseAriaLabel: "Collapse sidebar", expandAriaLabel: "Expand sidebar" }, stepper: { progressAriaLabel: "Step {{currentStep}} of {{totalSteps}}" }, table: { ascAriaLabel: "Sort ascending", descAriaLabel: "Sort descending" }, pagination: { navigationAriaLabel: "Pagination", previousPageAriaLabel: "Previous page", nextPageAriaLabel: "Next page", pageAriaLabel: "Page {{page}}" }, trend: { positiveAriaLabel: "Trend up {{value}}", negativeAriaLabel: "Trend down {{value}}", neutralAriaLabel: "Neutral trend {{value}}" } }, i = {
1
+ const a = { closeAriaLabel: "Close" }, e = { addressInput: { qrCodeAriaLabel: "Scan QR code" }, amountDisplay: { amountHiddenAriaLabel: "Amount hidden" }, avatar: { defaultAriaLabel: "User avatar" }, baseInput: { clearInputAriaLabel: "Clear input" }, spinner: { loadingAriaLabel: "Loading" }, dialogHeader: { goBackAriaLabel: "Go back", closeAriaLabel: "Close" }, banner: { closeAriaLabel: "Close" }, link: { opensInNewTabAriaLabel: "(opens in a new tab)" }, navBar: { goBackAriaLabel: "Go back" }, sideBar: { navigationAriaLabel: "Sidebar navigation", collapseAriaLabel: "Collapse sidebar", expandAriaLabel: "Expand sidebar" }, stepper: { progressAriaLabel: "Step {{currentStep}} of {{totalSteps}}" }, table: { ascAriaLabel: "Sort ascending", descAriaLabel: "Sort descending" }, pagination: { navigationAriaLabel: "Pagination", previousPageAriaLabel: "Previous page", nextPageAriaLabel: "Next page", pageAriaLabel: "Page {{page}}" }, trend: { positiveAriaLabel: "Trend up {{value}}", negativeAriaLabel: "Trend down {{value}}", neutralAriaLabel: "Neutral trend {{value}}" }, chart: { emptyLabel: "No data", loadingAriaLabel: "Loading chart", defaultAriaLabel: "Chart" }, select: { searchPlaceholder: "Search" }, subheader: { moreInfoAriaLabel: "More information" } }, r = {
2
2
  common: a,
3
3
  components: e
4
4
  };
5
5
  export {
6
6
  a as common,
7
7
  e as components,
8
- i as default
8
+ r as default
9
9
  };