next-helios-fe 1.7.24 → 1.7.26
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
@@ -1,5 +1,5 @@
|
|
1
1
|
"use client";
|
2
|
-
import React, { useState, useRef } from "react";
|
2
|
+
import React, { useState, useEffect, useRef } from "react";
|
3
3
|
import { Icon } from "@iconify/react";
|
4
4
|
import { Window, type WindowProps } from "./window";
|
5
5
|
|
@@ -13,9 +13,11 @@ interface WizardProps {
|
|
13
13
|
options?: {
|
14
14
|
border?: boolean;
|
15
15
|
disableNavigationClick?: boolean;
|
16
|
+
hideNavigationOnFirstWindow?: boolean;
|
16
17
|
};
|
17
18
|
onPreviousClick?: () => void;
|
18
19
|
onNextClick?: () => void;
|
20
|
+
onChangeWindow?: (window: any) => void;
|
19
21
|
}
|
20
22
|
|
21
23
|
interface WizardComponent extends React.FC<WizardProps> {
|
@@ -28,6 +30,7 @@ export const Wizard: WizardComponent = ({
|
|
28
30
|
options,
|
29
31
|
onPreviousClick,
|
30
32
|
onNextClick,
|
33
|
+
onChangeWindow,
|
31
34
|
}) => {
|
32
35
|
const wizardNavigationRef = useRef<HTMLDivElement>(null);
|
33
36
|
const childrenList = React.Children.toArray(children);
|
@@ -36,6 +39,12 @@ export const Wizard: WizardComponent = ({
|
|
36
39
|
});
|
37
40
|
const [activeTab, setActiveTab] = useState(0);
|
38
41
|
|
42
|
+
useEffect(() => {
|
43
|
+
if (onChangeWindow) {
|
44
|
+
onChangeWindow(activeTab);
|
45
|
+
}
|
46
|
+
}, [activeTab]);
|
47
|
+
|
39
48
|
const handleOnPreviousClick = () => {
|
40
49
|
if (activeTab - 1 === 0) {
|
41
50
|
wizardNavigationRef.current?.scrollTo({
|
@@ -68,45 +77,51 @@ export const Wizard: WizardComponent = ({
|
|
68
77
|
|
69
78
|
return (
|
70
79
|
<div className="flex flex-col gap-8 h-full overflow-hidden">
|
71
|
-
|
72
|
-
<div
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
80
|
+
{(!options?.hideNavigationOnFirstWindow || activeTab !== 0) && (
|
81
|
+
<div className="space-x-8 relative before:absolute before:inset-0 before:mt-6 md:before:translate-y-0 before:w-full before:h-0.5 before:bg-gradient-to-r before:from-transparent before:via-primary before:to-transparent">
|
82
|
+
<div
|
83
|
+
ref={wizardNavigationRef}
|
84
|
+
className="relative flex justify-between overflow-auto [&::-webkit-scrollbar]:hidden"
|
85
|
+
>
|
86
|
+
{tabs?.map((tab, index) => {
|
87
|
+
{
|
88
|
+
if (!options?.hideNavigationOnFirstWindow || index !== 0) {
|
89
|
+
return (
|
90
|
+
<div
|
91
|
+
key={index}
|
92
|
+
id={`wizard-tab-${index}`}
|
93
|
+
className={`group flex flex-col items-center gap-2 min-w-32 max-w-40 px-2 ${
|
94
|
+
activeTab >= index && "is-active"
|
95
|
+
}`}
|
96
|
+
>
|
97
|
+
<div className="rounded-full bg-secondary-bg">
|
98
|
+
<button
|
99
|
+
className={`flex justify-center items-center w-12 h-12 shadow border border-white rounded-full bg-secondary-light duration-300 group-[.is-active]:bg-primary group-[.is-active]:text-white ${
|
100
|
+
!options?.disableNavigationClick &&
|
101
|
+
"hover:border-primary hover:bg-primary-transparent hover:text-primary"
|
102
|
+
}`}
|
103
|
+
disabled={options?.disableNavigationClick}
|
104
|
+
onClick={() => {
|
105
|
+
setActiveTab(index);
|
106
|
+
}}
|
107
|
+
>
|
108
|
+
<Icon icon={tab.icon} className="text-2xl" />
|
109
|
+
</button>
|
110
|
+
</div>
|
111
|
+
<div className="flex flex-col items-center text-center">
|
112
|
+
<h1 className="text-sm font-medium group-[.is-active]:text-primary">
|
113
|
+
{tab.title}
|
114
|
+
</h1>
|
115
|
+
<p className="text-xs">{tab.subTitle}</p>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
})}
|
122
|
+
</div>
|
108
123
|
</div>
|
109
|
-
|
124
|
+
)}
|
110
125
|
<div
|
111
126
|
className={`flex-1 overflow-auto ${
|
112
127
|
options?.border && "border rounded-md px-4 py-6"
|