@gitlab/ui 129.3.1 → 129.4.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/dist/components/base/alert/alert.js +15 -1
- package/dist/components/base/token_selector/token_selector.js +14 -3
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/alert/alert.vue +16 -0
- package/src/components/base/progress_bar/progress_bar.scss +1 -1
- package/src/components/base/token_selector/token_selector.vue +18 -3
|
@@ -12,6 +12,7 @@ var script = {
|
|
|
12
12
|
CloseButton,
|
|
13
13
|
GlButton
|
|
14
14
|
},
|
|
15
|
+
expose: ['focus'],
|
|
15
16
|
props: {
|
|
16
17
|
/**
|
|
17
18
|
* The title text to display in the alert header.
|
|
@@ -116,6 +117,11 @@ var script = {
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
},
|
|
120
|
+
data() {
|
|
121
|
+
return {
|
|
122
|
+
hasProgrammaticFocus: false
|
|
123
|
+
};
|
|
124
|
+
},
|
|
119
125
|
computed: {
|
|
120
126
|
headingComponent() {
|
|
121
127
|
return `h${this.headerLevel}`;
|
|
@@ -175,6 +181,13 @@ var script = {
|
|
|
175
181
|
}
|
|
176
182
|
},
|
|
177
183
|
methods: {
|
|
184
|
+
/**
|
|
185
|
+
* Focus the alert.
|
|
186
|
+
*/
|
|
187
|
+
focus() {
|
|
188
|
+
this.$el.focus();
|
|
189
|
+
this.hasProgrammaticFocus = true;
|
|
190
|
+
},
|
|
178
191
|
primaryButtonClicked(event) {
|
|
179
192
|
/**
|
|
180
193
|
* Emitted when the primary action button is clicked.
|
|
@@ -214,7 +227,8 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
214
227
|
{ 'gl-alert-sticky': _vm.sticky },
|
|
215
228
|
{ 'gl-alert-not-dismissible': !_vm.dismissible },
|
|
216
229
|
{ 'gl-alert-has-title': !!_vm.title },
|
|
217
|
-
|
|
230
|
+
{ 'gl-focus': _vm.hasProgrammaticFocus },
|
|
231
|
+
_vm.variantClass ],attrs:{"role":_vm.role,"aria-live":_vm.politeness,"tabindex":"-1"},on:{"blur":function($event){_vm.hasProgrammaticFocus = false;}}},[_c('div',{staticClass:"gl-alert-icon-container"},[_c('gl-icon',{staticClass:"gl-alert-icon",attrs:{"name":_vm.iconName}})],1),_vm._v(" "),_c('div',{staticClass:"gl-alert-content"},[(_vm.title)?_c(_vm.headingComponent,{tag:"component",staticClass:"gl-alert-title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-body"},[_vm._t("default")],2),_vm._v(" "),(_vm.shouldRenderActions)?_c('div',{staticClass:"gl-alert-actions"},[_vm._t("actions",function(){return _vm._l((_vm.actionButtons),function(actionButton,index){return _c('gl-button',_vm._g(_vm._b({key:index,staticClass:"gl-alert-action"},'gl-button',actionButton.attrs,false),actionButton.listeners),[_vm._v("\n "+_vm._s(actionButton.text)+"\n ")])})})],2):_vm._e()],1),_vm._v(" "),(_vm.dismissible)?_c('close-button',{ref:"dismiss",staticClass:"gl-dismiss-btn",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.onDismiss}}):_vm._e()],1)};
|
|
218
232
|
var __vue_staticRenderFns__ = [];
|
|
219
233
|
|
|
220
234
|
/* style */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { uniqueId } from 'lodash-es';
|
|
2
|
+
import { logWarning } from '../../../utils/utils';
|
|
2
3
|
import { tokensValidator } from './helpers';
|
|
3
4
|
import GlTokenContainer from './token_container';
|
|
4
5
|
import GlTokenSelectorDropdown from './token_selector_dropdown';
|
|
@@ -34,7 +35,7 @@ var script = {
|
|
|
34
35
|
default: false
|
|
35
36
|
},
|
|
36
37
|
/**
|
|
37
|
-
* Shows
|
|
38
|
+
* Shows "Add new token option" in dropdown even if results are present. Requires `allowUserDefinedTokens` to be `true`.
|
|
38
39
|
*/
|
|
39
40
|
showAddNewAlways: {
|
|
40
41
|
type: Boolean,
|
|
@@ -83,7 +84,7 @@ var script = {
|
|
|
83
84
|
},
|
|
84
85
|
/**
|
|
85
86
|
* The `aria-label` attribute value for the underlying `input` element.
|
|
86
|
-
* Input must have an aria-label or aria-labelledby prop or it will be inaccessible.
|
|
87
|
+
* Input must have an `aria-label` or `aria-labelledby` prop or it will be inaccessible.
|
|
87
88
|
*
|
|
88
89
|
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label
|
|
89
90
|
*/
|
|
@@ -112,7 +113,8 @@ var script = {
|
|
|
112
113
|
default: null
|
|
113
114
|
},
|
|
114
115
|
/**
|
|
115
|
-
* HTML attributes to add to the text input. Helpful for adding `data-testid` attributes
|
|
116
|
+
* HTML attributes to add to the text input. Helpful for adding `data-testid` and similar attributes.
|
|
117
|
+
* Do not pass `aria-label` or `aria-labelledby` into this object. Use `ariaLabel` or `ariaLabelledby` prop instead.
|
|
116
118
|
*/
|
|
117
119
|
textInputAttrs: {
|
|
118
120
|
type: Object,
|
|
@@ -246,6 +248,15 @@ var script = {
|
|
|
246
248
|
// Each instance must have a unique ID for proper ARIA relationships
|
|
247
249
|
this.uniqueId = uniqueId('token-selector-');
|
|
248
250
|
},
|
|
251
|
+
mounted() {
|
|
252
|
+
var _this$textInputAttrs;
|
|
253
|
+
const hasLabel = this.ariaLabel || ((_this$textInputAttrs = this.textInputAttrs) === null || _this$textInputAttrs === void 0 ? void 0 : _this$textInputAttrs['aria-label']) || this.ariaLabelledby;
|
|
254
|
+
if (!hasLabel) {
|
|
255
|
+
logWarning('The text input needs an accessible label. ' + 'Provide an `id` and a sibling `<label>` with a `for` attribute. Or add an `aria-labelledby` or `aria-label` prop to ensure the component is accessible. ' + 'See https://design.gitlab.com/components/token/#accessibility', {
|
|
256
|
+
name: 'GlTokenSelector'
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
},
|
|
249
260
|
methods: {
|
|
250
261
|
handleFocus(event) {
|
|
251
262
|
/**
|