next-helios-fe 1.8.19 → 1.8.21
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/package.json
CHANGED
@@ -12,15 +12,23 @@ interface TabProps {
|
|
12
12
|
options?: {
|
13
13
|
variant?: "vertical" | "horizontal";
|
14
14
|
border?: boolean;
|
15
|
+
disablePadding?: boolean;
|
15
16
|
};
|
16
17
|
onChangeTab?: (tab: any) => void;
|
18
|
+
onCloseTab?: (tab: any) => void;
|
17
19
|
}
|
18
20
|
|
19
21
|
interface TabComponent extends React.FC<TabProps> {
|
20
22
|
Window: React.FC<WindowProps>;
|
21
23
|
}
|
22
24
|
|
23
|
-
export const Tab: TabComponent = ({
|
25
|
+
export const Tab: TabComponent = ({
|
26
|
+
children,
|
27
|
+
tabs,
|
28
|
+
options,
|
29
|
+
onChangeTab,
|
30
|
+
onCloseTab,
|
31
|
+
}) => {
|
24
32
|
const childrenList = React.Children.toArray(children);
|
25
33
|
const windowList = childrenList.filter((child) => {
|
26
34
|
return (child as React.ReactElement).type === Tab.Window;
|
@@ -48,21 +56,45 @@ export const Tab: TabComponent = ({ children, tabs, options, onChangeTab }) => {
|
|
48
56
|
<div className="flex overflow-auto [&::-webkit-scrollbar]:hidden">
|
49
57
|
{tabs?.slice(0, childrenList?.length).map((tab, index) => {
|
50
58
|
return (
|
51
|
-
<
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
<div className="relative flex items-center">
|
60
|
+
<button
|
61
|
+
key={index}
|
62
|
+
type="button"
|
63
|
+
className={`flex items-center gap-2 pt-2 pb-1.5 border-b-2 select-none whitespace-nowrap duration-300 ${
|
64
|
+
activeTab === index
|
65
|
+
? "text-primary border-primary"
|
66
|
+
: "border-transparent hover:text-primary hover:border-primary-transparent"
|
67
|
+
} ${
|
68
|
+
onCloseTab && childrenList.length !== 1
|
69
|
+
? "ps-6 pe-10"
|
70
|
+
: "px-6"
|
71
|
+
}`}
|
72
|
+
onClick={() => {
|
73
|
+
setActiveTab(index);
|
74
|
+
}}
|
75
|
+
>
|
76
|
+
{tab?.icon && <Icon icon={tab?.icon} className="text-lg" />}
|
77
|
+
{tab.title}
|
78
|
+
</button>
|
79
|
+
{onCloseTab && childrenList.length !== 1 && (
|
80
|
+
<button
|
81
|
+
type="button"
|
82
|
+
className="absolute right-2 p-0.5 rounded-full hover:text-warning"
|
83
|
+
onClick={() => {
|
84
|
+
setActiveTab(
|
85
|
+
activeTab === index
|
86
|
+
? index === 0
|
87
|
+
? index
|
88
|
+
: index - 1
|
89
|
+
: activeTab
|
90
|
+
);
|
91
|
+
onCloseTab(index);
|
92
|
+
}}
|
93
|
+
>
|
94
|
+
<Icon icon="pajamas:close" />
|
95
|
+
</button>
|
96
|
+
)}
|
97
|
+
</div>
|
66
98
|
);
|
67
99
|
})}
|
68
100
|
</div>
|
@@ -73,7 +105,7 @@ export const Tab: TabComponent = ({ children, tabs, options, onChangeTab }) => {
|
|
73
105
|
<button
|
74
106
|
key={index}
|
75
107
|
type="button"
|
76
|
-
className={`flex items-center gap-2 px-6 pt-2 pb-1.5 border-b-2 lg:border-b-0 border-r-0 lg:border-r-2 text-left whitespace-nowrap duration-300 ${
|
108
|
+
className={`flex items-center gap-2 px-6 pt-2 pb-1.5 border-b-2 lg:border-b-0 border-r-0 lg:border-r-2 text-left select-none whitespace-nowrap duration-300 ${
|
77
109
|
activeTab === index
|
78
110
|
? "text-primary border-primary"
|
79
111
|
: "border-transparent hover:text-primary hover:border-primary-transparent"
|
@@ -91,9 +123,11 @@ export const Tab: TabComponent = ({ children, tabs, options, onChangeTab }) => {
|
|
91
123
|
)}
|
92
124
|
<div
|
93
125
|
className={`flex-1 overflow-auto ${
|
94
|
-
options?.
|
95
|
-
?
|
96
|
-
|
126
|
+
!options?.disablePadding
|
127
|
+
? options?.variant !== "horizontal"
|
128
|
+
? "px-6 py-8"
|
129
|
+
: "px-6 lg:px-8 py-8 lg:py-6"
|
130
|
+
: ""
|
97
131
|
}`}
|
98
132
|
>
|
99
133
|
{windowList[activeTab]}
|
@@ -1547,7 +1547,7 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
|
|
1547
1547
|
placeholder="Phone number"
|
1548
1548
|
required={rest.required}
|
1549
1549
|
disabled={rest.disabled}
|
1550
|
-
value={(rest.value as string).split(selectedCountry)[1]}
|
1550
|
+
value={((rest.value || "") as string).split(selectedCountry)[1]}
|
1551
1551
|
onChange={(e) => {
|
1552
1552
|
rest.onChange &&
|
1553
1553
|
rest.onChange({
|
@@ -1629,7 +1629,9 @@ export const PhoneNumber: React.FC<PhoneNumberProps> = ({
|
|
1629
1629
|
rest.onChange({
|
1630
1630
|
target: {
|
1631
1631
|
value: `${item.dial_code}${
|
1632
|
-
(rest.value as string).split(
|
1632
|
+
((rest.value || "") as string).split(
|
1633
|
+
selectedCountry
|
1634
|
+
)[1]
|
1633
1635
|
}`,
|
1634
1636
|
} as HTMLInputElement,
|
1635
1637
|
} as any);
|