@ledgerhq/lumen-ui-react 0.1.4 → 0.1.5

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.
@@ -1,14 +1,7 @@
1
1
  const l = (r, n, t) => {
2
2
  const e = r[n];
3
3
  return e ? typeof e == "function" ? e() : Promise.resolve(e) : new Promise((i, o) => {
4
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
5
- o.bind(
6
- null,
7
- new Error(
8
- "Unknown variable dynamic import: " + n + (n.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
9
- )
10
- )
11
- );
4
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + n + (n.split("/").length !== t ? ". Note that variables only represent file names one level deep." : ""))));
12
5
  });
13
6
  };
14
7
  export {
@@ -1,150 +1,147 @@
1
- import { jsxs as h, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
2
  import { cn as a } from "../../../libs/utils-shared/dist/index.js";
3
- import d from "react";
4
- import { useCommonTranslation as $ } from "../../../i18n/useCommonTranslation.js";
5
- import { InteractiveIcon as q } from "../InteractiveIcon/InteractiveIcon.js";
6
- import { DeleteCircleFill as I } from "../../Symbols/Icons/DeleteCircleFill.js";
7
- const H = a(
3
+ import c from "react";
4
+ import { useCommonTranslation as O } from "../../../i18n/useCommonTranslation.js";
5
+ import { InteractiveIcon as $ } from "../InteractiveIcon/InteractiveIcon.js";
6
+ import { DeleteCircleFill as x } from "../../Symbols/Icons/DeleteCircleFill.js";
7
+ const q = a(
8
8
  "group relative flex h-48 w-full cursor-text items-center gap-8 rounded-sm bg-muted px-16 transition-colors",
9
9
  "focus-within:ring-2 focus-within:ring-active hover:bg-muted-hover",
10
10
  "has-disabled:cursor-not-allowed has-disabled:bg-disabled has-disabled:text-disabled",
11
11
  "has-invalid:border-error has-invalid:ring-1 has-invalid:ring-error",
12
12
  'has-[input[aria-invalid="true"]]:border-error has-[input[aria-invalid="true"]]:ring-1 has-[input[aria-invalid="true"]]:ring-error'
13
- ), K = a(
13
+ ), H = a(
14
14
  "peer w-full flex-1 bg-muted body-1 text-base caret-active outline-hidden transition-colors",
15
15
  "group-hover:bg-muted-hover group-disabled:bg-disabled",
16
16
  "group-has-disabled:cursor-not-allowed group-has-disabled:bg-disabled group-has-disabled:text-disabled",
17
17
  "placeholder:text-muted group-has-disabled:placeholder:text-disabled",
18
18
  "[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
19
19
  "truncate"
20
- ), U = a(
20
+ ), K = a(
21
21
  "pointer-events-none absolute top-6 left-16 origin-left body-4 text-muted transition-all duration-300",
22
22
  "peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-placeholder-shown:body-2",
23
23
  "group-has-disabled:text-disabled",
24
24
  "peer-focus:top-6 peer-focus:translate-y-0 peer-focus:body-4",
25
25
  "w-[calc(100%-var(--size-56))] truncate"
26
- ), G = ({
27
- ref: N,
28
- className: S,
29
- containerClassName: k,
30
- inputClassName: R,
31
- labelClassName: E,
32
- label: u,
33
- id: j,
34
- disabled: m,
35
- errorMessage: i,
36
- suffix: z,
37
- prefix: B,
38
- onClear: p,
39
- hideClearButton: C = !1,
40
- "aria-invalid": f,
41
- onChange: l,
42
- ...o
26
+ ), P = ({
27
+ ref: y,
28
+ className: I,
29
+ containerClassName: C,
30
+ inputClassName: S,
31
+ labelClassName: N,
32
+ label: d,
33
+ id: k,
34
+ disabled: h,
35
+ errorMessage: o,
36
+ suffix: R,
37
+ prefix: E,
38
+ onClear: j,
39
+ hideClearButton: z = !1,
40
+ "aria-invalid": b,
41
+ onChange: m,
42
+ ...i
43
43
  }) => {
44
- var x;
45
- const { t: D } = $(), n = d.useRef(null), F = d.useId(), b = j || `input-${F}`, L = f || (i ? !0 : void 0), c = o.value !== void 0, [T, v] = d.useState(
46
- ((x = o.defaultValue) == null ? void 0 : x.toString()) || ""
47
- ), V = d.useCallback(
44
+ const { t: B } = O(), n = c.useRef(null), D = c.useId(), u = k || `input-${D}`, F = b || (o ? !0 : void 0), s = i.value !== void 0, [L, v] = c.useState(
45
+ i.defaultValue?.toString() || ""
46
+ ), T = c.useCallback(
48
47
  (t) => {
49
- c || v(t.target.value), l == null || l(t);
48
+ s || v(t.target.value), m?.(t);
50
49
  },
51
- [c, l]
52
- ), g = (c ? !!o.value && o.value.toString().length > 0 : T.length > 0) && !m && !C, w = `${b}-error`, A = () => {
53
- var e;
50
+ [s, m]
51
+ ), f = (s ? !!i.value && i.value.toString().length > 0 : L.length > 0) && !h && !z, g = `${u}-error`, V = () => {
54
52
  if (!n.current) return;
55
- const t = (e = Object.getOwnPropertyDescriptor(
53
+ Object.getOwnPropertyDescriptor(
56
54
  window.HTMLInputElement.prototype,
57
55
  "value"
58
- )) == null ? void 0 : e.set;
59
- t == null || t.call(n.current, ""), c || v("");
60
- const s = new Event("input", { bubbles: !0 });
61
- n.current.dispatchEvent(s), n.current.focus(), p == null || p();
56
+ )?.set?.call(n.current, ""), s || v("");
57
+ const l = new Event("input", { bubbles: !0 });
58
+ n.current.dispatchEvent(l), n.current.focus(), j?.();
62
59
  };
63
- function O(...t) {
64
- return (s) => {
60
+ function A(...t) {
61
+ return (l) => {
65
62
  t.forEach((e) => {
66
- e && (typeof e == "function" ? e(s) : e.current = s);
63
+ e && (typeof e == "function" ? e(l) : e.current = l);
67
64
  });
68
65
  };
69
66
  }
70
- return /* @__PURE__ */ h("div", { className: S, children: [
71
- /* @__PURE__ */ h(
67
+ return /* @__PURE__ */ p("div", { className: I, children: [
68
+ /* @__PURE__ */ p(
72
69
  "div",
73
70
  {
74
- className: a(H, k),
71
+ className: a(q, C),
75
72
  onPointerDown: (t) => {
76
73
  if (t.target.closest("input, button, a")) return;
77
74
  const e = n.current;
78
75
  if (!e) return;
79
- const y = e.value.length > 0 ? e.value.length : 0;
76
+ const w = e.value.length > 0 ? e.value.length : 0;
80
77
  window.requestAnimationFrame(() => {
81
78
  try {
82
- e.setSelectionRange(y, y);
79
+ e.setSelectionRange(w, w);
83
80
  } catch {
84
81
  }
85
82
  e.focus();
86
83
  });
87
84
  },
88
85
  children: [
89
- B,
86
+ E,
90
87
  /* @__PURE__ */ r(
91
88
  "input",
92
89
  {
93
- ref: O(N, n),
94
- id: b,
95
- disabled: m,
90
+ ref: A(y, n),
91
+ id: u,
92
+ disabled: h,
96
93
  placeholder: " ",
97
- "aria-invalid": L,
98
- "aria-describedby": i ? w : void 0,
94
+ "aria-invalid": F,
95
+ "aria-describedby": o ? g : void 0,
99
96
  className: a(
100
- K,
101
- u && "pt-12 body-2",
102
- R
97
+ H,
98
+ d && "pt-12 body-2",
99
+ S
103
100
  ),
104
- onChange: V,
105
- ...o
101
+ onChange: T,
102
+ ...i
106
103
  }
107
104
  ),
108
- u && /* @__PURE__ */ r(
105
+ d && /* @__PURE__ */ r(
109
106
  "label",
110
107
  {
111
- htmlFor: b,
108
+ htmlFor: u,
112
109
  className: a(
113
- U,
114
- i && "text-error",
115
- E
110
+ K,
111
+ o && "text-error",
112
+ N
116
113
  ),
117
- children: u
114
+ children: d
118
115
  }
119
116
  ),
120
- g && /* @__PURE__ */ r(
121
- q,
117
+ f && /* @__PURE__ */ r(
118
+ $,
122
119
  {
123
120
  iconType: "filled",
124
- onClick: A,
125
- "aria-label": D("components.baseInput.clearInputAriaLabel"),
126
- children: /* @__PURE__ */ r(I, { size: 20 })
121
+ onClick: V,
122
+ "aria-label": B("components.baseInput.clearInputAriaLabel"),
123
+ children: /* @__PURE__ */ r(x, { size: 20 })
127
124
  }
128
125
  ),
129
- !g && z
126
+ !f && R
130
127
  ]
131
128
  }
132
129
  ),
133
- i && /* @__PURE__ */ h(
130
+ o && /* @__PURE__ */ p(
134
131
  "div",
135
132
  {
136
- id: w,
133
+ id: g,
137
134
  className: "mt-8 flex items-center gap-2 body-3 text-error",
138
135
  role: "alert",
139
136
  children: [
140
- /* @__PURE__ */ r(I, { size: 16, className: "shrink-0 text-error" }),
141
- /* @__PURE__ */ r("span", { children: i })
137
+ /* @__PURE__ */ r(x, { size: 16, className: "shrink-0 text-error" }),
138
+ /* @__PURE__ */ r("span", { children: o })
142
139
  ]
143
140
  }
144
141
  )
145
142
  ] });
146
143
  };
147
- G.displayName = "BaseInput";
144
+ P.displayName = "BaseInput";
148
145
  export {
149
- G as BaseInput
146
+ P as BaseInput
150
147
  };
@@ -1,188 +1,188 @@
1
- import { jsx as c, jsxs as u } from "react/jsx-runtime";
2
- import { createSafeContext as h, cn as x } from "../../../libs/utils-shared/dist/index.js";
3
- import { flexRender as b } from "@tanstack/react-table";
4
- import { useCallback as N, Fragment as B } from "react";
5
- import { TableRoot as C, Table as S, TableLoadingRow as H, TableHeader as k, TableHeaderRow as G, TableHeaderCell as v, TableSortButton as q, TableBody as T, TableGroupHeaderRow as I, TableRow as F, TableCell as M } from "../Table/Table.js";
1
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
2
+ import { createSafeContext as y, cn as C } from "../../../libs/utils-shared/dist/index.js";
3
+ import { flexRender as m } from "@tanstack/react-table";
4
+ import { useCallback as x, Fragment as N } from "react";
5
+ import { TableRoot as B, Table as S, TableLoadingRow as k, TableHeader as H, TableHeaderRow as G, TableHeaderCell as v, TableSortButton as q, TableBody as T, TableGroupHeaderRow as I, TableRow as F, TableCell as M } from "../Table/Table.js";
6
6
  import { SearchInput as j } from "../SearchInput/SearchInput.js";
7
- const [P, d] = h("DataTableContext"), V = ({
8
- table: t,
7
+ const [P, d] = y("DataTableContext"), V = ({
8
+ table: n,
9
9
  appearance: r = "no-background",
10
- paginationMode: n = "none",
11
- loading: a = !1,
12
- onScrollBottom: e,
13
- onRowClick: l,
14
- groupBy: o,
15
- renderGroupHeader: s,
16
- hideHeader: i = !1,
17
- children: f,
18
- className: y,
10
+ paginationMode: o = "none",
11
+ loading: e = !1,
12
+ onScrollBottom: a,
13
+ onRowClick: t,
14
+ groupBy: c,
15
+ renderGroupHeader: i,
16
+ hideHeader: s = !1,
17
+ children: h,
18
+ className: f,
19
19
  ref: w,
20
20
  ...R
21
- }) => /* @__PURE__ */ c(
21
+ }) => /* @__PURE__ */ l(
22
22
  P,
23
23
  {
24
24
  value: {
25
- hideHeader: i,
26
- paginationMode: n,
27
- table: t,
25
+ hideHeader: s,
26
+ paginationMode: o,
27
+ table: n,
28
28
  appearance: r,
29
- loading: a,
30
- onScrollBottom: e,
31
- onRowClick: l,
32
- groupBy: o,
33
- renderGroupHeader: s
29
+ loading: e,
30
+ onScrollBottom: a,
31
+ onRowClick: t,
32
+ groupBy: c,
33
+ renderGroupHeader: i
34
34
  },
35
- children: /* @__PURE__ */ c("div", { ref: w, className: x("flex flex-col", y), ...R, children: f })
35
+ children: /* @__PURE__ */ l("div", { ref: w, className: C("flex flex-col", f), ...R, children: h })
36
36
  }
37
37
  );
38
38
  V.displayName = "DataTableRoot";
39
39
  const p = ({
40
- className: t,
40
+ className: n,
41
41
  ref: r,
42
- ...n
42
+ ...o
43
43
  }) => {
44
- const { table: a } = d({
44
+ const { table: e } = d({
45
45
  consumerName: "DataTableHeader",
46
46
  contextRequired: !0
47
47
  });
48
- return /* @__PURE__ */ c(k, { ref: r, className: t, ...n, children: a.getHeaderGroups().map((e) => /* @__PURE__ */ c(G, { children: e.headers.map((l) => {
49
- const o = l.column.columnDef.meta;
50
- return /* @__PURE__ */ c(
48
+ return /* @__PURE__ */ l(H, { ref: r, className: n, ...o, children: e.getHeaderGroups().map((a) => /* @__PURE__ */ l(G, { children: a.headers.map((t) => {
49
+ const c = t.column.columnDef.meta;
50
+ return /* @__PURE__ */ l(
51
51
  v,
52
52
  {
53
- align: o == null ? void 0 : o.align,
54
- hideBelow: o == null ? void 0 : o.hideBelow,
55
- className: o == null ? void 0 : o.className,
56
- trailingContent: o == null ? void 0 : o.headerTrailingContent,
57
- children: l.isPlaceholder ? null : l.column.getCanSort() ? /* @__PURE__ */ c(
53
+ align: c?.align,
54
+ hideBelow: c?.hideBelow,
55
+ className: c?.className,
56
+ trailingContent: c?.headerTrailingContent,
57
+ children: t.isPlaceholder ? null : t.column.getCanSort() ? /* @__PURE__ */ l(
58
58
  q,
59
59
  {
60
- sortDirection: l.column.getIsSorted() || void 0,
61
- onClick: l.column.getToggleSortingHandler(),
62
- align: o == null ? void 0 : o.align,
63
- children: b(
64
- l.column.columnDef.header,
65
- l.getContext()
60
+ sortDirection: t.column.getIsSorted() || void 0,
61
+ onClick: t.column.getToggleSortingHandler(),
62
+ align: c?.align,
63
+ children: m(
64
+ t.column.columnDef.header,
65
+ t.getContext()
66
66
  )
67
67
  }
68
- ) : b(
69
- l.column.columnDef.header,
70
- l.getContext()
68
+ ) : m(
69
+ t.column.columnDef.header,
70
+ t.getContext()
71
71
  )
72
72
  },
73
- l.id
73
+ t.id
74
74
  );
75
- }) }, e.id)) });
75
+ }) }, a.id)) });
76
76
  };
77
77
  p.displayName = "DataTableHeader";
78
- const J = ({ className: t, ref: r, ...n }) => {
78
+ const J = ({ className: n, ref: r, ...o }) => {
79
79
  const {
80
- appearance: a,
81
- paginationMode: e,
82
- hideHeader: l,
83
- loading: o,
84
- onScrollBottom: s,
85
- groupBy: i
80
+ appearance: e,
81
+ paginationMode: a,
82
+ hideHeader: t,
83
+ loading: c,
84
+ onScrollBottom: i,
85
+ groupBy: s
86
86
  } = d({
87
87
  consumerName: "DataTable",
88
88
  contextRequired: !0
89
89
  });
90
90
  return /* @__PURE__ */ u(
91
- C,
91
+ B,
92
92
  {
93
93
  ref: r,
94
- appearance: a,
95
- loading: o,
96
- onScrollBottom: s,
97
- className: t,
98
- ...n,
94
+ appearance: e,
95
+ loading: c,
96
+ onScrollBottom: i,
97
+ className: n,
98
+ ...o,
99
99
  children: [
100
100
  /* @__PURE__ */ u(S, { children: [
101
- !l && /* @__PURE__ */ c(p, {}),
102
- i ? /* @__PURE__ */ c(g, {}) : /* @__PURE__ */ c(D, {})
101
+ !t && /* @__PURE__ */ l(p, {}),
102
+ s ? /* @__PURE__ */ l(D, {}) : /* @__PURE__ */ l(g, {})
103
103
  ] }),
104
- e === "infinite-scroll" && /* @__PURE__ */ c(H, {})
104
+ a === "infinite-scroll" && /* @__PURE__ */ l(k, {})
105
105
  ]
106
106
  }
107
107
  );
108
108
  };
109
109
  J.displayName = "DataTable";
110
- const D = ({ className: t, ref: r, ...n }) => {
111
- const { table: a } = d({
110
+ const g = ({ className: n, ref: r, ...o }) => {
111
+ const { table: e } = d({
112
112
  consumerName: "DataTableBody",
113
113
  contextRequired: !0
114
114
  });
115
- return /* @__PURE__ */ c(T, { ref: r, className: t, ...n, children: a.getRowModel().rows.map((e) => /* @__PURE__ */ c(m, { row: e }, e.id)) });
115
+ return /* @__PURE__ */ l(T, { ref: r, className: n, ...o, children: e.getRowModel().rows.map((a) => /* @__PURE__ */ l(b, { row: a }, a.id)) });
116
116
  };
117
- D.displayName = "DataTableBody";
118
- const K = (t, r) => {
119
- const n = [];
120
- let a = null;
121
- for (const e of t) {
122
- const l = r(e);
123
- (!a || a.key !== l) && (a = { key: l, rows: [], count: 0 }, n.push(a)), a.rows.push(e), a.count++;
117
+ g.displayName = "DataTableBody";
118
+ const K = (n, r) => {
119
+ const o = [];
120
+ let e = null;
121
+ for (const a of n) {
122
+ const t = r(a);
123
+ (!e || e.key !== t) && (e = { key: t, rows: [], count: 0 }, o.push(e)), e.rows.push(a), e.count++;
124
124
  }
125
- return n;
126
- }, g = ({
127
- className: t,
125
+ return o;
126
+ }, D = ({
127
+ className: n,
128
128
  ref: r,
129
- ...n
129
+ ...o
130
130
  }) => {
131
- const { table: a, groupBy: e, renderGroupHeader: l } = d({
131
+ const { table: e, groupBy: a, renderGroupHeader: t } = d({
132
132
  consumerName: "DataTableGroupedBody",
133
133
  contextRequired: !0
134
- }), o = K(a.getRowModel().rows, e);
135
- return /* @__PURE__ */ c(T, { ref: r, className: t, ...n, children: o.map((s) => /* @__PURE__ */ u(B, { children: [
136
- /* @__PURE__ */ c(I, { colSpan: s.rows[0].getVisibleCells().length, children: l ? l({ row: s.rows[0], count: s.count }) : s.key }),
137
- s.rows.map((i) => /* @__PURE__ */ c(m, { row: i }, i.id))
138
- ] }, s.key)) });
134
+ }), c = K(e.getRowModel().rows, a);
135
+ return /* @__PURE__ */ l(T, { ref: r, className: n, ...o, children: c.map((i) => /* @__PURE__ */ u(N, { children: [
136
+ /* @__PURE__ */ l(I, { colSpan: i.rows[0].getVisibleCells().length, children: t ? t({ row: i.rows[0], count: i.count }) : i.key }),
137
+ i.rows.map((s) => /* @__PURE__ */ l(b, { row: s }, s.id))
138
+ ] }, i.key)) });
139
139
  };
140
- g.displayName = "DataTableGroupedBody";
141
- const m = ({ row: t }) => {
140
+ D.displayName = "DataTableGroupedBody";
141
+ const b = ({ row: n }) => {
142
142
  const { onRowClick: r } = d({
143
143
  consumerName: "DataTableRow",
144
144
  contextRequired: !0
145
- }), n = !!r;
146
- return /* @__PURE__ */ c(
145
+ }), o = !!r;
146
+ return /* @__PURE__ */ l(
147
147
  F,
148
148
  {
149
- clickable: n,
150
- onClick: n ? () => r == null ? void 0 : r(t) : void 0,
151
- children: t.getVisibleCells().map((a) => {
152
- const e = a.column.columnDef.meta;
153
- return /* @__PURE__ */ c(
149
+ clickable: o,
150
+ onClick: o ? () => r?.(n) : void 0,
151
+ children: n.getVisibleCells().map((e) => {
152
+ const a = e.column.columnDef.meta;
153
+ return /* @__PURE__ */ l(
154
154
  M,
155
155
  {
156
- align: e == null ? void 0 : e.align,
157
- hideBelow: e == null ? void 0 : e.hideBelow,
158
- className: e == null ? void 0 : e.className,
159
- children: b(a.column.columnDef.cell, a.getContext())
156
+ align: a?.align,
157
+ hideBelow: a?.hideBelow,
158
+ className: a?.className,
159
+ children: m(e.column.columnDef.cell, e.getContext())
160
160
  },
161
- a.id
161
+ e.id
162
162
  );
163
163
  })
164
164
  }
165
165
  );
166
166
  };
167
- m.displayName = "DataTableRow";
167
+ b.displayName = "DataTableRow";
168
168
  const L = ({
169
- onChange: t,
169
+ onChange: n,
170
170
  ...r
171
171
  }) => {
172
- const { table: n } = d({
172
+ const { table: o } = d({
173
173
  consumerName: "DataTableGlobalSearchInput",
174
174
  contextRequired: !0
175
- }), a = N(
176
- (e) => {
177
- n.setGlobalFilter(e.target.value), t == null || t(e);
175
+ }), e = x(
176
+ (a) => {
177
+ o.setGlobalFilter(a.target.value), n?.(a);
178
178
  },
179
- [n, t]
179
+ [o, n]
180
180
  );
181
- return /* @__PURE__ */ c(
181
+ return /* @__PURE__ */ l(
182
182
  j,
183
183
  {
184
- value: n.getState().globalFilter ?? "",
185
- onChange: a,
184
+ value: o.getState().globalFilter ?? "",
185
+ onChange: e,
186
186
  ...r
187
187
  }
188
188
  );