@fragments-sdk/ui 0.7.0 → 0.7.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.
package/package.json
CHANGED
|
@@ -111,6 +111,16 @@ export default defineSegment({
|
|
|
111
111
|
values: ['sm', 'md'],
|
|
112
112
|
default: 'md',
|
|
113
113
|
},
|
|
114
|
+
striped: {
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
description: 'Show alternating row backgrounds',
|
|
117
|
+
default: 'false',
|
|
118
|
+
},
|
|
119
|
+
bordered: {
|
|
120
|
+
type: 'boolean',
|
|
121
|
+
description: 'Wrap table in a bordered container',
|
|
122
|
+
default: 'false',
|
|
123
|
+
},
|
|
114
124
|
},
|
|
115
125
|
|
|
116
126
|
relations: [
|
|
@@ -125,6 +135,8 @@ export default defineSegment({
|
|
|
125
135
|
'sortable: boolean - enable sorting',
|
|
126
136
|
'selectable: boolean - enable row selection',
|
|
127
137
|
'size: sm|md - table density',
|
|
138
|
+
'striped: boolean - alternating row backgrounds',
|
|
139
|
+
'bordered: boolean - bordered container',
|
|
128
140
|
],
|
|
129
141
|
scenarioTags: [
|
|
130
142
|
'data.table',
|
|
@@ -185,6 +197,28 @@ export default defineSegment({
|
|
|
185
197
|
/>
|
|
186
198
|
),
|
|
187
199
|
},
|
|
200
|
+
{
|
|
201
|
+
name: 'Striped',
|
|
202
|
+
description: 'Table with alternating row backgrounds',
|
|
203
|
+
render: () => (
|
|
204
|
+
<Table
|
|
205
|
+
columns={columns}
|
|
206
|
+
data={sampleUsers}
|
|
207
|
+
striped
|
|
208
|
+
/>
|
|
209
|
+
),
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'Bordered',
|
|
213
|
+
description: 'Table with bordered container',
|
|
214
|
+
render: () => (
|
|
215
|
+
<Table
|
|
216
|
+
columns={columns}
|
|
217
|
+
data={sampleUsers}
|
|
218
|
+
bordered
|
|
219
|
+
/>
|
|
220
|
+
),
|
|
221
|
+
},
|
|
188
222
|
{
|
|
189
223
|
name: 'Empty State',
|
|
190
224
|
description: 'Table with no data',
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
.sm {
|
|
34
34
|
.th,
|
|
35
35
|
.td {
|
|
36
|
-
padding: var(--fui-space-
|
|
36
|
+
padding: var(--fui-space-1, $fui-space-1) var(--fui-space-3, $fui-space-3);
|
|
37
37
|
font-size: var(--fui-font-size-xs, $fui-font-size-xs);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
.md {
|
|
42
42
|
.th,
|
|
43
43
|
.td {
|
|
44
|
-
padding: var(--fui-space-
|
|
44
|
+
padding: var(--fui-space-2, $fui-space-2) var(--fui-space-3, $fui-space-3);
|
|
45
45
|
font-size: var(--fui-font-size-sm, $fui-font-size-sm);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
position: sticky;
|
|
52
52
|
top: 0;
|
|
53
53
|
z-index: 1;
|
|
54
|
-
background-color: var(--fui-bg-
|
|
54
|
+
background-color: var(--fui-bg-tertiary, $fui-bg-tertiary);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.headerRow {
|
|
@@ -138,7 +138,6 @@
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
.selected {
|
|
141
|
-
background-color: var(--fui-color-accent, $fui-color-accent);
|
|
142
141
|
background-color: rgba($fui-color-accent, 0.08);
|
|
143
142
|
|
|
144
143
|
&:hover {
|
|
@@ -152,6 +151,37 @@
|
|
|
152
151
|
line-height: var(--fui-line-height-normal, $fui-line-height-normal);
|
|
153
152
|
}
|
|
154
153
|
|
|
154
|
+
// Striped rows
|
|
155
|
+
.striped {
|
|
156
|
+
.row:nth-child(even) {
|
|
157
|
+
background-color: var(--fui-bg-subtle, $fui-bg-subtle);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Hover and selected override stripe
|
|
161
|
+
.clickable:hover {
|
|
162
|
+
background-color: var(--fui-bg-hover, $fui-bg-hover);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.clickable:active {
|
|
166
|
+
background-color: var(--fui-bg-active, $fui-bg-active);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.selected {
|
|
170
|
+
background-color: rgba($fui-color-accent, 0.08);
|
|
171
|
+
|
|
172
|
+
&:hover {
|
|
173
|
+
background-color: rgba($fui-color-accent, 0.12);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Bordered
|
|
179
|
+
.bordered {
|
|
180
|
+
border: 1px solid var(--fui-border, $fui-border);
|
|
181
|
+
border-radius: var(--fui-radius-md, $fui-radius-md);
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
}
|
|
184
|
+
|
|
155
185
|
// Empty state
|
|
156
186
|
.emptyState {
|
|
157
187
|
display: flex;
|
|
@@ -167,7 +197,7 @@
|
|
|
167
197
|
}
|
|
168
198
|
|
|
169
199
|
// Responsive: allow horizontal scroll on small screens
|
|
170
|
-
@
|
|
200
|
+
@include below-sm {
|
|
171
201
|
.wrapper {
|
|
172
202
|
margin-left: calc(-1 * var(--fui-space-4, $fui-space-4));
|
|
173
203
|
margin-right: calc(-1 * var(--fui-space-4, $fui-space-4));
|
|
@@ -45,6 +45,10 @@ export interface TableProps<T> extends Omit<React.HTMLAttributes<HTMLTableElemen
|
|
|
45
45
|
caption?: string;
|
|
46
46
|
/** Hide the caption visually but keep it for screen readers */
|
|
47
47
|
captionHidden?: boolean;
|
|
48
|
+
/** Show alternating row backgrounds */
|
|
49
|
+
striped?: boolean;
|
|
50
|
+
/** Wrap table in a bordered container */
|
|
51
|
+
bordered?: boolean;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
export function Table<T>({
|
|
@@ -63,6 +67,8 @@ export function Table<T>({
|
|
|
63
67
|
className,
|
|
64
68
|
caption,
|
|
65
69
|
captionHidden = false,
|
|
70
|
+
striped = false,
|
|
71
|
+
bordered = false,
|
|
66
72
|
'aria-label': ariaLabel,
|
|
67
73
|
'aria-describedby': ariaDescribedBy,
|
|
68
74
|
...htmlProps
|
|
@@ -95,7 +101,7 @@ export function Table<T>({
|
|
|
95
101
|
|
|
96
102
|
const isEmpty = data.length === 0;
|
|
97
103
|
|
|
98
|
-
const rootClasses = [styles.table, styles[size], className]
|
|
104
|
+
const rootClasses = [styles.table, styles[size], striped && styles.striped, className]
|
|
99
105
|
.filter(Boolean)
|
|
100
106
|
.join(' ');
|
|
101
107
|
|
|
@@ -119,7 +125,7 @@ export function Table<T>({
|
|
|
119
125
|
};
|
|
120
126
|
|
|
121
127
|
return (
|
|
122
|
-
<div className={styles.wrapper}>
|
|
128
|
+
<div className={[styles.wrapper, bordered && styles.bordered].filter(Boolean).join(' ')}>
|
|
123
129
|
<table
|
|
124
130
|
{...htmlProps}
|
|
125
131
|
className={rootClasses}
|