@gitlab/ui 129.5.1 → 130.0.1

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 (28) 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 +3 -6
  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 +5 -5
  9. package/src/components/base/breadcrumb/breadcrumb.scss +5 -1
  10. package/src/components/base/form/form_checkbox/form_checkbox.vue +3 -3
  11. package/src/components/base/form/form_checkbox/form_checkbox_group.vue +3 -8
  12. package/src/components/base/form/form_radio/form_radio.vue +3 -6
  13. package/src/components/base/form/form_radio_group/form_radio_group.vue +135 -27
  14. package/src/scss/bootstrap_vue.scss +0 -1
  15. package/src/vendor/bootstrap-vue/src/constants/components.js +0 -2
  16. package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +0 -28
  17. package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +0 -29
  18. package/dist/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -2
  19. package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +0 -127
  20. package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check.js +0 -224
  21. package/src/vendor/bootstrap-vue/src/components/form-radio/_form-radio-group.scss +0 -1
  22. package/src/vendor/bootstrap-vue/src/components/form-radio/_form-radio.scss +0 -47
  23. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +0 -29
  24. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +0 -27
  25. package/src/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -4
  26. package/src/vendor/bootstrap-vue/src/components/form-radio/index.scss +0 -2
  27. package/src/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +0 -141
  28. package/src/vendor/bootstrap-vue/src/mixins/form-radio-check.js +0 -233
@@ -13,8 +13,6 @@ const NAME_DROPDOWN_TEXT = 'BDropdownText';
13
13
  const NAME_FORM = 'BForm';
14
14
  const NAME_FORM_GROUP = 'BFormGroup';
15
15
  const NAME_FORM_INVALID_FEEDBACK = 'BFormInvalidFeedback';
16
- const NAME_FORM_RADIO = 'BFormRadio';
17
- const NAME_FORM_RADIO_GROUP = 'BFormRadioGroup';
18
16
  const NAME_FORM_ROW = 'BFormRow';
19
17
  const NAME_FORM_SELECT = 'BFormSelect';
20
18
  const NAME_FORM_SELECT_OPTION = 'BFormSelectOption';
@@ -54,4 +52,4 @@ const NAME_TRANSITION = 'BVTransition';
54
52
  const NAME_TRANSPORTER = 'BVTransporter';
55
53
  const NAME_TRANSPORTER_TARGET = 'BVTransporterTarget';
56
54
 
57
- export { NAME_BUTTON, NAME_BUTTON_CLOSE, NAME_COL, NAME_DROPDOWN, NAME_DROPDOWN_DIVIDER, NAME_DROPDOWN_FORM, NAME_DROPDOWN_GROUP, NAME_DROPDOWN_HEADER, NAME_DROPDOWN_ITEM, NAME_DROPDOWN_ITEM_BUTTON, NAME_DROPDOWN_TEXT, NAME_FORM, NAME_FORM_BUTTON_LABEL_CONTROL, NAME_FORM_GROUP, NAME_FORM_INVALID_FEEDBACK, NAME_FORM_RADIO, NAME_FORM_RADIO_GROUP, NAME_FORM_RATING_STAR, NAME_FORM_ROW, NAME_FORM_SELECT, NAME_FORM_SELECT_OPTION, NAME_FORM_SELECT_OPTION_GROUP, NAME_FORM_TEXT, NAME_FORM_TEXTAREA, NAME_FORM_VALID_FEEDBACK, NAME_LINK, NAME_MODAL, NAME_POPOVER, NAME_POPOVER_HELPER, NAME_POPOVER_TEMPLATE, NAME_POPPER, NAME_TAB, NAME_TABLE, NAME_TABLE_CELL, NAME_TABLE_LITE, NAME_TABLE_SIMPLE, NAME_TABS, NAME_TAB_BUTTON_HELPER, NAME_TBODY, NAME_TFOOT, NAME_TH, NAME_THEAD, NAME_TOAST, NAME_TOASTER, NAME_TOAST_POP, NAME_TOOLTIP, NAME_TOOLTIP_HELPER, NAME_TOOLTIP_TEMPLATE, NAME_TR, NAME_TRANSITION, NAME_TRANSPORTER, NAME_TRANSPORTER_TARGET };
55
+ export { NAME_BUTTON, NAME_BUTTON_CLOSE, NAME_COL, NAME_DROPDOWN, NAME_DROPDOWN_DIVIDER, NAME_DROPDOWN_FORM, NAME_DROPDOWN_GROUP, NAME_DROPDOWN_HEADER, NAME_DROPDOWN_ITEM, NAME_DROPDOWN_ITEM_BUTTON, NAME_DROPDOWN_TEXT, NAME_FORM, NAME_FORM_BUTTON_LABEL_CONTROL, NAME_FORM_GROUP, NAME_FORM_INVALID_FEEDBACK, NAME_FORM_RATING_STAR, NAME_FORM_ROW, NAME_FORM_SELECT, NAME_FORM_SELECT_OPTION, NAME_FORM_SELECT_OPTION_GROUP, NAME_FORM_TEXT, NAME_FORM_TEXTAREA, NAME_FORM_VALID_FEEDBACK, NAME_LINK, NAME_MODAL, NAME_POPOVER, NAME_POPOVER_HELPER, NAME_POPOVER_TEMPLATE, NAME_POPPER, NAME_TAB, NAME_TABLE, NAME_TABLE_CELL, NAME_TABLE_LITE, NAME_TABLE_SIMPLE, NAME_TABS, NAME_TAB_BUTTON_HELPER, NAME_TBODY, NAME_TFOOT, NAME_TH, NAME_THEAD, NAME_TOAST, NAME_TOASTER, NAME_TOAST_POP, NAME_TOOLTIP, NAME_TOOLTIP_HELPER, NAME_TOOLTIP_TEMPLATE, NAME_TR, NAME_TRANSITION, NAME_TRANSPORTER, NAME_TRANSPORTER_TARGET };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "129.5.1",
3
+ "version": "130.0.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -119,9 +119,9 @@
119
119
  "@storybook/vue3": "^7.6.20",
120
120
  "@storybook/vue3-webpack5": "^7.6.20",
121
121
  "@types/jest-image-snapshot": "^6.4.1",
122
- "@vue/compat": "^3.5.24",
123
- "@vue/compiler-sfc": "^3.5.24",
124
- "@vue/server-renderer": "^3.5.24",
122
+ "@vue/compat": "3.5.30",
123
+ "@vue/compiler-sfc": "3.5.30",
124
+ "@vue/server-renderer": "3.5.30",
125
125
  "@vue/test-utils": "1.3.6",
126
126
  "@vue/test-utils-vue3": "npm:@vue/test-utils@^2.4.6",
127
127
  "@vue/vue2-jest": "29.2.6",
@@ -143,7 +143,7 @@
143
143
  "jest-circus": "30.3.0",
144
144
  "jest-environment-jsdom": "30.3.0",
145
145
  "jest-image-snapshot": "^6.5.2",
146
- "merge-cobertura": "^1.0.7",
146
+ "merge-cobertura": "^1.0.8",
147
147
  "mockdate": "^3.0.5",
148
148
  "module-alias": "^2.3.4",
149
149
  "pikaday": "^1.8.0",
@@ -8,7 +8,7 @@ $breadcrumb-max-width: $grid-size * 16;
8
8
  .gl-breadcrumb-list {
9
9
  @apply gl-bg-transparent;
10
10
  @apply gl-p-0;
11
- @apply gl-items-center;
11
+ @apply gl-items-start;
12
12
  @apply gl-leading-normal;
13
13
  @apply gl-m-0;
14
14
  @apply gl-flex-nowrap;
@@ -17,6 +17,8 @@ $breadcrumb-max-width: $grid-size * 16;
17
17
 
18
18
  // bootstrap overrides
19
19
  .gl-breadcrumb-item {
20
+ @apply gl-inline-flex;
21
+ @apply gl-items-center;
20
22
  @apply gl-leading-normal;
21
23
  @apply gl-shrink-0;
22
24
 
@@ -56,10 +58,12 @@ $breadcrumb-max-width: $grid-size * 16;
56
58
 
57
59
  .gl-breadcrumb-item-sm {
58
60
  @apply gl-text-sm;
61
+ @apply gl-h-6;
59
62
  }
60
63
 
61
64
  .gl-breadcrumb-item-md {
62
65
  @apply gl-text-base;
66
+ @apply gl-h-7;
63
67
  }
64
68
 
65
69
  .gl-breadcrumb-item {
@@ -6,7 +6,7 @@ import { looseIndexOf } from '../../../../vendor/bootstrap-vue/src/utils/loose-i
6
6
  export default {
7
7
  name: 'GlFormCheckbox',
8
8
  inject: {
9
- getGroup: {
9
+ getCheckboxGroup: {
10
10
  default: () => () => null,
11
11
  },
12
12
  },
@@ -108,7 +108,7 @@ export default {
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 @@ export default {
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?
@@ -17,7 +17,7 @@ export default {
17
17
  mixins: [formOptionsMixin],
18
18
  provide() {
19
19
  return {
20
- getGroup: () => this,
20
+ getCheckboxGroup: () => this,
21
21
  };
22
22
  },
23
23
  inheritAttrs: false,
@@ -101,11 +101,6 @@ export default {
101
101
  computedState() {
102
102
  return isBoolean(this.state) ? this.state : null;
103
103
  },
104
- stateClass() {
105
- if (this.computedState === true) return 'is-valid';
106
- if (this.computedState === false) return 'is-invalid';
107
- return null;
108
- },
109
104
  computedAriaInvalid() {
110
105
  const { ariaInvalid } = this;
111
106
  if (ariaInvalid === true || ariaInvalid === 'true' || ariaInvalid === '') {
@@ -125,8 +120,8 @@ export default {
125
120
  return pick(this.$attrs, PASS_DOWN_ATTRS);
126
121
  },
127
122
  groupName() {
128
- // Checks/Radios tied to the same model must have the same name,
129
- // especially for ARIA accessibility
123
+ // Checkboxes tied to the same model must have the same name, especially for
124
+ // ARIA accessibility. This is accessed from the child GlFormCheckboxes.
130
125
  return this.name || this.internalId;
131
126
  },
132
127
  },
@@ -5,10 +5,7 @@ import { looseEqual } from '../../../../vendor/bootstrap-vue/src/utils/loose-equ
5
5
  export default {
6
6
  name: 'GlFormRadio',
7
7
  inject: {
8
- getGroup: {
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 @@ export default {
78
75
  },
79
76
  },
80
77
  data() {
81
- const group = this.getGroup();
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 @@ export default {
98
95
  },
99
96
  },
100
97
  group() {
101
- return this.getGroup();
98
+ return this.getRadioGroup();
102
99
  },
103
100
  isGroup() {
104
101
  // Is this radio a child of radio-group?
@@ -1,56 +1,164 @@
1
1
  <script>
2
+ import { uniqueId, isBoolean, omit, pick } from 'lodash-es';
3
+ import { looseEqual } from '../../../../vendor/bootstrap-vue/src/utils/loose-equal';
2
4
  import { formOptionsMixin } from '../../../../vendor/bootstrap-vue/src/mixins/form-options';
3
- import { BFormRadioGroup } from '../../../../vendor/bootstrap-vue/src/components/form-radio/form-radio-group';
4
5
  import { SafeHtmlDirective as SafeHtml } from '../../../../directives/safe_html/safe_html';
5
6
  import GlFormRadio from '../form_radio/form_radio.vue';
6
7
 
7
- const { model } = 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'];
8
10
 
9
11
  export default {
10
12
  name: 'GlFormRadioGroup',
11
13
  components: {
12
- BFormRadioGroup,
13
14
  GlFormRadio,
14
15
  },
15
16
  directives: {
16
17
  SafeHtml,
17
18
  },
18
19
  mixins: [formOptionsMixin],
20
+ provide() {
21
+ return {
22
+ getRadioGroup: () => this,
23
+ };
24
+ },
19
25
  inheritAttrs: false,
20
- model,
21
- methods: {
22
- onInput(e) {
23
- /**
24
- * Emitted when the selected value is changed.
25
- *
26
- * @event input
27
- */
28
- this.$emit('input', e);
26
+ model: {
27
+ prop: 'checked',
28
+ event: 'input',
29
+ },
30
+ props: {
31
+ /**
32
+ * Used to set the `id` attribute on the rendered content, and used as the base to generate any additional element IDs as needed.
33
+ */
34
+ id: {
35
+ type: String,
36
+ required: false,
37
+ default: undefined,
38
+ },
39
+ /**
40
+ * The current value of the radio.
41
+ */
42
+ checked: {
43
+ // `checked` prop can be any type
44
+ type: undefined,
45
+ required: false,
46
+ default: null,
47
+ },
48
+ /**
49
+ * Array of items to render in the component
50
+ */
51
+ options: {
52
+ type: Array,
53
+ required: false,
54
+ default: () => [],
55
+ },
56
+ /**
57
+ * When set to `true`, disables the component's functionality and places it in a disabled state.
58
+ */
59
+ disabled: {
60
+ type: Boolean,
61
+ required: false,
62
+ default: false,
63
+ },
64
+ /**
65
+ * Sets the value of the `name` attribute on the form control.
66
+ */
67
+ name: {
68
+ type: String,
69
+ required: false,
70
+ default: undefined,
71
+ },
72
+ /**
73
+ * Adds the `required` attribute to the form control.
74
+ */
75
+ required: {
76
+ type: Boolean,
77
+ required: false,
78
+ default: false,
79
+ },
80
+ /**
81
+ * Controls the validation state appearance of the component. `true` for valid, `false` for invalid, or `null` for no validation state.
82
+ */
83
+ state: {
84
+ type: Boolean,
85
+ required: false,
86
+ default: null,
87
+ },
88
+ /**
89
+ * 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
90
+ */
91
+ ariaInvalid: {
92
+ type: [Boolean, String],
93
+ required: false,
94
+ default: false,
95
+ },
96
+ },
97
+ data() {
98
+ return {
99
+ internalId: this.id ? this.id : uniqueId('gitlab_ui_radio_group_'),
100
+ localChecked: this.checked,
101
+ };
102
+ },
103
+ computed: {
104
+ computedState() {
105
+ return isBoolean(this.state) ? this.state : null;
106
+ },
107
+ computedAriaInvalid() {
108
+ const { ariaInvalid } = this;
109
+ if (ariaInvalid === true || ariaInvalid === 'true' || ariaInvalid === '') {
110
+ return 'true';
111
+ }
112
+ return this.computedState === false ? 'true' : ariaInvalid;
113
+ },
114
+ computedAttrs() {
115
+ return {
116
+ ...omit(this.$attrs, PASS_DOWN_ATTRS),
117
+ id: this.internalId,
118
+ 'aria-invalid': this.computedAriaInvalid,
119
+ 'aria-required': this.required || null,
120
+ };
121
+ },
122
+ passDownAttrs() {
123
+ return pick(this.$attrs, PASS_DOWN_ATTRS);
124
+ },
125
+ groupName() {
126
+ // Radios tied to the same model must have the same name, especially for
127
+ // ARIA accessibility. This is accessed from the child GlFormRadios.
128
+ return this.name || this.internalId;
129
+ },
130
+ },
131
+ watch: {
132
+ checked(newValue) {
133
+ if (!looseEqual(newValue, this.localChecked)) {
134
+ this.localChecked = newValue;
135
+ }
29
136
  },
30
- onChange(e) {
31
- /**
32
- * Emitted when the selected value is changed.
33
- *
34
- * @event change
35
- */
36
- this.$emit('change', e);
137
+ localChecked(newValue, oldValue) {
138
+ if (!looseEqual(newValue, oldValue)) {
139
+ /**
140
+ * Emitted when the selected value is changed.
141
+ *
142
+ * @event input
143
+ */
144
+ this.$emit('input', newValue);
145
+ }
37
146
  },
38
147
  },
39
148
  };
40
149
  </script>
41
150
  <template>
42
- <b-form-radio-group
43
- class="gl-form-checkbox-group"
44
- stacked
45
- v-bind="$attrs"
46
- v-on="$listeners"
47
- @input="onInput"
48
- @change="onChange"
151
+ <div
152
+ v-bind="computedAttrs"
153
+ role="radiogroup"
154
+ tabindex="-1"
155
+ class="gl-form-radio-group gl-outline-none"
49
156
  >
50
157
  <!-- @slot Slot for GlFormRadios that will appear before radios generated from options prop -->
51
158
  <slot name="first"></slot>
52
159
  <gl-form-radio
53
160
  v-for="(option, idx) in formOptions"
161
+ v-bind="passDownAttrs"
54
162
  :key="idx"
55
163
  :value="option.value"
56
164
  :disabled="option.disabled"
@@ -60,5 +168,5 @@ export default {
60
168
  </gl-form-radio>
61
169
  <!-- @slot Slot for GlFormRadios that will appear after radios generated from options prop -->
62
170
  <slot></slot>
63
- </b-form-radio-group>
171
+ </div>
64
172
  </template>
@@ -7,7 +7,6 @@ $bv-enable-popover-variants: false;
7
7
  @import "../vendor/bootstrap-vue/src/utilities.scss";
8
8
 
9
9
  @import "../vendor/bootstrap-vue/src/components/dropdown/index.scss";
10
- @import "../vendor/bootstrap-vue/src/components/form-radio/index.scss";
11
10
  @import "../vendor/bootstrap-vue/src/components/modal/index.scss";
12
11
  @import "../vendor/bootstrap-vue/src/components/popover/index.scss";
13
12
  @import "../vendor/bootstrap-vue/src/components/table/index.scss";
@@ -13,8 +13,6 @@ export const NAME_DROPDOWN_TEXT = 'BDropdownText'
13
13
  export const NAME_FORM = 'BForm'
14
14
  export const NAME_FORM_GROUP = 'BFormGroup'
15
15
  export const NAME_FORM_INVALID_FEEDBACK = 'BFormInvalidFeedback'
16
- export const NAME_FORM_RADIO = 'BFormRadio'
17
- export const NAME_FORM_RADIO_GROUP = 'BFormRadioGroup'
18
16
  export const NAME_FORM_ROW = 'BFormRow'
19
17
  export const NAME_FORM_SELECT = 'BFormSelect'
20
18
  export const NAME_FORM_SELECT_OPTION = 'BFormSelectOption'
@@ -1,28 +0,0 @@
1
- import { extend } from '../../vue';
2
- import { NAME_FORM_RADIO_GROUP } from '../../constants/components';
3
- import { props as props$1, formRadioCheckGroupMixin } from '../../mixins/form-radio-check-group';
4
-
5
- // --- Props ---
6
-
7
- const props = props$1;
8
-
9
- // --- Main component ---
10
-
11
- // @vue/component
12
- const BFormRadioGroup = /*#__PURE__*/extend({
13
- name: NAME_FORM_RADIO_GROUP,
14
- mixins: [formRadioCheckGroupMixin],
15
- provide() {
16
- return {
17
- getBvRadioGroup: () => this
18
- };
19
- },
20
- props,
21
- computed: {
22
- isRadioGroup() {
23
- return true;
24
- }
25
- }
26
- });
27
-
28
- export { BFormRadioGroup, props };
@@ -1,29 +0,0 @@
1
- import { extend } from '../../vue';
2
- import { NAME_FORM_RADIO } from '../../constants/components';
3
- import { props as props$1, formRadioCheckMixin } from '../../mixins/form-radio-check';
4
-
5
- // --- Props ---
6
-
7
- const props = props$1;
8
-
9
- // --- Main component ---
10
-
11
- // @vue/component
12
- const BFormRadio = /*#__PURE__*/extend({
13
- name: NAME_FORM_RADIO,
14
- mixins: [formRadioCheckMixin],
15
- inject: {
16
- getBvGroup: {
17
- from: 'getBvRadioGroup',
18
- default: () => () => null
19
- }
20
- },
21
- props,
22
- computed: {
23
- bvGroup() {
24
- return this.getBvGroup();
25
- }
26
- }
27
- });
28
-
29
- export { BFormRadio, props };
@@ -1,2 +0,0 @@
1
- export { BFormRadio } from './form-radio';
2
- export { BFormRadioGroup } from './form-radio-group';
@@ -1,127 +0,0 @@
1
- import { extend } from '../vue';
2
- import { PROP_TYPE_BOOLEAN_STRING, PROP_TYPE_BOOLEAN } from '../constants/props';
3
- import { SLOT_NAME_FIRST } from '../constants/slots';
4
- import { htmlOrText } from '../utils/html';
5
- import { looseEqual } from '../utils/loose-equal';
6
- import { makeModelMixin } from '../utils/model';
7
- import { sortKeys, pick, omit } from '../utils/object';
8
- import { makeProp } from '../utils/props';
9
- import { BFormRadio } from '../components/form-radio/form-radio';
10
- import { props as props$2, formControlMixin } from './form-control';
11
- import { props as props$6, formCustomMixin } from './form-custom';
12
- import { props as props$3, formOptionsMixin } from './form-options';
13
- import { props as props$4, formSizeMixin } from './form-size';
14
- import { props as props$5, formStateMixin } from './form-state';
15
- import { props as props$1, idMixin } from './id';
16
- import { normalizeSlotMixin } from './normalize-slot';
17
-
18
- // --- Constants ---
19
-
20
- // Attributes to pass down to checks/radios instead of applying them to the group
21
- const PASS_DOWN_ATTRS = ['aria-describedby', 'aria-labelledby'];
22
- const {
23
- mixin: modelMixin,
24
- props: modelProps,
25
- prop: MODEL_PROP_NAME,
26
- event: MODEL_EVENT_NAME
27
- } = makeModelMixin('checked');
28
-
29
- // --- Props ---
30
-
31
- const props = sortKeys({
32
- ...props$1,
33
- ...modelProps,
34
- ...props$2,
35
- ...props$3,
36
- ...props$4,
37
- ...props$5,
38
- ...props$6,
39
- ariaInvalid: makeProp(PROP_TYPE_BOOLEAN_STRING, false),
40
- stacked: makeProp(PROP_TYPE_BOOLEAN, false),
41
- validated: makeProp(PROP_TYPE_BOOLEAN, false)
42
- });
43
-
44
- // --- Mixin ---
45
-
46
- // @vue/component
47
- const formRadioCheckGroupMixin = extend({
48
- mixins: [idMixin, modelMixin, normalizeSlotMixin, formControlMixin, formOptionsMixin, formSizeMixin, formStateMixin, formCustomMixin],
49
- inheritAttrs: false,
50
- props,
51
- data() {
52
- return {
53
- localChecked: this[MODEL_PROP_NAME]
54
- };
55
- },
56
- computed: {
57
- inline() {
58
- return !this.stacked;
59
- },
60
- groupName() {
61
- // Checks/Radios tied to the same model must have the same name,
62
- // especially for ARIA accessibility
63
- return this.name || this.safeId();
64
- },
65
- groupClasses() {
66
- const {
67
- validated
68
- } = this;
69
- return {
70
- 'was-validated': validated
71
- };
72
- }
73
- },
74
- watch: {
75
- [MODEL_PROP_NAME](newValue) {
76
- if (!looseEqual(newValue, this.localChecked)) {
77
- this.localChecked = newValue;
78
- }
79
- },
80
- localChecked(newValue, oldValue) {
81
- if (!looseEqual(newValue, oldValue)) {
82
- this.$emit(MODEL_EVENT_NAME, newValue);
83
- }
84
- }
85
- },
86
- render(h) {
87
- const {
88
- isRadioGroup
89
- } = this;
90
- const attrs = pick(this.$attrs, PASS_DOWN_ATTRS);
91
- const optionComponent = BFormRadio;
92
- const $inputs = this.formOptions.map((option, index) => {
93
- const key = `BV_option_${index}`;
94
- return h(optionComponent, {
95
- props: {
96
- // Individual radios or checks can be disabled in a group
97
- disabled: option.disabled || false,
98
- id: this.safeId(key),
99
- value: option.value
100
- // We don't need to include these, since the input's will know they are inside here
101
- // form: this.form || null,
102
- // name: this.groupName,
103
- // required: Boolean(this.name && this.required),
104
- // state: this.state
105
- },
106
- attrs,
107
- key
108
- }, [h('span', {
109
- domProps: htmlOrText(option.html, option.text)
110
- })]);
111
- });
112
- return h('div', {
113
- class: [this.groupClasses, 'bv-no-focus-ring'],
114
- attrs: {
115
- ...omit(this.$attrs, PASS_DOWN_ATTRS),
116
- 'aria-invalid': this.computedAriaInvalid,
117
- 'aria-required': this.required ? 'true' : null,
118
- id: this.safeId(),
119
- role: isRadioGroup ? 'radiogroup' : 'group',
120
- // Add `tabindex="-1"` to allow group to be focused if needed by screen readers
121
- tabindex: '-1'
122
- }
123
- }, [this.normalizeSlot(SLOT_NAME_FIRST), $inputs, this.normalizeSlot()]);
124
- }
125
- });
126
-
127
- export { MODEL_EVENT_NAME, MODEL_PROP_NAME, formRadioCheckGroupMixin, props };