@gitlab/ui 94.2.0 → 94.3.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 (149) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/experimental/duo/chat/duo_chat.js +1 -2
  3. package/dist/vendor/bootstrap-vue/src/components/badge/index.js +0 -10
  4. package/dist/vendor/bootstrap-vue/src/components/breadcrumb/index.js +0 -14
  5. package/dist/vendor/bootstrap-vue/src/components/button/index.js +0 -14
  6. package/dist/vendor/bootstrap-vue/src/components/button-group/index.js +0 -11
  7. package/dist/vendor/bootstrap-vue/src/components/collapse/index.js +0 -14
  8. package/dist/vendor/bootstrap-vue/src/components/dropdown/index.js +0 -34
  9. package/dist/vendor/bootstrap-vue/src/components/form/index.js +0 -20
  10. package/dist/vendor/bootstrap-vue/src/components/form-checkbox/index.js +0 -16
  11. package/dist/vendor/bootstrap-vue/src/components/form-group/index.js +0 -11
  12. package/dist/vendor/bootstrap-vue/src/components/form-input/index.js +0 -11
  13. package/dist/vendor/bootstrap-vue/src/components/form-radio/index.js +0 -14
  14. package/dist/vendor/bootstrap-vue/src/components/form-select/index.js +0 -17
  15. package/dist/vendor/bootstrap-vue/src/components/form-textarea/index.js +0 -11
  16. package/dist/vendor/bootstrap-vue/src/components/index.js +1 -49
  17. package/dist/vendor/bootstrap-vue/src/components/input-group/index.js +0 -18
  18. package/dist/vendor/bootstrap-vue/src/components/layout/index.js +0 -12
  19. package/dist/vendor/bootstrap-vue/src/components/link/index.js +0 -10
  20. package/dist/vendor/bootstrap-vue/src/components/modal/index.js +0 -19
  21. package/dist/vendor/bootstrap-vue/src/components/nav/index.js +0 -21
  22. package/dist/vendor/bootstrap-vue/src/components/navbar/index.js +0 -20
  23. package/dist/vendor/bootstrap-vue/src/components/popover/index.js +0 -14
  24. package/dist/vendor/bootstrap-vue/src/components/progress/index.js +0 -12
  25. package/dist/vendor/bootstrap-vue/src/components/table/index.js +0 -38
  26. package/dist/vendor/bootstrap-vue/src/components/tabs/index.js +0 -12
  27. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +1 -1
  28. package/dist/vendor/bootstrap-vue/src/components/tooltip/index.js +0 -14
  29. package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -2
  30. package/dist/vendor/bootstrap-vue/src/constants/env.js +1 -2
  31. package/dist/vendor/bootstrap-vue/src/constants/regex.js +1 -3
  32. package/dist/vendor/bootstrap-vue/src/directives/modal/index.js +0 -10
  33. package/dist/vendor/bootstrap-vue/src/directives/toggle/index.js +0 -10
  34. package/dist/vendor/bootstrap-vue/src/directives/tooltip/index.js +0 -10
  35. package/dist/vendor/bootstrap-vue/src/directives/visible/index.js +0 -10
  36. package/dist/vendor/bootstrap-vue/src/index.js +1 -38
  37. package/dist/vendor/bootstrap-vue/src/utils/object.js +1 -3
  38. package/dist/vendor/bootstrap-vue/src/utils/warn.js +2 -17
  39. package/package.json +1 -1
  40. package/src/components/experimental/duo/chat/duo_chat.vue +0 -10
  41. package/src/vendor/bootstrap-vue/src/components/badge/index.d.ts +1 -5
  42. package/src/vendor/bootstrap-vue/src/components/badge/index.js +1 -6
  43. package/src/vendor/bootstrap-vue/src/components/breadcrumb/index.d.ts +1 -5
  44. package/src/vendor/bootstrap-vue/src/components/breadcrumb/index.js +1 -6
  45. package/src/vendor/bootstrap-vue/src/components/button/index.d.ts +1 -5
  46. package/src/vendor/bootstrap-vue/src/components/button/index.js +1 -11
  47. package/src/vendor/bootstrap-vue/src/components/button-group/index.d.ts +1 -5
  48. package/src/vendor/bootstrap-vue/src/components/button-group/index.js +1 -9
  49. package/src/vendor/bootstrap-vue/src/components/collapse/index.d.ts +1 -5
  50. package/src/vendor/bootstrap-vue/src/components/collapse/index.js +1 -8
  51. package/src/vendor/bootstrap-vue/src/components/dropdown/index.d.ts +1 -5
  52. package/src/vendor/bootstrap-vue/src/components/dropdown/index.js +0 -25
  53. package/src/vendor/bootstrap-vue/src/components/form/index.d.ts +1 -5
  54. package/src/vendor/bootstrap-vue/src/components/form/index.js +1 -15
  55. package/src/vendor/bootstrap-vue/src/components/form-checkbox/index.d.ts +1 -5
  56. package/src/vendor/bootstrap-vue/src/components/form-checkbox/index.js +1 -13
  57. package/src/vendor/bootstrap-vue/src/components/form-group/index.d.ts +1 -5
  58. package/src/vendor/bootstrap-vue/src/components/form-group/index.js +1 -9
  59. package/src/vendor/bootstrap-vue/src/components/form-input/index.d.ts +1 -5
  60. package/src/vendor/bootstrap-vue/src/components/form-input/index.js +1 -9
  61. package/src/vendor/bootstrap-vue/src/components/form-radio/index.d.ts +1 -5
  62. package/src/vendor/bootstrap-vue/src/components/form-radio/index.js +1 -11
  63. package/src/vendor/bootstrap-vue/src/components/form-select/index.d.ts +1 -5
  64. package/src/vendor/bootstrap-vue/src/components/form-select/index.js +1 -13
  65. package/src/vendor/bootstrap-vue/src/components/form-textarea/index.d.ts +1 -5
  66. package/src/vendor/bootstrap-vue/src/components/form-textarea/index.js +1 -9
  67. package/src/vendor/bootstrap-vue/src/components/index.js +1 -50
  68. package/src/vendor/bootstrap-vue/src/components/input-group/index.d.ts +1 -5
  69. package/src/vendor/bootstrap-vue/src/components/input-group/index.js +1 -19
  70. package/src/vendor/bootstrap-vue/src/components/layout/index.d.ts +1 -5
  71. package/src/vendor/bootstrap-vue/src/components/layout/index.js +1 -9
  72. package/src/vendor/bootstrap-vue/src/components/link/index.d.ts +1 -5
  73. package/src/vendor/bootstrap-vue/src/components/link/index.js +1 -6
  74. package/src/vendor/bootstrap-vue/src/components/modal/README.md +0 -8
  75. package/src/vendor/bootstrap-vue/src/components/modal/index.d.ts +2 -5
  76. package/src/vendor/bootstrap-vue/src/components/modal/index.js +1 -11
  77. package/src/vendor/bootstrap-vue/src/components/modal/package.json +0 -3
  78. package/src/vendor/bootstrap-vue/src/components/nav/index.d.ts +1 -5
  79. package/src/vendor/bootstrap-vue/src/components/nav/index.js +1 -17
  80. package/src/vendor/bootstrap-vue/src/components/nav/package.json +0 -3
  81. package/src/vendor/bootstrap-vue/src/components/navbar/index.d.ts +1 -4
  82. package/src/vendor/bootstrap-vue/src/components/navbar/index.js +1 -17
  83. package/src/vendor/bootstrap-vue/src/components/navbar/package.json +0 -5
  84. package/src/vendor/bootstrap-vue/src/components/popover/README.md +1 -46
  85. package/src/vendor/bootstrap-vue/src/components/popover/index.d.ts +1 -5
  86. package/src/vendor/bootstrap-vue/src/components/popover/index.js +1 -8
  87. package/src/vendor/bootstrap-vue/src/components/popover/package.json +1 -4
  88. package/src/vendor/bootstrap-vue/src/components/progress/index.d.ts +1 -5
  89. package/src/vendor/bootstrap-vue/src/components/progress/index.js +1 -9
  90. package/src/vendor/bootstrap-vue/src/components/table/README.md +3 -15
  91. package/src/vendor/bootstrap-vue/src/components/table/index.d.ts +1 -7
  92. package/src/vendor/bootstrap-vue/src/components/table/index.js +0 -33
  93. package/src/vendor/bootstrap-vue/src/components/table/package.json +0 -4
  94. package/src/vendor/bootstrap-vue/src/components/tabs/index.d.ts +1 -5
  95. package/src/vendor/bootstrap-vue/src/components/tabs/index.js +1 -9
  96. package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +1 -1
  97. package/src/vendor/bootstrap-vue/src/components/tooltip/index.d.ts +1 -5
  98. package/src/vendor/bootstrap-vue/src/components/tooltip/index.js +1 -8
  99. package/src/vendor/bootstrap-vue/src/components/tooltip/package.json +0 -3
  100. package/src/vendor/bootstrap-vue/src/constants/components.js +0 -1
  101. package/src/vendor/bootstrap-vue/src/constants/env.js +0 -1
  102. package/src/vendor/bootstrap-vue/src/constants/regex.js +0 -3
  103. package/src/vendor/bootstrap-vue/src/directives/modal/index.d.ts +1 -4
  104. package/src/vendor/bootstrap-vue/src/directives/modal/index.js +1 -6
  105. package/src/vendor/bootstrap-vue/src/directives/toggle/index.d.ts +1 -5
  106. package/src/vendor/bootstrap-vue/src/directives/toggle/index.js +1 -6
  107. package/src/vendor/bootstrap-vue/src/directives/tooltip/README.md +0 -1
  108. package/src/vendor/bootstrap-vue/src/directives/tooltip/index.d.ts +1 -5
  109. package/src/vendor/bootstrap-vue/src/directives/tooltip/index.js +1 -6
  110. package/src/vendor/bootstrap-vue/src/directives/visible/index.d.ts +1 -5
  111. package/src/vendor/bootstrap-vue/src/directives/visible/index.js +1 -6
  112. package/src/vendor/bootstrap-vue/src/icons/icons.js +1 -4
  113. package/src/vendor/bootstrap-vue/src/index.d.ts +0 -3
  114. package/src/vendor/bootstrap-vue/src/index.js +2 -45
  115. package/src/vendor/bootstrap-vue/src/utils/config.spec.js +2 -2
  116. package/src/vendor/bootstrap-vue/src/utils/object.js +0 -2
  117. package/src/vendor/bootstrap-vue/src/utils/warn.js +1 -16
  118. package/translations.js +0 -2
  119. package/dist/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal.js +0 -279
  120. package/dist/vendor/bootstrap-vue/src/directives/hover/hover.js +0 -61
  121. package/dist/vendor/bootstrap-vue/src/directives/hover/index.js +0 -11
  122. package/dist/vendor/bootstrap-vue/src/directives/index.js +0 -23
  123. package/dist/vendor/bootstrap-vue/src/directives/popover/index.js +0 -11
  124. package/dist/vendor/bootstrap-vue/src/directives/popover/popover.js +0 -265
  125. package/dist/vendor/bootstrap-vue/src/directives/scrollspy/helpers/bv-scrollspy.class.js +0 -404
  126. package/dist/vendor/bootstrap-vue/src/directives/scrollspy/index.js +0 -11
  127. package/dist/vendor/bootstrap-vue/src/directives/scrollspy/scrollspy.js +0 -112
  128. package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal.js +0 -279
  129. package/src/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal.spec.js +0 -178
  130. package/src/vendor/bootstrap-vue/src/directives/hover/README.md +0 -87
  131. package/src/vendor/bootstrap-vue/src/directives/hover/hover.js +0 -54
  132. package/src/vendor/bootstrap-vue/src/directives/hover/hover.spec.js +0 -49
  133. package/src/vendor/bootstrap-vue/src/directives/hover/index.d.ts +0 -11
  134. package/src/vendor/bootstrap-vue/src/directives/hover/index.js +0 -8
  135. package/src/vendor/bootstrap-vue/src/directives/hover/package.json +0 -13
  136. package/src/vendor/bootstrap-vue/src/directives/index.d.ts +0 -13
  137. package/src/vendor/bootstrap-vue/src/directives/index.js +0 -22
  138. package/src/vendor/bootstrap-vue/src/directives/popover/README.md +0 -648
  139. package/src/vendor/bootstrap-vue/src/directives/popover/index.d.ts +0 -11
  140. package/src/vendor/bootstrap-vue/src/directives/popover/index.js +0 -8
  141. package/src/vendor/bootstrap-vue/src/directives/popover/package.json +0 -111
  142. package/src/vendor/bootstrap-vue/src/directives/popover/popover.js +0 -275
  143. package/src/vendor/bootstrap-vue/src/directives/popover/popover.spec.js +0 -129
  144. package/src/vendor/bootstrap-vue/src/directives/scrollspy/README.md +0 -411
  145. package/src/vendor/bootstrap-vue/src/directives/scrollspy/helpers/bv-scrollspy.class.js +0 -480
  146. package/src/vendor/bootstrap-vue/src/directives/scrollspy/index.d.ts +0 -11
  147. package/src/vendor/bootstrap-vue/src/directives/scrollspy/index.js +0 -8
  148. package/src/vendor/bootstrap-vue/src/directives/scrollspy/package.json +0 -38
  149. package/src/vendor/bootstrap-vue/src/directives/scrollspy/scrollspy.js +0 -117
@@ -1,11 +0,0 @@
1
- //
2
- // VBPopover
3
- //
4
- import Vue, { DirectiveOptions } from 'vue'
5
- import { BvPlugin } from '../../'
6
-
7
- // Plugin
8
- export declare const VBPopoverPlugin: BvPlugin
9
-
10
- // directive: v-b-popover
11
- export declare const VBPopover: DirectiveOptions
@@ -1,8 +0,0 @@
1
- import { VBPopover } from './popover'
2
- import { pluginFactory } from '../../utils/plugins'
3
-
4
- const VBPopoverPlugin = /*#__PURE__*/ pluginFactory({
5
- directives: { VBPopover }
6
- })
7
-
8
- export { VBPopoverPlugin, VBPopover }
@@ -1,111 +0,0 @@
1
- {
2
- "name": "@bootstrap-vue/popover",
3
- "version": "0.0.0",
4
- "meta": {
5
- "title": "Popover",
6
- "description": "Add BootstrapVue popovers to any element on your site, using Bootstrap v4 CSS for styling and animations. Popovers are tooltips on steroids.",
7
- "directive": "VBPopover",
8
- "arg": {
9
- "pattern": "[a-zA-Z][a-zA-Z0-9_\\-]*",
10
- "description": "ID of element to append the popover markup when visible. Optional, defaults to the body",
11
- "required": false
12
- },
13
- "expression": [
14
- "String",
15
- "Function",
16
- "Object"
17
- ],
18
- "modifiers": [
19
- {
20
- "name": "top",
21
- "description": "Positions the popover on the top of the trigger element (default)"
22
- },
23
- {
24
- "name": "right",
25
- "description": "Positions the popover on the right of the trigger element"
26
- },
27
- {
28
- "name": "bottom",
29
- "description": "Positions the popover on the bottom of the trigger element"
30
- },
31
- {
32
- "name": "auto",
33
- "description": "Positions the popover in the best fit place around the trigger element"
34
- },
35
- {
36
- "name": "topright",
37
- "description": "Positions the popover on the top-right of the trigger element"
38
- },
39
- {
40
- "name": "topleft",
41
- "description": "Positions the popover on the top-left of the trigger element"
42
- },
43
- {
44
- "name": "bottomright",
45
- "description": "Positions the popover on the bottom-right of the trigger element"
46
- },
47
- {
48
- "name": "bottomleft",
49
- "description": "Positions the popover on the bottom-left of the trigger element"
50
- },
51
- {
52
- "name": "lefttop",
53
- "description": "Positions the popover on the left-top of the trigger element"
54
- },
55
- {
56
- "name": "leftbottom",
57
- "description": "Positions the popover on the left-bottom of the trigger element"
58
- },
59
- {
60
- "name": "righttop",
61
- "description": "Positions the popover on the right-top of the trigger element"
62
- },
63
- {
64
- "name": "rightbottom",
65
- "description": "Positions the popover on the right-bottom of the trigger element"
66
- },
67
- {
68
- "name": "nofade",
69
- "description": "Disabled the fade animation of the popover"
70
- },
71
- {
72
- "name": "html",
73
- "description": "Enables basic HTML in the title/content",
74
- "xss": true
75
- },
76
- {
77
- "name": "viewport",
78
- "description": "Sets the boundary constraint to the viewport"
79
- },
80
- {
81
- "name": "window",
82
- "description": "Sets the boundary constrain to the window"
83
- },
84
- {
85
- "name": "v-{variant}",
86
- "pattern": "v-[a-z]+",
87
- "description": "Sets the popover contextual color variant to `{variant}`"
88
- },
89
- {
90
- "name": "d{###}",
91
- "pattern": "d[0-9]+",
92
- "description": "The show and hide delay in milliseconds (where `{###}` is the value in milliseconds)"
93
- },
94
- {
95
- "name": "ds{###}",
96
- "pattern": "ds[0-9]+",
97
- "description": "The show delay in milliseconds (where `{###}` is the value in milliseconds)"
98
- },
99
- {
100
- "name": "dh{###}",
101
- "pattern": "dh[0-9]+",
102
- "description": "The hide delay in milliseconds (where `{###}` is the value in milliseconds)"
103
- },
104
- {
105
- "name": "o{###}",
106
- "pattern": "o-?[0-9]+",
107
- "description": "An offset value in pixels (where `{###}` is the number of pixels, defaults to 0. Negative values allowed)"
108
- }
109
- ]
110
- }
111
- }
@@ -1,275 +0,0 @@
1
- import { NAME_POPOVER } from '../../constants/components'
2
- import { IS_BROWSER } from '../../constants/env'
3
- import { EVENT_NAME_SHOW } from '../../constants/events'
4
- import { concat } from '../../utils/array'
5
- import { getComponentConfig } from '../../utils/config'
6
- import { getScopeId } from '../../utils/get-scope-id'
7
- import { identity } from '../../utils/identity'
8
- import { getInstanceFromDirective } from '../../utils/get-instance-from-directive'
9
- import {
10
- isFunction,
11
- isNumber,
12
- isPlainObject,
13
- isString,
14
- isUndefined,
15
- isUndefinedOrNull
16
- } from '../../utils/inspect'
17
- import { looseEqual } from '../../utils/loose-equal'
18
- import { toInteger } from '../../utils/number'
19
- import { keys } from '../../utils/object'
20
- import { createNewChildComponent } from '../../utils/create-new-child-component'
21
- import { BVPopover } from '../../components/popover/helpers/bv-popover'
22
- import { nextTick } from '../../vue'
23
-
24
- // Key which we use to store tooltip object on element
25
- const BV_POPOVER = '__BV_Popover__'
26
-
27
- // Default trigger
28
- const DefaultTrigger = 'click'
29
-
30
- // Valid event triggers
31
- const validTriggers = {
32
- focus: true,
33
- hover: true,
34
- click: true,
35
- blur: true,
36
- manual: true
37
- }
38
-
39
- // Directive modifier test regular expressions. Pre-compile for performance
40
- const htmlRE = /^html$/i
41
- const noFadeRE = /^nofade$/i
42
- const placementRE = /^(auto|top(left|right)?|bottom(left|right)?|left(top|bottom)?|right(top|bottom)?)$/i
43
- const boundaryRE = /^(window|viewport|scrollParent)$/i
44
- const delayRE = /^d\d+$/i
45
- const delayShowRE = /^ds\d+$/i
46
- const delayHideRE = /^dh\d+$/i
47
- const offsetRE = /^o-?\d+$/i
48
- const variantRE = /^v-.+$/i
49
- const spacesRE = /\s+/
50
-
51
- // Build a Popover config based on bindings (if any)
52
- // Arguments and modifiers take precedence over passed value config object
53
- const parseBindings = (bindings, vnode) => /* istanbul ignore next: not easy to test */ {
54
- // We start out with a basic config
55
- let config = {
56
- title: undefined,
57
- content: undefined,
58
- trigger: '', // Default set below if needed
59
- placement: 'right',
60
- fallbackPlacement: 'flip',
61
- container: false, // Default of body
62
- animation: true,
63
- offset: 0,
64
- disabled: false,
65
- id: null,
66
- html: false,
67
- delay: getComponentConfig(NAME_POPOVER, 'delay', 50),
68
- boundary: String(getComponentConfig(NAME_POPOVER, 'boundary', 'scrollParent')),
69
- boundaryPadding: toInteger(getComponentConfig(NAME_POPOVER, 'boundaryPadding', 5), 0),
70
- variant: getComponentConfig(NAME_POPOVER, 'variant'),
71
- customClass: getComponentConfig(NAME_POPOVER, 'customClass')
72
- }
73
-
74
- // Process `bindings.value`
75
- if (isString(bindings.value) || isNumber(bindings.value)) {
76
- // Value is popover content (html optionally supported)
77
- config.content = bindings.value
78
- } else if (isFunction(bindings.value)) {
79
- // Content generator function
80
- config.content = bindings.value
81
- } else if (isPlainObject(bindings.value)) {
82
- // Value is config object, so merge
83
- config = { ...config, ...bindings.value }
84
- }
85
-
86
- // If argument, assume element ID of container element
87
- if (bindings.arg) {
88
- // Element ID specified as arg
89
- // We must prepend '#' to become a CSS selector
90
- config.container = `#${bindings.arg}`
91
- }
92
-
93
- // If title is not provided, try title attribute
94
- if (isUndefined(config.title)) {
95
- // Try attribute
96
- const data = vnode.data || {}
97
- config.title = data.attrs && !isUndefinedOrNull(data.attrs.title) ? data.attrs.title : undefined
98
- }
99
-
100
- // Normalize delay
101
- if (!isPlainObject(config.delay)) {
102
- config.delay = {
103
- show: toInteger(config.delay, 0),
104
- hide: toInteger(config.delay, 0)
105
- }
106
- }
107
-
108
- // Process modifiers
109
- keys(bindings.modifiers).forEach(mod => {
110
- if (htmlRE.test(mod)) {
111
- // Title/content allows HTML
112
- config.html = true
113
- } else if (noFadeRE.test(mod)) {
114
- // No animation
115
- config.animation = false
116
- } else if (placementRE.test(mod)) {
117
- // Placement of popover
118
- config.placement = mod
119
- } else if (boundaryRE.test(mod)) {
120
- // Boundary of popover
121
- mod = mod === 'scrollparent' ? 'scrollParent' : mod
122
- config.boundary = mod
123
- } else if (delayRE.test(mod)) {
124
- // Delay value
125
- const delay = toInteger(mod.slice(1), 0)
126
- config.delay.show = delay
127
- config.delay.hide = delay
128
- } else if (delayShowRE.test(mod)) {
129
- // Delay show value
130
- config.delay.show = toInteger(mod.slice(2), 0)
131
- } else if (delayHideRE.test(mod)) {
132
- // Delay hide value
133
- config.delay.hide = toInteger(mod.slice(2), 0)
134
- } else if (offsetRE.test(mod)) {
135
- // Offset value, negative allowed
136
- config.offset = toInteger(mod.slice(1), 0)
137
- } else if (variantRE.test(mod)) {
138
- // Variant
139
- config.variant = mod.slice(2) || null
140
- }
141
- })
142
-
143
- // Special handling of event trigger modifiers trigger is
144
- // a space separated list
145
- const selectedTriggers = {}
146
-
147
- // Parse current config object trigger
148
- concat(config.trigger || '')
149
- .filter(identity)
150
- .join(' ')
151
- .trim()
152
- .toLowerCase()
153
- .split(spacesRE)
154
- .forEach(trigger => {
155
- if (validTriggers[trigger]) {
156
- selectedTriggers[trigger] = true
157
- }
158
- })
159
-
160
- // Parse modifiers for triggers
161
- keys(bindings.modifiers).forEach(mod => {
162
- mod = mod.toLowerCase()
163
- if (validTriggers[mod]) {
164
- // If modifier is a valid trigger
165
- selectedTriggers[mod] = true
166
- }
167
- })
168
-
169
- // Sanitize triggers
170
- config.trigger = keys(selectedTriggers).join(' ')
171
- if (config.trigger === 'blur') {
172
- // Blur by itself is useless, so convert it to 'focus'
173
- config.trigger = 'focus'
174
- }
175
- if (!config.trigger) {
176
- // Use default trigger
177
- config.trigger = DefaultTrigger
178
- }
179
-
180
- return config
181
- }
182
-
183
- // Add or update Popover on our element
184
- const applyPopover = (el, bindings, vnode) => {
185
- if (!IS_BROWSER) {
186
- /* istanbul ignore next */
187
- return
188
- }
189
- const config = parseBindings(bindings, vnode)
190
- if (!el[BV_POPOVER]) {
191
- const parent = getInstanceFromDirective(vnode, bindings)
192
- el[BV_POPOVER] = createNewChildComponent(parent, BVPopover, {
193
- // Add the parent's scoped style attribute data
194
- _scopeId: getScopeId(parent, undefined)
195
- })
196
- el[BV_POPOVER].__bv_prev_data__ = {}
197
- el[BV_POPOVER].$on(EVENT_NAME_SHOW, () => /* istanbul ignore next: for now */ {
198
- // Before showing the popover, we update the title
199
- // and content if they are functions
200
- const data = {}
201
- if (isFunction(config.title)) {
202
- data.title = config.title(el)
203
- }
204
- if (isFunction(config.content)) {
205
- data.content = config.content(el)
206
- }
207
- if (keys(data).length > 0) {
208
- el[BV_POPOVER].updateData(data)
209
- }
210
- })
211
- }
212
- const data = {
213
- title: config.title,
214
- content: config.content,
215
- triggers: config.trigger,
216
- placement: config.placement,
217
- fallbackPlacement: config.fallbackPlacement,
218
- variant: config.variant,
219
- customClass: config.customClass,
220
- container: config.container,
221
- boundary: config.boundary,
222
- delay: config.delay,
223
- offset: config.offset,
224
- noFade: !config.animation,
225
- id: config.id,
226
- disabled: config.disabled,
227
- html: config.html
228
- }
229
- const oldData = el[BV_POPOVER].__bv_prev_data__
230
- el[BV_POPOVER].__bv_prev_data__ = data
231
- if (!looseEqual(data, oldData)) {
232
- // We only update the instance if data has changed
233
- const newData = {
234
- target: el
235
- }
236
- keys(data).forEach(prop => {
237
- // We only pass data properties that have changed
238
- if (data[prop] !== oldData[prop]) {
239
- // If title/content is a function, we execute it here
240
- newData[prop] =
241
- (prop === 'title' || prop === 'content') && isFunction(data[prop])
242
- ? /* istanbul ignore next */ data[prop](el)
243
- : data[prop]
244
- }
245
- })
246
- el[BV_POPOVER].updateData(newData)
247
- }
248
- }
249
-
250
- // Remove Popover from our element
251
- const removePopover = el => {
252
- if (el[BV_POPOVER]) {
253
- el[BV_POPOVER].$destroy()
254
- el[BV_POPOVER] = null
255
- }
256
- delete el[BV_POPOVER]
257
- }
258
-
259
- // Export our directive
260
- export const VBPopover = {
261
- bind(el, bindings, vnode) {
262
- applyPopover(el, bindings, vnode)
263
- },
264
- // We use `componentUpdated` here instead of `update`, as the former
265
- // waits until the containing component and children have finished updating
266
- componentUpdated(el, bindings, vnode) {
267
- // Performed in a `$nextTick()` to prevent endless render/update loops
268
- nextTick(() => {
269
- applyPopover(el, bindings, vnode)
270
- })
271
- },
272
- unbind(el) {
273
- removePopover(el)
274
- }
275
- }
@@ -1,129 +0,0 @@
1
- import { mount } from '@vue/test-utils'
2
- import { waitNT, waitRAF } from '../../../tests/utils'
3
- import { VBPopover } from './popover'
4
-
5
- // Key which we use to store tooltip object on element
6
- const BV_POPOVER = '__BV_Popover__'
7
-
8
- describe('v-b-popover directive', () => {
9
- const originalCreateRange = document.createRange
10
- const origGetBCR = Element.prototype.getBoundingClientRect
11
-
12
- beforeEach(() => {
13
- // https://github.com/FezVrasta/popper.js/issues/478#issuecomment-407422016
14
- // Hack to make Popper not bork out during tests.
15
- // Note popper still does not do any positioning calculation in JSDOM though.
16
- // So we cannot test actual positioning... just detect when it is open.
17
- document.createRange = () => ({
18
- setStart: () => {},
19
- setEnd: () => {},
20
- commonAncestorContainer: {
21
- nodeName: 'BODY',
22
- ownerDocument: document
23
- }
24
- })
25
- // Mock `getBoundingClientRect()` so that the `isVisible(el)` test returns `true`
26
- // Needed for visibility checks of trigger element, etc.
27
- Element.prototype.getBoundingClientRect = jest.fn(() => ({
28
- width: 24,
29
- height: 24,
30
- top: 0,
31
- left: 0,
32
- bottom: 0,
33
- right: 0
34
- }))
35
- })
36
-
37
- afterEach(() => {
38
- // Reset overrides
39
- document.createRange = originalCreateRange
40
- Element.prototype.getBoundingClientRect = origGetBCR
41
- })
42
-
43
- it('should have BVPopover Vue instance', async () => {
44
- jest.useFakeTimers()
45
-
46
- const App = {
47
- directives: {
48
- bPopover: VBPopover
49
- },
50
- template: `<button v-b-popover="'content'" title="foobar">button</button>`
51
- }
52
-
53
- const wrapper = mount(App, {
54
- attachTo: document.body
55
- })
56
-
57
- expect(wrapper.vm).toBeDefined()
58
- await waitNT(wrapper.vm)
59
- await waitRAF()
60
- await waitNT(wrapper.vm)
61
- await waitRAF()
62
- await waitNT(wrapper.vm)
63
- await waitRAF()
64
- jest.runOnlyPendingTimers()
65
- await waitNT(wrapper.vm)
66
- await waitRAF()
67
-
68
- expect(wrapper.element.tagName).toBe('BUTTON')
69
- const $button = wrapper.find('button')
70
-
71
- // Should have instance of popover class on it
72
- expect($button.element[BV_POPOVER]).toBeDefined()
73
- expect($button.element[BV_POPOVER].$options.name).toBe('BVPopover')
74
-
75
- wrapper.destroy()
76
- })
77
-
78
- it('should work', async () => {
79
- jest.useFakeTimers()
80
-
81
- const App = {
82
- directives: {
83
- bPopover: VBPopover
84
- },
85
- template: `<button v-b-popover.click.html="'content'" title="<b>foobar</b>">button</button>`
86
- }
87
-
88
- const wrapper = mount(App, {
89
- attachTo: document.body
90
- })
91
-
92
- expect(wrapper.vm).toBeDefined()
93
- expect(wrapper.element.tagName).toBe('BUTTON')
94
- const $button = wrapper.find('button')
95
- await waitNT(wrapper.vm)
96
- await waitRAF()
97
- await waitNT(wrapper.vm)
98
- await waitRAF()
99
- await waitNT(wrapper.vm)
100
- await waitRAF()
101
- jest.runOnlyPendingTimers()
102
- await waitNT(wrapper.vm)
103
- await waitRAF()
104
-
105
- // Should have instance of popover class on it
106
- expect($button.element[BV_POPOVER]).toBeDefined()
107
- expect($button.element[BV_POPOVER].$options.name).toBe('BVPopover')
108
-
109
- expect($button.attributes('aria-describedby')).toBeUndefined()
110
-
111
- // Trigger click
112
- await $button.trigger('click')
113
- await waitRAF()
114
- await waitRAF()
115
- jest.runOnlyPendingTimers()
116
- await waitNT(wrapper.vm)
117
- await waitRAF()
118
-
119
- expect($button.attributes('aria-describedby')).toBeDefined()
120
- const adb = $button.attributes('aria-describedby')
121
-
122
- const pop = document.getElementById(adb)
123
- expect(pop).not.toBe(null)
124
- expect(pop.classList.contains('popover')).toBe(true)
125
- expect(pop.classList.contains('b-popover')).toBe(true)
126
-
127
- wrapper.destroy()
128
- })
129
- })