srcdev-nuxt-components 6.0.0 → 6.0.1
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/README.md +2 -2
- package/app/assets/styles/extends-layer/srcdev-components/components/_display-prompt-core.css +72 -0
- package/app/assets/styles/extends-layer/srcdev-components/components/index.css +1 -0
- package/app/assets/styles/extends-layer/srcdev-components/index.css +2 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/index.css +1 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_error.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_info.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_secondary.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_success.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/_warning.css +15 -0
- package/app/assets/styles/extends-layer/srcdev-components/setup/themes/index.css +5 -0
- package/app/assets/styles/main.css +2 -0
- package/app/assets/styles/setup/_head.css +36 -0
- package/app/assets/styles/setup/a11y/_utils.css +20 -0
- package/app/assets/styles/setup/a11y/_variables.css +8 -0
- package/app/assets/styles/setup/a11y/index.css +2 -0
- package/app/assets/styles/setup/index.css +5 -0
- package/app/assets/styles/setup/typography/index.css +2 -0
- package/app/assets/styles/setup/typography/utility-classes/_generic-font-classes.css +217 -0
- package/app/assets/styles/setup/typography/utility-classes/_generic-font-variation-settings.css +29 -0
- package/app/assets/styles/setup/typography/utility-classes/_generic-font-weights.css +39 -0
- package/app/assets/styles/setup/typography/utility-classes/index.css +3 -0
- package/app/assets/styles/setup/typography/vars/_colors.css +14 -0
- package/app/assets/styles/setup/typography/vars/_reponsive-font-sizes.css +12 -0
- package/app/assets/styles/setup/typography/vars/index.css +2 -0
- package/app/assets/styles/setup/utility-classes/_fluid-spacing.css +13 -0
- package/app/assets/styles/setup/utility-classes/animations/_auto-rotate.css +13 -0
- package/app/assets/styles/setup/utility-classes/animations/_entry-exit-blur.css +16 -0
- package/app/assets/styles/setup/utility-classes/animations/_entry-slide-in.css +15 -0
- package/app/assets/styles/setup/utility-classes/animations/_entry-zoom-reveal.css +15 -0
- package/app/assets/styles/setup/utility-classes/animations/index.css +4 -0
- package/app/assets/styles/setup/utility-classes/index.css +2 -0
- package/app/assets/styles/setup/variables/colors/_blue.css +15 -0
- package/app/assets/styles/setup/variables/colors/_gray.css +16 -0
- package/app/assets/styles/setup/variables/colors/_green.css +15 -0
- package/app/assets/styles/setup/variables/colors/_orange.css +15 -0
- package/app/assets/styles/setup/variables/colors/_red.css +15 -0
- package/app/assets/styles/setup/variables/colors/_yellow.css +15 -0
- package/app/assets/styles/setup/variables/colors/index.css +6 -0
- package/app/assets/styles/setup/variables/index.css +1 -0
- package/app/components/accordian/AccordianCore.vue +46 -0
- package/app/components/animated-svg-text/AnimatedSvgText.vue +87 -0
- package/app/components/canvas-switcher/CanvasSwitcher.vue +77 -0
- package/app/components/carousel-basic/CarouselBasic.vue +291 -0
- package/app/components/carousel-basic/CarouselFlip.vue +461 -0
- package/app/components/carousel-basic/CarouselInfinite.vue +325 -0
- package/app/components/clip-element/ClipElement.vue +73 -0
- package/app/components/clipped-panels/ClippedPanel.vue +73 -0
- package/app/components/container-glow/ContainerGlowCore.vue +211 -0
- package/app/components/content-grid/ContentGrid.vue +85 -0
- package/app/components/deep-expanding-menu/DeepExpandingMenu.vue +214 -0
- package/app/components/deep-expanding-menu/DeepExpandingMenuOld.vue +218 -0
- package/app/components/display-banner/DisplayBanner.vue +63 -0
- package/app/components/display-details/DisplayDetailsCore.vue +301 -0
- package/app/components/display-dialog/DisplayDialogCore.vue +255 -0
- package/app/components/display-dialog/variants/DisplayDialogConfirm.vue +45 -0
- package/app/components/display-dialog/variants/DisplayDialogScrollableContent.vue +49 -0
- package/app/components/display-grid/DisplayGridCore.vue +22 -0
- package/app/components/display-prompt/DisplayPromptCore.vue +187 -0
- package/app/components/display-prompt/variants/DisplayPromptError.vue +53 -0
- package/app/components/expanding-panel/ExpandingPanel.vue +124 -0
- package/app/components/image-galleries/SliderGallery.vue +784 -0
- package/app/components/layout-grids/LayoutGridA.vue +103 -0
- package/app/components/layout-grids/LayoutGridB.vue +132 -0
- package/app/components/layout-row/LayoutRow.vue +165 -0
- package/app/components/masonry-grid/MasonryGrid.vue +62 -0
- package/app/components/masonry-grid-ordered/MasonryGridOrdered.vue +158 -0
- package/app/components/masonry-grid-sorted/MasonryGridSorted.vue +115 -0
- package/app/components/pop-over/PopOver.vue +88 -0
- package/app/components/responsive-header/NavigationItems.vue +169 -0
- package/app/components/responsive-header/ResponsiveHeader.vue +686 -0
- package/app/components/rotating-carousel/RotatingCarouselImage.vue +200 -0
- package/app/components/skip-links/SkipLinks.vue +92 -0
- package/app/components/tabs/TabsCore.vue +277 -0
- package/app/composables/useDialogControls.ts +44 -0
- package/app/composables/useStyleClassPassthrough.ts +35 -0
- package/app/composables/useTabs.ts +201 -0
- package/app/types/gallery-data.ts +13 -0
- package/app/types/responsiveHeader.ts +38 -0
- package/app/types/types.carousel-basic.ts +19 -0
- package/package.json +3 -6
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--blue-0: #e7f5ff;
|
|
3
|
+
--blue-1: #d0ebff;
|
|
4
|
+
--blue-2: #a5d8ff;
|
|
5
|
+
--blue-3: #74c0fc;
|
|
6
|
+
--blue-4: #4dabf7;
|
|
7
|
+
--blue-5: #339af0;
|
|
8
|
+
--blue-6: #228be6;
|
|
9
|
+
--blue-7: #1c7ed6;
|
|
10
|
+
--blue-8: #1971c2;
|
|
11
|
+
--blue-9: #1864ab;
|
|
12
|
+
--blue-10: #145591;
|
|
13
|
+
--blue-11: #114678;
|
|
14
|
+
--blue-12: #0e01cd;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--gray-00: #ffffff;
|
|
3
|
+
--gray-0: #f8f9fa;
|
|
4
|
+
--gray-1: #f1f3f5;
|
|
5
|
+
--gray-2: #e9ecef;
|
|
6
|
+
--gray-3: #dee2e6;
|
|
7
|
+
--gray-4: #ced4da;
|
|
8
|
+
--gray-5: #adb5bd;
|
|
9
|
+
--gray-6: #868e96;
|
|
10
|
+
--gray-7: #495057;
|
|
11
|
+
--gray-8: #343a40;
|
|
12
|
+
--gray-9: #212529;
|
|
13
|
+
--gray-10: #16191d;
|
|
14
|
+
--gray-11: #0d0f12;
|
|
15
|
+
--gray-12: #030507;
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--green-0: #ebfbee;
|
|
3
|
+
--green-1: #d3f9d8;
|
|
4
|
+
--green-2: #b2f2bb;
|
|
5
|
+
--green-3: #8ce99a;
|
|
6
|
+
--green-4: #69db7c;
|
|
7
|
+
--green-5: #51cf66;
|
|
8
|
+
--green-6: #40c057;
|
|
9
|
+
--green-7: #37b24d;
|
|
10
|
+
--green-8: #2f9e44;
|
|
11
|
+
--green-9: #2b8a3e;
|
|
12
|
+
--green-10: #237032;
|
|
13
|
+
--green-11: #1b5727;
|
|
14
|
+
--green-12: #017f18;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--orange-0: #fff4e6;
|
|
3
|
+
--orange-1: #ffe8cc;
|
|
4
|
+
--orange-2: #ffd8a8;
|
|
5
|
+
--orange-3: #ffc078;
|
|
6
|
+
--orange-4: #ffa94d;
|
|
7
|
+
--orange-5: #ff922b;
|
|
8
|
+
--orange-6: #ff7400;
|
|
9
|
+
--orange-7: #f76707;
|
|
10
|
+
--orange-8: #e8590c;
|
|
11
|
+
--orange-9: #d9480f;
|
|
12
|
+
--orange-10: #bf400d;
|
|
13
|
+
--orange-11: #99330b;
|
|
14
|
+
--orange-12: #c23903;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--red-0: #fff5f5;
|
|
3
|
+
--red-1: #ffe3e3;
|
|
4
|
+
--red-2: #ffc9c9;
|
|
5
|
+
--red-3: #ffa8a8;
|
|
6
|
+
--red-4: #ff8787;
|
|
7
|
+
--red-5: #ff6b6b;
|
|
8
|
+
--red-6: #fa5252;
|
|
9
|
+
--red-7: #f03e3e;
|
|
10
|
+
--red-8: #e03131;
|
|
11
|
+
--red-9: #ff0b0b;
|
|
12
|
+
--red-10: #b02525;
|
|
13
|
+
--red-11: #962020;
|
|
14
|
+
--red-12: #cc0000;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--yellow-0: #fff9db;
|
|
3
|
+
--yellow-1: #fff3bf;
|
|
4
|
+
--yellow-2: #ffec99;
|
|
5
|
+
--yellow-3: #ffe066;
|
|
6
|
+
--yellow-4: #ffd43b;
|
|
7
|
+
--yellow-5: #fcc419;
|
|
8
|
+
--yellow-6: #fab005;
|
|
9
|
+
--yellow-7: #f59f00;
|
|
10
|
+
--yellow-8: #f08c00;
|
|
11
|
+
--yellow-9: #e67700;
|
|
12
|
+
--yellow-10: #b35c00;
|
|
13
|
+
--yellow-11: #804200;
|
|
14
|
+
--yellow-12: #663500;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './colors';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="display-accordian" :class="[elementClasses]">
|
|
3
|
+
<ExpandingPanel v-for="(item, key) in itemCount" :key="key" :name :animation-duration="300" icon-size="medium" :style-class-passthrough="['accordian-item']">
|
|
4
|
+
<template #summary>
|
|
5
|
+
<slot :name="`accordian-${key}-summary`"></slot>
|
|
6
|
+
</template>
|
|
7
|
+
<template #icon>
|
|
8
|
+
<slot :name="`accordian-${key}-icon`"></slot>
|
|
9
|
+
</template>
|
|
10
|
+
<template #layout-content>
|
|
11
|
+
<slot :name="`accordian-${key}-content`"></slot>
|
|
12
|
+
</template>
|
|
13
|
+
</ExpandingPanel>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
name: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: null,
|
|
22
|
+
},
|
|
23
|
+
itemCount: {
|
|
24
|
+
type: Number as PropType<number>,
|
|
25
|
+
default: 0,
|
|
26
|
+
},
|
|
27
|
+
animationDuration: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 400,
|
|
30
|
+
},
|
|
31
|
+
styleClassPassthrough: {
|
|
32
|
+
type: Array as PropType<string[]>,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
38
|
+
const animationDurationStr = computed(() => `${props.animationDuration}ms`);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<style lang="css">
|
|
42
|
+
.display-accordian {
|
|
43
|
+
max-width: 600px;
|
|
44
|
+
margin: 0 auto;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="animated-svg-text" :class="[elementClasses]">
|
|
3
|
+
<slot name="text"></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
styleClassPassthrough: {
|
|
10
|
+
type: Array as PropType<string[]>,
|
|
11
|
+
default: () => [],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
16
|
+
|
|
17
|
+
watch(
|
|
18
|
+
() => props.styleClassPassthrough,
|
|
19
|
+
() => {
|
|
20
|
+
resetElementClasses(props.styleClassPassthrough);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style lang="css">
|
|
26
|
+
|
|
27
|
+
@keyframes animatedSvgText {
|
|
28
|
+
0% {
|
|
29
|
+
fill: transparent;
|
|
30
|
+
stroke-dashoffset: var(--_animated-svg-text-stroke-dasharray);
|
|
31
|
+
stroke-width: 0.3;
|
|
32
|
+
}
|
|
33
|
+
70% {
|
|
34
|
+
fill: transparent;
|
|
35
|
+
stroke-width: 0.3;
|
|
36
|
+
}
|
|
37
|
+
100% {
|
|
38
|
+
fill: var(--_animated-svg-fill-color);
|
|
39
|
+
stroke-dashoffset: 0;
|
|
40
|
+
stroke-width: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
html {
|
|
45
|
+
|
|
46
|
+
&[data-color-scheme='light'] {
|
|
47
|
+
.animated-svg-text {
|
|
48
|
+
--_animated-svg-text-color: var(--_animated-svg-text-stroke-light);
|
|
49
|
+
--_animated-svg-fill-color: var(--_animated-svg-text-fill-light);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
&[data-color-scheme='dark'] {
|
|
53
|
+
.animated-svg-text {
|
|
54
|
+
--_animated-svg-text-color: var(--_animated-svg-text-stroke-dark);
|
|
55
|
+
--_animated-svg-fill-color: var(--_animated-svg-text-fill-dark);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
&[data-color-scheme='auto'] {
|
|
59
|
+
.animated-svg-text {
|
|
60
|
+
@media (prefers-color-scheme: light) {
|
|
61
|
+
--_animated-svg-text-color: var(--_animated-svg-text-stroke-light);
|
|
62
|
+
--_animated-svg-fill-color: var(--_animated-svg-text-fill-light);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (prefers-color-scheme: dark) {
|
|
66
|
+
--_animated-svg-text-color: var(--_animated-svg-text-stroke-dark);
|
|
67
|
+
--_animated-svg-fill-color: var(--_animated-svg-text-fill-dark);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.animated-svg-text {
|
|
73
|
+
|
|
74
|
+
--_animated-svg-text-color: var(--_animated-svg-text-stroke-light):
|
|
75
|
+
--_animated-svg-fill-color: var(--_animated-svg-text-fill-light);
|
|
76
|
+
|
|
77
|
+
svg path {
|
|
78
|
+
stroke: var(--_animated-svg-text-color);
|
|
79
|
+
stroke-width: 0.3;
|
|
80
|
+
stroke-dasharray: var(--_animated-svg-text-stroke-dasharray);
|
|
81
|
+
stroke-dashoffset: var(--_animated-svg-text-stroke-dasharray);
|
|
82
|
+
animation: animatedSvgText var(--_animated-svg-animation-duration) linear 1 forwards;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="canvas-switcher">
|
|
3
|
+
<p>Canvas switcher</p>
|
|
4
|
+
<ul class="canvas-switcher mbe-20">
|
|
5
|
+
<li>
|
|
6
|
+
<button type="button" @click.stop.prevent="updateCanvas('mobileCanvas')">
|
|
7
|
+
<Icon name="ic:baseline-phone-iphone" class="icon" :class="[{ current: canvasName === 'mobileCanvas' }]" />
|
|
8
|
+
</button>
|
|
9
|
+
</li>
|
|
10
|
+
<li>
|
|
11
|
+
<button type="button" @click.stop.prevent="updateCanvas('tabletCanvas')">
|
|
12
|
+
<Icon name="ic:baseline-tablet-mac" class="icon" :class="[{ current: canvasName === 'tabletCanvas' }]" />
|
|
13
|
+
</button>
|
|
14
|
+
</li>
|
|
15
|
+
<li>
|
|
16
|
+
<button type="button" @click.stop.prevent="updateCanvas('laptopCanvas')">
|
|
17
|
+
<Icon name="ic:baseline-laptop-mac" class="icon" :class="[{ current: canvasName === 'laptopCanvas' }]" />
|
|
18
|
+
</button>
|
|
19
|
+
</li>
|
|
20
|
+
<li>
|
|
21
|
+
<button type="button" @click.stop.prevent="updateCanvas('desktopCanvas')">
|
|
22
|
+
<Icon name="ic:outline-desktop-mac" class="icon" :class="[{ current: canvasName === 'desktopCanvas' }]" />
|
|
23
|
+
</button>
|
|
24
|
+
</li>
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import type { MediaCanvas } from '@/types/types.canvasName';
|
|
31
|
+
|
|
32
|
+
const canvasName = defineModel<MediaCanvas>('canvasName');
|
|
33
|
+
|
|
34
|
+
const updateCanvas = (setCanvas: MediaCanvas) => {
|
|
35
|
+
canvasName.value = setCanvas;
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="css">
|
|
40
|
+
.canvas-switcher {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: 20px;
|
|
44
|
+
|
|
45
|
+
ul {
|
|
46
|
+
display: flex;
|
|
47
|
+
gap: 10px;
|
|
48
|
+
list-style-type: none;
|
|
49
|
+
margin: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
|
|
52
|
+
li {
|
|
53
|
+
button {
|
|
54
|
+
all: unset;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
padding: 5px;
|
|
59
|
+
border: 0px solid light-dark(var(--gray-10), var(--gray-2));
|
|
60
|
+
border-radius: 4px;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
|
|
63
|
+
.icon {
|
|
64
|
+
color: light-dark(var(--gray-10), var(--gray-2));
|
|
65
|
+
|
|
66
|
+
width: 24px;
|
|
67
|
+
height: 24px;
|
|
68
|
+
|
|
69
|
+
&.current {
|
|
70
|
+
color: light-dark(var(--green-10), var(--green-4));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</style>
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="carousel-basic" :class="[elementClasses]" ref="carouselWrapperRef" role="region" aria-label="Image carousel">
|
|
3
|
+
<!-- Screen reader announcement for current item -->
|
|
4
|
+
<div aria-live="polite" aria-atomic="true" class="sr-only">Item {{ currentIndex + 1 }} of {{ itemCount }}</div>
|
|
5
|
+
|
|
6
|
+
<LayoutRow tag="div" variant="full-width" :style-class-passthrough="['mbe-20']">
|
|
7
|
+
<div tabindex="0" class="item-container" :class="{ 'allow-overflow': allowCarouselOverflow }" ref="carouselContainerRef" role="group" aria-label="Carousel items">
|
|
8
|
+
<div v-for="(item, index) in carouselDataIds" :key="index" class="item" ref="carouselItems" :aria-current="currentIndex === index ? 'true' : 'false'">
|
|
9
|
+
<slot :name="item"></slot>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</LayoutRow>
|
|
13
|
+
|
|
14
|
+
<LayoutRow tag="div" variant="full-width" :style-class-passthrough="['mbe-20']">
|
|
15
|
+
<div class="timeline-container">
|
|
16
|
+
<div v-for="index in itemCount" :key="index" class="timeline-item">
|
|
17
|
+
<div class="count">Step {{ index }}</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</LayoutRow>
|
|
21
|
+
|
|
22
|
+
<LayoutRow tag="div" variant="full-width" :style-class-passthrough="['mbe-20']">
|
|
23
|
+
<div tabindex="0" class="controls-container" ref="controlsContainerRef">
|
|
24
|
+
<div class="markers-container">
|
|
25
|
+
<ul class="markers-list">
|
|
26
|
+
<li v-for="index in itemCount" :key="index" class="markers-item">
|
|
27
|
+
<button @click.prevent="jumpToFrame(index - 1)" class="btn-marker" :class="[{ active: currentIndex === index - 1 }]" :aria-label="`Jump to item ${Math.floor(index + 1)}`"></button>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="buttons-container">
|
|
32
|
+
<button type="button" @click.prevent="actionPrevious()" class="btn-action" aria-label="Go to previous item">
|
|
33
|
+
<Icon name="ic:outline-keyboard-arrow-left" class="arrows-icon" />
|
|
34
|
+
</button>
|
|
35
|
+
<button type="button" @click.prevent="actionNext()" class="btn-action" aria-label="Go to next item">
|
|
36
|
+
<Icon name="ic:outline-keyboard-arrow-right" class="arrows-icon" />
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</LayoutRow>
|
|
41
|
+
</section>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { useEventListener, useResizeObserver, useSwipe } from '@vueuse/core';
|
|
46
|
+
|
|
47
|
+
const props = defineProps({
|
|
48
|
+
carouselDataIds: {
|
|
49
|
+
type: Array as PropType<string[]>,
|
|
50
|
+
default: () => [],
|
|
51
|
+
},
|
|
52
|
+
styleClassPassthrough: {
|
|
53
|
+
type: Array as PropType<string[]>,
|
|
54
|
+
default: () => [],
|
|
55
|
+
},
|
|
56
|
+
transitionSpeed: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 200,
|
|
59
|
+
},
|
|
60
|
+
allowCarouselOverflow: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
returnToStart: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
71
|
+
|
|
72
|
+
const carouselWrapperRef = ref<HTMLDivElement | null>(null);
|
|
73
|
+
const carouselContainerRef = ref<HTMLDivElement | null>(null);
|
|
74
|
+
const carouselItemsRef = useTemplateRef<HTMLDivElement[]>('carouselItems');
|
|
75
|
+
const controlsContainerRef = ref<HTMLDivElement | null>(null);
|
|
76
|
+
const carouselInitComplete = ref(false);
|
|
77
|
+
|
|
78
|
+
const currentIndex = ref(0);
|
|
79
|
+
const itemCount = ref(props.carouselDataIds.length);
|
|
80
|
+
const offset = ref(0);
|
|
81
|
+
const transitionSpeedStr = props.transitionSpeed + 'ms';
|
|
82
|
+
const itemTransform = computed(() => {
|
|
83
|
+
return `translateX(calc(${offset.value} * (${itemWidth.value} + var(--_carousel-item-track-gap))))`;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const itemWidth = ref('0px');
|
|
87
|
+
|
|
88
|
+
const actionPrevious = () => {
|
|
89
|
+
if (props.returnToStart && currentIndex.value === 0) {
|
|
90
|
+
offset.value = -itemCount.value;
|
|
91
|
+
doAction();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (offset.value >= 0) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
offset.value = Math.min(offset.value + 1);
|
|
99
|
+
doAction();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const actionNext = () => {
|
|
103
|
+
if (props.returnToStart && offset.value <= -1 * (itemCount.value - 1)) {
|
|
104
|
+
offset.value = 0;
|
|
105
|
+
doAction();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (offset.value <= -1 * (itemCount.value - 1)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
offset.value = Math.min(offset.value - 1);
|
|
114
|
+
doAction();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const doAction = () => {
|
|
118
|
+
currentIndex.value = Math.abs(offset.value);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const jumpToFrame = (index: number) => {
|
|
122
|
+
if (index >= 0 && index < itemCount.value) {
|
|
123
|
+
offset.value = -index;
|
|
124
|
+
doAction();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const initialSetup = () => {
|
|
129
|
+
if (carouselItemsRef?.value && carouselItemsRef.value.length > 0 && carouselItemsRef.value[0]) {
|
|
130
|
+
itemWidth.value = carouselItemsRef.value[0].offsetWidth + 'px';
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
carouselInitComplete.value = true;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const { direction } = useSwipe(carouselContainerRef, {
|
|
137
|
+
passive: false,
|
|
138
|
+
onSwipeEnd() {
|
|
139
|
+
if (direction.value === 'left') {
|
|
140
|
+
actionNext();
|
|
141
|
+
} else if (direction.value === 'right') {
|
|
142
|
+
actionPrevious();
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
useEventListener(carouselContainerRef, 'keydown', (event: KeyboardEvent) => {
|
|
148
|
+
if (event.key === 'ArrowLeft') {
|
|
149
|
+
actionPrevious();
|
|
150
|
+
} else if (event.key === 'ArrowRight') {
|
|
151
|
+
actionNext();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
useEventListener(controlsContainerRef, 'keydown', (event: KeyboardEvent) => {
|
|
156
|
+
if (event.key === 'ArrowLeft') {
|
|
157
|
+
actionPrevious();
|
|
158
|
+
} else if (event.key === 'ArrowRight') {
|
|
159
|
+
actionNext();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
useResizeObserver(carouselWrapperRef, async () => {
|
|
164
|
+
initialSetup();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
onMounted(() => {
|
|
168
|
+
initialSetup();
|
|
169
|
+
});
|
|
170
|
+
</script>
|
|
171
|
+
|
|
172
|
+
<style lang="css">
|
|
173
|
+
.carousel-basic {
|
|
174
|
+
--_carousel-item-track-gap: 10px;
|
|
175
|
+
|
|
176
|
+
display: grid;
|
|
177
|
+
grid-template-columns: 1fr;
|
|
178
|
+
gap: 10px;
|
|
179
|
+
|
|
180
|
+
.sr-only {
|
|
181
|
+
position: absolute;
|
|
182
|
+
width: 1px;
|
|
183
|
+
height: 1px;
|
|
184
|
+
padding: 0;
|
|
185
|
+
margin: -1px;
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
clip: rect(0, 0, 0, 0);
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
border: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.timeline-container {
|
|
193
|
+
display: flex;
|
|
194
|
+
gap: var(--_carousel-item-track-gap);
|
|
195
|
+
overflow-x: hidden;
|
|
196
|
+
|
|
197
|
+
.timeline-item {
|
|
198
|
+
display: flex;
|
|
199
|
+
flex: 0 0 100%;
|
|
200
|
+
max-inline-size: 800px;
|
|
201
|
+
align-items: center;
|
|
202
|
+
transform: v-bind(itemTransform);
|
|
203
|
+
position: relative;
|
|
204
|
+
|
|
205
|
+
&::before {
|
|
206
|
+
content: '';
|
|
207
|
+
position: absolute;
|
|
208
|
+
height: 2px;
|
|
209
|
+
background-color: #fff;
|
|
210
|
+
left: 70px;
|
|
211
|
+
right: 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.count {
|
|
215
|
+
width: fit-content;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.item-container {
|
|
221
|
+
display: flex;
|
|
222
|
+
gap: var(--_carousel-item-track-gap);
|
|
223
|
+
overflow-x: hidden;
|
|
224
|
+
position: relative;
|
|
225
|
+
|
|
226
|
+
&.allow-overflow {
|
|
227
|
+
overflow-x: initial;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.item {
|
|
231
|
+
display: flex;
|
|
232
|
+
flex: 0 0 100%;
|
|
233
|
+
max-inline-size: 800px;
|
|
234
|
+
transition: transform v-bind(transitionSpeedStr) ease;
|
|
235
|
+
transform: v-bind(itemTransform);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.controls-container {
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
justify-content: flex-end;
|
|
243
|
+
|
|
244
|
+
.markers-container {
|
|
245
|
+
.markers-list {
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-direction: row;
|
|
248
|
+
gap: 10px;
|
|
249
|
+
list-style-type: none;
|
|
250
|
+
margin: unset;
|
|
251
|
+
padding: unset;
|
|
252
|
+
|
|
253
|
+
.markers-item {
|
|
254
|
+
.btn-marker {
|
|
255
|
+
border: none;
|
|
256
|
+
outline: none;
|
|
257
|
+
box-shadow: none;
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
transition: background-color v-bind(transitionSpeedStr) linear;
|
|
260
|
+
|
|
261
|
+
&.active {
|
|
262
|
+
background-color: red;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.buttons-container {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: end;
|
|
273
|
+
gap: 20px;
|
|
274
|
+
|
|
275
|
+
.btn-action {
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
278
|
+
justify-content: center;
|
|
279
|
+
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
height: fit-content;
|
|
282
|
+
|
|
283
|
+
.arrows-icon {
|
|
284
|
+
width: 24px;
|
|
285
|
+
height: 24px;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
</style>
|