@gitlab/ui 72.8.1 → 72.10.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 +14 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +14 -2
- package/dist/index.css +2 -2
- 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/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +10 -4
- 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/scss/storybook.scss +3 -0
- package/src/scss/utilities.scss +10 -0
- package/src/scss/utility-mixins/spacing.scss +6 -0
- package/tailwind.defaults.js +5 -0
- package/translations.json +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "72.
|
|
3
|
+
"version": "72.10.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,13 +17,15 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"src",
|
|
19
19
|
"dist",
|
|
20
|
-
"translations.json"
|
|
20
|
+
"translations.json",
|
|
21
|
+
"tailwind.defaults.js"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "NODE_ENV=production rollup -c",
|
|
24
25
|
"prebuild": "run-s build-tokens generate-utilities",
|
|
25
26
|
"prepare": "run-s build-tokens generate-utilities",
|
|
26
27
|
"generate-utilities": "make src/scss/utilities.scss",
|
|
28
|
+
"deprecate-gl-utils": "./bin/deprecate_utils.js",
|
|
27
29
|
"copy-fonts": "make copy-fonts",
|
|
28
30
|
"build-tokens": "node ./bin/build_tokens.js",
|
|
29
31
|
"clean": "rm -r dist storybook src/scss/utilities.scss",
|
|
@@ -61,7 +63,8 @@
|
|
|
61
63
|
"lint": "run-p prettier eslint stylelint markdownlint",
|
|
62
64
|
"lint:fix": "run-s prettier:fix eslint:fix stylelint:fix markdownlint:fix",
|
|
63
65
|
"generate:component": "plop",
|
|
64
|
-
"translations:collect": "make translations.json"
|
|
66
|
+
"translations:collect": "make translations.json",
|
|
67
|
+
"tailwind-config-viewer": "tailwind-config-viewer -o"
|
|
65
68
|
},
|
|
66
69
|
"dependencies": {
|
|
67
70
|
"@floating-ui/dom": "1.4.3",
|
|
@@ -78,6 +81,7 @@
|
|
|
78
81
|
"dompurify": "^2.4.7 || ^3.0.5",
|
|
79
82
|
"emoji-regex": ">=10.0.0",
|
|
80
83
|
"pikaday": "^1.8.0",
|
|
84
|
+
"tailwindcss": "3^",
|
|
81
85
|
"vue": "^2.7.16"
|
|
82
86
|
},
|
|
83
87
|
"resolutions": {
|
|
@@ -154,7 +158,7 @@
|
|
|
154
158
|
"react-dom": "^18.2.0",
|
|
155
159
|
"rollup": "^2.53.1",
|
|
156
160
|
"rollup-plugin-babel": "^4.4.0",
|
|
157
|
-
"rollup-plugin-postcss": "
|
|
161
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
158
162
|
"rollup-plugin-string": "^3.0.0",
|
|
159
163
|
"rollup-plugin-svg": "^2.0.0",
|
|
160
164
|
"rollup-plugin-vue": "^5.1.6",
|
|
@@ -167,6 +171,8 @@
|
|
|
167
171
|
"storybook-dark-mode": "3.0.3",
|
|
168
172
|
"style-dictionary": "^3.8.0",
|
|
169
173
|
"stylelint": "15.10.2",
|
|
174
|
+
"tailwind-config-viewer": "1.7.3",
|
|
175
|
+
"tailwindcss": "3.4.1",
|
|
170
176
|
"vue": "2.7.16",
|
|
171
177
|
"vue-loader": "^15.8.3",
|
|
172
178
|
"vue-loader-vue3": "npm:vue-loader@17",
|
|
@@ -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
|
package/src/scss/storybook.scss
CHANGED
package/src/scss/utilities.scss
CHANGED
|
@@ -6510,6 +6510,16 @@ $gl-animate-skeleton-loader-max-width: 64 * $grid-size;
|
|
|
6510
6510
|
.gl-mr-auto\! {
|
|
6511
6511
|
margin-right: auto !important;
|
|
6512
6512
|
}
|
|
6513
|
+
.gl-md-mr-auto {
|
|
6514
|
+
@include gl-media-breakpoint-up(md) {
|
|
6515
|
+
margin-right: auto;
|
|
6516
|
+
}
|
|
6517
|
+
}
|
|
6518
|
+
.gl-md-mr-auto\! {
|
|
6519
|
+
@include gl-media-breakpoint-up(md) {
|
|
6520
|
+
margin-right: auto !important;
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6513
6523
|
.gl-mr-0 {
|
|
6514
6524
|
margin-right: 0;
|
|
6515
6525
|
}
|
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
|
}
|