@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,233 +0,0 @@
1
- import { extend } from '../vue'
2
- import { PROP_TYPE_ANY, PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../constants/props'
3
- import { EVENT_NAME_CHANGE } from '../constants/events'
4
- import { attemptBlur, attemptFocus } 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 { formControlMixin, props as formControlProps } from './form-control'
12
- import { formCustomMixin, props as formCustomProps } from './form-custom'
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
- const {
21
- mixin: modelMixin,
22
- props: modelProps,
23
- prop: MODEL_PROP_NAME,
24
- event: MODEL_EVENT_NAME
25
- } = makeModelMixin('checked', { defaultValue: null })
26
-
27
- export { MODEL_PROP_NAME, MODEL_EVENT_NAME }
28
-
29
- // --- Props ---
30
-
31
- export const props = sortKeys({
32
- ...idProps,
33
- ...modelProps,
34
- ...formControlProps,
35
- ...formSizeProps,
36
- ...formStateProps,
37
- ...formCustomProps,
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
- export const formRadioCheckMixin = extend({
48
- mixins: [
49
- attrsMixin,
50
- idMixin,
51
- modelMixin,
52
- normalizeSlotMixin,
53
- formControlMixin,
54
- formSizeMixin,
55
- formStateMixin,
56
- formCustomMixin
57
- ],
58
- inheritAttrs: false,
59
- props,
60
- data() {
61
- return {
62
- localChecked: this.isGroup ? this.bvGroup[MODEL_PROP_NAME] : this[MODEL_PROP_NAME]
63
- }
64
- },
65
- computed: {
66
- computedLocalChecked: {
67
- get() {
68
- return this.isGroup ? this.bvGroup.localChecked : this.localChecked
69
- },
70
- set(value) {
71
- if (this.isGroup) {
72
- this.bvGroup.localChecked = value
73
- } else {
74
- this.localChecked = value
75
- }
76
- }
77
- },
78
- isChecked() {
79
- return looseEqual(this.value, this.computedLocalChecked)
80
- },
81
- isRadio() {
82
- return true
83
- },
84
- isGroup() {
85
- // Is this check/radio a child of check-group or radio-group?
86
- return !!this.bvGroup
87
- },
88
- isSwitch() {
89
- // Custom switch styling (checkboxes only)
90
- return this.isRadio ? false : this.isGroup ? this.bvGroup.switches : this.switch
91
- },
92
- isInline() {
93
- return this.isGroup ? this.bvGroup.inline : this.inline
94
- },
95
- isDisabled() {
96
- // Child can be disabled while parent isn't, but is always disabled if group is
97
- return this.isGroup ? this.bvGroup.disabled || this.disabled : this.disabled
98
- },
99
- isRequired() {
100
- // Required only works when a name is provided for the input(s)
101
- // Child can only be required when parent is
102
- // Groups will always have a name (either user supplied or auto generated)
103
- return this.computedName && (this.isGroup ? this.bvGroup.required : this.required)
104
- },
105
- computedName() {
106
- // Group name preferred over local name
107
- return (this.isGroup ? this.bvGroup.groupName : this.name) || null
108
- },
109
- computedForm() {
110
- return (this.isGroup ? this.bvGroup.form : this.form) || null
111
- },
112
- computedSize() {
113
- return (this.isGroup ? this.bvGroup.size : this.size) || ''
114
- },
115
- computedState() {
116
- return this.isGroup ? this.bvGroup.computedState : isBoolean(this.state) ? this.state : null
117
- },
118
- computedAttrs() {
119
- const { isDisabled: disabled, isRequired: required } = this
120
-
121
- return {
122
- ...this.bvAttrs,
123
- id: this.safeId(),
124
- type: this.isRadio ? 'radio' : 'checkbox',
125
- name: this.computedName,
126
- form: this.computedForm,
127
- disabled,
128
- required,
129
- 'aria-required': required || null,
130
- 'aria-label': this.ariaLabel || null,
131
- 'aria-labelledby': this.ariaLabelledby || null
132
- }
133
- }
134
- },
135
- watch: {
136
- [MODEL_PROP_NAME](...args) {
137
- this[`${MODEL_PROP_NAME}Watcher`](...args)
138
- },
139
- computedLocalChecked(...args) {
140
- this.computedLocalCheckedWatcher(...args)
141
- }
142
- },
143
- methods: {
144
- [`${MODEL_PROP_NAME}Watcher`](newValue) {
145
- if (!looseEqual(newValue, this.computedLocalChecked)) {
146
- this.computedLocalChecked = newValue
147
- }
148
- },
149
- computedLocalCheckedWatcher(newValue, oldValue) {
150
- if (!looseEqual(newValue, oldValue)) {
151
- this.$emit(MODEL_EVENT_NAME, newValue)
152
- }
153
- },
154
-
155
- handleChange({ target: { checked } }) {
156
- const { value } = this
157
- const localChecked = checked ? value : null
158
-
159
- this.computedLocalChecked = value
160
-
161
- // Fire events in a `$nextTick()` to ensure the `v-model` is updated
162
- this.$nextTick(() => {
163
- // Change is only emitted on user interaction
164
- this.$emit(EVENT_NAME_CHANGE, localChecked)
165
-
166
- // If this is a child of a group, we emit a change event on it as well
167
- if (this.isGroup) {
168
- this.bvGroup.$emit(EVENT_NAME_CHANGE, localChecked)
169
- }
170
- })
171
- },
172
-
173
- // Convenience methods for focusing the input
174
- focus() {
175
- if (!this.isDisabled) {
176
- attemptFocus(this.$refs.input)
177
- }
178
- },
179
-
180
- blur() {
181
- if (!this.isDisabled) {
182
- attemptBlur(this.$refs.input)
183
- }
184
- }
185
- },
186
- render(h) {
187
- const { isRadio, isInline, isSwitch, computedSize, bvAttrs } = this
188
- const $content = this.normalizeSlot()
189
-
190
- const $input = h('input', {
191
- class: ['custom-control-input', this.stateClass],
192
- attrs: this.computedAttrs,
193
- domProps: {
194
- value: this.value,
195
- checked: this.isChecked
196
- },
197
- on: {
198
- change: this.handleChange
199
- },
200
- key: 'input',
201
- ref: 'input'
202
- })
203
-
204
- const $label = h(
205
- 'label',
206
- {
207
- class: 'custom-control-label',
208
- attrs: { for: this.safeId() }
209
- },
210
- $content
211
- )
212
-
213
- return h(
214
- 'div',
215
- {
216
- class: [
217
- {
218
- 'custom-control-inline': isInline,
219
- 'custom-checkbox': !isRadio && !isSwitch,
220
- 'custom-switch': isSwitch,
221
- 'custom-radio': isRadio,
222
- // Temporary until Bootstrap v4 supports sizing (most likely in V5)
223
- [`b-custom-control-${computedSize}`]: computedSize
224
- },
225
- 'custom-control',
226
- bvAttrs.class
227
- ],
228
- style: bvAttrs.style
229
- },
230
- [$input, $label]
231
- )
232
- }
233
- })