next-helios-fe 1.8.86 → 1.8.87

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.8.86",
3
+ "version": "1.8.87",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@iconify/react": "^5.0.1",
40
40
  "dayjs": "^1.11.11",
41
41
  "flowbite-react": "^0.10.1",
42
- "next": "14.2.4",
42
+ "next": "^14.2.4",
43
43
  "postcss": "^8",
44
44
  "react": "^18.2.0",
45
45
  "react-dom": "^18.2.0",
@@ -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
 
@@ -48,35 +48,25 @@ export const Wizard: WizardComponent = ({
48
48
  });
49
49
  const [activeTab, setActiveTab] = useState(0);
50
50
 
51
- const handleOnPreviousClick = () => {
52
- if (activeTab - 1 === 0) {
51
+ useEffect(() => {
52
+ if (activeTab === 0) {
53
53
  wizardNavigationRef.current?.scrollTo({
54
54
  left: 0,
55
55
  behavior: "smooth",
56
56
  });
57
57
  } else {
58
- document.getElementById(`wizard-tab-${activeTab - 1}`)?.scrollIntoView({
59
- behavior: "smooth",
60
- block: "nearest",
61
- inline: "center",
62
- });
63
- }
64
- };
65
-
66
- const handleOnNextClick = () => {
67
- if (activeTab + 1 === childrenList.length) {
68
58
  wizardNavigationRef.current?.scrollTo({
69
- left: wizardNavigationRef.current.scrollWidth,
70
- behavior: "smooth",
71
- });
72
- } else {
73
- document.getElementById(`wizard-tab-${activeTab + 1}`)?.scrollIntoView({
59
+ left: Array.from({ length: activeTab })
60
+ .map((_, index) => {
61
+ return (
62
+ document.getElementById(`wizard-tab-${index}`)?.offsetWidth || 0
63
+ );
64
+ })
65
+ .reduce((acc, cur) => acc + cur, 0),
74
66
  behavior: "smooth",
75
- block: "nearest",
76
- inline: "center",
77
67
  });
78
68
  }
79
- };
69
+ }, [activeTab]);
80
70
 
81
71
  return (
82
72
  <div className="flex flex-col gap-8 h-full overflow-hidden">
@@ -210,7 +200,6 @@ export const Wizard: WizardComponent = ({
210
200
  }`}
211
201
  disabled={activeTab === 0}
212
202
  onClick={() => {
213
- handleOnPreviousClick();
214
203
  onPreviousClick && onPreviousClick();
215
204
 
216
205
  if (onChangeTab) {
@@ -254,7 +243,6 @@ export const Wizard: WizardComponent = ({
254
243
  if (options?.customNextButton?.onClick) {
255
244
  options.customNextButton.onClick();
256
245
  } else {
257
- handleOnNextClick();
258
246
  onNextClick && onNextClick();
259
247
 
260
248
  if (onChangeTab) {
@@ -202,7 +202,7 @@ export const Tooltip: React.FC<TooltipProps> = ({
202
202
  createPortal(
203
203
  <div
204
204
  ref={tooltipRef}
205
- className={`absolute z-50 max-w-dvw max-h-dvh overflow-hidden duration-200 transition-opacity ${
205
+ className={`fixed z-50 max-w-dvw max-h-dvh overflow-hidden duration-200 transition-opacity ${
206
206
  visible ? "opacity-100" : "opacity-0 pointer-events-none"
207
207
  } ${options?.enableHover ? "" : "pointer-events-none"}`}
208
208
  style={getTooltipPosition()}