@ledgerhq/lumen-ui-react 0.0.87 → 0.0.89

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 (44) hide show
  1. package/ai-rules/RULES.md +5 -1
  2. package/dist/i18n/locales/de.json.d.ts +3 -0
  3. package/dist/i18n/locales/de.json.js +1 -1
  4. package/dist/i18n/locales/en.json.d.ts +3 -0
  5. package/dist/i18n/locales/en.json.js +1 -1
  6. package/dist/i18n/locales/es.json.d.ts +3 -0
  7. package/dist/i18n/locales/es.json.js +1 -1
  8. package/dist/i18n/locales/fr.json.d.ts +3 -0
  9. package/dist/i18n/locales/fr.json.js +1 -1
  10. package/dist/i18n/locales/ja.json.d.ts +3 -0
  11. package/dist/i18n/locales/ja.json.js +1 -1
  12. package/dist/i18n/locales/ko.json.d.ts +3 -0
  13. package/dist/i18n/locales/ko.json.js +1 -1
  14. package/dist/i18n/locales/pt.json.d.ts +3 -0
  15. package/dist/i18n/locales/pt.json.js +1 -1
  16. package/dist/i18n/locales/ru.json.d.ts +3 -0
  17. package/dist/i18n/locales/ru.json.js +1 -1
  18. package/dist/i18n/locales/th.json.d.ts +3 -0
  19. package/dist/i18n/locales/th.json.js +1 -1
  20. package/dist/i18n/locales/tr.json.d.ts +3 -0
  21. package/dist/i18n/locales/tr.json.js +1 -1
  22. package/dist/i18n/locales/zh.json.d.ts +3 -0
  23. package/dist/i18n/locales/zh.json.js +1 -1
  24. package/dist/index.js +130 -128
  25. package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
  26. package/dist/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
  27. package/dist/lib/Components/AmountDisplay/AmountDisplay.js +82 -22
  28. package/dist/lib/Components/AmountDisplay/index.d.ts +1 -1
  29. package/dist/lib/Components/AmountDisplay/index.d.ts.map +1 -1
  30. package/dist/lib/Components/AmountDisplay/types.d.ts +10 -24
  31. package/dist/lib/Components/AmountDisplay/types.d.ts.map +1 -1
  32. package/dist/lib/Components/Dialog/Dialog.d.ts +1 -0
  33. package/dist/lib/Components/Dialog/Dialog.d.ts.map +1 -1
  34. package/dist/lib/Components/Dialog/DialogClose/DialogClose.d.ts +19 -0
  35. package/dist/lib/Components/Dialog/DialogClose/DialogClose.d.ts.map +1 -0
  36. package/dist/lib/Components/Dialog/DialogClose/DialogClose.js +8 -0
  37. package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.d.ts.map +1 -1
  38. package/dist/lib/Components/Dialog/DialogHeader/DialogHeader.js +16 -15
  39. package/dist/lib/Components/Dialog/types.d.ts +22 -3
  40. package/dist/lib/Components/Dialog/types.d.ts.map +1 -1
  41. package/dist/lib/Components/Table/utils/useThrottledScrollBottom.js +4 -4
  42. package/dist/libs/utils-shared/dist/index.js +110 -92
  43. package/dist/package.json +1 -1
  44. package/package.json +1 -1
@@ -1,147 +1,165 @@
1
- import { jsx as A } from "react/jsx-runtime";
2
- import { createContext as W, useMemo as O, useContext as j } from "react";
1
+ import { jsx as W } from "react/jsx-runtime";
2
+ import { useMemo as A, createContext as O, useContext as j } from "react";
3
3
  import { clsx as k } from "clsx";
4
4
  import { twMerge as N } from "tailwind-merge";
5
- function H(r) {
6
- return r ? r.split(/[-_ ]+/).map((t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase()).join("") : "";
5
+ function H(t) {
6
+ return t ? t.split(/[-_ ]+/).map((r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase()).join("") : "";
7
7
  }
8
8
  const q = 48, z = 17, E = 2;
9
- function J(r) {
10
- const t = r.replace(/\D/g, "").length;
9
+ function J(t) {
10
+ const r = t.replace(/\D/g, "").length;
11
11
  return Math.max(
12
12
  z,
13
- q - t * E
13
+ q - r * E
14
14
  );
15
15
  }
16
- function y(r, t = !0) {
17
- if (!r) return "";
18
- const o = r.includes("."), [m, l] = r.split("."), s = m.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
19
- return o && t ? l ? `${s}.${l}` : `${s}.` : s;
16
+ function v(t, r = !0) {
17
+ if (!t) return "";
18
+ const i = t.includes("."), [c, l] = t.split("."), o = c.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
19
+ return i && r ? l ? `${o}.${l}` : `${o}.` : o;
20
20
  }
21
- function K(r, t = {}) {
21
+ function K(t, r = {}) {
22
22
  const {
23
- allowDecimals: o = !0,
24
- thousandsSeparator: m = !0,
23
+ allowDecimals: i = !0,
24
+ thousandsSeparator: c = !0,
25
25
  maxIntegerLength: l = 9,
26
- maxDecimalLength: s = 9
27
- } = t, n = r.replace(",", ".").replace(/[^\d.]/g, "");
26
+ maxDecimalLength: o = 9
27
+ } = r, n = t.replace(",", ".").replace(/[^\d.]/g, "");
28
28
  let e = n;
29
- if (e = e.replace(/^0+(?=\d)/, ""), !o)
30
- return e = e.replace(/\D/g, ""), l > 0 && e.length > l && (e = e.slice(0, l)), m ? y(e) : e;
29
+ if (e = e.replace(/^0+(?=\d)/, ""), !i)
30
+ return e = e.replace(/\D/g, ""), l > 0 && e.length > l && (e = e.slice(0, l)), c ? v(e) : e;
31
31
  e === "." && (e = "0.");
32
- const i = e.indexOf(".");
33
- if (i !== -1) {
34
- let a = e.slice(0, i), c = e.slice(i + 1).replace(/\./g, "");
35
- l > 0 && a.length > l && (a = a.slice(0, l)), c = c.slice(0, s), a === "" && (a = "0");
36
- const h = n.endsWith(".") || e.endsWith(".");
37
- e = c.length > 0 ? `${a}.${c}` : h ? `${a}.` : a;
32
+ const s = e.indexOf(".");
33
+ if (s !== -1) {
34
+ let u = e.slice(0, s), m = e.slice(s + 1).replace(/\./g, "");
35
+ l > 0 && u.length > l && (u = u.slice(0, l)), m = m.slice(0, o), u === "" && (u = "0");
36
+ const g = n.endsWith(".") || e.endsWith(".");
37
+ e = m.length > 0 ? `${u}.${m}` : g ? `${u}.` : u;
38
38
  } else
39
39
  l > 0 && e.length > l && (e = e.slice(0, l));
40
- return m ? y(e) : e;
40
+ return c ? v(e) : e;
41
41
  }
42
- function U(r, t) {
43
- const o = W(t), m = ({ children: s, value: n }) => {
44
- const e = O(
42
+ function U(t, r) {
43
+ const i = O(r), c = ({ children: o, value: n }) => {
44
+ const e = A(
45
45
  () => n,
46
46
  Object.values(n ?? {})
47
47
  );
48
- return /* @__PURE__ */ A(o.Provider, { value: e, children: s });
48
+ return /* @__PURE__ */ W(i.Provider, { value: e, children: o });
49
49
  };
50
- m.displayName = r + "Provider";
50
+ c.displayName = t + "Provider";
51
51
  function l({
52
- consumerName: s,
52
+ consumerName: o,
53
53
  contextRequired: n
54
54
  }) {
55
- const e = j(o);
55
+ const e = j(i);
56
56
  if (e)
57
57
  return e;
58
58
  if (n)
59
59
  throw new Error(
60
- `${s} must be used within ${r}`
60
+ `${o} must be used within ${t}`
61
61
  );
62
- return t || {};
62
+ return r || {};
63
63
  }
64
- return [m, l];
64
+ return [c, l];
65
65
  }
66
- function V(...r) {
67
- return N(k(r));
66
+ function V(...t) {
67
+ return N(k(t));
68
68
  }
69
69
  const _ = ({
70
- currentStep: r,
71
- totalSteps: t,
72
- size: o,
73
- label: m,
70
+ currentStep: t,
71
+ totalSteps: r,
72
+ size: i,
73
+ label: c,
74
74
  strokeWidth: l = 4,
75
- arcPercentage: s = 0.75
75
+ arcPercentage: o = 0.75
76
76
  }) => {
77
- const n = Math.min(Math.max(r, 0), t), e = m ?? `${n}/${t}`, i = t <= 0 ? 0 : n / t, a = (o - l) / 2, c = o / 2, h = o / 2, f = 2 * Math.PI * a, g = f * s, D = g * (1 - i), d = n <= 0, C = `${g} ${f}`, T = d ? g - 2 : D;
77
+ const n = Math.min(Math.max(t, 0), r), e = c ?? `${n}/${r}`, s = r <= 0 ? 0 : n / r, u = (i - l) / 2, m = i / 2, g = i / 2, d = 2 * Math.PI * u, p = d * o, P = p * (1 - s), h = n <= 0, w = `${p} ${d}`, y = h ? p - 2 : P;
78
78
  return {
79
79
  displayLabel: e,
80
- progress: i,
81
- r: a,
82
- cx: c,
83
- cy: h,
84
- circumference: f,
85
- trackArcLength: g,
86
- trackDashArray: `${g} ${f}`,
87
- progressDashArray: C,
88
- progressDashOffset: T,
89
- showMinimalDot: d
80
+ progress: s,
81
+ r: u,
82
+ cx: m,
83
+ cy: g,
84
+ circumference: d,
85
+ trackArcLength: p,
86
+ trackDashArray: `${p} ${d}`,
87
+ progressDashArray: w,
88
+ progressDashOffset: y,
89
+ showMinimalDot: h
90
90
  };
91
+ }, Q = (t) => A(
92
+ () => ({
93
+ integerPart: Array.from(t.integerPart, (r) => ({
94
+ value: r,
95
+ type: r.match(/^\d$/) ? "digit" : "separator"
96
+ })),
97
+ decimalPart: t.decimalPart ? Array.from(t.decimalPart, (r) => ({
98
+ value: r,
99
+ type: "digit"
100
+ })) : []
101
+ }),
102
+ [t.integerPart, t.decimalPart]
103
+ ), X = (t, r, i) => {
104
+ if (r) return i;
105
+ const c = t.decimalPart ? `${t.decimalSeparator}${t.decimalPart}` : "", l = `${t.integerPart}${c}`;
106
+ return t.currencyPosition === "end" ? `${l} ${t.currencyText}` : `${t.currencyText} ${l}`;
91
107
  };
92
- function F(r, t, o = {}) {
93
- const { leading: m = !1, trailing: l = !0, maxWait: s } = o;
94
- let n = null, e = null, i = null, a = 0, c = null, h = null, f;
95
- const g = s !== void 0, D = g ? Math.max(s, t) : 0, d = (u) => {
96
- a = u;
97
- const p = c, $ = h;
98
- return c = null, h = null, f = r.apply($, p), f;
99
- }, C = (u) => {
100
- const p = i ? u - i : 0;
101
- return t - p;
102
- }, T = (u) => {
103
- const p = i ? u - i : t, $ = u - a;
104
- return i === null || p >= t || p < 0 || g && $ >= D;
105
- }, M = (u) => (n = null, l && c ? d(u) : (c = null, h = null, f)), x = () => {
106
- const u = Date.now();
107
- if (T(u)) {
108
- M(u);
108
+ function F(t, r, i = {}) {
109
+ const { leading: c = !1, trailing: l = !0, maxWait: o } = i;
110
+ let n = null, e = null, s = null, u = 0, m = null, g = null, d;
111
+ const p = o !== void 0, P = p ? Math.max(o, r) : 0, h = (a) => {
112
+ u = a;
113
+ const f = m, x = g;
114
+ return m = null, g = null, d = t.apply(x, f), d;
115
+ }, w = (a) => {
116
+ const f = s ? a - s : 0;
117
+ return r - f;
118
+ }, y = (a) => {
119
+ const f = s ? a - s : r, x = a - u;
120
+ return s === null || f >= r || f < 0 || p && x >= P;
121
+ }, D = (a) => (n = null, l && m ? h(a) : (m = null, g = null, d)), $ = () => {
122
+ const a = Date.now();
123
+ if (y(a)) {
124
+ D(a);
109
125
  return;
110
126
  }
111
- n = setTimeout(x, C(u));
112
- }, b = () => {
113
- const u = Date.now();
114
- e = null, c && (d(u), n !== null && (clearTimeout(n), n = setTimeout(x, t)));
115
- }, v = (u) => (a = u, n = setTimeout(x, t), g && (e = setTimeout(b, D)), m ? d(u) : f), L = () => {
116
- n !== null && clearTimeout(n), e !== null && clearTimeout(e), a = 0, c = null, h = null, i = null, n = null, e = null;
117
- }, P = () => n === null && e === null ? f : M(Date.now()), S = () => n !== null || e !== null, w = function(...u) {
118
- const p = Date.now(), $ = T(p);
119
- if (c = u, h = this, i = p, $) {
127
+ n = setTimeout($, w(a));
128
+ }, M = () => {
129
+ const a = Date.now();
130
+ e = null, m && (h(a), n !== null && (clearTimeout(n), n = setTimeout($, r)));
131
+ }, b = (a) => (u = a, n = setTimeout($, r), p && (e = setTimeout(M, P)), c ? h(a) : d), C = () => {
132
+ n !== null && clearTimeout(n), e !== null && clearTimeout(e), u = 0, m = null, g = null, s = null, n = null, e = null;
133
+ }, S = () => n === null && e === null ? d : D(Date.now()), L = () => n !== null || e !== null, T = function(...a) {
134
+ const f = Date.now(), x = y(f);
135
+ if (m = a, g = this, s = f, x) {
120
136
  if (n === null)
121
- return v(p);
122
- if (g)
123
- return clearTimeout(n), n = setTimeout(x, t), d(p);
137
+ return b(f);
138
+ if (p)
139
+ return clearTimeout(n), n = setTimeout($, r), h(f);
124
140
  }
125
- return n === null && (n = setTimeout(x, t)), f;
141
+ return n === null && (n = setTimeout($, r)), d;
126
142
  };
127
- return w.cancel = L, w.flush = P, w.pending = S, w;
143
+ return T.cancel = C, T.flush = S, T.pending = L, T;
128
144
  }
129
- function Q(r, t, o = {}) {
130
- const { leading: m = !0, trailing: l = !0 } = o;
131
- return F(r, t, {
132
- leading: m,
145
+ function Y(t, r, i = {}) {
146
+ const { leading: c = !0, trailing: l = !0 } = i;
147
+ return F(t, r, {
148
+ leading: c,
133
149
  trailing: l,
134
- maxWait: t
150
+ maxWait: r
135
151
  });
136
152
  }
137
153
  export {
154
+ X as buildAriaLabel,
138
155
  V as cn,
139
156
  U as createSafeContext,
140
157
  F as debounce,
141
- y as formatThousands,
158
+ v as formatThousands,
142
159
  J as getFontSize,
143
160
  _ as getStepperCalculations,
144
161
  K as textFormatter,
145
- Q as throttle,
146
- H as toPascalCase
162
+ Y as throttle,
163
+ H as toPascalCase,
164
+ Q as useSplitText
147
165
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [