hds-web 1.3.9 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +2 -2
- package/dist/index.es.css +2 -2
- package/dist/index.es.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/HDS/components/Cards/Misc/talkcard2.js +1 -1
- package/src/HDS/components/Carousels/carouselCard.js +51 -33
- package/src/HDS/helpers/Grid/grid.js +6 -3
- package/src/styles/tailwind.css +29 -117
@@ -1,6 +1,8 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import { useRef } from "react";
|
2
3
|
import { Icon } from "../common-components/Icon";
|
3
4
|
export default function CarouselCard(props) {
|
5
|
+
const carouselRef = useRef(null); // Create a ref using useRef
|
4
6
|
const [currentCard, setCurrentCard] = React.useState(0);
|
5
7
|
const [touchStart, setTouchStart] = React.useState(0);
|
6
8
|
const [touchEnd, setTouchEnd] = React.useState(0);
|
@@ -28,49 +30,62 @@ export default function CarouselCard(props) {
|
|
28
30
|
return acc;
|
29
31
|
}, {});
|
30
32
|
|
31
|
-
|
32
|
-
setCurrentCard(i);
|
33
|
-
|
34
|
-
if (refs[i] && refs[i].current) {
|
35
|
-
refs[i].current.scrollIntoView({
|
36
|
-
behavior: "smooth",
|
37
|
-
block: "nearest",
|
38
|
-
inline: "start",
|
39
|
-
});
|
40
|
-
}
|
41
|
-
};
|
33
|
+
|
42
34
|
|
43
35
|
const totalCards = props.cards.length;
|
44
36
|
|
45
37
|
const nextCard = () => {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
38
|
+
let scrollByAmount = 1;
|
39
|
+
if (window.innerWidth > 800) {
|
40
|
+
scrollByAmount = 2;
|
41
|
+
}
|
42
|
+
if (window.innerWidth > 1140) {
|
43
|
+
scrollByAmount = 3;
|
44
|
+
}
|
45
|
+
|
46
|
+
if (currentCard < totalCards - scrollByAmount) {
|
47
|
+
setCurrentCard(currentCard + scrollByAmount);
|
48
|
+
carouselRef.current.scrollTo({
|
49
|
+
left: carouselRef.current.scrollLeft + carouselRef.current.children[0].offsetWidth * scrollByAmount,
|
50
|
+
behavior: "smooth",
|
51
|
+
});
|
55
52
|
}
|
53
|
+
else {
|
54
|
+
setCurrentCard(0);
|
55
|
+
carouselRef.current.scrollTo({
|
56
|
+
left: 0,
|
57
|
+
behavior: "smooth",
|
58
|
+
});
|
59
|
+
}
|
56
60
|
};
|
57
|
-
|
61
|
+
|
58
62
|
const previousCard = () => {
|
59
|
-
let scrollByAmount =
|
63
|
+
let scrollByAmount = 1;
|
64
|
+
if (window.innerWidth > 800) {
|
65
|
+
scrollByAmount = 2;
|
66
|
+
}
|
60
67
|
if (window.innerWidth > 1140) {
|
61
68
|
scrollByAmount = 3;
|
62
|
-
} else if (window.innerWidth > 800) {
|
63
|
-
scrollByAmount = 2;
|
64
|
-
} else {
|
65
|
-
scrollByAmount = 1;
|
66
69
|
}
|
67
|
-
|
68
|
-
if (currentCard
|
69
|
-
|
70
|
+
|
71
|
+
if (currentCard > 0) {
|
72
|
+
setCurrentCard(currentCard - scrollByAmount);
|
73
|
+
carouselRef.current.scrollTo({
|
74
|
+
left: carouselRef.current.scrollLeft - carouselRef.current.children[0].offsetWidth * scrollByAmount,
|
75
|
+
behavior: "smooth",
|
76
|
+
});
|
70
77
|
} else {
|
71
|
-
|
78
|
+
const lastCardIndex = totalCards - 1;
|
79
|
+
const scrollLeft = carouselRef.current.scrollWidth - carouselRef.current.children[0].offsetWidth * scrollByAmount;
|
80
|
+
setCurrentCard(lastCardIndex);
|
81
|
+
carouselRef.current.scrollTo({
|
82
|
+
left: scrollLeft,
|
83
|
+
behavior: "smooth",
|
84
|
+
});
|
72
85
|
}
|
73
86
|
};
|
87
|
+
|
88
|
+
|
74
89
|
|
75
90
|
const arrowStyle = ' text-2xl z-10 bg-black h-10 ml-6 w-10 rounded-full bg-purple-200 hover:bg-neutral-0 flex items-center justify-center';
|
76
91
|
|
@@ -99,7 +114,7 @@ export default function CarouselCard(props) {
|
|
99
114
|
<div className="block tb:hidden">
|
100
115
|
{props.cards.map((item, i) => (
|
101
116
|
<div className="my-5" key={i} ref={refs[i]}>
|
102
|
-
<div className="rounded-3xl ">
|
117
|
+
<div className="rounded-3xl overflow-hidden">
|
103
118
|
{React.createElement(props.component, item)}
|
104
119
|
</div>
|
105
120
|
|
@@ -131,10 +146,13 @@ export default function CarouselCard(props) {
|
|
131
146
|
}}
|
132
147
|
>
|
133
148
|
<div className="">
|
134
|
-
<div className={`snap-x w-full inline-flex select-none overflow-x-hidden scrollbar-hide`}
|
149
|
+
<div className={`snap-x w-full inline-flex select-none overflow-x-hidden scrollbar-hide`}
|
150
|
+
ref={carouselRef}
|
151
|
+
>
|
135
152
|
|
136
153
|
{props.cards.map((item, i) => (
|
137
|
-
<div className="max-[1140px]:snap-
|
154
|
+
// <div className="max-[1140px]:snap-always tb:snap-always mx-5 max-[1140px]:shrink-0" key={i} ref={refs[i]}>
|
155
|
+
<div className=" max-[1140px]:snap-end snap-center mx-5 shrink-0" key={i} ref={refs[i]}>
|
138
156
|
<div className="w-full select-none rounded-3xl object-contain">
|
139
157
|
{React.createElement(props.component, item)}
|
140
158
|
</div>
|
@@ -3,12 +3,15 @@ import React from 'react';
|
|
3
3
|
const GridComponent = ({ cards, gridSize }) => {
|
4
4
|
const numCards = cards.length;
|
5
5
|
const cardsLeftInLastRow = numCards % gridSize;
|
6
|
-
const lastRowColSpan = `col-span-${gridSize / cardsLeftInLastRow}`;
|
7
|
-
|
8
6
|
const renderCards = () => {
|
7
|
+
let cardClass = '';
|
8
|
+
if(cards.length === 4 ){
|
9
|
+
cardClass = 'grid grid-cols-2'
|
10
|
+
}
|
11
|
+
else cardClass = 'gridAutoClass';
|
9
12
|
return cards.map((card, index) => (
|
10
13
|
<div
|
11
|
-
className=
|
14
|
+
className={cardClass}
|
12
15
|
key={index}
|
13
16
|
>
|
14
17
|
{/* Render card content */}
|
package/src/styles/tailwind.css
CHANGED
@@ -1404,10 +1404,6 @@ select {
|
|
1404
1404
|
max-height: 100%;
|
1405
1405
|
}
|
1406
1406
|
|
1407
|
-
.min-h-\[96px\] {
|
1408
|
-
min-height: 96px;
|
1409
|
-
}
|
1410
|
-
|
1411
1407
|
.min-h-\[116px\] {
|
1412
1408
|
min-height: 116px;
|
1413
1409
|
}
|
@@ -1538,14 +1534,14 @@ select {
|
|
1538
1534
|
width: 100vw;
|
1539
1535
|
}
|
1540
1536
|
|
1541
|
-
.min-w-\[100px\] {
|
1542
|
-
min-width: 100px;
|
1543
|
-
}
|
1544
|
-
|
1545
1537
|
.min-w-\[11\.5rem\] {
|
1546
1538
|
min-width: 11.5rem;
|
1547
1539
|
}
|
1548
1540
|
|
1541
|
+
.min-w-\[144px\] {
|
1542
|
+
min-width: 144px;
|
1543
|
+
}
|
1544
|
+
|
1549
1545
|
.min-w-\[18rem\] {
|
1550
1546
|
min-width: 18rem;
|
1551
1547
|
}
|
@@ -1568,14 +1564,6 @@ select {
|
|
1568
1564
|
min-width: 100%;
|
1569
1565
|
}
|
1570
1566
|
|
1571
|
-
.min-w-\[144px\] {
|
1572
|
-
min-width: 144px;
|
1573
|
-
}
|
1574
|
-
|
1575
|
-
.min-w-\[11\.25rem\] {
|
1576
|
-
min-width: 11.25rem;
|
1577
|
-
}
|
1578
|
-
|
1579
1567
|
.max-w-2xl {
|
1580
1568
|
max-width: 42rem;
|
1581
1569
|
}
|
@@ -1596,6 +1584,10 @@ select {
|
|
1596
1584
|
max-width: 18rem;
|
1597
1585
|
}
|
1598
1586
|
|
1587
|
+
.max-w-\[22\.313rem\] {
|
1588
|
+
max-width: 22.313rem;
|
1589
|
+
}
|
1590
|
+
|
1599
1591
|
.max-w-\[22rem\] {
|
1600
1592
|
max-width: 22rem;
|
1601
1593
|
}
|
@@ -1634,10 +1626,6 @@ select {
|
|
1634
1626
|
max-width: min-content;
|
1635
1627
|
}
|
1636
1628
|
|
1637
|
-
.max-w-\[22\.313rem\] {
|
1638
|
-
max-width: 22.313rem;
|
1639
|
-
}
|
1640
|
-
|
1641
1629
|
.flex-1 {
|
1642
1630
|
flex: 1 1 0%;
|
1643
1631
|
}
|
@@ -2066,14 +2054,6 @@ select {
|
|
2066
2054
|
overflow: hidden;
|
2067
2055
|
}
|
2068
2056
|
|
2069
|
-
.overflow-clip {
|
2070
|
-
overflow: clip;
|
2071
|
-
}
|
2072
|
-
|
2073
|
-
.overflow-visible {
|
2074
|
-
overflow: visible;
|
2075
|
-
}
|
2076
|
-
|
2077
2057
|
.overflow-scroll {
|
2078
2058
|
overflow: scroll;
|
2079
2059
|
}
|
@@ -2180,16 +2160,6 @@ select {
|
|
2180
2160
|
border-top-right-radius: 0.375rem;
|
2181
2161
|
}
|
2182
2162
|
|
2183
|
-
.rounded-l {
|
2184
|
-
border-top-left-radius: 0.25rem;
|
2185
|
-
border-bottom-left-radius: 0.25rem;
|
2186
|
-
}
|
2187
|
-
|
2188
|
-
.rounded-l-full {
|
2189
|
-
border-top-left-radius: 9999px;
|
2190
|
-
border-bottom-left-radius: 9999px;
|
2191
|
-
}
|
2192
|
-
|
2193
2163
|
.rounded-tl-2xl {
|
2194
2164
|
border-top-left-radius: 1rem;
|
2195
2165
|
}
|
@@ -5157,10 +5127,6 @@ select {
|
|
5157
5127
|
stroke-width: 1.5px;
|
5158
5128
|
}
|
5159
5129
|
|
5160
|
-
.stroke-\[1\.5\] {
|
5161
|
-
stroke-width: 1.5;
|
5162
|
-
}
|
5163
|
-
|
5164
5130
|
.object-contain {
|
5165
5131
|
object-fit: contain;
|
5166
5132
|
}
|
@@ -5494,18 +5460,10 @@ select {
|
|
5494
5460
|
padding-top: 1rem;
|
5495
5461
|
}
|
5496
5462
|
|
5497
|
-
.pt-5 {
|
5498
|
-
padding-top: 1.25rem;
|
5499
|
-
}
|
5500
|
-
|
5501
5463
|
.pt-6 {
|
5502
5464
|
padding-top: 1.5rem;
|
5503
5465
|
}
|
5504
5466
|
|
5505
|
-
.pr-0 {
|
5506
|
-
padding-right: 0px;
|
5507
|
-
}
|
5508
|
-
|
5509
5467
|
.pt-8 {
|
5510
5468
|
padding-top: 2rem;
|
5511
5469
|
}
|
@@ -7466,15 +7424,6 @@ select {
|
|
7466
7424
|
margin-left: 0px;
|
7467
7425
|
}
|
7468
7426
|
|
7469
|
-
.first\:rounded-full:first-child {
|
7470
|
-
border-radius: 9999px;
|
7471
|
-
}
|
7472
|
-
|
7473
|
-
.first\:rounded-r-full:first-child {
|
7474
|
-
border-top-right-radius: 9999px;
|
7475
|
-
border-bottom-right-radius: 9999px;
|
7476
|
-
}
|
7477
|
-
|
7478
7427
|
.first\:rounded-l-full:first-child {
|
7479
7428
|
border-top-left-radius: 9999px;
|
7480
7429
|
border-bottom-left-radius: 9999px;
|
@@ -7485,29 +7434,10 @@ select {
|
|
7485
7434
|
background-color: rgb(57 112 253 / var(--tw-bg-opacity));
|
7486
7435
|
}
|
7487
7436
|
|
7488
|
-
.first\:bg-purple-500:first-child {
|
7489
|
-
--tw-bg-opacity: 1;
|
7490
|
-
background-color: rgb(140 73 250 / var(--tw-bg-opacity));
|
7491
|
-
}
|
7492
|
-
|
7493
|
-
.first\:bg-neutral-200:first-child {
|
7494
|
-
--tw-bg-opacity: 1;
|
7495
|
-
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
|
7496
|
-
}
|
7497
|
-
|
7498
7437
|
.last\:mr-0:last-child {
|
7499
7438
|
margin-right: 0px;
|
7500
7439
|
}
|
7501
7440
|
|
7502
|
-
.last\:rounded-3xl:last-child {
|
7503
|
-
border-radius: 1.5rem;
|
7504
|
-
}
|
7505
|
-
|
7506
|
-
.last\:rounded-r-3xl:last-child {
|
7507
|
-
border-top-right-radius: 1.5rem;
|
7508
|
-
border-bottom-right-radius: 1.5rem;
|
7509
|
-
}
|
7510
|
-
|
7511
7441
|
.last\:rounded-r-full:last-child {
|
7512
7442
|
border-top-right-radius: 9999px;
|
7513
7443
|
border-bottom-right-radius: 9999px;
|
@@ -8110,14 +8040,12 @@ select {
|
|
8110
8040
|
flex-shrink: 0;
|
8111
8041
|
}
|
8112
8042
|
|
8113
|
-
.max-\[1140px\]\:snap-
|
8114
|
-
scroll-snap-align:
|
8043
|
+
.max-\[1140px\]\:snap-end {
|
8044
|
+
scroll-snap-align: end;
|
8115
8045
|
}
|
8116
|
-
}
|
8117
8046
|
|
8118
|
-
|
8119
|
-
|
8120
|
-
flex-direction: row;
|
8047
|
+
.max-\[1140px\]\:snap-always {
|
8048
|
+
scroll-snap-stop: always;
|
8121
8049
|
}
|
8122
8050
|
}
|
8123
8051
|
|
@@ -8276,20 +8204,12 @@ select {
|
|
8276
8204
|
gap: 4rem;
|
8277
8205
|
}
|
8278
8206
|
|
8279
|
-
.tb\:gap-\[31\.5rem\] {
|
8280
|
-
gap: 31.5rem;
|
8281
|
-
}
|
8282
|
-
|
8283
8207
|
.tb\:gap-3 {
|
8284
8208
|
gap: 0.75rem;
|
8285
8209
|
}
|
8286
8210
|
|
8287
|
-
.tb\:gap
|
8288
|
-
gap:
|
8289
|
-
}
|
8290
|
-
|
8291
|
-
.tb\:gap-6 {
|
8292
|
-
gap: 1.5rem;
|
8211
|
+
.tb\:gap-\[31\.5rem\] {
|
8212
|
+
gap: 31.5rem;
|
8293
8213
|
}
|
8294
8214
|
|
8295
8215
|
.tb\:gap-x-16 {
|
@@ -8331,6 +8251,11 @@ select {
|
|
8331
8251
|
padding: 4rem;
|
8332
8252
|
}
|
8333
8253
|
|
8254
|
+
.tb\:px-0 {
|
8255
|
+
padding-left: 0px;
|
8256
|
+
padding-right: 0px;
|
8257
|
+
}
|
8258
|
+
|
8334
8259
|
.tb\:px-3 {
|
8335
8260
|
padding-left: 0.75rem;
|
8336
8261
|
padding-right: 0.75rem;
|
@@ -8346,15 +8271,6 @@ select {
|
|
8346
8271
|
padding-right: 2rem;
|
8347
8272
|
}
|
8348
8273
|
|
8349
|
-
.tb\:px-0 {
|
8350
|
-
padding-left: 0px;
|
8351
|
-
padding-right: 0px;
|
8352
|
-
}
|
8353
|
-
|
8354
|
-
.tb\:pb-14 {
|
8355
|
-
padding-bottom: 3.5rem;
|
8356
|
-
}
|
8357
|
-
|
8358
8274
|
.tb\:pb-8 {
|
8359
8275
|
padding-bottom: 2rem;
|
8360
8276
|
}
|
@@ -8367,6 +8283,10 @@ select {
|
|
8367
8283
|
padding-top: 2.5rem;
|
8368
8284
|
}
|
8369
8285
|
|
8286
|
+
.tb\:pt-14 {
|
8287
|
+
padding-top: 3.5rem;
|
8288
|
+
}
|
8289
|
+
|
8370
8290
|
.tb\:pt-8 {
|
8371
8291
|
padding-top: 2rem;
|
8372
8292
|
}
|
@@ -8375,14 +8295,6 @@ select {
|
|
8375
8295
|
padding-top: 2.875rem;
|
8376
8296
|
}
|
8377
8297
|
|
8378
|
-
.tb\:pl-0 {
|
8379
|
-
padding-left: 0px;
|
8380
|
-
}
|
8381
|
-
|
8382
|
-
.tb\:pt-14 {
|
8383
|
-
padding-top: 3.5rem;
|
8384
|
-
}
|
8385
|
-
|
8386
8298
|
.tb\:text-left {
|
8387
8299
|
text-align: left;
|
8388
8300
|
}
|
@@ -8782,8 +8694,8 @@ select {
|
|
8782
8694
|
width: 38%;
|
8783
8695
|
}
|
8784
8696
|
|
8785
|
-
.tb-l\:w-\[
|
8786
|
-
width:
|
8697
|
+
.tb-l\:w-\[380px\] {
|
8698
|
+
width: 380px;
|
8787
8699
|
}
|
8788
8700
|
|
8789
8701
|
.tb-l\:w-\[62\%\] {
|
@@ -8838,10 +8750,6 @@ select {
|
|
8838
8750
|
gap: 9rem;
|
8839
8751
|
}
|
8840
8752
|
|
8841
|
-
.tb-l\:gap-6 {
|
8842
|
-
gap: 1.5rem;
|
8843
|
-
}
|
8844
|
-
|
8845
8753
|
.tb-l\:space-x-6 > :not([hidden]) ~ :not([hidden]) {
|
8846
8754
|
--tw-space-x-reverse: 0;
|
8847
8755
|
margin-right: calc(1.5rem * var(--tw-space-x-reverse));
|
@@ -8974,6 +8882,10 @@ select {
|
|
8974
8882
|
width: 36%;
|
8975
8883
|
}
|
8976
8884
|
|
8885
|
+
.db\:w-\[520px\] {
|
8886
|
+
width: 520px;
|
8887
|
+
}
|
8888
|
+
|
8977
8889
|
.db\:w-\[72\%\] {
|
8978
8890
|
width: 72%;
|
8979
8891
|
}
|