hds-web 1.24.2 → 1.24.4
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 +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/HDS/components/Cards/Misc/talkcard2.js +1 -0
- package/src/HDS/components/Tabs/index.js +1 -0
- package/src/HDS/components/Tabs/tab.js +57 -29
- package/src/HDS/components/Tabs/v3tab.js +60 -0
- package/src/HDS/modules/navCard/navCard.js +5 -14
- package/src/styles/tailwind.css +13 -18
package/package.json
CHANGED
@@ -2,7 +2,6 @@ import React, { useState, useRef } from 'react';
|
|
2
2
|
import { HDSColor } from '../../foundation/ColorPalette';
|
3
3
|
import { Typography } from '../../foundation/Typography'
|
4
4
|
import PropTypes from 'prop-types';
|
5
|
-
import { motion } from 'framer-motion';
|
6
5
|
|
7
6
|
export default function Tab(props) {
|
8
7
|
const {
|
@@ -10,54 +9,83 @@ export default function Tab(props) {
|
|
10
9
|
onTabClick,
|
11
10
|
pillColor,
|
12
11
|
} = props;
|
13
|
-
const [activeTab, setActiveTab] = useState(tabs.find(tab => tab.current) || tabs[0]
|
12
|
+
const [activeTab, setActiveTab] = useState(tabs.find(tab => tab.current) || tabs[0]);
|
13
|
+
const pillRef = useRef(null);
|
14
14
|
let pillColorClass = '';
|
15
|
-
if
|
16
|
-
|
15
|
+
if(pillColor){
|
16
|
+
pillColorClass = HDSColor(pillColor);
|
17
17
|
}
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
|
20
|
+
const handleTabClick = (event, clickedTab) => {
|
21
|
+
event.preventDefault();
|
22
|
+
setActiveTab(clickedTab);
|
21
23
|
if (onTabClick) {
|
22
24
|
onTabClick(clickedTab);
|
23
25
|
}
|
24
26
|
|
27
|
+
// Move the pill indicator to the clicked tab
|
28
|
+
const pill = pillRef.current;
|
29
|
+
if (pill) {
|
30
|
+
const pillWidth = event.currentTarget.offsetWidth;
|
31
|
+
const clickedTabOffset = event.currentTarget.offsetLeft;
|
32
|
+
const pillOffset = pill.parentElement.offsetLeft;
|
33
|
+
const translateX = clickedTabOffset;
|
34
|
+
|
35
|
+
pill.style.transform = `translateX(${translateX}px)`;
|
36
|
+
pill.style.width = `${pillWidth}px`;
|
37
|
+
}
|
25
38
|
};
|
26
|
-
let tabTextClass = '';
|
39
|
+
let tabTextClass = '';
|
40
|
+
|
41
|
+
function tabClass(name) {
|
42
|
+
// console.log(currentTab['tabTextColorClass']);
|
43
|
+
|
44
|
+
if(activeTab['tabTextColorClass']){
|
45
|
+
tabTextClass = HDSColor(activeTab['tabTextColorClass']);
|
46
|
+
}
|
47
|
+
else tabTextClass = 'text-neutral-500'
|
27
48
|
|
49
|
+
let classActive = ' text-neutral-0 transition-all rounded-full ' + pillColorClass;
|
50
|
+
let clasnInActive = ' flex-nowrap rounded-full ' + tabTextClass;
|
51
|
+
if (activeTab.name === name) {
|
52
|
+
return classActive;
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
return clasnInActive;
|
56
|
+
}
|
57
|
+
}
|
28
58
|
return (
|
29
|
-
<div className=
|
30
|
-
<div className="block
|
31
|
-
<nav className="relative inline-flex gap-2 rounded-
|
32
|
-
{tabs.map(
|
33
|
-
<
|
59
|
+
<div className=''>
|
60
|
+
<div className="block">
|
61
|
+
<nav className="relative inline-flex gap-2 rounded-full" aria-label="Tabs">
|
62
|
+
{tabs.map(tab => (
|
63
|
+
<div
|
34
64
|
key={tab.name}
|
35
|
-
onClick={() =>
|
36
|
-
handleTabClick(tab);
|
37
|
-
}}
|
38
|
-
className={`${activeTab === tab.name ? ' text-neutral-0 transition-all duration-300' : ' hover:bg-neutral-500/30 text-neutral-400'} relative px-3 py-1 whitespace-nowrap rounded-full hover:text-neutral-0`}
|
65
|
+
onClick={(event) => handleTabClick(event, tab)}
|
39
66
|
>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
className={`absolute inset-0 ${pillColorClass}`}
|
44
|
-
style={{ borderRadius: 32 }}
|
45
|
-
// transition={{ duration:1 }}
|
46
|
-
|
47
|
-
/>
|
48
|
-
)}
|
49
|
-
<Typography textStyle="body3c-medium" className={`relative z-10 `}>
|
67
|
+
<Typography
|
68
|
+
className={`${tabClass(tab.name)} ${tab.name === activeTab.name ? '' : 'hover:bg-neutral-150'} cursor-pointer px-3 py-1 z-[2] relative whitespace-nowrap`}
|
69
|
+
textStyle='body3c-medium'>
|
50
70
|
{tab.name}
|
51
71
|
</Typography>
|
52
|
-
</
|
72
|
+
</div>
|
53
73
|
))}
|
74
|
+
<span
|
75
|
+
ref={pillRef}
|
76
|
+
className={`absolute left-0 z-[1] ${pillColorClass} rounded-full transition-all ease-in duration-150`}
|
77
|
+
style={{
|
78
|
+
left: `${activeTab.index * 100}%`,
|
79
|
+
width: `${activeTab.width}px`, // Use the width of the clicked tab
|
80
|
+
height: '28px' // Add desired height to make the pill visible
|
81
|
+
}}
|
82
|
+
/>
|
54
83
|
</nav>
|
55
84
|
</div>
|
56
85
|
</div>
|
57
86
|
);
|
58
87
|
}
|
59
88
|
|
60
|
-
|
61
89
|
Tab.defaultProps = {
|
62
90
|
pillColor: 'bg-blue-500',
|
63
91
|
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
2
|
+
import { HDSColor } from '../../foundation/ColorPalette';
|
3
|
+
import { Typography } from '../../foundation/Typography'
|
4
|
+
import { motion } from 'framer-motion';
|
5
|
+
|
6
|
+
export default function V3Tab(props) {
|
7
|
+
const {
|
8
|
+
tabs,
|
9
|
+
onTabClick,
|
10
|
+
pillColor,
|
11
|
+
} = props;
|
12
|
+
const initialActiveTab = tabs.find(tab => tab.current)?.name || tabs[0].name;
|
13
|
+
const [activeTab, setActiveTab] = useState(initialActiveTab);
|
14
|
+
let pillColorClass = '';
|
15
|
+
if (pillColor) {
|
16
|
+
pillColorClass = HDSColor(pillColor);
|
17
|
+
}
|
18
|
+
const handleTabClick = (clickedTab) => {
|
19
|
+
setActiveTab(clickedTab.name);
|
20
|
+
if (onTabClick) {
|
21
|
+
onTabClick(clickedTab);
|
22
|
+
}
|
23
|
+
|
24
|
+
};
|
25
|
+
return (
|
26
|
+
<div className="">
|
27
|
+
<div className="block ">
|
28
|
+
<nav className="relative inline-flex gap-2 rounded-[32px] " aria-label="Tabs">
|
29
|
+
{tabs && tabs.map((tab) => (
|
30
|
+
<button
|
31
|
+
key={tab.name}
|
32
|
+
onClick={() => {
|
33
|
+
handleTabClick(tab);
|
34
|
+
}}
|
35
|
+
className={`${activeTab === tab.name ? ' text-neutral-0 transition-all duration-300' : ' hover:bg-neutral-500/30 text-neutral-400'} relative px-3 py-1 whitespace-nowrap rounded-full hover:text-neutral-0`}
|
36
|
+
>
|
37
|
+
{activeTab === tab.name && (
|
38
|
+
<motion.div
|
39
|
+
layoutId="active-pill"
|
40
|
+
className={`absolute inset-0 ${pillColorClass}`}
|
41
|
+
style={{ borderRadius: 32 }}
|
42
|
+
// transition={{ duration:1 }}
|
43
|
+
|
44
|
+
/>
|
45
|
+
)}
|
46
|
+
<Typography textStyle="body3c-medium" className={`relative z-10 `}>
|
47
|
+
{tab.name}
|
48
|
+
</Typography>
|
49
|
+
</button>
|
50
|
+
))}
|
51
|
+
</nav>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
V3Tab.defaultProps = {
|
59
|
+
pillColor: 'bg-blue-500',
|
60
|
+
}
|
@@ -6,19 +6,18 @@ import { HDSColor } from '../../foundation/ColorPalette';
|
|
6
6
|
import { Tab } from '../../components/Tabs';
|
7
7
|
import { Icon } from '../../components/common-components/Icon'
|
8
8
|
import PropTypes from 'prop-types';
|
9
|
-
import { motion } from 'framer-motion';
|
10
9
|
|
11
10
|
|
12
11
|
export default function NavCard(props) {
|
13
12
|
const [showVideo, setShowVideo] = useState(false);
|
14
13
|
const TabCard = (tabContent) => {
|
15
|
-
|
14
|
+
|
16
15
|
return (
|
17
16
|
<>
|
18
17
|
<div className=''>
|
19
18
|
{tabContent.title && <Typography textStyle='body1c-semi-bold' className={HDSColor(tabContent.title_color)}>{tabContent.title}</Typography>}
|
20
19
|
|
21
|
-
{tabContent.subTitle && <Typography textStyle='body3' className={'mt-2 ' + HDSColor(tabContent.sub_title_color)}>{tabContent.subTitle}</Typography>}
|
20
|
+
{tabContent.subTitle && <Typography textStyle='body3' className={ 'mt-2 ' + HDSColor(tabContent.sub_title_color)}>{tabContent.subTitle}</Typography>}
|
22
21
|
{tabContent.readMore_cta && <div className="flex">
|
23
22
|
<a href={tabContent.readMore_cta_link ?? ''} >
|
24
23
|
<HDSButton
|
@@ -75,7 +74,7 @@ export default function NavCard(props) {
|
|
75
74
|
<div className="relative">
|
76
75
|
{
|
77
76
|
tabContent.img_url && (
|
78
|
-
<img src={tabContent.img_url} alt="Illustration" className=' rounded-2xl'
|
77
|
+
<img src={tabContent.img_url} alt="Illustration" className=' rounded-2xl'/>
|
79
78
|
)
|
80
79
|
}
|
81
80
|
{
|
@@ -127,21 +126,13 @@ export default function NavCard(props) {
|
|
127
126
|
bgColorTab={props.bgColorTab}
|
128
127
|
/>
|
129
128
|
</div>
|
130
|
-
<
|
131
|
-
key={activeTab}
|
132
|
-
initial={{ opacity: 0.8 }} // Initial opacity when the component is rendered
|
133
|
-
animate={{ opacity: 1 }} // Opacity when the tab switches
|
134
|
-
exit={{ opacity: 0.8 }} // Opacity when exiting the component
|
135
|
-
transition={{ duration: 1, ease: 'easeIn' }} // Tr
|
136
|
-
|
137
|
-
className=''>
|
129
|
+
<div className=''>
|
138
130
|
{props.tabContent &&
|
139
131
|
props.tabContent[activeTab] &&
|
140
132
|
TabCard(props.tabContent[activeTab])}
|
141
|
-
</
|
133
|
+
</div>
|
142
134
|
|
143
135
|
</div>}
|
144
136
|
</div>
|
145
137
|
)
|
146
138
|
}
|
147
|
-
|
package/src/styles/tailwind.css
CHANGED
@@ -952,6 +952,10 @@ select{
|
|
952
952
|
left: 17.6%;
|
953
953
|
}
|
954
954
|
|
955
|
+
.left-\[400px\]{
|
956
|
+
left: 400px;
|
957
|
+
}
|
958
|
+
|
955
959
|
.left-\[45\%\]{
|
956
960
|
left: 45%;
|
957
961
|
}
|
@@ -1253,6 +1257,11 @@ select{
|
|
1253
1257
|
margin-bottom: 2rem;
|
1254
1258
|
}
|
1255
1259
|
|
1260
|
+
.mx-8{
|
1261
|
+
margin-left: 2rem;
|
1262
|
+
margin-right: 2rem;
|
1263
|
+
}
|
1264
|
+
|
1256
1265
|
.-mb-\[112\%\]{
|
1257
1266
|
margin-bottom: -112%;
|
1258
1267
|
}
|
@@ -1624,6 +1633,10 @@ select{
|
|
1624
1633
|
height: 2.25rem;
|
1625
1634
|
}
|
1626
1635
|
|
1636
|
+
.h-\[1000px\]{
|
1637
|
+
height: 1000px;
|
1638
|
+
}
|
1639
|
+
|
1627
1640
|
.h-\[130px\]{
|
1628
1641
|
height: 130px;
|
1629
1642
|
}
|
@@ -1668,10 +1681,6 @@ select{
|
|
1668
1681
|
height: 60px;
|
1669
1682
|
}
|
1670
1683
|
|
1671
|
-
.h-\[700px\]{
|
1672
|
-
height: 700px;
|
1673
|
-
}
|
1674
|
-
|
1675
1684
|
.h-\[800px\]{
|
1676
1685
|
height: 800px;
|
1677
1686
|
}
|
@@ -9335,11 +9344,6 @@ select{
|
|
9335
9344
|
border-color: rgb(13 65 198 / var(--tw-border-opacity));
|
9336
9345
|
}
|
9337
9346
|
|
9338
|
-
.hover\:border-neutral-0:hover{
|
9339
|
-
--tw-border-opacity: 1;
|
9340
|
-
border-color: rgb(255 255 255 / var(--tw-border-opacity));
|
9341
|
-
}
|
9342
|
-
|
9343
9347
|
.hover\:border-neutral-300:hover{
|
9344
9348
|
--tw-border-opacity: 1;
|
9345
9349
|
border-color: rgb(210 214 219 / var(--tw-border-opacity));
|
@@ -9829,10 +9833,6 @@ select{
|
|
9829
9833
|
background-color: rgb(133 77 24 / var(--tw-bg-opacity));
|
9830
9834
|
}
|
9831
9835
|
|
9832
|
-
.hover\:bg-neutral-0\/20:hover{
|
9833
|
-
background-color: rgb(255 255 255 / 0.2);
|
9834
|
-
}
|
9835
|
-
|
9836
9836
|
.hover\:bg-neutral-500\/30:hover{
|
9837
9837
|
background-color: rgb(108 115 127 / 0.3);
|
9838
9838
|
}
|
@@ -10029,11 +10029,6 @@ select{
|
|
10029
10029
|
color: rgb(30 86 227 / var(--tw-text-opacity));
|
10030
10030
|
}
|
10031
10031
|
|
10032
|
-
.focus\:text-blue-700:focus{
|
10033
|
-
--tw-text-opacity: 1;
|
10034
|
-
color: rgb(13 65 198 / var(--tw-text-opacity));
|
10035
|
-
}
|
10036
|
-
|
10037
10032
|
.focus\:text-neutral-0:focus{
|
10038
10033
|
--tw-text-opacity: 1;
|
10039
10034
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|