@ledgerhq/lumen-ui-react 0.1.61 → 0.1.63

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 (169) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +80 -63
  4. package/dist/lib/Components/core/AddressInput/AddressInput.js +1 -1
  5. package/dist/lib/Components/core/AmountDisplay/AmountDisplay.js +1 -1
  6. package/dist/lib/Components/core/AmountInput/AmountInput.js +17 -17
  7. package/dist/lib/Components/core/AmountInput/useAmountInputValue/useAmountInputValue.js +3 -3
  8. package/dist/lib/Components/core/Avatar/Avatar.js +7 -7
  9. package/dist/lib/Components/core/Avatar/resolveAvatarColor.js +2 -2
  10. package/dist/lib/Components/core/AvatarButton/AvatarButton.js +2 -2
  11. package/dist/lib/Components/core/Banner/Banner.js +9 -9
  12. package/dist/lib/Components/core/Button/Button.js +4 -4
  13. package/dist/lib/Components/core/Card/Card.js +15 -15
  14. package/dist/lib/Components/core/CardButton/CardButton.d.ts +2 -0
  15. package/dist/lib/Components/core/CardButton/CardButton.d.ts.map +1 -1
  16. package/dist/lib/Components/core/CardButton/CardButton.js +4 -4
  17. package/dist/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
  18. package/dist/lib/Components/core/DataTable/DataTable.js +42 -42
  19. package/dist/lib/Components/core/Dialog/DialogHeader/DialogHeader.js +1 -1
  20. package/dist/lib/Components/core/Divider/Divider.js +4 -4
  21. package/dist/lib/Components/core/DotCount/DotCount.js +3 -3
  22. package/dist/lib/Components/core/DotIcon/DotIcon.js +11 -11
  23. package/dist/lib/Components/core/DotSymbol/DotSymbol.js +7 -7
  24. package/dist/lib/Components/core/Link/Link.d.ts +1 -1
  25. package/dist/lib/Components/core/Link/Link.d.ts.map +1 -1
  26. package/dist/lib/Components/core/Link/Link.js +25 -23
  27. package/dist/lib/Components/core/Link/types.d.ts +1 -1
  28. package/dist/lib/Components/core/Link/types.d.ts.map +1 -1
  29. package/dist/lib/Components/core/ListItem/ListItem.js +8 -8
  30. package/dist/lib/Components/core/MediaBanner/MediaBanner.js +4 -4
  31. package/dist/lib/Components/core/MediaCard/MediaCard.js +1 -1
  32. package/dist/lib/Components/core/MediaImage/MediaImage.js +5 -5
  33. package/dist/lib/Components/core/Menu/Menu.js +25 -25
  34. package/dist/lib/Components/core/NavBar/CoinCapsule.js +4 -4
  35. package/dist/lib/Components/core/NavBar/NavBar.js +3 -3
  36. package/dist/lib/Components/core/PageIndicator/PageIndicator.js +5 -5
  37. package/dist/lib/Components/core/Pagination/Pagination.js +1 -1
  38. package/dist/lib/Components/core/Popover/Popover.js +13 -13
  39. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  40. package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +80 -84
  41. package/dist/lib/Components/core/Select/Select.d.ts.map +1 -1
  42. package/dist/lib/Components/core/Select/Select.js +108 -107
  43. package/dist/lib/Components/core/SideBar/SideBar.js +33 -33
  44. package/dist/lib/Components/core/Spinner/Spinner.js +1 -1
  45. package/dist/lib/Components/core/Spot/Spot.js +13 -13
  46. package/dist/lib/Components/core/Stepper/Stepper.d.ts +4 -3
  47. package/dist/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
  48. package/dist/lib/Components/core/Stepper/Stepper.js +137 -62
  49. package/dist/lib/Components/core/Stepper/types.d.ts +12 -2
  50. package/dist/lib/Components/core/Stepper/types.d.ts.map +1 -1
  51. package/dist/lib/Components/core/Subheader/Subheader.d.ts.map +1 -1
  52. package/dist/lib/Components/core/Subheader/Subheader.js +33 -29
  53. package/dist/lib/Components/core/Table/Table.js +10 -10
  54. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.js +6 -6
  55. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts +1 -1
  56. package/dist/lib/Components/core/ThemeProvider/ThemeProvider.types.d.ts.map +1 -1
  57. package/dist/lib/Components/core/Timeline/Timeline.d.ts +54 -0
  58. package/dist/lib/Components/core/Timeline/Timeline.d.ts.map +1 -0
  59. package/dist/lib/Components/core/Timeline/Timeline.js +228 -0
  60. package/dist/lib/Components/core/Timeline/index.d.ts +3 -0
  61. package/dist/lib/Components/core/Timeline/index.d.ts.map +1 -0
  62. package/dist/lib/Components/core/Timeline/types.d.ts +148 -0
  63. package/dist/lib/Components/core/Timeline/types.d.ts.map +1 -0
  64. package/dist/lib/Components/core/Toast/Toast.d.ts +25 -0
  65. package/dist/lib/Components/core/Toast/Toast.d.ts.map +1 -0
  66. package/dist/lib/Components/core/Toast/Toast.js +68 -0
  67. package/dist/lib/Components/core/Toast/Toaster.d.ts +27 -0
  68. package/dist/lib/Components/core/Toast/Toaster.d.ts.map +1 -0
  69. package/dist/lib/Components/core/Toast/Toaster.js +92 -0
  70. package/dist/lib/Components/core/Toast/hooks/useToastCollapse.d.ts +15 -0
  71. package/dist/lib/Components/core/Toast/hooks/useToastCollapse.d.ts.map +1 -0
  72. package/dist/lib/Components/core/Toast/hooks/useToastCollapse.js +15 -0
  73. package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.d.ts +24 -0
  74. package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.d.ts.map +1 -0
  75. package/dist/lib/Components/core/Toast/hooks/useToastViewportPause.js +27 -0
  76. package/dist/lib/Components/core/Toast/index.d.ts +5 -0
  77. package/dist/lib/Components/core/Toast/index.d.ts.map +1 -0
  78. package/dist/lib/Components/core/Toast/styles.d.ts +20 -0
  79. package/dist/lib/Components/core/Toast/styles.d.ts.map +1 -0
  80. package/dist/lib/Components/core/Toast/styles.js +77 -0
  81. package/dist/lib/Components/core/Toast/types.d.ts +81 -0
  82. package/dist/lib/Components/core/Toast/types.d.ts.map +1 -0
  83. package/dist/lib/Components/core/Trend/Trend.js +3 -3
  84. package/dist/lib/Components/core/index.d.ts +2 -0
  85. package/dist/lib/Components/core/index.d.ts.map +1 -1
  86. package/dist/lib/Components/internal/BaseButton/BaseButton.js +7 -7
  87. package/dist/lib/Components/internal/BaseInput/BaseInput.js +22 -22
  88. package/dist/lib/Components/internal/BaseInput/BaseInputMultiline.js +12 -12
  89. package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.js +4 -4
  90. package/dist/lib/Components/internal/BaseTag/BaseTag.js +4 -4
  91. package/dist/lib/Components/symbols/Icon/createIcon.js +3 -3
  92. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -1
  93. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.js +36 -35
  94. package/dist/lib/Components/visualization/CartesianChart/types.d.ts +1 -1
  95. package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -1
  96. package/dist/lib/Components/visualization/DonutChart/DonutChart.js +31 -31
  97. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +2 -2
  98. package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -1
  99. package/dist/lib/Components/visualization/DonutChart/DonutRing.js +13 -12
  100. package/dist/lib/Components/visualization/DonutChart/types.d.ts +1 -1
  101. package/dist/lib/Components/visualization/Legend/Legend.d.ts +1 -1
  102. package/dist/lib/Components/visualization/Legend/Legend.d.ts.map +1 -1
  103. package/dist/lib/Components/visualization/Legend/Legend.js +6 -10
  104. package/dist/lib/Components/visualization/Legend/types.d.ts +2 -2
  105. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts +1 -1
  106. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -1
  107. package/dist/lib/Components/visualization/LineChart/LineChart.js +90 -84
  108. package/dist/lib/Components/visualization/LineChart/types.d.ts +1 -1
  109. package/dist/lib/Components/visualization/LineChart/utils.d.ts +2 -1
  110. package/dist/lib/Components/visualization/LineChart/utils.d.ts.map +1 -1
  111. package/dist/lib/Components/visualization/LineChart/utils.js +23 -22
  112. package/dist/lib/Components/visualization/config.d.ts +0 -3
  113. package/dist/lib/Components/visualization/config.d.ts.map +1 -1
  114. package/dist/lib/Components/visualization/config.js +3 -6
  115. package/dist/libs/utils-shared/dist/index.js +353 -140
  116. package/dist/package.json +4 -6
  117. package/dist/translations/index.d.ts +3 -0
  118. package/dist/translations/index.d.ts.map +1 -0
  119. package/dist/{i18n → translations}/languages.d.ts +0 -5
  120. package/dist/translations/languages.d.ts.map +1 -0
  121. package/dist/{i18n → translations}/languages.js +1 -2
  122. package/dist/{i18n → translations}/locales/en.json.d.ts +11 -0
  123. package/dist/{i18n → translations}/locales/en.json.js +2 -2
  124. package/dist/translations/translations.d.ts +727 -0
  125. package/dist/translations/translations.d.ts.map +1 -0
  126. package/dist/translations/translations.js +22 -0
  127. package/package.json +4 -6
  128. package/dist/_virtual/dynamic-import-helper.js +0 -9
  129. package/dist/i18n/I18nProvider.d.ts +0 -8
  130. package/dist/i18n/I18nProvider.d.ts.map +0 -1
  131. package/dist/i18n/I18nProvider.js +0 -14
  132. package/dist/i18n/i18n.d.ts +0 -12
  133. package/dist/i18n/i18n.d.ts.map +0 -1
  134. package/dist/i18n/i18n.js +0 -42
  135. package/dist/i18n/index.d.ts +0 -4
  136. package/dist/i18n/index.d.ts.map +0 -1
  137. package/dist/i18n/languages.d.ts.map +0 -1
  138. package/dist/i18n/useCommonTranslation.d.ts +0 -2
  139. package/dist/i18n/useCommonTranslation.d.ts.map +0 -1
  140. package/dist/i18n/useCommonTranslation.js +0 -6
  141. package/dist/node_modules/i18next/dist/esm/i18next.js +0 -1479
  142. package/dist/node_modules/react-i18next/dist/es/I18nextProvider.js +0 -19
  143. package/dist/node_modules/react-i18next/dist/es/context.js +0 -17
  144. package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
  145. package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -8
  146. package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -11
  147. package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -25
  148. package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -65
  149. package/dist/node_modules/react-i18next/dist/es/utils.js +0 -57
  150. /package/dist/{i18n → translations}/locales/de.json.d.ts +0 -0
  151. /package/dist/{i18n → translations}/locales/de.json.js +0 -0
  152. /package/dist/{i18n → translations}/locales/es.json.d.ts +0 -0
  153. /package/dist/{i18n → translations}/locales/es.json.js +0 -0
  154. /package/dist/{i18n → translations}/locales/fr.json.d.ts +0 -0
  155. /package/dist/{i18n → translations}/locales/fr.json.js +0 -0
  156. /package/dist/{i18n → translations}/locales/ja.json.d.ts +0 -0
  157. /package/dist/{i18n → translations}/locales/ja.json.js +0 -0
  158. /package/dist/{i18n → translations}/locales/ko.json.d.ts +0 -0
  159. /package/dist/{i18n → translations}/locales/ko.json.js +0 -0
  160. /package/dist/{i18n → translations}/locales/pt.json.d.ts +0 -0
  161. /package/dist/{i18n → translations}/locales/pt.json.js +0 -0
  162. /package/dist/{i18n → translations}/locales/ru.json.d.ts +0 -0
  163. /package/dist/{i18n → translations}/locales/ru.json.js +0 -0
  164. /package/dist/{i18n → translations}/locales/th.json.d.ts +0 -0
  165. /package/dist/{i18n → translations}/locales/th.json.js +0 -0
  166. /package/dist/{i18n → translations}/locales/tr.json.d.ts +0 -0
  167. /package/dist/{i18n → translations}/locales/tr.json.js +0 -0
  168. /package/dist/{i18n → translations}/locales/zh.json.d.ts +0 -0
  169. /package/dist/{i18n → translations}/locales/zh.json.js +0 -0
@@ -1,44 +1,44 @@
1
- import { jsx as L } from "react/jsx-runtime";
2
- import { useMemo as M, createContext as W, useRef as q, useContext as I } from "react";
3
- import { clsx as N } from "clsx";
4
- import { twMerge as F } from "tailwind-merge";
5
- function K(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 z = {
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 ne(e, t = "md") {
16
- const { max: r, min: l, scale: a, startAt: o } = z[t], n = e.replace(/\D/g, "").length;
17
- return Math.max(l, r - Math.max(0, n - o) * a);
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
+ return Math.max(n, r - Math.max(0, o - s) * a);
18
18
  }
19
- function B(e, t = !0) {
19
+ function H(e, t = !0) {
20
20
  if (!e) return "";
21
- const r = e.includes("."), [l, a] = e.split("."), o = l.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
22
- return r && t ? a ? `${o}.${a}` : `${o}.` : o;
21
+ const r = e.includes("."), [n, a] = e.split("."), s = n.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
22
+ return r && t ? a ? `${s}.${a}` : `${s}.` : s;
23
23
  }
24
- const V = (e) => e.replaceAll(",", ".").replaceAll(/[^\d.]/g, ""), Y = (e) => e.replace(/^0+(?=\d)/, ""), D = (e, t) => t > 0 ? e.slice(0, t) : e, _ = (e, t) => D(e.replaceAll(/\D/g, ""), t), G = (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
- const l = e.indexOf(".");
27
- if (l === -1) return D(e, t);
28
- const a = D(e.slice(0, l), t) || "0", o = e.slice(l + 1).replaceAll(".", "").slice(0, r);
29
- return o.length > 0 ? `${a}.${o}` : e.endsWith(".") ? `${a}.` : a;
26
+ const n = e.indexOf(".");
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
+ return s.length > 0 ? `${a}.${s}` : e.endsWith(".") ? `${a}.` : a;
30
30
  };
31
- function le(e, t = {}) {
31
+ function Ee(e, t = {}) {
32
32
  const {
33
33
  allowDecimals: r = !0,
34
- thousandsSeparator: l = !0,
34
+ thousandsSeparator: n = !0,
35
35
  maxIntegerLength: a = 9,
36
- maxDecimalLength: o = 9,
37
- decimalSeparator: n = "."
38
- } = t, i = Y(V(e)), u = r ? G(i, a, o) : _(i, a), f = l ? B(u) : u;
39
- return n === "." ? f : f.replaceAll(".", n);
36
+ maxDecimalLength: s = 9,
37
+ decimalSeparator: o = "."
38
+ } = t, i = te(ee(e)), l = r ? ne(i, a, s) : re(i, a), c = n ? H(l) : l;
39
+ return o === "." ? c : c.replaceAll(".", o);
40
40
  }
41
- const A = [
41
+ const P = [
42
42
  "orange",
43
43
  "green",
44
44
  "blue",
@@ -48,105 +48,112 @@ const A = [
48
48
  "turquoise",
49
49
  "pink"
50
50
  ];
51
- function ae(e) {
52
- const t = (K(e) % A.length + A.length) % A.length;
53
- return A[t];
51
+ function Le(e) {
52
+ const t = (V(e) % P.length + P.length) % P.length;
53
+ return P[t];
54
54
  }
55
- function H(e, t) {
55
+ function ae(e, t) {
56
56
  if (Object.is(e, t)) return !0;
57
- const r = e, l = t, a = Object.keys(r), o = Object.keys(l);
58
- return a.length !== o.length ? !1 : a.every(
59
- (n) => Object.prototype.hasOwnProperty.call(l, n) && Object.is(r[n], l[n])
57
+ const r = e, n = t, a = Object.keys(r), s = Object.keys(n);
58
+ return a.length !== s.length ? !1 : a.every(
59
+ (o) => Object.prototype.hasOwnProperty.call(n, o) && Object.is(r[o], n[o])
60
60
  );
61
61
  }
62
- function J(e, t) {
63
- const r = W(t), l = ({ children: o, value: n }) => {
64
- const i = q(n);
65
- return H(i.current, n) || (i.current = n), /* @__PURE__ */ L(r.Provider, { value: i.current, children: o });
62
+ function se(e, t) {
63
+ const r = F(t), n = ({ children: s, value: o }) => {
64
+ const i = y(o);
65
+ return ae(i.current, o) || (i.current = o), /* @__PURE__ */ q(r.Provider, { value: i.current, children: s });
66
66
  };
67
- l.displayName = e + "Provider";
67
+ n.displayName = e + "Provider";
68
68
  function a({
69
- consumerName: o,
70
- contextRequired: n
69
+ consumerName: s,
70
+ contextRequired: o
71
71
  }) {
72
- const i = I(r);
72
+ const i = _(r);
73
73
  if (i)
74
74
  return i;
75
- if (n)
75
+ if (o)
76
76
  throw new Error(
77
- `${o} must be used within ${e}`
77
+ `${s} must be used within ${e}`
78
78
  );
79
79
  return t || {};
80
80
  }
81
- return [l, a];
81
+ return [n, a];
82
82
  }
83
- const [oe, Q] = J("Disabled", { disabled: !1 }), ie = ({
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 l = Q({
88
+ const n = oe({
89
89
  consumerName: e,
90
90
  contextRequired: t ?? !1
91
91
  });
92
- return !!(r?.disabled || l.disabled);
92
+ return !!(r?.disabled || n.disabled);
93
93
  };
94
- function se(...e) {
95
- return F(N(e));
94
+ function We(...e) {
95
+ return Q(J(e));
96
96
  }
97
- const w = (e) => typeof e == "string" || typeof e == "number", ue = (e) => Array.isArray(e) ? e.every(w) : w(e);
98
- function S(e, t) {
97
+ const C = (e) => typeof e == "string" || typeof e == "number", qe = (e) => Array.isArray(e) ? e.every(C) : C(e);
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 U(...e) {
103
+ function ie(...e) {
104
104
  const t = /* @__PURE__ */ new Map();
105
105
  return (r) => {
106
106
  if (r === null) {
107
- e.forEach((l) => {
108
- const a = t.get(l);
109
- typeof a == "function" && a(), S(l, null);
107
+ e.forEach((n) => {
108
+ const a = t.get(n);
109
+ typeof a == "function" && a(), E(n, null);
110
110
  }), t.clear();
111
111
  return;
112
112
  }
113
- e.forEach((l) => {
114
- const a = S(l, r);
115
- typeof a == "function" && t.set(l, a);
113
+ e.forEach((n) => {
114
+ const a = E(n, r);
115
+ typeof a == "function" && t.set(n, a);
116
116
  });
117
117
  };
118
118
  }
119
- function ce(...e) {
120
- return M(() => U(...e), e);
119
+ function Fe(...e) {
120
+ return I(() => ie(...e), e);
121
121
  }
122
- function de(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 fe = ({
136
+ const Be = ({
128
137
  currentStep: e,
129
138
  totalSteps: t,
130
139
  size: r,
131
- label: l,
132
- strokeWidth: a = 4,
133
- arcPercentage: o = 0.75
140
+ label: n,
141
+ strokeWidth: a = 4
134
142
  }) => {
135
- const n = Math.min(Math.max(e, 0), t), i = l ?? `${n}/${t}`, u = t <= 0 ? 0 : n / t, f = (r - a) / 2, p = r / 2, h = r / 2, c = 2 * Math.PI * f, m = c * o, b = m * (1 - u), g = n <= 0, v = `${m} ${c}`, P = g ? m - 2 : b;
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;
136
144
  return {
137
- displayLabel: i,
138
- progress: u,
139
- r: f,
140
- cx: p,
141
- cy: h,
142
- circumference: c,
143
- trackArcLength: m,
144
- trackDashArray: `${m} ${c}`,
145
+ displayLabel: o,
146
+ progress: i,
147
+ r: l,
148
+ cx: c,
149
+ cy: p,
150
+ circumference: d,
145
151
  progressDashArray: v,
146
- progressDashOffset: P,
147
- showMinimalDot: g
152
+ progressMaskDashArray: b,
153
+ progressDashOffset: S,
154
+ dashPatternOffset: w
148
155
  };
149
- }, me = (e) => M(
156
+ }, Ke = (e) => I(
150
157
  () => ({
151
158
  integerPart: Array.from(e.integerPart, (t) => ({
152
159
  value: t,
@@ -158,57 +165,215 @@ const fe = ({
158
165
  })) : []
159
166
  }),
160
167
  [e.integerPart, e.decimalPart]
161
- ), pe = (e, t, r) => {
168
+ ), Ue = (e, t, r) => {
162
169
  if (t) return r;
163
- const l = e.decimalPart ? `${e.decimalSeparator}${e.decimalPart}` : "", a = `${e.integerPart}${l}`;
170
+ const n = e.decimalPart ? `${e.decimalSeparator}${e.decimalPart}` : "", a = `${e.integerPart}${n}`;
164
171
  return e.currencyPosition === "end" ? `${a} ${e.currencyText}` : `${e.currencyText} ${a}`;
165
172
  };
166
- function Z(e, t, r = {}) {
167
- const { leading: l = !1, trailing: a = !0, maxWait: o } = r;
168
- let n = null, i = null, u = null, f = 0, p = null, h = null, c;
169
- const m = o !== void 0, b = m ? Math.max(o, t) : 0, g = (s) => {
170
- f = s;
171
- const d = p ?? [], x = h;
172
- return p = null, h = null, c = e.apply(x, d), c;
173
- }, v = (s) => {
174
- const d = u ? s - u : 0;
175
- return t - d;
176
- }, P = (s) => {
177
- const d = u ? s - u : t, x = s - f;
178
- return u === null || d >= t || d < 0 || m && x >= b;
179
- }, T = (s) => (n = null, a && p ? g(s) : (p = null, h = null, c)), y = () => {
180
- const s = Date.now();
181
- if (P(s)) {
182
- T(s);
173
+ let L = 0;
174
+ const ce = {
175
+ info: 5e3,
176
+ success: 5e3,
177
+ warning: 0,
178
+ error: 0
179
+ }, ue = 3, B = [], ze = (e) => Number.isInteger(e) && e >= 1 ? e : ue, Xe = (e, t) => {
180
+ if (e.duration !== void 0)
181
+ return e.duration === 0 ? 1 / 0 : e.duration;
182
+ if (e.loading) return 1 / 0;
183
+ const r = t?.[e.appearance] ?? ce[e.appearance];
184
+ return r === 0 ? 1 / 0 : r;
185
+ }, de = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : (L += 1, `toast-${Date.now()}-${L}`), pe = (e, t) => ({
186
+ id: e,
187
+ appearance: t.appearance ?? "info",
188
+ loading: t.loading ?? !1,
189
+ title: t.title,
190
+ duration: t.duration,
191
+ dismissible: t.dismissible ?? !0,
192
+ action: t.action
193
+ }), fe = (e) => {
194
+ const t = {};
195
+ for (const r of Object.keys(e))
196
+ (e[r] !== void 0 || r === "action") && Object.assign(t, { [r]: e[r] });
197
+ return t;
198
+ };
199
+ let f = B;
200
+ const O = /* @__PURE__ */ new Set();
201
+ let $ = 0;
202
+ const D = () => {
203
+ for (const e of O) 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);
209
+ if (r === -1) return;
210
+ const n = fe(t), a = n.duration !== void 0 || n.loading !== void 0 || n.appearance !== void 0, s = {
211
+ ...f[r],
212
+ ...n,
213
+ ...a && { duration: n.duration }
214
+ };
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(
219
+ (r) => r.id === e ? { ...r, exiting: !0 } : r
220
+ ), D());
221
+ }, Te = () => {
222
+ f.length !== 0 && (f = f.map((e) => ({ ...e, exiting: !0 })), D());
223
+ }, ve = () => ($ += 1, $ > 1 && console.warn(
224
+ `[Toaster] ${$} <Toaster /> instances are mounted at once. Every toast will render once per instance. Mount a single <Toaster /> for the whole app.`
225
+ ), () => {
226
+ $ -= 1;
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) => {
237
+ const r = y(/* @__PURE__ */ new Set());
238
+ return k(() => {
239
+ r.current = new Set(
240
+ e.filter(
241
+ (n, a) => a >= t || r.current.has(n.id)
242
+ ).map((n) => n.id)
243
+ ), e.slice(t).filter((n) => n.exiting).forEach((n) => K.dismiss(n.id));
244
+ }, [e, t]), (n) => r.current.has(n);
245
+ }, we = ({
246
+ durationMs: e,
247
+ paused: t,
248
+ exiting: r,
249
+ onExpire: n
250
+ }) => {
251
+ const a = y(n);
252
+ a.current = n;
253
+ const s = y(e), o = y(e), i = y(null);
254
+ k(() => {
255
+ if (r || (e !== o.current && (o.current = e, s.current = e), t || !Number.isFinite(s.current))) return;
256
+ i.current = Date.now();
257
+ const l = setTimeout(
258
+ () => a.current(),
259
+ s.current
260
+ );
261
+ return () => {
262
+ clearTimeout(l), i.current !== null && (s.current -= Date.now() - i.current, i.current = null);
263
+ };
264
+ }, [t, r, e]);
265
+ }, Ae = 300, Ge = ({
266
+ durationMs: e,
267
+ paused: t,
268
+ exiting: r,
269
+ onDismiss: n
270
+ }) => {
271
+ we({ durationMs: e, paused: t, exiting: r, onExpire: n });
272
+ const a = y(n);
273
+ a.current = n, k(() => {
274
+ if (!r) return;
275
+ const s = setTimeout(
276
+ () => a.current(),
277
+ Ae
278
+ );
279
+ return () => clearTimeout(s);
280
+ }, [r]);
281
+ }, R = (e, t) => typeof e == "function" ? e(t) : e, Pe = ({
282
+ add: e,
283
+ update: t,
284
+ dismiss: r,
285
+ dismissAll: n
286
+ }) => {
287
+ const a = (s) => ({
288
+ id: e(s)
289
+ });
290
+ return {
291
+ notify: a,
292
+ info: (s) => a({ ...s, appearance: "info" }),
293
+ success: (s) => a({ ...s, appearance: "success" }),
294
+ warning: (s) => a({ ...s, appearance: "warning" }),
295
+ error: (s) => a({ ...s, appearance: "error" }),
296
+ loading: (s) => a({ ...s, appearance: "info", loading: !0 }),
297
+ update: t,
298
+ dismiss: r,
299
+ dismissAll: n,
300
+ promise: (s, o) => {
301
+ const { id: i } = a({
302
+ ...o.loading,
303
+ appearance: "info",
304
+ loading: !0
305
+ });
306
+ return s.then(
307
+ (l) => {
308
+ const c = R(o.success, l);
309
+ t(i, {
310
+ ...c,
311
+ appearance: "success",
312
+ loading: !1,
313
+ action: c.action,
314
+ dismissible: c.dismissible ?? !0
315
+ });
316
+ },
317
+ (l) => {
318
+ const c = R(o.error, l);
319
+ t(i, {
320
+ ...c,
321
+ appearance: "error",
322
+ loading: !1,
323
+ action: c.action,
324
+ dismissible: c.dismissible ?? !0
325
+ });
326
+ }
327
+ ), { id: i };
328
+ }
329
+ };
330
+ }, Je = Pe(K);
331
+ function $e(e, t, r = {}) {
332
+ const { leading: n = !1, trailing: a = !0, maxWait: s } = r;
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) => {
335
+ c = u;
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 = () => {
345
+ const u = Date.now();
346
+ if (w(u)) {
347
+ j(u);
183
348
  return;
184
349
  }
185
- n = setTimeout(y, v(s));
186
- }, k = () => {
187
- const s = Date.now();
188
- i = null, p && (g(s), n !== null && (clearTimeout(n), n = setTimeout(y, t)));
189
- }, O = (s) => (f = s, n = setTimeout(y, t), m && (i = setTimeout(k, b)), l ? g(s) : c), R = () => {
190
- n !== null && clearTimeout(n), i !== null && clearTimeout(i), f = 0, p = null, h = null, u = null, n = null, i = null;
191
- }, j = () => n === null && i === null ? c : T(Date.now()), E = () => n !== null || i !== null, $ = function(...s) {
192
- const d = Date.now(), x = P(d);
193
- if (p = s, h = this, u = d, x) {
194
- if (n === null)
195
- return O(d);
196
- if (m)
197
- return clearTimeout(n), n = setTimeout(y, t), g(d);
350
+ o = setTimeout(x, S(u));
351
+ }, U = () => {
352
+ const u = Date.now();
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) {
359
+ if (o === null)
360
+ return z(m);
361
+ if (h)
362
+ return clearTimeout(o), o = setTimeout(x, t), b(m);
198
363
  }
199
- return n === null && (n = setTimeout(y, t)), c;
364
+ return o === null && (o = setTimeout(x, t)), g;
200
365
  };
201
- return $.cancel = R, $.flush = j, $.pending = E, $;
366
+ return A.cancel = X, A.flush = Y, A.pending = G, A;
202
367
  }
203
- function he(e, t, r = {}) {
204
- const { leading: l = !0, trailing: a = !0 } = r;
205
- return Z(e, t, {
206
- leading: l,
368
+ function Qe(e, t, r = {}) {
369
+ const { leading: n = !0, trailing: a = !0 } = r;
370
+ return $e(e, t, {
371
+ leading: n,
207
372
  trailing: a,
208
373
  maxWait: t
209
374
  });
210
375
  }
211
- const ge = ({
376
+ const Ve = ({
212
377
  onClick: e,
213
378
  disabled: t
214
379
  }) => e ? t ? {
@@ -222,41 +387,89 @@ const ge = ({
222
387
  (r.key === "Enter" || r.key === " ") && (r.preventDefault(), e?.(r));
223
388
  },
224
389
  onClick: e
225
- } : void 0, C = " ", ye = ({
390
+ } : void 0, N = " ", Ze = ({
226
391
  label: e,
227
392
  placeholder: t
228
393
  }) => {
229
394
  const r = typeof t == "string" && t.trim().length > 0 ? t : void 0;
230
395
  return e ? {
231
- inputPlaceholder: r ?? C,
396
+ inputPlaceholder: r ?? N,
232
397
  labelStaysFloatedWithPlaceholder: r !== void 0
233
398
  } : {
234
- inputPlaceholder: t ?? C,
399
+ inputPlaceholder: t ?? N,
235
400
  labelStaysFloatedWithPlaceholder: !1
236
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 };
237
439
  };
238
440
  export {
239
- A as AVATAR_COLOR_KEYS,
240
- oe as DisabledProvider,
241
- S as assignRef,
242
- pe as buildAriaLabel,
243
- se as cn,
244
- de as createPropsResolver,
245
- J as createSafeContext,
246
- Z as debounce,
247
- B as formatThousands,
248
- ge as getButtonA11yProps,
249
- ne as getFontSize,
250
- fe as getStepperCalculations,
251
- K as hashString,
252
- ue as isTextChildren,
253
- U as mergeRefs,
254
- ae as resolveAvatarColorKey,
255
- ye as resolveBaseInputPlaceholder,
256
- H as shallowEqual,
257
- le as textFormatter,
258
- he as throttle,
259
- ie as useDisabledContext,
260
- ce as useMergedRef,
261
- me as useSplitText
441
+ P as AVATAR_COLOR_KEYS,
442
+ Re as DisabledProvider,
443
+ Ae as EXIT_ANIMATION_MS,
444
+ E as assignRef,
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
262
475
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
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.15",
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
  };