@gitlab/ui 42.4.1 → 42.7.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/CHANGELOG.md +21 -0
- package/dist/components/base/drawer/drawer.js +5 -1
- package/dist/components/base/form/form_combobox/constants.js +39 -2
- package/dist/components/base/form/form_combobox/form_combobox.js +23 -3
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/drawer/drawer.scss +20 -0
- package/src/components/base/drawer/drawer.spec.js +1 -0
- package/src/components/base/drawer/drawer.stories.js +55 -13
- package/src/components/base/drawer/drawer.vue +10 -0
- package/src/components/base/form/form_combobox/constants.js +16 -1
- package/src/components/base/form/form_combobox/form_combobox.scss +1 -0
- package/src/components/base/form/form_combobox/form_combobox.spec.js +142 -95
- package/src/components/base/form/form_combobox/form_combobox.stories.js +42 -10
- package/src/components/base/form/form_combobox/form_combobox.vue +28 -9
- package/src/scss/utilities.scss +18 -0
- package/src/scss/utility-mixins/spacing.scss +12 -0
|
@@ -31,9 +31,19 @@ export default {
|
|
|
31
31
|
required: true,
|
|
32
32
|
},
|
|
33
33
|
value: {
|
|
34
|
-
type: String,
|
|
34
|
+
type: [String, Object],
|
|
35
35
|
required: true,
|
|
36
36
|
},
|
|
37
|
+
matchValueToAttr: {
|
|
38
|
+
type: String,
|
|
39
|
+
required: false,
|
|
40
|
+
default: undefined,
|
|
41
|
+
},
|
|
42
|
+
autofocus: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
required: false,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
37
47
|
},
|
|
38
48
|
data() {
|
|
39
49
|
return {
|
|
@@ -54,6 +64,11 @@ export default {
|
|
|
54
64
|
showSuggestions() {
|
|
55
65
|
return this.results.length > 0;
|
|
56
66
|
},
|
|
67
|
+
displayedValue() {
|
|
68
|
+
return this.matchValueToAttr && this.value[this.matchValueToAttr]
|
|
69
|
+
? this.value[this.matchValueToAttr]
|
|
70
|
+
: this.value;
|
|
71
|
+
},
|
|
57
72
|
},
|
|
58
73
|
mounted() {
|
|
59
74
|
document.addEventListener('click', this.handleClickOutside);
|
|
@@ -112,9 +127,12 @@ export default {
|
|
|
112
127
|
return;
|
|
113
128
|
}
|
|
114
129
|
|
|
115
|
-
const filteredTokens = this.tokenList.filter((token) =>
|
|
116
|
-
|
|
117
|
-
|
|
130
|
+
const filteredTokens = this.tokenList.filter((token) => {
|
|
131
|
+
if (this.matchValueToAttr) {
|
|
132
|
+
return token[this.matchValueToAttr].toLowerCase().includes(value.toLowerCase());
|
|
133
|
+
}
|
|
134
|
+
return token.toLowerCase().includes(value.toLowerCase());
|
|
135
|
+
});
|
|
118
136
|
|
|
119
137
|
if (filteredTokens.length) {
|
|
120
138
|
this.openSuggestions(filteredTokens);
|
|
@@ -147,13 +165,14 @@ export default {
|
|
|
147
165
|
<gl-form-group :label="labelText" :label-for="inputId" :label-sr-only="labelSrOnly">
|
|
148
166
|
<gl-form-input
|
|
149
167
|
:id="inputId"
|
|
150
|
-
:value="
|
|
168
|
+
:value="displayedValue"
|
|
151
169
|
type="text"
|
|
152
170
|
role="searchbox"
|
|
153
171
|
:autocomplete="showAutocomplete"
|
|
154
172
|
aria-autocomplete="list"
|
|
155
173
|
:aria-controls="suggestionsId"
|
|
156
174
|
aria-haspopup="listbox"
|
|
175
|
+
:autofocus="autofocus"
|
|
157
176
|
@input="onEntry"
|
|
158
177
|
@keydown.down="onArrowDown"
|
|
159
178
|
@keydown.up="onArrowUp"
|
|
@@ -163,11 +182,11 @@ export default {
|
|
|
163
182
|
/>
|
|
164
183
|
</gl-form-group>
|
|
165
184
|
|
|
166
|
-
<
|
|
185
|
+
<ul
|
|
167
186
|
v-show="showSuggestions && !userDismissedResults"
|
|
168
187
|
:id="suggestionsId"
|
|
169
188
|
data-testid="combobox-dropdown"
|
|
170
|
-
class="dropdown-menu dropdown-full-width"
|
|
189
|
+
class="dropdown-menu dropdown-full-width gl-list-style-none gl-pl-0 gl-mb-0 gl-overflow-y-auto"
|
|
171
190
|
:class="{ 'show-dropdown': showSuggestions }"
|
|
172
191
|
>
|
|
173
192
|
<gl-dropdown-item
|
|
@@ -179,8 +198,8 @@ export default {
|
|
|
179
198
|
tabindex="-1"
|
|
180
199
|
@click="selectToken(result)"
|
|
181
200
|
>
|
|
182
|
-
{{ result }}
|
|
201
|
+
<slot name="result" :item="result">{{ result }}</slot>
|
|
183
202
|
</gl-dropdown-item>
|
|
184
|
-
</
|
|
203
|
+
</ul>
|
|
185
204
|
</div>
|
|
186
205
|
</template>
|
package/src/scss/utilities.scss
CHANGED
|
@@ -5592,6 +5592,18 @@
|
|
|
5592
5592
|
.gl-mt-7\! {
|
|
5593
5593
|
margin-top: $gl-spacing-scale-7 !important;
|
|
5594
5594
|
}
|
|
5595
|
+
.gl-mt-8 {
|
|
5596
|
+
margin-top: $gl-spacing-scale-8;
|
|
5597
|
+
}
|
|
5598
|
+
.gl-mt-8\! {
|
|
5599
|
+
margin-top: $gl-spacing-scale-8 !important;
|
|
5600
|
+
}
|
|
5601
|
+
.gl-mt-9 {
|
|
5602
|
+
margin-top: $gl-spacing-scale-9;
|
|
5603
|
+
}
|
|
5604
|
+
.gl-mt-9\! {
|
|
5605
|
+
margin-top: $gl-spacing-scale-9 !important;
|
|
5606
|
+
}
|
|
5595
5607
|
.gl-mt-11 {
|
|
5596
5608
|
margin-top: $gl-spacing-scale-11;
|
|
5597
5609
|
}
|
|
@@ -5742,6 +5754,12 @@
|
|
|
5742
5754
|
.gl-mb-8\! {
|
|
5743
5755
|
margin-bottom: $gl-spacing-scale-8 !important;
|
|
5744
5756
|
}
|
|
5757
|
+
.gl-mb-9 {
|
|
5758
|
+
margin-bottom: $gl-spacing-scale-9;
|
|
5759
|
+
}
|
|
5760
|
+
.gl-mb-9\! {
|
|
5761
|
+
margin-bottom: $gl-spacing-scale-9 !important;
|
|
5762
|
+
}
|
|
5745
5763
|
.gl-ml-auto {
|
|
5746
5764
|
margin-left: auto;
|
|
5747
5765
|
}
|
|
@@ -418,6 +418,14 @@
|
|
|
418
418
|
margin-top: $gl-spacing-scale-7;
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
@mixin gl-mt-8 {
|
|
422
|
+
margin-top: $gl-spacing-scale-8;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
@mixin gl-mt-9 {
|
|
426
|
+
margin-top: $gl-spacing-scale-9;
|
|
427
|
+
}
|
|
428
|
+
|
|
421
429
|
@mixin gl-mt-11 {
|
|
422
430
|
margin-top: $gl-spacing-scale-11;
|
|
423
431
|
}
|
|
@@ -518,6 +526,10 @@
|
|
|
518
526
|
margin-bottom: $gl-spacing-scale-8;
|
|
519
527
|
}
|
|
520
528
|
|
|
529
|
+
@mixin gl-mb-9 {
|
|
530
|
+
margin-bottom: $gl-spacing-scale-9;
|
|
531
|
+
}
|
|
532
|
+
|
|
521
533
|
@mixin gl-ml-auto {
|
|
522
534
|
margin-left: auto;
|
|
523
535
|
}
|