@gitlab/ui 79.0.0 → 79.1.1
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 +15 -0
- package/dist/components/base/form/form_textarea/form_textarea.js +6 -3
- 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 +1 -1
- package/src/components/base/filtered_search/filtered_search_suggestion.scss +1 -0
- package/src/components/base/filtered_search/filtered_search_suggestion_list.scss +18 -0
- package/src/components/base/form/form_group/form_group.stories.js +28 -19
- package/src/components/base/form/form_textarea/form_textarea.spec.js +37 -0
- package/src/components/base/form/form_textarea/form_textarea.vue +6 -3
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
.gl-filtered-search-suggestion-list.dropdown-menu {
|
|
5
5
|
@include gl-display-block;
|
|
6
6
|
width: $gl-dropdown-width;
|
|
7
|
+
@include gl-p-2;
|
|
8
|
+
@include gl-border-gray-200;
|
|
9
|
+
@include gl-rounded-lg;
|
|
10
|
+
@include gl-shadow-md;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
.gl-filtered-search-suggestion-list {
|
|
@@ -11,6 +15,20 @@
|
|
|
11
15
|
@include gl-overflow-y-auto;
|
|
12
16
|
max-height: $gl-max-dropdown-max-height;
|
|
13
17
|
|
|
18
|
+
.gl-filtered-search-suggestion,
|
|
19
|
+
.gl-filtered-search-suggestion > a,
|
|
20
|
+
.gl-filtered-search-suggestion > button {
|
|
21
|
+
border-radius: $gl-border-radius-base !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.gl-dropdown-divider {
|
|
25
|
+
@include gl-mx-n2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.gl-spinner-container {
|
|
29
|
+
@include gl-my-2;
|
|
30
|
+
}
|
|
31
|
+
|
|
14
32
|
.gl-filtered-search-suggestion {
|
|
15
33
|
@include gl-p-0;
|
|
16
34
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { disableControls } from '../../../../utils/stories_utils';
|
|
1
2
|
import GlFormInput from '../form_input/form_input.vue';
|
|
2
3
|
import GlFormTextarea from '../form_textarea/form_textarea.vue';
|
|
3
|
-
import { disableControls } from '../../../../utils/stories_utils';
|
|
4
|
-
import GlFormGroup from './form_group.vue';
|
|
5
4
|
import readme from './form_group.md';
|
|
5
|
+
import GlFormGroup from './form_group.vue';
|
|
6
6
|
|
|
7
7
|
const components = {
|
|
8
8
|
GlFormGroup,
|
|
@@ -24,16 +24,24 @@ const generateProps = ({
|
|
|
24
24
|
description,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const makeBindings = (overrides = {}) =>
|
|
28
|
+
Object.entries({
|
|
29
|
+
':id': "id + '_group'",
|
|
30
|
+
':label-for': 'id',
|
|
31
|
+
':label': 'label',
|
|
32
|
+
':label-description': 'labelDescription',
|
|
33
|
+
':optional': 'optional',
|
|
34
|
+
':optional-text': 'optionalText',
|
|
35
|
+
':description': 'description',
|
|
36
|
+
...overrides,
|
|
37
|
+
})
|
|
38
|
+
.map(([key, value]) => `${key}="${value}"`)
|
|
39
|
+
.join(' ');
|
|
40
|
+
|
|
41
|
+
const wrap = (template, bindingsOverrides = {}) => `
|
|
28
42
|
<gl-form-group
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
:label-description="labelDescription"
|
|
32
|
-
:optional="optional"
|
|
33
|
-
:optional-text="optionalText"
|
|
34
|
-
:description="description"
|
|
35
|
-
${bindings}
|
|
36
|
-
:label-for="id">
|
|
43
|
+
${makeBindings(bindingsOverrides)}
|
|
44
|
+
>
|
|
37
45
|
${template}
|
|
38
46
|
</gl-form-group>
|
|
39
47
|
`;
|
|
@@ -78,14 +86,15 @@ export const WithValidations = (_args, { argTypes }) => ({
|
|
|
78
86
|
components: { ...components, GlFormInput },
|
|
79
87
|
template: `
|
|
80
88
|
<div>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
${wrap('<gl-form-input :id="id + \'-name1\'" :state="false" />', {
|
|
90
|
+
'invalid-feedback': 'This field is required.',
|
|
91
|
+
':label-for': "id + '-name1'",
|
|
92
|
+
})}
|
|
93
|
+
${wrap('<gl-form-input :id="id + \'-name2\'" :state="true" value="Sidney Jones" />', {
|
|
94
|
+
'valid-feedback': 'This field is valid.',
|
|
95
|
+
':id': "'group2'",
|
|
96
|
+
':label-for': "id + '-name2'",
|
|
97
|
+
})}
|
|
89
98
|
</div>
|
|
90
99
|
`,
|
|
91
100
|
});
|
|
@@ -201,5 +201,42 @@ describe('GlFormTextArea', () => {
|
|
|
201
201
|
|
|
202
202
|
itUpdatesDebouncedScreenReaderText(expectedText);
|
|
203
203
|
});
|
|
204
|
+
|
|
205
|
+
describe('when `value` prop is `null`', () => {
|
|
206
|
+
const expectedText = `${characterCount} characters remaining`;
|
|
207
|
+
|
|
208
|
+
beforeEach(() => {
|
|
209
|
+
createComponent({
|
|
210
|
+
value: null,
|
|
211
|
+
characterCount,
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('displays remaining characters', () => {
|
|
216
|
+
expect(wrapper.text()).toContain(expectedText);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
itUpdatesDebouncedScreenReaderText(expectedText);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
describe('when `value` prop is updated to `null`', () => {
|
|
223
|
+
const textareaCharacterCount = 5;
|
|
224
|
+
const expectedText = `${characterCount} characters remaining`;
|
|
225
|
+
|
|
226
|
+
beforeEach(() => {
|
|
227
|
+
createComponent({
|
|
228
|
+
value: 'a'.repeat(textareaCharacterCount),
|
|
229
|
+
characterCount,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
wrapper.setProps({ value: null });
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('updates character count text', () => {
|
|
236
|
+
expect(wrapper.text()).toContain(expectedText);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
itUpdatesDebouncedScreenReaderText(expectedText);
|
|
240
|
+
});
|
|
204
241
|
});
|
|
205
242
|
});
|
|
@@ -98,7 +98,7 @@ export default {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
this.remainingCharacterCount = this.characterCount - newValue
|
|
101
|
+
this.remainingCharacterCount = this.characterCount - this.valueLength(newValue);
|
|
102
102
|
this.debouncedUpdateRemainingCharacterCountSrOnly(newValue);
|
|
103
103
|
},
|
|
104
104
|
},
|
|
@@ -111,16 +111,19 @@ export default {
|
|
|
111
111
|
);
|
|
112
112
|
},
|
|
113
113
|
methods: {
|
|
114
|
+
valueLength(value) {
|
|
115
|
+
return value?.length || 0;
|
|
116
|
+
},
|
|
114
117
|
handleKeyPress(e) {
|
|
115
118
|
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
|
|
116
119
|
this.$emit('submit');
|
|
117
120
|
}
|
|
118
121
|
},
|
|
119
122
|
updateRemainingCharacterCountSrOnly(newValue) {
|
|
120
|
-
this.remainingCharacterCountSrOnly = this.characterCount - newValue
|
|
123
|
+
this.remainingCharacterCountSrOnly = this.characterCount - this.valueLength(newValue);
|
|
121
124
|
},
|
|
122
125
|
initialRemainingCharacterCount() {
|
|
123
|
-
return this.characterCount - this.value
|
|
126
|
+
return this.characterCount - this.valueLength(this.value);
|
|
124
127
|
},
|
|
125
128
|
},
|
|
126
129
|
};
|