@gitlab/ui 132.2.2 → 134.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/dist/components/base/broadcast_message/broadcast_message.js +3 -3
- package/dist/components/base/form/form_input/form_input.js +2 -60
- package/dist/components/base/form/form_textarea/form_textarea.js +421 -45
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +1 -145
- package/dist/tokens/build/js/tokens.js +1 -145
- package/dist/utils/constants.js +12 -12
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -2
- package/package.json +1 -1
- package/src/components/base/broadcast_message/broadcast_message.vue +3 -3
- package/src/components/base/form/form_input/form_input.vue +2 -60
- package/src/components/base/form/form_textarea/form_textarea.vue +462 -49
- package/src/tokens/build/css/tokens.css +16 -160
- package/src/tokens/build/css/tokens.dark.css +16 -160
- package/src/tokens/build/docs/tokens-tailwind-docs.dark.json +15293 -26883
- package/src/tokens/build/docs/tokens-tailwind-docs.json +15293 -26883
- package/src/tokens/build/figma/constants.dark.json +0 -1152
- package/src/tokens/build/figma/constants.json +0 -1152
- package/src/tokens/build/figma/mode.dark.json +160 -16
- package/src/tokens/build/figma/mode.json +160 -16
- package/src/tokens/build/js/tokens.dark.js +0 -144
- package/src/tokens/build/js/tokens.js +0 -144
- package/src/tokens/build/json/tokens.dark.json +15296 -19354
- package/src/tokens/build/json/tokens.json +15173 -19231
- package/src/tokens/build/scss/_tokens.dark.scss +16 -160
- package/src/tokens/build/scss/_tokens.scss +16 -160
- package/src/tokens/build/scss/_tokens_custom_properties.scss +0 -144
- package/src/tokens/build/tailwind/tokens.cjs +0 -75
- package/src/tokens/contextual/broadcast.tokens.json +160 -16
- package/src/utils/constants.js +11 -11
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -1
- package/tailwind.defaults.js +0 -2
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +0 -233
- package/dist/vendor/bootstrap-vue/src/components/form-textarea/index.js +0 -1
- package/dist/vendor/bootstrap-vue/src/mixins/form-selection.js +0 -62
- package/dist/vendor/bootstrap-vue/src/mixins/form-text.js +0 -279
- package/dist/vendor/bootstrap-vue/src/mixins/form-validity.js +0 -50
- package/src/tokens/constant/color.theme.tokens.json +0 -1168
- package/src/tokens/deprecated/deprecated.color.theme.tokens.json +0 -2248
- package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +0 -241
- package/src/vendor/bootstrap-vue/src/components/form-textarea/index.js +0 -3
- package/src/vendor/bootstrap-vue/src/mixins/form-selection.js +0 -60
- package/src/vendor/bootstrap-vue/src/mixins/form-text.js +0 -280
- package/src/vendor/bootstrap-vue/src/mixins/form-validity.js +0 -48
|
@@ -4,7 +4,16 @@
|
|
|
4
4
|
"background": {
|
|
5
5
|
"color": {
|
|
6
6
|
"blue": {
|
|
7
|
-
"$value":
|
|
7
|
+
"$value": {
|
|
8
|
+
"colorSpace": "srgb",
|
|
9
|
+
"components": [
|
|
10
|
+
0.13725490196078433,
|
|
11
|
+
0.3176470588235294,
|
|
12
|
+
0.5019607843137255
|
|
13
|
+
],
|
|
14
|
+
"alpha": 1,
|
|
15
|
+
"hex": "#235180"
|
|
16
|
+
},
|
|
8
17
|
"$type": "color",
|
|
9
18
|
"$description": "Used for the background for the blue banner type.",
|
|
10
19
|
"$extensions": {
|
|
@@ -26,7 +35,16 @@
|
|
|
26
35
|
}
|
|
27
36
|
},
|
|
28
37
|
"green": {
|
|
29
|
-
"$value":
|
|
38
|
+
"$value": {
|
|
39
|
+
"colorSpace": "srgb",
|
|
40
|
+
"components": [
|
|
41
|
+
0.10588235294117647,
|
|
42
|
+
0.396078431372549,
|
|
43
|
+
0.24705882352941178
|
|
44
|
+
],
|
|
45
|
+
"alpha": 1,
|
|
46
|
+
"hex": "#1b653f"
|
|
47
|
+
},
|
|
30
48
|
"$type": "color",
|
|
31
49
|
"$description": "Used for the background for the green banner type.",
|
|
32
50
|
"$extensions": {
|
|
@@ -37,7 +55,16 @@
|
|
|
37
55
|
}
|
|
38
56
|
},
|
|
39
57
|
"indigo": {
|
|
40
|
-
"$value":
|
|
58
|
+
"$value": {
|
|
59
|
+
"colorSpace": "srgb",
|
|
60
|
+
"components": [
|
|
61
|
+
0.2549019607843137,
|
|
62
|
+
0.2549019607843137,
|
|
63
|
+
0.6235294117647059
|
|
64
|
+
],
|
|
65
|
+
"alpha": 1,
|
|
66
|
+
"hex": "#41419f"
|
|
67
|
+
},
|
|
41
68
|
"$type": "color",
|
|
42
69
|
"$description": "Used for the background for the indigo banner type.",
|
|
43
70
|
"$extensions": {
|
|
@@ -59,7 +86,16 @@
|
|
|
59
86
|
}
|
|
60
87
|
},
|
|
61
88
|
"lightblue": {
|
|
62
|
-
"$value":
|
|
89
|
+
"$value": {
|
|
90
|
+
"colorSpace": "srgb",
|
|
91
|
+
"components": [
|
|
92
|
+
0.28627450980392155,
|
|
93
|
+
0.4666666666666667,
|
|
94
|
+
0.6470588235294118
|
|
95
|
+
],
|
|
96
|
+
"alpha": 1,
|
|
97
|
+
"hex": "#4977a5"
|
|
98
|
+
},
|
|
63
99
|
"$type": "color",
|
|
64
100
|
"$description": "Used for the background for the lightblue banner type.",
|
|
65
101
|
"$extensions": {
|
|
@@ -70,7 +106,16 @@
|
|
|
70
106
|
}
|
|
71
107
|
},
|
|
72
108
|
"lightgreen": {
|
|
73
|
-
"$value":
|
|
109
|
+
"$value": {
|
|
110
|
+
"colorSpace": "srgb",
|
|
111
|
+
"components": [
|
|
112
|
+
0.18823529411764706,
|
|
113
|
+
0.5098039215686274,
|
|
114
|
+
0.34509803921568627
|
|
115
|
+
],
|
|
116
|
+
"alpha": 1,
|
|
117
|
+
"hex": "#308258"
|
|
118
|
+
},
|
|
74
119
|
"$type": "color",
|
|
75
120
|
"$description": "Used for the background for the lightgreen banner type.",
|
|
76
121
|
"$extensions": {
|
|
@@ -81,7 +126,16 @@
|
|
|
81
126
|
}
|
|
82
127
|
},
|
|
83
128
|
"lightindigo": {
|
|
84
|
-
"$value":
|
|
129
|
+
"$value": {
|
|
130
|
+
"colorSpace": "srgb",
|
|
131
|
+
"components": [
|
|
132
|
+
0.4,
|
|
133
|
+
0.4,
|
|
134
|
+
0.7686274509803922
|
|
135
|
+
],
|
|
136
|
+
"alpha": 1,
|
|
137
|
+
"hex": "#6666c4"
|
|
138
|
+
},
|
|
85
139
|
"$type": "color",
|
|
86
140
|
"$description": "Used for the background for the lightindigo banner type.",
|
|
87
141
|
"$extensions": {
|
|
@@ -92,7 +146,16 @@
|
|
|
92
146
|
}
|
|
93
147
|
},
|
|
94
148
|
"lightred": {
|
|
95
|
-
"$value":
|
|
149
|
+
"$value":{
|
|
150
|
+
"colorSpace": "srgb",
|
|
151
|
+
"components": [
|
|
152
|
+
0.6784313725490196,
|
|
153
|
+
0.2901960784313726,
|
|
154
|
+
0.23137254901960785
|
|
155
|
+
],
|
|
156
|
+
"alpha": 1,
|
|
157
|
+
"hex": "#ad4a3b"
|
|
158
|
+
},
|
|
96
159
|
"$type": "color",
|
|
97
160
|
"$description": "Used for the background for the lightred banner type.",
|
|
98
161
|
"$extensions": {
|
|
@@ -103,7 +166,16 @@
|
|
|
103
166
|
}
|
|
104
167
|
},
|
|
105
168
|
"red": {
|
|
106
|
-
"$value":
|
|
169
|
+
"$value": {
|
|
170
|
+
"colorSpace": "srgb",
|
|
171
|
+
"components": [
|
|
172
|
+
0.5607843137254902,
|
|
173
|
+
0.12941176470588237,
|
|
174
|
+
0.06274509803921569
|
|
175
|
+
],
|
|
176
|
+
"alpha": 1,
|
|
177
|
+
"hex": "#8f2110"
|
|
178
|
+
},
|
|
107
179
|
"$type": "color",
|
|
108
180
|
"$description": "Used for the background for the red banner type.",
|
|
109
181
|
"$extensions": {
|
|
@@ -118,7 +190,16 @@
|
|
|
118
190
|
"border": {
|
|
119
191
|
"color": {
|
|
120
192
|
"blue": {
|
|
121
|
-
"$value":
|
|
193
|
+
"$value": {
|
|
194
|
+
"colorSpace": "srgb",
|
|
195
|
+
"components": [
|
|
196
|
+
0.043137254901960784,
|
|
197
|
+
0.14901960784313725,
|
|
198
|
+
0.25098039215686274
|
|
199
|
+
],
|
|
200
|
+
"alpha": 1,
|
|
201
|
+
"hex": "#0b2640"
|
|
202
|
+
},
|
|
122
203
|
"$type": "color",
|
|
123
204
|
"$description": "Used for the border for the blue banner type.",
|
|
124
205
|
"$extensions": {
|
|
@@ -138,7 +219,16 @@
|
|
|
138
219
|
}
|
|
139
220
|
},
|
|
140
221
|
"green": {
|
|
141
|
-
"$value":
|
|
222
|
+
"$value": {
|
|
223
|
+
"colorSpace": "srgb",
|
|
224
|
+
"components": [
|
|
225
|
+
0.054901960784313725,
|
|
226
|
+
0.2627450980392157,
|
|
227
|
+
0.1568627450980392
|
|
228
|
+
],
|
|
229
|
+
"alpha": 1,
|
|
230
|
+
"hex": "#0e4328"
|
|
231
|
+
},
|
|
142
232
|
"$type": "color",
|
|
143
233
|
"$description": "Used for the border for the green banner type.",
|
|
144
234
|
"$extensions": {
|
|
@@ -148,7 +238,16 @@
|
|
|
148
238
|
}
|
|
149
239
|
},
|
|
150
240
|
"indigo": {
|
|
151
|
-
"$value":
|
|
241
|
+
"$value": {
|
|
242
|
+
"colorSpace": "srgb",
|
|
243
|
+
"components": [
|
|
244
|
+
0.13333333333333333,
|
|
245
|
+
0.13333333333333333,
|
|
246
|
+
0.3803921568627451
|
|
247
|
+
],
|
|
248
|
+
"alpha": 1,
|
|
249
|
+
"hex": "#222261"
|
|
250
|
+
},
|
|
152
251
|
"$type": "color",
|
|
153
252
|
"$description": "Used for the border for the indigo banner type.",
|
|
154
253
|
"$extensions": {
|
|
@@ -168,7 +267,16 @@
|
|
|
168
267
|
}
|
|
169
268
|
},
|
|
170
269
|
"lightblue": {
|
|
171
|
-
"$value":
|
|
270
|
+
"$value": {
|
|
271
|
+
"colorSpace": "srgb",
|
|
272
|
+
"components": [
|
|
273
|
+
0.13725490196078433,
|
|
274
|
+
0.3176470588235294,
|
|
275
|
+
0.5019607843137255
|
|
276
|
+
],
|
|
277
|
+
"alpha": 1,
|
|
278
|
+
"hex": "#235180"
|
|
279
|
+
},
|
|
172
280
|
"$type": "color",
|
|
173
281
|
"$description": "Used for the border for the lightblue banner type.",
|
|
174
282
|
"$extensions": {
|
|
@@ -178,7 +286,16 @@
|
|
|
178
286
|
}
|
|
179
287
|
},
|
|
180
288
|
"lightgreen": {
|
|
181
|
-
"$value":
|
|
289
|
+
"$value": {
|
|
290
|
+
"colorSpace": "srgb",
|
|
291
|
+
"components": [
|
|
292
|
+
0.10588235294117647,
|
|
293
|
+
0.396078431372549,
|
|
294
|
+
0.24705882352941178
|
|
295
|
+
],
|
|
296
|
+
"alpha": 1,
|
|
297
|
+
"hex": "#1b653f"
|
|
298
|
+
},
|
|
182
299
|
"$type": "color",
|
|
183
300
|
"$description": "Used for the border for the lightgreen banner type.",
|
|
184
301
|
"$extensions": {
|
|
@@ -188,7 +305,16 @@
|
|
|
188
305
|
}
|
|
189
306
|
},
|
|
190
307
|
"lightindigo": {
|
|
191
|
-
"$value":
|
|
308
|
+
"$value": {
|
|
309
|
+
"colorSpace": "srgb",
|
|
310
|
+
"components": [
|
|
311
|
+
0.2549019607843137,
|
|
312
|
+
0.2549019607843137,
|
|
313
|
+
0.6235294117647059
|
|
314
|
+
],
|
|
315
|
+
"alpha": 1,
|
|
316
|
+
"hex": "#41419f"
|
|
317
|
+
},
|
|
192
318
|
"$type": "color",
|
|
193
319
|
"$description": "Used for the border for the lightindigo banner type.",
|
|
194
320
|
"$extensions": {
|
|
@@ -198,7 +324,16 @@
|
|
|
198
324
|
}
|
|
199
325
|
},
|
|
200
326
|
"lightred": {
|
|
201
|
-
"$value":
|
|
327
|
+
"$value": {
|
|
328
|
+
"colorSpace": "srgb",
|
|
329
|
+
"components": [
|
|
330
|
+
0.5607843137254902,
|
|
331
|
+
0.12941176470588237,
|
|
332
|
+
0.06274509803921569
|
|
333
|
+
],
|
|
334
|
+
"alpha": 1,
|
|
335
|
+
"hex": "#8f2110"
|
|
336
|
+
},
|
|
202
337
|
"$type": "color",
|
|
203
338
|
"$description": "Used for the border for the lightred banner type.",
|
|
204
339
|
"$extensions": {
|
|
@@ -208,7 +343,16 @@
|
|
|
208
343
|
}
|
|
209
344
|
},
|
|
210
345
|
"red": {
|
|
211
|
-
"$value":
|
|
346
|
+
"$value": {
|
|
347
|
+
"colorSpace": "srgb",
|
|
348
|
+
"components": [
|
|
349
|
+
0.34509803921568627,
|
|
350
|
+
0.050980392156862744,
|
|
351
|
+
0.00784313725490196
|
|
352
|
+
],
|
|
353
|
+
"alpha": 1,
|
|
354
|
+
"hex": "#580d02"
|
|
355
|
+
},
|
|
212
356
|
"$type": "color",
|
|
213
357
|
"$description": "Used for the border for the red banner type.",
|
|
214
358
|
"$extensions": {
|
package/src/utils/constants.js
CHANGED
|
@@ -276,17 +276,17 @@ export const alertVariantIconMap = {
|
|
|
276
276
|
tip: 'bulb',
|
|
277
277
|
};
|
|
278
278
|
|
|
279
|
-
export const
|
|
280
|
-
indigo: '
|
|
281
|
-
'light-indigo': '
|
|
282
|
-
blue: '
|
|
283
|
-
'light-blue': '
|
|
284
|
-
green: '
|
|
285
|
-
'light-green': '
|
|
286
|
-
red: '
|
|
287
|
-
'light-red': '
|
|
288
|
-
dark: '
|
|
289
|
-
light: '
|
|
279
|
+
export const broadcastMessageThemes = {
|
|
280
|
+
indigo: 'indigo',
|
|
281
|
+
'light-indigo': 'light-indigo',
|
|
282
|
+
blue: 'blue',
|
|
283
|
+
'light-blue': 'light-blue',
|
|
284
|
+
green: 'green',
|
|
285
|
+
'light-green': 'light-green',
|
|
286
|
+
red: 'red',
|
|
287
|
+
'light-red': 'light-red',
|
|
288
|
+
dark: 'dark',
|
|
289
|
+
light: 'light',
|
|
290
290
|
};
|
|
291
291
|
|
|
292
292
|
export const modalButtonDefaults = {
|
|
@@ -18,7 +18,6 @@ export const NAME_FORM_SELECT = 'BFormSelect'
|
|
|
18
18
|
export const NAME_FORM_SELECT_OPTION = 'BFormSelectOption'
|
|
19
19
|
export const NAME_FORM_SELECT_OPTION_GROUP = 'BFormSelectOptionGroup'
|
|
20
20
|
export const NAME_FORM_TEXT = 'BFormText'
|
|
21
|
-
export const NAME_FORM_TEXTAREA = 'BFormTextarea'
|
|
22
21
|
export const NAME_FORM_VALID_FEEDBACK = 'BFormValidFeedback'
|
|
23
22
|
export const NAME_LINK = 'BLink'
|
|
24
23
|
export const NAME_MODAL = 'BModal'
|
package/tailwind.defaults.js
CHANGED
|
@@ -309,8 +309,6 @@ module.exports = {
|
|
|
309
309
|
'inner-b-1-border-default':
|
|
310
310
|
'inset 0 -1px 0 0 var(--gl-border-color-default, var(--gl-color-neutral-100, #dcdcde))',
|
|
311
311
|
'inner-b-2-blue-500': 'inset 0 -2px 0 0 var(--blue-500, #1f75cb)',
|
|
312
|
-
'inner-b-2-theme-accent':
|
|
313
|
-
'inset 0 -2px 0 0 var(--gl-theme-accent, var(--theme-indigo-500, #6666c4))',
|
|
314
312
|
'inner-l-3-red-600': 'inset 3px 0 0 0 var(--red-600, #c91c00)',
|
|
315
313
|
'inner-l-4-gray-100': 'inset 4px 0 0 0 var(--gray-100, #dcdcde)',
|
|
316
314
|
'x0-y0-b3-s1-blue-500': 'inset 0 0 3px 1px var(--blue-500, #1f75cb)',
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { extend } from '../../vue';
|
|
2
|
-
import { NAME_FORM_TEXTAREA } from '../../constants/components';
|
|
3
|
-
import { requestAF, isVisible, getCS, getStyle, setStyle } from '../../utils/dom';
|
|
4
|
-
import { isNull } from '../../utils/inspect';
|
|
5
|
-
import { mathMax, mathMin, mathCeil } from '../../utils/math';
|
|
6
|
-
import { toInteger, toFloat } from '../../utils/number';
|
|
7
|
-
import { sortKeys } from '../../utils/object';
|
|
8
|
-
import { props as props$2, formControlMixin } from '../../mixins/form-control';
|
|
9
|
-
import { formSelectionMixin } from '../../mixins/form-selection';
|
|
10
|
-
import { props as props$3, formSizeMixin } from '../../mixins/form-size';
|
|
11
|
-
import { props as props$4, formStateMixin } from '../../mixins/form-state';
|
|
12
|
-
import { props as props$5, formTextMixin } from '../../mixins/form-text';
|
|
13
|
-
import { formValidityMixin } from '../../mixins/form-validity';
|
|
14
|
-
import { props as props$1, idMixin } from '../../mixins/id';
|
|
15
|
-
import { listenOnRootMixin } from '../../mixins/listen-on-root';
|
|
16
|
-
import { listenersMixin } from '../../mixins/listeners';
|
|
17
|
-
import { VBVisible } from '../../directives/visible/visible';
|
|
18
|
-
|
|
19
|
-
// --- Props ---
|
|
20
|
-
|
|
21
|
-
const props = sortKeys({
|
|
22
|
-
...props$1,
|
|
23
|
-
...props$2,
|
|
24
|
-
...props$3,
|
|
25
|
-
...props$4,
|
|
26
|
-
...props$5,
|
|
27
|
-
maxRows: {
|
|
28
|
-
type: [Number, String],
|
|
29
|
-
required: false,
|
|
30
|
-
default: undefined
|
|
31
|
-
},
|
|
32
|
-
// When in auto resize mode, disable shrinking to content height
|
|
33
|
-
noAutoShrink: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
required: false,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
// Disable the resize handle of textarea
|
|
39
|
-
noResize: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
required: false,
|
|
42
|
-
default: false
|
|
43
|
-
},
|
|
44
|
-
rows: {
|
|
45
|
-
type: [Number, String],
|
|
46
|
-
required: false,
|
|
47
|
-
default: 2
|
|
48
|
-
},
|
|
49
|
-
// 'soft', 'hard' or 'off'
|
|
50
|
-
// Browser default is 'soft'
|
|
51
|
-
wrap: {
|
|
52
|
-
type: String,
|
|
53
|
-
required: false,
|
|
54
|
-
default: 'soft'
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// --- Main component ---
|
|
59
|
-
|
|
60
|
-
// @vue/component
|
|
61
|
-
const BFormTextarea = /*#__PURE__*/extend({
|
|
62
|
-
name: NAME_FORM_TEXTAREA,
|
|
63
|
-
directives: {
|
|
64
|
-
'b-visible': VBVisible
|
|
65
|
-
},
|
|
66
|
-
// Mixin order is important!
|
|
67
|
-
mixins: [listenersMixin, idMixin, listenOnRootMixin, formControlMixin, formSizeMixin, formStateMixin, formTextMixin, formSelectionMixin, formValidityMixin],
|
|
68
|
-
props,
|
|
69
|
-
data() {
|
|
70
|
-
return {
|
|
71
|
-
heightInPx: null
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
computed: {
|
|
75
|
-
type() {
|
|
76
|
-
return null;
|
|
77
|
-
},
|
|
78
|
-
computedStyle() {
|
|
79
|
-
const styles = {
|
|
80
|
-
// Setting `noResize` to true will disable the ability for the user to
|
|
81
|
-
// manually resize the textarea. We also disable when in auto height mode
|
|
82
|
-
resize: !this.computedRows || this.noResize ? 'none' : null
|
|
83
|
-
};
|
|
84
|
-
if (!this.computedRows) {
|
|
85
|
-
// Conditionally set the computed CSS height when auto rows/height is enabled
|
|
86
|
-
// We avoid setting the style to `null`, which can override user manual resize handle
|
|
87
|
-
styles.height = this.heightInPx;
|
|
88
|
-
// We always add a vertical scrollbar to the textarea when auto-height is
|
|
89
|
-
// enabled so that the computed height calculation returns a stable value
|
|
90
|
-
styles.overflowY = 'scroll';
|
|
91
|
-
}
|
|
92
|
-
return styles;
|
|
93
|
-
},
|
|
94
|
-
computedMinRows() {
|
|
95
|
-
// Ensure rows is at least 2 and positive (2 is the native textarea value)
|
|
96
|
-
// A value of 1 can cause issues in some browsers, and most browsers
|
|
97
|
-
// only support 2 as the smallest value
|
|
98
|
-
return mathMax(toInteger(this.rows, 2), 2);
|
|
99
|
-
},
|
|
100
|
-
computedMaxRows() {
|
|
101
|
-
return mathMax(this.computedMinRows, toInteger(this.maxRows, 0));
|
|
102
|
-
},
|
|
103
|
-
computedRows() {
|
|
104
|
-
// This is used to set the attribute 'rows' on the textarea
|
|
105
|
-
// If auto-height is enabled, then we return `null` as we use CSS to control height
|
|
106
|
-
return this.computedMinRows === this.computedMaxRows ? this.computedMinRows : null;
|
|
107
|
-
},
|
|
108
|
-
computedAttrs() {
|
|
109
|
-
const disabled = this.disabled,
|
|
110
|
-
required = this.required;
|
|
111
|
-
return {
|
|
112
|
-
id: this.safeId(),
|
|
113
|
-
name: this.name || null,
|
|
114
|
-
form: this.form || null,
|
|
115
|
-
disabled,
|
|
116
|
-
placeholder: this.placeholder || null,
|
|
117
|
-
required,
|
|
118
|
-
autocomplete: this.autocomplete || null,
|
|
119
|
-
readonly: this.readonly || this.plaintext,
|
|
120
|
-
rows: this.computedRows,
|
|
121
|
-
wrap: this.wrap || null,
|
|
122
|
-
'aria-required': this.required ? 'true' : null,
|
|
123
|
-
'aria-invalid': this.computedAriaInvalid
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
computedListeners() {
|
|
127
|
-
return {
|
|
128
|
-
...this.bvListeners,
|
|
129
|
-
input: this.onInput,
|
|
130
|
-
change: this.onChange,
|
|
131
|
-
blur: this.onBlur
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
watch: {
|
|
136
|
-
localValue() {
|
|
137
|
-
this.setHeight();
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
mounted() {
|
|
141
|
-
this.setHeight();
|
|
142
|
-
},
|
|
143
|
-
methods: {
|
|
144
|
-
// Called by intersection observer directive
|
|
145
|
-
/* istanbul ignore next */
|
|
146
|
-
visibleCallback(visible) {
|
|
147
|
-
if (visible) {
|
|
148
|
-
// We use a `$nextTick()` here just to make sure any
|
|
149
|
-
// transitions or portalling have completed
|
|
150
|
-
this.$nextTick(this.setHeight);
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
setHeight() {
|
|
154
|
-
this.$nextTick(() => {
|
|
155
|
-
requestAF(() => {
|
|
156
|
-
this.heightInPx = this.computeHeight();
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
/* istanbul ignore next: can't test getComputedStyle in JSDOM */
|
|
161
|
-
computeHeight() {
|
|
162
|
-
if (this.$isServer || !isNull(this.computedRows)) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
const el = this.$el;
|
|
166
|
-
|
|
167
|
-
// Element must be visible (not hidden) and in document
|
|
168
|
-
// Must be checked after above checks
|
|
169
|
-
if (!isVisible(el)) {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Get current computed styles
|
|
174
|
-
const computedStyle = getCS(el);
|
|
175
|
-
// Height of one line of text in px
|
|
176
|
-
const lineHeight = toFloat(computedStyle.lineHeight, 1);
|
|
177
|
-
// Calculate height of border and padding
|
|
178
|
-
const border = toFloat(computedStyle.borderTopWidth, 0) + toFloat(computedStyle.borderBottomWidth, 0);
|
|
179
|
-
const padding = toFloat(computedStyle.paddingTop, 0) + toFloat(computedStyle.paddingBottom, 0);
|
|
180
|
-
// Calculate offset
|
|
181
|
-
const offset = border + padding;
|
|
182
|
-
// Minimum height for min rows (which must be 2 rows or greater for cross-browser support)
|
|
183
|
-
const minHeight = lineHeight * this.computedMinRows + offset;
|
|
184
|
-
|
|
185
|
-
// Get the current style height (with `px` units)
|
|
186
|
-
const oldHeight = getStyle(el, 'height') || computedStyle.height;
|
|
187
|
-
// Probe scrollHeight by temporarily changing the height to `auto`
|
|
188
|
-
setStyle(el, 'height', 'auto');
|
|
189
|
-
const scrollHeight = el.scrollHeight;
|
|
190
|
-
// Place the original old height back on the element, just in case `computedProp`
|
|
191
|
-
// returns the same value as before
|
|
192
|
-
setStyle(el, 'height', oldHeight);
|
|
193
|
-
|
|
194
|
-
// Calculate content height in 'rows' (scrollHeight includes padding but not border)
|
|
195
|
-
const contentRows = mathMax((scrollHeight - padding) / lineHeight, 2);
|
|
196
|
-
// Calculate number of rows to display (limited within min/max rows)
|
|
197
|
-
const rows = mathMin(mathMax(contentRows, this.computedMinRows), this.computedMaxRows);
|
|
198
|
-
// Calculate the required height of the textarea including border and padding (in pixels)
|
|
199
|
-
const height = mathMax(mathCeil(rows * lineHeight + offset), minHeight);
|
|
200
|
-
|
|
201
|
-
// Computed height remains the larger of `oldHeight` and new `height`,
|
|
202
|
-
// when height is in `sticky` mode (prop `no-auto-shrink` is true)
|
|
203
|
-
if (this.noAutoShrink && toFloat(oldHeight, 0) > height) {
|
|
204
|
-
return oldHeight;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Return the new computed CSS height in px units
|
|
208
|
-
return `${height}px`;
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
render(h) {
|
|
212
|
-
return h('textarea', {
|
|
213
|
-
class: this.computedClass,
|
|
214
|
-
style: this.computedStyle,
|
|
215
|
-
directives: [{
|
|
216
|
-
name: 'b-visible',
|
|
217
|
-
value: this.visibleCallback,
|
|
218
|
-
// If textarea is within 640px of viewport, consider it visible
|
|
219
|
-
modifiers: {
|
|
220
|
-
'640': true
|
|
221
|
-
}
|
|
222
|
-
}],
|
|
223
|
-
attrs: this.computedAttrs,
|
|
224
|
-
domProps: {
|
|
225
|
-
value: this.localValue
|
|
226
|
-
},
|
|
227
|
-
on: this.computedListeners,
|
|
228
|
-
ref: 'input'
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
export { BFormTextarea, props };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { BFormTextarea } from './form-textarea';
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { extend } from '../vue';
|
|
2
|
-
|
|
3
|
-
// @vue/component
|
|
4
|
-
const formSelectionMixin = extend({
|
|
5
|
-
computed: {
|
|
6
|
-
selectionStart: {
|
|
7
|
-
// Expose selectionStart for formatters, etc
|
|
8
|
-
cache: false,
|
|
9
|
-
/* istanbul ignore next */
|
|
10
|
-
get() {
|
|
11
|
-
return this.$refs.input.selectionStart;
|
|
12
|
-
},
|
|
13
|
-
/* istanbul ignore next */
|
|
14
|
-
set(val) {
|
|
15
|
-
this.$refs.input.selectionStart = val;
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
selectionEnd: {
|
|
19
|
-
// Expose selectionEnd for formatters, etc
|
|
20
|
-
cache: false,
|
|
21
|
-
/* istanbul ignore next */
|
|
22
|
-
get() {
|
|
23
|
-
return this.$refs.input.selectionEnd;
|
|
24
|
-
},
|
|
25
|
-
/* istanbul ignore next */
|
|
26
|
-
set(val) {
|
|
27
|
-
this.$refs.input.selectionEnd = val;
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
selectionDirection: {
|
|
31
|
-
// Expose selectionDirection for formatters, etc
|
|
32
|
-
cache: false,
|
|
33
|
-
/* istanbul ignore next */
|
|
34
|
-
get() {
|
|
35
|
-
return this.$refs.input.selectionDirection;
|
|
36
|
-
},
|
|
37
|
-
/* istanbul ignore next */
|
|
38
|
-
set(val) {
|
|
39
|
-
this.$refs.input.selectionDirection = val;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
methods: {
|
|
44
|
-
/* istanbul ignore next */
|
|
45
|
-
select() {
|
|
46
|
-
// For external handler that may want a select() method
|
|
47
|
-
this.$refs.input.select(...arguments);
|
|
48
|
-
},
|
|
49
|
-
/* istanbul ignore next */
|
|
50
|
-
setSelectionRange() {
|
|
51
|
-
// For external handler that may want a setSelectionRange(a,b,c) method
|
|
52
|
-
this.$refs.input.setSelectionRange(...arguments);
|
|
53
|
-
},
|
|
54
|
-
/* istanbul ignore next */
|
|
55
|
-
setRangeText() {
|
|
56
|
-
// For external handler that may want a setRangeText(a,b,c) method
|
|
57
|
-
this.$refs.input.setRangeText(...arguments);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export { formSelectionMixin };
|