@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
@@ -1,224 +0,0 @@
1
- import { extend } from '../vue';
2
- import { PROP_TYPE_STRING, PROP_TYPE_BOOLEAN, PROP_TYPE_ANY } from '../constants/props';
3
- import { EVENT_NAME_CHANGE } from '../constants/events';
4
- import { attemptFocus, attemptBlur } from '../utils/dom';
5
- import { isBoolean } from '../utils/inspect';
6
- import { looseEqual } from '../utils/loose-equal';
7
- import { makeModelMixin } from '../utils/model';
8
- import { sortKeys } from '../utils/object';
9
- import { makeProp } from '../utils/props';
10
- import { attrsMixin } from './attrs';
11
- import { props as props$2, formControlMixin } from './form-control';
12
- import { props as props$5, formCustomMixin } from './form-custom';
13
- import { props as props$3, formSizeMixin } from './form-size';
14
- import { props as props$4, formStateMixin } from './form-state';
15
- import { props as props$1, idMixin } from './id';
16
- import { normalizeSlotMixin } from './normalize-slot';
17
-
18
- // --- Constants ---
19
-
20
- const {
21
- mixin: modelMixin,
22
- props: modelProps,
23
- prop: MODEL_PROP_NAME,
24
- event: MODEL_EVENT_NAME
25
- } = makeModelMixin('checked', {
26
- defaultValue: null
27
- });
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
- ariaLabel: makeProp(PROP_TYPE_STRING),
39
- ariaLabelledby: makeProp(PROP_TYPE_STRING),
40
- inline: makeProp(PROP_TYPE_BOOLEAN, false),
41
- value: makeProp(PROP_TYPE_ANY)
42
- });
43
-
44
- // --- Mixin ---
45
-
46
- // @vue/component
47
- const formRadioCheckMixin = extend({
48
- mixins: [attrsMixin, idMixin, modelMixin, normalizeSlotMixin, formControlMixin, formSizeMixin, formStateMixin, formCustomMixin],
49
- inheritAttrs: false,
50
- props,
51
- data() {
52
- return {
53
- localChecked: this.isGroup ? this.bvGroup[MODEL_PROP_NAME] : this[MODEL_PROP_NAME]
54
- };
55
- },
56
- computed: {
57
- computedLocalChecked: {
58
- get() {
59
- return this.isGroup ? this.bvGroup.localChecked : this.localChecked;
60
- },
61
- set(value) {
62
- if (this.isGroup) {
63
- this.bvGroup.localChecked = value;
64
- } else {
65
- this.localChecked = value;
66
- }
67
- }
68
- },
69
- isChecked() {
70
- return looseEqual(this.value, this.computedLocalChecked);
71
- },
72
- isRadio() {
73
- return true;
74
- },
75
- isGroup() {
76
- // Is this check/radio a child of check-group or radio-group?
77
- return !!this.bvGroup;
78
- },
79
- isSwitch() {
80
- // Custom switch styling (checkboxes only)
81
- return this.isRadio ? false : this.isGroup ? this.bvGroup.switches : this.switch;
82
- },
83
- isInline() {
84
- return this.isGroup ? this.bvGroup.inline : this.inline;
85
- },
86
- isDisabled() {
87
- // Child can be disabled while parent isn't, but is always disabled if group is
88
- return this.isGroup ? this.bvGroup.disabled || this.disabled : this.disabled;
89
- },
90
- isRequired() {
91
- // Required only works when a name is provided for the input(s)
92
- // Child can only be required when parent is
93
- // Groups will always have a name (either user supplied or auto generated)
94
- return this.computedName && (this.isGroup ? this.bvGroup.required : this.required);
95
- },
96
- computedName() {
97
- // Group name preferred over local name
98
- return (this.isGroup ? this.bvGroup.groupName : this.name) || null;
99
- },
100
- computedForm() {
101
- return (this.isGroup ? this.bvGroup.form : this.form) || null;
102
- },
103
- computedSize() {
104
- return (this.isGroup ? this.bvGroup.size : this.size) || '';
105
- },
106
- computedState() {
107
- return this.isGroup ? this.bvGroup.computedState : isBoolean(this.state) ? this.state : null;
108
- },
109
- computedAttrs() {
110
- const {
111
- isDisabled: disabled,
112
- isRequired: required
113
- } = this;
114
- return {
115
- ...this.bvAttrs,
116
- id: this.safeId(),
117
- type: this.isRadio ? 'radio' : 'checkbox',
118
- name: this.computedName,
119
- form: this.computedForm,
120
- disabled,
121
- required,
122
- 'aria-required': required || null,
123
- 'aria-label': this.ariaLabel || null,
124
- 'aria-labelledby': this.ariaLabelledby || null
125
- };
126
- }
127
- },
128
- watch: {
129
- [MODEL_PROP_NAME]() {
130
- this[`${MODEL_PROP_NAME}Watcher`](...arguments);
131
- },
132
- computedLocalChecked() {
133
- this.computedLocalCheckedWatcher(...arguments);
134
- }
135
- },
136
- methods: {
137
- [`${MODEL_PROP_NAME}Watcher`](newValue) {
138
- if (!looseEqual(newValue, this.computedLocalChecked)) {
139
- this.computedLocalChecked = newValue;
140
- }
141
- },
142
- computedLocalCheckedWatcher(newValue, oldValue) {
143
- if (!looseEqual(newValue, oldValue)) {
144
- this.$emit(MODEL_EVENT_NAME, newValue);
145
- }
146
- },
147
- handleChange(_ref) {
148
- let {
149
- target: {
150
- checked
151
- }
152
- } = _ref;
153
- const {
154
- value
155
- } = this;
156
- const localChecked = checked ? value : null;
157
- this.computedLocalChecked = value;
158
-
159
- // Fire events in a `$nextTick()` to ensure the `v-model` is updated
160
- this.$nextTick(() => {
161
- // Change is only emitted on user interaction
162
- this.$emit(EVENT_NAME_CHANGE, localChecked);
163
-
164
- // If this is a child of a group, we emit a change event on it as well
165
- if (this.isGroup) {
166
- this.bvGroup.$emit(EVENT_NAME_CHANGE, localChecked);
167
- }
168
- });
169
- },
170
- // Convenience methods for focusing the input
171
- focus() {
172
- if (!this.isDisabled) {
173
- attemptFocus(this.$refs.input);
174
- }
175
- },
176
- blur() {
177
- if (!this.isDisabled) {
178
- attemptBlur(this.$refs.input);
179
- }
180
- }
181
- },
182
- render(h) {
183
- const {
184
- isRadio,
185
- isInline,
186
- isSwitch,
187
- computedSize,
188
- bvAttrs
189
- } = this;
190
- const $content = this.normalizeSlot();
191
- const $input = h('input', {
192
- class: ['custom-control-input', this.stateClass],
193
- attrs: this.computedAttrs,
194
- domProps: {
195
- value: this.value,
196
- checked: this.isChecked
197
- },
198
- on: {
199
- change: this.handleChange
200
- },
201
- key: 'input',
202
- ref: 'input'
203
- });
204
- const $label = h('label', {
205
- class: 'custom-control-label',
206
- attrs: {
207
- for: this.safeId()
208
- }
209
- }, $content);
210
- return h('div', {
211
- class: [{
212
- 'custom-control-inline': isInline,
213
- 'custom-checkbox': !isRadio && !isSwitch,
214
- 'custom-switch': isSwitch,
215
- 'custom-radio': isRadio,
216
- // Temporary until Bootstrap v4 supports sizing (most likely in V5)
217
- [`b-custom-control-${computedSize}`]: computedSize
218
- }, 'custom-control', bvAttrs.class],
219
- style: bvAttrs.style
220
- }, [$input, $label]);
221
- }
222
- });
223
-
224
- export { MODEL_EVENT_NAME, MODEL_PROP_NAME, formRadioCheckMixin, props };
@@ -1 +0,0 @@
1
- @import "../../utilities";
@@ -1,47 +0,0 @@
1
- // Adds control sizing to Bootstrap custom radio inputs
2
-
3
- .custom-radio.b-custom-control-lg,
4
- .input-group-lg .custom-radio {
5
- font-size: $font-size-lg;
6
- line-height: $line-height-lg;
7
- padding-left: $b-custom-control-gutter-lg + $b-custom-control-indicator-size-lg;
8
-
9
- .custom-control-label::before {
10
- top: ($font-size-lg * $line-height-lg - $b-custom-control-indicator-size-lg) * 0.5;
11
- left: -($b-custom-control-gutter-lg + $b-custom-control-indicator-size-lg);
12
- width: $b-custom-control-indicator-size-lg;
13
- height: $b-custom-control-indicator-size-lg;
14
- border-radius: $b-custom-radio-indicator-border-radius-lg;
15
- }
16
-
17
- .custom-control-label::after {
18
- top: ($font-size-lg * $line-height-lg - $b-custom-control-indicator-size-lg) * 0.5;
19
- left: -($b-custom-control-gutter-lg + $b-custom-control-indicator-size-lg);
20
- width: $b-custom-control-indicator-size-lg;
21
- height: $b-custom-control-indicator-size-lg;
22
- background: no-repeat 50% / #{$b-custom-control-indicator-bg-size-lg};
23
- }
24
- }
25
-
26
- .custom-radio.b-custom-control-sm,
27
- .input-group-sm .custom-radio {
28
- font-size: $font-size-sm;
29
- line-height: $line-height-sm;
30
- padding-left: $b-custom-control-gutter-sm + $b-custom-control-indicator-size-sm;
31
-
32
- .custom-control-label::before {
33
- top: ($font-size-sm * $line-height-sm - $b-custom-control-indicator-size-sm) * 0.5;
34
- left: -($b-custom-control-gutter-sm + $b-custom-control-indicator-size-sm);
35
- width: $b-custom-control-indicator-size-sm;
36
- height: $b-custom-control-indicator-size-sm;
37
- border-radius: $b-custom-radio-indicator-border-radius-sm;
38
- }
39
-
40
- .custom-control-label::after {
41
- top: ($font-size-sm * $line-height-sm - $b-custom-control-indicator-size-sm) * 0.5;
42
- left: -($b-custom-control-gutter-sm + $b-custom-control-indicator-size-sm);
43
- width: $b-custom-control-indicator-size-sm;
44
- height: $b-custom-control-indicator-size-sm;
45
- background: no-repeat 50% / #{$b-custom-control-indicator-bg-size-sm};
46
- }
47
- }
@@ -1,29 +0,0 @@
1
- import { extend } from '../../vue'
2
- import { NAME_FORM_RADIO_GROUP } from '../../constants/components'
3
- import {
4
- formRadioCheckGroupMixin,
5
- props as formRadioCheckGroupProps
6
- } from '../../mixins/form-radio-check-group'
7
-
8
- // --- Props ---
9
-
10
- export const props = formRadioCheckGroupProps
11
-
12
- // --- Main component ---
13
-
14
- // @vue/component
15
- export const BFormRadioGroup = /*#__PURE__*/ extend({
16
- name: NAME_FORM_RADIO_GROUP,
17
- mixins: [formRadioCheckGroupMixin],
18
- provide() {
19
- return {
20
- getBvRadioGroup: () => this
21
- }
22
- },
23
- props,
24
- computed: {
25
- isRadioGroup() {
26
- return true
27
- }
28
- }
29
- })
@@ -1,27 +0,0 @@
1
- import { extend } from '../../vue'
2
- import { NAME_FORM_RADIO } from '../../constants/components'
3
- import { formRadioCheckMixin, props as formRadioCheckProps } from '../../mixins/form-radio-check'
4
-
5
- // --- Props ---
6
-
7
- export const props = formRadioCheckProps
8
-
9
- // --- Main component ---
10
-
11
- // @vue/component
12
- export 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
- })
@@ -1,4 +0,0 @@
1
- import { BFormRadio } from './form-radio'
2
- import { BFormRadioGroup } from './form-radio-group'
3
-
4
- export { BFormRadio, BFormRadioGroup }
@@ -1,2 +0,0 @@
1
- @import "form-radio";
2
- @import "form-radio-group";
@@ -1,141 +0,0 @@
1
- import { extend } from '../vue'
2
- import { PROP_TYPE_BOOLEAN, PROP_TYPE_BOOLEAN_STRING } 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 { omit, pick, sortKeys } from '../utils/object'
8
- import { makeProp } from '../utils/props'
9
- import { BFormRadio } from '../components/form-radio/form-radio'
10
- import { formControlMixin, props as formControlProps } from './form-control'
11
- import { formCustomMixin, props as formCustomProps } from './form-custom'
12
- import { formOptionsMixin, props as formOptionsProps } from './form-options'
13
- import { formSizeMixin, props as formSizeProps } from './form-size'
14
- import { formStateMixin, props as formStateProps } from './form-state'
15
- import { idMixin, props as idProps } 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
-
23
- const {
24
- mixin: modelMixin,
25
- props: modelProps,
26
- prop: MODEL_PROP_NAME,
27
- event: MODEL_EVENT_NAME
28
- } = makeModelMixin('checked')
29
-
30
- export { MODEL_PROP_NAME, MODEL_EVENT_NAME }
31
-
32
- // --- Props ---
33
-
34
- export const props = sortKeys({
35
- ...idProps,
36
- ...modelProps,
37
- ...formControlProps,
38
- ...formOptionsProps,
39
- ...formSizeProps,
40
- ...formStateProps,
41
- ...formCustomProps,
42
- ariaInvalid: makeProp(PROP_TYPE_BOOLEAN_STRING, false),
43
- stacked: makeProp(PROP_TYPE_BOOLEAN, false),
44
- validated: makeProp(PROP_TYPE_BOOLEAN, false)
45
- })
46
-
47
- // --- Mixin ---
48
-
49
- // @vue/component
50
- export const formRadioCheckGroupMixin = extend({
51
- mixins: [
52
- idMixin,
53
- modelMixin,
54
- normalizeSlotMixin,
55
- formControlMixin,
56
- formOptionsMixin,
57
- formSizeMixin,
58
- formStateMixin,
59
- formCustomMixin
60
- ],
61
- inheritAttrs: false,
62
- props,
63
- data() {
64
- return {
65
- localChecked: this[MODEL_PROP_NAME]
66
- }
67
- },
68
- computed: {
69
- inline() {
70
- return !this.stacked
71
- },
72
- groupName() {
73
- // Checks/Radios tied to the same model must have the same name,
74
- // especially for ARIA accessibility
75
- return this.name || this.safeId()
76
- },
77
- groupClasses() {
78
- const { validated } = this
79
-
80
- return { 'was-validated': validated }
81
- }
82
- },
83
- watch: {
84
- [MODEL_PROP_NAME](newValue) {
85
- if (!looseEqual(newValue, this.localChecked)) {
86
- this.localChecked = newValue
87
- }
88
- },
89
- localChecked(newValue, oldValue) {
90
- if (!looseEqual(newValue, oldValue)) {
91
- this.$emit(MODEL_EVENT_NAME, newValue)
92
- }
93
- }
94
- },
95
- render(h) {
96
- const { isRadioGroup } = this
97
- const attrs = pick(this.$attrs, PASS_DOWN_ATTRS)
98
- const optionComponent = BFormRadio
99
-
100
- const $inputs = this.formOptions.map((option, index) => {
101
- const key = `BV_option_${index}`
102
-
103
- return h(
104
- optionComponent,
105
- {
106
- props: {
107
- // Individual radios or checks can be disabled in a group
108
- disabled: option.disabled || false,
109
- id: this.safeId(key),
110
- value: option.value
111
- // We don't need to include these, since the input's will know they are inside here
112
- // form: this.form || null,
113
- // name: this.groupName,
114
- // required: Boolean(this.name && this.required),
115
- // state: this.state
116
- },
117
- attrs,
118
- key
119
- },
120
- [h('span', { domProps: htmlOrText(option.html, option.text) })]
121
- )
122
- })
123
-
124
- return h(
125
- 'div',
126
- {
127
- class: [this.groupClasses, 'bv-no-focus-ring'],
128
- attrs: {
129
- ...omit(this.$attrs, PASS_DOWN_ATTRS),
130
- 'aria-invalid': this.computedAriaInvalid,
131
- 'aria-required': this.required ? 'true' : null,
132
- id: this.safeId(),
133
- role: isRadioGroup ? 'radiogroup' : 'group',
134
- // Add `tabindex="-1"` to allow group to be focused if needed by screen readers
135
- tabindex: '-1'
136
- }
137
- },
138
- [this.normalizeSlot(SLOT_NAME_FIRST), $inputs, this.normalizeSlot()]
139
- )
140
- }
141
- })