@rowakit/table 0.1.0

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,319 @@
1
+ /**
2
+ * RowaKit Table Styles
3
+ *
4
+ * Default styles using design tokens.
5
+ * Import this file in your app to use default styling.
6
+ */
7
+
8
+ /* ============================================================================
9
+ * TABLE CONTAINER
10
+ * ============================================================================ */
11
+
12
+ .rowakit-table {
13
+ width: 100%;
14
+ font-family: var(--rowakit-font-family);
15
+ font-size: var(--rowakit-font-size-sm);
16
+ line-height: var(--rowakit-line-height-normal);
17
+ color: var(--rowakit-table-body-color);
18
+ background-color: var(--rowakit-table-bg);
19
+
20
+ /* Enable horizontal scroll on small screens */
21
+ overflow-x: auto;
22
+ -webkit-overflow-scrolling: touch;
23
+ }
24
+
25
+ .rowakit-table table {
26
+ width: 100%;
27
+ border-collapse: collapse;
28
+ background-color: var(--rowakit-table-bg);
29
+ }
30
+
31
+ /* ============================================================================
32
+ * TABLE HEADER
33
+ * ============================================================================ */
34
+
35
+ .rowakit-table thead th {
36
+ text-align: left;
37
+ padding: var(--rowakit-table-header-padding);
38
+ border-bottom: var(--rowakit-table-header-border-width) solid var(--rowakit-table-header-border-color);
39
+ font-weight: var(--rowakit-table-header-font-weight);
40
+ color: var(--rowakit-table-header-color);
41
+ background-color: var(--rowakit-table-header-bg);
42
+ user-select: none;
43
+ white-space: nowrap;
44
+ }
45
+
46
+ .rowakit-table thead th[role="button"] {
47
+ cursor: pointer;
48
+ transition: background-color 0.15s ease;
49
+ }
50
+
51
+ .rowakit-table thead th[role="button"]:hover {
52
+ background-color: var(--rowakit-color-gray-50);
53
+ }
54
+
55
+ .rowakit-table thead th[role="button"]:focus {
56
+ outline: 2px solid var(--rowakit-color-primary-500);
57
+ outline-offset: -2px;
58
+ }
59
+
60
+ /* ============================================================================
61
+ * TABLE BODY
62
+ * ============================================================================ */
63
+
64
+ .rowakit-table tbody td {
65
+ padding: var(--rowakit-table-cell-padding);
66
+ border-bottom: var(--rowakit-border-width) solid var(--rowakit-table-cell-border-color);
67
+ }
68
+
69
+ .rowakit-table tbody tr:hover {
70
+ background-color: var(--rowakit-table-row-hover-bg);
71
+ }
72
+
73
+ .rowakit-table tbody tr:last-child td {
74
+ border-bottom: none;
75
+ }
76
+
77
+ /* ============================================================================
78
+ * LOADING STATE
79
+ * ============================================================================ */
80
+
81
+ .rowakit-table-loading {
82
+ padding: var(--rowakit-spacing-2xl);
83
+ text-align: center;
84
+ color: var(--rowakit-state-loading-color);
85
+ }
86
+
87
+ .rowakit-table-loading-spinner {
88
+ display: inline-block;
89
+ width: 1rem;
90
+ height: 1rem;
91
+ border: 2px solid var(--rowakit-color-gray-200);
92
+ border-top-color: var(--rowakit-color-primary-500);
93
+ border-radius: 50%;
94
+ animation: rowakit-spin 0.6s linear infinite;
95
+ }
96
+
97
+ @keyframes rowakit-spin {
98
+ to { transform: rotate(360deg); }
99
+ }
100
+
101
+ /* ============================================================================
102
+ * ERROR STATE
103
+ * ============================================================================ */
104
+
105
+ .rowakit-table-error {
106
+ padding: var(--rowakit-spacing-2xl);
107
+ text-align: center;
108
+ }
109
+
110
+ .rowakit-table-error-message {
111
+ color: var(--rowakit-state-error-color);
112
+ background-color: var(--rowakit-state-error-bg);
113
+ padding: var(--rowakit-spacing-md) var(--rowakit-spacing-lg);
114
+ border-radius: var(--rowakit-border-radius);
115
+ margin-bottom: var(--rowakit-spacing-lg);
116
+ }
117
+
118
+ /* ============================================================================
119
+ * EMPTY STATE
120
+ * ============================================================================ */
121
+
122
+ .rowakit-table-empty {
123
+ padding: var(--rowakit-spacing-2xl);
124
+ text-align: center;
125
+ color: var(--rowakit-state-empty-color);
126
+ }
127
+
128
+ /* ============================================================================
129
+ * PAGINATION
130
+ * ============================================================================ */
131
+
132
+ .rowakit-table-pagination {
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: space-between;
136
+ padding: var(--rowakit-pagination-padding);
137
+ border-top: var(--rowakit-border-width) solid var(--rowakit-pagination-border-color);
138
+ background-color: var(--rowakit-pagination-bg);
139
+ gap: var(--rowakit-spacing-lg);
140
+ flex-wrap: wrap;
141
+ }
142
+
143
+ .rowakit-table-pagination-left,
144
+ .rowakit-table-pagination-right {
145
+ display: flex;
146
+ align-items: center;
147
+ gap: var(--rowakit-spacing-sm);
148
+ }
149
+
150
+ .rowakit-table-pagination-center {
151
+ font-size: var(--rowakit-font-size-sm);
152
+ color: var(--rowakit-color-gray-500);
153
+ }
154
+
155
+ .rowakit-table-pagination label {
156
+ font-size: var(--rowakit-font-size-sm);
157
+ color: var(--rowakit-color-gray-500);
158
+ }
159
+
160
+ .rowakit-table-pagination select {
161
+ padding: var(--rowakit-spacing-xs) var(--rowakit-spacing-sm);
162
+ border: var(--rowakit-border-width) solid var(--rowakit-color-gray-300);
163
+ border-radius: var(--rowakit-border-radius);
164
+ font-size: var(--rowakit-font-size-sm);
165
+ background-color: var(--rowakit-table-bg);
166
+ cursor: pointer;
167
+ transition: border-color 0.15s ease;
168
+ }
169
+
170
+ .rowakit-table-pagination select:hover {
171
+ border-color: var(--rowakit-color-gray-400);
172
+ }
173
+
174
+ .rowakit-table-pagination select:focus {
175
+ outline: 2px solid var(--rowakit-color-primary-500);
176
+ outline-offset: 1px;
177
+ border-color: var(--rowakit-color-primary-500);
178
+ }
179
+
180
+ .rowakit-table-pagination select:disabled {
181
+ opacity: 0.5;
182
+ cursor: not-allowed;
183
+ }
184
+
185
+ /* ============================================================================
186
+ * BUTTONS
187
+ * ============================================================================ */
188
+
189
+ .rowakit-button {
190
+ padding: var(--rowakit-button-padding-sm);
191
+ font-size: var(--rowakit-font-size-sm);
192
+ font-weight: var(--rowakit-font-weight-medium);
193
+ border: none;
194
+ border-radius: var(--rowakit-button-border-radius);
195
+ cursor: pointer;
196
+ transition: background-color 0.15s ease, opacity 0.15s ease;
197
+ white-space: nowrap;
198
+ }
199
+
200
+ .rowakit-button:focus {
201
+ outline: 2px solid var(--rowakit-color-primary-500);
202
+ outline-offset: 2px;
203
+ }
204
+
205
+ .rowakit-button-primary {
206
+ background-color: var(--rowakit-button-primary-bg);
207
+ color: var(--rowakit-button-primary-color);
208
+ }
209
+
210
+ .rowakit-button-primary:hover:not(:disabled) {
211
+ background-color: var(--rowakit-button-primary-hover-bg);
212
+ }
213
+
214
+ .rowakit-button-secondary {
215
+ background-color: var(--rowakit-button-secondary-bg);
216
+ color: var(--rowakit-button-secondary-color);
217
+ }
218
+
219
+ .rowakit-button-secondary:hover:not(:disabled) {
220
+ background-color: var(--rowakit-button-secondary-hover-bg);
221
+ }
222
+
223
+ .rowakit-button-danger {
224
+ background-color: var(--rowakit-button-danger-bg);
225
+ color: var(--rowakit-button-danger-color);
226
+ }
227
+
228
+ .rowakit-button-danger:hover:not(:disabled) {
229
+ background-color: var(--rowakit-button-danger-hover-bg);
230
+ }
231
+
232
+ .rowakit-button:disabled {
233
+ background-color: var(--rowakit-button-disabled-bg);
234
+ color: var(--rowakit-button-disabled-color);
235
+ cursor: not-allowed;
236
+ opacity: 0.5;
237
+ }
238
+
239
+ .rowakit-button-pagination {
240
+ padding: var(--rowakit-button-padding);
241
+ }
242
+
243
+ /* ============================================================================
244
+ * ACTION BUTTONS
245
+ * ============================================================================ */
246
+
247
+ .rowakit-table-actions {
248
+ display: flex;
249
+ gap: var(--rowakit-spacing-sm);
250
+ }
251
+
252
+ /* ============================================================================
253
+ * MODAL
254
+ * ============================================================================ */
255
+
256
+ .rowakit-modal-backdrop {
257
+ position: fixed;
258
+ top: 0;
259
+ left: 0;
260
+ right: 0;
261
+ bottom: 0;
262
+ background-color: var(--rowakit-modal-backdrop-bg);
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: center;
266
+ z-index: var(--rowakit-z-modal);
267
+ padding: var(--rowakit-spacing-lg);
268
+ }
269
+
270
+ .rowakit-modal {
271
+ background-color: var(--rowakit-modal-bg);
272
+ padding: var(--rowakit-modal-padding);
273
+ border-radius: var(--rowakit-modal-border-radius);
274
+ max-width: 400px;
275
+ width: 100%;
276
+ box-shadow: var(--rowakit-modal-shadow);
277
+ }
278
+
279
+ .rowakit-modal-title {
280
+ font-size: var(--rowakit-font-size-xl);
281
+ font-weight: var(--rowakit-font-weight-semibold);
282
+ margin-bottom: var(--rowakit-spacing-lg);
283
+ color: var(--rowakit-color-gray-900);
284
+ }
285
+
286
+ .rowakit-modal-content {
287
+ margin-bottom: var(--rowakit-spacing-xl);
288
+ color: var(--rowakit-color-gray-500);
289
+ font-size: var(--rowakit-font-size-sm);
290
+ }
291
+
292
+ .rowakit-modal-actions {
293
+ display: flex;
294
+ gap: var(--rowakit-spacing-md);
295
+ justify-content: flex-end;
296
+ }
297
+
298
+ /* ============================================================================
299
+ * RESPONSIVE
300
+ * ============================================================================ */
301
+
302
+ @media (max-width: 640px) {
303
+ .rowakit-table-pagination {
304
+ flex-direction: column;
305
+ align-items: stretch;
306
+ gap: var(--rowakit-spacing-md);
307
+ }
308
+
309
+ .rowakit-table-pagination-left,
310
+ .rowakit-table-pagination-center,
311
+ .rowakit-table-pagination-right {
312
+ justify-content: center;
313
+ }
314
+
315
+ .rowakit-modal {
316
+ max-width: 100%;
317
+ margin: var(--rowakit-spacing-lg);
318
+ }
319
+ }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * RowaKit Table Design Tokens
3
+ *
4
+ * CSS variables for customizing table appearance.
5
+ * Override these in your app to customize the theme.
6
+ */
7
+
8
+ :root {
9
+ /* ============================================================================
10
+ * COLORS
11
+ * ============================================================================ */
12
+
13
+ /* Neutral colors */
14
+ --rowakit-color-gray-50: #f9fafb;
15
+ --rowakit-color-gray-100: #f3f4f6;
16
+ --rowakit-color-gray-200: #e5e7eb;
17
+ --rowakit-color-gray-300: #d1d5db;
18
+ --rowakit-color-gray-400: #9ca3af;
19
+ --rowakit-color-gray-500: #6b7280;
20
+ --rowakit-color-gray-600: #4b5563;
21
+ --rowakit-color-gray-700: #374151;
22
+ --rowakit-color-gray-800: #1f2937;
23
+ --rowakit-color-gray-900: #111827;
24
+
25
+ /* Primary colors (blue) */
26
+ --rowakit-color-primary-50: #eff6ff;
27
+ --rowakit-color-primary-100: #dbeafe;
28
+ --rowakit-color-primary-200: #bfdbfe;
29
+ --rowakit-color-primary-300: #93c5fd;
30
+ --rowakit-color-primary-400: #60a5fa;
31
+ --rowakit-color-primary-500: #3b82f6;
32
+ --rowakit-color-primary-600: #2563eb;
33
+ --rowakit-color-primary-700: #1d4ed8;
34
+
35
+ /* Danger colors (red) */
36
+ --rowakit-color-danger-50: #fef2f2;
37
+ --rowakit-color-danger-100: #fee2e2;
38
+ --rowakit-color-danger-500: #ef4444;
39
+ --rowakit-color-danger-600: #dc2626;
40
+
41
+ /* Success colors (green) */
42
+ --rowakit-color-success-50: #f0fdf4;
43
+ --rowakit-color-success-500: #22c55e;
44
+
45
+ /* ============================================================================
46
+ * SPACING
47
+ * ============================================================================ */
48
+
49
+ --rowakit-spacing-xs: 0.25rem; /* 4px */
50
+ --rowakit-spacing-sm: 0.5rem; /* 8px */
51
+ --rowakit-spacing-md: 0.75rem; /* 12px */
52
+ --rowakit-spacing-lg: 1rem; /* 16px */
53
+ --rowakit-spacing-xl: 1.5rem; /* 24px */
54
+ --rowakit-spacing-2xl: 2rem; /* 32px */
55
+
56
+ /* ============================================================================
57
+ * TYPOGRAPHY
58
+ * ============================================================================ */
59
+
60
+ --rowakit-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
61
+
62
+ --rowakit-font-size-xs: 0.75rem; /* 12px */
63
+ --rowakit-font-size-sm: 0.875rem; /* 14px */
64
+ --rowakit-font-size-base: 1rem; /* 16px */
65
+ --rowakit-font-size-lg: 1.125rem; /* 18px */
66
+ --rowakit-font-size-xl: 1.25rem; /* 20px */
67
+
68
+ --rowakit-font-weight-normal: 400;
69
+ --rowakit-font-weight-medium: 500;
70
+ --rowakit-font-weight-semibold: 600;
71
+ --rowakit-font-weight-bold: 700;
72
+
73
+ --rowakit-line-height-tight: 1.25;
74
+ --rowakit-line-height-normal: 1.5;
75
+ --rowakit-line-height-relaxed: 1.75;
76
+
77
+ /* ============================================================================
78
+ * BORDERS
79
+ * ============================================================================ */
80
+
81
+ --rowakit-border-width: 1px;
82
+ --rowakit-border-width-thick: 2px;
83
+ --rowakit-border-radius-sm: 0.125rem; /* 2px */
84
+ --rowakit-border-radius: 0.25rem; /* 4px */
85
+ --rowakit-border-radius-md: 0.375rem; /* 6px */
86
+ --rowakit-border-radius-lg: 0.5rem; /* 8px */
87
+
88
+ /* ============================================================================
89
+ * SHADOWS
90
+ * ============================================================================ */
91
+
92
+ --rowakit-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
93
+ --rowakit-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
94
+ --rowakit-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
95
+ --rowakit-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
96
+ --rowakit-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
97
+
98
+ /* ============================================================================
99
+ * TABLE-SPECIFIC TOKENS
100
+ * ============================================================================ */
101
+
102
+ /* Table container */
103
+ --rowakit-table-bg: #ffffff;
104
+ --rowakit-table-border-color: var(--rowakit-color-gray-200);
105
+
106
+ /* Table header */
107
+ --rowakit-table-header-bg: var(--rowakit-table-bg);
108
+ --rowakit-table-header-color: var(--rowakit-color-gray-900);
109
+ --rowakit-table-header-font-weight: var(--rowakit-font-weight-semibold);
110
+ --rowakit-table-header-border-color: var(--rowakit-color-gray-200);
111
+ --rowakit-table-header-border-width: var(--rowakit-border-width-thick);
112
+ --rowakit-table-header-padding: var(--rowakit-spacing-md);
113
+
114
+ /* Table body */
115
+ --rowakit-table-body-bg: var(--rowakit-table-bg);
116
+ --rowakit-table-body-color: var(--rowakit-color-gray-900);
117
+ --rowakit-table-row-hover-bg: var(--rowakit-color-gray-50);
118
+ --rowakit-table-cell-padding: var(--rowakit-spacing-md);
119
+ --rowakit-table-cell-border-color: var(--rowakit-color-gray-200);
120
+
121
+ /* Pagination */
122
+ --rowakit-pagination-bg: var(--rowakit-table-bg);
123
+ --rowakit-pagination-border-color: var(--rowakit-color-gray-200);
124
+ --rowakit-pagination-padding: var(--rowakit-spacing-lg);
125
+
126
+ /* Buttons */
127
+ --rowakit-button-primary-bg: var(--rowakit-color-primary-500);
128
+ --rowakit-button-primary-color: #ffffff;
129
+ --rowakit-button-primary-hover-bg: var(--rowakit-color-primary-600);
130
+
131
+ --rowakit-button-secondary-bg: var(--rowakit-color-gray-100);
132
+ --rowakit-button-secondary-color: var(--rowakit-color-gray-700);
133
+ --rowakit-button-secondary-hover-bg: var(--rowakit-color-gray-200);
134
+
135
+ --rowakit-button-danger-bg: var(--rowakit-color-danger-500);
136
+ --rowakit-button-danger-color: #ffffff;
137
+ --rowakit-button-danger-hover-bg: var(--rowakit-color-danger-600);
138
+
139
+ --rowakit-button-disabled-bg: var(--rowakit-color-gray-200);
140
+ --rowakit-button-disabled-color: var(--rowakit-color-gray-400);
141
+
142
+ --rowakit-button-padding-sm: var(--rowakit-spacing-xs) var(--rowakit-spacing-sm);
143
+ --rowakit-button-padding: var(--rowakit-spacing-sm) var(--rowakit-spacing-lg);
144
+ --rowakit-button-border-radius: var(--rowakit-border-radius);
145
+
146
+ /* States */
147
+ --rowakit-state-loading-color: var(--rowakit-color-gray-500);
148
+ --rowakit-state-error-color: var(--rowakit-color-danger-500);
149
+ --rowakit-state-error-bg: var(--rowakit-color-danger-50);
150
+ --rowakit-state-empty-color: var(--rowakit-color-gray-500);
151
+
152
+ /* Modal */
153
+ --rowakit-modal-backdrop-bg: rgba(0, 0, 0, 0.5);
154
+ --rowakit-modal-bg: #ffffff;
155
+ --rowakit-modal-border-radius: var(--rowakit-border-radius-lg);
156
+ --rowakit-modal-shadow: var(--rowakit-shadow-xl);
157
+ --rowakit-modal-padding: var(--rowakit-spacing-xl);
158
+
159
+ /* Z-index */
160
+ --rowakit-z-modal: 1000;
161
+ --rowakit-z-dropdown: 100;
162
+ }
163
+
164
+ /* ============================================================================
165
+ * DARK MODE SUPPORT (Optional)
166
+ * ============================================================================ */
167
+
168
+ @media (prefers-color-scheme: dark) {
169
+ :root {
170
+ /* Override colors for dark mode if needed */
171
+ /* Uncomment and customize as needed:
172
+ --rowakit-table-bg: #1f2937;
173
+ --rowakit-table-header-color: #f9fafb;
174
+ --rowakit-table-body-color: #e5e7eb;
175
+ */
176
+ }
177
+ }