@gitlab/ui 129.5.1 → 130.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/form/form_checkbox/form_checkbox.js +3 -3
- package/dist/components/base/form/form_checkbox/form_checkbox_group.js +3 -8
- package/dist/components/base/form/form_radio/form_radio.js +3 -6
- package/dist/components/base/form/form_radio_group/form_radio_group.js +131 -22
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -3
- package/package.json +5 -5
- package/src/components/base/form/form_checkbox/form_checkbox.vue +3 -3
- package/src/components/base/form/form_checkbox/form_checkbox_group.vue +3 -8
- package/src/components/base/form/form_radio/form_radio.vue +3 -6
- package/src/components/base/form/form_radio_group/form_radio_group.vue +135 -27
- package/src/scss/bootstrap_vue.scss +0 -1
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -2
- package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +0 -28
- package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +0 -29
- package/dist/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -2
- package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +0 -127
- package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check.js +0 -224
- package/src/vendor/bootstrap-vue/src/components/form-radio/_form-radio-group.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/form-radio/_form-radio.scss +0 -47
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +0 -29
- package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +0 -27
- package/src/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -4
- package/src/vendor/bootstrap-vue/src/components/form-radio/index.scss +0 -2
- package/src/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +0 -141
- package/src/vendor/bootstrap-vue/src/mixins/form-radio-check.js +0 -233
|
@@ -6,7 +6,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
6
6
|
var script = {
|
|
7
7
|
name: 'GlFormCheckbox',
|
|
8
8
|
inject: {
|
|
9
|
-
|
|
9
|
+
getCheckboxGroup: {
|
|
10
10
|
default: () => () => null
|
|
11
11
|
}
|
|
12
12
|
},
|
|
@@ -108,7 +108,7 @@ var script = {
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
data() {
|
|
111
|
-
const group = this.
|
|
111
|
+
const group = this.getCheckboxGroup();
|
|
112
112
|
return {
|
|
113
113
|
internalId: this.id ? this.id : uniqueId('gitlab_ui_checkbox_'),
|
|
114
114
|
localChecked: group ? group.checked : this.checked
|
|
@@ -128,7 +128,7 @@ var script = {
|
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
group() {
|
|
131
|
-
return this.
|
|
131
|
+
return this.getCheckboxGroup();
|
|
132
132
|
},
|
|
133
133
|
isGroup() {
|
|
134
134
|
// Is this check a child of check-group?
|
|
@@ -18,7 +18,7 @@ var script = {
|
|
|
18
18
|
mixins: [formOptionsMixin],
|
|
19
19
|
provide() {
|
|
20
20
|
return {
|
|
21
|
-
|
|
21
|
+
getCheckboxGroup: () => this
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
24
|
inheritAttrs: false,
|
|
@@ -102,11 +102,6 @@ var script = {
|
|
|
102
102
|
computedState() {
|
|
103
103
|
return isBoolean(this.state) ? this.state : null;
|
|
104
104
|
},
|
|
105
|
-
stateClass() {
|
|
106
|
-
if (this.computedState === true) return 'is-valid';
|
|
107
|
-
if (this.computedState === false) return 'is-invalid';
|
|
108
|
-
return null;
|
|
109
|
-
},
|
|
110
105
|
computedAriaInvalid() {
|
|
111
106
|
const {
|
|
112
107
|
ariaInvalid
|
|
@@ -128,8 +123,8 @@ var script = {
|
|
|
128
123
|
return pick(this.$attrs, PASS_DOWN_ATTRS);
|
|
129
124
|
},
|
|
130
125
|
groupName() {
|
|
131
|
-
//
|
|
132
|
-
//
|
|
126
|
+
// Checkboxes tied to the same model must have the same name, especially for
|
|
127
|
+
// ARIA accessibility. This is accessed from the child GlFormCheckboxes.
|
|
133
128
|
return this.name || this.internalId;
|
|
134
129
|
}
|
|
135
130
|
},
|
|
@@ -5,10 +5,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
5
5
|
var script = {
|
|
6
6
|
name: 'GlFormRadio',
|
|
7
7
|
inject: {
|
|
8
|
-
|
|
9
|
-
// When we remove BFormRadioGroup from GlFormRadioGroup, we can rename
|
|
10
|
-
// the `getBvRadioGroup` provide to `getRadioGroup`.
|
|
11
|
-
from: 'getBvRadioGroup',
|
|
8
|
+
getRadioGroup: {
|
|
12
9
|
default: () => () => null
|
|
13
10
|
}
|
|
14
11
|
},
|
|
@@ -78,7 +75,7 @@ var script = {
|
|
|
78
75
|
}
|
|
79
76
|
},
|
|
80
77
|
data() {
|
|
81
|
-
const group = this.
|
|
78
|
+
const group = this.getRadioGroup();
|
|
82
79
|
return {
|
|
83
80
|
internalId: this.id ? this.id : uniqueId('gitlab_ui_radio_'),
|
|
84
81
|
localChecked: group ? group.checked : this.checked
|
|
@@ -98,7 +95,7 @@ var script = {
|
|
|
98
95
|
}
|
|
99
96
|
},
|
|
100
97
|
group() {
|
|
101
|
-
return this.
|
|
98
|
+
return this.getRadioGroup();
|
|
102
99
|
},
|
|
103
100
|
isGroup() {
|
|
104
101
|
// Is this radio a child of radio-group?
|
|
@@ -1,40 +1,149 @@
|
|
|
1
|
+
import { uniqueId, isBoolean, omit, pick } from 'lodash-es';
|
|
2
|
+
import { looseEqual } from '../../../../vendor/bootstrap-vue/src/utils/loose-equal';
|
|
1
3
|
import { formOptionsMixin } from '../../../../vendor/bootstrap-vue/src/mixins/form-options';
|
|
2
|
-
import { BFormRadioGroup } from '../../../../vendor/bootstrap-vue/src/components/form-radio/form-radio-group';
|
|
3
4
|
import { SafeHtmlDirective } from '../../../../directives/safe_html/safe_html';
|
|
4
5
|
import GlFormRadio from '../form_radio/form_radio';
|
|
5
6
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} = BFormRadioGroup.options;
|
|
8
|
+
// Attributes to pass down to checks/radios instead of applying them to the group
|
|
9
|
+
const PASS_DOWN_ATTRS = ['aria-describedby', 'aria-labelledby'];
|
|
10
10
|
var script = {
|
|
11
11
|
name: 'GlFormRadioGroup',
|
|
12
12
|
components: {
|
|
13
|
-
BFormRadioGroup,
|
|
14
13
|
GlFormRadio
|
|
15
14
|
},
|
|
16
15
|
directives: {
|
|
17
16
|
SafeHtml: SafeHtmlDirective
|
|
18
17
|
},
|
|
19
18
|
mixins: [formOptionsMixin],
|
|
19
|
+
provide() {
|
|
20
|
+
return {
|
|
21
|
+
getRadioGroup: () => this
|
|
22
|
+
};
|
|
23
|
+
},
|
|
20
24
|
inheritAttrs: false,
|
|
21
|
-
model
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
model: {
|
|
26
|
+
prop: 'checked',
|
|
27
|
+
event: 'input'
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
/**
|
|
31
|
+
* Used to set the `id` attribute on the rendered content, and used as the base to generate any additional element IDs as needed.
|
|
32
|
+
*/
|
|
33
|
+
id: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: false,
|
|
36
|
+
default: undefined
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* The current value of the radio.
|
|
40
|
+
*/
|
|
41
|
+
checked: {
|
|
42
|
+
// `checked` prop can be any type
|
|
43
|
+
type: undefined,
|
|
44
|
+
required: false,
|
|
45
|
+
default: null
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* Array of items to render in the component
|
|
49
|
+
*/
|
|
50
|
+
options: {
|
|
51
|
+
type: Array,
|
|
52
|
+
required: false,
|
|
53
|
+
default: () => []
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* When set to `true`, disables the component's functionality and places it in a disabled state.
|
|
57
|
+
*/
|
|
58
|
+
disabled: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
required: false,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Sets the value of the `name` attribute on the form control.
|
|
65
|
+
*/
|
|
66
|
+
name: {
|
|
67
|
+
type: String,
|
|
68
|
+
required: false,
|
|
69
|
+
default: undefined
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Adds the `required` attribute to the form control.
|
|
73
|
+
*/
|
|
74
|
+
required: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
required: false,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Controls the validation state appearance of the component. `true` for valid, `false` for invalid, or `null` for no validation state.
|
|
81
|
+
*/
|
|
82
|
+
state: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
required: false,
|
|
85
|
+
default: null
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Optional value to set for the 'aria-invalid' attribute. Supported values are 'true' and 'false'. If not set, the 'state' prop will dictate the value
|
|
89
|
+
*/
|
|
90
|
+
ariaInvalid: {
|
|
91
|
+
type: [Boolean, String],
|
|
92
|
+
required: false,
|
|
93
|
+
default: false
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
internalId: this.id ? this.id : uniqueId('gitlab_ui_radio_group_'),
|
|
99
|
+
localChecked: this.checked
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
computed: {
|
|
103
|
+
computedState() {
|
|
104
|
+
return isBoolean(this.state) ? this.state : null;
|
|
105
|
+
},
|
|
106
|
+
computedAriaInvalid() {
|
|
107
|
+
const {
|
|
108
|
+
ariaInvalid
|
|
109
|
+
} = this;
|
|
110
|
+
if (ariaInvalid === true || ariaInvalid === 'true' || ariaInvalid === '') {
|
|
111
|
+
return 'true';
|
|
112
|
+
}
|
|
113
|
+
return this.computedState === false ? 'true' : ariaInvalid;
|
|
114
|
+
},
|
|
115
|
+
computedAttrs() {
|
|
116
|
+
return {
|
|
117
|
+
...omit(this.$attrs, PASS_DOWN_ATTRS),
|
|
118
|
+
id: this.internalId,
|
|
119
|
+
'aria-invalid': this.computedAriaInvalid,
|
|
120
|
+
'aria-required': this.required || null
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
passDownAttrs() {
|
|
124
|
+
return pick(this.$attrs, PASS_DOWN_ATTRS);
|
|
125
|
+
},
|
|
126
|
+
groupName() {
|
|
127
|
+
// Radios tied to the same model must have the same name, especially for
|
|
128
|
+
// ARIA accessibility. This is accessed from the child GlFormRadios.
|
|
129
|
+
return this.name || this.internalId;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
watch: {
|
|
133
|
+
checked(newValue) {
|
|
134
|
+
if (!looseEqual(newValue, this.localChecked)) {
|
|
135
|
+
this.localChecked = newValue;
|
|
136
|
+
}
|
|
30
137
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
138
|
+
localChecked(newValue, oldValue) {
|
|
139
|
+
if (!looseEqual(newValue, oldValue)) {
|
|
140
|
+
/**
|
|
141
|
+
* Emitted when the selected value is changed.
|
|
142
|
+
*
|
|
143
|
+
* @event input
|
|
144
|
+
*/
|
|
145
|
+
this.$emit('input', newValue);
|
|
146
|
+
}
|
|
38
147
|
}
|
|
39
148
|
}
|
|
40
149
|
};
|
|
@@ -43,7 +152,7 @@ var script = {
|
|
|
43
152
|
const __vue_script__ = script;
|
|
44
153
|
|
|
45
154
|
/* template */
|
|
46
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('
|
|
155
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._b({staticClass:"gl-form-radio-group gl-outline-none",attrs:{"role":"radiogroup","tabindex":"-1"}},'div',_vm.computedAttrs,false),[_vm._t("first"),_vm._v(" "),_vm._l((_vm.formOptions),function(option,idx){return _c('gl-form-radio',_vm._b({key:idx,attrs:{"value":option.value,"disabled":option.disabled}},'gl-form-radio',_vm.passDownAttrs,false),[(option.html)?_c('span',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(option.html),expression:"option.html"}]}):_c('span',[_vm._v(_vm._s(option.text))])])}),_vm._v(" "),_vm._t("default")],2)};
|
|
47
156
|
var __vue_staticRenderFns__ = [];
|
|
48
157
|
|
|
49
158
|
/* style */
|