@gitlab/ui 128.17.0 → 129.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 (113) hide show
  1. package/dist/components/base/form/form_checkbox/form_checkbox.js +4 -2
  2. package/dist/components/base/form/form_radio/form_radio.js +209 -11
  3. package/dist/components/base/tooltip/tooltip.js +1 -3
  4. package/dist/config.js +0 -37
  5. package/dist/utils/constants.js +1 -7
  6. package/dist/vendor/bootstrap-vue/src/components/button/button-close.js +3 -3
  7. package/dist/vendor/bootstrap-vue/src/components/button/button.js +3 -3
  8. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.js +3 -3
  9. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.js +3 -3
  10. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.js +3 -3
  11. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.js +3 -3
  12. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.js +3 -3
  13. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.js +3 -3
  14. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.js +3 -3
  15. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown.js +3 -3
  16. package/dist/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.js +3 -3
  17. package/dist/vendor/bootstrap-vue/src/components/form/form-text.js +3 -3
  18. package/dist/vendor/bootstrap-vue/src/components/form/form-valid-feedback.js +3 -3
  19. package/dist/vendor/bootstrap-vue/src/components/form/form.js +3 -3
  20. package/dist/vendor/bootstrap-vue/src/components/form-group/form-group.js +3 -3
  21. package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +1 -2
  22. package/dist/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +1 -2
  23. package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +3 -3
  24. package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +3 -3
  25. package/dist/vendor/bootstrap-vue/src/components/form-select/form-select.js +3 -3
  26. package/dist/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +3 -3
  27. package/dist/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +3 -3
  28. package/dist/vendor/bootstrap-vue/src/components/layout/col.js +3 -3
  29. package/dist/vendor/bootstrap-vue/src/components/layout/form-row.js +3 -3
  30. package/dist/vendor/bootstrap-vue/src/components/modal/modal.js +3 -3
  31. package/dist/vendor/bootstrap-vue/src/components/popover/popover.js +8 -4
  32. package/dist/vendor/bootstrap-vue/src/components/table/table-lite.js +2 -3
  33. package/dist/vendor/bootstrap-vue/src/components/table/table-simple.js +2 -3
  34. package/dist/vendor/bootstrap-vue/src/components/table/table.js +2 -3
  35. package/dist/vendor/bootstrap-vue/src/components/table/tbody.js +3 -3
  36. package/dist/vendor/bootstrap-vue/src/components/table/td.js +3 -3
  37. package/dist/vendor/bootstrap-vue/src/components/table/tfoot.js +3 -3
  38. package/dist/vendor/bootstrap-vue/src/components/table/th.js +1 -2
  39. package/dist/vendor/bootstrap-vue/src/components/table/thead.js +3 -3
  40. package/dist/vendor/bootstrap-vue/src/components/table/tr.js +3 -3
  41. package/dist/vendor/bootstrap-vue/src/components/tabs/tab.js +3 -3
  42. package/dist/vendor/bootstrap-vue/src/components/tabs/tabs.js +3 -3
  43. package/dist/vendor/bootstrap-vue/src/components/toast/toast.js +3 -3
  44. package/dist/vendor/bootstrap-vue/src/components/toast/toaster.js +3 -3
  45. package/dist/vendor/bootstrap-vue/src/components/tooltip/tooltip.js +7 -6
  46. package/dist/vendor/bootstrap-vue/src/constants/config.js +7 -1
  47. package/dist/vendor/bootstrap-vue/src/directives/tooltip/tooltip.js +6 -7
  48. package/dist/vendor/bootstrap-vue/src/mixins/dropdown.js +3 -3
  49. package/dist/vendor/bootstrap-vue/src/mixins/form-control.js +3 -3
  50. package/dist/vendor/bootstrap-vue/src/mixins/form-custom.js +3 -3
  51. package/dist/vendor/bootstrap-vue/src/mixins/form-options.js +3 -3
  52. package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +3 -3
  53. package/dist/vendor/bootstrap-vue/src/mixins/form-radio-check.js +3 -3
  54. package/dist/vendor/bootstrap-vue/src/mixins/form-size.js +3 -3
  55. package/dist/vendor/bootstrap-vue/src/mixins/form-state.js +3 -3
  56. package/dist/vendor/bootstrap-vue/src/mixins/form-text.js +3 -3
  57. package/package.json +1 -1
  58. package/src/components/base/form/form_checkbox/form_checkbox.vue +4 -2
  59. package/src/components/base/form/form_radio/form_radio.vue +220 -31
  60. package/src/components/base/tooltip/tooltip.vue +0 -3
  61. package/src/config.js +0 -40
  62. package/src/utils/constants.js +0 -6
  63. package/src/vendor/bootstrap-vue/src/components/button/button-close.js +7 -10
  64. package/src/vendor/bootstrap-vue/src/components/button/button.js +13 -16
  65. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.js +4 -7
  66. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.js +6 -9
  67. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.js +9 -12
  68. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.js +6 -9
  69. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.js +9 -12
  70. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.js +6 -9
  71. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.js +6 -9
  72. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.js +27 -30
  73. package/src/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.js +11 -14
  74. package/src/vendor/bootstrap-vue/src/components/form/form-text.js +7 -10
  75. package/src/vendor/bootstrap-vue/src/components/form/form-valid-feedback.js +11 -14
  76. package/src/vendor/bootstrap-vue/src/components/form/form.js +7 -10
  77. package/src/vendor/bootstrap-vue/src/components/form-group/form-group.js +27 -30
  78. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio-group.js +1 -2
  79. package/src/vendor/bootstrap-vue/src/components/form-radio/form-radio.js +1 -2
  80. package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +5 -8
  81. package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +5 -8
  82. package/src/vendor/bootstrap-vue/src/components/form-select/form-select.js +14 -17
  83. package/src/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +6 -9
  84. package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +17 -20
  85. package/src/vendor/bootstrap-vue/src/components/layout/col.js +16 -19
  86. package/src/vendor/bootstrap-vue/src/components/layout/form-row.js +4 -7
  87. package/src/vendor/bootstrap-vue/src/components/modal/modal.js +59 -62
  88. package/src/vendor/bootstrap-vue/src/components/popover/popover.js +13 -11
  89. package/src/vendor/bootstrap-vue/src/components/table/table-lite.js +11 -15
  90. package/src/vendor/bootstrap-vue/src/components/table/table-simple.js +5 -9
  91. package/src/vendor/bootstrap-vue/src/components/table/table.js +20 -24
  92. package/src/vendor/bootstrap-vue/src/components/table/tbody.js +5 -8
  93. package/src/vendor/bootstrap-vue/src/components/table/td.js +8 -11
  94. package/src/vendor/bootstrap-vue/src/components/table/tfoot.js +5 -8
  95. package/src/vendor/bootstrap-vue/src/components/table/th.js +1 -2
  96. package/src/vendor/bootstrap-vue/src/components/table/thead.js +6 -9
  97. package/src/vendor/bootstrap-vue/src/components/table/tr.js +4 -7
  98. package/src/vendor/bootstrap-vue/src/components/tabs/tab.js +16 -19
  99. package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +22 -25
  100. package/src/vendor/bootstrap-vue/src/components/toast/toast.js +23 -26
  101. package/src/vendor/bootstrap-vue/src/components/toast/toaster.js +9 -12
  102. package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.js +36 -38
  103. package/src/vendor/bootstrap-vue/src/constants/config.js +6 -0
  104. package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.js +6 -7
  105. package/src/vendor/bootstrap-vue/src/mixins/dropdown.js +22 -25
  106. package/src/vendor/bootstrap-vue/src/mixins/form-control.js +9 -12
  107. package/src/vendor/bootstrap-vue/src/mixins/form-custom.js +4 -7
  108. package/src/vendor/bootstrap-vue/src/mixins/form-options.js +8 -11
  109. package/src/vendor/bootstrap-vue/src/mixins/form-radio-check-group.js +13 -16
  110. package/src/vendor/bootstrap-vue/src/mixins/form-radio-check.js +13 -16
  111. package/src/vendor/bootstrap-vue/src/mixins/form-size.js +4 -7
  112. package/src/vendor/bootstrap-vue/src/mixins/form-state.js +5 -8
  113. package/src/vendor/bootstrap-vue/src/mixins/form-text.js +17 -20
@@ -2,4 +2,10 @@ const NAME = 'BvConfig';
2
2
  const PROP_NAME = '$bvConfig';
3
3
  const DEFAULT_BREAKPOINT = ['xs', 'sm', 'md', 'lg', 'xl'];
4
4
 
5
- export { DEFAULT_BREAKPOINT, NAME, PROP_NAME };
5
+ // in milliseconds
6
+ const TOOLTIP_DELAY = {
7
+ show: 500,
8
+ hide: 0
9
+ };
10
+
11
+ export { DEFAULT_BREAKPOINT, NAME, PROP_NAME, TOOLTIP_DELAY };
@@ -1,10 +1,9 @@
1
- import { NAME_TOOLTIP } from '../../constants/components';
2
1
  import { IS_BROWSER } from '../../constants/env';
3
2
  import { EVENT_NAME_SHOW } from '../../constants/events';
4
3
  import { concat } from '../../utils/array';
5
4
  import { isVue3 } from '../../vue';
6
- import { getComponentConfig } from '../../utils/config';
7
5
  import { getScopeId } from '../../utils/get-scope-id';
6
+ import { TOOLTIP_DELAY } from '../../constants/config';
8
7
  import { identity } from '../../utils/identity';
9
8
  import { getInstanceFromDirective } from '../../utils/get-instance-from-directive';
10
9
  import { isFunction, isString, isNumber, isPlainObject, isUndefined, isUndefinedOrNull } from '../../utils/inspect';
@@ -60,11 +59,11 @@ const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to
60
59
  html: false,
61
60
  interactive: true,
62
61
  disabled: false,
63
- delay: getComponentConfig(NAME_TOOLTIP, 'delay', 50),
64
- boundary: String(getComponentConfig(NAME_TOOLTIP, 'boundary', 'scrollParent')),
65
- boundaryPadding: toInteger(getComponentConfig(NAME_TOOLTIP, 'boundaryPadding', 5), 0),
66
- variant: getComponentConfig(NAME_TOOLTIP, 'variant'),
67
- customClass: getComponentConfig(NAME_TOOLTIP, 'customClass')
62
+ delay: TOOLTIP_DELAY,
63
+ boundary: 'scrollParent',
64
+ boundaryPadding: 5,
65
+ variant: undefined,
66
+ customClass: 'gl-tooltip'
68
67
  };
69
68
  // Process `bindings.value`
70
69
  if (isString(bindings.value) || isNumber(bindings.value)) {
@@ -10,7 +10,7 @@ import { BvEvent } from '../utils/bv-event.class';
10
10
  import { requestAF, contains, closest, attemptFocus, selectAll, isVisible } from '../utils/dom';
11
11
  import { getRootEventName, stopEvent } from '../utils/events';
12
12
  import { sortKeys, mergeDeep } from '../utils/object';
13
- import { makePropsConfigurable, makeProp } from '../utils/props';
13
+ import { makeProp } from '../utils/props';
14
14
  import { warn } from '../utils/warn';
15
15
  import { clickOutMixin } from './click-out';
16
16
  import { focusInMixin } from './focus-in';
@@ -34,7 +34,7 @@ const filterVisibles = els => (els || []).filter(isVisible);
34
34
 
35
35
  // --- Props ---
36
36
 
37
- const props = makePropsConfigurable(sortKeys({
37
+ const props = sortKeys({
38
38
  ...props$1,
39
39
  // String: `scrollParent`, `window` or `viewport`
40
40
  // HTMLElement: HTML Element reference
@@ -54,7 +54,7 @@ const props = makePropsConfigurable(sortKeys({
54
54
  popperOpts: makeProp(PROP_TYPE_OBJECT, {}),
55
55
  // Right align menu (default is left align)
56
56
  right: makeProp(PROP_TYPE_BOOLEAN, false)
57
- }), NAME_DROPDOWN);
57
+ });
58
58
 
59
59
  // --- Mixin ---
60
60
 
@@ -1,7 +1,7 @@
1
1
  import { extend } from '../vue';
2
2
  import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../constants/props';
3
3
  import { requestAF, isVisible, matches, select, attemptFocus } from '../utils/dom';
4
- import { makePropsConfigurable, makeProp } from '../utils/props';
4
+ import { makeProp } from '../utils/props';
5
5
 
6
6
  // --- Constants ---
7
7
 
@@ -9,14 +9,14 @@ const SELECTOR = 'input, textarea, select';
9
9
 
10
10
  // --- Props ---
11
11
 
12
- const props = makePropsConfigurable({
12
+ const props = {
13
13
  autofocus: makeProp(PROP_TYPE_BOOLEAN, false),
14
14
  disabled: makeProp(PROP_TYPE_BOOLEAN, false),
15
15
  form: makeProp(PROP_TYPE_STRING),
16
16
  id: makeProp(PROP_TYPE_STRING),
17
17
  name: makeProp(PROP_TYPE_STRING),
18
18
  required: makeProp(PROP_TYPE_BOOLEAN, false)
19
- }, 'formControls');
19
+ };
20
20
 
21
21
  // --- Mixin ---
22
22
 
@@ -1,12 +1,12 @@
1
1
  import { extend } from '../vue';
2
2
  import { PROP_TYPE_BOOLEAN } from '../constants/props';
3
- import { makePropsConfigurable, makeProp } from '../utils/props';
3
+ import { makeProp } from '../utils/props';
4
4
 
5
5
  // --- Props ---
6
6
 
7
- const props = makePropsConfigurable({
7
+ const props = {
8
8
  plain: makeProp(PROP_TYPE_BOOLEAN, false)
9
- }, 'formControls');
9
+ };
10
10
 
11
11
  // --- Mixin ---
12
12
 
@@ -4,7 +4,7 @@ import { get } from '../utils/get';
4
4
  import { stripTags } from '../utils/html';
5
5
  import { isPlainObject, isUndefined, isArray } from '../utils/inspect';
6
6
  import { keys } from '../utils/object';
7
- import { makePropsConfigurable, makeProp } from '../utils/props';
7
+ import { makeProp } from '../utils/props';
8
8
  import { warn } from '../utils/warn';
9
9
 
10
10
  // --- Constants ---
@@ -13,13 +13,13 @@ const OPTIONS_OBJECT_DEPRECATED_MSG = 'Setting prop "options" to an object is de
13
13
 
14
14
  // --- Props ---
15
15
 
16
- const props = makePropsConfigurable({
16
+ const props = {
17
17
  disabledField: makeProp(PROP_TYPE_STRING, 'disabled'),
18
18
  htmlField: makeProp(PROP_TYPE_STRING, 'html'),
19
19
  options: makeProp(PROP_TYPE_ARRAY_OBJECT, []),
20
20
  textField: makeProp(PROP_TYPE_STRING, 'text'),
21
21
  valueField: makeProp(PROP_TYPE_STRING, 'value')
22
- }, 'formOptionControls');
22
+ };
23
23
 
24
24
  // --- Mixin ---
25
25
 
@@ -5,7 +5,7 @@ import { htmlOrText } from '../utils/html';
5
5
  import { looseEqual } from '../utils/loose-equal';
6
6
  import { makeModelMixin } from '../utils/model';
7
7
  import { sortKeys, pick, omit } from '../utils/object';
8
- import { makePropsConfigurable, makeProp } from '../utils/props';
8
+ import { makeProp } from '../utils/props';
9
9
  import { BFormRadio } from '../components/form-radio/form-radio';
10
10
  import { props as props$2, formControlMixin } from './form-control';
11
11
  import { props as props$6, formCustomMixin } from './form-custom';
@@ -28,7 +28,7 @@ const {
28
28
 
29
29
  // --- Props ---
30
30
 
31
- const props = makePropsConfigurable(sortKeys({
31
+ const props = sortKeys({
32
32
  ...props$1,
33
33
  ...modelProps,
34
34
  ...props$2,
@@ -39,7 +39,7 @@ const props = makePropsConfigurable(sortKeys({
39
39
  ariaInvalid: makeProp(PROP_TYPE_BOOLEAN_STRING, false),
40
40
  stacked: makeProp(PROP_TYPE_BOOLEAN, false),
41
41
  validated: makeProp(PROP_TYPE_BOOLEAN, false)
42
- }), 'formRadioCheckGroups');
42
+ });
43
43
 
44
44
  // --- Mixin ---
45
45
 
@@ -6,7 +6,7 @@ import { isBoolean } from '../utils/inspect';
6
6
  import { looseEqual } from '../utils/loose-equal';
7
7
  import { makeModelMixin } from '../utils/model';
8
8
  import { sortKeys } from '../utils/object';
9
- import { makePropsConfigurable, makeProp } from '../utils/props';
9
+ import { makeProp } from '../utils/props';
10
10
  import { attrsMixin } from './attrs';
11
11
  import { props as props$2, formControlMixin } from './form-control';
12
12
  import { props as props$5, formCustomMixin } from './form-custom';
@@ -28,7 +28,7 @@ const {
28
28
 
29
29
  // --- Props ---
30
30
 
31
- const props = makePropsConfigurable(sortKeys({
31
+ const props = sortKeys({
32
32
  ...props$1,
33
33
  ...modelProps,
34
34
  ...props$2,
@@ -39,7 +39,7 @@ const props = makePropsConfigurable(sortKeys({
39
39
  ariaLabelledby: makeProp(PROP_TYPE_STRING),
40
40
  inline: makeProp(PROP_TYPE_BOOLEAN, false),
41
41
  value: makeProp(PROP_TYPE_ANY)
42
- }), 'formRadioCheckControls');
42
+ });
43
43
 
44
44
  // --- Mixin ---
45
45
 
@@ -1,12 +1,12 @@
1
1
  import { extend } from '../vue';
2
2
  import { PROP_TYPE_STRING } from '../constants/props';
3
- import { makePropsConfigurable, makeProp } from '../utils/props';
3
+ import { makeProp } from '../utils/props';
4
4
 
5
5
  // --- Props ---
6
6
 
7
- const props = makePropsConfigurable({
7
+ const props = {
8
8
  size: makeProp(PROP_TYPE_STRING)
9
- }, 'formControls');
9
+ };
10
10
 
11
11
  // --- Mixin ---
12
12
 
@@ -1,7 +1,7 @@
1
1
  import { extend } from '../vue';
2
2
  import { PROP_TYPE_BOOLEAN } from '../constants/props';
3
3
  import { isBoolean } from '../utils/inspect';
4
- import { makePropsConfigurable, makeProp } from '../utils/props';
4
+ import { makeProp } from '../utils/props';
5
5
  import { safeVueInstance } from '../utils/safe-vue-instance';
6
6
 
7
7
  /* Form control contextual state class computation
@@ -15,10 +15,10 @@ import { safeVueInstance } from '../utils/safe-vue-instance';
15
15
 
16
16
  // --- Props ---
17
17
 
18
- const props = makePropsConfigurable({
18
+ const props = {
19
19
  // Tri-state prop: true, false, null (or undefined)
20
20
  state: makeProp(PROP_TYPE_BOOLEAN, null)
21
- }, 'formState');
21
+ };
22
22
 
23
23
  // --- Mixin ---
24
24
 
@@ -7,7 +7,7 @@ import { mathMax } from '../utils/math';
7
7
  import { makeModelMixin } from '../utils/model';
8
8
  import { toInteger, toFloat } from '../utils/number';
9
9
  import { sortKeys } from '../utils/object';
10
- import { makePropsConfigurable, makeProp, hasPropFunction } from '../utils/props';
10
+ import { makeProp, hasPropFunction } from '../utils/props';
11
11
  import { toString } from '../utils/string';
12
12
 
13
13
  // --- Constants ---
@@ -25,7 +25,7 @@ const {
25
25
 
26
26
  // --- Props ---
27
27
 
28
- const props = makePropsConfigurable(sortKeys({
28
+ const props = sortKeys({
29
29
  ...modelProps,
30
30
  ariaInvalid: makeProp(PROP_TYPE_BOOLEAN_STRING, false),
31
31
  autocomplete: makeProp(PROP_TYPE_STRING),
@@ -40,7 +40,7 @@ const props = makePropsConfigurable(sortKeys({
40
40
  plaintext: makeProp(PROP_TYPE_BOOLEAN, false),
41
41
  readonly: makeProp(PROP_TYPE_BOOLEAN, false),
42
42
  trim: makeProp(PROP_TYPE_BOOLEAN, false)
43
- }), 'formTextControls');
43
+ });
44
44
 
45
45
  // --- Mixin ---
46
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "128.17.0",
3
+ "version": "129.0.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -93,7 +93,8 @@ export default {
93
93
  * Value returned when this checkbox is checked.
94
94
  */
95
95
  value: {
96
- type: [Array, Boolean, String],
96
+ // `value` prop can be any type
97
+ type: undefined,
97
98
  required: false,
98
99
  default: true,
99
100
  },
@@ -101,7 +102,8 @@ export default {
101
102
  * Value returned when this checkbox is unchecked. Note not applicable when multiple checkboxes bound to the same v-model array.
102
103
  */
103
104
  uncheckedValue: {
104
- type: [Array, Boolean, String],
105
+ // `uncheckedValue` prop can be any type
106
+ type: undefined,
105
107
  required: false,
106
108
  default: false,
107
109
  },
@@ -1,51 +1,240 @@
1
1
  <script>
2
- import { BFormRadio } from '../../../../vendor/bootstrap-vue/src/components/form-radio/form-radio';
3
-
4
- const { model } = BFormRadio.options;
2
+ import uniqueId from 'lodash/uniqueId';
3
+ import isBoolean from 'lodash/isBoolean';
4
+ import { looseEqual } from '../../../../vendor/bootstrap-vue/src/utils/loose-equal';
5
5
 
6
6
  export default {
7
7
  name: 'GlFormRadio',
8
- components: { BFormRadio },
8
+ inject: {
9
+ getGroup: {
10
+ // When we remove BFormRadioGroup from GlFormRadioGroup, we can rename
11
+ // the `getBvRadioGroup` provide to `getRadioGroup`.
12
+ from: 'getBvRadioGroup',
13
+ default: () => () => null,
14
+ },
15
+ },
9
16
  inheritAttrs: false,
10
17
  model: {
11
- prop: model.prop,
12
- event: model.event,
18
+ prop: 'checked',
19
+ event: 'input',
13
20
  },
14
21
  props: {
15
22
  /**
16
- * Whether the radio is checked
23
+ * Used to set the `id` attribute on the rendered content, and used as the base to generate any additional element IDs as needed.
24
+ */
25
+ id: {
26
+ type: String,
27
+ required: false,
28
+ default: undefined,
29
+ },
30
+ /**
31
+ * The current value of the radio. When bound to multiple radios, this is the value of the currently selected radio.
17
32
  */
18
33
  checked: {
19
- type: [String, Number, Boolean, Object],
34
+ // `checked` prop can be any type
35
+ type: undefined,
36
+ required: false,
37
+ default: null,
38
+ },
39
+ /**
40
+ * When set to `true`, disables the component's functionality and places it in a disabled state.
41
+ */
42
+ disabled: {
43
+ type: Boolean,
44
+ required: false,
45
+ default: false,
46
+ },
47
+ /**
48
+ * Sets the value of the `name` attribute on the form control.
49
+ */
50
+ name: {
51
+ type: String,
52
+ required: false,
53
+ default: undefined,
54
+ },
55
+ /**
56
+ * Adds the `required` attribute to the form control.
57
+ */
58
+ required: {
59
+ type: Boolean,
20
60
  required: false,
21
61
  default: false,
22
62
  },
63
+ /**
64
+ * Controls the validation state appearance of the component. `true` for valid, `false` for invalid, or `null` for no validation state.
65
+ */
66
+ state: {
67
+ type: Boolean,
68
+ required: false,
69
+ default: null,
70
+ },
71
+ /**
72
+ * Value returned when this radio is selected.
73
+ */
74
+ value: {
75
+ // `value` prop can be any type
76
+ type: undefined,
77
+ required: false,
78
+ default: true,
79
+ },
80
+ },
81
+ data() {
82
+ const group = this.getGroup();
83
+ return {
84
+ internalId: this.id ? this.id : uniqueId('gitlab_ui_radio_'),
85
+ localChecked: group ? group.checked : this.checked,
86
+ };
87
+ },
88
+ computed: {
89
+ computedLocalChecked: {
90
+ get() {
91
+ return this.isGroup ? this.group.localChecked : this.localChecked;
92
+ },
93
+ set(value) {
94
+ if (this.isGroup) {
95
+ this.group.localChecked = value;
96
+ } else {
97
+ this.localChecked = value;
98
+ }
99
+ },
100
+ },
101
+ group() {
102
+ return this.getGroup();
103
+ },
104
+ isGroup() {
105
+ // Is this radio a child of radio-group?
106
+ return Boolean(this.group);
107
+ },
108
+ computedState() {
109
+ if (this.isGroup) return this.group.computedState;
110
+ return isBoolean(this.state) ? this.state : null;
111
+ },
112
+ stateClass() {
113
+ if (this.computedState === true) return 'is-valid';
114
+ if (this.computedState === false) return 'is-invalid';
115
+ return null;
116
+ },
117
+ computedAriaInvalid() {
118
+ return this.computedState === false ? 'true' : null;
119
+ },
120
+ isChecked() {
121
+ return looseEqual(this.computedLocalChecked, this.value);
122
+ },
123
+ isDisabled() {
124
+ // Child can be disabled while parent isn't, but is always disabled if group is
125
+ return this.isGroup ? this.group.disabled || this.disabled : this.disabled;
126
+ },
127
+ isRequired() {
128
+ // Required only works when a name is provided for the input(s)
129
+ // Child can only be required when parent is
130
+ // Groups will always have a name (either user supplied or auto generated)
131
+ return this.computedName && (this.isGroup ? this.group.required : this.required);
132
+ },
133
+ computedName() {
134
+ // Group name preferred over local name
135
+ return (this.isGroup ? this.group.groupName : this.name) || null;
136
+ },
137
+ computedAttrs() {
138
+ const { isDisabled: disabled, isRequired: required, value, isChecked: checked } = this;
139
+
140
+ return {
141
+ ...this.$attrs,
142
+ id: this.internalId,
143
+ name: this.computedName,
144
+ disabled,
145
+ required,
146
+ value,
147
+ checked,
148
+ 'aria-required': required || null,
149
+ 'aria-invalid': this.computedAriaInvalid,
150
+ };
151
+ },
152
+ },
153
+ watch: {
154
+ checked(...args) {
155
+ this.checkedWatcher(...args);
156
+ },
157
+ computedLocalChecked(...args) {
158
+ this.computedLocalCheckedWatcher(...args);
159
+ },
160
+ },
161
+ methods: {
162
+ checkedWatcher(newValue) {
163
+ if (!looseEqual(newValue, this.computedLocalChecked)) {
164
+ this.computedLocalChecked = newValue;
165
+ }
166
+ },
167
+ computedLocalCheckedWatcher(newValue, oldValue) {
168
+ if (!looseEqual(newValue, oldValue)) {
169
+ /**
170
+ * Emitted when the selected value is changed
171
+ *
172
+ * @event input
173
+ * @type {boolean} current selected value of radio group
174
+ */
175
+ this.$emit('input', newValue);
176
+ }
177
+ },
178
+ handleChange() {
179
+ const { value } = this;
180
+
181
+ // Update `computedLocalChecked`
182
+ this.computedLocalChecked = value;
183
+
184
+ // Fire events in a `$nextTick()` to ensure the `v-model` is updated
185
+ this.$nextTick(() => {
186
+ /**
187
+ * Emitted when the selected value is changed due to user interaction
188
+ *
189
+ * @event change
190
+ * @type {boolean} current selected value of radio group
191
+ */
192
+ this.$emit('change', value);
193
+
194
+ // If this is a child of a group, we emit a change event on it as well
195
+ if (this.isGroup) {
196
+ /**
197
+ * Emitted when the selected value is changed due to user interaction
198
+ *
199
+ * @event change
200
+ * @type {boolean} current selected value of radio group
201
+ */
202
+ this.group.$emit('change', value);
203
+ }
204
+ });
205
+ },
206
+ focus() {
207
+ if (!this.disabled) {
208
+ this.$refs.input?.focus();
209
+ }
210
+ },
211
+ blur() {
212
+ if (!this.disabled) {
213
+ this.$refs.input?.blur();
214
+ }
215
+ },
23
216
  },
24
217
  };
25
218
  </script>
26
219
 
27
220
  <template>
28
- <!--
29
- Emitted when the selected value is changed
30
- @event input
31
- @type {boolean} current selected value of radio group
32
-
33
- Emitted when the selected value is changed due to user interaction
34
- @event change
35
- @type {boolean} current selected value of radio group
36
- -->
37
- <b-form-radio
38
- class="gl-form-radio"
39
- :checked="checked"
40
- v-bind="$attrs"
41
- @input="$emit('input', $event)"
42
- @change="$emit('change', $event)"
43
- >
44
- <!-- @slot Content to use for the label -->
45
- <slot></slot>
46
- <p v-if="$scopedSlots.help" class="help-text">
47
- <!-- @slot Content provided here will be shown beneath the radio. Typically used for help or descriptive text. -->
48
- <slot name="help"></slot>
49
- </p>
50
- </b-form-radio>
221
+ <div class="gl-form-radio custom-radio custom-control">
222
+ <input
223
+ ref="input"
224
+ key="input"
225
+ v-bind="computedAttrs"
226
+ type="radio"
227
+ class="custom-control-input"
228
+ :class="stateClass"
229
+ @change="handleChange"
230
+ />
231
+ <label :for="internalId" class="custom-control-label">
232
+ <!-- @slot Content to use for the label -->
233
+ <slot></slot>
234
+ <p v-if="Boolean($scopedSlots.help)" class="help-text">
235
+ <!-- @slot Content provided here will be shown beneath the radio. Typically used for help or descriptive text. -->
236
+ <slot name="help"></slot>
237
+ </p>
238
+ </label>
239
+ </div>
51
240
  </template>
@@ -1,6 +1,5 @@
1
1
  <script>
2
2
  import { BTooltip } from '../../../vendor/bootstrap-vue/src/components/tooltip/tooltip';
3
- import { tooltipDelay } from '../../../utils/constants';
4
3
  import tooltipMixin from '../../mixins/tooltip_mixin';
5
4
  import { getGlTooltipDefaultContainer } from '../../../directives/tooltip/container';
6
5
 
@@ -8,7 +7,6 @@ const tooltipRefName = 'bvTooltip';
8
7
 
9
8
  export default {
10
9
  name: 'GlTooltip',
11
- tooltipDelay,
12
10
  components: {
13
11
  BTooltip,
14
12
  },
@@ -24,7 +22,6 @@ export default {
24
22
  :ref="$options.tooltipRefName"
25
23
  v-bind="$attrs"
26
24
  :container="$attrs.container || $options.getGlTooltipDefaultContainer()"
27
- :delay="$options.tooltipDelay"
28
25
  v-on="$listeners"
29
26
  >
30
27
  <!-- @slot Tooltip content -->
package/src/config.js CHANGED
@@ -1,37 +1,4 @@
1
- import Vue from 'vue';
2
1
  import translationKeys from '../translations';
3
- import { BVConfigPlugin } from './vendor/bootstrap-vue/src/bv-config';
4
- import { tooltipDelay } from './utils/constants';
5
-
6
- const tooltipGlobalConfig = {
7
- // Work around for https://github.com/bootstrap-vue/bootstrap-vue/issues/6507
8
- boundaryPadding: 5,
9
- customClass: 'gl-tooltip',
10
- delay: tooltipDelay,
11
- };
12
-
13
- const popoverDelayConfig = {
14
- show: 50, // BootstrapVue's default delay on show.
15
- hide: 150, // Increased hide delay so that it doesn't disappear to quickly when user attempts to interact with the content.
16
- };
17
-
18
- /**
19
- * Guard against nonexistent localStorage,
20
- * or corrupted localStorage
21
- *
22
- * localStorage access is not possible in certain environments like
23
- * - in iframe usage in Chrome if embedded on another domain
24
- * - tests / node
25
- */
26
- try {
27
- const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
28
-
29
- if (glTooltipDelay) {
30
- tooltipGlobalConfig.delay = JSON.parse(glTooltipDelay);
31
- }
32
- } catch {
33
- // localStorage doesn't exist (or the value is not properly formatted)
34
- }
35
2
 
36
3
  export const i18n = translationKeys;
37
4
 
@@ -61,13 +28,6 @@ const setConfigs = ({ translations, firstDayOfWeek } = {}) => {
61
28
  }
62
29
  configured = true;
63
30
 
64
- Vue.use(BVConfigPlugin, {
65
- BTooltip: tooltipGlobalConfig,
66
- BPopover: {
67
- delay: popoverDelayConfig,
68
- },
69
- });
70
-
71
31
  if (typeof firstDayOfWeek === 'number' && firstDayOfWeek >= 0 && firstDayOfWeek <= 6) {
72
32
  defaultConfig.firstDayOfWeek = firstDayOfWeek;
73
33
  }
@@ -242,12 +242,6 @@ export const tooltipPlacements = {
242
242
  bottom: 'bottom',
243
243
  };
244
244
 
245
- // in milliseconds
246
- export const tooltipDelay = {
247
- show: 500,
248
- hide: 0,
249
- };
250
-
251
245
  export const popoverPlacements = {
252
246
  top: 'top',
253
247
  right: 'right',