@gitlab/ui 38.8.0 → 38.9.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 +26 -0
- package/dist/components/base/form/form_textarea/form_textarea.js +62 -2
- package/dist/components/base/label/label.js +1 -1
- package/dist/components/charts/series_label/series_label.js +1 -6
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utils/constants.js +7 -2
- package/package.json +1 -2
- package/src/components/base/accordion/accordion.stories.js +2 -4
- package/src/components/base/accordion/accordion_item.stories.js +2 -4
- package/src/components/base/alert/alert.stories.js +2 -4
- package/src/components/base/avatar/avatar.stories.js +3 -9
- package/src/components/base/avatar_labeled/avatar_labeled.stories.js +6 -12
- package/src/components/base/avatar_link/avatar_link.stories.js +2 -6
- package/src/components/base/avatars_inline/avatars_inline.stories.js +2 -4
- package/src/components/base/badge/badge.scss +10 -0
- package/src/components/base/badge/badge.stories.js +3 -9
- package/src/components/base/banner/banner.stories.js +1 -3
- package/src/components/base/broadcast_message/broadcast_message.stories.js +4 -8
- package/src/components/base/button/button.stories.js +8 -16
- package/src/components/base/datepicker/datepicker.stories.js +2 -2
- package/src/components/base/daterange_picker/daterange_picker.stories.js +2 -6
- package/src/components/base/dropdown/dropdown.stories.js +4 -12
- package/src/components/base/dropdown/dropdown_item.stories.js +2 -6
- package/src/components/base/form/form_group/form_group.stories.js +1 -1
- package/src/components/base/form/form_input/form_input.stories.js +1 -3
- package/src/components/base/form/form_input_group/form_input_group.stories.js +4 -12
- package/src/components/base/form/form_radio/form_radio.stories.js +1 -3
- package/src/components/base/form/form_select/form_select.stories.js +4 -8
- package/src/components/base/form/form_textarea/form_textarea.spec.js +115 -8
- package/src/components/base/form/form_textarea/form_textarea.stories.js +21 -0
- package/src/components/base/form/form_textarea/form_textarea.vue +73 -8
- package/src/components/base/icon/icon.stories.js +4 -8
- package/src/components/base/label/label.stories.js +2 -6
- package/src/components/base/label/label.vue +3 -10
- package/src/components/base/link/link.stories.js +2 -4
- package/src/components/base/loading_icon/loading_icon.stories.js +4 -8
- package/src/components/base/modal/modal.stories.js +16 -32
- package/src/components/base/path/path.stories.js +2 -6
- package/src/components/base/popover/popover.stories.js +2 -4
- package/src/components/base/progress_bar/progress_bar.stories.js +2 -4
- package/src/components/base/search_box_by_click/search_box_by_click.stories.js +1 -3
- package/src/components/base/segmented_control/segmented_control.stories.js +1 -3
- package/src/components/base/skeleton_loading/skeleton_loading.stories.js +2 -4
- package/src/components/base/table/table.stories.js +2 -4
- package/src/components/base/toggle/toggle.stories.js +4 -10
- package/src/components/base/token/token.stories.js +2 -4
- package/src/components/base/token_selector/token_selector.stories.js +2 -4
- package/src/components/charts/series_label/series_label.stories.js +3 -6
- package/src/components/charts/series_label/series_label.vue +0 -3
- package/src/components/charts/single_stat/single_stat.stories.js +1 -3
- package/src/directives/resize_observer/resize_observer.stories.js +1 -3
- package/src/utils/constants.js +6 -0
- package/documentation/documented_stories.js +0 -215
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GlFormTextarea } from '../../../../index';
|
|
2
|
+
import { textareaCountOptions } from '../../../../utils/constants';
|
|
2
3
|
import readme from './form_textarea.md';
|
|
3
4
|
|
|
4
5
|
const template = `
|
|
@@ -7,6 +8,10 @@ const template = `
|
|
|
7
8
|
:placeholder="placeholder"
|
|
8
9
|
:rows="5"
|
|
9
10
|
:no-resize="noResize"
|
|
11
|
+
:count="count"
|
|
12
|
+
:countType="countType"
|
|
13
|
+
:character-count-text="characterCountText"
|
|
14
|
+
:character-count-over-limit-text="characterCountOverLimitText"
|
|
10
15
|
/>
|
|
11
16
|
`;
|
|
12
17
|
|
|
@@ -14,10 +19,18 @@ const generateProps = ({
|
|
|
14
19
|
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.',
|
|
15
20
|
placeholder = 'hello',
|
|
16
21
|
noResize = GlFormTextarea.props.noResize.default,
|
|
22
|
+
count = 400,
|
|
23
|
+
countType = textareaCountOptions.max,
|
|
24
|
+
characterCountText = '%{count} characters left',
|
|
25
|
+
characterCountOverLimitText = '%{count} characters over limit',
|
|
17
26
|
} = {}) => ({
|
|
18
27
|
model,
|
|
19
28
|
placeholder,
|
|
20
29
|
noResize,
|
|
30
|
+
count,
|
|
31
|
+
countType,
|
|
32
|
+
characterCountText,
|
|
33
|
+
characterCountOverLimitText,
|
|
21
34
|
});
|
|
22
35
|
|
|
23
36
|
const Template = (args) => ({
|
|
@@ -41,4 +54,12 @@ export default {
|
|
|
41
54
|
},
|
|
42
55
|
},
|
|
43
56
|
},
|
|
57
|
+
argTypes: {
|
|
58
|
+
countType: {
|
|
59
|
+
control: {
|
|
60
|
+
type: 'select',
|
|
61
|
+
options: textareaCountOptions,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
44
65
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BFormTextarea } from 'bootstrap-vue';
|
|
3
|
+
import GlSprintf from '../../../utilities/sprintf/sprintf.vue';
|
|
4
|
+
import { textareaCountOptions } from '../../../../utils/constants';
|
|
3
5
|
|
|
4
6
|
const model = {
|
|
5
7
|
prop: 'value',
|
|
@@ -9,6 +11,7 @@ const model = {
|
|
|
9
11
|
export default {
|
|
10
12
|
components: {
|
|
11
13
|
BFormTextarea,
|
|
14
|
+
GlSprintf,
|
|
12
15
|
},
|
|
13
16
|
inheritAttrs: false,
|
|
14
17
|
model,
|
|
@@ -30,6 +33,27 @@ export default {
|
|
|
30
33
|
required: false,
|
|
31
34
|
default: false,
|
|
32
35
|
},
|
|
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
|
+
},
|
|
33
57
|
},
|
|
34
58
|
computed: {
|
|
35
59
|
listeners() {
|
|
@@ -56,6 +80,37 @@ export default {
|
|
|
56
80
|
keypressEvent() {
|
|
57
81
|
return this.submitOnEnter ? 'keyup' : null;
|
|
58
82
|
},
|
|
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
|
+
},
|
|
59
114
|
},
|
|
60
115
|
methods: {
|
|
61
116
|
handleKeyPress(e) {
|
|
@@ -68,12 +123,22 @@ export default {
|
|
|
68
123
|
</script>
|
|
69
124
|
|
|
70
125
|
<template>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
126
|
+
<div>
|
|
127
|
+
<b-form-textarea
|
|
128
|
+
ref="textarea"
|
|
129
|
+
class="gl-form-input gl-form-textarea"
|
|
130
|
+
:no-resize="noResize"
|
|
131
|
+
v-bind="$attrs"
|
|
132
|
+
:value="value"
|
|
133
|
+
v-on="listeners"
|
|
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>
|
|
79
144
|
</template>
|
|
@@ -44,16 +44,12 @@ export default {
|
|
|
44
44
|
argTypes: {
|
|
45
45
|
...disableControls(['useDeprecatedSizes']),
|
|
46
46
|
name: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
options: iconSpriteInfo.icons,
|
|
50
|
-
},
|
|
47
|
+
options: iconSpriteInfo.icons,
|
|
48
|
+
control: 'select',
|
|
51
49
|
},
|
|
52
50
|
size: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
options: iconSizeOptions,
|
|
56
|
-
},
|
|
51
|
+
options: iconSizeOptions,
|
|
52
|
+
control: 'select',
|
|
57
53
|
},
|
|
58
54
|
},
|
|
59
55
|
};
|
|
@@ -67,18 +67,14 @@ export default {
|
|
|
67
67
|
},
|
|
68
68
|
argTypes: {
|
|
69
69
|
backgroundColor: {
|
|
70
|
-
control:
|
|
71
|
-
type: 'color',
|
|
72
|
-
},
|
|
70
|
+
control: 'color',
|
|
73
71
|
},
|
|
74
72
|
size: {
|
|
75
73
|
options: labelSizeOptions,
|
|
76
74
|
},
|
|
77
75
|
tooltipPlacement: {
|
|
78
76
|
options: tooltipPlacements,
|
|
79
|
-
control:
|
|
80
|
-
type: 'select',
|
|
81
|
-
},
|
|
77
|
+
control: 'select',
|
|
82
78
|
},
|
|
83
79
|
},
|
|
84
80
|
};
|
|
@@ -120,15 +120,8 @@ export default {
|
|
|
120
120
|
</script>
|
|
121
121
|
|
|
122
122
|
<template>
|
|
123
|
-
<span
|
|
124
|
-
ref="labelTitle"
|
|
125
|
-
class="gl-label"
|
|
126
|
-
:class="cssClasses"
|
|
127
|
-
:style="cssVariables"
|
|
128
|
-
v-bind="$attrs"
|
|
129
|
-
@click="onClick"
|
|
130
|
-
>
|
|
131
|
-
<gl-link :href="target" class="gl-label-link">
|
|
123
|
+
<span class="gl-label" :class="cssClasses" :style="cssVariables" v-bind="$attrs" @click="onClick">
|
|
124
|
+
<gl-link ref="labelTitle" :href="target" class="gl-label-link">
|
|
132
125
|
<span class="gl-label-text">
|
|
133
126
|
{{ scopedKey }}
|
|
134
127
|
</span>
|
|
@@ -146,7 +139,7 @@ export default {
|
|
|
146
139
|
/>
|
|
147
140
|
<gl-tooltip
|
|
148
141
|
v-if="description"
|
|
149
|
-
:target="() => $refs.labelTitle"
|
|
142
|
+
:target="() => $refs.labelTitle.$el"
|
|
150
143
|
:placement="tooltipPlacement"
|
|
151
144
|
boundary="viewport"
|
|
152
145
|
>
|
|
@@ -46,16 +46,12 @@ export default {
|
|
|
46
46
|
},
|
|
47
47
|
argTypes: {
|
|
48
48
|
color: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
options: viewModeOptions,
|
|
52
|
-
},
|
|
49
|
+
options: viewModeOptions,
|
|
50
|
+
control: 'select',
|
|
53
51
|
},
|
|
54
52
|
size: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
options: loadingIconSizes,
|
|
58
|
-
},
|
|
53
|
+
options: loadingIconSizes,
|
|
54
|
+
control: 'select',
|
|
59
55
|
},
|
|
60
56
|
},
|
|
61
57
|
};
|
|
@@ -115,52 +115,36 @@ export default {
|
|
|
115
115
|
},
|
|
116
116
|
argTypes: {
|
|
117
117
|
headerBgVariant: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
options: variantOptionsWithNoDefault,
|
|
121
|
-
},
|
|
118
|
+
options: variantOptionsWithNoDefault,
|
|
119
|
+
control: 'select',
|
|
122
120
|
},
|
|
123
121
|
headerBorderVariant: {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
options: variantOptionsWithNoDefault,
|
|
127
|
-
},
|
|
122
|
+
options: variantOptionsWithNoDefault,
|
|
123
|
+
control: 'select',
|
|
128
124
|
},
|
|
129
125
|
headerTextVariant: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
options: variantOptionsWithNoDefault,
|
|
133
|
-
},
|
|
126
|
+
options: variantOptionsWithNoDefault,
|
|
127
|
+
control: 'select',
|
|
134
128
|
},
|
|
135
129
|
bodyBgVariant: {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
options: variantOptionsWithNoDefault,
|
|
139
|
-
},
|
|
130
|
+
options: variantOptionsWithNoDefault,
|
|
131
|
+
control: 'select',
|
|
140
132
|
},
|
|
141
133
|
bodyTextVariant: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
options: variantOptionsWithNoDefault,
|
|
145
|
-
},
|
|
134
|
+
options: variantOptionsWithNoDefault,
|
|
135
|
+
control: 'select',
|
|
146
136
|
},
|
|
147
137
|
footerBgVariant: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
options: variantOptionsWithNoDefault,
|
|
151
|
-
},
|
|
138
|
+
options: variantOptionsWithNoDefault,
|
|
139
|
+
control: 'select',
|
|
152
140
|
},
|
|
153
141
|
footerBorderVariant: {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
options: variantOptionsWithNoDefault,
|
|
157
|
-
},
|
|
142
|
+
options: variantOptionsWithNoDefault,
|
|
143
|
+
control: 'select',
|
|
158
144
|
},
|
|
159
145
|
footerTextVariant: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
options: variantOptionsWithNoDefault,
|
|
163
|
-
},
|
|
146
|
+
options: variantOptionsWithNoDefault,
|
|
147
|
+
control: 'select',
|
|
164
148
|
},
|
|
165
149
|
},
|
|
166
150
|
};
|
|
@@ -107,10 +107,8 @@ export default {
|
|
|
107
107
|
},
|
|
108
108
|
argTypes: {
|
|
109
109
|
stacked: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
options: ['sm', 'md', 'lg', 'xl', true, false],
|
|
113
|
-
},
|
|
110
|
+
options: ['sm', 'md', 'lg', 'xl', true, false],
|
|
111
|
+
control: 'select',
|
|
114
112
|
},
|
|
115
113
|
},
|
|
116
114
|
};
|
|
@@ -56,20 +56,14 @@ export default {
|
|
|
56
56
|
argTypes: {
|
|
57
57
|
...disableControls(['name']),
|
|
58
58
|
labelPosition: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
options: toggleLabelPosition,
|
|
62
|
-
},
|
|
59
|
+
options: toggleLabelPosition,
|
|
60
|
+
control: 'select',
|
|
63
61
|
},
|
|
64
62
|
label: {
|
|
65
|
-
control:
|
|
66
|
-
type: 'text',
|
|
67
|
-
},
|
|
63
|
+
control: 'text',
|
|
68
64
|
},
|
|
69
65
|
help: {
|
|
70
|
-
control:
|
|
71
|
-
type: 'text',
|
|
72
|
-
},
|
|
66
|
+
control: 'text',
|
|
73
67
|
},
|
|
74
68
|
},
|
|
75
69
|
};
|
|
@@ -35,13 +35,14 @@ const Template = (_args, { argTypes }) => ({
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
export const Default = Template.bind({});
|
|
38
|
-
Default.args = generateProps();
|
|
38
|
+
Default.args = generateProps({ color: '' });
|
|
39
39
|
|
|
40
40
|
export const WithLongName = Template.bind({});
|
|
41
|
-
WithLongName.args = generateProps({ text: SERIES_NAME[SERIES_NAME_LONG] });
|
|
41
|
+
WithLongName.args = generateProps({ color: '', text: SERIES_NAME[SERIES_NAME_LONG] });
|
|
42
42
|
|
|
43
43
|
export const WithLongNameWithNoSpaces = Template.bind({});
|
|
44
44
|
WithLongNameWithNoSpaces.args = generateProps({
|
|
45
|
+
color: '',
|
|
45
46
|
text: SERIES_NAME[SERIES_NAME_LONG_WITHOUT_SPACES],
|
|
46
47
|
});
|
|
47
48
|
|
|
@@ -71,10 +72,6 @@ export default {
|
|
|
71
72
|
},
|
|
72
73
|
},
|
|
73
74
|
argTypes: {
|
|
74
|
-
type: {
|
|
75
|
-
control: 'select',
|
|
76
|
-
options: ['solid', 'dashed'],
|
|
77
|
-
},
|
|
78
75
|
color: {
|
|
79
76
|
control: 'color',
|
|
80
77
|
},
|
package/src/utils/constants.js
CHANGED
|
@@ -37,6 +37,7 @@ export const badgeVariantOptions = {
|
|
|
37
37
|
success: 'success',
|
|
38
38
|
warning: 'warning',
|
|
39
39
|
danger: 'danger',
|
|
40
|
+
tier: 'tier',
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
export const variantCssColorMap = {
|
|
@@ -297,3 +298,8 @@ export const loadingIconSizes = {
|
|
|
297
298
|
'lg (32x32)': 'lg',
|
|
298
299
|
'xl (64x64)': 'xl',
|
|
299
300
|
};
|
|
301
|
+
|
|
302
|
+
export const textareaCountOptions = {
|
|
303
|
+
max: 'max',
|
|
304
|
+
recommended: 'recommended',
|
|
305
|
+
};
|