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,6 +1,6 @@
1
1
  {
2
2
  "name": "next-helios-fe",
3
- "version": "1.7.24",
3
+ "version": "1.7.26",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
- <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">
72
- <div
73
- ref={wizardNavigationRef}
74
- className="relative flex justify-between overflow-auto [&::-webkit-scrollbar]:hidden"
75
- >
76
- {tabs?.slice(0, childrenList.length)?.map((tab, index) => {
77
- return (
78
- <div
79
- key={index}
80
- id={`wizard-tab-${index}`}
81
- className={`group flex flex-col items-center gap-2 min-w-32 max-w-40 px-2 ${
82
- activeTab >= index && "is-active"
83
- }`}
84
- >
85
- <div className="rounded-full bg-secondary-bg">
86
- <button
87
- 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 ${
88
- !options?.disableNavigationClick &&
89
- "hover:border-primary hover:bg-primary-transparent hover:text-primary"
90
- }`}
91
- disabled={options?.disableNavigationClick}
92
- onClick={() => {
93
- setActiveTab(index);
94
- }}
95
- >
96
- <Icon icon={tab.icon} className="text-2xl" />
97
- </button>
98
- </div>
99
- <div className="flex flex-col items-center text-center">
100
- <h1 className="text-sm font-medium group-[.is-active]:text-primary">
101
- {tab.title}
102
- </h1>
103
- <p className="text-xs">{tab.subTitle}</p>
104
- </div>
105
- </div>
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
- </div>
124
+ )}
110
125
  <div
111
126
  className={`flex-1 overflow-auto ${
112
127
  options?.border && "border rounded-md px-4 py-6"