@gitlab/ui 131.3.1 → 132.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/package.json +2 -1
- package/src/components/base/form/form_checkbox/form_checkbox_group.vue +4 -2
- package/src/components/base/form/form_radio_group/form_radio_group.vue +4 -2
- package/src/utils/form_options_utils.js +39 -0
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +116 -25
- package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.js +86 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "132.0.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
"@cypress/grep": "^4.1.1",
|
|
104
104
|
"@figma/code-connect": "^1.4.3",
|
|
105
105
|
"@gitlab/fonts": "^1.3.1",
|
|
106
|
+
"@gitlab/hybrid-vue": "npm:@vue/compat@3.5.30",
|
|
106
107
|
"@gitlab/svgs": "*",
|
|
107
108
|
"@jest/test-sequencer": "30.3.0",
|
|
108
109
|
"@rollup/plugin-commonjs": "^28.0.9",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uniqueId, isBoolean, omit, pick } from 'lodash-es';
|
|
3
3
|
import { looseEqual } from '../../../../utils/equality_utils';
|
|
4
|
-
import { formOptionsMixin } from '../../../../vendor/bootstrap-vue/src/mixins/form-options';
|
|
5
4
|
import { SafeHtmlDirective as SafeHtml } from '../../../../directives/safe_html/safe_html';
|
|
5
|
+
import { normalizeOptions } from '../../../../utils/form_options_utils';
|
|
6
6
|
import GlFormCheckbox from './form_checkbox.vue';
|
|
7
7
|
|
|
8
8
|
// Attributes to pass down to checks/radios instead of applying them to the group
|
|
@@ -14,7 +14,6 @@ export default {
|
|
|
14
14
|
directives: {
|
|
15
15
|
SafeHtml,
|
|
16
16
|
},
|
|
17
|
-
mixins: [formOptionsMixin],
|
|
18
17
|
provide() {
|
|
19
18
|
return {
|
|
20
19
|
getCheckboxGroup: () => this,
|
|
@@ -98,6 +97,9 @@ export default {
|
|
|
98
97
|
};
|
|
99
98
|
},
|
|
100
99
|
computed: {
|
|
100
|
+
formOptions() {
|
|
101
|
+
return normalizeOptions(this.options);
|
|
102
|
+
},
|
|
101
103
|
computedState() {
|
|
102
104
|
return isBoolean(this.state) ? this.state : null;
|
|
103
105
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { uniqueId, isBoolean, omit, pick } from 'lodash-es';
|
|
3
3
|
import { looseEqual } from '../../../../utils/equality_utils';
|
|
4
|
-
import { formOptionsMixin } from '../../../../vendor/bootstrap-vue/src/mixins/form-options';
|
|
5
4
|
import { SafeHtmlDirective as SafeHtml } from '../../../../directives/safe_html/safe_html';
|
|
5
|
+
import { normalizeOptions } from '../../../../utils/form_options_utils';
|
|
6
6
|
import GlFormRadio from '../form_radio/form_radio.vue';
|
|
7
7
|
|
|
8
8
|
// Attributes to pass down to checks/radios instead of applying them to the group
|
|
@@ -16,7 +16,6 @@ export default {
|
|
|
16
16
|
directives: {
|
|
17
17
|
SafeHtml,
|
|
18
18
|
},
|
|
19
|
-
mixins: [formOptionsMixin],
|
|
20
19
|
provide() {
|
|
21
20
|
return {
|
|
22
21
|
getRadioGroup: () => this,
|
|
@@ -101,6 +100,9 @@ export default {
|
|
|
101
100
|
};
|
|
102
101
|
},
|
|
103
102
|
computed: {
|
|
103
|
+
formOptions() {
|
|
104
|
+
return normalizeOptions(this.options);
|
|
105
|
+
},
|
|
104
106
|
computedState() {
|
|
105
107
|
return isBoolean(this.state) ? this.state : null;
|
|
106
108
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a single option into a standard { value, text, html, disabled } shape.
|
|
3
|
+
*/
|
|
4
|
+
function normalizeOption(option) {
|
|
5
|
+
if (option !== null && typeof option === 'object') {
|
|
6
|
+
const { value, text, html, disabled } = option;
|
|
7
|
+
return {
|
|
8
|
+
value: value === undefined ? text : value,
|
|
9
|
+
text: String(text),
|
|
10
|
+
html,
|
|
11
|
+
disabled: Boolean(disabled),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
value: option,
|
|
16
|
+
text: String(option),
|
|
17
|
+
disabled: false,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes an options array into a consistent format for rendering.
|
|
23
|
+
*
|
|
24
|
+
* Each option can be a primitive (string, number) or an object with
|
|
25
|
+
* `{ value, text, html, disabled }` properties. Primitives are converted
|
|
26
|
+
* to `{ value, text, disabled: false }`. For objects, `value` defaults to
|
|
27
|
+
* `text` when omitted and `disabled` defaults to `false`.
|
|
28
|
+
*
|
|
29
|
+
* @param {Array<string|number|{value?: *, text: string, html?: string, disabled?: boolean}>} options
|
|
30
|
+
* The raw options array to normalize.
|
|
31
|
+
* @returns {Array<{value: *, text: string, html?: string, disabled: boolean}>}
|
|
32
|
+
* The normalized options, or an empty array if the input is not an array.
|
|
33
|
+
*/
|
|
34
|
+
export function normalizeOptions(options) {
|
|
35
|
+
if (Array.isArray(options)) {
|
|
36
|
+
return options.map((option) => normalizeOption(option));
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
@@ -20,9 +20,10 @@ import {
|
|
|
20
20
|
CODE_UP
|
|
21
21
|
} from '../../constants/key-codes'
|
|
22
22
|
import {
|
|
23
|
-
|
|
23
|
+
PROP_TYPE_ARRAY,
|
|
24
24
|
PROP_TYPE_BOOLEAN,
|
|
25
25
|
PROP_TYPE_NUMBER,
|
|
26
|
+
PROP_TYPE_OBJECT,
|
|
26
27
|
PROP_TYPE_STRING
|
|
27
28
|
} from '../../constants/props'
|
|
28
29
|
import {
|
|
@@ -45,7 +46,6 @@ import { makeModelMixin } from '../../utils/model'
|
|
|
45
46
|
import { toInteger } from '../../utils/number'
|
|
46
47
|
import { sortKeys } from '../../utils/object'
|
|
47
48
|
import { observeDom } from '../../utils/observe-dom'
|
|
48
|
-
import { makeProp } from '../../utils/props'
|
|
49
49
|
import { stableSort } from '../../utils/stable-sort'
|
|
50
50
|
import { idMixin, props as idProps } from '../../mixins/id'
|
|
51
51
|
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
|
|
@@ -76,14 +76,41 @@ const BVTabButton = /*#__PURE__*/ extend({
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
props: {
|
|
79
|
-
controls:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
controls: {
|
|
80
|
+
type: PROP_TYPE_STRING,
|
|
81
|
+
required: false,
|
|
82
|
+
default: undefined
|
|
83
|
+
},
|
|
84
|
+
id: {
|
|
85
|
+
type: PROP_TYPE_STRING,
|
|
86
|
+
required: false,
|
|
87
|
+
default: undefined
|
|
88
|
+
},
|
|
89
|
+
noKeyNav: {
|
|
90
|
+
type: PROP_TYPE_BOOLEAN,
|
|
91
|
+
required: false,
|
|
92
|
+
default: false
|
|
93
|
+
},
|
|
94
|
+
posInSet: {
|
|
95
|
+
type: PROP_TYPE_NUMBER,
|
|
96
|
+
required: false,
|
|
97
|
+
default: undefined
|
|
98
|
+
},
|
|
99
|
+
setSize: {
|
|
100
|
+
type: PROP_TYPE_NUMBER,
|
|
101
|
+
required: false,
|
|
102
|
+
default: undefined
|
|
103
|
+
},
|
|
84
104
|
// Reference to the child <b-tab> instance
|
|
85
|
-
tab:
|
|
86
|
-
|
|
105
|
+
tab: {
|
|
106
|
+
required: false,
|
|
107
|
+
default: undefined
|
|
108
|
+
},
|
|
109
|
+
tabIndex: {
|
|
110
|
+
type: PROP_TYPE_NUMBER,
|
|
111
|
+
required: false,
|
|
112
|
+
default: undefined
|
|
113
|
+
}
|
|
87
114
|
},
|
|
88
115
|
computed: {
|
|
89
116
|
bvTabs() {
|
|
@@ -188,11 +215,31 @@ const BVTabButton = /*#__PURE__*/ extend({
|
|
|
188
215
|
|
|
189
216
|
// --- Props ---
|
|
190
217
|
const navProps = {
|
|
191
|
-
align:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
218
|
+
align: {
|
|
219
|
+
type: PROP_TYPE_STRING,
|
|
220
|
+
required: false,
|
|
221
|
+
default: undefined
|
|
222
|
+
},
|
|
223
|
+
fill: {
|
|
224
|
+
type: PROP_TYPE_BOOLEAN,
|
|
225
|
+
required: false,
|
|
226
|
+
default: false
|
|
227
|
+
},
|
|
228
|
+
justified: {
|
|
229
|
+
type: PROP_TYPE_BOOLEAN,
|
|
230
|
+
required: false,
|
|
231
|
+
default: false
|
|
232
|
+
},
|
|
233
|
+
pills: {
|
|
234
|
+
type: PROP_TYPE_BOOLEAN,
|
|
235
|
+
required: false,
|
|
236
|
+
default: false
|
|
237
|
+
},
|
|
238
|
+
small: {
|
|
239
|
+
type: PROP_TYPE_BOOLEAN,
|
|
240
|
+
required: false,
|
|
241
|
+
default: false
|
|
242
|
+
}
|
|
196
243
|
}
|
|
197
244
|
|
|
198
245
|
export const props = sortKeys({
|
|
@@ -200,21 +247,65 @@ export const props = sortKeys({
|
|
|
200
247
|
...modelProps,
|
|
201
248
|
...navProps,
|
|
202
249
|
// Only applied to the currently active `li`
|
|
203
|
-
activeNavItemClass:
|
|
250
|
+
activeNavItemClass: {
|
|
251
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
252
|
+
required: false,
|
|
253
|
+
default: undefined
|
|
254
|
+
},
|
|
204
255
|
// Only applied to the currently active `<b-tab>`
|
|
205
256
|
// This prop is sniffed by the `<b-tab>` child
|
|
206
|
-
activeTabClass:
|
|
207
|
-
|
|
257
|
+
activeTabClass: {
|
|
258
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
259
|
+
required: false,
|
|
260
|
+
default: undefined
|
|
261
|
+
},
|
|
262
|
+
contentClass: {
|
|
263
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
264
|
+
required: false,
|
|
265
|
+
default: undefined
|
|
266
|
+
},
|
|
208
267
|
// Synonym for 'bottom'
|
|
209
|
-
end:
|
|
268
|
+
end: {
|
|
269
|
+
type: PROP_TYPE_BOOLEAN,
|
|
270
|
+
required: false,
|
|
271
|
+
default: false
|
|
272
|
+
},
|
|
210
273
|
// This prop is sniffed by the `<b-tab>` child
|
|
211
|
-
lazy:
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
274
|
+
lazy: {
|
|
275
|
+
type: PROP_TYPE_BOOLEAN,
|
|
276
|
+
required: false,
|
|
277
|
+
default: false
|
|
278
|
+
},
|
|
279
|
+
navClass: {
|
|
280
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
281
|
+
required: false,
|
|
282
|
+
default: undefined
|
|
283
|
+
},
|
|
284
|
+
navWrapperClass: {
|
|
285
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
286
|
+
required: false,
|
|
287
|
+
default: undefined
|
|
288
|
+
},
|
|
289
|
+
noFade: {
|
|
290
|
+
type: PROP_TYPE_BOOLEAN,
|
|
291
|
+
required: false,
|
|
292
|
+
default: false
|
|
293
|
+
},
|
|
294
|
+
noKeyNav: {
|
|
295
|
+
type: PROP_TYPE_BOOLEAN,
|
|
296
|
+
required: false,
|
|
297
|
+
default: false
|
|
298
|
+
},
|
|
299
|
+
noNavStyle: {
|
|
300
|
+
type: PROP_TYPE_BOOLEAN,
|
|
301
|
+
required: false,
|
|
302
|
+
default: false
|
|
303
|
+
},
|
|
304
|
+
tag: {
|
|
305
|
+
type: PROP_TYPE_STRING,
|
|
306
|
+
required: false,
|
|
307
|
+
default: 'div'
|
|
308
|
+
}
|
|
218
309
|
})
|
|
219
310
|
|
|
220
311
|
// --- Main component ---
|
|
@@ -14,11 +14,10 @@ import {
|
|
|
14
14
|
MODEL_EVENT_NAME_PREFIX
|
|
15
15
|
} from '../../constants/events'
|
|
16
16
|
import {
|
|
17
|
-
|
|
17
|
+
PROP_TYPE_ARRAY,
|
|
18
18
|
PROP_TYPE_BOOLEAN,
|
|
19
19
|
PROP_TYPE_FUNCTION,
|
|
20
|
-
|
|
21
|
-
PROP_TYPE_NUMBER_STRING,
|
|
20
|
+
PROP_TYPE_NUMBER,
|
|
22
21
|
PROP_TYPE_OBJECT,
|
|
23
22
|
PROP_TYPE_STRING
|
|
24
23
|
} from '../../constants/props'
|
|
@@ -28,7 +27,6 @@ import { getScopeId } from '../../utils/get-scope-id'
|
|
|
28
27
|
import { isUndefinedOrNull } from '../../utils/inspect'
|
|
29
28
|
import { pick } from '../../utils/object'
|
|
30
29
|
import { TOOLTIP_DELAY } from '../../constants/config'
|
|
31
|
-
import { makeProp } from '../../utils/props'
|
|
32
30
|
import { createNewChildComponent, eventProp } from '../../utils/create-new-child-component'
|
|
33
31
|
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
|
|
34
32
|
import { BVTooltip } from './helpers/bv-tooltip'
|
|
@@ -47,35 +45,98 @@ export const props = {
|
|
|
47
45
|
// String: scrollParent, window, or viewport
|
|
48
46
|
// Element: element reference
|
|
49
47
|
// Object: Vue component
|
|
50
|
-
boundary:
|
|
51
|
-
|
|
48
|
+
boundary: {
|
|
49
|
+
type: [HTMLElement, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
50
|
+
required: false,
|
|
51
|
+
default: 'scrollParent'
|
|
52
|
+
},
|
|
53
|
+
boundaryPadding: {
|
|
54
|
+
type: [PROP_TYPE_NUMBER, PROP_TYPE_STRING],
|
|
55
|
+
required: false,
|
|
56
|
+
default: 5
|
|
57
|
+
},
|
|
52
58
|
// String: HTML ID of container, if null body is used (default)
|
|
53
59
|
// HTMLElement: element reference reference
|
|
54
60
|
// Object: Vue Component
|
|
55
|
-
container:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
container: {
|
|
62
|
+
type: [HTMLElement, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
63
|
+
required: false,
|
|
64
|
+
default: undefined
|
|
65
|
+
},
|
|
66
|
+
customClass: {
|
|
67
|
+
type: PROP_TYPE_STRING,
|
|
68
|
+
required: false,
|
|
69
|
+
default: 'gl-tooltip'
|
|
70
|
+
},
|
|
71
|
+
delay: {
|
|
72
|
+
type: [PROP_TYPE_NUMBER, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
73
|
+
required: false,
|
|
74
|
+
default: () => ({ ...TOOLTIP_DELAY })
|
|
75
|
+
},
|
|
76
|
+
[MODEL_PROP_NAME_ENABLED]: {
|
|
77
|
+
type: PROP_TYPE_BOOLEAN,
|
|
78
|
+
required: false,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
fallbackPlacement: {
|
|
82
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_STRING],
|
|
83
|
+
required: false,
|
|
84
|
+
default: 'flip'
|
|
85
|
+
},
|
|
60
86
|
// ID to use for tooltip element
|
|
61
87
|
// If not provided on will automatically be generated
|
|
62
|
-
id:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
id: {
|
|
89
|
+
type: PROP_TYPE_STRING,
|
|
90
|
+
required: false,
|
|
91
|
+
default: undefined
|
|
92
|
+
},
|
|
93
|
+
noFade: {
|
|
94
|
+
type: PROP_TYPE_BOOLEAN,
|
|
95
|
+
required: false,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
98
|
+
noninteractive: {
|
|
99
|
+
type: PROP_TYPE_BOOLEAN,
|
|
100
|
+
required: false,
|
|
101
|
+
default: false
|
|
102
|
+
},
|
|
103
|
+
offset: {
|
|
104
|
+
type: [PROP_TYPE_NUMBER, PROP_TYPE_STRING],
|
|
105
|
+
required: false,
|
|
106
|
+
default: 0
|
|
107
|
+
},
|
|
108
|
+
placement: {
|
|
109
|
+
type: PROP_TYPE_STRING,
|
|
110
|
+
required: false,
|
|
111
|
+
default: 'top'
|
|
112
|
+
},
|
|
113
|
+
[MODEL_PROP_NAME_SHOW]: {
|
|
114
|
+
type: PROP_TYPE_BOOLEAN,
|
|
115
|
+
required: false,
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
68
118
|
// String ID of element, or element/component reference
|
|
69
119
|
// Or function that returns one of the above
|
|
70
120
|
// Required
|
|
71
|
-
target:
|
|
72
|
-
[HTMLElement, SVGElement, PROP_TYPE_FUNCTION, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
121
|
+
target: {
|
|
122
|
+
type: [HTMLElement, SVGElement, PROP_TYPE_FUNCTION, PROP_TYPE_OBJECT, PROP_TYPE_STRING],
|
|
123
|
+
required: true
|
|
124
|
+
},
|
|
125
|
+
title: {
|
|
126
|
+
type: PROP_TYPE_STRING,
|
|
127
|
+
required: false,
|
|
128
|
+
default: undefined
|
|
129
|
+
},
|
|
130
|
+
triggers: {
|
|
131
|
+
type: [PROP_TYPE_ARRAY, PROP_TYPE_STRING],
|
|
132
|
+
required: false,
|
|
133
|
+
default: 'hover focus'
|
|
134
|
+
},
|
|
135
|
+
variant: {
|
|
136
|
+
type: PROP_TYPE_STRING,
|
|
137
|
+
required: false,
|
|
138
|
+
default: undefined
|
|
139
|
+
}
|
|
79
140
|
}
|
|
80
141
|
|
|
81
142
|
// --- Main component ---
|