next-helios-fe 1.8.104 → 1.8.106

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.104",
3
+ "version": "1.8.106",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -100,7 +100,7 @@ export const Tab: TabComponent = ({
100
100
  })}
101
101
  </div>
102
102
  {cornerComponent && (
103
- <div className="flex items-center px-4 border-s">
103
+ <div className="flex items-center px-2 border-s">
104
104
  {cornerComponent}
105
105
  </div>
106
106
  )}
@@ -1,20 +1,12 @@
1
1
  "use client";
2
2
  import React from "react";
3
- import { Dropdown as Dd } from "flowbite-react";
3
+ import { Dropdown as Dd, DropdownProps as Dp } from "flowbite-react";
4
4
  import { Header, type HeaderProps } from "./header";
5
5
  import { Item, type ItemProps } from "./item";
6
6
 
7
- interface DropdownProps {
8
- children: React.ReactNode;
9
- placement?:
10
- | "top"
11
- | "top-start"
12
- | "top-end"
13
- | "bottom"
14
- | "bottom-start"
15
- | "bottom-end";
16
- dismissOnClick?: boolean;
7
+ interface DropdownProps extends Omit<Dp, "label" | "trigger"> {
17
8
  trigger?: React.ReactNode;
9
+ actionTrigger?: "click" | "hover";
18
10
  }
19
11
 
20
12
  interface DropdownComponent extends React.FC<DropdownProps> {
@@ -23,12 +15,11 @@ interface DropdownComponent extends React.FC<DropdownProps> {
23
15
  }
24
16
 
25
17
  export const Dropdown: DropdownComponent = ({
26
- children,
27
- placement,
28
- dismissOnClick,
29
18
  trigger,
19
+ actionTrigger,
20
+ ...rest
30
21
  }) => {
31
- const childrenList = React.Children.toArray(children);
22
+ const childrenList = React.Children.toArray(rest.children);
32
23
  const header = childrenList.find((child) => {
33
24
  return (child as React.ReactElement).type === Dropdown.Header;
34
25
  });
@@ -40,8 +31,7 @@ export const Dropdown: DropdownComponent = ({
40
31
  <Dd
41
32
  label=""
42
33
  className="w-min max-h-96 px-1 z-20 rounded-md border-default bg-secondary-bg overflow-x-hidden overflow-y-auto"
43
- placement={placement || "bottom-end"}
44
- dismissOnClick={dismissOnClick ?? true}
34
+ dismissOnClick={rest.dismissOnClick ?? true}
45
35
  theme={{
46
36
  floating: {
47
37
  header: "px-4 py-2 text-sm !text-default",
@@ -55,12 +45,14 @@ export const Dropdown: DropdownComponent = ({
55
45
  },
56
46
  }}
57
47
  renderTrigger={() => <div>{trigger}</div>}
48
+ trigger={actionTrigger || "click"}
49
+ {...rest}
58
50
  >
59
51
  {header}
60
52
  {itemList}
61
53
  {childrenList.length > 0 && !header && itemList.length === 0 && (
62
54
  <Dd.Item className="flex flex-col cursor-default" as="div">
63
- {children}
55
+ {rest.children}
64
56
  </Dd.Item>
65
57
  )}
66
58
  </Dd>
@@ -1,13 +1,12 @@
1
1
  "use client";
2
2
  import React from "react";
3
- import { Dropdown as Dd } from "flowbite-react";
3
+ import { Dropdown as Dd, DropdownItemProps } from "flowbite-react";
4
4
 
5
- export interface ItemProps {
5
+ export interface ItemProps extends Omit<DropdownItemProps, "as"> {
6
6
  children: React.ReactNode;
7
7
  active?: boolean;
8
8
  as?: "button" | "title";
9
9
  disabled?: boolean;
10
- onClick?: () => void;
11
10
  }
12
11
 
13
12
  export const Item: React.FC<ItemProps> = ({
@@ -15,7 +14,7 @@ export const Item: React.FC<ItemProps> = ({
15
14
  active,
16
15
  as,
17
16
  disabled,
18
- onClick,
17
+ ...rest
19
18
  }) => {
20
19
  return (
21
20
  <Dd.Item
@@ -25,9 +24,9 @@ export const Item: React.FC<ItemProps> = ({
25
24
  : `disabled:text-disabled ${
26
25
  as === "title" ? "" : "hover:bg-secondary-light"
27
26
  }`
28
- } outline-0`}
27
+ }`}
29
28
  disabled={active ? true : (disabled || as === "title") ?? false}
30
- onClick={onClick}
29
+ {...rest}
31
30
  >
32
31
  {children}
33
32
  </Dd.Item>
@@ -46,10 +46,16 @@ export const Checkbox: React.FC<CheckboxProps> = ({
46
46
  <input
47
47
  ref={inputRef}
48
48
  type="checkbox"
49
- className={`border-default border rounded bg-secondary-bg cursor-pointer indeterminate:bg-primary indeterminate:hover:bg-primary indeterminate:disabled:bg-secondary-dark checked:bg-primary focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:bg-secondary-light disabled:checked:bg-secondary-dark disabled:cursor-default ${
49
+ className={`border-default border rounded bg-secondary-bg cursor-pointer indeterminate:bg-primary indeterminate:hover:bg-primary indeterminate:disabled:bg-secondary-dark checked:bg-primary focus:outline-none focus:ring-1 focus:ring-primary focus:ring-offset-0 focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:checked:bg-secondary-dark disabled:cursor-default ${
50
50
  theme && "border-0"
51
51
  }`}
52
52
  style={{ backgroundColor: theme }}
53
+ onKeyDown={(e) => {
54
+ if (e.key === "Enter") {
55
+ e.preventDefault();
56
+ inputRef.current?.click();
57
+ }
58
+ }}
53
59
  {...rest}
54
60
  />
55
61
  </div>
@@ -72,13 +78,18 @@ export const Checkbox: React.FC<CheckboxProps> = ({
72
78
  )}
73
79
  </div>
74
80
  )}
75
- <div
76
- className={`flex items-center justify-start w-8 h-5 border rounded-full bg-secondary-bg overflow-hidden cursor-pointer duration-300 group-has-[:checked]/checkbox:justify-end group-has-[:checked]/checkbox:bg-primary group-has-[:disabled:checked]/checkbox:bg-secondary-dark ${
81
+ <button
82
+ type="button"
83
+ className={`flex items-center justify-start w-8 h-5 border rounded-full bg-secondary-bg overflow-hidden cursor-pointer duration-300 group-has-[:checked]/checkbox:justify-end group-has-[:checked]/checkbox:bg-primary group-has-[:disabled]/checkbox:bg-secondary-light group-has-[:disabled:checked]/checkbox:bg-secondary-dark focus:outline-none focus:ring-1 focus:ring-primary focus:ring-offset-0 focus:shadow focus:shadow-primary focus:border-primary-dark ${
77
84
  options?.variant !== "switch" && "hidden"
78
85
  }`}
86
+ disabled={rest.disabled}
87
+ onClick={() => {
88
+ inputRef.current?.click();
89
+ }}
79
90
  >
80
91
  <div className="w-4 h-4 rounded-full bg-secondary duration-300 group-has-[:checked]/checkbox:bg-secondary-bg group-has-[:disabled]/checkbox:bg-secondary-dark group-has-[:disabled:checked]/checkbox:bg-secondary-bg"></div>
81
- </div>
92
+ </button>
82
93
  </label>
83
94
  );
84
95
  };
@@ -92,6 +92,7 @@ export const Color: React.FC<ColorProps> = ({
92
92
  ref={inputRef}
93
93
  type="color"
94
94
  className="absolute -bottom-2.5 -z-10"
95
+ tabIndex={-1}
95
96
  value={tempValue}
96
97
  onChange={(e) => setTempValue(e.target.value.toUpperCase())}
97
98
  {...rest}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import React from "react";
2
+ import React, { useRef } from "react";
3
3
  import { Tooltip } from "../../../components";
4
4
  import { Icon } from "@iconify/react";
5
5
 
@@ -20,6 +20,8 @@ export const Radio: React.FC<RadioProps> = ({
20
20
  theme,
21
21
  ...rest
22
22
  }) => {
23
+ const inputRef = useRef<HTMLInputElement>(null);
24
+
23
25
  return (
24
26
  <label
25
27
  className={`flex items-center w-fit ${
@@ -35,11 +37,18 @@ export const Radio: React.FC<RadioProps> = ({
35
37
  }`}
36
38
  >
37
39
  <input
40
+ ref={inputRef}
38
41
  type="radio"
39
- className={`border-default border bg-secondary-bg cursor-pointer checked:bg-primary focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:bg-secondary-light disabled:checked:bg-secondary-dark disabled:cursor-default ${
42
+ className={`border-default border bg-secondary-bg cursor-pointer checked:bg-primary focus:outline-none focus:ring-1 focus:ring-primary focus:ring-offset-0 focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:checked:bg-secondary-dark disabled:cursor-default ${
40
43
  theme && "border-0"
41
44
  }`}
42
45
  style={{ backgroundColor: theme }}
46
+ onKeyDown={(e) => {
47
+ if (e.key === "Enter") {
48
+ e.preventDefault();
49
+ inputRef.current?.click();
50
+ }
51
+ }}
43
52
  {...rest}
44
53
  />
45
54
  </div>
@@ -63,7 +63,7 @@ export const Range: React.FC<RangeProps> = ({
63
63
  <input
64
64
  ref={inputRef}
65
65
  type="range"
66
- className={`flex-1 border-default border cursor-pointer accent-primary focus:outline-none focus:ring-0 focus:ring-offset-0 disabled:accent-secondary-dark disabled:cursor-default ${
66
+ className={`flex-1 border border-default rounded-md cursor-pointer accent-primary focus:outline-none focus:ring-0 focus:ring-offset-0 focus:accent-primary-dark disabled:accent-secondary-dark disabled:cursor-default ${
67
67
  theme && "border-0"
68
68
  }`}
69
69
  style={{ accentColor: theme }}