@ledgerhq/lumen-ui-react 0.0.80 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n/locales/en.json.d.ts +4 -0
- package/dist/i18n/locales/en.json.js +1 -1
- package/dist/i18n/locales/fr.json.d.ts +4 -0
- package/dist/i18n/locales/fr.json.js +1 -1
- package/dist/index.js +98 -81
- package/dist/lib/Components/AmountInput/AmountInput.js +14 -14
- package/dist/lib/Components/Banner/Banner.js +2 -2
- package/dist/lib/Components/BaseInput/BaseInput.js +9 -9
- package/dist/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/lib/Components/CardButton/CardButton.js +9 -9
- package/dist/lib/Components/Dialog/Dialog.js +2 -2
- package/dist/lib/Components/Menu/Menu.js +4 -4
- package/dist/lib/Components/Select/Select.js +4 -4
- package/dist/lib/Components/SideBar/SideBar.js +16 -16
- package/dist/lib/Components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/lib/Components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/lib/Components/Skeleton/Skeleton.js +78 -27
- package/dist/lib/Components/Skeleton/types.d.ts +1 -1
- package/dist/lib/Components/Skeleton/types.d.ts.map +1 -1
- package/dist/lib/Components/Spot/Spot.d.ts +1 -1
- package/dist/lib/Components/Spot/Spot.d.ts.map +1 -1
- package/dist/lib/Components/Spot/Spot.js +27 -25
- package/dist/lib/Components/Subheader/Subheader.d.ts.map +1 -1
- package/dist/lib/Components/Subheader/Subheader.js +13 -5
- package/dist/lib/Components/Table/Table.d.ts +158 -0
- package/dist/lib/Components/Table/Table.d.ts.map +1 -0
- package/dist/lib/Components/Table/Table.js +390 -0
- package/dist/lib/Components/Table/constants.d.ts +3 -0
- package/dist/lib/Components/Table/constants.d.ts.map +1 -0
- package/dist/lib/Components/Table/constants.js +5 -0
- package/dist/lib/Components/Table/index.d.ts +3 -0
- package/dist/lib/Components/Table/index.d.ts.map +1 -0
- package/dist/lib/Components/Table/types.d.ts +245 -0
- package/dist/lib/Components/Table/types.d.ts.map +1 -0
- package/dist/lib/Components/Table/utils/useThrottledScrollBottom.d.ts +39 -0
- package/dist/lib/Components/Table/utils/useThrottledScrollBottom.d.ts.map +1 -0
- package/dist/lib/Components/Table/utils/useThrottledScrollBottom.js +39 -0
- package/dist/lib/Components/Tile/Tile.js +9 -9
- package/dist/lib/Components/TileButton/TileButton.js +5 -5
- package/dist/lib/Components/index.d.ts +1 -0
- package/dist/lib/Components/index.d.ts.map +1 -1
- package/dist/libs/utils-shared/dist/index.js +101 -54
- package/dist/package.json +4 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { createSafeContext as T, cn as c } from "../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { cva as i } from "class-variance-authority";
|
|
4
|
+
import { forwardRef as s } from "react";
|
|
5
|
+
import { useThrottledScrollBottom as g } from "./utils/useThrottledScrollBottom.js";
|
|
6
|
+
import { Spot as w } from "../Spot/Spot.js";
|
|
7
|
+
import { Information as R } from "../../Symbols/Icons/Information.js";
|
|
8
|
+
import { useCommonTranslation as B } from "../../../i18n/useCommonTranslation.js";
|
|
9
|
+
import { ChevronUpDown as C } from "../../Symbols/Icons/ChevronUpDown.js";
|
|
10
|
+
import { ChevronDescending as j } from "../../Symbols/Icons/ChevronDescending.js";
|
|
11
|
+
import { ChevronAscending as H } from "../../Symbols/Icons/ChevronAscending.js";
|
|
12
|
+
import { InteractiveIcon as A } from "../InteractiveIcon/InteractiveIcon.js";
|
|
13
|
+
const [I, b] = T("Table"), L = i(
|
|
14
|
+
"relative scrollbar-none w-full max-w-full border-collapse overflow-x-auto rounded-lg",
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
appearance: {
|
|
18
|
+
"no-background": "bg-canvas",
|
|
19
|
+
plain: "bg-surface"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
), V = s(
|
|
24
|
+
({
|
|
25
|
+
children: t,
|
|
26
|
+
appearance: e = "no-background",
|
|
27
|
+
className: a,
|
|
28
|
+
onScrollBottom: r,
|
|
29
|
+
loading: n,
|
|
30
|
+
...o
|
|
31
|
+
}, d) => {
|
|
32
|
+
const m = g({
|
|
33
|
+
onScrollBottom: r,
|
|
34
|
+
loading: n
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ l(I, { value: { appearance: e, loading: n }, children: /* @__PURE__ */ l(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
...o,
|
|
40
|
+
ref: d,
|
|
41
|
+
className: L({ appearance: e, className: a }),
|
|
42
|
+
onScroll: m,
|
|
43
|
+
children: t
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
V.displayName = "TableRoot";
|
|
49
|
+
const S = s(
|
|
50
|
+
({ children: t, className: e, ...a }, r) => /* @__PURE__ */ l(
|
|
51
|
+
"table",
|
|
52
|
+
{
|
|
53
|
+
...a,
|
|
54
|
+
className: c("w-full max-w-full table-fixed", e),
|
|
55
|
+
ref: r,
|
|
56
|
+
children: t
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
S.displayName = "Table";
|
|
61
|
+
const q = s(({ children: t, className: e, ...a }, r) => /* @__PURE__ */ l("thead", { ref: r, className: e, ...a, children: t }));
|
|
62
|
+
q.displayName = "TableHeader";
|
|
63
|
+
const z = s(
|
|
64
|
+
({ children: t, className: e, ...a }, r) => /* @__PURE__ */ l("tbody", { ref: r, className: e, ...a, children: t })
|
|
65
|
+
);
|
|
66
|
+
z.displayName = "TableBody";
|
|
67
|
+
const G = s(
|
|
68
|
+
({ children: t, className: e, clickable: a = !1, onClick: r, ...n }, o) => /* @__PURE__ */ l(
|
|
69
|
+
"tr",
|
|
70
|
+
{
|
|
71
|
+
ref: o,
|
|
72
|
+
onClick: r,
|
|
73
|
+
role: a ? "button" : void 0,
|
|
74
|
+
className: c(
|
|
75
|
+
a && "cursor-pointer outline-none select-none hover:bg-base-transparent-hover active:bg-base-transparent-pressed",
|
|
76
|
+
e
|
|
77
|
+
),
|
|
78
|
+
...n,
|
|
79
|
+
children: t
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
G.displayName = "TableRow";
|
|
84
|
+
const M = i("sticky top-0", {
|
|
85
|
+
variants: {
|
|
86
|
+
appearance: {
|
|
87
|
+
"no-background": "bg-canvas",
|
|
88
|
+
plain: "bg-surface"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}), k = s(({ children: t, className: e, ...a }, r) => {
|
|
92
|
+
const { appearance: n } = b({
|
|
93
|
+
consumerName: "TableHeaderRow",
|
|
94
|
+
contextRequired: !0
|
|
95
|
+
});
|
|
96
|
+
return /* @__PURE__ */ l(
|
|
97
|
+
"tr",
|
|
98
|
+
{
|
|
99
|
+
ref: r,
|
|
100
|
+
className: M({ appearance: n, className: e }),
|
|
101
|
+
...a,
|
|
102
|
+
children: t
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
k.displayName = "TableHeaderRow";
|
|
107
|
+
const J = s(({ children: t, className: e, colSpan: a = 1, ...r }, n) => {
|
|
108
|
+
const { appearance: o } = b({
|
|
109
|
+
consumerName: "TableGroupHeaderRow",
|
|
110
|
+
contextRequired: !0
|
|
111
|
+
});
|
|
112
|
+
return /* @__PURE__ */ l("tr", { ref: n, className: c("h-40", e), ...r, children: /* @__PURE__ */ l("td", { colSpan: a, children: /* @__PURE__ */ l(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: c(
|
|
116
|
+
"flex h-32 w-full items-center bg-muted px-12 body-3 text-base",
|
|
117
|
+
o === "no-background" && "rounded-sm"
|
|
118
|
+
),
|
|
119
|
+
children: t
|
|
120
|
+
}
|
|
121
|
+
) }) });
|
|
122
|
+
});
|
|
123
|
+
J.displayName = "TableGroupHeaderRow";
|
|
124
|
+
const f = {
|
|
125
|
+
root: i(
|
|
126
|
+
"h-64 truncate p-12 body-3 text-base first:rounded-l-md last:rounded-r-md",
|
|
127
|
+
{
|
|
128
|
+
variants: {
|
|
129
|
+
hideBelow: {
|
|
130
|
+
xs: "hidden xs:table-cell",
|
|
131
|
+
sm: "hidden sm:table-cell",
|
|
132
|
+
md: "hidden md:table-cell",
|
|
133
|
+
lg: "hidden lg:table-cell",
|
|
134
|
+
xl: "hidden xl:table-cell"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
inner: i("flex flex-1 justify-end", {
|
|
140
|
+
variants: {
|
|
141
|
+
align: {
|
|
142
|
+
start: "text-start justify-start",
|
|
143
|
+
end: "text-end justify-end"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
}, K = s(
|
|
148
|
+
({ children: t, className: e, hideBelow: a, align: r = "start", ...n }, o) => /* @__PURE__ */ l(
|
|
149
|
+
"td",
|
|
150
|
+
{
|
|
151
|
+
ref: o,
|
|
152
|
+
className: f.root({ hideBelow: a, className: e }),
|
|
153
|
+
...n,
|
|
154
|
+
children: /* @__PURE__ */ l("div", { className: f.inner({ align: r }), children: t })
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
K.displayName = "TableCell";
|
|
159
|
+
const P = i("flex items-center gap-12 truncate", {
|
|
160
|
+
variants: {
|
|
161
|
+
align: {
|
|
162
|
+
start: "text-start",
|
|
163
|
+
end: "text-end"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}), U = s(
|
|
167
|
+
({
|
|
168
|
+
className: t,
|
|
169
|
+
align: e = "start",
|
|
170
|
+
leadingContent: a,
|
|
171
|
+
title: r,
|
|
172
|
+
description: n,
|
|
173
|
+
...o
|
|
174
|
+
}, d) => /* @__PURE__ */ u(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref: d,
|
|
178
|
+
className: P({ align: e, className: t }),
|
|
179
|
+
...o,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ l("div", { children: a }),
|
|
182
|
+
/* @__PURE__ */ u("div", { className: "flex flex-col gap-4 truncate", children: [
|
|
183
|
+
/* @__PURE__ */ l("div", { className: "truncate body-2 text-base", children: r }),
|
|
184
|
+
/* @__PURE__ */ l("div", { className: "truncate body-3 text-muted", children: n })
|
|
185
|
+
] })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
U.displayName = "TableCellContent";
|
|
191
|
+
const v = {
|
|
192
|
+
root: i("group h-40 truncate p-12 body-3 text-base", {
|
|
193
|
+
variants: {
|
|
194
|
+
hideBelow: {
|
|
195
|
+
xs: "hidden xs:table-cell",
|
|
196
|
+
sm: "hidden sm:table-cell",
|
|
197
|
+
md: "hidden md:table-cell",
|
|
198
|
+
lg: "hidden lg:table-cell",
|
|
199
|
+
xl: "hidden xl:table-cell"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}),
|
|
203
|
+
content: i("flex min-w-0 items-center gap-4 truncate", {
|
|
204
|
+
variants: {
|
|
205
|
+
align: {
|
|
206
|
+
start: "text-start justify-start",
|
|
207
|
+
end: "text-end justify-end"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}),
|
|
211
|
+
trailingContent: i(
|
|
212
|
+
"flex items-center justify-center opacity-0 group-hover:opacity-100"
|
|
213
|
+
)
|
|
214
|
+
}, E = s(
|
|
215
|
+
({
|
|
216
|
+
children: t,
|
|
217
|
+
className: e,
|
|
218
|
+
scope: a = "col",
|
|
219
|
+
hideBelow: r,
|
|
220
|
+
align: n = "start",
|
|
221
|
+
trailingContent: o,
|
|
222
|
+
...d
|
|
223
|
+
}, m) => /* @__PURE__ */ l(
|
|
224
|
+
"th",
|
|
225
|
+
{
|
|
226
|
+
ref: m,
|
|
227
|
+
scope: a,
|
|
228
|
+
className: v.root({ hideBelow: r, className: e }),
|
|
229
|
+
...d,
|
|
230
|
+
children: /* @__PURE__ */ l("div", { className: "min-w-0", children: /* @__PURE__ */ u("div", { className: v.content({ align: n }), children: [
|
|
231
|
+
/* @__PURE__ */ l("span", { className: c("truncate", n === "end" && "order-1"), children: t }),
|
|
232
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-center opacity-0 group-hover:opacity-100", children: o })
|
|
233
|
+
] }) })
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
);
|
|
237
|
+
E.displayName = "TableHeaderCell";
|
|
238
|
+
const F = s(
|
|
239
|
+
({ children: t, className: e, ...a }, r) => /* @__PURE__ */ l(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
ref: r,
|
|
243
|
+
className: c("flex items-center gap-8 py-12", e),
|
|
244
|
+
...a,
|
|
245
|
+
children: t
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
);
|
|
249
|
+
F.displayName = "TableActionBar";
|
|
250
|
+
const O = s(({ children: t, className: e, ...a }, r) => /* @__PURE__ */ l(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
ref: r,
|
|
254
|
+
className: c("flex items-center gap-8", e),
|
|
255
|
+
...a,
|
|
256
|
+
children: t
|
|
257
|
+
}
|
|
258
|
+
));
|
|
259
|
+
O.displayName = "TableActionBarLeading";
|
|
260
|
+
const Q = s(({ children: t, className: e, ...a }, r) => /* @__PURE__ */ l(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
ref: r,
|
|
264
|
+
className: c("ml-auto flex items-center gap-8", e),
|
|
265
|
+
...a,
|
|
266
|
+
children: t
|
|
267
|
+
}
|
|
268
|
+
));
|
|
269
|
+
Q.displayName = "TableActionBarTrailing";
|
|
270
|
+
const W = s(
|
|
271
|
+
({ className: t, ...e }, a) => {
|
|
272
|
+
const { loading: r } = b({
|
|
273
|
+
consumerName: "TableLoadingRow",
|
|
274
|
+
contextRequired: !0
|
|
275
|
+
});
|
|
276
|
+
return r ? /* @__PURE__ */ l(
|
|
277
|
+
"div",
|
|
278
|
+
{
|
|
279
|
+
...e,
|
|
280
|
+
ref: a,
|
|
281
|
+
className: c(
|
|
282
|
+
"flex h-80 w-full items-center justify-center p-12",
|
|
283
|
+
t
|
|
284
|
+
),
|
|
285
|
+
children: /* @__PURE__ */ l(w, { appearance: "loader", size: 48 })
|
|
286
|
+
}
|
|
287
|
+
) : null;
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
W.displayName = "TableLoadingRow";
|
|
291
|
+
const X = s(
|
|
292
|
+
({ className: t, ...e }, a) => /* @__PURE__ */ l(
|
|
293
|
+
A,
|
|
294
|
+
{
|
|
295
|
+
...e,
|
|
296
|
+
iconType: "filled",
|
|
297
|
+
className: t,
|
|
298
|
+
ref: a,
|
|
299
|
+
children: /* @__PURE__ */ l(R, { size: 20 })
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
);
|
|
303
|
+
X.displayName = "TableInfoIcon";
|
|
304
|
+
const Y = {
|
|
305
|
+
asc: H,
|
|
306
|
+
desc: j,
|
|
307
|
+
idle: C
|
|
308
|
+
}, x = {
|
|
309
|
+
root: i(
|
|
310
|
+
[
|
|
311
|
+
"group flex min-w-0 cursor-pointer items-center gap-4",
|
|
312
|
+
"rounded-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"
|
|
313
|
+
],
|
|
314
|
+
{
|
|
315
|
+
variants: {
|
|
316
|
+
align: {
|
|
317
|
+
end: "flex-row-reverse",
|
|
318
|
+
start: ""
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
icon: i("", {
|
|
324
|
+
variants: {
|
|
325
|
+
active: {
|
|
326
|
+
true: "opacity-100",
|
|
327
|
+
false: "opacity-0 group-hover:opacity-100"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
})
|
|
331
|
+
}, Z = s(
|
|
332
|
+
({
|
|
333
|
+
children: t,
|
|
334
|
+
sortDirection: e,
|
|
335
|
+
align: a = "start",
|
|
336
|
+
onToggleSort: r,
|
|
337
|
+
className: n,
|
|
338
|
+
onClick: o,
|
|
339
|
+
...d
|
|
340
|
+
}, m) => {
|
|
341
|
+
const { t: p } = B(), h = Y[e || "idle"], y = {
|
|
342
|
+
asc: p("table.ascAriaLabel"),
|
|
343
|
+
desc: p("table.descAriaLabel")
|
|
344
|
+
};
|
|
345
|
+
return /* @__PURE__ */ u(
|
|
346
|
+
"button",
|
|
347
|
+
{
|
|
348
|
+
...d,
|
|
349
|
+
ref: m,
|
|
350
|
+
type: "button",
|
|
351
|
+
className: x.root({ align: a, className: n }),
|
|
352
|
+
"aria-label": e ? y[e] : void 0,
|
|
353
|
+
onClick: (N) => {
|
|
354
|
+
o == null || o(N), r == null || r(e === "asc" ? "desc" : "asc");
|
|
355
|
+
},
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ l("span", { className: "min-w-0 truncate", children: t }),
|
|
358
|
+
/* @__PURE__ */ l(
|
|
359
|
+
h,
|
|
360
|
+
{
|
|
361
|
+
size: 20,
|
|
362
|
+
className: x.icon({
|
|
363
|
+
active: !!e
|
|
364
|
+
})
|
|
365
|
+
}
|
|
366
|
+
)
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
Z.displayName = "TableSortButton";
|
|
373
|
+
export {
|
|
374
|
+
S as Table,
|
|
375
|
+
F as TableActionBar,
|
|
376
|
+
O as TableActionBarLeading,
|
|
377
|
+
Q as TableActionBarTrailing,
|
|
378
|
+
z as TableBody,
|
|
379
|
+
K as TableCell,
|
|
380
|
+
U as TableCellContent,
|
|
381
|
+
J as TableGroupHeaderRow,
|
|
382
|
+
q as TableHeader,
|
|
383
|
+
E as TableHeaderCell,
|
|
384
|
+
k as TableHeaderRow,
|
|
385
|
+
X as TableInfoIcon,
|
|
386
|
+
W as TableLoadingRow,
|
|
387
|
+
V as TableRoot,
|
|
388
|
+
G as TableRow,
|
|
389
|
+
Z as TableSortButton
|
|
390
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Table/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,oCAAoC,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Table/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
2
|
+
import { Breakpoints } from '../../../types';
|
|
3
|
+
export type TableRootProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The appearance of the body
|
|
6
|
+
* @default 'no-background'
|
|
7
|
+
*/
|
|
8
|
+
appearance?: 'no-background' | 'plain';
|
|
9
|
+
/**
|
|
10
|
+
* The table content (TableHeader, TableBody)
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Custom classname
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Callback fired when scroll reaches the bottom of the table container.
|
|
19
|
+
* Useful for implementing infinite scroll or pagination.
|
|
20
|
+
*/
|
|
21
|
+
onScrollBottom?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* When true, disables onScrollBottom to prevent duplicate fetches.
|
|
24
|
+
* Use this while data is being loaded.
|
|
25
|
+
*/
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
export type TableProps = {
|
|
29
|
+
/**
|
|
30
|
+
* The table content (TableHeader, TableBody)
|
|
31
|
+
*/
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Custom classname
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
} & HTMLAttributes<HTMLTableElement>;
|
|
38
|
+
export type TableHeaderProps = {
|
|
39
|
+
/**
|
|
40
|
+
* The header content (TableHeaderRow)
|
|
41
|
+
*/
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Custom classname
|
|
45
|
+
*/
|
|
46
|
+
className?: string;
|
|
47
|
+
} & HTMLAttributes<HTMLTableSectionElement>;
|
|
48
|
+
export type TableBodyProps = {
|
|
49
|
+
/**
|
|
50
|
+
* The body content (TableRow)
|
|
51
|
+
*/
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Custom classname
|
|
55
|
+
*/
|
|
56
|
+
className?: string;
|
|
57
|
+
} & HTMLAttributes<HTMLTableSectionElement>;
|
|
58
|
+
export type TableRowProps = {
|
|
59
|
+
/**
|
|
60
|
+
* Whether the row is clickable
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
clickable?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The function to call when the row is clicked
|
|
66
|
+
*/
|
|
67
|
+
onClick?: (e: React.MouseEvent<HTMLTableRowElement>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* The row content (TableCell)
|
|
70
|
+
*/
|
|
71
|
+
children: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Custom classname
|
|
74
|
+
*/
|
|
75
|
+
className?: string;
|
|
76
|
+
} & HTMLAttributes<HTMLTableRowElement>;
|
|
77
|
+
export type TableCellProps = {
|
|
78
|
+
/**
|
|
79
|
+
* Hides this table header cell when the screen width is below the specified breakpoint.
|
|
80
|
+
* Use this to responsively show or hide columns at certain viewport sizes.
|
|
81
|
+
*/
|
|
82
|
+
hideBelow?: Breakpoints;
|
|
83
|
+
/**
|
|
84
|
+
* The cell content
|
|
85
|
+
*/
|
|
86
|
+
children?: ReactNode;
|
|
87
|
+
/**
|
|
88
|
+
* Custom classname
|
|
89
|
+
*/
|
|
90
|
+
className?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Text alignment within the cell
|
|
93
|
+
* @default 'start'
|
|
94
|
+
*/
|
|
95
|
+
align?: 'start' | 'end';
|
|
96
|
+
} & Omit<TdHTMLAttributes<HTMLTableCellElement>, 'align'>;
|
|
97
|
+
export type TableCellContentProps = {
|
|
98
|
+
/**
|
|
99
|
+
* Text alignment within the cell
|
|
100
|
+
* @default 'start'
|
|
101
|
+
*/
|
|
102
|
+
align?: 'start' | 'end';
|
|
103
|
+
/**
|
|
104
|
+
* Custom classname
|
|
105
|
+
*/
|
|
106
|
+
className?: string;
|
|
107
|
+
/**
|
|
108
|
+
* The leading content of the cell
|
|
109
|
+
* Typically an spot, icon or crypto-icon.
|
|
110
|
+
*/
|
|
111
|
+
leadingContent?: ReactNode;
|
|
112
|
+
/**
|
|
113
|
+
* The title of the cell
|
|
114
|
+
*/
|
|
115
|
+
title?: ReactNode;
|
|
116
|
+
/**
|
|
117
|
+
* The description of the cell
|
|
118
|
+
*/
|
|
119
|
+
description?: ReactNode;
|
|
120
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
121
|
+
export type TableHeaderRowProps = {
|
|
122
|
+
/**
|
|
123
|
+
* The header row content (TableHeaderCell)
|
|
124
|
+
*/
|
|
125
|
+
children: ReactNode;
|
|
126
|
+
/**
|
|
127
|
+
* The number of columns to span
|
|
128
|
+
*/
|
|
129
|
+
colSpan?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Custom classname
|
|
132
|
+
*/
|
|
133
|
+
className?: string;
|
|
134
|
+
} & HTMLAttributes<HTMLTableRowElement>;
|
|
135
|
+
export type TableGroupHeaderRowProps = {
|
|
136
|
+
/**
|
|
137
|
+
* The group header row content (TableHeaderCell)
|
|
138
|
+
*/
|
|
139
|
+
children: ReactNode;
|
|
140
|
+
/**
|
|
141
|
+
* Custom classname
|
|
142
|
+
*/
|
|
143
|
+
className?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Number of columns the group header row should span.
|
|
146
|
+
* This property is mandatory and should match the total number of columns in the table.
|
|
147
|
+
*/
|
|
148
|
+
colSpan: number;
|
|
149
|
+
} & HTMLAttributes<HTMLTableRowElement>;
|
|
150
|
+
export type TableHeaderCellProps = {
|
|
151
|
+
/**
|
|
152
|
+
* Hides this table header cell when the screen width is below the specified breakpoint.
|
|
153
|
+
* Use this to responsively show or hide columns at certain viewport sizes.
|
|
154
|
+
*/
|
|
155
|
+
hideBelow?: Breakpoints;
|
|
156
|
+
/**
|
|
157
|
+
* The header cell content. Use TableSortButton for sortable columns; other children are trailing content.
|
|
158
|
+
*/
|
|
159
|
+
children?: ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* The trailing content of the header cell
|
|
162
|
+
* Typically icons or other content, these are shown only on hover.
|
|
163
|
+
*/
|
|
164
|
+
trailingContent?: ReactNode;
|
|
165
|
+
/**
|
|
166
|
+
* Custom classname
|
|
167
|
+
*/
|
|
168
|
+
className?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Text alignment within the cell
|
|
171
|
+
* @default 'start'
|
|
172
|
+
*/
|
|
173
|
+
align?: 'start' | 'end';
|
|
174
|
+
/**
|
|
175
|
+
* Scope of the header cell
|
|
176
|
+
* @default 'col'
|
|
177
|
+
*/
|
|
178
|
+
scope?: 'col' | 'row' | 'colgroup' | 'rowgroup';
|
|
179
|
+
} & Omit<ThHTMLAttributes<HTMLTableCellElement>, 'align'>;
|
|
180
|
+
export type TableActionBarProps = {
|
|
181
|
+
/**
|
|
182
|
+
* The action bar content (TableActionBarLeading, TableActionBarTrailing)
|
|
183
|
+
*/
|
|
184
|
+
children: ReactNode;
|
|
185
|
+
/**
|
|
186
|
+
* Custom classname
|
|
187
|
+
*/
|
|
188
|
+
className?: string;
|
|
189
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
190
|
+
export type TableActionBarLeadingProps = {
|
|
191
|
+
/**
|
|
192
|
+
* The leading content (start-aligned actions)
|
|
193
|
+
*/
|
|
194
|
+
children: ReactNode;
|
|
195
|
+
/**
|
|
196
|
+
* Custom classname
|
|
197
|
+
*/
|
|
198
|
+
className?: string;
|
|
199
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
200
|
+
export type TableActionBarTrailingProps = {
|
|
201
|
+
/**
|
|
202
|
+
* The trailing content (end-aligned actions)
|
|
203
|
+
*/
|
|
204
|
+
children: ReactNode;
|
|
205
|
+
/**
|
|
206
|
+
* Custom classname
|
|
207
|
+
*/
|
|
208
|
+
className?: string;
|
|
209
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
210
|
+
export type TableLoadingRowProps = {
|
|
211
|
+
/**
|
|
212
|
+
* Custom classname
|
|
213
|
+
*/
|
|
214
|
+
className?: string;
|
|
215
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
216
|
+
export type TableInfoIconProps = {
|
|
217
|
+
/**
|
|
218
|
+
* Custom classname
|
|
219
|
+
*/
|
|
220
|
+
className?: string;
|
|
221
|
+
} & Omit<HTMLAttributes<HTMLButtonElement>, 'children'>;
|
|
222
|
+
export type TableSortValue = 'asc' | 'desc' | undefined;
|
|
223
|
+
export type TableSortButtonProps = {
|
|
224
|
+
/**
|
|
225
|
+
* Text and elements alignment within the cell
|
|
226
|
+
*/
|
|
227
|
+
align?: 'start' | 'end';
|
|
228
|
+
/**
|
|
229
|
+
* The column label (e.g. "Name", "Amount")
|
|
230
|
+
*/
|
|
231
|
+
children: ReactNode;
|
|
232
|
+
/**
|
|
233
|
+
* Current sort direction
|
|
234
|
+
*/
|
|
235
|
+
sortDirection?: TableSortValue;
|
|
236
|
+
/**
|
|
237
|
+
* Callback fired when the sort control is clicked
|
|
238
|
+
*/
|
|
239
|
+
onToggleSort?: (sort: TableSortValue) => void;
|
|
240
|
+
/**
|
|
241
|
+
* Custom classname
|
|
242
|
+
*/
|
|
243
|
+
className?: string;
|
|
244
|
+
} & Omit<HTMLAttributes<HTMLButtonElement>, 'children'>;
|
|
245
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Table/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IACvC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEnC,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAErC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;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,CAAC,CAAC;AAEnC,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { UIEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a scroll container has reached the bottom.
|
|
4
|
+
* Uses a threshold tolerance to handle subpixel rounding issues.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isScrolledToBottom: ({ element, threshold, }: {
|
|
7
|
+
element: HTMLElement;
|
|
8
|
+
threshold?: number;
|
|
9
|
+
}) => boolean;
|
|
10
|
+
type UseThrottledScrollBottomOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Callback fired when the user scrolls near the bottom.
|
|
13
|
+
*/
|
|
14
|
+
onScrollBottom?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* When true, disables the callback to prevent duplicate fetches.
|
|
17
|
+
*/
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Distance from bottom (in pixels) to trigger the callback.
|
|
21
|
+
* @default 2
|
|
22
|
+
*/
|
|
23
|
+
thresholdInRow?: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Hook that provides a throttled scroll handler for infinite scroll patterns.
|
|
27
|
+
* Fires `onScrollBottom` when the user scrolls within `threshold` pixels of the bottom.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const handleScroll = useThrottledScrollBottom({
|
|
31
|
+
* onScrollBottom: fetchMore,
|
|
32
|
+
* loading,
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* return <div onScroll={handleScroll}>...</div>;
|
|
36
|
+
*/
|
|
37
|
+
export declare const useThrottledScrollBottom: ({ onScrollBottom, loading, thresholdInRow, }: UseThrottledScrollBottomOptions) => ((event: UIEvent<HTMLElement>) => void) | undefined;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=useThrottledScrollBottom.d.ts.map
|