next-helios-fe 1.8.82 → 1.8.83
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
@@ -10,9 +10,15 @@ interface ChipProps {
|
|
10
10
|
bordered?: boolean;
|
11
11
|
borderRadius?: "basic" | "full";
|
12
12
|
};
|
13
|
+
onRemove?: () => void;
|
13
14
|
}
|
14
15
|
|
15
|
-
export const Chip: React.FC<ChipProps> = ({
|
16
|
+
export const Chip: React.FC<ChipProps> = ({
|
17
|
+
label,
|
18
|
+
icon,
|
19
|
+
options,
|
20
|
+
onRemove,
|
21
|
+
}) => {
|
16
22
|
const variant =
|
17
23
|
options?.bordered !== true
|
18
24
|
? options?.variant === "secondary"
|
@@ -35,13 +41,37 @@ export const Chip: React.FC<ChipProps> = ({ label, icon, options }) => {
|
|
35
41
|
: "border border-primary text-primary";
|
36
42
|
const borderRadius =
|
37
43
|
options?.borderRadius === "full" ? "rounded-full" : "rounded-md";
|
44
|
+
const removeButton =
|
45
|
+
options?.variant === "secondary"
|
46
|
+
? "text-secondary hover:text-secondary-dark"
|
47
|
+
: options?.variant === "success"
|
48
|
+
? "text-success hover:text-success-dark"
|
49
|
+
: options?.variant === "warning"
|
50
|
+
? "text-warning hover:text-warning-dark"
|
51
|
+
: options?.variant === "danger"
|
52
|
+
? "text-danger hover:text-danger-dark"
|
53
|
+
: "text-primary hover:text-primary-dark";
|
38
54
|
|
39
55
|
return (
|
40
56
|
<div
|
41
|
-
className={`flex items-center gap-
|
57
|
+
className={`flex items-center gap-3 w-fit px-3 py-1 font-medium select-none ${variant} ${borderRadius}`}
|
42
58
|
>
|
43
|
-
|
44
|
-
|
59
|
+
<div className="flex items-center gap-1.5">
|
60
|
+
{icon && <Icon icon={icon} className="text-lg" />}
|
61
|
+
<span className="text-sm">{label}</span>
|
62
|
+
</div>
|
63
|
+
{onRemove && (
|
64
|
+
<div
|
65
|
+
className={`cursor-pointer active:opacity-70 active:duration-300 active:ease-out disabled:active:opacity-100 ${removeButton}`}
|
66
|
+
onClick={() => {
|
67
|
+
if (onRemove) {
|
68
|
+
onRemove();
|
69
|
+
}
|
70
|
+
}}
|
71
|
+
>
|
72
|
+
<Icon icon="pajamas:close" />
|
73
|
+
</div>
|
74
|
+
)}
|
45
75
|
</div>
|
46
76
|
);
|
47
77
|
};
|
@@ -46,7 +46,7 @@ interface TableProps {
|
|
46
46
|
};
|
47
47
|
customTool?: {
|
48
48
|
icon: string;
|
49
|
-
tooltip
|
49
|
+
tooltip: string;
|
50
50
|
variant: "primary" | "secondary" | "success" | "warning" | "danger";
|
51
51
|
show?: boolean;
|
52
52
|
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
@@ -548,7 +548,7 @@ export const Table: TableComponentProps = ({
|
|
548
548
|
: "bg-primary hover:bg-primary-dark";
|
549
549
|
|
550
550
|
if (item.show !== false) {
|
551
|
-
return
|
551
|
+
return (
|
552
552
|
<Tooltip
|
553
553
|
key={index}
|
554
554
|
content={item.tooltip || "custom tool"}
|
@@ -563,16 +563,6 @@ export const Table: TableComponentProps = ({
|
|
563
563
|
<Icon icon={item.icon} className="text-2xl" />
|
564
564
|
</button>
|
565
565
|
</Tooltip>
|
566
|
-
) : (
|
567
|
-
<button
|
568
|
-
type="button"
|
569
|
-
className={`rounded-full p-1.5 text-white ${variant}`}
|
570
|
-
onClick={(e) => {
|
571
|
-
item.onClick && item.onClick(e);
|
572
|
-
}}
|
573
|
-
>
|
574
|
-
<Icon icon={item.icon} className="text-2xl" />
|
575
|
-
</button>
|
576
566
|
);
|
577
567
|
}
|
578
568
|
})}
|