next-helios-fe 1.6.25 → 1.6.27
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/dist/components/form/input/color.d.ts +2 -1
- package/dist/components/form/input/date.d.ts +1 -0
- package/dist/components/form/input/email.d.ts +3 -1
- package/dist/components/form/input/file.d.ts +3 -1
- package/dist/components/form/input/number.d.ts +3 -1
- package/dist/components/form/input/password.d.ts +3 -1
- package/dist/components/form/input/range.d.ts +4 -2
- package/dist/components/form/input/text.d.ts +3 -1
- package/dist/components/form/input/time.d.ts +2 -1
- package/dist/components/form/other/autocomplete.d.ts +6 -5
- package/dist/components/form/other/multipleSelect.d.ts +6 -5
- package/dist/components/form/other/phoneNumber.d.ts +2 -1
- package/dist/components/form/other/pin.d.ts +2 -1
- package/dist/components/form/other/secret.d.ts +2 -1
- package/dist/components/form/other/select.d.ts +6 -5
- package/dist/components/form/other/textarea.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/form/input/color.tsx +20 -10
- package/src/components/form/input/date.tsx +24 -11
- package/src/components/form/input/email.tsx +36 -11
- package/src/components/form/input/file.tsx +37 -11
- package/src/components/form/input/number.tsx +36 -11
- package/src/components/form/input/password.tsx +30 -10
- package/src/components/form/input/range.tsx +37 -16
- package/src/components/form/input/text.tsx +36 -11
- package/src/components/form/input/time.tsx +25 -12
- package/src/components/form/other/autocomplete.tsx +27 -17
- package/src/components/form/other/multipleSelect.tsx +26 -16
- package/src/components/form/other/phoneNumber.tsx +21 -10
- package/src/components/form/other/pin.tsx +21 -10
- package/src/components/form/other/secret.tsx +20 -10
- package/src/components/form/other/select.tsx +24 -15
- package/src/components/form/other/textarea.tsx +31 -10
package/package.json
CHANGED
@@ -4,17 +4,19 @@ import { Icon } from "@iconify/react";
|
|
4
4
|
|
5
5
|
export interface ColorProps
|
6
6
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
7
|
+
label?: string;
|
8
|
+
description?: string;
|
7
9
|
options?: {
|
8
10
|
width?: "full" | "fit";
|
9
11
|
height?: "short" | "medium" | "high";
|
10
12
|
};
|
11
|
-
label?: string;
|
12
13
|
onClipboardClick?: (value: string) => void;
|
13
14
|
}
|
14
15
|
|
15
16
|
export const Color: React.FC<ColorProps> = ({
|
16
17
|
options,
|
17
18
|
label,
|
19
|
+
description,
|
18
20
|
onClipboardClick,
|
19
21
|
...rest
|
20
22
|
}) => {
|
@@ -47,15 +49,23 @@ export const Color: React.FC<ColorProps> = ({
|
|
47
49
|
|
48
50
|
return (
|
49
51
|
<label className={`grid gap-2 ${width}`}>
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
<div className="flex justify-between items-center">
|
53
|
+
{label && (
|
54
|
+
<span
|
55
|
+
className={`text-sm select-none ${
|
56
|
+
rest.required &&
|
57
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
58
|
+
}`}
|
59
|
+
>
|
60
|
+
{label}
|
61
|
+
</span>
|
62
|
+
)}
|
63
|
+
{description && (
|
64
|
+
<span title={description} className="text-sm text-primary-dark">
|
65
|
+
<Icon icon="octicon:info-16" />
|
66
|
+
</span>
|
67
|
+
)}
|
68
|
+
</div>
|
59
69
|
<div className="flex gap-4">
|
60
70
|
<div className="relative flex flex-col">
|
61
71
|
<button
|
@@ -6,6 +6,7 @@ import dayjs from "dayjs";
|
|
6
6
|
|
7
7
|
export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
8
8
|
label?: string;
|
9
|
+
description?: string;
|
9
10
|
options?: {
|
10
11
|
enableSelectRange?: boolean;
|
11
12
|
width?: "full" | "fit";
|
@@ -13,7 +14,12 @@ export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
13
14
|
};
|
14
15
|
}
|
15
16
|
|
16
|
-
export const Date: React.FC<DateProps> = ({
|
17
|
+
export const Date: React.FC<DateProps> = ({
|
18
|
+
options,
|
19
|
+
label,
|
20
|
+
description,
|
21
|
+
...rest
|
22
|
+
}) => {
|
17
23
|
const [tempValue, setTempValue] = useState<any>([
|
18
24
|
dayjs().startOf("day"),
|
19
25
|
dayjs().endOf("day"),
|
@@ -40,16 +46,23 @@ export const Date: React.FC<DateProps> = ({ options, label, ...rest }) => {
|
|
40
46
|
return (
|
41
47
|
<div className="flex items-end">
|
42
48
|
<label className={`grid gap-2 ${width}`}>
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
<div className="flex justify-between items-center">
|
50
|
+
{label && (
|
51
|
+
<span
|
52
|
+
className={`text-sm select-none ${
|
53
|
+
rest.required &&
|
54
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
55
|
+
}`}
|
56
|
+
>
|
57
|
+
{label}
|
58
|
+
</span>
|
59
|
+
)}
|
60
|
+
{description && (
|
61
|
+
<span title={description} className="text-sm text-primary-dark">
|
62
|
+
<Icon icon="octicon:info-16" />
|
63
|
+
</span>
|
64
|
+
)}
|
65
|
+
</div>
|
53
66
|
<div className="relative flex items-center">
|
54
67
|
<input
|
55
68
|
type="text"
|
@@ -1,16 +1,24 @@
|
|
1
1
|
"use client";
|
2
2
|
import React from "react";
|
3
|
+
import { Icon } from "@iconify/react";
|
3
4
|
|
4
5
|
export interface EmailProps
|
5
6
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
7
|
+
label?: string;
|
8
|
+
description?: string;
|
6
9
|
options?: {
|
7
10
|
width?: "full" | "fit";
|
8
11
|
height?: "short" | "medium" | "high";
|
12
|
+
hideInputDetail?: boolean;
|
9
13
|
};
|
10
|
-
label?: string;
|
11
14
|
}
|
12
15
|
|
13
|
-
export const Email: React.FC<EmailProps> = ({
|
16
|
+
export const Email: React.FC<EmailProps> = ({
|
17
|
+
options,
|
18
|
+
label,
|
19
|
+
description,
|
20
|
+
...rest
|
21
|
+
}) => {
|
14
22
|
const width = options?.width === "fit" ? "w-fit" : "w-full";
|
15
23
|
const height =
|
16
24
|
options?.height === "short"
|
@@ -21,15 +29,32 @@ export const Email: React.FC<EmailProps> = ({ options, label, ...rest }) => {
|
|
21
29
|
|
22
30
|
return (
|
23
31
|
<label className={`grid gap-2 ${width}`}>
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
<div className="flex justify-between">
|
33
|
+
{label && (
|
34
|
+
<span
|
35
|
+
className={`text-sm select-none ${
|
36
|
+
rest.required &&
|
37
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
38
|
+
}`}
|
39
|
+
>
|
40
|
+
{label}
|
41
|
+
</span>
|
42
|
+
)}
|
43
|
+
{!options?.hideInputDetail && (
|
44
|
+
<div className="flex items-center gap-2">
|
45
|
+
{(rest.minLength || rest.maxLength) && (
|
46
|
+
<span className="text-sm select-none">
|
47
|
+
{rest.minLength || 0}/{rest.maxLength || "∞"}
|
48
|
+
</span>
|
49
|
+
)}
|
50
|
+
{description && (
|
51
|
+
<span title={description} className="text-sm text-primary-dark">
|
52
|
+
<Icon icon="octicon:info-16" />
|
53
|
+
</span>
|
54
|
+
)}
|
55
|
+
</div>
|
56
|
+
)}
|
57
|
+
</div>
|
33
58
|
<input
|
34
59
|
type="email"
|
35
60
|
className={`w-full px-4 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-slate-300 focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-slate-400 ${height}`}
|
@@ -3,6 +3,8 @@ import React, { useState, useEffect, useRef } from "react";
|
|
3
3
|
import { Icon } from "@iconify/react";
|
4
4
|
|
5
5
|
export interface FileProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
6
|
+
label?: string;
|
7
|
+
description?: string;
|
6
8
|
options?: {
|
7
9
|
variant?: "basic" | "drag&drop";
|
8
10
|
buttonVariant?: "basic" | "button";
|
@@ -10,15 +12,16 @@ export interface FileProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
10
12
|
buttonOnly?: boolean;
|
11
13
|
width?: "full" | "fit";
|
12
14
|
height?: "short" | "medium" | "high";
|
15
|
+
hideInputDetail?: boolean;
|
13
16
|
};
|
14
|
-
label?: string;
|
15
17
|
defaultValue?: any[];
|
16
18
|
value?: any[];
|
17
19
|
}
|
18
20
|
|
19
21
|
export const File: React.FC<FileProps> = ({
|
20
|
-
options,
|
21
22
|
label,
|
23
|
+
description,
|
24
|
+
options,
|
22
25
|
defaultValue,
|
23
26
|
value,
|
24
27
|
...rest
|
@@ -54,16 +57,39 @@ export const File: React.FC<FileProps> = ({
|
|
54
57
|
|
55
58
|
return (
|
56
59
|
<label className={`grid gap-2 ${width}`}>
|
57
|
-
{
|
58
|
-
<
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
{!options?.buttonOnly && (
|
61
|
+
<div className="flex justify-between">
|
62
|
+
{label && (
|
63
|
+
<span
|
64
|
+
className={`text-sm select-none ${
|
65
|
+
rest.required &&
|
66
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
67
|
+
}`}
|
68
|
+
>
|
69
|
+
{label}
|
70
|
+
</span>
|
71
|
+
)}
|
72
|
+
{!options?.hideInputDetail && (
|
73
|
+
<div className="flex items-center gap-2">
|
74
|
+
{options?.variant !== "drag&drop" && options?.maxSizeInMb && (
|
75
|
+
<span className="text-sm select-none">
|
76
|
+
{options?.maxSizeInMb} MB
|
77
|
+
</span>
|
78
|
+
)}
|
79
|
+
{description && (
|
80
|
+
<span title={description} className="text-sm text-primary-dark">
|
81
|
+
<Icon icon="octicon:info-16" />
|
82
|
+
</span>
|
83
|
+
)}
|
84
|
+
</div>
|
85
|
+
)}
|
86
|
+
</div>
|
65
87
|
)}
|
66
|
-
<div
|
88
|
+
<div
|
89
|
+
className={`flex items-center gap-4 ${
|
90
|
+
!options?.buttonOnly && "flex-row-reverse"
|
91
|
+
}`}
|
92
|
+
>
|
67
93
|
{options?.variant !== "drag&drop" ? (
|
68
94
|
<div
|
69
95
|
className={`relative flex-1 items-center ${
|
@@ -4,14 +4,21 @@ import { Icon } from "@iconify/react";
|
|
4
4
|
|
5
5
|
export interface NumberProps
|
6
6
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
7
|
+
label?: string;
|
8
|
+
description?: string;
|
7
9
|
options?: {
|
8
10
|
width?: "full" | "fit";
|
9
11
|
height?: "short" | "medium" | "high";
|
12
|
+
hideInputDetail?: boolean;
|
10
13
|
};
|
11
|
-
label?: string;
|
12
14
|
}
|
13
15
|
|
14
|
-
export const Number: React.FC<NumberProps> = ({
|
16
|
+
export const Number: React.FC<NumberProps> = ({
|
17
|
+
options,
|
18
|
+
label,
|
19
|
+
description,
|
20
|
+
...rest
|
21
|
+
}) => {
|
15
22
|
const inputRef = useRef<HTMLInputElement>(null);
|
16
23
|
const width = options?.width === "fit" ? "w-fit" : "w-full";
|
17
24
|
const height =
|
@@ -23,15 +30,33 @@ export const Number: React.FC<NumberProps> = ({ options, label, ...rest }) => {
|
|
23
30
|
|
24
31
|
return (
|
25
32
|
<label className={`grid gap-2 ${width}`}>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
<div className="flex justify-between">
|
34
|
+
{label && (
|
35
|
+
<span
|
36
|
+
className={`text-sm select-none ${
|
37
|
+
rest.required &&
|
38
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
39
|
+
}`}
|
40
|
+
>
|
41
|
+
{label}
|
42
|
+
</span>
|
43
|
+
)}
|
44
|
+
{!options?.hideInputDetail && (
|
45
|
+
<div className="flex items-center gap-2">
|
46
|
+
{(rest.min || rest.max) && (
|
47
|
+
<span className="text-sm select-none">
|
48
|
+
{rest.min || rest.min === 0 ? rest.min : "∞"}/
|
49
|
+
{rest.max || rest.max === 0 ? rest.max : "∞"}
|
50
|
+
</span>
|
51
|
+
)}
|
52
|
+
{description && (
|
53
|
+
<span title={description} className="text-sm text-primary-dark">
|
54
|
+
<Icon icon="octicon:info-16" />
|
55
|
+
</span>
|
56
|
+
)}
|
57
|
+
</div>
|
58
|
+
)}
|
59
|
+
</div>
|
35
60
|
<div className="relative flex items-center">
|
36
61
|
<input
|
37
62
|
ref={inputRef}
|
@@ -4,16 +4,19 @@ import { Icon } from "@iconify/react";
|
|
4
4
|
|
5
5
|
export interface PasswordProps
|
6
6
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
7
|
+
label?: string;
|
8
|
+
description?: string;
|
7
9
|
options?: {
|
8
10
|
width?: "full" | "fit";
|
9
11
|
height?: "short" | "medium" | "high";
|
12
|
+
hideInputDetail?: boolean;
|
10
13
|
};
|
11
|
-
label?: string;
|
12
14
|
}
|
13
15
|
|
14
16
|
export const Password: React.FC<PasswordProps> = ({
|
15
17
|
options,
|
16
18
|
label,
|
19
|
+
description,
|
17
20
|
...rest
|
18
21
|
}) => {
|
19
22
|
const [show, setShow] = useState(false);
|
@@ -27,15 +30,32 @@ export const Password: React.FC<PasswordProps> = ({
|
|
27
30
|
|
28
31
|
return (
|
29
32
|
<label className={`grid gap-2 ${width}`}>
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
<div className="flex justify-between">
|
34
|
+
{label && (
|
35
|
+
<span
|
36
|
+
className={`text-sm select-none ${
|
37
|
+
rest.required &&
|
38
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
39
|
+
}`}
|
40
|
+
>
|
41
|
+
{label}
|
42
|
+
</span>
|
43
|
+
)}
|
44
|
+
{!options?.hideInputDetail && (
|
45
|
+
<div className="flex items-center gap-2">
|
46
|
+
{(rest.minLength || rest.maxLength) && (
|
47
|
+
<span className="text-sm select-none">
|
48
|
+
{rest.minLength || 0}/{rest.maxLength || "∞"}
|
49
|
+
</span>
|
50
|
+
)}
|
51
|
+
{description && (
|
52
|
+
<span title={description} className="text-sm text-primary-dark">
|
53
|
+
<Icon icon="octicon:info-16" />
|
54
|
+
</span>
|
55
|
+
)}
|
56
|
+
</div>
|
57
|
+
)}
|
58
|
+
</div>
|
39
59
|
<div className="relative flex items-center">
|
40
60
|
<input
|
41
61
|
type={show ? "text" : "password"}
|
@@ -1,36 +1,59 @@
|
|
1
1
|
"use client";
|
2
|
-
import React from "react";
|
2
|
+
import React, { useRef } from "react";
|
3
|
+
import { Icon } from "@iconify/react";
|
3
4
|
|
4
5
|
export interface RangeProps
|
5
6
|
extends React.InputHTMLAttributes<HTMLInputElement> {
|
7
|
+
label?: string;
|
8
|
+
description?: string;
|
9
|
+
theme?: string;
|
6
10
|
options?: {
|
7
11
|
width?: "full" | "fit";
|
12
|
+
hideInputDetail?: boolean;
|
8
13
|
};
|
9
|
-
label?: string;
|
10
|
-
theme?: string;
|
11
14
|
}
|
12
15
|
|
13
16
|
export const Range: React.FC<RangeProps> = ({
|
14
17
|
options,
|
15
18
|
label,
|
19
|
+
description,
|
16
20
|
theme,
|
17
21
|
...rest
|
18
22
|
}) => {
|
23
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
19
24
|
const width = options?.width === "fit" ? "w-fit" : "w-full";
|
20
25
|
|
21
26
|
return (
|
22
27
|
<label className={`grid gap-2 ${width}`}>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
<div className="flex justify-between">
|
29
|
+
{label && (
|
30
|
+
<span
|
31
|
+
className={`text-sm select-none ${
|
32
|
+
rest.required &&
|
33
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
34
|
+
}`}
|
35
|
+
>
|
36
|
+
{label}
|
37
|
+
</span>
|
38
|
+
)}
|
39
|
+
{!options?.hideInputDetail && (
|
40
|
+
<div className="flex items-center gap-2">
|
41
|
+
{(rest.min || rest.max) && (
|
42
|
+
<span className="text-sm select-none">
|
43
|
+
{rest.min || 0}/{rest.max || 100}
|
44
|
+
</span>
|
45
|
+
)}
|
46
|
+
{description && (
|
47
|
+
<span title={description} className="text-sm text-primary-dark">
|
48
|
+
<Icon icon="octicon:info-16" />
|
49
|
+
</span>
|
50
|
+
)}
|
51
|
+
</div>
|
52
|
+
)}
|
53
|
+
</div>
|
32
54
|
<div className="flex gap-2">
|
33
55
|
<input
|
56
|
+
ref={inputRef}
|
34
57
|
type="range"
|
35
58
|
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 ${
|
36
59
|
theme && "border-0"
|
@@ -38,10 +61,8 @@ export const Range: React.FC<RangeProps> = ({
|
|
38
61
|
style={{ accentColor: theme }}
|
39
62
|
{...rest}
|
40
63
|
/>
|
41
|
-
{
|
42
|
-
<span className="w-7 text-right">
|
43
|
-
{rest.value || rest.defaultValue}
|
44
|
-
</span>
|
64
|
+
{inputRef.current?.value && (
|
65
|
+
<span className="w-7 text-right">{inputRef.current?.value}</span>
|
45
66
|
)}
|
46
67
|
</div>
|
47
68
|
</label>
|
@@ -1,15 +1,23 @@
|
|
1
1
|
"use client";
|
2
2
|
import React from "react";
|
3
|
+
import { Icon } from "@iconify/react";
|
3
4
|
|
4
5
|
export interface TextProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
6
|
+
label?: string;
|
7
|
+
description?: string;
|
5
8
|
options?: {
|
6
9
|
width?: "full" | "fit";
|
7
10
|
height?: "short" | "medium" | "high";
|
11
|
+
hideInputDetail?: boolean;
|
8
12
|
};
|
9
|
-
label?: string;
|
10
13
|
}
|
11
14
|
|
12
|
-
export const Text: React.FC<TextProps> = ({
|
15
|
+
export const Text: React.FC<TextProps> = ({
|
16
|
+
options,
|
17
|
+
label,
|
18
|
+
description,
|
19
|
+
...rest
|
20
|
+
}) => {
|
13
21
|
const width = options?.width === "fit" ? "w-fit" : "w-full";
|
14
22
|
const height =
|
15
23
|
options?.height === "short"
|
@@ -20,15 +28,32 @@ export const Text: React.FC<TextProps> = ({ options, label, ...rest }) => {
|
|
20
28
|
|
21
29
|
return (
|
22
30
|
<label className={`grid gap-2 ${width}`}>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
<div className="flex justify-between">
|
32
|
+
{label && (
|
33
|
+
<span
|
34
|
+
className={`text-sm select-none ${
|
35
|
+
rest.required &&
|
36
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
37
|
+
}`}
|
38
|
+
>
|
39
|
+
{label}
|
40
|
+
</span>
|
41
|
+
)}
|
42
|
+
{!options?.hideInputDetail && (
|
43
|
+
<div className="flex items-center gap-2">
|
44
|
+
{(rest.minLength || rest.maxLength) && (
|
45
|
+
<span className="text-sm select-none">
|
46
|
+
{rest.minLength || 0}/{rest.maxLength || "∞"}
|
47
|
+
</span>
|
48
|
+
)}
|
49
|
+
{description && (
|
50
|
+
<span title={description} className="text-sm text-primary-dark">
|
51
|
+
<Icon icon="octicon:info-16" />
|
52
|
+
</span>
|
53
|
+
)}
|
54
|
+
</div>
|
55
|
+
)}
|
56
|
+
</div>
|
32
57
|
<input
|
33
58
|
type="text"
|
34
59
|
className={`w-full px-4 border-default border rounded-md bg-secondary-bg placeholder:duration-300 placeholder:translate-x-0 focus:placeholder:translate-x-1 placeholder:text-slate-300 focus:outline-none focus:ring-1 focus:ring-primary focus:shadow focus:shadow-primary focus:border-primary-dark disabled:bg-secondary-light disabled:text-slate-400 ${height}`}
|
@@ -5,14 +5,20 @@ import { Icon } from "@iconify/react";
|
|
5
5
|
import dayjs from "dayjs";
|
6
6
|
|
7
7
|
export interface TimeProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
8
|
+
label?: string;
|
9
|
+
description?: string;
|
8
10
|
options?: {
|
9
11
|
width?: "full" | "fit";
|
10
12
|
height?: "short" | "medium" | "high";
|
11
13
|
};
|
12
|
-
label?: string;
|
13
14
|
}
|
14
15
|
|
15
|
-
export const Time: React.FC<TimeProps> = ({
|
16
|
+
export const Time: React.FC<TimeProps> = ({
|
17
|
+
options,
|
18
|
+
label,
|
19
|
+
description,
|
20
|
+
...rest
|
21
|
+
}) => {
|
16
22
|
const [tempValue, setTempValue] = useState(dayjs().format("hh:mm a"));
|
17
23
|
const dropdownRef = useRef<HTMLButtonElement>(null);
|
18
24
|
const hoursRef = useRef<HTMLDivElement>(null);
|
@@ -145,16 +151,23 @@ export const Time: React.FC<TimeProps> = ({ options, label, ...rest }) => {
|
|
145
151
|
return (
|
146
152
|
<div className="flex items-end">
|
147
153
|
<label className={`grid gap-2 ${width}`}>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
154
|
+
<div className="flex justify-between items-center">
|
155
|
+
{label && (
|
156
|
+
<span
|
157
|
+
className={`text-sm select-none ${
|
158
|
+
rest.required &&
|
159
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
160
|
+
}`}
|
161
|
+
>
|
162
|
+
{label}
|
163
|
+
</span>
|
164
|
+
)}
|
165
|
+
{description && (
|
166
|
+
<span title={description} className="text-sm text-primary-dark">
|
167
|
+
<Icon icon="octicon:info-16" />
|
168
|
+
</span>
|
169
|
+
)}
|
170
|
+
</div>
|
158
171
|
<div className="relative flex items-center">
|
159
172
|
<input
|
160
173
|
type="text"
|
@@ -1,28 +1,30 @@
|
|
1
1
|
"use client";
|
2
2
|
import React, { useState, useEffect, useRef } from "react";
|
3
|
-
import { Icon } from "@iconify/react";
|
4
3
|
import { createPortal } from "react-dom";
|
4
|
+
import { Icon } from "@iconify/react";
|
5
5
|
|
6
6
|
export interface AutocompleteProps
|
7
7
|
extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
8
|
-
options?: {
|
9
|
-
width?: "full" | "fit";
|
10
|
-
height?: "short" | "medium" | "high";
|
11
|
-
};
|
12
|
-
label?: string;
|
13
8
|
menus: {
|
14
9
|
label: string;
|
15
10
|
value: string;
|
16
11
|
[key: string]: any;
|
17
12
|
}[];
|
13
|
+
label?: string;
|
18
14
|
placeholder?: string;
|
15
|
+
description?: string;
|
16
|
+
options?: {
|
17
|
+
width?: "full" | "fit";
|
18
|
+
height?: "short" | "medium" | "high";
|
19
|
+
};
|
19
20
|
}
|
20
21
|
|
21
22
|
export const Autocomplete: React.FC<AutocompleteProps> = ({
|
22
|
-
options,
|
23
|
-
label,
|
24
23
|
menus,
|
24
|
+
label,
|
25
25
|
placeholder,
|
26
|
+
description,
|
27
|
+
options,
|
26
28
|
...rest
|
27
29
|
}) => {
|
28
30
|
const [tempValue, setTempValue] = useState("");
|
@@ -116,15 +118,23 @@ export const Autocomplete: React.FC<AutocompleteProps> = ({
|
|
116
118
|
|
117
119
|
return (
|
118
120
|
<label className={`grid gap-2 ${width}`}>
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
<div className="flex justify-between items-center">
|
122
|
+
{label && (
|
123
|
+
<span
|
124
|
+
className={`text-sm select-none ${
|
125
|
+
rest.required &&
|
126
|
+
"after:content-['*'] after:ml-1 after:text-danger"
|
127
|
+
}`}
|
128
|
+
>
|
129
|
+
{label}
|
130
|
+
</span>
|
131
|
+
)}
|
132
|
+
{description && (
|
133
|
+
<span title={description} className="text-sm text-primary-dark">
|
134
|
+
<Icon icon="octicon:info-16" />
|
135
|
+
</span>
|
136
|
+
)}
|
137
|
+
</div>
|
128
138
|
<div className="relative" ref={triggerRef}>
|
129
139
|
<div
|
130
140
|
className="relative flex items-center cursor-pointer"
|