@gitlab/ui 138.1.0 → 138.2.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/sorting/sorting.js +27 -5
- package/dist/components/base/toggle/toggle.js +24 -1
- package/dist/components/charts/chart/chart.js +22 -0
- package/dist/config.js +14 -2
- package/package.json +1 -1
- package/src/components/base/sorting/sorting.vue +29 -4
- package/src/components/base/toggle/toggle.vue +25 -2
- package/src/components/charts/chart/chart.vue +18 -0
- package/src/config.js +16 -1
- package/translations.js +2 -2
|
@@ -97,6 +97,15 @@ var script = {
|
|
|
97
97
|
type: Boolean,
|
|
98
98
|
required: false,
|
|
99
99
|
default: true
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Disables the entire sorting control (both the sort-by dropdown and the
|
|
103
|
+
* sort direction toggle) while keeping it visible.
|
|
104
|
+
*/
|
|
105
|
+
disabled: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
required: false,
|
|
108
|
+
default: false
|
|
100
109
|
}
|
|
101
110
|
},
|
|
102
111
|
data() {
|
|
@@ -106,7 +115,13 @@ var script = {
|
|
|
106
115
|
};
|
|
107
116
|
},
|
|
108
117
|
computed: {
|
|
118
|
+
unavailableLabel() {
|
|
119
|
+
return translate('GlSorting.sortingUnavailable', 'Sorting is unavailable');
|
|
120
|
+
},
|
|
109
121
|
sortingListboxLabel() {
|
|
122
|
+
if (this.disabled) {
|
|
123
|
+
return this.unavailableLabel;
|
|
124
|
+
}
|
|
110
125
|
return translate('GlSorting.sortByLabel', 'Sort by:');
|
|
111
126
|
},
|
|
112
127
|
localSortDirection() {
|
|
@@ -121,18 +136,23 @@ var script = {
|
|
|
121
136
|
},
|
|
122
137
|
isDirectionToggleDisabled() {
|
|
123
138
|
var _this$selectedSortOpt3;
|
|
124
|
-
return Boolean((_this$selectedSortOpt3 = this.selectedSortOption) === null || _this$selectedSortOpt3 === void 0 ? void 0 : _this$selectedSortOpt3.directionToggleDisabled);
|
|
139
|
+
return this.disabled || Boolean((_this$selectedSortOpt3 = this.selectedSortOption) === null || _this$selectedSortOpt3 === void 0 ? void 0 : _this$selectedSortOpt3.directionToggleDisabled);
|
|
125
140
|
},
|
|
126
141
|
sortDirectionText() {
|
|
127
|
-
if (this.sortDirectionToolTip) return this.sortDirectionToolTip;
|
|
142
|
+
if (this.sortDirectionToolTip && !this.disabled) return this.sortDirectionToolTip;
|
|
128
143
|
if (this.isDirectionToggleDisabled) {
|
|
129
|
-
return this.selectedSortText ? translate('GlSorting.sortDirectionUnavailableFor', '
|
|
144
|
+
return this.selectedSortText ? translate('GlSorting.sortDirectionUnavailableFor', 'Sorting is unavailable for %{sortField}', {
|
|
130
145
|
sortField: this.selectedSortText
|
|
131
|
-
}) :
|
|
146
|
+
}) : this.unavailableLabel;
|
|
132
147
|
}
|
|
133
148
|
return this.isAscending ? translate('GlSorting.sortAscending', 'Sort direction: ascending') : translate('GlSorting.sortDescending', 'Sort direction: descending');
|
|
134
149
|
}
|
|
135
150
|
},
|
|
151
|
+
watch: {
|
|
152
|
+
disabled(isDisabled) {
|
|
153
|
+
if (isDisabled) this.$refs.listbox.close();
|
|
154
|
+
}
|
|
155
|
+
},
|
|
136
156
|
methods: {
|
|
137
157
|
toggleSortDirection() {
|
|
138
158
|
if (this.isDirectionToggleDisabled) return;
|
|
@@ -149,6 +169,8 @@ var script = {
|
|
|
149
169
|
this.$emit('sort-direction-change', newDirection);
|
|
150
170
|
},
|
|
151
171
|
onSortByChanged(event) {
|
|
172
|
+
if (this.disabled) return;
|
|
173
|
+
|
|
152
174
|
/**
|
|
153
175
|
* Emitted when the sort field is changed.
|
|
154
176
|
*
|
|
@@ -167,7 +189,7 @@ var script = {
|
|
|
167
189
|
const __vue_script__ = script;
|
|
168
190
|
|
|
169
191
|
/* template */
|
|
170
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-button-group',{staticClass:"gl-sorting gl-flex"},[_c('gl-collapsible-listbox',{staticClass:"gl-w-full",class:_vm.dropdownClass,attrs:{"toggle-text":_vm.text,"items":_vm.sortOptions,"selected":_vm.sortBy,"toggle-class":_vm.dropdownToggleClass,"placement":"bottom-end","block":_vm.block,"toggle-id":_vm.toggleId,"toggle-aria-labelled-by":(_vm.sortingListboxId + " " + _vm.toggleId)},on:{"select":_vm.onSortByChanged}}),_vm._v(" "),_c('span',{staticClass:"gl-sr-only",attrs:{"id":_vm.sortingListboxId}},[_vm._v(_vm._s(_vm.sortingListboxLabel))]),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],class:['sorting-direction-button', _vm.sortDirectionToggleClass],attrs:{"title":_vm.sortDirectionText,"icon":_vm.localSortDirection,"aria-label":_vm.sortDirectionText,"disabled":_vm.isDirectionToggleDisabled,"accessible-disabled":_vm.isDirectionToggleDisabled},on:{"click":_vm.toggleSortDirection}})],1)};
|
|
192
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-button-group',{staticClass:"gl-sorting gl-flex"},[_c('gl-collapsible-listbox',{ref:"listbox",staticClass:"gl-w-full",class:_vm.dropdownClass,attrs:{"toggle-text":_vm.text,"items":_vm.sortOptions,"selected":_vm.sortBy,"toggle-class":_vm.dropdownToggleClass,"placement":"bottom-end","block":_vm.block,"disabled":_vm.disabled,"toggle-id":_vm.toggleId,"toggle-aria-labelled-by":(_vm.sortingListboxId + " " + _vm.toggleId)},on:{"select":_vm.onSortByChanged}}),_vm._v(" "),_c('span',{staticClass:"gl-sr-only",attrs:{"id":_vm.sortingListboxId}},[_vm._v(_vm._s(_vm.sortingListboxLabel))]),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],class:['sorting-direction-button', _vm.sortDirectionToggleClass],attrs:{"title":_vm.sortDirectionText,"icon":_vm.localSortDirection,"aria-label":_vm.sortDirectionText,"disabled":_vm.isDirectionToggleDisabled,"accessible-disabled":_vm.isDirectionToggleDisabled},on:{"click":_vm.toggleSortDirection}})],1)};
|
|
171
193
|
var __vue_staticRenderFns__ = [];
|
|
172
194
|
|
|
173
195
|
/* style */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { uniqueId } from 'lodash-es';
|
|
2
|
+
import { glToggleConfig } from '../../../config';
|
|
2
3
|
import { toggleLabelPosition } from '../../../utils/constants';
|
|
3
4
|
import GlIcon from '../icon/icon';
|
|
4
5
|
import GlLoadingIcon from '../loading_icon/loading_icon';
|
|
@@ -41,6 +42,22 @@ var script = {
|
|
|
41
42
|
required: false,
|
|
42
43
|
default: false
|
|
43
44
|
},
|
|
45
|
+
/**
|
|
46
|
+
* Keep the toggle focusable while `disabled` is `true`. Uses `aria-disabled` so the toggle stays in the tab order and is announced by assistive technology.
|
|
47
|
+
*/
|
|
48
|
+
accessibleDisabled: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false,
|
|
51
|
+
default: () => glToggleConfig.accessibleDisabledToggle
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Space-separated ids of elements that describe the toggle, in addition to its help text.
|
|
55
|
+
*/
|
|
56
|
+
ariaDescribedby: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: false,
|
|
59
|
+
default: undefined
|
|
60
|
+
},
|
|
44
61
|
/**
|
|
45
62
|
* Whether the toggle is in the loading state.
|
|
46
63
|
*/
|
|
@@ -108,6 +125,12 @@ var script = {
|
|
|
108
125
|
helpId() {
|
|
109
126
|
return this.shouldRenderHelp ? `toggle-help-${this.uuid}` : undefined;
|
|
110
127
|
},
|
|
128
|
+
describedBy() {
|
|
129
|
+
return [this.helpId, this.ariaDescribedby].filter(Boolean).join(' ') || undefined;
|
|
130
|
+
},
|
|
131
|
+
isNativeDisabled() {
|
|
132
|
+
return this.disabled && !this.accessibleDisabled;
|
|
133
|
+
},
|
|
111
134
|
isChecked() {
|
|
112
135
|
return this.value ? 'true' : 'false';
|
|
113
136
|
},
|
|
@@ -146,7 +169,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
146
169
|
'is-checked': _vm.value,
|
|
147
170
|
'is-disabled': _vm.disabled || _vm.isLoading,
|
|
148
171
|
'is-loading': _vm.isLoading,
|
|
149
|
-
},attrs:{"role":"switch","aria-checked":_vm.isChecked,"aria-labelledby":_vm.labelId,"aria-describedby":_vm.
|
|
172
|
+
},attrs:{"role":"switch","aria-checked":_vm.isChecked,"aria-labelledby":_vm.labelId,"aria-describedby":_vm.describedBy,"aria-disabled":_vm.disabled,"type":"button","disabled":_vm.isNativeDisabled},on:{"click":function($event){$event.preventDefault();return _vm.toggleFeature.apply(null, arguments)}}},[(_vm.isLoading)?_c('gl-loading-icon',{staticClass:"toggle-loading",attrs:{"color":"dark"}}):_c('span',{staticClass:"toggle-icon"},[_c('gl-icon',{attrs:{"name":_vm.icon,"size":12}})],1)],1),_vm._v(" "),(_vm.shouldRenderHelp)?_c('span',{staticClass:"gl-help-label",attrs:{"id":_vm.helpId,"data-testid":"toggle-help"}},[_vm._t("help",function(){return [_vm._v(_vm._s(_vm.help))]})],2):_vm._e()])};
|
|
150
173
|
var __vue_staticRenderFns__ = [];
|
|
151
174
|
|
|
152
175
|
/* style */
|
|
@@ -73,6 +73,15 @@ var script = {
|
|
|
73
73
|
type: Boolean,
|
|
74
74
|
required: false,
|
|
75
75
|
default: true
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* A name for the chart that screen readers announce. It is added as a hidden title, which
|
|
79
|
+
* ECharts reads into the description it generates. Ignored when `options` sets a title.
|
|
80
|
+
*/
|
|
81
|
+
accessibleTitle: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: false,
|
|
84
|
+
default: ''
|
|
76
85
|
}
|
|
77
86
|
},
|
|
78
87
|
data() {
|
|
@@ -96,6 +105,14 @@ var script = {
|
|
|
96
105
|
}
|
|
97
106
|
});
|
|
98
107
|
}
|
|
108
|
+
if (this.accessibleTitle && !options.title) {
|
|
109
|
+
options = merge({}, options, {
|
|
110
|
+
title: {
|
|
111
|
+
text: this.accessibleTitle,
|
|
112
|
+
show: false
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
99
116
|
|
|
100
117
|
// Add space at the top to fit the toolbox
|
|
101
118
|
if (((_options$toolbox = options.toolbox) === null || _options$toolbox === void 0 ? void 0 : _options$toolbox.show) === true) {
|
|
@@ -116,6 +133,11 @@ var script = {
|
|
|
116
133
|
this.draw();
|
|
117
134
|
}
|
|
118
135
|
},
|
|
136
|
+
accessibleTitle() {
|
|
137
|
+
if (this.chart) {
|
|
138
|
+
this.draw();
|
|
139
|
+
}
|
|
140
|
+
},
|
|
119
141
|
width() {
|
|
120
142
|
this.setChartSize();
|
|
121
143
|
},
|
package/dist/config.js
CHANGED
|
@@ -5,6 +5,7 @@ const defaultConfig = {
|
|
|
5
5
|
firstDayOfWeek: 0 // Defaults to 0 (Sunday)
|
|
6
6
|
};
|
|
7
7
|
const glButtonConfig = {};
|
|
8
|
+
const glToggleConfig = {};
|
|
8
9
|
let configured = false;
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -15,6 +16,7 @@ let configured = false;
|
|
|
15
16
|
* @property {undefined | Object} translations Generic translations for component labels to fall back to.
|
|
16
17
|
* @property {undefined | Number} firstDayOfWeek Configured first day of the week, from 0 (Sunday) to 6 (Saturday).
|
|
17
18
|
* @property {boolean} [accessibleDisabledButton] Temporary flag to enable the accessible disabled button.
|
|
19
|
+
* @property {boolean} [accessibleDisabledToggle] Temporary flag to enable the accessible disabled toggle.
|
|
18
20
|
*
|
|
19
21
|
*/
|
|
20
22
|
const setConfigs = function () {
|
|
@@ -22,7 +24,9 @@ const setConfigs = function () {
|
|
|
22
24
|
translations = _ref.translations,
|
|
23
25
|
firstDayOfWeek = _ref.firstDayOfWeek,
|
|
24
26
|
_ref$accessibleDisabl = _ref.accessibleDisabledButton,
|
|
25
|
-
accessibleDisabledButton = _ref$accessibleDisabl === void 0 ? false : _ref$accessibleDisabl
|
|
27
|
+
accessibleDisabledButton = _ref$accessibleDisabl === void 0 ? false : _ref$accessibleDisabl,
|
|
28
|
+
_ref$accessibleDisabl2 = _ref.accessibleDisabledToggle,
|
|
29
|
+
accessibleDisabledToggle = _ref$accessibleDisabl2 === void 0 ? false : _ref$accessibleDisabl2;
|
|
26
30
|
if (configured) {
|
|
27
31
|
if (process.env.NODE_ENV === 'development') {
|
|
28
32
|
throw new Error('GitLab UI can only be configured once!');
|
|
@@ -67,6 +71,14 @@ const setConfigs = function () {
|
|
|
67
71
|
accessibleDisabledButton
|
|
68
72
|
});
|
|
69
73
|
}
|
|
74
|
+
|
|
75
|
+
// Temporary flag for the accessible disabled toggle. Once validated, aria-disabled becomes
|
|
76
|
+
// the default for disabled toggles and this flag is removed.
|
|
77
|
+
if (typeof accessibleDisabledToggle === 'boolean') {
|
|
78
|
+
Object.assign(glToggleConfig, {
|
|
79
|
+
accessibleDisabledToggle
|
|
80
|
+
});
|
|
81
|
+
}
|
|
70
82
|
};
|
|
71
83
|
|
|
72
|
-
export { setConfigs as default, defaultConfig, glButtonConfig, i18n };
|
|
84
|
+
export { setConfigs as default, defaultConfig, glButtonConfig, glToggleConfig, i18n };
|
package/package.json
CHANGED
|
@@ -98,6 +98,15 @@ export default {
|
|
|
98
98
|
required: false,
|
|
99
99
|
default: true,
|
|
100
100
|
},
|
|
101
|
+
/**
|
|
102
|
+
* Disables the entire sorting control (both the sort-by dropdown and the
|
|
103
|
+
* sort direction toggle) while keeping it visible.
|
|
104
|
+
*/
|
|
105
|
+
disabled: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
required: false,
|
|
108
|
+
default: false,
|
|
109
|
+
},
|
|
101
110
|
},
|
|
102
111
|
data() {
|
|
103
112
|
return {
|
|
@@ -106,7 +115,14 @@ export default {
|
|
|
106
115
|
};
|
|
107
116
|
},
|
|
108
117
|
computed: {
|
|
118
|
+
unavailableLabel() {
|
|
119
|
+
return translate('GlSorting.sortingUnavailable', 'Sorting is unavailable');
|
|
120
|
+
},
|
|
109
121
|
sortingListboxLabel() {
|
|
122
|
+
if (this.disabled) {
|
|
123
|
+
return this.unavailableLabel;
|
|
124
|
+
}
|
|
125
|
+
|
|
110
126
|
return translate('GlSorting.sortByLabel', 'Sort by:');
|
|
111
127
|
},
|
|
112
128
|
localSortDirection() {
|
|
@@ -119,19 +135,19 @@ export default {
|
|
|
119
135
|
return this.selectedSortOption?.text ?? '';
|
|
120
136
|
},
|
|
121
137
|
isDirectionToggleDisabled() {
|
|
122
|
-
return Boolean(this.selectedSortOption?.directionToggleDisabled);
|
|
138
|
+
return this.disabled || Boolean(this.selectedSortOption?.directionToggleDisabled);
|
|
123
139
|
},
|
|
124
140
|
sortDirectionText() {
|
|
125
|
-
if (this.sortDirectionToolTip) return this.sortDirectionToolTip;
|
|
141
|
+
if (this.sortDirectionToolTip && !this.disabled) return this.sortDirectionToolTip;
|
|
126
142
|
|
|
127
143
|
if (this.isDirectionToggleDisabled) {
|
|
128
144
|
return this.selectedSortText
|
|
129
145
|
? translate(
|
|
130
146
|
'GlSorting.sortDirectionUnavailableFor',
|
|
131
|
-
'
|
|
147
|
+
'Sorting is unavailable for %{sortField}',
|
|
132
148
|
{ sortField: this.selectedSortText },
|
|
133
149
|
)
|
|
134
|
-
:
|
|
150
|
+
: this.unavailableLabel;
|
|
135
151
|
}
|
|
136
152
|
|
|
137
153
|
return this.isAscending
|
|
@@ -139,6 +155,11 @@ export default {
|
|
|
139
155
|
: translate('GlSorting.sortDescending', 'Sort direction: descending');
|
|
140
156
|
},
|
|
141
157
|
},
|
|
158
|
+
watch: {
|
|
159
|
+
disabled(isDisabled) {
|
|
160
|
+
if (isDisabled) this.$refs.listbox.close();
|
|
161
|
+
},
|
|
162
|
+
},
|
|
142
163
|
methods: {
|
|
143
164
|
toggleSortDirection() {
|
|
144
165
|
if (this.isDirectionToggleDisabled) return;
|
|
@@ -156,6 +177,8 @@ export default {
|
|
|
156
177
|
this.$emit('sort-direction-change', newDirection);
|
|
157
178
|
},
|
|
158
179
|
onSortByChanged(event) {
|
|
180
|
+
if (this.disabled) return;
|
|
181
|
+
|
|
159
182
|
/**
|
|
160
183
|
* Emitted when the sort field is changed.
|
|
161
184
|
*
|
|
@@ -174,6 +197,7 @@ export default {
|
|
|
174
197
|
<template>
|
|
175
198
|
<gl-button-group class="gl-sorting gl-flex">
|
|
176
199
|
<gl-collapsible-listbox
|
|
200
|
+
ref="listbox"
|
|
177
201
|
:toggle-text="text"
|
|
178
202
|
:items="sortOptions"
|
|
179
203
|
:selected="sortBy"
|
|
@@ -182,6 +206,7 @@ export default {
|
|
|
182
206
|
:class="dropdownClass"
|
|
183
207
|
placement="bottom-end"
|
|
184
208
|
:block="block"
|
|
209
|
+
:disabled="disabled"
|
|
185
210
|
:toggle-id="toggleId"
|
|
186
211
|
:toggle-aria-labelled-by="`${sortingListboxId} ${toggleId}`"
|
|
187
212
|
@select="onSortByChanged"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uniqueId } from 'lodash-es';
|
|
3
3
|
|
|
4
|
+
import { glToggleConfig } from '../../../config';
|
|
4
5
|
import { toggleLabelPosition } from '../../../utils/constants';
|
|
5
6
|
import GlIcon from '../icon/icon.vue';
|
|
6
7
|
import GlLoadingIcon from '../loading_icon/loading_icon.vue';
|
|
@@ -43,6 +44,22 @@ export default {
|
|
|
43
44
|
required: false,
|
|
44
45
|
default: false,
|
|
45
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* Keep the toggle focusable while `disabled` is `true`. Uses `aria-disabled` so the toggle stays in the tab order and is announced by assistive technology.
|
|
49
|
+
*/
|
|
50
|
+
accessibleDisabled: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
required: false,
|
|
53
|
+
default: () => glToggleConfig.accessibleDisabledToggle,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Space-separated ids of elements that describe the toggle, in addition to its help text.
|
|
57
|
+
*/
|
|
58
|
+
ariaDescribedby: {
|
|
59
|
+
type: String,
|
|
60
|
+
required: false,
|
|
61
|
+
default: undefined,
|
|
62
|
+
},
|
|
46
63
|
/**
|
|
47
64
|
* Whether the toggle is in the loading state.
|
|
48
65
|
*/
|
|
@@ -111,6 +128,12 @@ export default {
|
|
|
111
128
|
helpId() {
|
|
112
129
|
return this.shouldRenderHelp ? `toggle-help-${this.uuid}` : undefined;
|
|
113
130
|
},
|
|
131
|
+
describedBy() {
|
|
132
|
+
return [this.helpId, this.ariaDescribedby].filter(Boolean).join(' ') || undefined;
|
|
133
|
+
},
|
|
134
|
+
isNativeDisabled() {
|
|
135
|
+
return this.disabled && !this.accessibleDisabled;
|
|
136
|
+
},
|
|
114
137
|
isChecked() {
|
|
115
138
|
return this.value ? 'true' : 'false';
|
|
116
139
|
},
|
|
@@ -172,7 +195,7 @@ export default {
|
|
|
172
195
|
role="switch"
|
|
173
196
|
:aria-checked="isChecked"
|
|
174
197
|
:aria-labelledby="labelId"
|
|
175
|
-
:aria-describedby="
|
|
198
|
+
:aria-describedby="describedBy"
|
|
176
199
|
:aria-disabled="disabled"
|
|
177
200
|
:class="{
|
|
178
201
|
'is-checked': value,
|
|
@@ -181,7 +204,7 @@ export default {
|
|
|
181
204
|
}"
|
|
182
205
|
class="gl-toggle gl-shrink-0"
|
|
183
206
|
type="button"
|
|
184
|
-
:disabled="
|
|
207
|
+
:disabled="isNativeDisabled"
|
|
185
208
|
@click.prevent="toggleFeature"
|
|
186
209
|
>
|
|
187
210
|
<gl-loading-icon v-if="isLoading" color="dark" class="toggle-loading" />
|
|
@@ -80,6 +80,15 @@ export default {
|
|
|
80
80
|
required: false,
|
|
81
81
|
default: true,
|
|
82
82
|
},
|
|
83
|
+
/**
|
|
84
|
+
* A name for the chart that screen readers announce. It is added as a hidden title, which
|
|
85
|
+
* ECharts reads into the description it generates. Ignored when `options` sets a title.
|
|
86
|
+
*/
|
|
87
|
+
accessibleTitle: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false,
|
|
90
|
+
default: '',
|
|
91
|
+
},
|
|
83
92
|
},
|
|
84
93
|
data() {
|
|
85
94
|
return {
|
|
@@ -96,6 +105,10 @@ export default {
|
|
|
96
105
|
options = merge({}, options, { aria: { enabled: true } });
|
|
97
106
|
}
|
|
98
107
|
|
|
108
|
+
if (this.accessibleTitle && !options.title) {
|
|
109
|
+
options = merge({}, options, { title: { text: this.accessibleTitle, show: false } });
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
// Add space at the top to fit the toolbox
|
|
100
113
|
if (options.toolbox?.show === true) {
|
|
101
114
|
const top = (options.grid?.top || 0) + toolboxHeight;
|
|
@@ -111,6 +124,11 @@ export default {
|
|
|
111
124
|
this.draw();
|
|
112
125
|
}
|
|
113
126
|
},
|
|
127
|
+
accessibleTitle() {
|
|
128
|
+
if (this.chart) {
|
|
129
|
+
this.draw();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
114
132
|
width() {
|
|
115
133
|
this.setChartSize();
|
|
116
134
|
},
|
package/src/config.js
CHANGED
|
@@ -7,6 +7,7 @@ export const defaultConfig = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export const glButtonConfig = {};
|
|
10
|
+
export const glToggleConfig = {};
|
|
10
11
|
|
|
11
12
|
let configured = false;
|
|
12
13
|
|
|
@@ -18,9 +19,15 @@ let configured = false;
|
|
|
18
19
|
* @property {undefined | Object} translations Generic translations for component labels to fall back to.
|
|
19
20
|
* @property {undefined | Number} firstDayOfWeek Configured first day of the week, from 0 (Sunday) to 6 (Saturday).
|
|
20
21
|
* @property {boolean} [accessibleDisabledButton] Temporary flag to enable the accessible disabled button.
|
|
22
|
+
* @property {boolean} [accessibleDisabledToggle] Temporary flag to enable the accessible disabled toggle.
|
|
21
23
|
*
|
|
22
24
|
*/
|
|
23
|
-
const setConfigs = ({
|
|
25
|
+
const setConfigs = ({
|
|
26
|
+
translations,
|
|
27
|
+
firstDayOfWeek,
|
|
28
|
+
accessibleDisabledButton = false,
|
|
29
|
+
accessibleDisabledToggle = false,
|
|
30
|
+
} = {}) => {
|
|
24
31
|
if (configured) {
|
|
25
32
|
if (process.env.NODE_ENV === 'development') {
|
|
26
33
|
throw new Error('GitLab UI can only be configured once!');
|
|
@@ -71,6 +78,14 @@ const setConfigs = ({ translations, firstDayOfWeek, accessibleDisabledButton = f
|
|
|
71
78
|
accessibleDisabledButton,
|
|
72
79
|
});
|
|
73
80
|
}
|
|
81
|
+
|
|
82
|
+
// Temporary flag for the accessible disabled toggle. Once validated, aria-disabled becomes
|
|
83
|
+
// the default for disabled toggles and this flag is removed.
|
|
84
|
+
if (typeof accessibleDisabledToggle === 'boolean') {
|
|
85
|
+
Object.assign(glToggleConfig, {
|
|
86
|
+
accessibleDisabledToggle,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
74
89
|
};
|
|
75
90
|
|
|
76
91
|
export default setConfigs;
|
package/translations.js
CHANGED
|
@@ -43,8 +43,8 @@ export default {
|
|
|
43
43
|
'GlSorting.sortAscending': 'Sort direction: ascending',
|
|
44
44
|
'GlSorting.sortByLabel': 'Sort by:',
|
|
45
45
|
'GlSorting.sortDescending': 'Sort direction: descending',
|
|
46
|
-
'GlSorting.
|
|
47
|
-
'GlSorting.
|
|
46
|
+
'GlSorting.sortDirectionUnavailableFor': 'Sorting is unavailable for %{sortField}',
|
|
47
|
+
'GlSorting.sortingUnavailable': 'Sorting is unavailable',
|
|
48
48
|
'GlTabs.GlScrollableTabs.scrollLeftLabel': 'Scroll left',
|
|
49
49
|
'GlTabs.GlScrollableTabs.scrollRightLabel': 'Scroll right',
|
|
50
50
|
'GlToken.closeButtonTitle': 'Remove',
|