@mozaic-ds/web-components 0.13.0 → 0.14.0-beta.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/package.json +1 -1
- package/public/adeo/bundle.js +5 -1
- package/public/adeo/components/button/Button.nested.js +2 -0
- package/public/adeo/components/button/Button.nested.js.map +1 -0
- package/public/adeo/components/button/Button.nested.svelte +173 -0
- package/public/adeo/components/carousel/Carousel.js +2 -0
- package/public/adeo/components/carousel/Carousel.js.map +1 -0
- package/public/adeo/components/carousel/Carousel.svelte +414 -0
- package/public/adeo/components/carousel/CarouselCard.nested.js +2 -0
- package/public/adeo/components/carousel/CarouselCard.nested.js.map +1 -0
- package/public/adeo/components/carousel/carousel.types.d.ts +19 -0
- package/public/adeo/components/carousel/carousel.types.d.ts.map +1 -0
- package/public/adeo/components/carouselcard/CarouselCard.nested.svelte +37 -0
- package/public/adeo/components/datatable/DataTable.js +1 -1
- package/public/adeo/components/datatable/DataTable.js.map +1 -1
- package/public/adeo/components/datatable/DataTable.svelte +5 -3
- package/public/adeo/components/datatable/DataTableDefaultSelection.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/adeo/components/datatable/datatable.types.d.ts +1 -0
- package/public/adeo/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/adeo/components/datatabledefaultselection/DataTableDefaultSelection.nested.svelte +0 -15
- package/public/adeo/components/header/Header.js.map +1 -1
- package/public/adeo/components/header/Header.svelte +1 -1
- package/public/adeo/components/header/_c.header.scss +310 -0
- package/public/adeo/components/header/_s.header.scss +28 -0
- package/public/adeo/components/layer/Layer.js +1 -1
- package/public/adeo/components/layer/Layer.js.map +1 -1
- package/public/adeo/components/layer/Layer.svelte +3 -0
- package/public/adeo/components/layer/layer.types.d.ts +2 -0
- package/public/adeo/components/layer/layer.types.d.ts.map +1 -0
- package/public/adeo/components/link/Link.nested.js +2 -0
- package/public/adeo/components/link/Link.nested.js.map +1 -0
- package/public/adeo/components/link/Link.nested.svelte +78 -0
- package/public/adeo/components/quantityselector/QuantitySelector.js +1 -1
- package/public/adeo/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/adeo/components/quantityselector/QuantitySelector.svelte +1 -1
- package/public/adeo/components/sidebar/sidebar-feature-group.nested.js +1 -1
- package/public/adeo/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/adeo/components/sidebar/sidebar-segment.nested.js +1 -1
- package/public/adeo/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/adeo/components/sidebar-feature-group/sidebar-feature-group.nested.svelte +6 -4
- package/public/adeo/components/sidebar-segment/sidebar-segment.nested.svelte +9 -8
- package/public/adeo/components/undefined/sidebar-variables.scss +9 -0
- package/public/adeo/main.d.ts +1 -0
- package/public/adeo/main.d.ts.map +1 -1
- package/public/adeo/stories/carousel/items.d.ts +3 -0
- package/public/adeo/stories/carousel/items.d.ts.map +1 -0
- package/public/bricoman/bundle.js +5 -1
- package/public/bricoman/components/button/Button.nested.js +2 -0
- package/public/bricoman/components/button/Button.nested.js.map +1 -0
- package/public/bricoman/components/button/Button.nested.svelte +173 -0
- package/public/bricoman/components/carousel/Carousel.js +2 -0
- package/public/bricoman/components/carousel/Carousel.js.map +1 -0
- package/public/bricoman/components/carousel/Carousel.svelte +414 -0
- package/public/bricoman/components/carousel/CarouselCard.nested.js +2 -0
- package/public/bricoman/components/carousel/CarouselCard.nested.js.map +1 -0
- package/public/bricoman/components/carousel/carousel.types.d.ts +19 -0
- package/public/bricoman/components/carousel/carousel.types.d.ts.map +1 -0
- package/public/bricoman/components/carouselcard/CarouselCard.nested.svelte +37 -0
- package/public/bricoman/components/datatable/DataTable.js +1 -1
- package/public/bricoman/components/datatable/DataTable.js.map +1 -1
- package/public/bricoman/components/datatable/DataTable.svelte +5 -3
- package/public/bricoman/components/datatable/DataTableDefaultSelection.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/bricoman/components/datatable/datatable.types.d.ts +1 -0
- package/public/bricoman/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/bricoman/components/datatabledefaultselection/DataTableDefaultSelection.nested.svelte +0 -15
- package/public/bricoman/components/header/Header.js.map +1 -1
- package/public/bricoman/components/header/Header.svelte +1 -1
- package/public/bricoman/components/header/_c.header.scss +310 -0
- package/public/bricoman/components/header/_s.header.scss +28 -0
- package/public/bricoman/components/layer/Layer.js +1 -1
- package/public/bricoman/components/layer/Layer.js.map +1 -1
- package/public/bricoman/components/layer/Layer.svelte +3 -0
- package/public/bricoman/components/layer/layer.types.d.ts +2 -0
- package/public/bricoman/components/layer/layer.types.d.ts.map +1 -0
- package/public/bricoman/components/link/Link.nested.js +2 -0
- package/public/bricoman/components/link/Link.nested.js.map +1 -0
- package/public/bricoman/components/link/Link.nested.svelte +78 -0
- package/public/bricoman/components/quantityselector/QuantitySelector.js +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.svelte +1 -1
- package/public/bricoman/components/sidebar/sidebar-feature-group.nested.js +1 -1
- package/public/bricoman/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/bricoman/components/sidebar/sidebar-segment.nested.js +1 -1
- package/public/bricoman/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/bricoman/components/sidebar-feature-group/sidebar-feature-group.nested.svelte +6 -4
- package/public/bricoman/components/sidebar-segment/sidebar-segment.nested.svelte +9 -8
- package/public/bricoman/components/undefined/sidebar-variables.scss +9 -0
- package/public/bricoman/main.d.ts +1 -0
- package/public/bricoman/main.d.ts.map +1 -1
- package/public/bricoman/stories/carousel/items.d.ts +3 -0
- package/public/bricoman/stories/carousel/items.d.ts.map +1 -0
- package/public/bundle.js +5 -1
- package/public/components/button/Button.nested.js +2 -0
- package/public/components/button/Button.nested.js.map +1 -0
- package/public/components/button/Button.nested.svelte +173 -0
- package/public/components/carousel/Carousel.js +2 -0
- package/public/components/carousel/Carousel.js.map +1 -0
- package/public/components/carousel/Carousel.svelte +414 -0
- package/public/components/carousel/CarouselCard.nested.js +2 -0
- package/public/components/carousel/CarouselCard.nested.js.map +1 -0
- package/public/components/carousel/carousel.types.d.ts +19 -0
- package/public/components/carousel/carousel.types.d.ts.map +1 -0
- package/public/components/carouselcard/CarouselCard.nested.svelte +37 -0
- package/public/components/datatable/DataTable.js +1 -1
- package/public/components/datatable/DataTable.js.map +1 -1
- package/public/components/datatable/DataTable.svelte +5 -3
- package/public/components/datatable/DataTableDefaultSelection.nested.js +1 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/components/datatable/datatable.types.d.ts +1 -0
- package/public/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/components/datatabledefaultselection/DataTableDefaultSelection.nested.svelte +0 -15
- package/public/components/header/Header.js.map +1 -1
- package/public/components/header/Header.svelte +1 -1
- package/public/components/header/_c.header.scss +310 -0
- package/public/components/header/_s.header.scss +28 -0
- package/public/components/layer/Layer.js +1 -1
- package/public/components/layer/Layer.js.map +1 -1
- package/public/components/layer/Layer.svelte +3 -0
- package/public/components/layer/layer.types.d.ts +2 -0
- package/public/components/layer/layer.types.d.ts.map +1 -0
- package/public/components/link/Link.nested.js +2 -0
- package/public/components/link/Link.nested.js.map +1 -0
- package/public/components/link/Link.nested.svelte +78 -0
- package/public/components/quantityselector/QuantitySelector.js +1 -1
- package/public/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.svelte +1 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js +1 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-segment.nested.js +1 -1
- package/public/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/components/sidebar-feature-group/sidebar-feature-group.nested.svelte +6 -4
- package/public/components/sidebar-segment/sidebar-segment.nested.svelte +9 -8
- package/public/components/undefined/sidebar-variables.scss +9 -0
- package/public/main.d.ts +1 -0
- package/public/main.d.ts.map +1 -1
- package/public/stories/carousel/items.d.ts +3 -0
- package/public/stories/carousel/items.d.ts.map +1 -0
- package/public/utilities/components/carousel/carousel.types.d.ts +19 -0
- package/public/utilities/components/carousel/carousel.types.d.ts.map +1 -0
- package/public/utilities/components/datatable/datatable.types.d.ts +1 -0
- package/public/utilities/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/utilities/components/layer/layer.types.d.ts +2 -0
- package/public/utilities/components/layer/layer.types.d.ts.map +1 -0
- package/public/utilities/main.d.ts +1 -0
- package/public/utilities/main.d.ts.map +1 -1
- package/public/utilities/stories/carousel/Carousel.stories.d.ts +8 -0
- package/public/utilities/stories/carousel/Carousel.stories.d.ts.map +1 -0
- package/public/utilities/stories/carousel/items.d.ts +3 -0
- package/public/utilities/stories/carousel/items.d.ts.map +1 -0
- package/public/utilities/stories/layer/Layer.stories.d.ts +1 -0
- package/public/utilities/stories/layer/Layer.stories.d.ts.map +1 -1
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import type {
|
|
5
|
+
CarouselDevice,
|
|
6
|
+
CarouselItem,
|
|
7
|
+
CarouselOptions,
|
|
8
|
+
CarouselTitleTag,
|
|
9
|
+
} from './carousel.types';
|
|
10
|
+
import Link from '../link/Link.nested.svelte';
|
|
11
|
+
import CarouselCard from './CarouselCard.nested.svelte';
|
|
12
|
+
import Button from '../button/Button.nested.svelte';
|
|
13
|
+
import { EventHandler } from '../../utilities/EventHandler';
|
|
14
|
+
import { onMount } from 'svelte';
|
|
15
|
+
|
|
16
|
+
export let title: string;
|
|
17
|
+
export let titletag: CarouselTitleTag = 'h1';
|
|
18
|
+
export let subtitlelink: string;
|
|
19
|
+
export let mobile = false;
|
|
20
|
+
export let options: string;
|
|
21
|
+
export let items: string;
|
|
22
|
+
|
|
23
|
+
const mediaQueryS: MediaQueryList = window.matchMedia('(max-width: 679px)');
|
|
24
|
+
const mediaQueryM: MediaQueryList = window.matchMedia(
|
|
25
|
+
'(min-width: 680px) and (max-width: 1279px)',
|
|
26
|
+
);
|
|
27
|
+
const mediaQueryXL: MediaQueryList = window.matchMedia('(min-width: 1280px)');
|
|
28
|
+
|
|
29
|
+
// default options for all 3 screen sizes (s = <m ; m = >=m to <xl ; xl = >=xl)
|
|
30
|
+
const defaultCarouselOptions: CarouselOptions = {
|
|
31
|
+
s: {
|
|
32
|
+
itemsVisible: 1,
|
|
33
|
+
hasHalfItemVisible: true,
|
|
34
|
+
},
|
|
35
|
+
m: {
|
|
36
|
+
itemsVisible: 3,
|
|
37
|
+
hasHalfItemVisible: false,
|
|
38
|
+
},
|
|
39
|
+
xl: {
|
|
40
|
+
itemsVisible: 5,
|
|
41
|
+
hasHalfItemVisible: false,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// size using to separate item. Useful for gap in css and for move the scroll.
|
|
46
|
+
let betweenItemsPixelSize = 16;
|
|
47
|
+
|
|
48
|
+
// needed padding to display the outlined focus border on carousel items
|
|
49
|
+
let accessibilityFocusPadding = 4;
|
|
50
|
+
|
|
51
|
+
let eventHandler = new EventHandler();
|
|
52
|
+
|
|
53
|
+
let currentDevice: CarouselDevice = initCurrentDevice(
|
|
54
|
+
mediaQueryM,
|
|
55
|
+
mediaQueryXL,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
let carouselContainer: HTMLDivElement;
|
|
59
|
+
let carouselScrollbarLeft = 0;
|
|
60
|
+
|
|
61
|
+
let isScrollBeginning = true;
|
|
62
|
+
let isScrollEnd = false;
|
|
63
|
+
|
|
64
|
+
$: carouselItems = items ? (JSON.parse(items) as CarouselItem[]) : [];
|
|
65
|
+
$: carouselOptions = options
|
|
66
|
+
? Object.assign(
|
|
67
|
+
{},
|
|
68
|
+
defaultCarouselOptions,
|
|
69
|
+
JSON.parse(options) as CarouselOptions,
|
|
70
|
+
)
|
|
71
|
+
: defaultCarouselOptions;
|
|
72
|
+
$: carouselItemsSize = carouselItems?.length;
|
|
73
|
+
|
|
74
|
+
$: carouselCurrentItemsVisible = carouselOptions[currentDevice].itemsVisible;
|
|
75
|
+
$: carouselCurrentHasHalfItemVisible =
|
|
76
|
+
carouselOptions[currentDevice].hasHalfItemVisible || false;
|
|
77
|
+
$: carouselCurrentItemsSize =
|
|
78
|
+
carouselItemsSize < carouselCurrentItemsVisible
|
|
79
|
+
? carouselCurrentItemsVisible
|
|
80
|
+
: carouselItemsSize;
|
|
81
|
+
|
|
82
|
+
$: carouselCurrentItemsVisibleAndHalf = carouselCurrentHasHalfItemVisible
|
|
83
|
+
? carouselCurrentItemsVisible + 0.5
|
|
84
|
+
: carouselCurrentItemsVisible;
|
|
85
|
+
|
|
86
|
+
$: carouselItemWidthSpace = getCarouselItemsWidthSpace(
|
|
87
|
+
carouselCurrentItemsVisible,
|
|
88
|
+
carouselCurrentHasHalfItemVisible,
|
|
89
|
+
);
|
|
90
|
+
$: carouselContainerWidthSpace = getCarouselContainerWidthSpace(
|
|
91
|
+
carouselCurrentItemsSize,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
/* returns the total size of the spacing between items for the big container */
|
|
95
|
+
function getCarouselContainerWidthSpace(totalItems: number) {
|
|
96
|
+
return (totalItems - 1) * betweenItemsPixelSize;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* returns the total size of the spacing between items for the screen size */
|
|
100
|
+
function getCarouselItemsWidthSpace(
|
|
101
|
+
itemsVisible: number,
|
|
102
|
+
itemsAndHalfVisible: boolean,
|
|
103
|
+
) {
|
|
104
|
+
if (itemsAndHalfVisible) {
|
|
105
|
+
return itemsVisible * betweenItemsPixelSize;
|
|
106
|
+
}
|
|
107
|
+
return (itemsVisible - 1) * betweenItemsPixelSize;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* move the scroll to change the displaying items.
|
|
111
|
+
1 to move right, -1 to move left
|
|
112
|
+
*/
|
|
113
|
+
function moveScroll(signe: 1 | -1) {
|
|
114
|
+
/* returns the size in pixel of an item according to screen size and the number of items visible. */
|
|
115
|
+
function getCarouselItemWidth() {
|
|
116
|
+
const carouselItemsWidthSpace = getCarouselItemsWidthSpace(
|
|
117
|
+
carouselCurrentItemsVisible,
|
|
118
|
+
carouselCurrentHasHalfItemVisible,
|
|
119
|
+
);
|
|
120
|
+
if (carouselCurrentHasHalfItemVisible) {
|
|
121
|
+
return (
|
|
122
|
+
(carouselContainer.clientWidth - carouselItemsWidthSpace) /
|
|
123
|
+
carouselCurrentItemsVisibleAndHalf
|
|
124
|
+
);
|
|
125
|
+
} else {
|
|
126
|
+
return (
|
|
127
|
+
(carouselContainer.clientWidth - carouselItemsWidthSpace) /
|
|
128
|
+
carouselCurrentItemsVisible
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* returns the new left position of the scrollbar
|
|
134
|
+
* in the case of visible half items, the calculation depends if the carousel is at the beginnind, at the end or in the middle.
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
function getLeft() {
|
|
138
|
+
if (!carouselCurrentHasHalfItemVisible) {
|
|
139
|
+
return (
|
|
140
|
+
carouselContainer.scrollLeft +
|
|
141
|
+
signe *
|
|
142
|
+
(carouselContainer.clientWidth +
|
|
143
|
+
betweenItemsPixelSize -
|
|
144
|
+
accessibilityFocusPadding * 2)
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
const itemWidth = getCarouselItemWidth();
|
|
148
|
+
if (isScrollBeginning) {
|
|
149
|
+
return (
|
|
150
|
+
carouselContainer.scrollLeft +
|
|
151
|
+
(signe *
|
|
152
|
+
(carouselContainer.clientWidth -
|
|
153
|
+
(3 / 4) * itemWidth -
|
|
154
|
+
betweenItemsPixelSize) +
|
|
155
|
+
accessibilityFocusPadding)
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
if (isScrollEnd) {
|
|
159
|
+
return (
|
|
160
|
+
carouselContainer.scrollLeft +
|
|
161
|
+
signe *
|
|
162
|
+
(carouselContainer.clientWidth -
|
|
163
|
+
(3 / 4) * itemWidth -
|
|
164
|
+
betweenItemsPixelSize)
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
return (
|
|
168
|
+
carouselContainer.scrollLeft +
|
|
169
|
+
signe *
|
|
170
|
+
(carouselContainer.clientWidth -
|
|
171
|
+
itemWidth / 2 -
|
|
172
|
+
betweenItemsPixelSize +
|
|
173
|
+
accessibilityFocusPadding * 2)
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
carouselContainer.scrollTo({ behavior: 'smooth', left: getLeft() });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function nextCards() {
|
|
181
|
+
moveScroll(1);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function previousCards() {
|
|
185
|
+
moveScroll(-1);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function handleScrollCarousel() {
|
|
189
|
+
isScrollBeginning = carouselContainer?.scrollLeft <= 0;
|
|
190
|
+
isScrollEnd =
|
|
191
|
+
carouselContainer?.scrollWidth - carouselContainer?.scrollLeft <=
|
|
192
|
+
carouselContainer.offsetWidth;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function handleClickCard(item: CarouselItem, event: MouseEvent): MouseEvent {
|
|
196
|
+
eventHandler.dispatch('carousel-item-clicked', item);
|
|
197
|
+
return event;
|
|
198
|
+
}
|
|
199
|
+
function handleClickLink(event: MouseEvent): MouseEvent {
|
|
200
|
+
eventHandler.dispatch('carousel-link-clicked', {});
|
|
201
|
+
return event;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// returns device according to screen size
|
|
205
|
+
function initCurrentDevice(
|
|
206
|
+
mediaQueryM: MediaQueryList,
|
|
207
|
+
mediaQueryXL: MediaQueryList,
|
|
208
|
+
) {
|
|
209
|
+
if (mediaQueryXL.matches) {
|
|
210
|
+
return 'xl';
|
|
211
|
+
}
|
|
212
|
+
if (mediaQueryM.matches) {
|
|
213
|
+
return 'm';
|
|
214
|
+
}
|
|
215
|
+
return 's';
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function handleMediaQueryChange(
|
|
219
|
+
event: MediaQueryListEvent,
|
|
220
|
+
matchingDevice: CarouselDevice,
|
|
221
|
+
): MediaQueryListEvent {
|
|
222
|
+
if (event.matches) {
|
|
223
|
+
currentDevice = matchingDevice;
|
|
224
|
+
}
|
|
225
|
+
return event;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
onMount(() => {
|
|
229
|
+
mediaQueryS.onchange = (e) => {
|
|
230
|
+
handleMediaQueryChange(e, 's');
|
|
231
|
+
};
|
|
232
|
+
mediaQueryM.onchange = (e) => {
|
|
233
|
+
handleMediaQueryChange(e, 'm');
|
|
234
|
+
};
|
|
235
|
+
mediaQueryXL.onchange = (e) => {
|
|
236
|
+
handleMediaQueryChange(e, 'xl');
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
</script>
|
|
240
|
+
|
|
241
|
+
<div class="mc-carousel">
|
|
242
|
+
<div class="mc-carousel__header">
|
|
243
|
+
<div class="mc-carousel__titles">
|
|
244
|
+
{@html `<${titletag} style="margin:0">${title}</${titletag}>`}
|
|
245
|
+
<div class="mc-carousel__subtitle">
|
|
246
|
+
<Link
|
|
247
|
+
href="#layer"
|
|
248
|
+
iconname="navigation-arrow-arrow--right-24px"
|
|
249
|
+
iconposition="right"
|
|
250
|
+
label={subtitlelink}
|
|
251
|
+
on:click={handleClickLink}
|
|
252
|
+
size="s"
|
|
253
|
+
target="_self"
|
|
254
|
+
/>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
<nav
|
|
258
|
+
aria-label="pagination"
|
|
259
|
+
class="mc-carousel__nav {mobile
|
|
260
|
+
? 'mc-carousel__nav--mobile'
|
|
261
|
+
: 'mc-carousel__nav--desktop'}"
|
|
262
|
+
>
|
|
263
|
+
<Button
|
|
264
|
+
theme="neutral"
|
|
265
|
+
size="s"
|
|
266
|
+
bordered={true}
|
|
267
|
+
iconmode="only"
|
|
268
|
+
iconname="navigation-arrow-arrow--left-32px"
|
|
269
|
+
aria-label="Previous page"
|
|
270
|
+
disabled={isScrollBeginning}
|
|
271
|
+
on:click={previousCards}
|
|
272
|
+
label="Previous"
|
|
273
|
+
loader=""
|
|
274
|
+
/>
|
|
275
|
+
<Button
|
|
276
|
+
theme="neutral"
|
|
277
|
+
size="s"
|
|
278
|
+
type="button"
|
|
279
|
+
bordered={true}
|
|
280
|
+
disabled={isScrollEnd}
|
|
281
|
+
iconmode="only"
|
|
282
|
+
iconname="navigation-arrow-arrow--right-32px"
|
|
283
|
+
aria-label="Next Page"
|
|
284
|
+
on:click={nextCards}
|
|
285
|
+
label="Next"
|
|
286
|
+
loader=""
|
|
287
|
+
/>
|
|
288
|
+
</nav>
|
|
289
|
+
</div>
|
|
290
|
+
<div
|
|
291
|
+
class="mc-carousel__body"
|
|
292
|
+
bind:this={carouselContainer}
|
|
293
|
+
on:scroll={handleScrollCarousel}
|
|
294
|
+
style="--carousel__accessibility-focus-padding: {accessibilityFocusPadding}px;"
|
|
295
|
+
>
|
|
296
|
+
<div
|
|
297
|
+
class="mc-carousel__content"
|
|
298
|
+
style="
|
|
299
|
+
--carousel__container-width-space: {carouselContainerWidthSpace}px;
|
|
300
|
+
--carousel__items-count: {carouselCurrentItemsSize};
|
|
301
|
+
--carousel__item-width-space: {carouselItemWidthSpace}px;
|
|
302
|
+
--carousel__items-visible: {carouselCurrentItemsVisibleAndHalf};
|
|
303
|
+
--carousel__scrollbar-left: {carouselScrollbarLeft};
|
|
304
|
+
--carousel__container-separate-item-size: {betweenItemsPixelSize}px;"
|
|
305
|
+
>
|
|
306
|
+
{#each carouselItems as item}
|
|
307
|
+
<button
|
|
308
|
+
class="mc-carousel__item"
|
|
309
|
+
on:click={(event) => handleClickCard(item, event)}
|
|
310
|
+
>
|
|
311
|
+
<CarouselCard
|
|
312
|
+
title={item.title}
|
|
313
|
+
imgSrc={item.imgSrc}
|
|
314
|
+
imgAlt={item.imgAlt}
|
|
315
|
+
/>
|
|
316
|
+
</button>
|
|
317
|
+
{/each}
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<style lang="scss">
|
|
323
|
+
@import '@mozaic-ds/styles/settings-tools/_all-settings';
|
|
324
|
+
@import '@mozaic-ds/styles/components/c.button';
|
|
325
|
+
@import '@mozaic-ds/styles/components/c.links';
|
|
326
|
+
@import '@mozaic-ds/styles/components/c.pagination';
|
|
327
|
+
|
|
328
|
+
.mc-carousel {
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
gap: $mu100;
|
|
332
|
+
|
|
333
|
+
&__header {
|
|
334
|
+
/* Auto layout */
|
|
335
|
+
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: flex-end;
|
|
338
|
+
justify-content: space-between;
|
|
339
|
+
}
|
|
340
|
+
&__titles {
|
|
341
|
+
display: flex;
|
|
342
|
+
flex-direction: column;
|
|
343
|
+
gap: $mu025;
|
|
344
|
+
}
|
|
345
|
+
&__nav {
|
|
346
|
+
gap: $mu050;
|
|
347
|
+
&--mobile {
|
|
348
|
+
display: none;
|
|
349
|
+
}
|
|
350
|
+
&--desktop {
|
|
351
|
+
display: flex;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
&__body {
|
|
356
|
+
position: relative;
|
|
357
|
+
overflow-x: auto;
|
|
358
|
+
overflow-y: hidden;
|
|
359
|
+
padding: var(--carousel__accessibility-focus-padding);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
&__content {
|
|
363
|
+
display: flex;
|
|
364
|
+
flex-wrap: nowrap;
|
|
365
|
+
column-gap: var(--carousel__container-separate-item-size);
|
|
366
|
+
// the total size of the big container for all items: taille d'un item * le nbre d'items + espace entre chaque item
|
|
367
|
+
width: calc(
|
|
368
|
+
(
|
|
369
|
+
(100% - var(--carousel__item-width-space)) /
|
|
370
|
+
var(--carousel__items-visible)
|
|
371
|
+
) * var(--carousel__items-count) +
|
|
372
|
+
var(--carousel__container-width-space)
|
|
373
|
+
);
|
|
374
|
+
margin-bottom: $mu125;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
&__item {
|
|
378
|
+
display: flex;
|
|
379
|
+
background: none;
|
|
380
|
+
border: none;
|
|
381
|
+
margin: 0;
|
|
382
|
+
padding: 0;
|
|
383
|
+
cursor: pointer;
|
|
384
|
+
// taille d'un item: (100% - les espaces entre chaque item isible) / le nombre d'items visible
|
|
385
|
+
width: calc(
|
|
386
|
+
(100% - var(--carousel__item-width-space)) /
|
|
387
|
+
var(--carousel__items-visible)
|
|
388
|
+
);
|
|
389
|
+
@include set-focus-floating-base();
|
|
390
|
+
|
|
391
|
+
&:focus {
|
|
392
|
+
@include set-focus-floating();
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
&-footer {
|
|
397
|
+
display: flex;
|
|
398
|
+
flex-direction: column;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
::-webkit-scrollbar {
|
|
403
|
+
border-radius: $mu025;
|
|
404
|
+
height: 6px;
|
|
405
|
+
background: $color-grey-100;
|
|
406
|
+
border-top: 1px solid white;
|
|
407
|
+
border-bottom: 1px solid white;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
::-webkit-scrollbar-thumb {
|
|
411
|
+
background: $color-grey-800;
|
|
412
|
+
border-radius: 6px;
|
|
413
|
+
}
|
|
414
|
+
</style>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{E as e,i as o,s as t,F as s,c as l,e as i,d as a,t as r,g as k,$ as c,h as d,v as m,b as g,j as n,k as v,m as q,n as f,o as b,p as x,q as p}from"../../index-52f16292.js";function u(e){s(e,"svelte-1gooqkk",'.mc-card.svelte-1gooqkk.svelte-1gooqkk{font-family:"LeroyMerlin", sans-serif;max-width:17.75rem}.mc-card.svelte-1gooqkk.svelte-1gooqkk,.mc-card.svelte-1gooqkk .svelte-1gooqkk{-webkit-box-sizing:border-box;box-sizing:border-box}@media screen and (min-width: 680px){.mc-card.svelte-1gooqkk.svelte-1gooqkk{max-width:18.25rem}}@media screen and (min-width: 1024px){.mc-card.svelte-1gooqkk.svelte-1gooqkk{max-width:18rem}}@media screen and (min-width: 1280px){.mc-card.svelte-1gooqkk.svelte-1gooqkk{max-width:17.5rem}}@media screen and (min-width: 1920px){.mc-card.svelte-1gooqkk.svelte-1gooqkk{max-width:27.25rem}}.mc-card__visual.svelte-1gooqkk.svelte-1gooqkk{margin:0;overflow:hidden;position:relative}.mc-card__visual.svelte-1gooqkk.svelte-1gooqkk::before{content:"";display:block;width:100%;padding-top:75%}.mc-card__visual--1x1.svelte-1gooqkk.svelte-1gooqkk::before{padding-top:100%}.mc-card__visual--16x9.svelte-1gooqkk.svelte-1gooqkk::before{padding-top:56.25%}.mc-card__img.svelte-1gooqkk.svelte-1gooqkk{height:auto;left:0;position:absolute;top:50%;width:100%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.mc-card__content.svelte-1gooqkk.svelte-1gooqkk{padding-top:1rem}.mc-card__title.svelte-1gooqkk.svelte-1gooqkk,.mc-card__subtitle.svelte-1gooqkk.svelte-1gooqkk{margin-top:0;margin-bottom:0.5rem}.mc-card__title.svelte-1gooqkk.svelte-1gooqkk{font-size:1.125rem;line-height:1.3333333333;font-weight:600;color:#000000}.mc-card__subtitle.svelte-1gooqkk.svelte-1gooqkk{font-size:0.875rem;line-height:1.2857142857;font-weight:400;color:#333333}.mc-card__body.svelte-1gooqkk.svelte-1gooqkk{font-size:1rem;line-height:1.375;color:#191919}.mc-card__body.svelte-1gooqkk.svelte-1gooqkk:not(:last-child){margin-bottom:1rem}.mc-card--bordered.svelte-1gooqkk.svelte-1gooqkk{background:#ffffff;border:2px solid #808080;border-radius:0.25rem;overflow:hidden}.mc-card--fluid.svelte-1gooqkk.svelte-1gooqkk{max-width:none}.mc-carousel-card.svelte-1gooqkk.svelte-1gooqkk{font-family:"LeroyMerlin", sans-serif;font-weight:400;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;padding:0.5rem;gap:0.25rem;border:1px solid #666666;border-radius:0.25rem}.mc-carousel-card.svelte-1gooqkk .mc-carousel-card__image.svelte-1gooqkk{width:100%}')}function h(e){let o,t,s,x,p,u,h,_=[e[3],{class:"mc-carousel-card"}],w={};for(let e=0;e<_.length;e+=1)w=l(w,_[e]);return{c(){o=i("div"),t=i("picture"),s=i("img"),p=a(),u=i("div"),h=r(e[0]),k(s,"class","mc-carousel-card__image svelte-1gooqkk"),c(s.src,x=e[1])||k(s,"src",x),k(s,"alt",e[2]),k(t,"class","svelte-1gooqkk"),k(u,"class","mc-carousel-card__title svelte-1gooqkk"),d(o,w),m(o,"svelte-1gooqkk",!0)},m(e,l){g(e,o,l),n(o,t),n(t,s),n(o,p),n(o,u),n(u,h)},p(e,[t]){2&t&&!c(s.src,x=e[1])&&k(s,"src",x),4&t&&k(s,"alt",e[2]),1&t&&v(h,e[0]),d(o,w=q(_,[8&t&&e[3],{class:"mc-carousel-card"}])),m(o,"svelte-1gooqkk",!0)},i:f,o:f,d(e){e&&b(o)}}}function _(e,o,t){let s;const i=["title","imgSrc","imgAlt"];let a=x(o,i),{title:r}=o,{imgSrc:k}=o,{imgAlt:c}=o;return e.$$set=e=>{o=l(l({},o),p(e)),t(4,a=x(o,i)),"title"in e&&t(0,r=e.title),"imgSrc"in e&&t(1,k=e.imgSrc),"imgAlt"in e&&t(2,c=e.imgAlt)},e.$$.update=()=>{t(3,s=Object.assign({},a))},[r,k,c,s]}class w extends e{constructor(e){super(),o(this,e,_,h,t,{title:0,imgSrc:1,imgAlt:2},u)}}export{w as default};
|
|
2
|
+
//# sourceMappingURL=CarouselCard.nested.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselCard.nested.js","sources":["../../../../src/components/carousel/CarouselCard.nested.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n export let title: string;\n export let imgSrc: string;\n export let imgAlt: string;\n $: attributes = { ...$$restProps };\n</script>\n\n<div {...attributes} class=\"mc-carousel-card\">\n <picture>\n <img class=\"mc-carousel-card__image\" src={imgSrc} alt={imgAlt} />\n </picture>\n <div class=\"mc-carousel-card__title\">{title}</div>\n</div>\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/_all-settings';\n @import '@mozaic-ds/styles/components/c.card';\n\n .mc-carousel-card {\n $parent: get-parent-selector(&);\n @include set-font-face();\n\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n padding: $mu050;\n gap: $mu025;\n border: 1px solid $color-grey-600;\n border-radius: $mu025;\n\n #{$parent}__image {\n width: 100%;\n }\n }\n</style>\n"],"names":["ctx","class","attr","img","img_src_value","insert","target","div1","anchor","append","picture","div0","title","$$props","imgSrc","imgAlt","attributes","Object","assign","$$restProps"],"mappings":"woFASSA,EAAU,GAAA,CAAAC,MAAA,uIAIqBD,EAAK,oEAFCA,EAAM,KAAAE,EAAAC,EAAA,MAAAC,aAAOJ,EAAM,gIAFjEK,EAKKC,EAAAC,EAAAC,GAJHC,EAESF,EAAAG,GADPD,EAAgEC,EAAAP,UAElEM,EAAiDF,EAAAI,oCAFLX,EAAM,iCAAOA,EAAM,aAEzBA,EAAK,oBAJpCA,EAAU,kKANNY,GAAaC,UACbC,GAAcD,UACdE,GAAcF,mKACtBG,EAALC,OAAAC,UAAuBC,GAAW"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CarouselTitleTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
2
|
+
export type CarouselDevice = 's' | 'm' | 'xl';
|
|
3
|
+
export type CarouselOptions = {
|
|
4
|
+
s: ItemOptions;
|
|
5
|
+
m: ItemOptions;
|
|
6
|
+
xl: ItemOptions;
|
|
7
|
+
};
|
|
8
|
+
type ItemOptions = {
|
|
9
|
+
itemsVisible: number;
|
|
10
|
+
hasHalfItemVisible?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type CarouselItem = {
|
|
13
|
+
id?: string;
|
|
14
|
+
title: string;
|
|
15
|
+
imgSrc: string;
|
|
16
|
+
imgAlt: string;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=carousel.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.types.d.ts","sourceRoot":"","sources":["../../../../src/components/carousel/carousel.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACvE,MAAM,MAAM,cAAc,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC1B,CAAC,EAAE,WAAW,CAAC;IACf,CAAC,EAAE,WAAW,CAAC;IACf,EAAE,EAAE,WAAW,CAAC;CACnB,CAAA;AAED,KAAK,WAAW,GAAG;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
export let title: string;
|
|
5
|
+
export let imgSrc: string;
|
|
6
|
+
export let imgAlt: string;
|
|
7
|
+
$: attributes = { ...$$restProps };
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div {...attributes} class="mc-carousel-card">
|
|
11
|
+
<picture>
|
|
12
|
+
<img class="mc-carousel-card__image" src={imgSrc} alt={imgAlt} />
|
|
13
|
+
</picture>
|
|
14
|
+
<div class="mc-carousel-card__title">{title}</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style lang="scss">
|
|
18
|
+
@import '@mozaic-ds/styles/settings-tools/_all-settings';
|
|
19
|
+
@import '@mozaic-ds/styles/components/c.card';
|
|
20
|
+
|
|
21
|
+
.mc-carousel-card {
|
|
22
|
+
$parent: get-parent-selector(&);
|
|
23
|
+
@include set-font-face();
|
|
24
|
+
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
padding: $mu050;
|
|
29
|
+
gap: $mu025;
|
|
30
|
+
border: 1px solid $color-grey-600;
|
|
31
|
+
border-radius: $mu025;
|
|
32
|
+
|
|
33
|
+
#{$parent}__image {
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</style>
|