@blenx-dev/datatable 0.1.1

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.
@@ -0,0 +1,420 @@
1
+ import { style, keyframes } from "@vanilla-extract/css";
2
+ import { semanticVars, tokenVars } from "@blenx-dev/theme/contract";
3
+
4
+ const pulse = keyframes({
5
+ "0%, 100%": { opacity: 0.4 },
6
+ "50%": { opacity: 0.8 },
7
+ });
8
+
9
+ export const actionsCell = style({
10
+ display: "flex",
11
+ gap: 4,
12
+ });
13
+
14
+ export const checkbox = style({
15
+ cursor: "pointer",
16
+ });
17
+
18
+ export const fetchingBar = style({
19
+ display: "flex",
20
+ justifyContent: "center",
21
+ alignItems: "center",
22
+ padding: tokenVars.spacing.sm,
23
+ gap: tokenVars.spacing.sm,
24
+ });
25
+
26
+ export const fetchingText = style({
27
+ color: semanticVars.text.secondary,
28
+ fontSize: "13px",
29
+ });
30
+
31
+ export const tableContainer = style({
32
+ overflowX: "auto",
33
+ overflowY: "auto",
34
+ borderRadius: tokenVars.borderRadius.md,
35
+ borderWidth: 1,
36
+ borderStyle: "solid",
37
+ borderColor: semanticVars.border.default,
38
+ position: "relative",
39
+ });
40
+
41
+ export const table = style({
42
+ width: "100%",
43
+ borderCollapse: "collapse",
44
+ tableLayout: "auto",
45
+ });
46
+
47
+ export const theadStatic = style({});
48
+
49
+ export const theadSticky = style({
50
+ position: "sticky",
51
+ top: 0,
52
+ zIndex: 1,
53
+ });
54
+
55
+ export const theadStickyScrolled = style({
56
+ position: "sticky",
57
+ top: 0,
58
+ zIndex: 1,
59
+ boxShadow: tokenVars.shadow.sm,
60
+ });
61
+
62
+ export const headRow = style({
63
+ backgroundColor: semanticVars.background.subtle,
64
+ });
65
+
66
+ export const th = style({
67
+ paddingTop: 10,
68
+ paddingBottom: 10,
69
+ paddingLeft: 12,
70
+ paddingRight: 12,
71
+ fontSize: "12px",
72
+ fontWeight: tokenVars.fontWeight.semibold,
73
+ color: semanticVars.text.secondary,
74
+ textAlign: "left",
75
+ textTransform: "uppercase",
76
+ letterSpacing: "0.05em",
77
+ borderBottomWidth: 1,
78
+ borderBottomStyle: "solid",
79
+ borderBottomColor: semanticVars.border.default,
80
+ whiteSpace: "nowrap",
81
+ userSelect: "none",
82
+ });
83
+
84
+ export const thSm = style({
85
+ fontSize: "11px",
86
+ paddingTop: 6,
87
+ paddingBottom: 6,
88
+ paddingLeft: 8,
89
+ paddingRight: 8,
90
+ });
91
+
92
+ export const thLg = style({
93
+ fontSize: "13px",
94
+ paddingTop: 14,
95
+ paddingBottom: 14,
96
+ paddingLeft: 16,
97
+ paddingRight: 16,
98
+ });
99
+
100
+ export const thSortable = style({
101
+ cursor: "pointer",
102
+ });
103
+
104
+ export const thContent = style({
105
+ display: "flex",
106
+ alignItems: "center",
107
+ gap: 4,
108
+ });
109
+
110
+ export const td = style({
111
+ paddingTop: 10,
112
+ paddingBottom: 10,
113
+ paddingLeft: 12,
114
+ paddingRight: 12,
115
+ fontSize: tokenVars.fontSize.sm,
116
+ color: semanticVars.text.primary,
117
+ borderBottomWidth: 1,
118
+ borderBottomStyle: "solid",
119
+ borderBottomColor: semanticVars.border.subtle,
120
+ whiteSpace: "nowrap",
121
+ overflow: "hidden",
122
+ textOverflow: "ellipsis",
123
+ });
124
+
125
+ export const tdSm = style({
126
+ paddingTop: 6,
127
+ paddingBottom: 6,
128
+ paddingLeft: 8,
129
+ paddingRight: 8,
130
+ });
131
+
132
+ export const tdLg = style({
133
+ paddingTop: 14,
134
+ paddingBottom: 14,
135
+ paddingLeft: 16,
136
+ paddingRight: 16,
137
+ });
138
+
139
+ export const tr = style({
140
+ transition: "background-color 0.15s ease",
141
+ });
142
+
143
+ export const trSm = style({ height: 36 });
144
+
145
+ export const trLg = style({ height: 60 });
146
+
147
+ export const trSelected = style({
148
+ backgroundColor: semanticVars.background.subtle,
149
+ });
150
+
151
+ export const emptyTd = style({
152
+ padding: 0,
153
+ borderBottomWidth: 1,
154
+ borderBottomStyle: "solid",
155
+ borderBottomColor: semanticVars.border.default,
156
+ });
157
+
158
+ // ─── Loading skeleton ────────────────────────────────────────────────────────
159
+
160
+ export const loadingWrapper = style({
161
+ width: "100%",
162
+ });
163
+
164
+ export const loadingTable = style({
165
+ width: "100%",
166
+ borderCollapse: "collapse",
167
+ });
168
+
169
+ export const headerCell = style({
170
+ paddingTop: 12,
171
+ paddingBottom: 12,
172
+ paddingLeft: 16,
173
+ paddingRight: 16,
174
+ borderBottomColor: semanticVars.border.default,
175
+ borderBottomStyle: "solid",
176
+ borderBottomWidth: 1,
177
+ });
178
+
179
+ export const skeletonBar = style({
180
+ borderRadius: 4,
181
+ backgroundColor: semanticVars.surface.raised,
182
+ animationName: pulse,
183
+ animationDuration: "1.5s",
184
+ animationTimingFunction: "ease-in-out",
185
+ animationIterationCount: "infinite",
186
+ });
187
+
188
+ export const cell = style({
189
+ paddingTop: 12,
190
+ paddingBottom: 12,
191
+ paddingLeft: 16,
192
+ paddingRight: 16,
193
+ borderBottomColor: semanticVars.border.subtle,
194
+ borderBottomStyle: "solid",
195
+ borderBottomWidth: 1,
196
+ });
197
+
198
+ export const loadingFooter = style({
199
+ display: "flex",
200
+ justifyContent: "center",
201
+ alignItems: "center",
202
+ padding: 16,
203
+ gap: 8,
204
+ });
205
+
206
+ export const loadingText = style({
207
+ color: semanticVars.text.secondary,
208
+ fontSize: tokenVars.fontSize.sm,
209
+ });
210
+
211
+ // ─── Column toggle ───────────────────────────────────────────────────────────
212
+
213
+ export const itemLabel = style({
214
+ fontSize: 14,
215
+ });
216
+
217
+ export const deselectLabel = style({
218
+ color: semanticVars.text.secondary,
219
+ fontSize: 13,
220
+ });
221
+
222
+ export const checkboxChecked = style({
223
+ marginLeft: "auto",
224
+ width: 16,
225
+ height: 16,
226
+ borderRadius: 3,
227
+ borderWidth: 1.5,
228
+ borderStyle: "solid",
229
+ borderColor: semanticVars.interactive.primary,
230
+ display: "inline-flex",
231
+ alignItems: "center",
232
+ justifyContent: "center",
233
+ backgroundColor: semanticVars.interactive.primary,
234
+ });
235
+
236
+ export const checkboxUnchecked = style({
237
+ marginLeft: "auto",
238
+ width: 16,
239
+ height: 16,
240
+ borderRadius: 3,
241
+ borderWidth: 1.5,
242
+ borderStyle: "solid",
243
+ borderColor: semanticVars.border.default,
244
+ display: "inline-flex",
245
+ alignItems: "center",
246
+ justifyContent: "center",
247
+ backgroundColor: "transparent",
248
+ });
249
+
250
+ export const partial = style({
251
+ width: 8,
252
+ height: 2,
253
+ borderRadius: 1,
254
+ backgroundColor: semanticVars.text.secondary,
255
+ });
256
+
257
+ // ─── Empty state ─────────────────────────────────────────────────────────────
258
+
259
+ export const emptyContainer = style({
260
+ display: "flex",
261
+ flexDirection: "column",
262
+ alignItems: "center",
263
+ justifyContent: "center",
264
+ paddingTop: tokenVars.spacing.xxxl,
265
+ paddingBottom: tokenVars.spacing.xxxl,
266
+ paddingLeft: tokenVars.spacing.md,
267
+ paddingRight: tokenVars.spacing.md,
268
+ gap: 12,
269
+ });
270
+
271
+ export const iconWrap = style({
272
+ opacity: 0.5,
273
+ });
274
+
275
+ export const message = style({
276
+ color: semanticVars.text.secondary,
277
+ fontSize: tokenVars.fontSize.sm,
278
+ lineHeight: 1.5,
279
+ textAlign: "center",
280
+ margin: 0,
281
+ });
282
+
283
+ export const actionWrap = style({
284
+ marginTop: tokenVars.spacing.xs,
285
+ });
286
+
287
+ // ─── Error state ─────────────────────────────────────────────────────────────
288
+
289
+ export const errorContainer = style({
290
+ display: "flex",
291
+ flexDirection: "column",
292
+ alignItems: "center",
293
+ justifyContent: "center",
294
+ paddingTop: tokenVars.spacing.xxxl,
295
+ paddingBottom: tokenVars.spacing.xxxl,
296
+ paddingLeft: tokenVars.spacing.md,
297
+ paddingRight: tokenVars.spacing.md,
298
+ gap: 12,
299
+ });
300
+
301
+ export const errorMessage = style({
302
+ color: semanticVars.status.danger,
303
+ fontSize: tokenVars.fontSize.sm,
304
+ lineHeight: 1.5,
305
+ textAlign: "center",
306
+ margin: 0,
307
+ });
308
+
309
+ // ─── Infinite loader ─────────────────────────────────────────────────────────
310
+
311
+ export const sentinel = style({
312
+ display: "flex",
313
+ justifyContent: "center",
314
+ alignItems: "center",
315
+ padding: tokenVars.spacing.md,
316
+ minHeight: 48,
317
+ });
318
+
319
+ export const loadingInline = style({
320
+ display: "flex",
321
+ alignItems: "center",
322
+ gap: tokenVars.spacing.sm,
323
+ });
324
+
325
+ export const loaderLoadingText = style({
326
+ color: semanticVars.text.secondary,
327
+ fontSize: tokenVars.fontSize.sm,
328
+ });
329
+
330
+ export const noMore = style({
331
+ color: semanticVars.text.disabled,
332
+ fontSize: tokenVars.fontSize.sm,
333
+ });
334
+
335
+ export const center = style({
336
+ display: "flex",
337
+ justifyContent: "center",
338
+ alignItems: "center",
339
+ padding: tokenVars.spacing.md,
340
+ });
341
+
342
+ // ─── Pagination ──────────────────────────────────────────────────────────────
343
+
344
+ export const nav = style({
345
+ display: "flex",
346
+ alignItems: "center",
347
+ justifyContent: "space-between",
348
+ paddingTop: tokenVars.spacing.sm,
349
+ paddingBottom: tokenVars.spacing.sm,
350
+ });
351
+
352
+ export const info = style({
353
+ color: semanticVars.text.secondary,
354
+ fontSize: tokenVars.fontSize.sm,
355
+ });
356
+
357
+ export const controls = style({
358
+ display: "flex",
359
+ alignItems: "center",
360
+ gap: tokenVars.spacing.sm,
361
+ });
362
+
363
+ export const range = style({
364
+ color: semanticVars.text.secondary,
365
+ fontSize: tokenVars.fontSize.sm,
366
+ whiteSpace: "nowrap",
367
+ });
368
+
369
+ export const buttonGroup = style({
370
+ display: "flex",
371
+ alignItems: "center",
372
+ gap: tokenVars.spacing.xs,
373
+ });
374
+
375
+ export const pageWrap = style({
376
+ display: "flex",
377
+ alignItems: "center",
378
+ gap: 2,
379
+ });
380
+
381
+ export const ellipsis = style({
382
+ color: semanticVars.text.disabled,
383
+ fontSize: tokenVars.fontSize.sm,
384
+ paddingLeft: tokenVars.spacing.xs,
385
+ paddingRight: tokenVars.spacing.xs,
386
+ });
387
+
388
+ export const pageButton = style({
389
+ minWidth: 32,
390
+ height: 32,
391
+ });
392
+
393
+ // ─── Toolbar ─────────────────────────────────────────────────────────────────
394
+
395
+ export const toolbarContainer = style({
396
+ display: "flex",
397
+ alignItems: "center",
398
+ justifyContent: "space-between",
399
+ gap: tokenVars.spacing.md,
400
+ paddingTop: tokenVars.spacing.sm,
401
+ paddingBottom: tokenVars.spacing.sm,
402
+ });
403
+
404
+ export const leftGroup = style({
405
+ display: "flex",
406
+ alignItems: "center",
407
+ gap: tokenVars.spacing.sm,
408
+ flex: 1,
409
+ });
410
+
411
+ export const rightGroup = style({
412
+ display: "flex",
413
+ alignItems: "center",
414
+ gap: tokenVars.spacing.sm,
415
+ });
416
+
417
+ export const searchWrap = style({
418
+ flex: 1,
419
+ maxWidth: 320,
420
+ });