@gitlab/ui 136.3.1 → 136.3.2
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/dist/components/base/collapse/collapse.js +3 -4
- package/dist/components/base/filtered_search/filtered_search.js +4 -5
- package/dist/components/base/filtered_search/filtered_search_token.js +8 -9
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +13 -14
- package/dist/components/base/form/form_checkbox/form_checkbox.js +14 -15
- package/dist/components/base/form/form_input/form_input.js +9 -11
- package/dist/components/base/form/form_radio/form_radio.js +14 -15
- package/dist/components/base/form/form_textarea/form_textarea.js +13 -16
- package/dist/components/base/infinite_scroll/infinite_scroll.js +17 -19
- package/dist/components/base/new_dropdowns/listbox/listbox.js +17 -19
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +6 -8
- package/dist/components/base/token_selector/token_selector.js +13 -15
- package/package.json +4 -4
- package/src/components/base/collapse/collapse.vue +3 -4
- package/src/components/base/filtered_search/filtered_search.vue +4 -5
- package/src/components/base/filtered_search/filtered_search_token.vue +8 -9
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +10 -11
- package/src/components/base/form/form_checkbox/form_checkbox.vue +14 -15
- package/src/components/base/form/form_input/form_input.vue +9 -11
- package/src/components/base/form/form_radio/form_radio.vue +14 -15
- package/src/components/base/form/form_textarea/form_textarea.vue +13 -16
- package/src/components/base/infinite_scroll/infinite_scroll.vue +16 -18
- package/src/components/base/new_dropdowns/listbox/listbox.vue +17 -19
- package/src/components/base/tabs/tabs/scrollable_tabs.vue +7 -9
- package/src/components/base/token_selector/token_selector.vue +12 -14
|
@@ -427,11 +427,10 @@ var script = {
|
|
|
427
427
|
this.activeTokenIdx = null;
|
|
428
428
|
}
|
|
429
429
|
},
|
|
430
|
-
onClear() {
|
|
431
|
-
this.$nextTick(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
});
|
|
430
|
+
async onClear() {
|
|
431
|
+
await this.$nextTick();
|
|
432
|
+
this.activeTokenIdx = this.lastTokenIdx;
|
|
433
|
+
this.$emit('clear');
|
|
435
434
|
},
|
|
436
435
|
submit() {
|
|
437
436
|
/**
|
|
@@ -245,20 +245,19 @@ var script = {
|
|
|
245
245
|
this.$emit('replace', createTerm(this.config.title));
|
|
246
246
|
}
|
|
247
247
|
},
|
|
248
|
-
replaceToken(newType) {
|
|
248
|
+
async replaceToken(newType) {
|
|
249
249
|
const newTokenConfig = this.availableTokens.find(_ref => {
|
|
250
250
|
let type = _ref.type;
|
|
251
251
|
return type === newType;
|
|
252
252
|
});
|
|
253
253
|
if (newTokenConfig === this.config) {
|
|
254
|
-
this.$nextTick(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
254
|
+
await this.$nextTick();
|
|
255
|
+
/**
|
|
256
|
+
* Emitted when this term token will lose its focus.
|
|
257
|
+
*
|
|
258
|
+
* @event deactivate
|
|
259
|
+
*/
|
|
260
|
+
this.$emit('deactivate');
|
|
262
261
|
return;
|
|
263
262
|
}
|
|
264
263
|
if (newTokenConfig) {
|
|
@@ -312,22 +312,21 @@ var script = {
|
|
|
312
312
|
loose = _ref2.loose;
|
|
313
313
|
return (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.find(option => loose ? match(option[this.optionTextField], inputValue) : option[this.optionTextField] === inputValue);
|
|
314
314
|
},
|
|
315
|
-
activate() {
|
|
315
|
+
async activate() {
|
|
316
316
|
this.fallbackValue = this.value;
|
|
317
|
-
this.$nextTick(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
317
|
+
await this.$nextTick();
|
|
318
|
+
const input = this.$refs.input;
|
|
319
|
+
if (input) {
|
|
320
|
+
input.focus();
|
|
321
|
+
input.scrollIntoView({
|
|
322
|
+
block: 'nearest',
|
|
323
|
+
inline: 'end'
|
|
324
|
+
});
|
|
325
|
+
this.alignSuggestions(input);
|
|
326
|
+
if (this.cursorPosition === 'start') {
|
|
327
|
+
input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 0);
|
|
329
328
|
}
|
|
330
|
-
}
|
|
329
|
+
}
|
|
331
330
|
},
|
|
332
331
|
deactivate() {
|
|
333
332
|
var _this$matchingOption;
|
|
@@ -221,7 +221,7 @@ var script = {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
|
-
handleChange(_ref) {
|
|
224
|
+
async handleChange(_ref) {
|
|
225
225
|
let _ref$target = _ref.target,
|
|
226
226
|
checked = _ref$target.checked,
|
|
227
227
|
indeterminate = _ref$target.indeterminate;
|
|
@@ -245,25 +245,24 @@ var script = {
|
|
|
245
245
|
this.computedLocalChecked = localChecked;
|
|
246
246
|
|
|
247
247
|
// Fire events in a `$nextTick()` to ensure the `v-model` is updated
|
|
248
|
-
this.$nextTick(
|
|
248
|
+
await this.$nextTick();
|
|
249
|
+
/**
|
|
250
|
+
* Emitted when selected value(s) is changed due to user interaction.
|
|
251
|
+
*
|
|
252
|
+
* @event change
|
|
253
|
+
*/
|
|
254
|
+
this.$emit('change', localChecked);
|
|
255
|
+
|
|
256
|
+
// If this is a child of a group, we emit a change event on it as well
|
|
257
|
+
if (this.isGroup) {
|
|
249
258
|
/**
|
|
250
259
|
* Emitted when selected value(s) is changed due to user interaction.
|
|
251
260
|
*
|
|
252
261
|
* @event change
|
|
253
262
|
*/
|
|
254
|
-
this.$emit('change', localChecked);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (this.isGroup) {
|
|
258
|
-
/**
|
|
259
|
-
* Emitted when selected value(s) is changed due to user interaction.
|
|
260
|
-
*
|
|
261
|
-
* @event change
|
|
262
|
-
*/
|
|
263
|
-
this.group.$emit('change', localChecked);
|
|
264
|
-
}
|
|
265
|
-
this.$emit('indeterminate', indeterminate);
|
|
266
|
-
});
|
|
263
|
+
this.group.$emit('change', localChecked);
|
|
264
|
+
}
|
|
265
|
+
this.$emit('indeterminate', indeterminate);
|
|
267
266
|
},
|
|
268
267
|
setIndeterminate(state) {
|
|
269
268
|
// Indeterminate only supported in single checkbox mode
|
|
@@ -429,14 +429,13 @@ var script = {
|
|
|
429
429
|
// Create private non-reactive props
|
|
430
430
|
this.$_inputDebounceTimer = null;
|
|
431
431
|
},
|
|
432
|
-
mounted() {
|
|
432
|
+
async mounted() {
|
|
433
433
|
this.setWheelStopper(this.noWheel);
|
|
434
434
|
this.handleAutofocus();
|
|
435
|
-
this.$nextTick(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
});
|
|
435
|
+
await this.$nextTick();
|
|
436
|
+
// Update DOM with auto-generated ID after mount
|
|
437
|
+
// to prevent SSR hydration errors
|
|
438
|
+
this.localId = uniqueId('gl-form-input-');
|
|
440
439
|
},
|
|
441
440
|
deactivated() {
|
|
442
441
|
// Turn off listeners when keep-alive component deactivated
|
|
@@ -600,11 +599,10 @@ var script = {
|
|
|
600
599
|
});
|
|
601
600
|
this.blur();
|
|
602
601
|
},
|
|
603
|
-
handleAutofocus() {
|
|
604
|
-
this.$nextTick(
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
});
|
|
602
|
+
async handleAutofocus() {
|
|
603
|
+
await this.$nextTick();
|
|
604
|
+
window.requestAnimationFrame(() => {
|
|
605
|
+
if (this.autofocus && isVisible(this.$refs.input)) this.focus();
|
|
608
606
|
});
|
|
609
607
|
},
|
|
610
608
|
select() {
|
|
@@ -173,33 +173,32 @@ var script = {
|
|
|
173
173
|
this.$emit('input', newValue);
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
|
-
handleChange() {
|
|
176
|
+
async handleChange() {
|
|
177
177
|
const value = this.value;
|
|
178
178
|
|
|
179
179
|
// Update `computedLocalChecked`
|
|
180
180
|
this.computedLocalChecked = value;
|
|
181
181
|
|
|
182
182
|
// Fire events in a `$nextTick()` to ensure the `v-model` is updated
|
|
183
|
-
this.$nextTick(
|
|
183
|
+
await this.$nextTick();
|
|
184
|
+
/**
|
|
185
|
+
* Emitted when the selected value is changed due to user interaction
|
|
186
|
+
*
|
|
187
|
+
* @event change
|
|
188
|
+
* @type {boolean} current selected value of radio group
|
|
189
|
+
*/
|
|
190
|
+
this.$emit('change', value);
|
|
191
|
+
|
|
192
|
+
// If this is a child of a group, we emit a change event on it as well
|
|
193
|
+
if (this.isGroup) {
|
|
184
194
|
/**
|
|
185
195
|
* Emitted when the selected value is changed due to user interaction
|
|
186
196
|
*
|
|
187
197
|
* @event change
|
|
188
198
|
* @type {boolean} current selected value of radio group
|
|
189
199
|
*/
|
|
190
|
-
this.$emit('change', value);
|
|
191
|
-
|
|
192
|
-
// If this is a child of a group, we emit a change event on it as well
|
|
193
|
-
if (this.isGroup) {
|
|
194
|
-
/**
|
|
195
|
-
* Emitted when the selected value is changed due to user interaction
|
|
196
|
-
*
|
|
197
|
-
* @event change
|
|
198
|
-
* @type {boolean} current selected value of radio group
|
|
199
|
-
*/
|
|
200
|
-
this.group.$emit('change', value);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
200
|
+
this.group.$emit('change', value);
|
|
201
|
+
}
|
|
203
202
|
},
|
|
204
203
|
focus() {
|
|
205
204
|
if (!this.disabled) {
|
|
@@ -309,11 +309,10 @@ var script = {
|
|
|
309
309
|
created() {
|
|
310
310
|
this.$_inputDebounceTimer = null;
|
|
311
311
|
},
|
|
312
|
-
mounted() {
|
|
312
|
+
async mounted() {
|
|
313
313
|
this.handleAutofocus();
|
|
314
|
-
this.$nextTick(
|
|
315
|
-
|
|
316
|
-
});
|
|
314
|
+
await this.$nextTick();
|
|
315
|
+
this.localId = uniqueId('gl-form-textarea-');
|
|
317
316
|
},
|
|
318
317
|
beforeDestroy() {
|
|
319
318
|
this.clearDebounce();
|
|
@@ -423,13 +422,12 @@ var script = {
|
|
|
423
422
|
*/
|
|
424
423
|
this.$emit('blur', event);
|
|
425
424
|
},
|
|
426
|
-
handleAutofocus() {
|
|
427
|
-
this.$nextTick(
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
});
|
|
425
|
+
async handleAutofocus() {
|
|
426
|
+
await this.$nextTick();
|
|
427
|
+
window.requestAnimationFrame(() => {
|
|
428
|
+
if (this.autofocus && isVisible(this.$refs.input)) {
|
|
429
|
+
this.focus();
|
|
430
|
+
}
|
|
433
431
|
});
|
|
434
432
|
},
|
|
435
433
|
handleKeyPress(e) {
|
|
@@ -442,11 +440,10 @@ var script = {
|
|
|
442
440
|
this.$emit('submit');
|
|
443
441
|
}
|
|
444
442
|
},
|
|
445
|
-
setHeight() {
|
|
446
|
-
this.$nextTick(
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
});
|
|
443
|
+
async setHeight() {
|
|
444
|
+
await this.$nextTick();
|
|
445
|
+
window.requestAnimationFrame(() => {
|
|
446
|
+
this.heightInPx = this.computeHeight();
|
|
450
447
|
});
|
|
451
448
|
},
|
|
452
449
|
computeHeight() {
|
|
@@ -49,7 +49,7 @@ var script = {
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
watch: {
|
|
52
|
-
fetchedItems(newVal, oldVal) {
|
|
52
|
+
async fetchedItems(newVal, oldVal) {
|
|
53
53
|
// Re-adjust scroll to the current item if more items are added
|
|
54
54
|
if (newVal > oldVal) {
|
|
55
55
|
const _this$$refs$infiniteC = this.$refs.infiniteContainer,
|
|
@@ -58,32 +58,30 @@ var script = {
|
|
|
58
58
|
// Only when scrolled to the top
|
|
59
59
|
if (scrollHeight !== 0 && scrollTop === 0) {
|
|
60
60
|
// Wait until the DOM is fully updated to adjust scroll
|
|
61
|
-
this.$nextTick(
|
|
62
|
-
|
|
61
|
+
await this.$nextTick();
|
|
62
|
+
const newScrollHeight = this.$refs.infiniteContainer.scrollHeight;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
// New scrollTop is the new height, minus the old height
|
|
65
|
+
// minus a small space to allow the user to trigger a scroll once more
|
|
66
|
+
let top = newScrollHeight - scrollHeight - adjustScrollGap;
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
68
|
+
// Never adjust to 0, or a new event may be be triggered
|
|
69
|
+
if (top < 1) {
|
|
70
|
+
top = 1;
|
|
71
|
+
}
|
|
72
|
+
this.scrollTo({
|
|
73
|
+
top
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
|
-
mounted() {
|
|
79
|
+
async mounted() {
|
|
81
80
|
// Scroll to bottom for reverse effect
|
|
82
|
-
this.$nextTick(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
81
|
+
await this.$nextTick();
|
|
82
|
+
if (this.$listeners.topReached && !this.$listeners.bottomReached) {
|
|
83
|
+
this.scrollDown();
|
|
84
|
+
}
|
|
87
85
|
},
|
|
88
86
|
methods: {
|
|
89
87
|
/**
|
|
@@ -569,22 +569,21 @@ var script = {
|
|
|
569
569
|
}
|
|
570
570
|
},
|
|
571
571
|
items: {
|
|
572
|
-
handler() {
|
|
573
|
-
this.$nextTick(
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
572
|
+
async handler() {
|
|
573
|
+
await this.$nextTick();
|
|
574
|
+
/* Every time the list of items changes (on search),
|
|
575
|
+
* the observed elements are recreated, thus we need to start obesrving them again */
|
|
576
|
+
this.observeScroll();
|
|
577
577
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
});
|
|
578
|
+
/**
|
|
579
|
+
* Every time the list of items changes, and there is a search string,
|
|
580
|
+
* we want to visually highlight the first enabled item
|
|
581
|
+
*/
|
|
582
|
+
if (this.searchHasOptions) {
|
|
583
|
+
this.nextFocusedItemIndex = this.getFirstEnabledIndex();
|
|
584
|
+
} else {
|
|
585
|
+
this.nextFocusedItemIndex = null;
|
|
586
|
+
}
|
|
588
587
|
}
|
|
589
588
|
},
|
|
590
589
|
...(process.env.NODE_ENV !== 'production' ? {
|
|
@@ -774,7 +773,7 @@ var script = {
|
|
|
774
773
|
const nextIndex = clamp(currentIndex + offset, 0, elements.length - 1);
|
|
775
774
|
this.focusItem(nextIndex, elements);
|
|
776
775
|
},
|
|
777
|
-
focusItem(index, elements) {
|
|
776
|
+
async focusItem(index, elements) {
|
|
778
777
|
let keepSearchFocused = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
779
778
|
this.nextFocusedItemIndex = index;
|
|
780
779
|
|
|
@@ -791,9 +790,8 @@ var script = {
|
|
|
791
790
|
var _elements$index;
|
|
792
791
|
(_elements$index = elements[index]) === null || _elements$index === void 0 ? void 0 : _elements$index.focus();
|
|
793
792
|
}
|
|
794
|
-
this.$nextTick(
|
|
795
|
-
|
|
796
|
-
});
|
|
793
|
+
await this.$nextTick();
|
|
794
|
+
this.scrollActiveItemIntoView();
|
|
797
795
|
},
|
|
798
796
|
focusSearchInput() {
|
|
799
797
|
this.$refs.searchBox.focusInput();
|
|
@@ -68,23 +68,21 @@ var script = {
|
|
|
68
68
|
}), {});
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
mounted() {
|
|
72
|
-
this.$nextTick(() => {
|
|
73
|
-
this.navScrollWidth = this.getScrollWidth();
|
|
74
|
-
});
|
|
71
|
+
async mounted() {
|
|
75
72
|
this.handleNavScroll = debounce(e => {
|
|
76
73
|
this.scrollLeft = e.target.scrollLeft;
|
|
77
74
|
}, 100);
|
|
78
75
|
this.getNavContainer().addEventListener('scroll', this.handleNavScroll);
|
|
76
|
+
await this.$nextTick();
|
|
77
|
+
this.navScrollWidth = this.getScrollWidth();
|
|
79
78
|
},
|
|
80
79
|
beforeDestroy() {
|
|
81
80
|
this.getNavContainer().removeEventListener('scroll', this.handleNavScroll);
|
|
82
81
|
},
|
|
83
|
-
updated() {
|
|
82
|
+
async updated() {
|
|
84
83
|
// Whenever tabs are added or removed we need to recalculate the reactive scrollWidth
|
|
85
|
-
this.$nextTick(
|
|
86
|
-
|
|
87
|
-
});
|
|
84
|
+
await this.$nextTick();
|
|
85
|
+
this.navScrollWidth = this.getScrollWidth();
|
|
88
86
|
},
|
|
89
87
|
methods: {
|
|
90
88
|
handleResize(_ref) {
|
|
@@ -216,7 +216,7 @@ var script = {
|
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
watch: {
|
|
219
|
-
inputText(newValue, oldValue) {
|
|
219
|
+
async inputText(newValue, oldValue) {
|
|
220
220
|
if (newValue !== oldValue) {
|
|
221
221
|
/**
|
|
222
222
|
* Fired when user types in the token selector
|
|
@@ -234,13 +234,12 @@ var script = {
|
|
|
234
234
|
// Wait a tick so `text-input` event can be used to validate
|
|
235
235
|
// the value and change the `allowUserDefinedTokens` and/or
|
|
236
236
|
// `hideDropdownWithNoItems` props
|
|
237
|
-
this.$nextTick(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
237
|
+
await this.$nextTick();
|
|
238
|
+
if (this.hideDropdown) {
|
|
239
|
+
this.closeDropdown();
|
|
240
|
+
} else if (newValue !== '') {
|
|
241
|
+
this.openDropdown();
|
|
242
|
+
}
|
|
244
243
|
}
|
|
245
244
|
}
|
|
246
245
|
},
|
|
@@ -272,7 +271,8 @@ var script = {
|
|
|
272
271
|
this.triggerTokenFocusNextBackspace = true;
|
|
273
272
|
}
|
|
274
273
|
},
|
|
275
|
-
handleBlur(event) {
|
|
274
|
+
async handleBlur(event) {
|
|
275
|
+
var _event$relatedTarget, _event$relatedTarget$;
|
|
276
276
|
/**
|
|
277
277
|
* Fired when the token selector is blurred
|
|
278
278
|
*
|
|
@@ -285,12 +285,10 @@ var script = {
|
|
|
285
285
|
// Workaround is to:
|
|
286
286
|
// 1. Explicitly focus the dropdown menu item button on `mousedown` event. (see './token_selector_dropdown.vue')
|
|
287
287
|
// 2. Use `nextTick` so `blur` event is fired after the `mousedown` event
|
|
288
|
-
this.$nextTick(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
});
|
|
288
|
+
await this.$nextTick();
|
|
289
|
+
if (!((_event$relatedTarget = event.relatedTarget) !== null && _event$relatedTarget !== void 0 && (_event$relatedTarget$ = _event$relatedTarget.closest) !== null && _event$relatedTarget$ !== void 0 && _event$relatedTarget$.call(_event$relatedTarget, '.dropdown-item'))) {
|
|
290
|
+
this.closeDropdown();
|
|
291
|
+
}
|
|
294
292
|
},
|
|
295
293
|
handleEnter() {
|
|
296
294
|
if (this.focusedDropdownItem && this.dropdownIsOpen) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "136.3.
|
|
3
|
+
"version": "136.3.2",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"autoprefixer": "10.5.4",
|
|
141
141
|
"axe-playwright": "^2.2.2",
|
|
142
142
|
"babel-loader": "^9.2.1",
|
|
143
|
-
"cypress": "15.
|
|
143
|
+
"cypress": "15.21.0",
|
|
144
144
|
"cypress-real-events": "^1.15.0",
|
|
145
145
|
"dompurify": "^3.1.2",
|
|
146
146
|
"emoji-regex": "^10.6.0",
|
|
@@ -169,13 +169,13 @@
|
|
|
169
169
|
"rollup-plugin-string": "^3.0.0",
|
|
170
170
|
"rollup-plugin-svg": "^2.0.0",
|
|
171
171
|
"rollup-plugin-vue": "^5.1.9",
|
|
172
|
-
"sass": "^1.
|
|
172
|
+
"sass": "^1.103.1",
|
|
173
173
|
"sass-loader": "^10.5.2",
|
|
174
174
|
"sass-true": "^9",
|
|
175
175
|
"start-server-and-test": "^2.1.5",
|
|
176
176
|
"storybook": "^7.6.24",
|
|
177
177
|
"storybook-dark-mode": "4.0.2",
|
|
178
|
-
"style-dictionary": "^5.5.
|
|
178
|
+
"style-dictionary": "^5.5.2",
|
|
179
179
|
"style-loader": "^4",
|
|
180
180
|
"tailwindcss": "3.4.19",
|
|
181
181
|
"vue": "2.7.16",
|
|
@@ -402,11 +402,10 @@ export default {
|
|
|
402
402
|
}
|
|
403
403
|
},
|
|
404
404
|
|
|
405
|
-
onClear() {
|
|
406
|
-
this.$nextTick(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
});
|
|
405
|
+
async onClear() {
|
|
406
|
+
await this.$nextTick();
|
|
407
|
+
this.activeTokenIdx = this.lastTokenIdx;
|
|
408
|
+
this.$emit('clear');
|
|
410
409
|
},
|
|
411
410
|
|
|
412
411
|
submit() {
|
|
@@ -247,18 +247,17 @@ export default {
|
|
|
247
247
|
}
|
|
248
248
|
},
|
|
249
249
|
|
|
250
|
-
replaceToken(newType) {
|
|
250
|
+
async replaceToken(newType) {
|
|
251
251
|
const newTokenConfig = this.availableTokens.find(({ type }) => type === newType);
|
|
252
252
|
|
|
253
253
|
if (newTokenConfig === this.config) {
|
|
254
|
-
this.$nextTick(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
});
|
|
254
|
+
await this.$nextTick();
|
|
255
|
+
/**
|
|
256
|
+
* Emitted when this term token will lose its focus.
|
|
257
|
+
*
|
|
258
|
+
* @event deactivate
|
|
259
|
+
*/
|
|
260
|
+
this.$emit('deactivate');
|
|
262
261
|
return;
|
|
263
262
|
}
|
|
264
263
|
|
|
@@ -316,20 +316,19 @@ export default {
|
|
|
316
316
|
);
|
|
317
317
|
},
|
|
318
318
|
|
|
319
|
-
activate() {
|
|
319
|
+
async activate() {
|
|
320
320
|
this.fallbackValue = this.value;
|
|
321
321
|
|
|
322
|
-
this.$nextTick(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
322
|
+
await this.$nextTick();
|
|
323
|
+
const { input } = this.$refs;
|
|
324
|
+
if (input) {
|
|
325
|
+
input.focus();
|
|
326
|
+
input.scrollIntoView({ block: 'nearest', inline: 'end' });
|
|
327
|
+
this.alignSuggestions(input);
|
|
328
|
+
if (this.cursorPosition === 'start') {
|
|
329
|
+
input?.setSelectionRange(0, 0);
|
|
331
330
|
}
|
|
332
|
-
}
|
|
331
|
+
}
|
|
333
332
|
},
|
|
334
333
|
|
|
335
334
|
deactivate() {
|
|
@@ -221,7 +221,7 @@ export default {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
},
|
|
224
|
-
handleChange({ target: { checked, indeterminate } }) {
|
|
224
|
+
async handleChange({ target: { checked, indeterminate } }) {
|
|
225
225
|
const { value, uncheckedValue } = this;
|
|
226
226
|
|
|
227
227
|
// Update `computedLocalChecked`
|
|
@@ -241,26 +241,25 @@ export default {
|
|
|
241
241
|
this.computedLocalChecked = localChecked;
|
|
242
242
|
|
|
243
243
|
// Fire events in a `$nextTick()` to ensure the `v-model` is updated
|
|
244
|
-
this.$nextTick(
|
|
244
|
+
await this.$nextTick();
|
|
245
|
+
/**
|
|
246
|
+
* Emitted when selected value(s) is changed due to user interaction.
|
|
247
|
+
*
|
|
248
|
+
* @event change
|
|
249
|
+
*/
|
|
250
|
+
this.$emit('change', localChecked);
|
|
251
|
+
|
|
252
|
+
// If this is a child of a group, we emit a change event on it as well
|
|
253
|
+
if (this.isGroup) {
|
|
245
254
|
/**
|
|
246
255
|
* Emitted when selected value(s) is changed due to user interaction.
|
|
247
256
|
*
|
|
248
257
|
* @event change
|
|
249
258
|
*/
|
|
250
|
-
this.$emit('change', localChecked);
|
|
251
|
-
|
|
252
|
-
// If this is a child of a group, we emit a change event on it as well
|
|
253
|
-
if (this.isGroup) {
|
|
254
|
-
/**
|
|
255
|
-
* Emitted when selected value(s) is changed due to user interaction.
|
|
256
|
-
*
|
|
257
|
-
* @event change
|
|
258
|
-
*/
|
|
259
|
-
this.group.$emit('change', localChecked);
|
|
260
|
-
}
|
|
259
|
+
this.group.$emit('change', localChecked);
|
|
260
|
+
}
|
|
261
261
|
|
|
262
|
-
|
|
263
|
-
});
|
|
262
|
+
this.$emit('indeterminate', indeterminate);
|
|
264
263
|
},
|
|
265
264
|
setIndeterminate(state) {
|
|
266
265
|
// Indeterminate only supported in single checkbox mode
|
|
@@ -373,14 +373,13 @@ export default {
|
|
|
373
373
|
// Create private non-reactive props
|
|
374
374
|
this.$_inputDebounceTimer = null;
|
|
375
375
|
},
|
|
376
|
-
mounted() {
|
|
376
|
+
async mounted() {
|
|
377
377
|
this.setWheelStopper(this.noWheel);
|
|
378
378
|
this.handleAutofocus();
|
|
379
|
-
this.$nextTick(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
});
|
|
379
|
+
await this.$nextTick();
|
|
380
|
+
// Update DOM with auto-generated ID after mount
|
|
381
|
+
// to prevent SSR hydration errors
|
|
382
|
+
this.localId = uniqueId('gl-form-input-');
|
|
384
383
|
},
|
|
385
384
|
deactivated() {
|
|
386
385
|
// Turn off listeners when keep-alive component deactivated
|
|
@@ -534,11 +533,10 @@ export default {
|
|
|
534
533
|
stopEvent(event, { propagation: false });
|
|
535
534
|
this.blur();
|
|
536
535
|
},
|
|
537
|
-
handleAutofocus() {
|
|
538
|
-
this.$nextTick(
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
});
|
|
536
|
+
async handleAutofocus() {
|
|
537
|
+
await this.$nextTick();
|
|
538
|
+
window.requestAnimationFrame(() => {
|
|
539
|
+
if (this.autofocus && isVisible(this.$refs.input)) this.focus();
|
|
542
540
|
});
|
|
543
541
|
},
|
|
544
542
|
select(...args) {
|
|
@@ -171,33 +171,32 @@ export default {
|
|
|
171
171
|
this.$emit('input', newValue);
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
|
-
handleChange() {
|
|
174
|
+
async handleChange() {
|
|
175
175
|
const { value } = this;
|
|
176
176
|
|
|
177
177
|
// Update `computedLocalChecked`
|
|
178
178
|
this.computedLocalChecked = value;
|
|
179
179
|
|
|
180
180
|
// Fire events in a `$nextTick()` to ensure the `v-model` is updated
|
|
181
|
-
this.$nextTick(
|
|
181
|
+
await this.$nextTick();
|
|
182
|
+
/**
|
|
183
|
+
* Emitted when the selected value is changed due to user interaction
|
|
184
|
+
*
|
|
185
|
+
* @event change
|
|
186
|
+
* @type {boolean} current selected value of radio group
|
|
187
|
+
*/
|
|
188
|
+
this.$emit('change', value);
|
|
189
|
+
|
|
190
|
+
// If this is a child of a group, we emit a change event on it as well
|
|
191
|
+
if (this.isGroup) {
|
|
182
192
|
/**
|
|
183
193
|
* Emitted when the selected value is changed due to user interaction
|
|
184
194
|
*
|
|
185
195
|
* @event change
|
|
186
196
|
* @type {boolean} current selected value of radio group
|
|
187
197
|
*/
|
|
188
|
-
this.$emit('change', value);
|
|
189
|
-
|
|
190
|
-
// If this is a child of a group, we emit a change event on it as well
|
|
191
|
-
if (this.isGroup) {
|
|
192
|
-
/**
|
|
193
|
-
* Emitted when the selected value is changed due to user interaction
|
|
194
|
-
*
|
|
195
|
-
* @event change
|
|
196
|
-
* @type {boolean} current selected value of radio group
|
|
197
|
-
*/
|
|
198
|
-
this.group.$emit('change', value);
|
|
199
|
-
}
|
|
200
|
-
});
|
|
198
|
+
this.group.$emit('change', value);
|
|
199
|
+
}
|
|
201
200
|
},
|
|
202
201
|
focus() {
|
|
203
202
|
if (!this.disabled) {
|
|
@@ -315,11 +315,10 @@ export default {
|
|
|
315
315
|
created() {
|
|
316
316
|
this.$_inputDebounceTimer = null;
|
|
317
317
|
},
|
|
318
|
-
mounted() {
|
|
318
|
+
async mounted() {
|
|
319
319
|
this.handleAutofocus();
|
|
320
|
-
this.$nextTick(
|
|
321
|
-
|
|
322
|
-
});
|
|
320
|
+
await this.$nextTick();
|
|
321
|
+
this.localId = uniqueId('gl-form-textarea-');
|
|
323
322
|
},
|
|
324
323
|
beforeDestroy() {
|
|
325
324
|
this.clearDebounce();
|
|
@@ -424,13 +423,12 @@ export default {
|
|
|
424
423
|
*/
|
|
425
424
|
this.$emit('blur', event);
|
|
426
425
|
},
|
|
427
|
-
handleAutofocus() {
|
|
428
|
-
this.$nextTick(
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
});
|
|
426
|
+
async handleAutofocus() {
|
|
427
|
+
await this.$nextTick();
|
|
428
|
+
window.requestAnimationFrame(() => {
|
|
429
|
+
if (this.autofocus && isVisible(this.$refs.input)) {
|
|
430
|
+
this.focus();
|
|
431
|
+
}
|
|
434
432
|
});
|
|
435
433
|
},
|
|
436
434
|
handleKeyPress(e) {
|
|
@@ -443,11 +441,10 @@ export default {
|
|
|
443
441
|
this.$emit('submit');
|
|
444
442
|
}
|
|
445
443
|
},
|
|
446
|
-
setHeight() {
|
|
447
|
-
this.$nextTick(
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
});
|
|
444
|
+
async setHeight() {
|
|
445
|
+
await this.$nextTick();
|
|
446
|
+
window.requestAnimationFrame(() => {
|
|
447
|
+
this.heightInPx = this.computeHeight();
|
|
451
448
|
});
|
|
452
449
|
},
|
|
453
450
|
computeHeight() {
|
|
@@ -51,39 +51,37 @@ export default {
|
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
watch: {
|
|
54
|
-
fetchedItems(newVal, oldVal) {
|
|
54
|
+
async fetchedItems(newVal, oldVal) {
|
|
55
55
|
// Re-adjust scroll to the current item if more items are added
|
|
56
56
|
if (newVal > oldVal) {
|
|
57
57
|
const { scrollHeight, scrollTop } = this.$refs.infiniteContainer;
|
|
58
58
|
// Only when scrolled to the top
|
|
59
59
|
if (scrollHeight !== 0 && scrollTop === 0) {
|
|
60
60
|
// Wait until the DOM is fully updated to adjust scroll
|
|
61
|
-
this.$nextTick(
|
|
62
|
-
|
|
61
|
+
await this.$nextTick();
|
|
62
|
+
const { scrollHeight: newScrollHeight } = this.$refs.infiniteContainer;
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
// New scrollTop is the new height, minus the old height
|
|
65
|
+
// minus a small space to allow the user to trigger a scroll once more
|
|
66
|
+
let top = newScrollHeight - scrollHeight - adjustScrollGap;
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
// Never adjust to 0, or a new event may be be triggered
|
|
69
|
+
if (top < 1) {
|
|
70
|
+
top = 1;
|
|
71
|
+
}
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
});
|
|
73
|
+
this.scrollTo({ top });
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
},
|
|
78
77
|
},
|
|
79
78
|
|
|
80
|
-
mounted() {
|
|
79
|
+
async mounted() {
|
|
81
80
|
// Scroll to bottom for reverse effect
|
|
82
|
-
this.$nextTick(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
81
|
+
await this.$nextTick();
|
|
82
|
+
if (this.$listeners.topReached && !this.$listeners.bottomReached) {
|
|
83
|
+
this.scrollDown();
|
|
84
|
+
}
|
|
87
85
|
},
|
|
88
86
|
|
|
89
87
|
methods: {
|
|
@@ -610,22 +610,21 @@ export default {
|
|
|
610
610
|
},
|
|
611
611
|
},
|
|
612
612
|
items: {
|
|
613
|
-
handler() {
|
|
614
|
-
this.$nextTick(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
613
|
+
async handler() {
|
|
614
|
+
await this.$nextTick();
|
|
615
|
+
/* Every time the list of items changes (on search),
|
|
616
|
+
* the observed elements are recreated, thus we need to start obesrving them again */
|
|
617
|
+
this.observeScroll();
|
|
618
618
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
});
|
|
619
|
+
/**
|
|
620
|
+
* Every time the list of items changes, and there is a search string,
|
|
621
|
+
* we want to visually highlight the first enabled item
|
|
622
|
+
*/
|
|
623
|
+
if (this.searchHasOptions) {
|
|
624
|
+
this.nextFocusedItemIndex = this.getFirstEnabledIndex();
|
|
625
|
+
} else {
|
|
626
|
+
this.nextFocusedItemIndex = null;
|
|
627
|
+
}
|
|
629
628
|
},
|
|
630
629
|
},
|
|
631
630
|
...(process.env.NODE_ENV !== 'production'
|
|
@@ -831,7 +830,7 @@ export default {
|
|
|
831
830
|
|
|
832
831
|
this.focusItem(nextIndex, elements);
|
|
833
832
|
},
|
|
834
|
-
focusItem(index, elements, keepSearchFocused = false) {
|
|
833
|
+
async focusItem(index, elements, keepSearchFocused = false) {
|
|
835
834
|
this.nextFocusedItemIndex = index;
|
|
836
835
|
|
|
837
836
|
// Always update the activeItemId when focus changes
|
|
@@ -847,9 +846,8 @@ export default {
|
|
|
847
846
|
elements[index]?.focus();
|
|
848
847
|
}
|
|
849
848
|
|
|
850
|
-
this.$nextTick(
|
|
851
|
-
|
|
852
|
-
});
|
|
849
|
+
await this.$nextTick();
|
|
850
|
+
this.scrollActiveItemIntoView();
|
|
853
851
|
},
|
|
854
852
|
focusSearchInput() {
|
|
855
853
|
this.$refs.searchBox.focusInput();
|
|
@@ -72,25 +72,23 @@ export default {
|
|
|
72
72
|
.reduce((acc, key) => Object.assign(acc, { [key]: this.$attrs[key] }), {});
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
|
-
mounted() {
|
|
76
|
-
this.$nextTick(() => {
|
|
77
|
-
this.navScrollWidth = this.getScrollWidth();
|
|
78
|
-
});
|
|
79
|
-
|
|
75
|
+
async mounted() {
|
|
80
76
|
this.handleNavScroll = debounce((e) => {
|
|
81
77
|
this.scrollLeft = e.target.scrollLeft;
|
|
82
78
|
}, 100);
|
|
83
79
|
|
|
84
80
|
this.getNavContainer().addEventListener('scroll', this.handleNavScroll);
|
|
81
|
+
|
|
82
|
+
await this.$nextTick();
|
|
83
|
+
this.navScrollWidth = this.getScrollWidth();
|
|
85
84
|
},
|
|
86
85
|
beforeDestroy() {
|
|
87
86
|
this.getNavContainer().removeEventListener('scroll', this.handleNavScroll);
|
|
88
87
|
},
|
|
89
|
-
updated() {
|
|
88
|
+
async updated() {
|
|
90
89
|
// Whenever tabs are added or removed we need to recalculate the reactive scrollWidth
|
|
91
|
-
this.$nextTick(
|
|
92
|
-
|
|
93
|
-
});
|
|
90
|
+
await this.$nextTick();
|
|
91
|
+
this.navScrollWidth = this.getScrollWidth();
|
|
94
92
|
},
|
|
95
93
|
methods: {
|
|
96
94
|
handleResize({ contentRect: { width } }) {
|
|
@@ -222,7 +222,7 @@ export default {
|
|
|
222
222
|
},
|
|
223
223
|
},
|
|
224
224
|
watch: {
|
|
225
|
-
inputText(newValue, oldValue) {
|
|
225
|
+
async inputText(newValue, oldValue) {
|
|
226
226
|
if (newValue !== oldValue) {
|
|
227
227
|
/**
|
|
228
228
|
* Fired when user types in the token selector
|
|
@@ -242,13 +242,12 @@ export default {
|
|
|
242
242
|
// Wait a tick so `text-input` event can be used to validate
|
|
243
243
|
// the value and change the `allowUserDefinedTokens` and/or
|
|
244
244
|
// `hideDropdownWithNoItems` props
|
|
245
|
-
this.$nextTick(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
245
|
+
await this.$nextTick();
|
|
246
|
+
if (this.hideDropdown) {
|
|
247
|
+
this.closeDropdown();
|
|
248
|
+
} else if (newValue !== '') {
|
|
249
|
+
this.openDropdown();
|
|
250
|
+
}
|
|
252
251
|
}
|
|
253
252
|
},
|
|
254
253
|
},
|
|
@@ -286,7 +285,7 @@ export default {
|
|
|
286
285
|
this.triggerTokenFocusNextBackspace = true;
|
|
287
286
|
}
|
|
288
287
|
},
|
|
289
|
-
handleBlur(event) {
|
|
288
|
+
async handleBlur(event) {
|
|
290
289
|
/**
|
|
291
290
|
* Fired when the token selector is blurred
|
|
292
291
|
*
|
|
@@ -300,11 +299,10 @@ export default {
|
|
|
300
299
|
// Workaround is to:
|
|
301
300
|
// 1. Explicitly focus the dropdown menu item button on `mousedown` event. (see './token_selector_dropdown.vue')
|
|
302
301
|
// 2. Use `nextTick` so `blur` event is fired after the `mousedown` event
|
|
303
|
-
this.$nextTick(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
});
|
|
302
|
+
await this.$nextTick();
|
|
303
|
+
if (!event.relatedTarget?.closest?.('.dropdown-item')) {
|
|
304
|
+
this.closeDropdown();
|
|
305
|
+
}
|
|
308
306
|
},
|
|
309
307
|
handleEnter() {
|
|
310
308
|
if (this.focusedDropdownItem && this.dropdownIsOpen) {
|