next-helios-fe 1.8.85 → 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.85",
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) {
@@ -158,14 +158,6 @@ export const Table: TableComponentProps = ({
158
158
  });
159
159
  }, [data]);
160
160
 
161
- const handleExportData = (dataTitle: string, data: any[]) => {
162
- const fileName = `${dataTitle}_${dayjs().format("YYYY-MM-DD_HH-mm-ss")}`;
163
- const worksheet = xlsx.utils.json_to_sheet(data);
164
- const workbook = xlsx.utils.book_new();
165
- xlsx.utils.book_append_sheet(workbook, worksheet, "Data");
166
- xlsx.writeFile(workbook, fileName + ".xlsx");
167
- };
168
-
169
161
  useEffect(() => {
170
162
  if (page === 1) {
171
163
  paginationRef.current?.scrollTo({
@@ -173,14 +165,28 @@ export const Table: TableComponentProps = ({
173
165
  behavior: "smooth",
174
166
  });
175
167
  } else {
176
- document.getElementById(`pagination-page-${page - 1}`)?.scrollIntoView({
168
+ paginationRef.current?.scrollTo({
169
+ left: Array.from({ length: page - 2 })
170
+ .map((_, index) => {
171
+ return (
172
+ (document.getElementById(`pagination-page-${index}`)
173
+ ?.offsetWidth || 0) + 8
174
+ );
175
+ })
176
+ .reduce((acc, cur) => acc + cur, 0),
177
177
  behavior: "smooth",
178
- block: "nearest",
179
- inline: "center",
180
178
  });
181
179
  }
182
180
  }, [page]);
183
181
 
182
+ const handleExportData = (dataTitle: string, data: any[]) => {
183
+ const fileName = `${dataTitle}_${dayjs().format("YYYY-MM-DD_HH-mm-ss")}`;
184
+ const worksheet = xlsx.utils.json_to_sheet(data);
185
+ const workbook = xlsx.utils.book_new();
186
+ xlsx.utils.book_append_sheet(workbook, worksheet, "Data");
187
+ xlsx.writeFile(workbook, fileName + ".xlsx");
188
+ };
189
+
184
190
  const filteredData = useMemo(() => {
185
191
  const tempData = data
186
192
  ?.filter((item) => {
@@ -921,7 +927,7 @@ export const Table: TableComponentProps = ({
921
927
  key={index}
922
928
  id={`pagination-page-${index}`}
923
929
  type="button"
924
- className="flex h-9 min-w-9 select-none items-center justify-center rounded-md border hover:bg-secondary-light disabled:bg-primary-transparent disabled:text-primary"
930
+ className="flex items-center justify-center h-9 min-w-9 px-4 border rounded-md select-none hover:bg-secondary-light disabled:bg-primary-transparent disabled:text-primary"
925
931
  disabled={page === index + 1}
926
932
  onClick={() => {
927
933
  setPage(index + 1);
@@ -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()}