@vectara/vectara-ui 15.4.0 → 15.4.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/lib/components/table/_index.scss +22 -15
- package/lib/styles/index.css +19 -15
- package/package.json +1 -1
- package/src/docs/pages/table/Table.tsx +37 -11
|
@@ -7,6 +7,11 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
7
7
|
position: relative;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
// Enable nesting tables inside other tables as expandable content.
|
|
11
|
+
.vuiTableRowExpandedContent__cell > .vuiTableWrapper {
|
|
12
|
+
container-type: normal;
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
.vuiTableBlock {
|
|
11
16
|
background-color: rgba(var(--vui-color-empty-shade-rgb), 0.4);
|
|
12
17
|
height: 100%;
|
|
@@ -84,28 +89,30 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
84
89
|
display: flex;
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
// Direct descendent selectors enable non-responsive tables to
|
|
93
|
+
// be nested inside of responsive tables.
|
|
87
94
|
.vuiTable--responsive {
|
|
88
|
-
thead {
|
|
95
|
+
& > thead {
|
|
89
96
|
display: none;
|
|
90
97
|
}
|
|
91
98
|
|
|
92
|
-
.vuiTableRow--isSelectable {
|
|
99
|
+
& > tbody > .vuiTableRow--isSelectable {
|
|
93
100
|
padding-left: $sizeXxl;
|
|
94
101
|
}
|
|
95
102
|
|
|
96
|
-
.vuiTableRow--hasActions {
|
|
103
|
+
& > tbody > .vuiTableRow--hasActions {
|
|
97
104
|
padding-right: $sizeXxl;
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
// This enables truncated VuiText children to actually be truncated.
|
|
101
|
-
.vuiTableCell--truncate {
|
|
108
|
+
& > tbody > tr > .vuiTableCell--truncate {
|
|
102
109
|
min-width: 0;
|
|
103
110
|
overflow: hidden;
|
|
104
111
|
white-space: nowrap;
|
|
105
112
|
text-overflow: ellipsis;
|
|
106
113
|
}
|
|
107
114
|
|
|
108
|
-
tbody tr:not(.vuiTableRowExpandedContent) {
|
|
115
|
+
& > tbody > tr:not(.vuiTableRowExpandedContent) {
|
|
109
116
|
position: relative;
|
|
110
117
|
column-gap: $sizeM;
|
|
111
118
|
row-gap: $sizeM;
|
|
@@ -123,27 +130,27 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
123
130
|
border-radius: $sizeXs $sizeXs 0 0;
|
|
124
131
|
}
|
|
125
132
|
|
|
126
|
-
td {
|
|
133
|
+
& > td {
|
|
127
134
|
padding: 0;
|
|
128
135
|
}
|
|
129
136
|
|
|
130
|
-
.vuiTableCellWrapper {
|
|
137
|
+
& > td > .vuiTableCellWrapper {
|
|
131
138
|
display: flex;
|
|
132
139
|
flex-direction: column;
|
|
133
140
|
gap: $sizeXxs;
|
|
134
|
-
}
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
& > .vuiTableCell__label {
|
|
143
|
+
display: block;
|
|
144
|
+
}
|
|
138
145
|
}
|
|
139
146
|
|
|
140
|
-
.vuiTableRowSelect {
|
|
147
|
+
& > .vuiTableRowSelect {
|
|
141
148
|
position: absolute;
|
|
142
149
|
top: $sizeM;
|
|
143
150
|
left: $sizeXs;
|
|
144
151
|
}
|
|
145
152
|
|
|
146
|
-
.vuiTableRowActions {
|
|
153
|
+
& > .vuiTableRowActions {
|
|
147
154
|
position: absolute;
|
|
148
155
|
top: $sizeXs * 1.25;
|
|
149
156
|
right: $sizeXs;
|
|
@@ -157,13 +164,13 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
157
164
|
}
|
|
158
165
|
|
|
159
166
|
&.vuiTable--noActions {
|
|
160
|
-
tbody tr:not(.vuiTableRowExpandedContent) {
|
|
167
|
+
& > tbody tr:not(.vuiTableRowExpandedContent) {
|
|
161
168
|
padding-right: $sizeM;
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
|
|
165
172
|
// Expanded content in responsive mode
|
|
166
|
-
tbody tr.vuiTableRowExpandedContent {
|
|
173
|
+
& > tbody > tr.vuiTableRowExpandedContent {
|
|
167
174
|
display: block;
|
|
168
175
|
margin-bottom: $sizeS;
|
|
169
176
|
padding: $sizeL;
|
|
@@ -179,7 +186,7 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
179
186
|
|
|
180
187
|
@container (width < #{$tableResponsiveBreakpointSmall}) {
|
|
181
188
|
.vuiTable--responsive {
|
|
182
|
-
tbody tr:not(.vuiTableRowExpandedContent) {
|
|
189
|
+
& > tbody > tr:not(.vuiTableRowExpandedContent) {
|
|
183
190
|
grid-template-columns: 1fr;
|
|
184
191
|
}
|
|
185
192
|
}
|
package/lib/styles/index.css
CHANGED
|
@@ -5099,6 +5099,10 @@ h2.react-datepicker__current-month {
|
|
|
5099
5099
|
position: relative;
|
|
5100
5100
|
}
|
|
5101
5101
|
|
|
5102
|
+
.vuiTableRowExpandedContent__cell > .vuiTableWrapper {
|
|
5103
|
+
container-type: normal;
|
|
5104
|
+
}
|
|
5105
|
+
|
|
5102
5106
|
.vuiTableBlock {
|
|
5103
5107
|
background-color: rgba(var(--vui-color-empty-shade-rgb), 0.4);
|
|
5104
5108
|
height: 100%;
|
|
@@ -5166,22 +5170,22 @@ h2.react-datepicker__current-month {
|
|
|
5166
5170
|
.vuiTableHeader__responsiveSelectAllCheckbox {
|
|
5167
5171
|
display: flex;
|
|
5168
5172
|
}
|
|
5169
|
-
.vuiTable--responsive thead {
|
|
5173
|
+
.vuiTable--responsive > thead {
|
|
5170
5174
|
display: none;
|
|
5171
5175
|
}
|
|
5172
|
-
.vuiTable--responsive .vuiTableRow--isSelectable {
|
|
5176
|
+
.vuiTable--responsive > tbody > .vuiTableRow--isSelectable {
|
|
5173
5177
|
padding-left: 40px;
|
|
5174
5178
|
}
|
|
5175
|
-
.vuiTable--responsive .vuiTableRow--hasActions {
|
|
5179
|
+
.vuiTable--responsive > tbody > .vuiTableRow--hasActions {
|
|
5176
5180
|
padding-right: 40px;
|
|
5177
5181
|
}
|
|
5178
|
-
.vuiTable--responsive .vuiTableCell--truncate {
|
|
5182
|
+
.vuiTable--responsive > tbody > tr > .vuiTableCell--truncate {
|
|
5179
5183
|
min-width: 0;
|
|
5180
5184
|
overflow: hidden;
|
|
5181
5185
|
white-space: nowrap;
|
|
5182
5186
|
text-overflow: ellipsis;
|
|
5183
5187
|
}
|
|
5184
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5188
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) {
|
|
5185
5189
|
position: relative;
|
|
5186
5190
|
column-gap: 16px;
|
|
5187
5191
|
row-gap: 16px;
|
|
@@ -5194,27 +5198,27 @@ h2.react-datepicker__current-month {
|
|
|
5194
5198
|
box-shadow: rgba(50, 50, 93, 0.25) 0px 0 0 0, rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
5195
5199
|
margin-bottom: 12px;
|
|
5196
5200
|
}
|
|
5197
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent).vuiTableRow--expanded {
|
|
5201
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent).vuiTableRow--expanded {
|
|
5198
5202
|
margin-bottom: 0;
|
|
5199
5203
|
border-radius: 8px 8px 0 0;
|
|
5200
5204
|
}
|
|
5201
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) td {
|
|
5205
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > td {
|
|
5202
5206
|
padding: 0;
|
|
5203
5207
|
}
|
|
5204
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableCellWrapper {
|
|
5208
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > td > .vuiTableCellWrapper {
|
|
5205
5209
|
display: flex;
|
|
5206
5210
|
flex-direction: column;
|
|
5207
5211
|
gap: 4px;
|
|
5208
5212
|
}
|
|
5209
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableCell__label {
|
|
5213
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > td > .vuiTableCellWrapper > .vuiTableCell__label {
|
|
5210
5214
|
display: block;
|
|
5211
5215
|
}
|
|
5212
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableRowSelect {
|
|
5216
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > .vuiTableRowSelect {
|
|
5213
5217
|
position: absolute;
|
|
5214
5218
|
top: 16px;
|
|
5215
5219
|
left: 8px;
|
|
5216
5220
|
}
|
|
5217
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableRowActions {
|
|
5221
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > .vuiTableRowActions {
|
|
5218
5222
|
position: absolute;
|
|
5219
5223
|
top: 10px;
|
|
5220
5224
|
right: 8px;
|
|
@@ -5222,22 +5226,22 @@ h2.react-datepicker__current-month {
|
|
|
5222
5226
|
.vuiTable--responsive.vuiTable--notSelectable tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5223
5227
|
padding-left: 16px;
|
|
5224
5228
|
}
|
|
5225
|
-
.vuiTable--responsive.vuiTable--noActions tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5229
|
+
.vuiTable--responsive.vuiTable--noActions > tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5226
5230
|
padding-right: 16px;
|
|
5227
5231
|
}
|
|
5228
|
-
.vuiTable--responsive tbody tr.vuiTableRowExpandedContent {
|
|
5232
|
+
.vuiTable--responsive > tbody > tr.vuiTableRowExpandedContent {
|
|
5229
5233
|
display: block;
|
|
5230
5234
|
margin-bottom: 12px;
|
|
5231
5235
|
padding: 24px;
|
|
5232
5236
|
border-radius: 0 0 8px 8px;
|
|
5233
5237
|
box-shadow: rgba(50, 50, 93, 0.25) 0px 0 0 0, rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
5234
5238
|
}
|
|
5235
|
-
.vuiTable--responsive tbody tr.vuiTableRowExpandedContent .vuiTableRowExpandedContent__cell {
|
|
5239
|
+
.vuiTable--responsive > tbody > tr.vuiTableRowExpandedContent .vuiTableRowExpandedContent__cell {
|
|
5236
5240
|
padding: 0;
|
|
5237
5241
|
}
|
|
5238
5242
|
}
|
|
5239
5243
|
@container (width < 500px) {
|
|
5240
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5244
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) {
|
|
5241
5245
|
grid-template-columns: 1fr;
|
|
5242
5246
|
}
|
|
5243
5247
|
}
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ export const Table = () => {
|
|
|
32
32
|
const [isAlignTop, setIsAlignTop] = useState(false);
|
|
33
33
|
const [isHeaderSticky, setIsHeaderSticky] = useState(false);
|
|
34
34
|
const [isResponsive, setIsResponsive] = useState(true);
|
|
35
|
-
const [hasExpandableRows, setHasExpandableRows] = useState(
|
|
35
|
+
const [hasExpandableRows, setHasExpandableRows] = useState(true);
|
|
36
36
|
|
|
37
37
|
// Table state
|
|
38
38
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -431,16 +431,42 @@ export const Table = () => {
|
|
|
431
431
|
collapsedContent={
|
|
432
432
|
hasExpandableRows
|
|
433
433
|
? (person: Person) => (
|
|
434
|
-
<
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
434
|
+
<VuiTable
|
|
435
|
+
isResponsive={false}
|
|
436
|
+
idField="color"
|
|
437
|
+
rows={[
|
|
438
|
+
{
|
|
439
|
+
color: "red",
|
|
440
|
+
item: "apple"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
color: "orange",
|
|
444
|
+
item: "orange"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
color: "yellow",
|
|
448
|
+
item: "banana"
|
|
449
|
+
}
|
|
450
|
+
]}
|
|
451
|
+
columns={[
|
|
452
|
+
{
|
|
453
|
+
name: "color",
|
|
454
|
+
header: {
|
|
455
|
+
render: () => {
|
|
456
|
+
return "Color";
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
name: "item",
|
|
462
|
+
header: {
|
|
463
|
+
render: () => {
|
|
464
|
+
return "Item";
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
]}
|
|
469
|
+
/>
|
|
444
470
|
)
|
|
445
471
|
: undefined
|
|
446
472
|
}
|