@nuskin/product-components 3.18.0-td-341.2 → 4.0.0-cx15-11969.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.
@@ -1,209 +0,0 @@
1
- <template>
2
- <div class="swiper" data-carousel="carousel">
3
- <slot />
4
- </div>
5
- </template>
6
- <script>
7
- import Swiper, { Navigation, Pagination } from "swiper";
8
- import "swiper/swiper.scss";
9
- import "swiper/modules/pagination/pagination.scss";
10
-
11
- export const CSS_CLASSES = {
12
- SWIPER_WRAPPER: "swiper-wrapper",
13
- SWIPER_NAV_PREV: "swiper-button-prev",
14
- SWIPER_NAV_NEXT: "swiper-button-next",
15
- SWIPER_SLIDE: "swiper-slide",
16
- SWIPER_PAGINATION: "swiper-pagination",
17
- SWIPER_VISIBLE: "swiper-slide-visible",
18
- SWIPER_DUPLICATE: "swiper-slide-duplicate"
19
- };
20
-
21
- export const SELECTORS = {
22
- WRAPPER: '[data-carousel="wrapper"]',
23
- CHEVRON_LEFT: '[data-carousel="chevron-left"]',
24
- CHEVRON_RIGHT: '[data-carousel="chevron-right"]',
25
- ITEMS: '[data-carousel="item"]',
26
- DISABLED_TAB: "[data-disabletab]",
27
- DOTS: '[data-carousel="dots"]',
28
- DOT_ELEMENT: "span"
29
- };
30
-
31
- export default {
32
- name: "Carousel",
33
- props: {
34
- options: {
35
- default: () => ({}),
36
- type: Object
37
- }
38
- },
39
- data() {
40
- return {
41
- swiper: {
42
- type: Object,
43
- default: undefined
44
- }
45
- };
46
- },
47
- computed: {
48
- carouselWrapper() {
49
- return this.$el.querySelector(SELECTORS.WRAPPER);
50
- },
51
- carouselChevrons() {
52
- return [
53
- this.$el.querySelector(SELECTORS.CHEVRON_LEFT),
54
- this.$el.querySelector(SELECTORS.CHEVRON_RIGHT)
55
- ];
56
- },
57
- carouselItems() {
58
- return this.$el.querySelectorAll(SELECTORS.ITEMS);
59
- },
60
- carouselDotContainer() {
61
- return this.$el.querySelector(SELECTORS.DOTS);
62
- },
63
- carouselDots() {
64
- return this.$el.querySelectorAll(
65
- `.${CSS_CLASSES.SWIPER_PAGINATION} ${SELECTORS.DOT_ELEMENT}`
66
- );
67
- }
68
- },
69
- mounted() {
70
- this.setSwiperClasses();
71
- const options = this.buildOptions();
72
- this.swiper = new Swiper(this.$el, options);
73
- this.bindEvents();
74
- this.toggleTabItemIndex();
75
- this.setDotsTabIndex();
76
-
77
- this.swiper.on("slideChange", () => {
78
- this.toggleTabItemIndex();
79
- });
80
- },
81
- methods: {
82
- toggleTabItemIndex() {
83
- /**
84
- * Set all carousel slides, duplicates, and their anchor tags to be non-tabbable.
85
- * Note: We are using `methods` here instead of `computed` to fetch the updated DOM after carousel's slideChange
86
- */
87
- const carouselItems = this.getCarouselItems();
88
- const duplicateCarouselItems = this.getDuplicateCarouselItems();
89
- const visibleCarouselItems = this.getVisibleCarouselItems();
90
-
91
- [...carouselItems, ...duplicateCarouselItems].forEach(el => {
92
- el.tabIndex = "-1";
93
-
94
- const links = el.querySelectorAll("a");
95
- links.forEach(link => {
96
- link.tabIndex = "-1";
97
- });
98
- });
99
-
100
- /**
101
- * Set all visible slides and their anchor tags (with no `data-disabletab`) to be tabbable.
102
- */
103
- visibleCarouselItems.forEach(el => {
104
- if (el.firstChild instanceof HTMLAnchorElement) {
105
- el.firstChild.tabIndex = "0";
106
- } else {
107
- el.tabIndex = "0";
108
- }
109
-
110
- const links = el.querySelectorAll(`a:not(${SELECTORS.DISABLED_TAB})`);
111
- links.forEach(link => {
112
- link.tabIndex = "0";
113
- });
114
- });
115
- },
116
- setDotsTabIndex() {
117
- this.carouselDots.forEach(dot => {
118
- dot.tabIndex = "0";
119
- });
120
- },
121
- getCarouselItems() {
122
- return this.$el.querySelectorAll(SELECTORS.ITEMS);
123
- },
124
- getDuplicateCarouselItems() {
125
- return this.$el.querySelectorAll(
126
- `.${CSS_CLASSES.SWIPER_DUPLICATE}${SELECTORS.ITEMS}`
127
- );
128
- },
129
- getVisibleCarouselItems() {
130
- return this.$el.querySelectorAll(
131
- `.${CSS_CLASSES.SWIPER_VISIBLE}${SELECTORS.ITEMS}:not(${SELECTORS.DISABLED_TAB})`
132
- );
133
- },
134
- setSwiperClasses() {
135
- const {
136
- SWIPER_WRAPPER,
137
- SWIPER_NAV_PREV,
138
- SWIPER_NAV_NEXT,
139
- SWIPER_SLIDE,
140
- SWIPER_PAGINATION
141
- } = CSS_CLASSES;
142
- if (this.carouselWrapper)
143
- this.carouselWrapper.classList.add(SWIPER_WRAPPER);
144
-
145
- this.carouselItems.forEach(carouselItem => {
146
- carouselItem.classList.add(SWIPER_SLIDE);
147
- });
148
-
149
- if (this.carouselDotContainer)
150
- this.carouselDotContainer.classList.add(SWIPER_PAGINATION);
151
-
152
- const [left, right] = this.carouselChevrons;
153
- if (left) left.classList.add(SWIPER_NAV_PREV);
154
- if (right) right.classList.add(SWIPER_NAV_NEXT);
155
- },
156
- buildOptions() {
157
- const { options } = this;
158
- return {
159
- ...options,
160
- modules: [Navigation, Pagination]
161
- };
162
- },
163
- bindEvents() {
164
- const events = ["click"];
165
- events.forEach(event => {
166
- this.swiper.on(event, (swiperEvent, nativeEvent) =>
167
- this.$emit(event, { swiperEvent, nativeEvent })
168
- );
169
- });
170
-
171
- this.carouselDots.forEach(dot => {
172
- dot.addEventListener("keypress", e => {
173
- if (e.key === "Enter") e.target.click();
174
- });
175
- });
176
- }
177
- }
178
- };
179
- </script>
180
- <style lang="scss">
181
- .swiper-pagination {
182
- position: static;
183
- margin-top: 1.25rem;
184
-
185
- .swiper-pagination-bullet {
186
- height: 10px;
187
- width: 10px;
188
- margin: 5px 7px;
189
-
190
- &.swiper-pagination-bullet-active {
191
- background-color: #869791;
192
- }
193
- }
194
- }
195
-
196
- .carousel-chevron {
197
- .swiper-button-prev,
198
- .swiper-button-next {
199
- position: static;
200
- right: initial;
201
- left: initial;
202
-
203
- &::after {
204
- content: "";
205
- display: none;
206
- }
207
- }
208
- }
209
- </style>
@@ -1,93 +0,0 @@
1
- <template>
2
- <div data-carousel="chevron" class="carousel-chevron">
3
- <a data-carousel="chevron-left" class="arrow-left effect-black" href>
4
- <svg
5
- viewBox="0 0 24 24"
6
- preserveAspectRatio="xMidYMid meet"
7
- focusable="false"
8
- size="icon-sm"
9
- class="icon"
10
- icon-size="icon-lg"
11
- style="pointer-events: none; display: block;"
12
- >
13
- <g
14
- id="icon-narrow-angle-left-24"
15
- stroke="none"
16
- stroke-width="1"
17
- fill="none"
18
- fill-rule="evenodd"
19
- stroke-linecap="round"
20
- stroke-linejoin="round"
21
- >
22
- <g transform="translate(-196, -226)" stroke="currentColor">
23
- <polyline
24
- transform="translate(209.000000, 237.500000) scale(-1.2, 1.2) rotate(90.000000) translate(-209.000000, -237.500000) "
25
- points="200 242 209 233 218 242"
26
- />
27
- </g>
28
- </g>
29
- </svg>
30
- </a>
31
- <a data-carousel="chevron-right" class="arrow-right effect-black" href>
32
- <svg
33
- viewBox="0 0 24 24"
34
- preserveAspectRatio="xMidYMid meet"
35
- focusable="false"
36
- size="icon-sm"
37
- class="icon"
38
- icon-size="icon-lg"
39
- style="pointer-events: none; display: block;"
40
- >
41
- <g
42
- id="icon-narrow-angle-right-24"
43
- stroke="none"
44
- stroke-width="1"
45
- fill="none"
46
- fill-rule="evenodd"
47
- stroke-linecap="round"
48
- stroke-linejoin="round"
49
- >
50
- <g transform="translate(-196, -226)" stroke="currentColor">
51
- <polyline
52
- transform="translate(209.000000, 237.500000) scale(-1.2, 1.2) rotate(-90.000000) translate(-209.000000, -237.500000) "
53
- points="200 242 209 233 218 242"
54
- />
55
- </g>
56
- </g>
57
- </svg>
58
- </a>
59
- </div>
60
- </template>
61
- <script>
62
- export default {
63
- name: "CarouselChevron"
64
- };
65
- </script>
66
- <style lang="scss">
67
- .carousel-chevron {
68
- display: flex;
69
- flex-wrap: wrap;
70
- gap: 20px;
71
-
72
- .arrow-left,
73
- .arrow-right {
74
- height: auto;
75
- width: auto;
76
- padding: 10px;
77
- border: 2px solid black;
78
- border-radius: 3px;
79
- cursor: pointer;
80
- color: inherit !important;
81
-
82
- svg {
83
- height: 20px;
84
- width: 20px;
85
-
86
- &:hover {
87
- fill: var(--theme__color3);
88
- color: var(--theme__color3);
89
- }
90
- }
91
- }
92
- }
93
- </style>
@@ -1,72 +0,0 @@
1
- <template>
2
- <div class="preloader">
3
- <div class="loader"></div>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: "Loader"
10
- };
11
- </script>
12
-
13
- <style scoped lang="scss">
14
- .preloader {
15
- position: absolute;
16
- top: 0;
17
- left: 0;
18
- width: 100%;
19
- height: 100%;
20
- z-index: 10;
21
-
22
- .loader {
23
- display: inline-block;
24
- position: relative;
25
- width: 9.375rem;
26
- height: 9.375rem;
27
- border-radius: 50%;
28
- border: 3px solid transparent;
29
- border-top-color: #9370db;
30
- animation: spin 2s linear infinite;
31
- left: 50%;
32
- top: 50%;
33
- margin: -4.7rem 0 0 -4.7rem;
34
-
35
- &::before,
36
- &::after {
37
- content: " ";
38
- position: absolute;
39
- border-radius: 50%;
40
- border: 3px solid transparent;
41
- }
42
-
43
- &::before {
44
- top: 5px;
45
- left: 5px;
46
- right: 5px;
47
- bottom: 5px;
48
- border-top-color: #ba55d3;
49
- animation: spin 3s linear infinite;
50
- }
51
-
52
- &::after {
53
- top: 15px;
54
- left: 15px;
55
- right: 15px;
56
- bottom: 15px;
57
- border-top-color: #f56767;
58
- animation: spin 1.5s linear infinite;
59
- }
60
- }
61
- }
62
-
63
- @keyframes spin {
64
- 0% {
65
- transform: rotate(0deg);
66
- }
67
-
68
- 100% {
69
- transform: rotate(360deg);
70
- }
71
- }
72
- </style>