@gitlab/ui 72.9.0 → 72.11.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 +16 -0
- package/dist/components/base/form/form_input/form_input.js +1 -1
- package/dist/components/base/new_dropdowns/listbox/listbox.js +14 -2
- package/dist/components/charts/single_stat/single_stat.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +2 -2
- package/src/components/base/form/form_input/form_input.stories.js +16 -0
- package/src/components/base/form/form_input/form_input.vue +7 -1
- package/src/components/base/new_dropdowns/listbox/listbox.md +2 -1
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +5 -0
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +21 -19
- package/src/components/base/new_dropdowns/listbox/listbox.vue +16 -4
- package/src/components/charts/single_stat/single_stat.scss +10 -3
- package/src/components/charts/single_stat/single_stat.vue +8 -2
- package/translations.json +2 -1
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "72.
|
|
3
|
+
"version": "72.11.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"babel-jest": "29.0.1",
|
|
129
129
|
"babel-loader": "^8.0.5",
|
|
130
130
|
"bootstrap": "4.6.2",
|
|
131
|
-
"cypress": "13.6.
|
|
131
|
+
"cypress": "13.6.3",
|
|
132
132
|
"cypress-axe": "^1.4.0",
|
|
133
133
|
"cypress-real-events": "^1.11.0",
|
|
134
134
|
"dompurify": "^3.0.0",
|
|
@@ -16,11 +16,13 @@ const generateProps = ({
|
|
|
16
16
|
value = '',
|
|
17
17
|
disabled = false,
|
|
18
18
|
readonly = false,
|
|
19
|
+
type = 'text',
|
|
19
20
|
} = {}) => ({
|
|
20
21
|
width,
|
|
21
22
|
value,
|
|
22
23
|
disabled,
|
|
23
24
|
readonly,
|
|
25
|
+
type,
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
const Template = (args) => ({
|
|
@@ -38,6 +40,20 @@ Disabled.args = generateProps({ value: 'some text', disabled: true });
|
|
|
38
40
|
export const Readonly = Template.bind({});
|
|
39
41
|
Readonly.args = generateProps({ value: 'readonly text', readonly: true });
|
|
40
42
|
|
|
43
|
+
export const NumberInput = (args, { argTypes }) => ({
|
|
44
|
+
components: { GlFormInput },
|
|
45
|
+
props: Object.keys(argTypes),
|
|
46
|
+
data: () => ({
|
|
47
|
+
formInputWidths,
|
|
48
|
+
}),
|
|
49
|
+
template: `
|
|
50
|
+
<gl-form-input
|
|
51
|
+
type="number"
|
|
52
|
+
/>
|
|
53
|
+
`,
|
|
54
|
+
});
|
|
55
|
+
NumberInput.tags = ['skip-visual-test'];
|
|
56
|
+
|
|
41
57
|
export const Widths = (args, { argTypes }) => ({
|
|
42
58
|
components: { GlFormInput },
|
|
43
59
|
props: Object.keys(argTypes),
|
|
@@ -82,5 +82,11 @@ export default {
|
|
|
82
82
|
</script>
|
|
83
83
|
|
|
84
84
|
<template>
|
|
85
|
-
<b-form-input
|
|
85
|
+
<b-form-input
|
|
86
|
+
class="gl-form-input"
|
|
87
|
+
:class="cssClasses"
|
|
88
|
+
no-wheel
|
|
89
|
+
v-bind="$attrs"
|
|
90
|
+
v-on="listeners"
|
|
91
|
+
/>
|
|
86
92
|
</template>
|
|
@@ -134,7 +134,8 @@ To update content of the listbox, toggle the `searching` property
|
|
|
134
134
|
and update the `items` property with a new array. Be sure to debounce (or
|
|
135
135
|
similar) the `search` event handler to avoid rendering stale results.
|
|
136
136
|
To improve the accessibility, provide the `search-summary-sr-only` scoped slot
|
|
137
|
-
with a number of found search results text.
|
|
137
|
+
with a number of found search results text, alternately, you can pass a plural translate function.
|
|
138
|
+
An example of the plural translate function can be found [the GitLab Docs internationalization section](https://docs.gitlab.com/ee/development/i18n/externalization.html#plurals)
|
|
138
139
|
Screen reader will announce this text when the list is updated.
|
|
139
140
|
|
|
140
141
|
```html
|
|
@@ -477,6 +477,11 @@ describe('GlCollapsibleListbox', () => {
|
|
|
477
477
|
});
|
|
478
478
|
|
|
479
479
|
describe('Screen reader text with number of search results', () => {
|
|
480
|
+
it('when the #search-summary-sr-only slot content is empty', () => {
|
|
481
|
+
buildWrapper({ items: mockOptions, searchable: true, searching: false });
|
|
482
|
+
expect(findSRNumberOfResultsText().text()).toBe('12 results');
|
|
483
|
+
});
|
|
484
|
+
|
|
480
485
|
it('when the #search-summary-sr-only slot content is provided', () => {
|
|
481
486
|
const searchResultsContent = 'Found 5 results';
|
|
482
487
|
const slots = { 'search-summary-sr-only': searchResultsContent };
|
|
@@ -60,6 +60,7 @@ const generateProps = ({
|
|
|
60
60
|
startOpened = true,
|
|
61
61
|
fluidWidth,
|
|
62
62
|
positioningStrategy,
|
|
63
|
+
srOnlyResultsLabel,
|
|
63
64
|
} = {}) => ({
|
|
64
65
|
items,
|
|
65
66
|
category,
|
|
@@ -90,6 +91,7 @@ const generateProps = ({
|
|
|
90
91
|
startOpened,
|
|
91
92
|
fluidWidth,
|
|
92
93
|
positioningStrategy,
|
|
94
|
+
srOnlyResultsLabel,
|
|
93
95
|
});
|
|
94
96
|
|
|
95
97
|
const makeBindings = (overrides = {}) =>
|
|
@@ -123,6 +125,7 @@ const makeBindings = (overrides = {}) =>
|
|
|
123
125
|
':fluid-width': 'fluidWidth',
|
|
124
126
|
':positioning-strategy': 'positioningStrategy',
|
|
125
127
|
':startOpened': 'startOpened',
|
|
128
|
+
':sr-only-results-label': 'srOnlyResultsLabel',
|
|
126
129
|
...overrides,
|
|
127
130
|
})
|
|
128
131
|
.map(([key, value]) => `${key}="${value}"`)
|
|
@@ -577,6 +580,11 @@ export default {
|
|
|
577
580
|
subcategory: ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
578
581
|
},
|
|
579
582
|
},
|
|
583
|
+
srOnlyResultsLabel: {
|
|
584
|
+
table: {
|
|
585
|
+
subcategory: ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
586
|
+
},
|
|
587
|
+
},
|
|
580
588
|
listAriaLabelledBy: {
|
|
581
589
|
table: {
|
|
582
590
|
subcategory: ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
@@ -644,7 +652,7 @@ export const Searchable = (args, { argTypes }) => ({
|
|
|
644
652
|
return toggleText;
|
|
645
653
|
},
|
|
646
654
|
numberOfSearchResults() {
|
|
647
|
-
return this.filteredItems.length
|
|
655
|
+
return `${this.filteredItems.length} department${this.filteredItems.length > 1 ? 's' : ''}`;
|
|
648
656
|
},
|
|
649
657
|
},
|
|
650
658
|
template: template(
|
|
@@ -700,11 +708,6 @@ export const SearchableGroups = (args, { argTypes }) => ({
|
|
|
700
708
|
|
|
701
709
|
return toggleText;
|
|
702
710
|
},
|
|
703
|
-
numberOfSearchResults() {
|
|
704
|
-
return this.flattenedFilteredOptions.length === 1
|
|
705
|
-
? '1 result'
|
|
706
|
-
: `${this.flattenedFilteredOptions.length} results`;
|
|
707
|
-
},
|
|
708
711
|
},
|
|
709
712
|
methods: {
|
|
710
713
|
filterList(searchTerm) {
|
|
@@ -729,20 +732,19 @@ export const SearchableGroups = (args, { argTypes }) => ({
|
|
|
729
732
|
this.searchInProgress = false;
|
|
730
733
|
}, 2000);
|
|
731
734
|
},
|
|
735
|
+
srOnlyResultsLabel(count) {
|
|
736
|
+
return `${count} branch${count > 1 ? 'es' : ''} or tag${count > 1 ? 's' : ''}`;
|
|
737
|
+
},
|
|
732
738
|
},
|
|
733
|
-
template: template(
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
'@search': 'filterList',
|
|
743
|
-
},
|
|
744
|
-
}
|
|
745
|
-
),
|
|
739
|
+
template: template('', {
|
|
740
|
+
bindingOverrides: {
|
|
741
|
+
':items': 'filteredGroupOptions',
|
|
742
|
+
':toggle-text': 'customToggleText',
|
|
743
|
+
':searching': 'searchInProgress',
|
|
744
|
+
':sr-only-results-label': 'srOnlyResultsLabel',
|
|
745
|
+
'@search': 'filterList',
|
|
746
|
+
},
|
|
747
|
+
}),
|
|
746
748
|
});
|
|
747
749
|
SearchableGroups.args = generateProps({
|
|
748
750
|
headerText: 'Select ref',
|
|
@@ -26,6 +26,7 @@ import GlLoadingIcon from '../../loading_icon/loading_icon.vue';
|
|
|
26
26
|
import GlIntersectionObserver from '../../../utilities/intersection_observer/intersection_observer.vue';
|
|
27
27
|
import GlSearchBoxByType from '../../search_box_by_type/search_box_by_type.vue';
|
|
28
28
|
import GlBaseDropdown from '../base_dropdown/base_dropdown.vue';
|
|
29
|
+
import { translate } from '../../../../utils/i18n';
|
|
29
30
|
import GlListboxItem from './listbox_item.vue';
|
|
30
31
|
import GlListboxSearchInput from './listbox_search_input.vue';
|
|
31
32
|
import GlListboxGroup from './listbox_group.vue';
|
|
@@ -339,6 +340,17 @@ export default {
|
|
|
339
340
|
required: false,
|
|
340
341
|
default: false,
|
|
341
342
|
},
|
|
343
|
+
srOnlyResultsLabel: {
|
|
344
|
+
type: Function,
|
|
345
|
+
required: false,
|
|
346
|
+
default: (count) => {
|
|
347
|
+
const fn = translate('GlCollapsibleListbox.srOnlyResultsLabel', 'Results count');
|
|
348
|
+
if (typeof fn === 'function') {
|
|
349
|
+
return fn(count);
|
|
350
|
+
}
|
|
351
|
+
return `${count} result${count > 1 ? 's' : ''}`;
|
|
352
|
+
},
|
|
353
|
+
},
|
|
342
354
|
},
|
|
343
355
|
data() {
|
|
344
356
|
return {
|
|
@@ -394,9 +406,7 @@ export default {
|
|
|
394
406
|
return !this.flattenedOptions.length && !this.searching;
|
|
395
407
|
},
|
|
396
408
|
announceSRSearchResults() {
|
|
397
|
-
return
|
|
398
|
-
this.searchable && !this.showNoResultsText && this.$scopedSlots['search-summary-sr-only']
|
|
399
|
-
);
|
|
409
|
+
return this.searchable && !this.showNoResultsText;
|
|
400
410
|
},
|
|
401
411
|
headerId() {
|
|
402
412
|
return this.headerText && uniqueId('listbox-header-');
|
|
@@ -912,7 +922,9 @@ export default {
|
|
|
912
922
|
aria-live="assertive"
|
|
913
923
|
>
|
|
914
924
|
<!-- @slot Text read by screen reader announcing a number of search results -->
|
|
915
|
-
<slot name="search-summary-sr-only"
|
|
925
|
+
<slot name="search-summary-sr-only">
|
|
926
|
+
{{ srOnlyResultsLabel(flattenedOptions.length) }}
|
|
927
|
+
</slot>
|
|
916
928
|
</span>
|
|
917
929
|
|
|
918
930
|
<div
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
$line-height: 1;
|
|
2
|
-
|
|
3
1
|
.gl-single-stat {
|
|
4
|
-
line-height
|
|
2
|
+
@include gl-line-height-1;
|
|
5
3
|
|
|
6
4
|
&:hover[tabindex='0'] {
|
|
7
5
|
@include gl-bg-gray-50;
|
|
8
6
|
@include gl-rounded-base;
|
|
9
7
|
}
|
|
8
|
+
|
|
9
|
+
.gl-single-stat-number {
|
|
10
|
+
font-size: map-get($gl-font-sizes, 700);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.gl-single-stat-content .gl-badge {
|
|
14
|
+
position: relative;
|
|
15
|
+
top: -0.125em;
|
|
16
|
+
}
|
|
10
17
|
}
|
|
@@ -130,8 +130,14 @@ export default {
|
|
|
130
130
|
/>
|
|
131
131
|
<span class="gl-font-base gl-font-weight-normal" data-testid="title-text">{{ title }}</span>
|
|
132
132
|
</div>
|
|
133
|
-
<div
|
|
134
|
-
|
|
133
|
+
<div
|
|
134
|
+
class="gl-single-stat-content gl-display-flex gl-align-items-baseline gl-font-weight-bold gl-text-gray-900"
|
|
135
|
+
>
|
|
136
|
+
<span
|
|
137
|
+
class="gl-single-stat-number gl-line-height-1"
|
|
138
|
+
:class="{ 'gl-mr-2': !unit }"
|
|
139
|
+
data-testid="displayValue"
|
|
140
|
+
>
|
|
135
141
|
<gl-animated-number
|
|
136
142
|
v-if="canAnimate"
|
|
137
143
|
:number="Number(value)"
|
package/translations.json
CHANGED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
"GlSorting.sortAscending": "Sort direction: ascending",
|
|
4
4
|
"GlSorting.sortDescending": "Sort direction: descending",
|
|
5
5
|
"GlSearchBoxByType.clearButtonTitle": "Clear",
|
|
6
|
-
"GlSearchBoxByType.input.placeholder": "Search"
|
|
6
|
+
"GlSearchBoxByType.input.placeholder": "Search",
|
|
7
|
+
"GlCollapsibleListbox.srOnlyResultsLabel": "Results count"
|
|
7
8
|
}
|