@gitlab/ui 88.5.0 → 89.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.
- package/CHANGELOG.md +19 -0
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +1 -0
- package/dist/components/charts/series_label/series_label.js +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +0 -2
- package/dist/tokens/build/js/tokens.dark.js +13 -7
- package/dist/tokens/build/js/tokens.js +13 -7
- package/dist/tokens/css/tokens.css +12 -6
- package/dist/tokens/css/tokens.dark.css +12 -6
- package/dist/tokens/js/tokens.dark.js +12 -6
- package/dist/tokens/js/tokens.js +12 -6
- package/dist/tokens/json/tokens.dark.json +160 -30
- package/dist/tokens/json/tokens.json +160 -30
- package/dist/tokens/scss/_tokens.dark.scss +12 -6
- package/dist/tokens/scss/_tokens.scss +12 -6
- package/dist/tokens/scss/_tokens_custom_properties.scss +6 -0
- package/dist/vendor/bootstrap-vue/src/components/index.js +0 -2
- package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +1 -1
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -3
- package/dist/vendor/bootstrap-vue/src/index.js +0 -3
- package/package.json +1 -1
- package/src/components/base/avatar/avatar.scss +8 -0
- package/src/components/base/form/form_checkbox_tree/models/tree.js +1 -0
- package/src/components/charts/series_label/series_label.vue +1 -0
- package/src/index.js +0 -2
- package/src/scss/bootstrap.scss +0 -1
- package/src/scss/components.scss +0 -1
- package/src/tokens/build/css/tokens.css +12 -6
- package/src/tokens/build/css/tokens.dark.css +12 -6
- package/src/tokens/build/js/tokens.dark.js +12 -6
- package/src/tokens/build/js/tokens.js +12 -6
- package/src/tokens/build/json/tokens.dark.json +160 -30
- package/src/tokens/build/json/tokens.json +160 -30
- package/src/tokens/build/scss/_tokens.dark.scss +12 -6
- package/src/tokens/build/scss/_tokens.scss +12 -6
- package/src/tokens/build/scss/_tokens_custom_properties.scss +6 -0
- package/src/tokens/contextual/avatar.tokens.json +52 -18
- package/src/vendor/bootstrap-vue/nuxt/index.js +0 -1
- package/src/vendor/bootstrap-vue/package.json +0 -1
- package/src/vendor/bootstrap-vue/src/components/index.d.ts +0 -1
- package/src/vendor/bootstrap-vue/src/components/index.js +0 -2
- package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +1 -1
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -2
- package/src/vendor/bootstrap-vue/src/index.js +0 -5
- package/dist/components/base/carousel/carousel.js +0 -48
- package/dist/components/base/carousel/carousel_slide.js +0 -47
- package/dist/vendor/bootstrap-vue/src/components/carousel/carousel-slide.js +0 -123
- package/dist/vendor/bootstrap-vue/src/components/carousel/carousel.js +0 -617
- package/dist/vendor/bootstrap-vue/src/components/carousel/index.js +0 -14
- package/src/components/base/carousel/carousel.md +0 -3
- package/src/components/base/carousel/carousel.scss +0 -29
- package/src/components/base/carousel/carousel.vue +0 -19
- package/src/components/base/carousel/carousel_slide.vue +0 -18
- package/src/vendor/bootstrap-vue/src/components/carousel/README.md +0 -320
- package/src/vendor/bootstrap-vue/src/components/carousel/carousel-slide.js +0 -132
- package/src/vendor/bootstrap-vue/src/components/carousel/carousel-slide.spec.js +0 -276
- package/src/vendor/bootstrap-vue/src/components/carousel/carousel.js +0 -655
- package/src/vendor/bootstrap-vue/src/components/carousel/carousel.spec.js +0 -1069
- package/src/vendor/bootstrap-vue/src/components/carousel/index.d.ts +0 -20
- package/src/vendor/bootstrap-vue/src/components/carousel/index.js +0 -12
- package/src/vendor/bootstrap-vue/src/components/carousel/package.json +0 -185
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
# Carousel
|
|
2
|
-
|
|
3
|
-
> The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms.
|
|
4
|
-
> It works with a series of images, text, or custom markup. It also includes support for
|
|
5
|
-
> previous/next controls and indicators.
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<template>
|
|
9
|
-
<div>
|
|
10
|
-
<b-carousel
|
|
11
|
-
id="carousel-1"
|
|
12
|
-
v-model="slide"
|
|
13
|
-
:interval="4000"
|
|
14
|
-
controls
|
|
15
|
-
indicators
|
|
16
|
-
background="#ababab"
|
|
17
|
-
img-width="1024"
|
|
18
|
-
img-height="480"
|
|
19
|
-
style="text-shadow: 1px 1px 2px #333;"
|
|
20
|
-
@sliding-start="onSlideStart"
|
|
21
|
-
@sliding-end="onSlideEnd"
|
|
22
|
-
>
|
|
23
|
-
<!-- Text slides with image -->
|
|
24
|
-
<b-carousel-slide
|
|
25
|
-
caption="First slide"
|
|
26
|
-
text="Nulla vitae elit libero, a pharetra augue mollis interdum."
|
|
27
|
-
img-src="https://picsum.photos/1024/480/?image=52"
|
|
28
|
-
></b-carousel-slide>
|
|
29
|
-
|
|
30
|
-
<!-- Slides with custom text -->
|
|
31
|
-
<b-carousel-slide img-src="https://picsum.photos/1024/480/?image=54">
|
|
32
|
-
<h1>Hello world!</h1>
|
|
33
|
-
</b-carousel-slide>
|
|
34
|
-
|
|
35
|
-
<!-- Slides with image only -->
|
|
36
|
-
<b-carousel-slide img-src="https://picsum.photos/1024/480/?image=58"></b-carousel-slide>
|
|
37
|
-
|
|
38
|
-
<!-- Slides with img slot -->
|
|
39
|
-
<!-- Note the classes .d-block and .img-fluid to prevent browser default image alignment -->
|
|
40
|
-
<b-carousel-slide>
|
|
41
|
-
<template #img>
|
|
42
|
-
<img
|
|
43
|
-
class="d-block img-fluid w-100"
|
|
44
|
-
width="1024"
|
|
45
|
-
height="480"
|
|
46
|
-
src="https://picsum.photos/1024/480/?image=55"
|
|
47
|
-
alt="image slot"
|
|
48
|
-
>
|
|
49
|
-
</template>
|
|
50
|
-
</b-carousel-slide>
|
|
51
|
-
|
|
52
|
-
<!-- Slide with blank fluid image to maintain slide aspect ratio -->
|
|
53
|
-
<b-carousel-slide caption="Blank Image" img-blank img-alt="Blank image">
|
|
54
|
-
<p>
|
|
55
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse eros felis, tincidunt
|
|
56
|
-
a tincidunt eget, convallis vel est. Ut pellentesque ut lacus vel interdum.
|
|
57
|
-
</p>
|
|
58
|
-
</b-carousel-slide>
|
|
59
|
-
</b-carousel>
|
|
60
|
-
|
|
61
|
-
<p class="mt-4">
|
|
62
|
-
Slide #: {{ slide }}<br>
|
|
63
|
-
Sliding: {{ sliding }}
|
|
64
|
-
</p>
|
|
65
|
-
</div>
|
|
66
|
-
</template>
|
|
67
|
-
|
|
68
|
-
<script>
|
|
69
|
-
export default {
|
|
70
|
-
data() {
|
|
71
|
-
return {
|
|
72
|
-
slide: 0,
|
|
73
|
-
sliding: null
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
methods: {
|
|
77
|
-
onSlideStart(slide) {
|
|
78
|
-
this.sliding = true
|
|
79
|
-
},
|
|
80
|
-
onSlideEnd(slide) {
|
|
81
|
-
this.sliding = false
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<!-- b-carousel.vue -->
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Please be aware that nested carousels are **not** supported.
|
|
91
|
-
|
|
92
|
-
## Sizing
|
|
93
|
-
|
|
94
|
-
Carousels don't automatically normalize slide dimensions. As such, you may need to use additional
|
|
95
|
-
utilities or custom styles to appropriately size content. When using images in each slide, ensure
|
|
96
|
-
they all have the same dimensions (or aspect ratio).
|
|
97
|
-
|
|
98
|
-
When using `img-src` or `img-blank` on `<b-carousel-slide>`, you can set the image width and height
|
|
99
|
-
via the `img-width` and `img-height` props on `<b-carousel>` and have these values automatically
|
|
100
|
-
applied to each `carousel-slide` image.
|
|
101
|
-
|
|
102
|
-
Note that images will still be responsive and automatically grow or shrink to fit within the width
|
|
103
|
-
of its parent container.
|
|
104
|
-
|
|
105
|
-
Internally, `<b-carousel-slide>` uses the [`<b-img>`](/docs/components/image) component to render
|
|
106
|
-
the images. The `img-*` props map to the corresponding props available to `<b-img>`.
|
|
107
|
-
|
|
108
|
-
## Interval
|
|
109
|
-
|
|
110
|
-
Carousel defaults to an interval of `5000`ms (5 seconds). You can change the interval between slides
|
|
111
|
-
by setting the `interval` prop to the desired number of milliseconds. The smallest supported sliding
|
|
112
|
-
interval is 1000ms (1 second).
|
|
113
|
-
|
|
114
|
-
In browsers where the [Page Visibility API](https://www.w3.org/TR/page-visibility/) is supported,
|
|
115
|
-
the carousel will avoid sliding when the webpage is not visible to the user (such as when the
|
|
116
|
-
browser tab is inactive, the browser window is minimized, etc.). Sliding will resume when the
|
|
117
|
-
browser tab is active.
|
|
118
|
-
|
|
119
|
-
### Pausing the carousel
|
|
120
|
-
|
|
121
|
-
To pause the carousel from auto sliding, set the `interval` prop to `0`. To restart a paused
|
|
122
|
-
carousel, set the `interval` back to the desired number of ms.
|
|
123
|
-
|
|
124
|
-
When the carousel is paused, the user can still switch slides via the controls (if enabled) or touch
|
|
125
|
-
swipe (on touch enabled devices, if not disabled).
|
|
126
|
-
|
|
127
|
-
When the users mouse hovers the carousel it will automatically pause, and will automatically restart
|
|
128
|
-
when the mouse leaves the carousel. To disable this feature, set the `no-hover-pause` prop on
|
|
129
|
-
`<b-carousel>`.
|
|
130
|
-
|
|
131
|
-
## Controls and indicators
|
|
132
|
-
|
|
133
|
-
Set the prop `controls` to enable the previous and next control buttons.
|
|
134
|
-
|
|
135
|
-
Set the prop `indicators` to show the slide indicator buttons.
|
|
136
|
-
|
|
137
|
-
Both indicators and controls can be set at the same time or independently.
|
|
138
|
-
|
|
139
|
-
## Carousel slide content
|
|
140
|
-
|
|
141
|
-
`b-carousel-slide` provides several props and slots for placing content in the slide.
|
|
142
|
-
|
|
143
|
-
### Props
|
|
144
|
-
|
|
145
|
-
- `caption` Text to use as the main title on the slide (placed inside the inner element which has
|
|
146
|
-
the class `carousel-caption`)
|
|
147
|
-
- `text` Textual placed under the title (placed inside the inner element which has the class
|
|
148
|
-
`carousel-caption`)
|
|
149
|
-
- `img-src` URL of image to be placed into the background of the slide
|
|
150
|
-
- `caption-html` Alternate prop to the `caption` prop, which supports HTML strings
|
|
151
|
-
- `html` Alternate prop to the `text` prop, which supports HTML strings
|
|
152
|
-
|
|
153
|
-
<p class="alert alert-danger">
|
|
154
|
-
<strong>Warning:</strong> Be cautious of using the <code>caption-html</code> and <code>html</code>
|
|
155
|
-
props to display user supplied content, as it may make your application vulnerable to
|
|
156
|
-
<a class="alert-link" href="https://en.wikipedia.org/wiki/Cross-site_scripting">
|
|
157
|
-
<abbr title="Cross Site Scripting Attacks">XSS attacks</abbr></a>, if you do not first
|
|
158
|
-
<a class="alert-link" href="https://en.wikipedia.org/wiki/HTML_sanitization">sanitize</a> the
|
|
159
|
-
user supplied string.
|
|
160
|
-
</p>
|
|
161
|
-
|
|
162
|
-
### Named slots
|
|
163
|
-
|
|
164
|
-
- `default` content that will be placed inside of the inner element which has the class
|
|
165
|
-
`carousel-caption`. Appears after any content from the `caption` and `text` props.
|
|
166
|
-
- `img` content to place into the background of the slide. Despite the slot's name, you can place
|
|
167
|
-
almost any content in this slot in lieu of using the `default` slot or `caption` and `text` props.
|
|
168
|
-
|
|
169
|
-
## Carousel animation
|
|
170
|
-
|
|
171
|
-
Carousel, by default, uses a sliding animation. You can change the slide animation to a cross-fade
|
|
172
|
-
animation, or disable animation completely.
|
|
173
|
-
|
|
174
|
-
### Crossfade animation
|
|
175
|
-
|
|
176
|
-
Set the `<b-carousel>` `fade` prop to `true` to animate slides with a fade transition instead of the
|
|
177
|
-
default slide animation.
|
|
178
|
-
|
|
179
|
-
```html
|
|
180
|
-
<div>
|
|
181
|
-
<b-carousel
|
|
182
|
-
id="carousel-fade"
|
|
183
|
-
style="text-shadow: 0px 0px 2px #000"
|
|
184
|
-
fade
|
|
185
|
-
indicators
|
|
186
|
-
img-width="1024"
|
|
187
|
-
img-height="480"
|
|
188
|
-
>
|
|
189
|
-
<b-carousel-slide
|
|
190
|
-
caption="First Slide"
|
|
191
|
-
img-src="https://picsum.photos/1024/480/?image=10"
|
|
192
|
-
></b-carousel-slide>
|
|
193
|
-
<b-carousel-slide
|
|
194
|
-
caption="Second Slide"
|
|
195
|
-
img-src="https://picsum.photos/1024/480/?image=12"
|
|
196
|
-
></b-carousel-slide>
|
|
197
|
-
<b-carousel-slide
|
|
198
|
-
caption="Third Slide"
|
|
199
|
-
img-src="https://picsum.photos/1024/480/?image=22"
|
|
200
|
-
></b-carousel-slide>
|
|
201
|
-
</b-carousel>
|
|
202
|
-
</div>
|
|
203
|
-
|
|
204
|
-
<!-- b-carousel-fade.vue -->
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Disable animation
|
|
208
|
-
|
|
209
|
-
Set the `<b-carousel>` `no-animation` prop to `true` to disable slide animation.
|
|
210
|
-
|
|
211
|
-
```html
|
|
212
|
-
<div>
|
|
213
|
-
<b-carousel
|
|
214
|
-
id="carousel-no-animation"
|
|
215
|
-
style="text-shadow: 0px 0px 2px #000"
|
|
216
|
-
no-animation
|
|
217
|
-
indicators
|
|
218
|
-
img-width="1024"
|
|
219
|
-
img-height="480"
|
|
220
|
-
>
|
|
221
|
-
<b-carousel-slide
|
|
222
|
-
caption="First Slide"
|
|
223
|
-
img-src="https://picsum.photos/1024/480/?image=10"
|
|
224
|
-
></b-carousel-slide>
|
|
225
|
-
<b-carousel-slide
|
|
226
|
-
caption="Second Slide"
|
|
227
|
-
img-src="https://picsum.photos/1024/480/?image=12"
|
|
228
|
-
></b-carousel-slide>
|
|
229
|
-
<b-carousel-slide
|
|
230
|
-
caption="Third Slide"
|
|
231
|
-
img-src="https://picsum.photos/1024/480/?image=22"
|
|
232
|
-
></b-carousel-slide>
|
|
233
|
-
<b-carousel-slide
|
|
234
|
-
caption="Fourth Slide"
|
|
235
|
-
img-src="https://picsum.photos/1024/480/?image=23"
|
|
236
|
-
></b-carousel-slide>
|
|
237
|
-
</b-carousel>
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
<!-- b-carousel-no-animation.vue -->
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## Slide wrapping
|
|
244
|
-
|
|
245
|
-
Normally when the carousel reaches one end or the other in the list of slides, it will wrap to the
|
|
246
|
-
opposite end of the list of slides and continue cycling.
|
|
247
|
-
|
|
248
|
-
To disable carousel slide wrapping, set the `no-wrap` prop to true.
|
|
249
|
-
|
|
250
|
-
## Hide slide text content on small screens
|
|
251
|
-
|
|
252
|
-
On smaller screens you may want to hide the captions and headings. You can do so via the
|
|
253
|
-
`content-visible-up` prop of `<b-carousel-slide>`. The prop accepts a breakpoint name (i.e. `sm`,
|
|
254
|
-
`md`, `lg`, `xl`, or custom breakpoint names if you have defined them), and will hide the headings
|
|
255
|
-
and captions on screens _smaller_ than the breakpoint.
|
|
256
|
-
|
|
257
|
-
## Touch swipe support
|
|
258
|
-
|
|
259
|
-
On touch enabled devices, users can switch slides by swiping left or right on the carousel. To
|
|
260
|
-
disable touch control, set the `no-touch` prop to `true`.
|
|
261
|
-
|
|
262
|
-
## `v-model` support
|
|
263
|
-
|
|
264
|
-
Programmatically control which slide is showing via `v-model` (which binds to the `value` prop).
|
|
265
|
-
Note, that slides are indexed starting at `0`.
|
|
266
|
-
|
|
267
|
-
## Programmatic slide control
|
|
268
|
-
|
|
269
|
-
The `<b-carousel>` instance provides several public methods for controlling sliding:
|
|
270
|
-
|
|
271
|
-
| Method | Description |
|
|
272
|
-
| ----------------- | ------------------------------------------------------- |
|
|
273
|
-
| `setSlide(index)` | Go to slide specified by `index` |
|
|
274
|
-
| `next()` | Go to next slide |
|
|
275
|
-
| `prev()` | Go to previous slide |
|
|
276
|
-
| `pause()` | Pause the slide cycling |
|
|
277
|
-
| `start()` | Start slide cycling (prop `interval` must have a value) |
|
|
278
|
-
|
|
279
|
-
You will need a reference (via `this.$refs`) to the carousel instance in order to call these
|
|
280
|
-
methods:
|
|
281
|
-
|
|
282
|
-
```html
|
|
283
|
-
<template>
|
|
284
|
-
<b-carousel ref="myCarousel" .... >
|
|
285
|
-
<!-- slides go here -->
|
|
286
|
-
</b-carousel>
|
|
287
|
-
</template>
|
|
288
|
-
|
|
289
|
-
<script>
|
|
290
|
-
export default {
|
|
291
|
-
// ...
|
|
292
|
-
methods: {
|
|
293
|
-
prev() {
|
|
294
|
-
this.$refs.myCarousel.prev()
|
|
295
|
-
},
|
|
296
|
-
next() {
|
|
297
|
-
this.$refs.myCarousel.next()
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
</script>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## Accessibility
|
|
305
|
-
|
|
306
|
-
Carousels are generally not fully compliant with accessibility standards, although we try to make
|
|
307
|
-
them as accessible as possible.
|
|
308
|
-
|
|
309
|
-
By providing a document unique value via the `id` prop, `<b-carousel>` will enable accessibility
|
|
310
|
-
features. It is highly recommended to always add an ID to all components.
|
|
311
|
-
|
|
312
|
-
All carousel controls and indicators have aria labels. These can be customized by setting the
|
|
313
|
-
various `label-*` props.
|
|
314
|
-
|
|
315
|
-
**Note:** The animation effect of this component is dependent on the `prefers-reduced-motion` media
|
|
316
|
-
query. See the
|
|
317
|
-
[reduced motion section of our accessibility documentation](/docs/reference/accessibility) for
|
|
318
|
-
additional details.
|
|
319
|
-
|
|
320
|
-
<!-- Component reference added automatically from component package.json -->
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { extend } from '../../vue'
|
|
2
|
-
import { NAME_CAROUSEL_SLIDE } from '../../constants/components'
|
|
3
|
-
import { HAS_TOUCH_SUPPORT } from '../../constants/env'
|
|
4
|
-
import { PROP_TYPE_BOOLEAN, PROP_TYPE_NUMBER_STRING, PROP_TYPE_STRING } from '../../constants/props'
|
|
5
|
-
import { SLOT_NAME_IMG } from '../../constants/slots'
|
|
6
|
-
import { stopEvent } from '../../utils/events'
|
|
7
|
-
import { htmlOrText } from '../../utils/html'
|
|
8
|
-
import { identity } from '../../utils/identity'
|
|
9
|
-
import { sortKeys } from '../../utils/object'
|
|
10
|
-
import { makeProp, makePropsConfigurable, pluckProps, unprefixPropName } from '../../utils/props'
|
|
11
|
-
import { idMixin, props as idProps } from '../../mixins/id'
|
|
12
|
-
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
|
|
13
|
-
import { BImg } from '../image/img'
|
|
14
|
-
|
|
15
|
-
// --- Props ---
|
|
16
|
-
|
|
17
|
-
const imgProps = {
|
|
18
|
-
imgAlt: makeProp(PROP_TYPE_STRING),
|
|
19
|
-
imgBlank: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
20
|
-
imgBlankColor: makeProp(PROP_TYPE_STRING, 'transparent'),
|
|
21
|
-
imgHeight: makeProp(PROP_TYPE_NUMBER_STRING),
|
|
22
|
-
imgSrc: makeProp(PROP_TYPE_STRING),
|
|
23
|
-
imgWidth: makeProp(PROP_TYPE_NUMBER_STRING)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const props = makePropsConfigurable(
|
|
27
|
-
sortKeys({
|
|
28
|
-
...idProps,
|
|
29
|
-
...imgProps,
|
|
30
|
-
background: makeProp(PROP_TYPE_STRING),
|
|
31
|
-
caption: makeProp(PROP_TYPE_STRING),
|
|
32
|
-
captionHtml: makeProp(PROP_TYPE_STRING),
|
|
33
|
-
captionTag: makeProp(PROP_TYPE_STRING, 'h3'),
|
|
34
|
-
contentTag: makeProp(PROP_TYPE_STRING, 'div'),
|
|
35
|
-
contentVisibleUp: makeProp(PROP_TYPE_STRING),
|
|
36
|
-
text: makeProp(PROP_TYPE_STRING),
|
|
37
|
-
textHtml: makeProp(PROP_TYPE_STRING),
|
|
38
|
-
textTag: makeProp(PROP_TYPE_STRING, 'p')
|
|
39
|
-
}),
|
|
40
|
-
NAME_CAROUSEL_SLIDE
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
// --- Main component ---
|
|
44
|
-
|
|
45
|
-
// @vue/component
|
|
46
|
-
export const BCarouselSlide = /*#__PURE__*/ extend({
|
|
47
|
-
name: NAME_CAROUSEL_SLIDE,
|
|
48
|
-
mixins: [idMixin, normalizeSlotMixin],
|
|
49
|
-
inject: {
|
|
50
|
-
getBvCarousel: {
|
|
51
|
-
// Explicitly disable touch if not a child of carousel
|
|
52
|
-
default: () => () => ({ noTouch: true })
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
props,
|
|
56
|
-
computed: {
|
|
57
|
-
bvCarousel() {
|
|
58
|
-
return this.getBvCarousel()
|
|
59
|
-
},
|
|
60
|
-
contentClasses() {
|
|
61
|
-
return [
|
|
62
|
-
this.contentVisibleUp ? 'd-none' : '',
|
|
63
|
-
this.contentVisibleUp ? `d-${this.contentVisibleUp}-block` : ''
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
|
-
computedWidth() {
|
|
67
|
-
// Use local width, or try parent width
|
|
68
|
-
return this.imgWidth || this.bvCarousel.imgWidth || null
|
|
69
|
-
},
|
|
70
|
-
computedHeight() {
|
|
71
|
-
// Use local height, or try parent height
|
|
72
|
-
return this.imgHeight || this.bvCarousel.imgHeight || null
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
render(h) {
|
|
76
|
-
let $img = this.normalizeSlot(SLOT_NAME_IMG)
|
|
77
|
-
if (!$img && (this.imgSrc || this.imgBlank)) {
|
|
78
|
-
const on = {}
|
|
79
|
-
// Touch support event handler
|
|
80
|
-
/* istanbul ignore if: difficult to test in JSDOM */
|
|
81
|
-
if (!this.bvCarousel.noTouch && HAS_TOUCH_SUPPORT) {
|
|
82
|
-
on.dragstart = event => stopEvent(event, { propagation: false })
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
$img = h(BImg, {
|
|
86
|
-
props: {
|
|
87
|
-
...pluckProps(imgProps, this.$props, unprefixPropName.bind(null, 'img')),
|
|
88
|
-
width: this.computedWidth,
|
|
89
|
-
height: this.computedHeight,
|
|
90
|
-
fluidGrow: true,
|
|
91
|
-
block: true
|
|
92
|
-
},
|
|
93
|
-
on
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const $contentChildren = [
|
|
98
|
-
// Caption
|
|
99
|
-
this.caption || this.captionHtml
|
|
100
|
-
? h(this.captionTag, { domProps: htmlOrText(this.captionHtml, this.caption) })
|
|
101
|
-
: false,
|
|
102
|
-
// Text
|
|
103
|
-
this.text || this.textHtml
|
|
104
|
-
? h(this.textTag, { domProps: htmlOrText(this.textHtml, this.text) })
|
|
105
|
-
: false,
|
|
106
|
-
// Children
|
|
107
|
-
this.normalizeSlot() || false
|
|
108
|
-
]
|
|
109
|
-
|
|
110
|
-
let $content = h()
|
|
111
|
-
if ($contentChildren.some(identity)) {
|
|
112
|
-
$content = h(
|
|
113
|
-
this.contentTag,
|
|
114
|
-
{
|
|
115
|
-
staticClass: 'carousel-caption',
|
|
116
|
-
class: this.contentClasses
|
|
117
|
-
},
|
|
118
|
-
$contentChildren.map($child => $child || h())
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return h(
|
|
123
|
-
'div',
|
|
124
|
-
{
|
|
125
|
-
staticClass: 'carousel-item',
|
|
126
|
-
style: { background: this.background || this.bvCarousel.background || null },
|
|
127
|
-
attrs: { id: this.safeId(), role: 'listitem' }
|
|
128
|
-
},
|
|
129
|
-
[$img, $content]
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
})
|