@vectara/vectara-ui 15.4.0 → 15.5.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.
- package/lib/components/form/select/Select.d.ts +1 -1
- package/lib/components/form/select/Select.js +2 -1
- package/lib/components/form/select/_index.scss +13 -1
- package/lib/components/table/_index.scss +22 -15
- package/lib/styles/index.css +29 -16
- package/package.json +1 -1
- package/src/docs/pages/select/Select.tsx +33 -3
- package/src/docs/pages/table/Table.tsx +37 -11
|
@@ -15,8 +15,9 @@ import classNames from "classnames";
|
|
|
15
15
|
import { VuiIcon } from "../../icon/Icon";
|
|
16
16
|
import { BiCaretDown } from "react-icons/bi";
|
|
17
17
|
import { forwardRef } from "react";
|
|
18
|
-
const SIZE = ["m", "l"];
|
|
18
|
+
const SIZE = ["s", "m", "l"];
|
|
19
19
|
const sizeToIconSizeMap = {
|
|
20
|
+
s: "s",
|
|
20
21
|
m: "m",
|
|
21
22
|
l: "l"
|
|
22
23
|
};
|
|
@@ -21,11 +21,23 @@
|
|
|
21
21
|
right: 12px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
.vuiSelect--s {
|
|
25
|
+
select {
|
|
26
|
+
padding: $sizeXxs $sizeS;
|
|
27
|
+
font-size: $fontSizeSmall;
|
|
28
|
+
padding-right: 36px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.vuiSelect__caret {
|
|
32
|
+
top: calc(50% - 8px);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
.vuiSelect--m {
|
|
25
37
|
select {
|
|
26
38
|
padding: $sizeXs $sizeM;
|
|
27
39
|
font-size: $fontSizeStandard;
|
|
28
|
-
padding-right:
|
|
40
|
+
padding-right: 40px;
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
.vuiSelect__caret {
|
|
@@ -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
|
@@ -2849,10 +2849,19 @@ h2.react-datepicker__current-month {
|
|
|
2849
2849
|
right: 12px;
|
|
2850
2850
|
}
|
|
2851
2851
|
|
|
2852
|
+
.vuiSelect--s select {
|
|
2853
|
+
padding: 4px 12px;
|
|
2854
|
+
font-size: 12px;
|
|
2855
|
+
padding-right: 36px;
|
|
2856
|
+
}
|
|
2857
|
+
.vuiSelect--s .vuiSelect__caret {
|
|
2858
|
+
top: calc(50% - 8px);
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2852
2861
|
.vuiSelect--m select {
|
|
2853
2862
|
padding: 8px 16px;
|
|
2854
2863
|
font-size: 14px;
|
|
2855
|
-
padding-right:
|
|
2864
|
+
padding-right: 40px;
|
|
2856
2865
|
}
|
|
2857
2866
|
.vuiSelect--m .vuiSelect__caret {
|
|
2858
2867
|
top: calc(50% - 10px);
|
|
@@ -5099,6 +5108,10 @@ h2.react-datepicker__current-month {
|
|
|
5099
5108
|
position: relative;
|
|
5100
5109
|
}
|
|
5101
5110
|
|
|
5111
|
+
.vuiTableRowExpandedContent__cell > .vuiTableWrapper {
|
|
5112
|
+
container-type: normal;
|
|
5113
|
+
}
|
|
5114
|
+
|
|
5102
5115
|
.vuiTableBlock {
|
|
5103
5116
|
background-color: rgba(var(--vui-color-empty-shade-rgb), 0.4);
|
|
5104
5117
|
height: 100%;
|
|
@@ -5166,22 +5179,22 @@ h2.react-datepicker__current-month {
|
|
|
5166
5179
|
.vuiTableHeader__responsiveSelectAllCheckbox {
|
|
5167
5180
|
display: flex;
|
|
5168
5181
|
}
|
|
5169
|
-
.vuiTable--responsive thead {
|
|
5182
|
+
.vuiTable--responsive > thead {
|
|
5170
5183
|
display: none;
|
|
5171
5184
|
}
|
|
5172
|
-
.vuiTable--responsive .vuiTableRow--isSelectable {
|
|
5185
|
+
.vuiTable--responsive > tbody > .vuiTableRow--isSelectable {
|
|
5173
5186
|
padding-left: 40px;
|
|
5174
5187
|
}
|
|
5175
|
-
.vuiTable--responsive .vuiTableRow--hasActions {
|
|
5188
|
+
.vuiTable--responsive > tbody > .vuiTableRow--hasActions {
|
|
5176
5189
|
padding-right: 40px;
|
|
5177
5190
|
}
|
|
5178
|
-
.vuiTable--responsive .vuiTableCell--truncate {
|
|
5191
|
+
.vuiTable--responsive > tbody > tr > .vuiTableCell--truncate {
|
|
5179
5192
|
min-width: 0;
|
|
5180
5193
|
overflow: hidden;
|
|
5181
5194
|
white-space: nowrap;
|
|
5182
5195
|
text-overflow: ellipsis;
|
|
5183
5196
|
}
|
|
5184
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5197
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) {
|
|
5185
5198
|
position: relative;
|
|
5186
5199
|
column-gap: 16px;
|
|
5187
5200
|
row-gap: 16px;
|
|
@@ -5194,27 +5207,27 @@ h2.react-datepicker__current-month {
|
|
|
5194
5207
|
box-shadow: rgba(50, 50, 93, 0.25) 0px 0 0 0, rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
5195
5208
|
margin-bottom: 12px;
|
|
5196
5209
|
}
|
|
5197
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent).vuiTableRow--expanded {
|
|
5210
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent).vuiTableRow--expanded {
|
|
5198
5211
|
margin-bottom: 0;
|
|
5199
5212
|
border-radius: 8px 8px 0 0;
|
|
5200
5213
|
}
|
|
5201
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) td {
|
|
5214
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > td {
|
|
5202
5215
|
padding: 0;
|
|
5203
5216
|
}
|
|
5204
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableCellWrapper {
|
|
5217
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > td > .vuiTableCellWrapper {
|
|
5205
5218
|
display: flex;
|
|
5206
5219
|
flex-direction: column;
|
|
5207
5220
|
gap: 4px;
|
|
5208
5221
|
}
|
|
5209
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableCell__label {
|
|
5222
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > td > .vuiTableCellWrapper > .vuiTableCell__label {
|
|
5210
5223
|
display: block;
|
|
5211
5224
|
}
|
|
5212
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableRowSelect {
|
|
5225
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > .vuiTableRowSelect {
|
|
5213
5226
|
position: absolute;
|
|
5214
5227
|
top: 16px;
|
|
5215
5228
|
left: 8px;
|
|
5216
5229
|
}
|
|
5217
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) .vuiTableRowActions {
|
|
5230
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) > .vuiTableRowActions {
|
|
5218
5231
|
position: absolute;
|
|
5219
5232
|
top: 10px;
|
|
5220
5233
|
right: 8px;
|
|
@@ -5222,22 +5235,22 @@ h2.react-datepicker__current-month {
|
|
|
5222
5235
|
.vuiTable--responsive.vuiTable--notSelectable tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5223
5236
|
padding-left: 16px;
|
|
5224
5237
|
}
|
|
5225
|
-
.vuiTable--responsive.vuiTable--noActions tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5238
|
+
.vuiTable--responsive.vuiTable--noActions > tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5226
5239
|
padding-right: 16px;
|
|
5227
5240
|
}
|
|
5228
|
-
.vuiTable--responsive tbody tr.vuiTableRowExpandedContent {
|
|
5241
|
+
.vuiTable--responsive > tbody > tr.vuiTableRowExpandedContent {
|
|
5229
5242
|
display: block;
|
|
5230
5243
|
margin-bottom: 12px;
|
|
5231
5244
|
padding: 24px;
|
|
5232
5245
|
border-radius: 0 0 8px 8px;
|
|
5233
5246
|
box-shadow: rgba(50, 50, 93, 0.25) 0px 0 0 0, rgba(0, 0, 0, 0.16) 0px 1px 4px;
|
|
5234
5247
|
}
|
|
5235
|
-
.vuiTable--responsive tbody tr.vuiTableRowExpandedContent .vuiTableRowExpandedContent__cell {
|
|
5248
|
+
.vuiTable--responsive > tbody > tr.vuiTableRowExpandedContent .vuiTableRowExpandedContent__cell {
|
|
5236
5249
|
padding: 0;
|
|
5237
5250
|
}
|
|
5238
5251
|
}
|
|
5239
5252
|
@container (width < 500px) {
|
|
5240
|
-
.vuiTable--responsive tbody tr:not(.vuiTableRowExpandedContent) {
|
|
5253
|
+
.vuiTable--responsive > tbody > tr:not(.vuiTableRowExpandedContent) {
|
|
5241
5254
|
grid-template-columns: 1fr;
|
|
5242
5255
|
}
|
|
5243
5256
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import { VuiSelect } from "../../../lib";
|
|
2
|
+
import { VuiSelect, VuiSpacer } from "../../../lib";
|
|
3
3
|
|
|
4
4
|
const options = [
|
|
5
|
+
{ text: "Johann Baptist Christophorus Apollinaris von Albertini", value: "albertini" },
|
|
5
6
|
{ text: "David Brin", value: "brin" },
|
|
6
7
|
{ text: "Cormac McCarthy", value: "mccarthy" },
|
|
7
8
|
{ text: "Bret Easton Ellis", value: "ellis" }
|
|
8
9
|
];
|
|
9
10
|
|
|
10
11
|
export const Select = () => {
|
|
11
|
-
const [value, setValue] = useState("
|
|
12
|
+
const [value, setValue] = useState("albertini");
|
|
13
|
+
|
|
12
14
|
return (
|
|
13
|
-
|
|
15
|
+
<>
|
|
16
|
+
<VuiSelect
|
|
17
|
+
id="optionsList1"
|
|
18
|
+
size="s"
|
|
19
|
+
options={options}
|
|
20
|
+
value={value}
|
|
21
|
+
onChange={(event) => setValue(event.target.value)}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<VuiSpacer size="m" />
|
|
25
|
+
|
|
26
|
+
<VuiSelect
|
|
27
|
+
id="optionsList2"
|
|
28
|
+
size="m"
|
|
29
|
+
options={options}
|
|
30
|
+
value={value}
|
|
31
|
+
onChange={(event) => setValue(event.target.value)}
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<VuiSpacer size="m" />
|
|
35
|
+
|
|
36
|
+
<VuiSelect
|
|
37
|
+
id="optionsList3"
|
|
38
|
+
size="l"
|
|
39
|
+
options={options}
|
|
40
|
+
value={value}
|
|
41
|
+
onChange={(event) => setValue(event.target.value)}
|
|
42
|
+
/>
|
|
43
|
+
</>
|
|
14
44
|
);
|
|
15
45
|
};
|
|
@@ -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
|
}
|