next-helios-fe 1.1.38 → 1.1.40

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.1.38",
3
+ "version": "1.1.40",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,20 +4,27 @@ import { Item, type ItemProps } from "./item";
4
4
 
5
5
  interface AccordionProps {
6
6
  children: React.ReactNode;
7
+ options?: {
8
+ twoColumns?: boolean;
9
+ };
7
10
  }
8
11
 
9
12
  interface AccordionComponent extends React.FC<AccordionProps> {
10
13
  Item: React.FC<ItemProps>;
11
14
  }
12
15
 
13
- export const Accordion: AccordionComponent = ({ children }) => {
16
+ export const Accordion: AccordionComponent = ({ children, options }) => {
14
17
  const childrenList = React.Children.toArray(children);
15
18
  const itemList = childrenList.filter((child) => {
16
19
  return (child as React.ReactElement).type === Accordion.Item;
17
20
  });
18
21
 
19
22
  return (
20
- <div className="flex flex-col gap-2 w-full">
23
+ <div
24
+ className={`grid gap-x-4 gap-y-2 w-full h-min ${
25
+ options?.twoColumns && "lg:grid-cols-2"
26
+ }`}
27
+ >
21
28
  {itemList.map((item) => {
22
29
  return item;
23
30
  })}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React, { useState } from "react";
2
+ import React, { useState, useEffect } from "react";
3
3
  import { Icon } from "@iconify/react";
4
4
 
5
5
  export interface ItemProps {
@@ -7,6 +7,7 @@ export interface ItemProps {
7
7
  title: string;
8
8
  subTitle?: string;
9
9
  options?: {
10
+ defaultOpen?: boolean;
10
11
  border?: boolean;
11
12
  };
12
13
  }
@@ -17,35 +18,41 @@ export const Item: React.FC<ItemProps> = ({
17
18
  subTitle,
18
19
  options,
19
20
  }) => {
20
- const [active, setActive] = useState(false);
21
+ const [open, setOpen] = useState(false);
22
+
23
+ useEffect(() => {
24
+ if (options?.defaultOpen) {
25
+ setOpen(true);
26
+ }
27
+ }, [options?.defaultOpen]);
21
28
 
22
29
  return (
23
30
  <div
24
- className={`rounded-md overflow-hidden ${options?.border && "border"}`}
31
+ className={`h-min rounded-md overflow-hidden ${options?.border && "border"}`}
25
32
  >
26
33
  <div
27
34
  className={`grid w-full overflow-hidden duration-300 ${
28
- active ? "border-l-4 border-primary" : "border-l-0"
35
+ open ? "border-l-4 border-primary" : "border-l-0"
29
36
  }`}
30
37
  >
31
38
  <button
32
39
  type="button"
33
40
  className={`flex justify-between items-center w-full px-4 py-2 hover:bg-secondary-light ${
34
- active && "text-primary"
41
+ open && "text-primary"
35
42
  }`}
36
43
  onClick={() => {
37
- setActive(!active);
44
+ setOpen(!open);
38
45
  }}
39
46
  >
40
- <div className="flex flex-col items-start">
41
- <span>{title}</span>
42
- {subTitle && <span className="text-sm">{subTitle}</span>}
47
+ <div className="flex-1 flex flex-col items-start">
48
+ <span className="text-start">{title}</span>
49
+ {subTitle && <span className="text-start text-sm">{subTitle}</span>}
43
50
  </div>
44
- <Icon icon={`gravity-ui:chevron-${active ? "up" : "down"}`} />
51
+ <Icon icon={`gravity-ui:chevron-${open ? "up" : "down"}`} />
45
52
  </button>
46
53
  <div
47
54
  className={`overflow-auto duration-300 transition-all ${
48
- active ? "max-h-96 border-t" : "max-h-0"
55
+ open ? "max-h-96 border-t" : "max-h-0"
49
56
  }`}
50
57
  >
51
58
  <div className="px-6 py-4">{children}</div>
@@ -28,7 +28,7 @@ export const Tab: TabComponent = ({ children, tabs, options }) => {
28
28
 
29
29
  return (
30
30
  <div
31
- className={`flex w-full h-full ${
31
+ className={`flex w-full h-full overlow-hidden ${
32
32
  options?.variant !== "horizontal"
33
33
  ? "flex-col divide-y-1"
34
34
  : "flex-col lg:flex-row divide-y-1 lg:divide-y-0 divide-x-0 lg:divide-x-1"
@@ -41,7 +41,7 @@ interface TableProps {
41
41
  };
42
42
  };
43
43
  hideNumberColumn?: boolean;
44
- enableBorder?: boolean;
44
+ border?: boolean;
45
45
  maxRow?: 10 | 20 | 50 | 100;
46
46
  height?: "full" | "fit" | "20" | "40" | "80";
47
47
  };
@@ -391,7 +391,11 @@ export const Table: TableComponentProps = ({
391
391
  options?.toolbar?.filter?.show !== false ||
392
392
  options?.toolbar?.search?.show !== false ||
393
393
  options?.toolbar?.export?.show !== false) && (
394
- <div className="flex justify-between items-center gap-4 w-full h-fit overflow-auto [&::-webkit-scrollbar]:hidden">
394
+ <div
395
+ className={`flex items-center gap-4 w-full h-fit overflow-auto [&::-webkit-scrollbar]:hidden ${
396
+ !title ? "justify-end" : "justify-between"
397
+ }`}
398
+ >
395
399
  {title && <span className="text-lg whitespace-nowrap">{title}</span>}
396
400
  <div className="flex items-center gap-4">
397
401
  {options?.toolbar?.addData?.show !== false && (
@@ -473,7 +477,7 @@ export const Table: TableComponentProps = ({
473
477
  )}
474
478
  <div
475
479
  className={`overflow-auto ${height} ${
476
- options?.enableBorder && "border rounded-md"
480
+ options?.border && "border rounded-md"
477
481
  }`}
478
482
  >
479
483
  <table className="w-full text-sm overflow-x-auto">