@gitlab/ui 53.2.0 → 53.3.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 +7 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +9 -1
- package/package.json +1 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.spec.js +9 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.stories.js +16 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [53.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v53.2.0...v53.3.0) (2023-01-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlDisclosureDropdown:** Allow to provide custom toggle id ([b696ea2](https://gitlab.com/gitlab-org/gitlab-ui/commit/b696ea2ef34a9efca894260cfa45b7ff36aefd56))
|
|
7
|
+
|
|
1
8
|
# [53.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v53.1.0...v53.2.0) (2023-01-23)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -97,6 +97,15 @@ var script = {
|
|
|
97
97
|
required: false,
|
|
98
98
|
default: false
|
|
99
99
|
},
|
|
100
|
+
/**
|
|
101
|
+
* Custom toggle id.
|
|
102
|
+
* Fot instance, it can be referenced by tooltip or popover
|
|
103
|
+
*/
|
|
104
|
+
toggleId: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: false,
|
|
107
|
+
default: _uniqueId('dropdown-toggle-btn-')
|
|
108
|
+
},
|
|
100
109
|
/**
|
|
101
110
|
* Additional CSS classes to customize toggle appearance
|
|
102
111
|
*/
|
|
@@ -143,7 +152,6 @@ var script = {
|
|
|
143
152
|
},
|
|
144
153
|
data() {
|
|
145
154
|
return {
|
|
146
|
-
toggleId: _uniqueId('dropdown-toggle-btn-'),
|
|
147
155
|
disclosureId: _uniqueId('disclosure-'),
|
|
148
156
|
nextFocusedItemIndex: null
|
|
149
157
|
};
|
package/package.json
CHANGED
|
@@ -33,13 +33,21 @@ describe('GlDisclosureDropdown', () => {
|
|
|
33
33
|
const findListItem = (index) => findDisclosureItems().at(index).findComponent(ITEM_SELECTOR);
|
|
34
34
|
|
|
35
35
|
describe('toggle text', () => {
|
|
36
|
-
it('should pass toggle text to base dropdown', () => {
|
|
36
|
+
it('should pass toggle text to the base dropdown', () => {
|
|
37
37
|
const toggleText = 'Merge requests';
|
|
38
38
|
buildWrapper({ items: mockItems, toggleText });
|
|
39
39
|
expect(findBaseDropdown().props('toggleText')).toBe(toggleText);
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
describe('custom toggle id', () => {
|
|
44
|
+
it('should pass toggle id to the base dropdown', () => {
|
|
45
|
+
const toggleId = 'custom-toggle';
|
|
46
|
+
buildWrapper({ items: mockItems, toggleId });
|
|
47
|
+
expect(findBaseDropdown().props('toggleId')).toBe(toggleId);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
43
51
|
describe('ARIA attributes', () => {
|
|
44
52
|
it('should provide `toggleId` to the base dropdown and reference it in`aria-labelledby` attribute of the list container`', async () => {
|
|
45
53
|
await buildWrapper({ items: mockItems });
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
GlAvatar,
|
|
14
14
|
GlModal,
|
|
15
15
|
GlIcon,
|
|
16
|
+
GlTooltip,
|
|
16
17
|
} from '../../../../index';
|
|
17
18
|
import { makeContainer } from '../../../../utils/story_decorators/container';
|
|
18
19
|
import readme from './disclosure_dropdown.md';
|
|
@@ -35,6 +36,7 @@ const generateProps = ({
|
|
|
35
36
|
loading = defaultValue('loading'),
|
|
36
37
|
noCaret = defaultValue('noCaret'),
|
|
37
38
|
placement = defaultValue('placement'),
|
|
39
|
+
toggleId = defaultValue('toggleId'),
|
|
38
40
|
toggleText,
|
|
39
41
|
textSrOnly = defaultValue('textSrOnly'),
|
|
40
42
|
icon = '',
|
|
@@ -50,6 +52,7 @@ const generateProps = ({
|
|
|
50
52
|
loading,
|
|
51
53
|
noCaret,
|
|
52
54
|
placement,
|
|
55
|
+
toggleId,
|
|
53
56
|
toggleText,
|
|
54
57
|
textSrOnly,
|
|
55
58
|
icon,
|
|
@@ -68,6 +71,7 @@ const makeBindings = (overrides = {}) =>
|
|
|
68
71
|
':loading': 'loading',
|
|
69
72
|
':no-caret': 'noCaret',
|
|
70
73
|
':placement': 'placement',
|
|
74
|
+
':toggle-id': 'toggleId',
|
|
71
75
|
':toggle-text': 'toggleText',
|
|
72
76
|
':text-sr-only': 'textSrOnly',
|
|
73
77
|
':icon': 'icon',
|
|
@@ -93,23 +97,34 @@ const template = (content, { bindingOverrides = {} } = {}) => `
|
|
|
93
97
|
</gl-disclosure-dropdown>
|
|
94
98
|
`;
|
|
95
99
|
|
|
100
|
+
const TOGGLE_ID = 'custom-toggle-id';
|
|
96
101
|
export const Default = (args, { argTypes }) => ({
|
|
102
|
+
toggleId: TOGGLE_ID,
|
|
97
103
|
props: Object.keys(argTypes),
|
|
98
104
|
components: {
|
|
99
105
|
GlDisclosureDropdown,
|
|
106
|
+
GlTooltip,
|
|
100
107
|
},
|
|
101
108
|
mounted() {
|
|
102
109
|
if (this.startOpened) {
|
|
103
110
|
openDisclosure(this);
|
|
104
111
|
}
|
|
105
112
|
},
|
|
106
|
-
template:
|
|
113
|
+
template: `
|
|
114
|
+
<div>
|
|
115
|
+
${template()}
|
|
116
|
+
<gl-tooltip :target="$options.toggleId" placement="right">
|
|
117
|
+
This is a default disclosure
|
|
118
|
+
</gl-tooltip>
|
|
119
|
+
</div>
|
|
120
|
+
`,
|
|
107
121
|
});
|
|
108
122
|
Default.args = generateProps({
|
|
109
123
|
icon: 'ellipsis_v',
|
|
110
124
|
noCaret: true,
|
|
111
125
|
toggleText: 'Disclosure',
|
|
112
126
|
textSrOnly: true,
|
|
127
|
+
toggleId: TOGGLE_ID,
|
|
113
128
|
});
|
|
114
129
|
Default.decorators = [makeContainer({ height: '200px' })];
|
|
115
130
|
|
|
@@ -109,6 +109,15 @@ export default {
|
|
|
109
109
|
required: false,
|
|
110
110
|
default: false,
|
|
111
111
|
},
|
|
112
|
+
/**
|
|
113
|
+
* Custom toggle id.
|
|
114
|
+
* Fot instance, it can be referenced by tooltip or popover
|
|
115
|
+
*/
|
|
116
|
+
toggleId: {
|
|
117
|
+
type: String,
|
|
118
|
+
required: false,
|
|
119
|
+
default: uniqueId('dropdown-toggle-btn-'),
|
|
120
|
+
},
|
|
112
121
|
/**
|
|
113
122
|
* Additional CSS classes to customize toggle appearance
|
|
114
123
|
*/
|
|
@@ -155,7 +164,6 @@ export default {
|
|
|
155
164
|
},
|
|
156
165
|
data() {
|
|
157
166
|
return {
|
|
158
|
-
toggleId: uniqueId('dropdown-toggle-btn-'),
|
|
159
167
|
disclosureId: uniqueId('disclosure-'),
|
|
160
168
|
nextFocusedItemIndex: null,
|
|
161
169
|
};
|