@gitlab/ui 129.5.0 → 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.
Files changed (27) hide show
  1. package/dist/components/base/form/form_checkbox/form_checkbox.js +3 -3
  2. package/dist/components/base/form/form_checkbox/form_checkbox_group.js +3 -8
  3. package/dist/components/base/form/form_radio/form_radio.js +4 -8
  4. package/dist/components/base/form/form_radio_group/form_radio_group.js +131 -22
  5. package/dist/index.css +1 -1
  6. package/dist/index.css.map +1 -1
  7. package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -3
  8. package/package.json +6 -6
  9. package/src/components/base/form/form_checkbox/form_checkbox.vue +3 -3
  10. package/src/components/base/form/form_checkbox/form_checkbox_group.vue +3 -8
  11. package/src/components/base/form/form_radio/form_radio.vue +4 -8
  12. package/src/components/base/form/form_radio_group/form_radio_group.vue +135 -27
  13. package/src/scss/bootstrap_vue.scss +0 -1
  14. package/src/vendor/bootstrap-vue/src/constants/components.js +0 -2
  15. package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +0 -28
  16. package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +0 -29
  17. package/dist/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -2
  18. package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +0 -127
  19. package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check.js +0 -224
  20. package/src/vendor/bootstrap-vue/src/components/form-radio/_form-radio-group.scss +0 -1
  21. package/src/vendor/bootstrap-vue/src/components/form-radio/_form-radio.scss +0 -47
  22. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +0 -29
  23. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +0 -27
  24. package/src/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -4
  25. package/src/vendor/bootstrap-vue/src/components/form-radio/index.scss +0 -2
  26. package/src/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +0 -141
  27. 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
- getGroup: {
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.getGroup();
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.getGroup();
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
- getGroup: () => this
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
- // Checks/Radios tied to the same model must have the same name,
132
- // especially for ARIA accessibility
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
  },
@@ -1,15 +1,11 @@
1
- import uniqueId from 'lodash/uniqueId';
2
- import isBoolean from 'lodash/isBoolean';
1
+ import { uniqueId, isBoolean } from 'lodash-es';
3
2
  import { looseEqual } from '../../../../vendor/bootstrap-vue/src/utils/loose-equal';
4
3
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
4
 
6
5
  var script = {
7
6
  name: 'GlFormRadio',
8
7
  inject: {
9
- getGroup: {
10
- // When we remove BFormRadioGroup from GlFormRadioGroup, we can rename
11
- // the `getBvRadioGroup` provide to `getRadioGroup`.
12
- from: 'getBvRadioGroup',
8
+ getRadioGroup: {
13
9
  default: () => () => null
14
10
  }
15
11
  },
@@ -79,7 +75,7 @@ var script = {
79
75
  }
80
76
  },
81
77
  data() {
82
- const group = this.getGroup();
78
+ const group = this.getRadioGroup();
83
79
  return {
84
80
  internalId: this.id ? this.id : uniqueId('gitlab_ui_radio_'),
85
81
  localChecked: group ? group.checked : this.checked
@@ -99,7 +95,7 @@ var script = {
99
95
  }
100
96
  },
101
97
  group() {
102
- return this.getGroup();
98
+ return this.getRadioGroup();
103
99
  },
104
100
  isGroup() {
105
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
- const {
8
- model
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
- methods: {
23
- onInput(e) {
24
- /**
25
- * Emitted when the selected value is changed.
26
- *
27
- * @event input
28
- */
29
- this.$emit('input', e);
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
- onChange(e) {
32
- /**
33
- * Emitted when the selected value is changed.
34
- *
35
- * @event change
36
- */
37
- this.$emit('change', e);
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('b-form-radio-group',_vm._g(_vm._b({staticClass:"gl-form-checkbox-group",attrs:{"stacked":""},on:{"input":_vm.onInput,"change":_vm.onChange}},'b-form-radio-group',_vm.$attrs,false),_vm.$listeners),[_vm._t("first"),_vm._v(" "),_vm._l((_vm.formOptions),function(option,idx){return _c('gl-form-radio',{key:idx,attrs:{"value":option.value,"disabled":option.disabled}},[(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)};
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 */