next-helios-fe 1.4.3 → 1.4.5

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.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,31 +4,49 @@ import dynamic from "next/dynamic";
4
4
  const Ch = dynamic(() => import("react-apexcharts"), { ssr: false });
5
5
 
6
6
  interface ChartProps {
7
- type: "line" | "area" | "bar" | "pie" | "donut" | "radialBar" | "heatmap";
8
- theme?: "light" | "dark" | "system";
7
+ type:
8
+ | "line"
9
+ | "area"
10
+ | "bar"
11
+ | "pie"
12
+ | "donut"
13
+ | "radialBar"
14
+ | "heatmap"
15
+ | "scatter"
16
+ | "bubble"
17
+ | "candlestick"
18
+ | "boxPlot"
19
+ | "radar"
20
+ | "polarArea"
21
+ | "rangeBar"
22
+ | "rangeArea"
23
+ | "treemap";
24
+
9
25
  id?: string;
10
26
  title?: string;
11
27
  subTitle?: string;
12
- series: any;
13
28
  labels?: string[];
29
+ series: any;
14
30
  xaxis?: {
15
31
  categories: string[];
16
32
  };
17
- height?: number;
18
- sparkline?: boolean;
33
+ options?: {
34
+ theme?: "light" | "dark" | "system";
35
+ height?: number;
36
+ barChart?: { variant: "vertical" | "horizontal" };
37
+ sparkline?: boolean;
38
+ };
19
39
  }
20
40
 
21
41
  export const Chart: React.FC<ChartProps> = ({
22
42
  type,
23
- theme,
24
43
  id,
25
44
  title,
26
45
  subTitle,
27
46
  series,
28
47
  labels,
29
48
  xaxis,
30
- height,
31
- sparkline,
49
+ options,
32
50
  }) => {
33
51
  const areaOptions = type === "area" && {
34
52
  fill: {
@@ -42,10 +60,10 @@ export const Chart: React.FC<ChartProps> = ({
42
60
 
43
61
  return (
44
62
  <Ch
45
- type={type}
46
63
  id={id}
64
+ type={type}
47
65
  series={series}
48
- height={height}
66
+ height={options?.height}
49
67
  options={{
50
68
  title: {
51
69
  text: title,
@@ -74,6 +92,7 @@ export const Chart: React.FC<ChartProps> = ({
74
92
  "#9e9e9e",
75
93
  ],
76
94
  chart: {
95
+ type: type,
77
96
  toolbar: {
78
97
  show: false,
79
98
  },
@@ -81,14 +100,14 @@ export const Chart: React.FC<ChartProps> = ({
81
100
  enabled: false,
82
101
  },
83
102
  sparkline: {
84
- enabled: sparkline ?? true,
103
+ enabled: options?.sparkline ?? true,
85
104
  },
86
105
  events: {
87
106
  mounted: (chart) => {
88
107
  chart.windowResizeHandler();
89
108
  },
90
109
  },
91
- foreColor: theme === "light" ? "#475569" : "#ffffff",
110
+ foreColor: options?.theme === "light" ? "#475569" : "#ffffff",
92
111
  },
93
112
  dataLabels: {
94
113
  enabled: false,
@@ -101,18 +120,39 @@ export const Chart: React.FC<ChartProps> = ({
101
120
  bar: {
102
121
  borderRadius: 4,
103
122
  columnWidth: "30%",
123
+ horizontal: options?.barChart?.variant === "horizontal",
104
124
  },
105
125
  pie: {
106
126
  donut: {
107
- size: "70%",
127
+ labels: {
128
+ show: type === "donut",
129
+ name: {
130
+ show: true,
131
+ },
132
+ value: {
133
+ show: true,
134
+ },
135
+ total: {
136
+ show: true,
137
+ },
138
+ },
139
+ },
140
+ },
141
+ radialBar: {
142
+ dataLabels: {
143
+ total: {
144
+ show: true,
145
+ label: "Total",
146
+ },
108
147
  },
109
148
  },
110
149
  },
111
150
  tooltip: {
112
- theme: theme === "light" ? "light" : "dark",
151
+ theme: options?.theme === "light" ? "light" : "dark",
152
+ fillSeriesColor: false,
113
153
  },
114
154
  grid: {
115
- borderColor: theme === "light" ? "#e5e6e8" : "#545869",
155
+ borderColor: options?.theme === "light" ? "#e5e6e8" : "#545869",
116
156
  },
117
157
  ...areaOptions,
118
158
  }}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useState } from "react";
2
+ import React, { useState, useRef } from "react";
3
3
  import { Icon } from "@iconify/react";
4
4
  import { Window, type WindowProps } from "./window";
5
5
 
@@ -29,36 +29,73 @@ export const Wizard: WizardComponent = ({
29
29
  onPreviousClick,
30
30
  onNextClick,
31
31
  }) => {
32
+ const wizardNavigationRef = useRef<HTMLDivElement>(null);
32
33
  const childrenList = React.Children.toArray(children);
33
34
  const windowList = childrenList.filter((child) => {
34
35
  return (child as React.ReactElement).type === Wizard.Window;
35
36
  });
36
37
  const [activeTab, setActiveTab] = useState(0);
37
38
 
39
+ const handleOnPreviousClick = () => {
40
+ if (activeTab - 1 === 0) {
41
+ wizardNavigationRef.current?.scrollTo({
42
+ left: 0,
43
+ behavior: "smooth",
44
+ });
45
+ } else {
46
+ document.getElementById(`wizard-tab-${activeTab - 1}`)?.scrollIntoView({
47
+ behavior: "smooth",
48
+ block: "nearest",
49
+ inline: "center",
50
+ });
51
+ }
52
+ };
53
+
54
+ const handleOnNextClick = () => {
55
+ if (activeTab + 1 === childrenList.length) {
56
+ wizardNavigationRef.current?.scrollTo({
57
+ left: wizardNavigationRef.current.scrollWidth,
58
+ behavior: "smooth",
59
+ });
60
+ } else {
61
+ document.getElementById(`wizard-tab-${activeTab + 1}`)?.scrollIntoView({
62
+ behavior: "smooth",
63
+ block: "nearest",
64
+ inline: "center",
65
+ });
66
+ }
67
+ };
68
+
38
69
  return (
39
70
  <div className="flex flex-col gap-8 h-full overflow-hidden">
40
- <div className="space-x-8 relative before:absolute before:inset-0 before:mt-4 before:-translate-y-px md: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">
41
- <div className="relative flex justify-between">
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
+ >
42
76
  {tabs?.slice(0, childrenList.length)?.map((tab, index) => {
43
77
  return (
44
78
  <div
45
79
  key={index}
46
- className={`group flex flex-col items-center gap-2 max-w-40 max-h-40 ${
80
+ id={`wizard-tab-${index}`}
81
+ className={`group flex flex-col items-center gap-2 min-w-32 max-w-40 px-2 ${
47
82
  activeTab >= index && "is-active"
48
83
  }`}
49
84
  >
50
- <button
51
- 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 ${
52
- !options?.disableNavigationClick &&
53
- "hover:border-primary hover:text-primary"
54
- }`}
55
- disabled={options?.disableNavigationClick}
56
- onClick={() => {
57
- setActiveTab(index);
58
- }}
59
- >
60
- <Icon icon={tab.icon} className="text-2xl" />
61
- </button>
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>
62
99
  <div className="flex flex-col items-center text-center">
63
100
  <h1 className="text-sm font-medium group-[.is-active]:text-primary">
64
101
  {tab.title}
@@ -84,6 +121,7 @@ export const Wizard: WizardComponent = ({
84
121
  disabled={activeTab === 0}
85
122
  onClick={() => {
86
123
  setActiveTab((prev) => prev - 1);
124
+ handleOnPreviousClick();
87
125
  onPreviousClick && onPreviousClick();
88
126
  }}
89
127
  >
@@ -96,6 +134,7 @@ export const Wizard: WizardComponent = ({
96
134
  disabled={activeTab === childrenList.length - 1}
97
135
  onClick={() => {
98
136
  setActiveTab((prev) => prev + 1);
137
+ handleOnNextClick();
99
138
  onNextClick && onNextClick();
100
139
  }}
101
140
  >