@gitlab/ui 38.10.2 → 39.0.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 +36 -0
- package/dist/components/base/alert/alert.js +1 -1
- package/dist/components/base/filtered_search/filtered_search.js +18 -2
- package/dist/components/base/filtered_search/filtered_search_term.js +6 -1
- package/dist/components/base/filtered_search/filtered_search_token.js +32 -4
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +36 -16
- package/dist/components/base/form/form_textarea/form_textarea.js +2 -62
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/constants.js +1 -5
- package/package.json +9 -9
- package/src/components/base/alert/alert.vue +8 -8
- package/src/components/base/filtered_search/__snapshots__/filtered_search_term.spec.js.snap +4 -4
- package/src/components/base/filtered_search/filtered_search.stories.js +8 -1
- package/src/components/base/filtered_search/filtered_search.vue +19 -0
- package/src/components/base/filtered_search/filtered_search_term.spec.js +1 -0
- package/src/components/base/filtered_search/filtered_search_term.vue +11 -1
- package/src/components/base/filtered_search/filtered_search_token.spec.js +1 -0
- package/src/components/base/filtered_search/filtered_search_token.vue +41 -1
- package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +2 -2
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +33 -12
- package/src/components/base/form/form_checkbox/form_checkbox.scss +4 -2
- package/src/components/base/form/form_textarea/form_textarea.spec.js +8 -115
- package/src/components/base/form/form_textarea/form_textarea.stories.js +0 -21
- package/src/components/base/form/form_textarea/form_textarea.vue +8 -73
- package/src/utils/constants.js +0 -5
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GlFormTextarea } from '../../../../index';
|
|
2
|
-
import { textareaCountOptions } from '../../../../utils/constants';
|
|
3
2
|
import readme from './form_textarea.md';
|
|
4
3
|
|
|
5
4
|
const template = `
|
|
@@ -8,10 +7,6 @@ const template = `
|
|
|
8
7
|
:placeholder="placeholder"
|
|
9
8
|
:rows="5"
|
|
10
9
|
:no-resize="noResize"
|
|
11
|
-
:count="count"
|
|
12
|
-
:countType="countType"
|
|
13
|
-
:character-count-text="characterCountText"
|
|
14
|
-
:character-count-over-limit-text="characterCountOverLimitText"
|
|
15
10
|
/>
|
|
16
11
|
`;
|
|
17
12
|
|
|
@@ -19,18 +14,10 @@ const generateProps = ({
|
|
|
19
14
|
model = 'We take inspiration from other companies, and we always go for the boring solutions. Just like the rest of our work, we continually adjust our values and strive always to make them better. We used to have more values, but it was difficult to remember them all, so we condensed them and gave sub-values and created an acronym. Everyone is welcome to suggest improvements.',
|
|
20
15
|
placeholder = 'hello',
|
|
21
16
|
noResize = GlFormTextarea.props.noResize.default,
|
|
22
|
-
count = 400,
|
|
23
|
-
countType = textareaCountOptions.max,
|
|
24
|
-
characterCountText = '%{count} characters left',
|
|
25
|
-
characterCountOverLimitText = '%{count} characters over limit',
|
|
26
17
|
} = {}) => ({
|
|
27
18
|
model,
|
|
28
19
|
placeholder,
|
|
29
20
|
noResize,
|
|
30
|
-
count,
|
|
31
|
-
countType,
|
|
32
|
-
characterCountText,
|
|
33
|
-
characterCountOverLimitText,
|
|
34
21
|
});
|
|
35
22
|
|
|
36
23
|
const Template = (args) => ({
|
|
@@ -54,12 +41,4 @@ export default {
|
|
|
54
41
|
},
|
|
55
42
|
},
|
|
56
43
|
},
|
|
57
|
-
argTypes: {
|
|
58
|
-
countType: {
|
|
59
|
-
control: {
|
|
60
|
-
type: 'select',
|
|
61
|
-
options: textareaCountOptions,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
44
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BFormTextarea } from 'bootstrap-vue';
|
|
3
|
-
import GlSprintf from '../../../utilities/sprintf/sprintf.vue';
|
|
4
|
-
import { textareaCountOptions } from '../../../../utils/constants';
|
|
5
3
|
|
|
6
4
|
const model = {
|
|
7
5
|
prop: 'value',
|
|
@@ -11,7 +9,6 @@ const model = {
|
|
|
11
9
|
export default {
|
|
12
10
|
components: {
|
|
13
11
|
BFormTextarea,
|
|
14
|
-
GlSprintf,
|
|
15
12
|
},
|
|
16
13
|
inheritAttrs: false,
|
|
17
14
|
model,
|
|
@@ -33,27 +30,6 @@ export default {
|
|
|
33
30
|
required: false,
|
|
34
31
|
default: false,
|
|
35
32
|
},
|
|
36
|
-
count: {
|
|
37
|
-
type: Number,
|
|
38
|
-
required: false,
|
|
39
|
-
default: 0,
|
|
40
|
-
},
|
|
41
|
-
countType: {
|
|
42
|
-
required: false,
|
|
43
|
-
type: String,
|
|
44
|
-
default: textareaCountOptions.max,
|
|
45
|
-
validator: (value) => Object.keys(textareaCountOptions).includes(value),
|
|
46
|
-
},
|
|
47
|
-
characterCountText: {
|
|
48
|
-
required: false,
|
|
49
|
-
type: String,
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
characterCountOverLimitText: {
|
|
53
|
-
required: false,
|
|
54
|
-
type: String,
|
|
55
|
-
default: '',
|
|
56
|
-
},
|
|
57
33
|
},
|
|
58
34
|
computed: {
|
|
59
35
|
listeners() {
|
|
@@ -80,37 +56,6 @@ export default {
|
|
|
80
56
|
keypressEvent() {
|
|
81
57
|
return this.submitOnEnter ? 'keyup' : null;
|
|
82
58
|
},
|
|
83
|
-
characters() {
|
|
84
|
-
return this.value.length;
|
|
85
|
-
},
|
|
86
|
-
remainingCharacters() {
|
|
87
|
-
if (this.count) {
|
|
88
|
-
return Math.abs(this.count - this.characters);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return null;
|
|
92
|
-
},
|
|
93
|
-
characterCountClasses() {
|
|
94
|
-
switch (this.countType) {
|
|
95
|
-
case textareaCountOptions.max:
|
|
96
|
-
return {
|
|
97
|
-
'gl-text-red-500': this.value.length > this.count,
|
|
98
|
-
'gl-text-gray-500': this.value.length <= this.count,
|
|
99
|
-
};
|
|
100
|
-
case textareaCountOptions.recommended:
|
|
101
|
-
return 'gl-text-gray-500';
|
|
102
|
-
default:
|
|
103
|
-
return {};
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
hasCount() {
|
|
107
|
-
return this.remainingCharacters != null;
|
|
108
|
-
},
|
|
109
|
-
characterCountMessage() {
|
|
110
|
-
return this.characters > this.count
|
|
111
|
-
? this.characterCountOverLimitText
|
|
112
|
-
: this.characterCountText;
|
|
113
|
-
},
|
|
114
59
|
},
|
|
115
60
|
methods: {
|
|
116
61
|
handleKeyPress(e) {
|
|
@@ -123,22 +68,12 @@ export default {
|
|
|
123
68
|
</script>
|
|
124
69
|
|
|
125
70
|
<template>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
@[keypressEvent].native="handleKeyPress"
|
|
135
|
-
/>
|
|
136
|
-
<div v-if="hasCount">
|
|
137
|
-
<small :class="characterCountClasses" aria-live="polite">
|
|
138
|
-
<gl-sprintf :message="characterCountMessage">
|
|
139
|
-
<template #count>{{ remainingCharacters }}</template>
|
|
140
|
-
</gl-sprintf>
|
|
141
|
-
</small>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
71
|
+
<b-form-textarea
|
|
72
|
+
class="gl-form-input gl-form-textarea"
|
|
73
|
+
:no-resize="noResize"
|
|
74
|
+
v-bind="$attrs"
|
|
75
|
+
:value="value"
|
|
76
|
+
v-on="listeners"
|
|
77
|
+
@[keypressEvent].native="handleKeyPress"
|
|
78
|
+
/>
|
|
144
79
|
</template>
|