@universityofmaryland/web-elements-library 1.6.17 → 1.7.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/README.md +1 -1
- package/dist/atomic/animations/brand/card-stack.js +2 -3
- package/dist/atomic/animations/brand/card-stack.js.map +1 -1
- package/dist/atomic/animations/brand/chevron-flow.d.ts +1 -7
- package/dist/atomic/animations/brand/chevron-flow.d.ts.map +1 -1
- package/dist/atomic/animations/brand/chevron-flow.js +82 -159
- package/dist/atomic/animations/brand/chevron-flow.js.map +1 -1
- package/dist/atomic/animations/brand/chevron-scroll.d.ts +1 -4
- package/dist/atomic/animations/brand/chevron-scroll.d.ts.map +1 -1
- package/dist/atomic/animations/brand/chevron-scroll.js +89 -143
- package/dist/atomic/animations/brand/chevron-scroll.js.map +1 -1
- package/dist/atomic/assets/image/caption.d.ts +9 -0
- package/dist/atomic/assets/image/caption.d.ts.map +1 -0
- package/dist/atomic/assets/image/caption.js +166 -0
- package/dist/atomic/assets/image/caption.js.map +1 -0
- package/dist/atomic/assets/image/gif.d.ts.map +1 -1
- package/dist/atomic/assets/image/gif.js +6 -1
- package/dist/atomic/assets/image/gif.js.map +1 -1
- package/dist/atomic/assets/image/index.d.ts +1 -0
- package/dist/atomic/assets/image/index.d.ts.map +1 -1
- package/dist/atomic/assets/image/index.js +2 -0
- package/dist/atomic/assets/image/index.js.map +1 -1
- package/dist/atomic/assets/video/toggle.d.ts.map +1 -1
- package/dist/atomic/assets/video/toggle.js +9 -2
- package/dist/atomic/assets/video/toggle.js.map +1 -1
- package/dist/atomic/buttons/fullscreen.d.ts +1 -0
- package/dist/atomic/buttons/fullscreen.d.ts.map +1 -1
- package/dist/atomic/buttons/fullscreen.js +35 -3
- package/dist/atomic/buttons/fullscreen.js.map +1 -1
- package/dist/atomic/layout/overlay/modal.d.ts +1 -10
- package/dist/atomic/layout/overlay/modal.d.ts.map +1 -1
- package/dist/atomic/layout/overlay/modal.js +28 -44
- package/dist/atomic/layout/overlay/modal.js.map +1 -1
- package/dist/atomic/layout/person/columns.js +2 -3
- package/dist/atomic/layout/person/columns.js.map +1 -1
- package/dist/atomic/text-lockup/date.d.ts +1 -4
- package/dist/atomic/text-lockup/date.d.ts.map +1 -1
- package/dist/atomic/text-lockup/date.js +42 -75
- package/dist/atomic/text-lockup/date.js.map +1 -1
- package/dist/composite/accordion/item.d.ts +3 -16
- package/dist/composite/accordion/item.d.ts.map +1 -1
- package/dist/composite/accordion/item.js +152 -245
- package/dist/composite/accordion/item.js.map +1 -1
- package/dist/composite/card/block.js +2 -3
- package/dist/composite/card/block.js.map +1 -1
- package/dist/composite/card/event-time.js +2 -3
- package/dist/composite/card/event-time.js.map +1 -1
- package/dist/composite/card/list.js +2 -3
- package/dist/composite/card/list.js.map +1 -1
- package/dist/composite/card/overlay/color.js +3 -3
- package/dist/composite/card/overlay/icon.js +3 -3
- package/dist/composite/card/overlay/image.d.ts.map +1 -1
- package/dist/composite/card/overlay/image.js +9 -12
- package/dist/composite/card/overlay/image.js.map +1 -1
- package/dist/composite/card/video/block.js +4 -3
- package/dist/composite/card/video/block.js.map +1 -1
- package/dist/composite/carousel/cards/index.d.ts +1 -8
- package/dist/composite/carousel/cards/index.d.ts.map +1 -1
- package/dist/composite/carousel/cards/index.js +163 -282
- package/dist/composite/carousel/cards/index.js.map +1 -1
- package/dist/composite/carousel/default/index.d.ts +9 -15
- package/dist/composite/carousel/default/index.d.ts.map +1 -1
- package/dist/composite/carousel/default/index.js +78 -129
- package/dist/composite/carousel/default/index.js.map +1 -1
- package/dist/composite/carousel/elements/equal-width-items.d.ts +37 -0
- package/dist/composite/carousel/elements/equal-width-items.d.ts.map +1 -0
- package/dist/composite/carousel/elements/{blocks.js → equal-width-items.js} +157 -227
- package/dist/composite/carousel/elements/equal-width-items.js.map +1 -0
- package/dist/composite/carousel/elements/full-screen.d.ts +3 -2
- package/dist/composite/carousel/elements/full-screen.d.ts.map +1 -1
- package/dist/composite/carousel/elements/full-screen.js +34 -41
- package/dist/composite/carousel/elements/full-screen.js.map +1 -1
- package/dist/composite/carousel/elements/image.d.ts +15 -2
- package/dist/composite/carousel/elements/image.d.ts.map +1 -1
- package/dist/composite/carousel/elements/image.js +176 -151
- package/dist/composite/carousel/elements/image.js.map +1 -1
- package/dist/composite/carousel/elements/index.d.ts +4 -1
- package/dist/composite/carousel/elements/index.d.ts.map +1 -1
- package/dist/composite/carousel/elements/indicator-wrapper.d.ts +13 -0
- package/dist/composite/carousel/elements/indicator-wrapper.d.ts.map +1 -0
- package/dist/composite/carousel/elements/indicator-wrapper.js +67 -0
- package/dist/composite/carousel/elements/indicator-wrapper.js.map +1 -0
- package/dist/composite/carousel/elements/nav-button.d.ts +82 -0
- package/dist/composite/carousel/elements/nav-button.d.ts.map +1 -0
- package/dist/composite/carousel/elements/nav-button.js +164 -0
- package/dist/composite/carousel/elements/nav-button.js.map +1 -0
- package/dist/composite/carousel/elements/overlay.d.ts +3 -2
- package/dist/composite/carousel/elements/overlay.d.ts.map +1 -1
- package/dist/composite/carousel/elements/overlay.js +85 -55
- package/dist/composite/carousel/elements/overlay.js.map +1 -1
- package/dist/composite/carousel/image/multiple.d.ts +2 -7
- package/dist/composite/carousel/image/multiple.d.ts.map +1 -1
- package/dist/composite/carousel/image/multiple.js +85 -150
- package/dist/composite/carousel/image/multiple.js.map +1 -1
- package/dist/composite/carousel/image/standard.d.ts +2 -7
- package/dist/composite/carousel/image/standard.d.ts.map +1 -1
- package/dist/composite/carousel/image/standard.js +148 -262
- package/dist/composite/carousel/image/standard.js.map +1 -1
- package/dist/composite/carousel/thumbnail/index.d.ts +1 -8
- package/dist/composite/carousel/thumbnail/index.d.ts.map +1 -1
- package/dist/composite/carousel/thumbnail/index.js +72 -113
- package/dist/composite/carousel/thumbnail/index.js.map +1 -1
- package/dist/composite/carousel/wide/container.d.ts +21 -20
- package/dist/composite/carousel/wide/container.d.ts.map +1 -1
- package/dist/composite/carousel/wide/container.js +37 -12
- package/dist/composite/carousel/wide/container.js.map +1 -1
- package/dist/composite/carousel/wide/controls.d.ts +5 -10
- package/dist/composite/carousel/wide/controls.d.ts.map +1 -1
- package/dist/composite/carousel/wide/controls.js +24 -94
- package/dist/composite/carousel/wide/controls.js.map +1 -1
- package/dist/composite/carousel/wide/frames.d.ts +18 -10
- package/dist/composite/carousel/wide/frames.d.ts.map +1 -1
- package/dist/composite/carousel/wide/frames.js +60 -78
- package/dist/composite/carousel/wide/frames.js.map +1 -1
- package/dist/composite/carousel/wide/index.d.ts.map +1 -1
- package/dist/composite/carousel/wide/index.js +11 -19
- package/dist/composite/carousel/wide/index.js.map +1 -1
- package/dist/composite/hero/custom/expand.js +3 -4
- package/dist/composite/hero/custom/expand.js.map +1 -1
- package/dist/composite/hero/custom/grid.js +2 -3
- package/dist/composite/hero/custom/grid.js.map +1 -1
- package/dist/composite/hero/custom/video-arrow.js +4 -3
- package/dist/composite/hero/custom/video-arrow.js.map +1 -1
- package/dist/composite/hero/logo.js +3 -3
- package/dist/composite/hero/minimal.js +3 -3
- package/dist/composite/hero/overlay.js +5 -4
- package/dist/composite/hero/overlay.js.map +1 -1
- package/dist/composite/hero/stacked.js +3 -3
- package/dist/composite/hero/standard.js +4 -3
- package/dist/composite/hero/standard.js.map +1 -1
- package/dist/composite/layout/box/logo.d.ts +1 -4
- package/dist/composite/layout/box/logo.d.ts.map +1 -1
- package/dist/composite/layout/box/logo.js +55 -103
- package/dist/composite/layout/box/logo.js.map +1 -1
- package/dist/composite/layout/image/expand.d.ts +1 -4
- package/dist/composite/layout/image/expand.d.ts.map +1 -1
- package/dist/composite/layout/image/expand.js +136 -243
- package/dist/composite/layout/image/expand.js.map +1 -1
- package/dist/composite/layout/scroll-top/index.d.ts +1 -7
- package/dist/composite/layout/scroll-top/index.d.ts.map +1 -1
- package/dist/composite/layout/scroll-top/index.js +65 -77
- package/dist/composite/layout/scroll-top/index.js.map +1 -1
- package/dist/composite/layout/sticky-columns/index.d.ts +2 -2
- package/dist/composite/layout/sticky-columns/index.d.ts.map +1 -1
- package/dist/composite/layout/sticky-columns/index.js +42 -70
- package/dist/composite/layout/sticky-columns/index.js.map +1 -1
- package/dist/composite/media/elements/gif.js +3 -3
- package/dist/composite/media/inline/caption.d.ts +4 -2
- package/dist/composite/media/inline/caption.d.ts.map +1 -1
- package/dist/composite/media/inline/caption.js +56 -67
- package/dist/composite/media/inline/caption.js.map +1 -1
- package/dist/composite/media/inline/index.d.ts +9 -8
- package/dist/composite/media/inline/index.d.ts.map +1 -1
- package/dist/composite/media/inline/standard.d.ts +1 -4
- package/dist/composite/media/inline/standard.d.ts.map +1 -1
- package/dist/composite/media/inline/standard.js +16 -24
- package/dist/composite/media/inline/standard.js.map +1 -1
- package/dist/composite/media/inline/wrapped.d.ts +4 -2
- package/dist/composite/media/inline/wrapped.d.ts.map +1 -1
- package/dist/composite/media/inline/wrapped.js +80 -83
- package/dist/composite/media/inline/wrapped.js.map +1 -1
- package/dist/composite/navigation/utility/alert.js +3 -4
- package/dist/composite/navigation/utility/alert.js.map +1 -1
- package/dist/composite/pathway/_common.js +4 -3
- package/dist/composite/pathway/_common.js.map +1 -1
- package/dist/composite/pathway/hero.js +3 -3
- package/dist/composite/person/bio/full.js +3 -3
- package/dist/composite/person/bio/small.js +2 -3
- package/dist/composite/person/bio/small.js.map +1 -1
- package/dist/composite/person/block.js +2 -3
- package/dist/composite/person/block.js.map +1 -1
- package/dist/composite/person/hero.js +3 -3
- package/dist/composite/person/list.js +2 -3
- package/dist/composite/person/list.js.map +1 -1
- package/dist/composite/person/tabular.js +2 -3
- package/dist/composite/person/tabular.js.map +1 -1
- package/dist/composite/slider/events.d.ts +6 -12
- package/dist/composite/slider/events.d.ts.map +1 -1
- package/dist/composite/slider/events.js +304 -428
- package/dist/composite/slider/events.js.map +1 -1
- package/dist/layout/image.d.ts +5 -10
- package/dist/layout/image.d.ts.map +1 -1
- package/dist/layout/image.js +27 -88
- package/dist/layout/image.js.map +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout.js +2 -2
- package/package.json +6 -6
- package/dist/composite/carousel/elements/blocks.d.ts +0 -42
- package/dist/composite/carousel/elements/blocks.d.ts.map +0 -1
- package/dist/composite/carousel/elements/blocks.js.map +0 -1
- package/dist/composite/carousel/wide/_elementModel.d.ts +0 -18
- package/dist/composite/carousel/wide/_elementModel.d.ts.map +0 -1
- package/dist/composite/carousel/wide/_elementModel.js +0 -29
- package/dist/composite/carousel/wide/_elementModel.js.map +0 -1
|
@@ -1,355 +1,14 @@
|
|
|
1
1
|
import * as token from "@universityofmaryland/web-token-library";
|
|
2
2
|
import * as typography from "@universityofmaryland/web-styles-library/typography";
|
|
3
|
-
import {
|
|
3
|
+
import { ElementBuilder } from "@universityofmaryland/web-builder-library";
|
|
4
4
|
import { setupSwipeDetection } from "@universityofmaryland/web-utilities-library/events";
|
|
5
5
|
import { debounce } from "@universityofmaryland/web-utilities-library/performance";
|
|
6
|
+
import { parsePixelValue } from "@universityofmaryland/web-utilities-library/styles";
|
|
6
7
|
import { arrow_left, arrow_right } from "@universityofmaryland/web-icons-library/arrows";
|
|
7
8
|
const TABLET = 750;
|
|
8
9
|
const DESKTOP = 1e3;
|
|
9
10
|
const LARGE = 1300;
|
|
10
11
|
const ANIMATION_DURATION = 500;
|
|
11
|
-
const ATTRIBUTE_THEME = "theme";
|
|
12
|
-
const THEME_DARK = "dark";
|
|
13
|
-
const IS_THEME_DARK = `[${ATTRIBUTE_THEME}="${THEME_DARK}"]`;
|
|
14
|
-
const ELEMENT_NAME = "umd-element-slider-events";
|
|
15
|
-
const ELEMENT_SLIDER_EVENT_DECLRATION = "slider-events-declaration";
|
|
16
|
-
const ELEMENT_SLIDER_EVENT_CONTAINER = "slider-events-container";
|
|
17
|
-
const ELEMENT_SLIDER_EVENT_CONTAINER_WRAPPER = "slider-event-container-wrapper";
|
|
18
|
-
const ELEMENT_SLIDER_EVENT_COVER = "slider-event-cover";
|
|
19
|
-
const ELEMENT_SLIDER_EVENT_INTRO = "slider-event-intro-container";
|
|
20
|
-
const ELEMENT_SLIDER_EVENT_INTRO_HEADLINE = "slider-event-intro-headline";
|
|
21
|
-
const ELEMENT_SLIDER_EVENT_INTRO_ACTIONS = "slider-event-intro-actions";
|
|
22
|
-
const ELEMENT_SLIDER_EVENT_SLIDE_CONTAINTER = "slider-event-slide-container";
|
|
23
|
-
const ELEMENT_SLIDER_EVENT_SLIDE_WRAPPER = "slider-event-slide-wrapper";
|
|
24
|
-
const ELEMENT_SLIDER_EVENT_SLIDE_SCROLLER = "slider-event-slide-scroller";
|
|
25
|
-
const ELEMENT_SLIDER_EVENT_SLIDE_BUTTON = "slider-event-slide-button";
|
|
26
|
-
const ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_FORWARD = "slider-event-button-forward";
|
|
27
|
-
const ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_BACK = "slider-event-button-back";
|
|
28
|
-
const OVERWRITE_THEME_DARK_CONTAINER = `.${ELEMENT_SLIDER_EVENT_CONTAINER}${IS_THEME_DARK}`;
|
|
29
|
-
const OVERWRITE_THEME_DARK_CONTAINER_WRAPPER = `.${ELEMENT_SLIDER_EVENT_CONTAINER}${IS_THEME_DARK} .${ELEMENT_SLIDER_EVENT_CONTAINER_WRAPPER}`;
|
|
30
|
-
const OVERWRITE_THEME_DARK_INTRO_COVER = `.${ELEMENT_SLIDER_EVENT_CONTAINER}${IS_THEME_DARK} .${ELEMENT_SLIDER_EVENT_COVER}`;
|
|
31
|
-
const OVERWRITE_THEME_DARK_INTRO_HEADLINE = `.${ELEMENT_SLIDER_EVENT_CONTAINER}${IS_THEME_DARK} .${ELEMENT_SLIDER_EVENT_INTRO_HEADLINE}`;
|
|
32
|
-
const OVERWRITE_THEME_DARK_ARROW = `.${ELEMENT_SLIDER_EVENT_CONTAINER}${IS_THEME_DARK} .${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON}`;
|
|
33
|
-
const VariationThemeDark = `
|
|
34
|
-
${OVERWRITE_THEME_DARK_CONTAINER_WRAPPER} {
|
|
35
|
-
background-color: ${token.color.gray.darker};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
${OVERWRITE_THEME_DARK_CONTAINER} * {
|
|
39
|
-
color: #fff !important;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
${OVERWRITE_THEME_DARK_INTRO_COVER} {
|
|
43
|
-
background-color: ${token.color.gray.darker};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
${OVERWRITE_THEME_DARK_INTRO_HEADLINE} {
|
|
47
|
-
color: ${token.color.white};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
${OVERWRITE_THEME_DARK_ARROW} {
|
|
51
|
-
background-color: ${token.color.gray.dark};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
${OVERWRITE_THEME_DARK_ARROW} svg {
|
|
55
|
-
fill: ${token.color.white}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
${OVERWRITE_THEME_DARK_ARROW}:hover {
|
|
59
|
-
background-color: ${token.color.white}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
${OVERWRITE_THEME_DARK_ARROW}:hover svg {
|
|
63
|
-
fill: ${token.color.black}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
const ButtonStyles = `
|
|
67
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON} {
|
|
68
|
-
border: none;
|
|
69
|
-
width: 32px;
|
|
70
|
-
height: 32px;
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
background-color: ${token.color.gray.light};
|
|
75
|
-
transition: background-color ${ANIMATION_DURATION}ms;
|
|
76
|
-
position: absolute;
|
|
77
|
-
top: 50%;
|
|
78
|
-
transform: translateY(-50%);
|
|
79
|
-
z-index: 99;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
83
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON} {
|
|
84
|
-
width: 48px;
|
|
85
|
-
height: 48px;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON}:hover {
|
|
90
|
-
background-color: ${token.color.black};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON}:hover svg {
|
|
94
|
-
fill: ${token.color.white};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON} svg {
|
|
98
|
-
transition: fill .5s;
|
|
99
|
-
fill: ${token.color.black};
|
|
100
|
-
width: 16px;
|
|
101
|
-
height: 6px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
105
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON} svg {
|
|
106
|
-
width: 24px;
|
|
107
|
-
height: 8px;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_BACK} {
|
|
112
|
-
left: 0;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@container ${ELEMENT_NAME} (max-width: ${TABLET - 1}px) {
|
|
116
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_BACK} {
|
|
117
|
-
left: -24px;
|
|
118
|
-
top: ${token.spacing.xs};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_FORWARD} {
|
|
123
|
-
right: 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@container ${ELEMENT_NAME} (max-width: ${TABLET - 1}px) {
|
|
127
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_FORWARD} {
|
|
128
|
-
right: -24px;
|
|
129
|
-
top: ${token.spacing.xs};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
133
|
-
const DatesStyles = `
|
|
134
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_CONTAINTER} {
|
|
135
|
-
display: flex;
|
|
136
|
-
position: relative;
|
|
137
|
-
padding: 0 36px;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
141
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_CONTAINTER} {
|
|
142
|
-
padding: 0 60px;
|
|
143
|
-
width: calc(100% - 96px);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_WRAPPER} {
|
|
148
|
-
position: relative;
|
|
149
|
-
width: 100%;
|
|
150
|
-
overflow: hidden;
|
|
151
|
-
min-height: 44px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_WRAPPER} ::slotted(*) {
|
|
155
|
-
margin-bottom: 0 !important;
|
|
156
|
-
}
|
|
157
|
-
`;
|
|
158
|
-
const IntroStyles = `
|
|
159
|
-
.${ELEMENT_SLIDER_EVENT_INTRO} {
|
|
160
|
-
padding: 0 ${token.spacing.lg};
|
|
161
|
-
position: relative;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@container ${ELEMENT_NAME} (max-width: ${TABLET - 1}px) {
|
|
165
|
-
.${ELEMENT_SLIDER_EVENT_INTRO} {
|
|
166
|
-
text-align: center;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
171
|
-
.${ELEMENT_SLIDER_EVENT_INTRO} {
|
|
172
|
-
padding: 0;
|
|
173
|
-
padding-right: 24px;
|
|
174
|
-
padding-left: 0;
|
|
175
|
-
width: 200px;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@container ${ELEMENT_NAME} (min-width: ${LARGE}px) {
|
|
180
|
-
.${ELEMENT_SLIDER_EVENT_INTRO} {
|
|
181
|
-
width: 320px;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.${ELEMENT_SLIDER_EVENT_INTRO_HEADLINE} {
|
|
186
|
-
color: ${token.color.black};
|
|
187
|
-
font-weight: 700;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.${ELEMENT_SLIDER_EVENT_INTRO_HEADLINE} + * {
|
|
191
|
-
margin-top: ${token.spacing.min};
|
|
192
|
-
display: block;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
${jssToCSS({
|
|
196
|
-
styleObj: {
|
|
197
|
-
[`.${ELEMENT_SLIDER_EVENT_INTRO_HEADLINE}`]: typography.sans.larger
|
|
198
|
-
}
|
|
199
|
-
})}
|
|
200
|
-
|
|
201
|
-
* + .${ELEMENT_SLIDER_EVENT_INTRO_ACTIONS} {
|
|
202
|
-
text-decoration: none;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.${ELEMENT_SLIDER_EVENT_INTRO_ACTIONS} {
|
|
206
|
-
margin-top: ${token.spacing.min};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
`;
|
|
211
|
-
const ScrollerStyles = `
|
|
212
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_SCROLLER} {
|
|
213
|
-
position: relative;
|
|
214
|
-
z-index: 99;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
218
|
-
.${ELEMENT_SLIDER_EVENT_SLIDE_SCROLLER} {
|
|
219
|
-
display: flex;
|
|
220
|
-
align-items: center;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
`;
|
|
224
|
-
const CoverStyles = `
|
|
225
|
-
.${ELEMENT_SLIDER_EVENT_COVER} {
|
|
226
|
-
display: block;
|
|
227
|
-
position: absolute;
|
|
228
|
-
width: 200vw;
|
|
229
|
-
height: 100%;
|
|
230
|
-
top: 0;
|
|
231
|
-
left: -100vw;
|
|
232
|
-
background-color: ${token.color.gray.lighter};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
236
|
-
.${ELEMENT_SLIDER_EVENT_COVER} {
|
|
237
|
-
width: 40vw;
|
|
238
|
-
left: calc(100% - 1px);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
`;
|
|
242
|
-
const STYLES_SLIDER_EVENTS_ELEMENT = `
|
|
243
|
-
.${ELEMENT_SLIDER_EVENT_DECLRATION} {
|
|
244
|
-
container: ${ELEMENT_NAME} / inline-size;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.${ELEMENT_SLIDER_EVENT_CONTAINER_WRAPPER} {
|
|
248
|
-
padding: 24px 0;
|
|
249
|
-
background-color: ${token.color.gray.lighter};
|
|
250
|
-
position: relative;
|
|
251
|
-
z-index: 99;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
@container ${ELEMENT_NAME} (max-width: 260px) {
|
|
255
|
-
.${ELEMENT_SLIDER_EVENT_CONTAINER_WRAPPER} {
|
|
256
|
-
display: none
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
@container ${ELEMENT_NAME} (min-width: ${TABLET}px) {
|
|
261
|
-
.${ELEMENT_SLIDER_EVENT_CONTAINER_WRAPPER} {
|
|
262
|
-
padding: 40px;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
${CoverStyles}
|
|
267
|
-
${ScrollerStyles}
|
|
268
|
-
${IntroStyles}
|
|
269
|
-
${DatesStyles}
|
|
270
|
-
${ButtonStyles}
|
|
271
|
-
${VariationThemeDark}
|
|
272
|
-
`;
|
|
273
|
-
const CreateBackButton = ({
|
|
274
|
-
SetCountBackward,
|
|
275
|
-
SetButtonVisibility,
|
|
276
|
-
SetSlideDatesBackwards
|
|
277
|
-
}) => {
|
|
278
|
-
const button = document.createElement("button");
|
|
279
|
-
button.innerHTML = arrow_left;
|
|
280
|
-
button.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_BUTTON);
|
|
281
|
-
button.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_BACK);
|
|
282
|
-
button.style.display = "none";
|
|
283
|
-
button.setAttribute("type", "button");
|
|
284
|
-
button.setAttribute("aria-label", "see previous date");
|
|
285
|
-
const clickEvent = () => {
|
|
286
|
-
if (button.hasAttribute("disabled")) return;
|
|
287
|
-
SetCountBackward();
|
|
288
|
-
SetButtonVisibility();
|
|
289
|
-
SetSlideDatesBackwards();
|
|
290
|
-
};
|
|
291
|
-
button.addEventListener("click", clickEvent);
|
|
292
|
-
button.addEventListener("touchstart", clickEvent);
|
|
293
|
-
return button;
|
|
294
|
-
};
|
|
295
|
-
const CreateForwardButton = ({
|
|
296
|
-
SetCountForward,
|
|
297
|
-
SetButtonVisibility,
|
|
298
|
-
SetSlideDatesForward
|
|
299
|
-
}) => {
|
|
300
|
-
const button = document.createElement("button");
|
|
301
|
-
button.innerHTML = arrow_right;
|
|
302
|
-
button.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_BUTTON);
|
|
303
|
-
button.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_BUTTON_FORWARD);
|
|
304
|
-
button.setAttribute("type", "button");
|
|
305
|
-
button.setAttribute("aria-label", "see next date");
|
|
306
|
-
const clickEvent = () => {
|
|
307
|
-
if (button.hasAttribute("disabled")) return;
|
|
308
|
-
SetCountForward();
|
|
309
|
-
SetButtonVisibility();
|
|
310
|
-
SetSlideDatesForward();
|
|
311
|
-
};
|
|
312
|
-
button.addEventListener("click", clickEvent);
|
|
313
|
-
button.addEventListener("touchstart", clickEvent);
|
|
314
|
-
return button;
|
|
315
|
-
};
|
|
316
|
-
const CreateDatesContainer = (props) => {
|
|
317
|
-
const { dataSlider } = props;
|
|
318
|
-
const container = document.createElement("div");
|
|
319
|
-
const datesWrapper = document.createElement("div");
|
|
320
|
-
const backButton = CreateBackButton(props);
|
|
321
|
-
const forwardButton = CreateForwardButton(props);
|
|
322
|
-
datesWrapper.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_WRAPPER);
|
|
323
|
-
dataSlider.style.display = "block";
|
|
324
|
-
datesWrapper.appendChild(dataSlider);
|
|
325
|
-
container.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_CONTAINTER);
|
|
326
|
-
container.appendChild(backButton);
|
|
327
|
-
container.appendChild(datesWrapper);
|
|
328
|
-
container.appendChild(forwardButton);
|
|
329
|
-
return container;
|
|
330
|
-
};
|
|
331
|
-
const CreateIntroWrapper = (props) => {
|
|
332
|
-
const { headline, actions } = props;
|
|
333
|
-
const introductionWrapper = document.createElement("div");
|
|
334
|
-
if (headline) {
|
|
335
|
-
headline.classList.add(ELEMENT_SLIDER_EVENT_INTRO_HEADLINE);
|
|
336
|
-
introductionWrapper.appendChild(headline);
|
|
337
|
-
}
|
|
338
|
-
if (actions) {
|
|
339
|
-
introductionWrapper.appendChild(actions);
|
|
340
|
-
}
|
|
341
|
-
introductionWrapper.classList.add(ELEMENT_SLIDER_EVENT_INTRO);
|
|
342
|
-
return introductionWrapper;
|
|
343
|
-
};
|
|
344
|
-
const CreateScrollerWrapper = (props) => {
|
|
345
|
-
const container = document.createElement("div");
|
|
346
|
-
const introductionWrapper = CreateIntroWrapper(props);
|
|
347
|
-
const datesContainer = CreateDatesContainer(props);
|
|
348
|
-
container.classList.add(ELEMENT_SLIDER_EVENT_SLIDE_SCROLLER);
|
|
349
|
-
container.appendChild(introductionWrapper);
|
|
350
|
-
container.appendChild(datesContainer);
|
|
351
|
-
return container;
|
|
352
|
-
};
|
|
353
12
|
const ShowNumberOfDates = ({ container }) => {
|
|
354
13
|
let count = 1;
|
|
355
14
|
if (container.offsetWidth > TABLET) count = 2;
|
|
@@ -364,12 +23,10 @@ const JumpToDate = ({
|
|
|
364
23
|
const dateElements = Array.from(
|
|
365
24
|
dataSlider.querySelectorAll(":scope > *")
|
|
366
25
|
);
|
|
367
|
-
if (!dateElements) return;
|
|
368
26
|
const firstElement = dateElements[0];
|
|
369
|
-
const currentPositonAboveZero = currentPosition > 0;
|
|
370
27
|
const currentElement = dateElements[currentPosition];
|
|
371
28
|
let endPosition = 0;
|
|
372
|
-
if (
|
|
29
|
+
if (currentPosition > 0) {
|
|
373
30
|
endPosition = currentElement.offsetLeft - firstElement.offsetLeft;
|
|
374
31
|
}
|
|
375
32
|
dataSlider.style.transform = `translateX(${-endPosition}px)`;
|
|
@@ -382,81 +39,67 @@ const ButtonVisibilityLogic = ({
|
|
|
382
39
|
const dateElements = Array.from(
|
|
383
40
|
dataSlider.querySelectorAll(":scope > *")
|
|
384
41
|
);
|
|
385
|
-
const
|
|
386
|
-
container.querySelectorAll(
|
|
42
|
+
const [backButton, forwardButton] = Array.from(
|
|
43
|
+
container.querySelectorAll(".slider-event-slide-button")
|
|
387
44
|
);
|
|
388
45
|
const count = ShowNumberOfDates({ container });
|
|
389
46
|
const length = dateElements.length;
|
|
390
|
-
|
|
47
|
+
[backButton, forwardButton].forEach((button) => {
|
|
391
48
|
button.setAttribute("disabled", "");
|
|
392
49
|
setTimeout(() => {
|
|
393
50
|
button.removeAttribute("disabled");
|
|
394
51
|
}, ANIMATION_DURATION + 100);
|
|
395
52
|
});
|
|
396
53
|
if (currentPosition === 0) {
|
|
397
|
-
|
|
54
|
+
backButton.style.display = "none";
|
|
398
55
|
} else {
|
|
399
|
-
|
|
56
|
+
backButton.style.display = "flex";
|
|
400
57
|
}
|
|
401
58
|
if (currentPosition >= length - count) {
|
|
402
|
-
|
|
59
|
+
forwardButton.style.display = "none";
|
|
403
60
|
} else {
|
|
404
|
-
|
|
61
|
+
forwardButton.style.display = "flex";
|
|
405
62
|
}
|
|
406
63
|
};
|
|
407
64
|
const SizeDatesElements = ({
|
|
408
65
|
container,
|
|
409
66
|
dataSlider,
|
|
410
|
-
isThemeDark,
|
|
411
67
|
SetButtonVisibility
|
|
412
68
|
}) => {
|
|
413
|
-
const
|
|
414
|
-
`.${ELEMENT_SLIDER_EVENT_SLIDE_WRAPPER}`
|
|
415
|
-
);
|
|
416
|
-
const sizing = ({ sliderWrapper: sliderWrapper2 }) => {
|
|
69
|
+
const sizing = () => {
|
|
417
70
|
const dateElements = Array.from(
|
|
418
71
|
dataSlider.querySelectorAll(":scope > *")
|
|
419
72
|
);
|
|
73
|
+
const sliderWrapper = container.querySelector(
|
|
74
|
+
".slider-event-slide-wrapper"
|
|
75
|
+
);
|
|
420
76
|
const sliderVisibility = ({ show = true }) => {
|
|
421
|
-
|
|
77
|
+
if (show) {
|
|
78
|
+
dataSlider.style.visibility = "visible";
|
|
79
|
+
} else {
|
|
80
|
+
dataSlider.style.visibility = "hidden";
|
|
81
|
+
}
|
|
422
82
|
};
|
|
423
83
|
const setHeight = () => {
|
|
424
84
|
const maxHeightElement = dateElements.sort((a, b) => {
|
|
425
85
|
return a.offsetHeight - b.offsetHeight;
|
|
426
86
|
})[0];
|
|
427
|
-
const height = maxHeightElement.offsetHeight + parsePixelValue(maxHeightElement.
|
|
428
|
-
|
|
87
|
+
const height = maxHeightElement.offsetHeight + parsePixelValue(getComputedStyle(maxHeightElement).marginTop);
|
|
88
|
+
sliderWrapper.style.height = `${height}px`;
|
|
429
89
|
};
|
|
430
90
|
const setWidthPerDate = () => {
|
|
431
91
|
const count = ShowNumberOfDates({ container });
|
|
432
|
-
const dateElementSize =
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
if (elementWidth === 0) {
|
|
92
|
+
const dateElementSize = sliderWrapper.offsetWidth / count;
|
|
93
|
+
const containerWidth = container.offsetWidth;
|
|
94
|
+
if (containerWidth === 0) {
|
|
436
95
|
setTimeout(() => {
|
|
437
|
-
sizing(
|
|
96
|
+
sizing();
|
|
438
97
|
}, 200);
|
|
439
98
|
return;
|
|
440
99
|
}
|
|
441
100
|
dataSlider.style.width = `${dateElements.length * dateElementSize}px`;
|
|
442
101
|
dateElements.forEach((dateElement) => {
|
|
443
102
|
dateElement.style.width = `${dateElementSize}px`;
|
|
444
|
-
if (isMobile) {
|
|
445
|
-
const lineColor = isThemeDark ? token.color.gray.mediumAA : token.color.gray.light;
|
|
446
|
-
dateElement.style.display = `flex`;
|
|
447
|
-
dateElement.style.justifyContent = `center`;
|
|
448
|
-
dateElement.style.paddingRight = `0`;
|
|
449
|
-
dateElement.style.marginTop = `${token.spacing.xs}`;
|
|
450
|
-
dateElement.style.paddingTop = `${token.spacing.xs}`;
|
|
451
|
-
dateElement.style.borderTop = `1px solid ${lineColor}`;
|
|
452
|
-
} else {
|
|
453
|
-
dateElement.style.display = `flex`;
|
|
454
|
-
dateElement.style.justifyContent = `inherit`;
|
|
455
|
-
dateElement.style.paddingRight = `${token.spacing.lg}`;
|
|
456
|
-
dateElement.style.marginTop = `0`;
|
|
457
|
-
dateElement.style.paddingTop = `0`;
|
|
458
|
-
dateElement.style.borderTop = `none`;
|
|
459
|
-
}
|
|
460
103
|
});
|
|
461
104
|
};
|
|
462
105
|
sliderVisibility({ show: false });
|
|
@@ -465,7 +108,7 @@ const SizeDatesElements = ({
|
|
|
465
108
|
sliderVisibility({ show: true });
|
|
466
109
|
SetButtonVisibility();
|
|
467
110
|
};
|
|
468
|
-
sizing(
|
|
111
|
+
sizing();
|
|
469
112
|
};
|
|
470
113
|
const EventSlideDates = ({
|
|
471
114
|
forward,
|
|
@@ -524,35 +167,244 @@ const EventSwipe = ({
|
|
|
524
167
|
};
|
|
525
168
|
setupSwipeDetection({ container, callback: swipes });
|
|
526
169
|
};
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
170
|
+
const CreateBackButton = (props) => {
|
|
171
|
+
const { SetCountBackward, SetButtonVisibility, SetSlideDatesBackwards, isThemeDark } = props;
|
|
172
|
+
const clickEvent = (event) => {
|
|
173
|
+
const button = event.currentTarget;
|
|
174
|
+
if (button.hasAttribute("disabled")) return;
|
|
175
|
+
SetCountBackward();
|
|
176
|
+
SetButtonVisibility();
|
|
177
|
+
SetSlideDatesBackwards();
|
|
178
|
+
};
|
|
179
|
+
return new ElementBuilder("button").withClassName("slider-event-button-back").withClassName("slider-event-slide-button").withHTML(arrow_left).withAttribute("type", "button").withAria({ label: "see previous date" }).withStyles({
|
|
180
|
+
element: {
|
|
181
|
+
border: "none",
|
|
182
|
+
width: token.spacing.lg,
|
|
183
|
+
height: token.spacing.lg,
|
|
184
|
+
display: "none",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
justifyContent: "center",
|
|
187
|
+
backgroundColor: token.color.gray.light,
|
|
188
|
+
transition: `background-color ${ANIMATION_DURATION}ms`,
|
|
189
|
+
position: "absolute",
|
|
190
|
+
top: "50%",
|
|
191
|
+
transform: "translateY(-50%)",
|
|
192
|
+
zIndex: 99,
|
|
193
|
+
left: 0,
|
|
194
|
+
...isThemeDark && { backgroundColor: token.color.gray.dark },
|
|
195
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
196
|
+
width: token.spacing["2xl"],
|
|
197
|
+
height: token.spacing["2xl"]
|
|
198
|
+
},
|
|
199
|
+
[`@container (max-width: ${TABLET - 1}px)`]: {
|
|
200
|
+
left: `-${token.spacing.md}`,
|
|
201
|
+
top: token.spacing.xs
|
|
202
|
+
},
|
|
203
|
+
"&:hover": {
|
|
204
|
+
backgroundColor: token.color.black,
|
|
205
|
+
...isThemeDark && { backgroundColor: token.color.white }
|
|
206
|
+
},
|
|
207
|
+
"& svg": {
|
|
208
|
+
transition: "fill .5s",
|
|
209
|
+
fill: token.color.black,
|
|
210
|
+
width: token.spacing.sm,
|
|
211
|
+
height: "6px",
|
|
212
|
+
...isThemeDark && { fill: token.color.white },
|
|
213
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
214
|
+
width: token.spacing.md,
|
|
215
|
+
height: "8px"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"&:hover svg": {
|
|
219
|
+
fill: token.color.white,
|
|
220
|
+
...isThemeDark && { fill: token.color.black }
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}).on("click", clickEvent).on("touchstart", clickEvent).build();
|
|
224
|
+
};
|
|
225
|
+
const CreateForwardButton = (props) => {
|
|
226
|
+
const { SetCountForward, SetButtonVisibility, SetSlideDatesForward, isThemeDark } = props;
|
|
227
|
+
const clickEvent = (event) => {
|
|
228
|
+
const button = event.currentTarget;
|
|
229
|
+
if (button.hasAttribute("disabled")) return;
|
|
230
|
+
SetCountForward();
|
|
231
|
+
SetButtonVisibility();
|
|
232
|
+
SetSlideDatesForward();
|
|
233
|
+
};
|
|
234
|
+
return new ElementBuilder("button").withClassName("slider-event-button-forward").withClassName("slider-event-slide-button").withHTML(arrow_right).withAttribute("type", "button").withAria({ label: "see next date" }).withStyles({
|
|
235
|
+
element: {
|
|
236
|
+
border: "none",
|
|
237
|
+
width: token.spacing.lg,
|
|
238
|
+
height: token.spacing.lg,
|
|
239
|
+
display: "flex",
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
justifyContent: "center",
|
|
242
|
+
backgroundColor: token.color.gray.light,
|
|
243
|
+
transition: `background-color ${ANIMATION_DURATION}ms`,
|
|
244
|
+
position: "absolute",
|
|
245
|
+
top: "50%",
|
|
246
|
+
transform: "translateY(-50%)",
|
|
247
|
+
zIndex: 99,
|
|
248
|
+
right: 0,
|
|
249
|
+
...isThemeDark && { backgroundColor: token.color.gray.dark },
|
|
250
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
251
|
+
width: token.spacing["2xl"],
|
|
252
|
+
height: token.spacing["2xl"]
|
|
253
|
+
},
|
|
254
|
+
[`@container (max-width: ${TABLET - 1}px)`]: {
|
|
255
|
+
right: `-${token.spacing.md}`,
|
|
256
|
+
top: token.spacing.xs
|
|
257
|
+
},
|
|
258
|
+
"&:hover": {
|
|
259
|
+
backgroundColor: token.color.black,
|
|
260
|
+
...isThemeDark && { backgroundColor: token.color.white }
|
|
261
|
+
},
|
|
262
|
+
"& svg": {
|
|
263
|
+
transition: "fill .5s",
|
|
264
|
+
fill: token.color.black,
|
|
265
|
+
width: token.spacing.sm,
|
|
266
|
+
height: "6px",
|
|
267
|
+
...isThemeDark && { fill: token.color.white },
|
|
268
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
269
|
+
width: token.spacing.md,
|
|
270
|
+
height: "8px"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"&:hover svg": {
|
|
274
|
+
fill: token.color.white,
|
|
275
|
+
...isThemeDark && { fill: token.color.black }
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}).on("click", clickEvent).on("touchstart", clickEvent).build();
|
|
279
|
+
};
|
|
280
|
+
const CreateDatesContainer = (props) => {
|
|
281
|
+
const { dataSlider, isThemeDark } = props;
|
|
282
|
+
const backButton = CreateBackButton(props);
|
|
283
|
+
const forwardButton = CreateForwardButton(props);
|
|
284
|
+
const dataSliderModel = new ElementBuilder(dataSlider).withClassName("slider-event-data-slider").withStyles({
|
|
285
|
+
element: {
|
|
286
|
+
display: "flex",
|
|
287
|
+
position: "absolute",
|
|
288
|
+
top: 0,
|
|
289
|
+
left: 0,
|
|
290
|
+
"& > *": {
|
|
291
|
+
display: "flex",
|
|
292
|
+
justifyContent: "inherit",
|
|
293
|
+
paddingRight: token.spacing.lg,
|
|
294
|
+
[`@container (max-width: ${TABLET - 1}px)`]: {
|
|
295
|
+
justifyContent: "center",
|
|
296
|
+
paddingRight: 0,
|
|
297
|
+
marginTop: token.spacing.xs,
|
|
298
|
+
paddingTop: token.spacing.xs,
|
|
299
|
+
borderTop: `1px solid ${token.color.gray.light}`,
|
|
300
|
+
...isThemeDark && {
|
|
301
|
+
borderTop: `1px solid ${token.color.gray.mediumAA}`
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}).build();
|
|
307
|
+
const datesWrapper = new ElementBuilder().withClassName("slider-event-slide-wrapper").withStyles({
|
|
308
|
+
element: {
|
|
309
|
+
position: "relative",
|
|
310
|
+
width: "100%",
|
|
311
|
+
overflow: "hidden",
|
|
312
|
+
minHeight: "44px",
|
|
313
|
+
"& ::slotted(*)": {
|
|
314
|
+
marginBottom: "0 !important"
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}).withChild(dataSliderModel).build();
|
|
318
|
+
return new ElementBuilder().withClassName("slider-event-slide-container").withStyles({
|
|
319
|
+
element: {
|
|
320
|
+
display: "flex",
|
|
321
|
+
position: "relative",
|
|
322
|
+
padding: "0 36px",
|
|
323
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
324
|
+
padding: "0 60px",
|
|
325
|
+
width: "calc(100% - 96px)"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}).withChildren(backButton, datesWrapper, forwardButton).build();
|
|
329
|
+
};
|
|
330
|
+
const CreateIntroWrapper = (props) => {
|
|
331
|
+
const { headline, actions, isThemeDark } = props;
|
|
332
|
+
const createHeadline = () => {
|
|
333
|
+
if (!headline) {
|
|
334
|
+
console.warn("CreateIntroWrapper: headline element is required");
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
return new ElementBuilder(headline).withClassName("slider-event-intro-headline").withStyles({
|
|
338
|
+
element: {
|
|
339
|
+
...typography.sans.larger,
|
|
340
|
+
color: token.color.black,
|
|
341
|
+
fontWeight: 700,
|
|
342
|
+
...isThemeDark && { color: token.color.white },
|
|
343
|
+
"& + *": {
|
|
344
|
+
marginTop: token.spacing.min,
|
|
345
|
+
display: "block"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}).build();
|
|
349
|
+
};
|
|
350
|
+
const createActions = () => {
|
|
351
|
+
if (!actions) return null;
|
|
352
|
+
return new ElementBuilder(actions).withClassName("slider-event-intro-actions").withStyles({
|
|
353
|
+
element: {
|
|
354
|
+
marginTop: token.spacing.min
|
|
355
|
+
}
|
|
356
|
+
}).build();
|
|
357
|
+
};
|
|
358
|
+
return new ElementBuilder().withClassName("slider-event-intro-container").withStyles({
|
|
359
|
+
element: {
|
|
360
|
+
padding: `0 ${token.spacing.lg}`,
|
|
361
|
+
position: "relative",
|
|
362
|
+
[`@container (max-width: ${TABLET - 1}px)`]: {
|
|
363
|
+
textAlign: "center"
|
|
364
|
+
},
|
|
365
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
366
|
+
padding: 0,
|
|
367
|
+
paddingRight: "24px",
|
|
368
|
+
width: "200px"
|
|
369
|
+
},
|
|
370
|
+
[`@container (min-width: ${LARGE}px)`]: {
|
|
371
|
+
width: "320px"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}).withChild(createHeadline()).withChild(createActions()).build();
|
|
375
|
+
};
|
|
376
|
+
const CreateScrollerWrapper = (props) => {
|
|
377
|
+
const introductionWrapper = CreateIntroWrapper(props);
|
|
378
|
+
const datesContainer = CreateDatesContainer(props);
|
|
379
|
+
return new ElementBuilder().withClassName("slider-event-slide-scroller").withStyles({
|
|
380
|
+
element: {
|
|
381
|
+
position: "relative",
|
|
382
|
+
zIndex: 99,
|
|
383
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
384
|
+
display: "flex",
|
|
385
|
+
alignItems: "center"
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}).withChildren(introductionWrapper, datesContainer).build();
|
|
532
389
|
};
|
|
533
390
|
const createCompositeSliderEvents = (props) => (() => {
|
|
534
391
|
const { isThemeDark, dataSlider } = props;
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
const wrapper = document.createElement("div");
|
|
538
|
-
const coverElement = document.createElement("div");
|
|
539
|
-
const CommonDomElements = {
|
|
540
|
-
container,
|
|
541
|
-
dataSlider
|
|
542
|
-
};
|
|
392
|
+
let currentPosition = 0;
|
|
393
|
+
let container;
|
|
543
394
|
const SetCountForward = () => currentPosition = currentPosition + 1;
|
|
544
395
|
const SetCountBackward = () => currentPosition = currentPosition - 1;
|
|
545
|
-
const SetButtonVisibility = () => ButtonVisibilityLogic({
|
|
396
|
+
const SetButtonVisibility = () => ButtonVisibilityLogic({ container, dataSlider, currentPosition });
|
|
546
397
|
const size = () => SizeDatesElements({
|
|
547
|
-
|
|
548
|
-
|
|
398
|
+
container,
|
|
399
|
+
dataSlider,
|
|
549
400
|
SetButtonVisibility
|
|
550
401
|
});
|
|
551
|
-
const SetJumpToDate = () => JumpToDate({
|
|
552
|
-
const SetSlideDatesForward = () => EventSlideDates({
|
|
553
|
-
const SetSlideDatesBackwards = () => EventSlideDates({
|
|
402
|
+
const SetJumpToDate = () => JumpToDate({ dataSlider, currentPosition });
|
|
403
|
+
const SetSlideDatesForward = () => EventSlideDates({ dataSlider, forward: true });
|
|
404
|
+
const SetSlideDatesBackwards = () => EventSlideDates({ dataSlider, forward: false });
|
|
554
405
|
const SetEventSwipe = () => EventSwipe({
|
|
555
|
-
|
|
406
|
+
container,
|
|
407
|
+
dataSlider,
|
|
556
408
|
currentPosition,
|
|
557
409
|
SetCountBackward,
|
|
558
410
|
SetCountForward,
|
|
@@ -565,7 +417,11 @@ const createCompositeSliderEvents = (props) => (() => {
|
|
|
565
417
|
SetJumpToDate();
|
|
566
418
|
SetButtonVisibility();
|
|
567
419
|
};
|
|
568
|
-
const
|
|
420
|
+
const load = () => {
|
|
421
|
+
EventResize();
|
|
422
|
+
SetEventSwipe();
|
|
423
|
+
};
|
|
424
|
+
const scrollerModel = CreateScrollerWrapper({
|
|
569
425
|
...props,
|
|
570
426
|
SetCountForward,
|
|
571
427
|
SetCountBackward,
|
|
@@ -573,32 +429,52 @@ const createCompositeSliderEvents = (props) => (() => {
|
|
|
573
429
|
SetSlideDatesBackwards,
|
|
574
430
|
SetSlideDatesForward
|
|
575
431
|
});
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
432
|
+
const coverModel = new ElementBuilder().withClassName("slider-event-cover").withStyles({
|
|
433
|
+
element: {
|
|
434
|
+
display: "block",
|
|
435
|
+
position: "absolute",
|
|
436
|
+
width: "200vw",
|
|
437
|
+
height: "100%",
|
|
438
|
+
top: 0,
|
|
439
|
+
left: "-100vw",
|
|
440
|
+
backgroundColor: token.color.gray.lighter,
|
|
441
|
+
...isThemeDark && { backgroundColor: token.color.gray.darker },
|
|
442
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
443
|
+
width: "40vw",
|
|
444
|
+
left: "calc(100% - 1px)"
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}).build();
|
|
448
|
+
const wrapperModel = new ElementBuilder().withClassName("slider-event-container-wrapper").withStyles({
|
|
449
|
+
element: {
|
|
450
|
+
padding: "24px 0",
|
|
451
|
+
backgroundColor: token.color.gray.lighter,
|
|
452
|
+
position: "relative",
|
|
453
|
+
zIndex: 99,
|
|
454
|
+
...isThemeDark && { backgroundColor: token.color.gray.darker },
|
|
455
|
+
"@container (max-width: 260px)": {
|
|
456
|
+
display: "none"
|
|
457
|
+
},
|
|
458
|
+
[`@container (min-width: ${TABLET}px)`]: {
|
|
459
|
+
padding: "40px"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}).withChildren(scrollerModel, coverModel).build();
|
|
463
|
+
const containerModel = new ElementBuilder().withClassName("slider-events-container").withStylesIf(!!isThemeDark, {
|
|
464
|
+
element: {
|
|
465
|
+
"& *": { color: "#fff !important" }
|
|
466
|
+
}
|
|
467
|
+
}).ref((element) => {
|
|
468
|
+
container = element;
|
|
469
|
+
}).withChild(wrapperModel).build();
|
|
470
|
+
const declarationModel = new ElementBuilder().withClassName("slider-events-declaration").withStyles({
|
|
471
|
+
element: {
|
|
472
|
+
containerType: "inline-size"
|
|
473
|
+
}
|
|
474
|
+
}).withChild(containerModel).withEvents({ load, size }).build();
|
|
583
475
|
dataSlider.style.visibility = "hidden";
|
|
584
|
-
coverElement.classList.add(ELEMENT_SLIDER_EVENT_COVER);
|
|
585
|
-
wrapper.classList.add(ELEMENT_SLIDER_EVENT_CONTAINER_WRAPPER);
|
|
586
|
-
wrapper.appendChild(containerWrapper);
|
|
587
|
-
wrapper.appendChild(coverElement);
|
|
588
|
-
if (isThemeDark) container.setAttribute(ATTRIBUTE_THEME, THEME_DARK);
|
|
589
|
-
container.classList.add(ELEMENT_SLIDER_EVENT_CONTAINER);
|
|
590
|
-
container.appendChild(wrapper);
|
|
591
|
-
declaration.classList.add(ELEMENT_SLIDER_EVENT_DECLRATION);
|
|
592
|
-
declaration.appendChild(container);
|
|
593
476
|
window.addEventListener("resize", debounce(EventResize, 20));
|
|
594
|
-
return
|
|
595
|
-
element: declaration,
|
|
596
|
-
styles,
|
|
597
|
-
events: {
|
|
598
|
-
load,
|
|
599
|
-
size
|
|
600
|
-
}
|
|
601
|
-
};
|
|
477
|
+
return declarationModel;
|
|
602
478
|
})();
|
|
603
479
|
export {
|
|
604
480
|
createCompositeSliderEvents
|