@times-components/ts-components 1.146.2-a0ffbb6bc2acbec91d140a39f6be06256e702094.5 → 1.146.2-c12ed7999a41984c2ba8c437357e7a5df1914881.48

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.
Files changed (137) hide show
  1. package/dist/components/carousel-component/CarouselComponent.stories.d.ts +1 -0
  2. package/dist/components/carousel-component/CarouselComponent.stories.js +146 -0
  3. package/dist/components/carousel-component/CarouselItem.d.ts +3 -0
  4. package/dist/components/carousel-component/CarouselItem.js +12 -0
  5. package/dist/components/carousel-component/DefaultNavigationArrow.d.ts +8 -0
  6. package/dist/components/carousel-component/DefaultNavigationArrow.js +6 -0
  7. package/dist/components/carousel-component/DefaultPageDot.d.ts +8 -0
  8. package/dist/components/carousel-component/DefaultPageDot.js +4 -0
  9. package/dist/components/carousel-component/__tests__/CarouselComponent.test.d.ts +1 -0
  10. package/dist/components/carousel-component/__tests__/CarouselComponent.test.js +163 -0
  11. package/dist/components/carousel-component/__tests__/CarouselItem.test.d.ts +1 -0
  12. package/dist/components/carousel-component/__tests__/CarouselItem.test.js +80 -0
  13. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.d.ts +1 -0
  14. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.js +62 -0
  15. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.d.ts +1 -0
  16. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.js +68 -0
  17. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.d.ts +1 -0
  18. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.js +459 -0
  19. package/dist/components/carousel-component/hooks/useCarousel.d.ts +2 -0
  20. package/dist/components/carousel-component/hooks/useCarousel.js +167 -0
  21. package/dist/components/carousel-component/index.d.ts +4 -0
  22. package/dist/components/carousel-component/index.js +20 -0
  23. package/dist/components/carousel-component/styles.d.ts +28 -0
  24. package/dist/components/carousel-component/styles.js +172 -0
  25. package/dist/components/carousel-component/types.d.ts +53 -0
  26. package/dist/components/carousel-component/types.js +2 -0
  27. package/dist/components/social-embed/SocialMediaEmbed.js +15 -122
  28. package/dist/components/social-embed/SocialVendor.d.ts +16 -1
  29. package/dist/components/social-embed/SocialVendor.js +2 -41
  30. package/dist/components/social-embed/__tests__/SocialVendor.test.js +1 -8
  31. package/dist/components/social-embed/constants.d.ts +0 -1
  32. package/dist/components/social-embed/constants.js +2 -3
  33. package/dist/components/social-embed/helpers/socialMediaVendors.js +1 -6
  34. package/dist/components/social-embed/styles.d.ts +0 -1
  35. package/dist/components/social-embed/styles.js +1 -28
  36. package/dist/components/trip-cards/SkeletonCard.d.ts +7 -0
  37. package/dist/components/trip-cards/SkeletonCard.js +22 -0
  38. package/dist/components/trip-cards/TripCard.d.ts +3 -0
  39. package/dist/components/trip-cards/TripCard.js +61 -0
  40. package/dist/components/trip-cards/TripCards.stories.d.ts +1 -0
  41. package/dist/components/trip-cards/TripCards.stories.js +159 -0
  42. package/dist/components/trip-cards/TripCardsLayout.d.ts +3 -0
  43. package/dist/components/trip-cards/TripCardsLayout.js +63 -0
  44. package/dist/components/trip-cards/__tests__/SkeletonCard.test.d.ts +1 -0
  45. package/dist/components/trip-cards/__tests__/SkeletonCard.test.js +139 -0
  46. package/dist/components/trip-cards/__tests__/TripCard.test.d.ts +1 -0
  47. package/dist/components/trip-cards/__tests__/TripCard.test.js +165 -0
  48. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.d.ts +1 -0
  49. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.js +353 -0
  50. package/dist/components/trip-cards/__tests__/assets.test.d.ts +1 -0
  51. package/dist/components/trip-cards/__tests__/assets.test.js +165 -0
  52. package/dist/components/trip-cards/__tests__/helpers.test.d.ts +1 -0
  53. package/dist/components/trip-cards/__tests__/helpers.test.js +221 -0
  54. package/dist/components/trip-cards/__tests__/index.test.d.ts +1 -0
  55. package/dist/components/trip-cards/__tests__/index.test.js +482 -0
  56. package/dist/components/trip-cards/__tests__/mockData.test.d.ts +1 -0
  57. package/dist/components/trip-cards/__tests__/mockData.test.js +57 -0
  58. package/dist/components/trip-cards/__tests__/skeletonStyles.test.d.ts +1 -0
  59. package/dist/components/trip-cards/__tests__/skeletonStyles.test.js +194 -0
  60. package/dist/components/trip-cards/assets/BoatIcon.d.ts +1 -0
  61. package/dist/components/trip-cards/assets/BoatIcon.js +4 -0
  62. package/dist/components/trip-cards/assets/CalendarIcon.d.ts +1 -0
  63. package/dist/components/trip-cards/assets/CalendarIcon.js +4 -0
  64. package/dist/components/trip-cards/assets/ChevronRightIcon.d.ts +1 -0
  65. package/dist/components/trip-cards/assets/ChevronRightIcon.js +4 -0
  66. package/dist/components/trip-cards/assets/LocationIcon.d.ts +1 -0
  67. package/dist/components/trip-cards/assets/LocationIcon.js +4 -0
  68. package/dist/components/trip-cards/assets/MoonIcon.d.ts +1 -0
  69. package/dist/components/trip-cards/assets/MoonIcon.js +4 -0
  70. package/dist/components/trip-cards/assets/index.d.ts +6 -0
  71. package/dist/components/trip-cards/assets/index.js +7 -0
  72. package/dist/components/trip-cards/helpers.d.ts +11 -0
  73. package/dist/components/trip-cards/helpers.js +144 -0
  74. package/dist/components/trip-cards/index.d.ts +4 -0
  75. package/dist/components/trip-cards/index.js +68 -0
  76. package/dist/components/trip-cards/mockData.d.ts +3 -0
  77. package/dist/components/trip-cards/mockData.js +317 -0
  78. package/dist/components/trip-cards/skeletonStyles.d.ts +9 -0
  79. package/dist/components/trip-cards/skeletonStyles.js +37 -0
  80. package/dist/components/trip-cards/styles.d.ts +43 -0
  81. package/dist/components/trip-cards/styles.js +404 -0
  82. package/dist/components/trip-cards/types.d.ts +121 -0
  83. package/dist/components/trip-cards/types.js +2 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.js +2 -1
  86. package/dist/utils/cookie.d.ts +1 -0
  87. package/dist/utils/cookie.js +8 -1
  88. package/package.json +3 -3
  89. package/rnw.js +1 -1
  90. package/src/components/carousel-component/CarouselComponent.stories.tsx +220 -0
  91. package/src/components/carousel-component/CarouselItem.tsx +26 -0
  92. package/src/components/carousel-component/DefaultNavigationArrow.tsx +37 -0
  93. package/src/components/carousel-component/DefaultPageDot.tsx +20 -0
  94. package/src/components/carousel-component/__tests__/CarouselComponent.test.tsx +259 -0
  95. package/src/components/carousel-component/__tests__/CarouselItem.test.tsx +140 -0
  96. package/src/components/carousel-component/__tests__/DefaultNavigationArrow.test.tsx +153 -0
  97. package/src/components/carousel-component/__tests__/DefaultPageDot.test.tsx +105 -0
  98. package/src/components/carousel-component/hooks/__tests__/useCarousel.test.ts +625 -0
  99. package/src/components/carousel-component/hooks/useCarousel.ts +229 -0
  100. package/src/components/carousel-component/index.tsx +92 -0
  101. package/src/components/carousel-component/styles.ts +188 -0
  102. package/src/components/carousel-component/types.ts +62 -0
  103. package/src/components/social-embed/SocialMediaEmbed.tsx +1 -111
  104. package/src/components/social-embed/SocialVendor.tsx +1 -46
  105. package/src/components/social-embed/__tests__/SocialVendor.test.tsx +0 -11
  106. package/src/components/social-embed/constants.ts +1 -2
  107. package/src/components/social-embed/helpers/socialMediaVendors.ts +0 -5
  108. package/src/components/social-embed/styles.ts +0 -30
  109. package/src/components/trip-cards/SkeletonCard.tsx +64 -0
  110. package/src/components/trip-cards/TripCard.tsx +172 -0
  111. package/src/components/trip-cards/TripCards.stories.tsx +224 -0
  112. package/src/components/trip-cards/TripCardsLayout.tsx +162 -0
  113. package/src/components/trip-cards/__tests__/SkeletonCard.test.tsx +169 -0
  114. package/src/components/trip-cards/__tests__/TripCard.test.tsx +255 -0
  115. package/src/components/trip-cards/__tests__/TripCardsLayout.test.tsx +671 -0
  116. package/src/components/trip-cards/__tests__/assets.test.tsx +206 -0
  117. package/src/components/trip-cards/__tests__/helpers.test.ts +273 -0
  118. package/src/components/trip-cards/__tests__/index.test.tsx +554 -0
  119. package/src/components/trip-cards/__tests__/mockData.test.ts +67 -0
  120. package/src/components/trip-cards/__tests__/skeletonStyles.test.tsx +256 -0
  121. package/src/components/trip-cards/assets/BoatIcon.tsx +17 -0
  122. package/src/components/trip-cards/assets/CalendarIcon.tsx +17 -0
  123. package/src/components/trip-cards/assets/ChevronRightIcon.tsx +20 -0
  124. package/src/components/trip-cards/assets/LocationIcon.tsx +17 -0
  125. package/src/components/trip-cards/assets/MoonIcon.tsx +17 -0
  126. package/src/components/trip-cards/assets/index.ts +7 -0
  127. package/src/components/trip-cards/helpers.ts +181 -0
  128. package/src/components/trip-cards/index.tsx +120 -0
  129. package/src/components/trip-cards/mockData.ts +345 -0
  130. package/src/components/trip-cards/skeletonStyles.ts +46 -0
  131. package/src/components/trip-cards/styles.ts +450 -0
  132. package/src/components/trip-cards/types.ts +130 -0
  133. package/src/index.ts +2 -0
  134. package/src/utils/cookie.ts +8 -0
  135. package/dist/components/social-embed/components/FacebookComponent.d.ts +0 -6
  136. package/dist/components/social-embed/components/FacebookComponent.js +0 -74
  137. package/src/components/social-embed/components/FacebookComponent.tsx +0 -93
@@ -0,0 +1,229 @@
1
+ import { useState, useEffect, useRef, useCallback } from 'react';
2
+ import { UseCarouselOptions, UseCarouselReturn } from '../types';
3
+
4
+ const DRAG_THRESHOLD = 30;
5
+
6
+ export const useCarousel = (
7
+ totalItems: number,
8
+ options: UseCarouselOptions = {}
9
+ ): UseCarouselReturn => {
10
+ const { itemsPerPage = 2, onPageChange } = options;
11
+
12
+ const [currentPage, setCurrentPage] = useState(0);
13
+ const carouselRef = useRef<HTMLDivElement>(null);
14
+ const isScrollingRef = useRef(false);
15
+ const isDraggingRef = useRef(false);
16
+ const startXRef = useRef(0);
17
+ const touchStartXRef = useRef<number | null>(null);
18
+ const isSwipingRef = useRef(false);
19
+
20
+ const totalPages = Math.ceil(totalItems / itemsPerPage);
21
+
22
+ const scrollToPage = useCallback(
23
+ (page: number) => {
24
+ if (carouselRef.current) {
25
+ const cardElements = carouselRef.current.children;
26
+
27
+ if (cardElements.length > 0) {
28
+ isScrollingRef.current = true;
29
+
30
+ const container = carouselRef.current;
31
+ const targetCardIndex = page * itemsPerPage;
32
+ const targetCard = cardElements[targetCardIndex] as HTMLElement;
33
+
34
+ if (targetCard) {
35
+ const targetScroll = targetCard.offsetLeft;
36
+
37
+ container.scrollTo({
38
+ left: targetScroll,
39
+ behavior: 'smooth'
40
+ });
41
+ setCurrentPage(page);
42
+
43
+ if (onPageChange) {
44
+ onPageChange(page);
45
+ }
46
+
47
+ setTimeout(() => {
48
+ isScrollingRef.current = false;
49
+ }, 400);
50
+ }
51
+ }
52
+ }
53
+ },
54
+ [itemsPerPage, onPageChange]
55
+ );
56
+
57
+ const handlePrevious = useCallback(
58
+ () => {
59
+ const newPage = Math.max(0, currentPage - 1);
60
+ scrollToPage(newPage);
61
+ },
62
+ [currentPage, scrollToPage]
63
+ );
64
+
65
+ const handleNext = useCallback(
66
+ () => {
67
+ const newPage = Math.min(totalPages - 1, currentPage + 1);
68
+ scrollToPage(newPage);
69
+ },
70
+ [currentPage, totalPages, scrollToPage]
71
+ );
72
+
73
+ const handleDragNavigation = useCallback(
74
+ (diff: number) => {
75
+ if (Math.abs(diff) > DRAG_THRESHOLD) {
76
+ if (diff > 0) {
77
+ handleNext();
78
+ } else {
79
+ handlePrevious();
80
+ }
81
+ }
82
+ },
83
+ [handleNext, handlePrevious]
84
+ );
85
+
86
+ const handleMouseDown = useCallback((e: React.MouseEvent) => {
87
+ if (!carouselRef.current) {
88
+ return;
89
+ }
90
+ e.preventDefault();
91
+ isDraggingRef.current = true;
92
+ startXRef.current = e.pageX;
93
+ carouselRef.current.style.cursor = 'grabbing';
94
+ }, []);
95
+
96
+ const handleMouseUp = useCallback(
97
+ (e: React.MouseEvent) => {
98
+ if (!isDraggingRef.current) {
99
+ return;
100
+ }
101
+ isDraggingRef.current = false;
102
+
103
+ if (carouselRef.current) {
104
+ carouselRef.current.style.cursor = 'grab';
105
+
106
+ const endX = e.pageX;
107
+ const diff = startXRef.current - endX;
108
+
109
+ handleDragNavigation(diff);
110
+ }
111
+ },
112
+ [handleDragNavigation]
113
+ );
114
+
115
+ const handleMouseLeave = useCallback(
116
+ (e: React.MouseEvent) => {
117
+ if (!isDraggingRef.current) {
118
+ return;
119
+ }
120
+ isDraggingRef.current = false;
121
+
122
+ if (carouselRef.current) {
123
+ carouselRef.current.style.cursor = 'grab';
124
+
125
+ const endX = e.pageX;
126
+ const diff = startXRef.current - endX;
127
+
128
+ handleDragNavigation(diff);
129
+ }
130
+ },
131
+ [handleDragNavigation]
132
+ );
133
+
134
+ const handleTouchStart = (e: React.TouchEvent) => {
135
+ if (!carouselRef.current) {
136
+ return;
137
+ }
138
+ touchStartXRef.current = e.touches[0].clientX;
139
+ isSwipingRef.current = false;
140
+ };
141
+
142
+ const handleTouchMove = (e: React.TouchEvent) => {
143
+ if (touchStartXRef.current === null || isSwipingRef.current) {
144
+ return;
145
+ }
146
+
147
+ const currentX = e.touches[0].clientX;
148
+ const diff = touchStartXRef.current - currentX;
149
+
150
+ if (Math.abs(diff) > DRAG_THRESHOLD) {
151
+ isSwipingRef.current = true;
152
+ handleDragNavigation(diff);
153
+ }
154
+ };
155
+
156
+ const handleTouchEnd = () => {
157
+ touchStartXRef.current = null;
158
+ isSwipingRef.current = false;
159
+ };
160
+
161
+ const handleScroll = useCallback(
162
+ () => {
163
+ if (isScrollingRef.current) {
164
+ return;
165
+ }
166
+
167
+ if (carouselRef.current) {
168
+ const container = carouselRef.current;
169
+ const children = container.children;
170
+ if (children.length === 0) {
171
+ return;
172
+ }
173
+
174
+ const scrollLeft = container.scrollLeft;
175
+
176
+ let closestPage = 0;
177
+ let closestDistance = Infinity;
178
+
179
+ for (let page = 0; page < totalPages; page++) {
180
+ const cardIndex = page * itemsPerPage;
181
+ if (cardIndex < children.length) {
182
+ const card = children[cardIndex] as HTMLElement;
183
+ const distance = Math.abs(card.offsetLeft - scrollLeft);
184
+ if (distance < closestDistance) {
185
+ closestDistance = distance;
186
+ closestPage = page;
187
+ }
188
+ }
189
+ }
190
+
191
+ if (closestPage !== currentPage) {
192
+ setCurrentPage(closestPage);
193
+ if (onPageChange) {
194
+ onPageChange(closestPage);
195
+ }
196
+ }
197
+ }
198
+ },
199
+ [totalPages, itemsPerPage, onPageChange]
200
+ );
201
+
202
+ useEffect(
203
+ () => {
204
+ const carousel = carouselRef.current;
205
+ if (carousel) {
206
+ carousel.addEventListener('scroll', handleScroll);
207
+ return () => carousel.removeEventListener('scroll', handleScroll);
208
+ }
209
+ return undefined;
210
+ },
211
+ [handleScroll]
212
+ );
213
+
214
+ return {
215
+ currentPage,
216
+ totalPages,
217
+ carouselRef,
218
+ isScrolling: isScrollingRef.current,
219
+ handlePrevious,
220
+ handleNext,
221
+ scrollToPage,
222
+ handleMouseDown,
223
+ handleMouseUp,
224
+ handleMouseLeave,
225
+ handleTouchStart,
226
+ handleTouchMove,
227
+ handleTouchEnd
228
+ };
229
+ };
@@ -0,0 +1,92 @@
1
+ import React from 'react';
2
+ import { useCarousel } from './hooks/useCarousel';
3
+ import {
4
+ CarouselContainer,
5
+ CarouselWrapper,
6
+ CarouselContent,
7
+ CardsRow,
8
+ PageControl
9
+ } from './styles';
10
+ import { DefaultNavigationArrow } from './DefaultNavigationArrow';
11
+ import { DefaultPageDot } from './DefaultPageDot';
12
+ import { CarouselComponentProps } from './types';
13
+
14
+ export const CarouselComponent: React.FC<CarouselComponentProps> = ({
15
+ items,
16
+ options,
17
+ showArrows = true,
18
+ showDots = true,
19
+ arrowComponent: CustomArrow,
20
+ dotComponent: CustomDot,
21
+ className
22
+ }) => {
23
+ const {
24
+ currentPage,
25
+ totalPages,
26
+ carouselRef,
27
+ handlePrevious,
28
+ handleNext,
29
+ scrollToPage,
30
+ handleMouseDown,
31
+ handleMouseUp,
32
+ handleMouseLeave,
33
+ handleTouchStart,
34
+ handleTouchMove,
35
+ handleTouchEnd
36
+ } = useCarousel(items.length, options);
37
+
38
+ const ArrowComponent = CustomArrow || DefaultNavigationArrow;
39
+ const DotComponent = CustomDot || DefaultPageDot;
40
+
41
+ return (
42
+ <CarouselContainer className={className}>
43
+ <CarouselWrapper>
44
+ {showArrows && (
45
+ <ArrowComponent
46
+ direction="left"
47
+ onClick={handlePrevious}
48
+ disabled={currentPage === 0}
49
+ />
50
+ )}
51
+
52
+ <CarouselContent>
53
+ <CardsRow
54
+ ref={carouselRef}
55
+ onMouseDown={handleMouseDown}
56
+ onMouseUp={handleMouseUp}
57
+ onMouseLeave={handleMouseLeave}
58
+ onTouchStart={handleTouchStart}
59
+ onTouchMove={handleTouchMove}
60
+ onTouchEnd={handleTouchEnd}
61
+ >
62
+ {items}
63
+ </CardsRow>
64
+ </CarouselContent>
65
+
66
+ {showArrows && (
67
+ <ArrowComponent
68
+ direction="right"
69
+ onClick={handleNext}
70
+ disabled={currentPage >= totalPages - 1}
71
+ />
72
+ )}
73
+ </CarouselWrapper>
74
+
75
+ {showDots &&
76
+ totalPages > 1 && (
77
+ <PageControl>
78
+ {Array.from({ length: totalPages }).map((_, pageIndex) => (
79
+ <DotComponent
80
+ key={pageIndex}
81
+ active={pageIndex === currentPage}
82
+ onClick={() => scrollToPage(pageIndex)}
83
+ index={pageIndex}
84
+ />
85
+ ))}
86
+ </PageControl>
87
+ )}
88
+ </CarouselContainer>
89
+ );
90
+ };
91
+
92
+ export { CarouselItem } from './CarouselItem';
@@ -0,0 +1,188 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { ResponsiveConfig } from './types';
3
+ export const breakpoints = {
4
+ xs: '0px',
5
+ sm: '520px',
6
+ md: '768px',
7
+ lg: '1024px',
8
+ xl: '1320px'
9
+ };
10
+
11
+ export const colors = {
12
+ primary: '#005C8A',
13
+ white: '#FFFFFF'
14
+ };
15
+
16
+ export const ItemContainer = styled.div<{
17
+ widthItemConfig?: ResponsiveConfig;
18
+ maxWidthItemConfig?: ResponsiveConfig;
19
+ }>`
20
+ scroll-snap-align: start;
21
+ display: flex;
22
+ flex-direction: column;
23
+ align-self: stretch;
24
+
25
+ ${props => {
26
+ if (!props.widthItemConfig) {
27
+ return '';
28
+ }
29
+ const { xs, mobile, tablet, desktop, xl } = props.widthItemConfig;
30
+ return css`
31
+ ${xs && `flex: 0 0 ${xs};`}
32
+ ${mobile &&
33
+ `
34
+ @media (min-width: ${breakpoints.sm}) {
35
+ flex: 0 0 ${mobile};
36
+ }
37
+ `}
38
+ ${tablet &&
39
+ `
40
+ @media (min-width: ${breakpoints.md}) {
41
+ flex: 0 0 ${tablet};
42
+ }
43
+ `}
44
+ ${desktop &&
45
+ `
46
+ @media (min-width: ${breakpoints.lg}) {
47
+ flex: 0 0 ${desktop};
48
+ }
49
+ `}
50
+ ${xl &&
51
+ `
52
+ @media (min-width: ${breakpoints.xl}) {
53
+ flex: 0 0 ${xl};
54
+ }
55
+ `}
56
+ `;
57
+ }} ${props => {
58
+ if (!props.maxWidthItemConfig) {
59
+ return '';
60
+ }
61
+ const { xs, mobile, tablet, desktop, xl } = props.maxWidthItemConfig;
62
+ return css`
63
+ ${xs && `max-width: ${xs};`}
64
+ ${mobile &&
65
+ `
66
+ @media (min-width: ${breakpoints.sm}) {
67
+ max-width: ${mobile};
68
+ }
69
+ `}
70
+ ${tablet &&
71
+ `
72
+ @media (min-width: ${breakpoints.md}) {
73
+ max-width: ${tablet};
74
+ }
75
+ `}
76
+ ${desktop &&
77
+ `
78
+ @media (min-width: ${breakpoints.lg}) {
79
+ max-width: ${desktop};
80
+ }
81
+ `}
82
+ ${xl &&
83
+ `
84
+ @media (min-width: ${breakpoints.xl}) {
85
+ max-width: ${xl};
86
+ }
87
+ `}
88
+ `;
89
+ }};
90
+ `;
91
+
92
+ export const CarouselContainer = styled.div`
93
+ width: 100%;
94
+ `;
95
+
96
+ export const CarouselWrapper = styled.div`
97
+ position: relative;
98
+ width: 100%;
99
+ `;
100
+
101
+ export const CarouselContent = styled.div`
102
+ overflow: hidden;
103
+ `;
104
+
105
+ export const CardsRow = styled.div`
106
+ display: flex;
107
+ gap: 20px;
108
+ overflow-x: hidden;
109
+ scroll-snap-type: x mandatory;
110
+ scrollbar-width: none;
111
+ -ms-overflow-style: none;
112
+ padding: 0;
113
+ scroll-behavior: smooth;
114
+ cursor: grab;
115
+ user-select: none;
116
+ align-items: stretch;
117
+
118
+ &::-webkit-scrollbar {
119
+ display: none;
120
+ }
121
+
122
+ &:active {
123
+ cursor: grabbing;
124
+ }
125
+ `;
126
+
127
+ export const PageControl = styled.div`
128
+ display: flex;
129
+ justify-content: center;
130
+ align-items: center;
131
+ gap: 10px;
132
+ padding: 12px;
133
+ background: ${colors.white};
134
+ `;
135
+
136
+ export const NavigationArrowButton = styled.button<{
137
+ direction: 'left' | 'right';
138
+ disabled?: boolean;
139
+ }>`
140
+ display: none;
141
+ position: absolute;
142
+ top: 50%;
143
+ transform: translateY(-50%);
144
+ ${({ direction }) =>
145
+ direction === 'left' ? 'left: -68px;' : 'right: -68px;'} z-index: 10;
146
+ width: 48px;
147
+ height: 48px;
148
+ border: none;
149
+ border-radius: 50%;
150
+ background: ${({ disabled }) => (disabled ? '#CCCCCC' : colors.primary)};
151
+ cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
152
+ align-items: center;
153
+ justify-content: center;
154
+ transition: background 0.2s ease;
155
+ pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')};
156
+
157
+ svg {
158
+ width: 24px;
159
+ height: 24px;
160
+ }
161
+
162
+ svg path {
163
+ stroke: ${colors.white};
164
+ }
165
+
166
+ &:hover:not(:disabled) {
167
+ background: #004a6e;
168
+ }
169
+
170
+ @media (min-width: ${breakpoints.lg}) {
171
+ display: flex;
172
+ }
173
+ `;
174
+
175
+ export const PageDotButton = styled.button<{ active: boolean }>`
176
+ width: 8px;
177
+ height: 8px;
178
+ border-radius: 1000px;
179
+ border: none;
180
+ padding: 0;
181
+ background: ${({ active }) => (active ? '#01000D' : '#AAAAAA')};
182
+ cursor: pointer;
183
+ transition: background 0.2s ease;
184
+
185
+ &:hover {
186
+ background: #01000d;
187
+ }
188
+ `;
@@ -0,0 +1,62 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface ResponsiveConfig {
4
+ xs?: string;
5
+ mobile?: string;
6
+ tablet?: string;
7
+ desktop?: string;
8
+ xl?: string;
9
+ }
10
+
11
+ export type ResponsiveConfigNoXs = Omit<ResponsiveConfig, 'xs'>;
12
+
13
+ export interface ArrowComponentProps {
14
+ direction: 'left' | 'right';
15
+ onClick: () => void;
16
+ disabled: boolean;
17
+ }
18
+
19
+ export interface DotComponentProps {
20
+ active: boolean;
21
+ onClick: () => void;
22
+ index: number;
23
+ }
24
+
25
+ export interface CarouselComponentProps {
26
+ items: ReactNode[];
27
+ options?: UseCarouselOptions;
28
+ showArrows?: boolean;
29
+ showDots?: boolean;
30
+ arrowComponent?: React.ComponentType<ArrowComponentProps>;
31
+ dotComponent?: React.ComponentType<DotComponentProps>;
32
+ className?: string;
33
+ }
34
+
35
+ export interface CarouselItemProps {
36
+ children: ReactNode;
37
+ widthItemConfig?: ResponsiveConfig;
38
+ maxWidthItemConfig?: ResponsiveConfig;
39
+ className?: string;
40
+ }
41
+
42
+ // Carousel Hook Types
43
+ export interface UseCarouselOptions {
44
+ itemsPerPage?: number;
45
+ onPageChange?: (page: number) => void;
46
+ }
47
+
48
+ export interface UseCarouselReturn {
49
+ currentPage: number;
50
+ totalPages: number;
51
+ carouselRef: React.RefObject<HTMLDivElement>;
52
+ isScrolling: boolean;
53
+ handlePrevious: () => void;
54
+ handleNext: () => void;
55
+ scrollToPage: (page: number) => void;
56
+ handleMouseDown: (e: React.MouseEvent) => void;
57
+ handleMouseUp: (e: React.MouseEvent) => void;
58
+ handleMouseLeave: (e: React.MouseEvent<Element, MouseEvent>) => void;
59
+ handleTouchStart: (e: React.TouchEvent) => void;
60
+ handleTouchMove: (e: React.TouchEvent) => void;
61
+ handleTouchEnd: () => void;
62
+ }
@@ -1,4 +1,4 @@
1
- /* import React, { FC, useEffect } from 'react';
1
+ import React, { FC, useEffect } from 'react';
2
2
  import { BlockedEmbedMessage } from './BlockedEmbedMessage';
3
3
  import { checkVendorConsent } from './helpers/vendorConsent';
4
4
  import { eventStatus } from './constants';
@@ -74,113 +74,3 @@ export const SocialMediaEmbed: FC<SocialMediaEmbedProps> = ({
74
74
  <BlockedEmbedMessage vendorName={vendorName} />
75
75
  );
76
76
  };
77
- */
78
-
79
- import React, { FC, useEffect } from 'react';
80
- import { BlockedEmbedMessage } from './BlockedEmbedMessage';
81
- import { checkVendorConsent } from './helpers/vendorConsent';
82
- import { eventStatus } from './constants';
83
- import { TcData, VendorName } from './types';
84
- import { useSocialEmbedsContext } from '../../contexts/SocialEmbedsProvider';
85
- import { Vendor } from './SocialVendor';
86
-
87
- declare global {
88
- interface Window {
89
- __tcfapi?: (
90
- command: string,
91
- version: number,
92
- callback: (data: TcData, success: boolean) => void,
93
- listenerId?: number
94
- ) => void;
95
- twttr?: {
96
- widgets: {
97
- load: (element?: HTMLElement) => void;
98
- };
99
- };
100
- instgrm?: {
101
- Embeds?: {
102
- process: () => void;
103
- };
104
- };
105
- }
106
- }
107
-
108
- export type SocialMediaEmbedProps = {
109
- element?: any;
110
- url: string;
111
- vendorName: VendorName;
112
- id: string;
113
- };
114
-
115
- export const SocialMediaEmbed: FC<SocialMediaEmbedProps> = ({
116
- id,
117
- url,
118
- vendorName
119
- }) => {
120
- const {
121
- setIsSocialEmbedAllowed,
122
- isAllowedOnce,
123
- isSocialEmbedAllowed
124
- } = useSocialEmbedsContext();
125
-
126
- useEffect(() => {
127
- if (!window.__tcfapi) return;
128
-
129
- // ✅ 1. READ CURRENT CONSENT IMMEDIATELY
130
- const initialConsent = checkVendorConsent(vendorName);
131
- setIsSocialEmbedAllowed(prev => ({
132
- ...prev,
133
- [vendorName]: initialConsent
134
- }));
135
-
136
- // ✅ 2. LISTEN FOR FUTURE CHANGES
137
- window.__tcfapi('addEventListener', 2, (tcData, success) => {
138
- if (
139
- success &&
140
- (tcData.eventStatus === eventStatus.tcLoaded ||
141
- tcData.eventStatus === eventStatus.userActionComplete)
142
- ) {
143
- const consent = checkVendorConsent(vendorName);
144
- setIsSocialEmbedAllowed(prev => ({
145
- ...prev,
146
- [vendorName]: consent
147
- }));
148
- }
149
- });
150
- }, [vendorName, setIsSocialEmbedAllowed]);
151
-
152
-
153
- /* useEffect(() => {
154
- if (!window.__tcfapi) return;
155
-
156
- // Listen to CMP consent updates
157
- window.__tcfapi('addEventListener', 2, (_tcData: TcData, success: boolean) => {
158
- if (
159
- !success ||
160
- _tcData.eventStatus === eventStatus.tcLoaded ||
161
- _tcData.eventStatus === eventStatus.userActionComplete
162
- ) {
163
- // Use old checkVendorConsent function
164
- const consent = checkVendorConsent(vendorName);
165
-
166
- setIsSocialEmbedAllowed(prev => ({
167
- ...prev,
168
- [vendorName]: consent
169
- }));
170
- }
171
- });
172
- }, [vendorName, setIsSocialEmbedAllowed]); */
173
-
174
- // Only render the social component if consent or allowed once
175
- const allowed =
176
- isSocialEmbedAllowed[vendorName] === true ||
177
- isAllowedOnce[vendorName] === true;
178
-
179
- return allowed ? (
180
- <div id={id}>
181
- <Vendor vendorName={vendorName} url={url} />
182
- </div>
183
- ) : (
184
- <BlockedEmbedMessage vendorName={vendorName} />
185
- );
186
- };