sprint-asia-custom-component 0.1.68 → 0.1.69
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/index.js
CHANGED
|
@@ -24068,7 +24068,8 @@
|
|
|
24068
24068
|
isEdited = true,
|
|
24069
24069
|
mode = "default",
|
|
24070
24070
|
footer = null,
|
|
24071
|
-
currentOption = ""
|
|
24071
|
+
currentOption = "",
|
|
24072
|
+
className = ""
|
|
24072
24073
|
}) => {
|
|
24073
24074
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
24074
24075
|
const dropdownRef = React.useRef(null);
|
|
@@ -24101,7 +24102,7 @@
|
|
|
24101
24102
|
return val.value === currentOption;
|
|
24102
24103
|
});
|
|
24103
24104
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
24104
|
-
className:
|
|
24105
|
+
className: `relative inline-block text-left w-full ${className}`,
|
|
24105
24106
|
ref: dropdownRef
|
|
24106
24107
|
}, title && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
24107
24108
|
className: "flex"
|
|
@@ -28924,11 +28925,12 @@
|
|
|
28924
28925
|
rightIcon = null,
|
|
28925
28926
|
placeholder = "",
|
|
28926
28927
|
footer = null,
|
|
28927
|
-
type =
|
|
28928
|
+
type = "text",
|
|
28928
28929
|
mode = "default",
|
|
28929
28930
|
isRequired = true,
|
|
28930
28931
|
value,
|
|
28931
|
-
onChangeInput
|
|
28932
|
+
onChangeInput,
|
|
28933
|
+
className = ""
|
|
28932
28934
|
}) => {
|
|
28933
28935
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
28934
28936
|
const [showPassword, setShowPassword] = React.useState(false);
|
|
@@ -28942,7 +28944,7 @@
|
|
|
28942
28944
|
setShowPassword(!showPassword);
|
|
28943
28945
|
};
|
|
28944
28946
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
28945
|
-
className:
|
|
28947
|
+
className: `w-full ${className}`
|
|
28946
28948
|
}, title && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
28947
28949
|
className: "flex"
|
|
28948
28950
|
}, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
@@ -28961,22 +28963,22 @@
|
|
|
28961
28963
|
${mode === "danger" && "text-danger500"}
|
|
28962
28964
|
`
|
|
28963
28965
|
})), /*#__PURE__*/React__default["default"].createElement("input", {
|
|
28964
|
-
type: type ===
|
|
28966
|
+
type: type === "password" ? showPassword ? "text" : "password" : type,
|
|
28965
28967
|
className: `py-2.5 px-4 w-full font-normal text-sm text-neutral300 rounded-md border
|
|
28966
|
-
${!value && mode === "default" &&
|
|
28967
|
-
${value && mode === "default" &&
|
|
28968
|
-
${isFocused && mode === "default" &&
|
|
28969
|
-
${mode === "disable" &&
|
|
28970
|
-
${mode === "danger" &&
|
|
28971
|
-
${leftIcon ?
|
|
28972
|
-
${rightIcon ?
|
|
28968
|
+
${!value && mode === "default" && "bg-neutral20 border-neutral50 focus:outline-2 outline-primary500"}
|
|
28969
|
+
${value && mode === "default" && "bg-neutral20 border-black focus:outline-2 outline-primary500"}
|
|
28970
|
+
${isFocused && mode === "default" && "bg-neutral20 border-primary500"}
|
|
28971
|
+
${mode === "disable" && "bg-neutral30 border-neutral50"}
|
|
28972
|
+
${mode === "danger" && "bg-danger50 border-danger500 focus:outline-2 outline-danger500"}
|
|
28973
|
+
${leftIcon ? "pl-10" : "pl-3"}
|
|
28974
|
+
${rightIcon ? "pr-10" : "pr-3"}`,
|
|
28973
28975
|
placeholder: placeholder,
|
|
28974
28976
|
disabled: mode === "disable",
|
|
28975
28977
|
value: value,
|
|
28976
28978
|
onChange: onChangeInput,
|
|
28977
28979
|
onFocus: handleFocus,
|
|
28978
28980
|
onBlur: handleBlur
|
|
28979
|
-
}), type ===
|
|
28981
|
+
}), type === "password" && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
28980
28982
|
className: "absolute inset-y-0 right-0 pr-4 flex items-center cursor-pointer",
|
|
28981
28983
|
onClick: handleTogglePasswordVisibility
|
|
28982
28984
|
}, showPassword ? /*#__PURE__*/React__default["default"].createElement(PiEye, {
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ const DropdownText = ({
|
|
|
11
11
|
mode = "default",
|
|
12
12
|
footer = null,
|
|
13
13
|
currentOption = "",
|
|
14
|
+
className = "",
|
|
14
15
|
}) => {
|
|
15
16
|
const [isOpen, setIsOpen] = useState(false);
|
|
16
17
|
const dropdownRef = useRef(null);
|
|
@@ -47,7 +48,7 @@ const DropdownText = ({
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
|
-
<div className=
|
|
51
|
+
<div className={`relative inline-block text-left w-full ${className}`} ref={dropdownRef}>
|
|
51
52
|
{title && (
|
|
52
53
|
<div className="flex">
|
|
53
54
|
<p className="text-sm font-normal text-black mb-1">{title}</p>
|
|
@@ -1,106 +1,122 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { PiEyeClosedLight, PiEye, PiInfo } from
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { PiEyeClosedLight, PiEye, PiInfo } from "react-icons/pi";
|
|
3
3
|
|
|
4
4
|
const TextInput = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
title = "",
|
|
6
|
+
leftIcon = null,
|
|
7
|
+
rightIcon = null,
|
|
8
|
+
placeholder = "",
|
|
9
|
+
footer = null,
|
|
10
|
+
type = "text",
|
|
11
|
+
mode = "default",
|
|
12
|
+
isRequired = true,
|
|
13
|
+
value,
|
|
14
|
+
onChangeInput,
|
|
15
|
+
className = "",
|
|
15
16
|
}) => {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
18
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const handleFocus = () => {
|
|
21
|
+
setIsFocused(true);
|
|
22
|
+
};
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const handleBlur = () => {
|
|
25
|
+
setIsFocused(false);
|
|
26
|
+
};
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const handleTogglePasswordVisibility = () => {
|
|
29
|
+
setShowPassword(!showPassword);
|
|
30
|
+
};
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</div>
|
|
40
|
-
}
|
|
32
|
+
return (
|
|
33
|
+
<div className={`w-full ${className}`}>
|
|
34
|
+
{title && (
|
|
35
|
+
<div className="flex">
|
|
36
|
+
<p className="text-sm font-normal text-black mb-1">{title}</p>
|
|
37
|
+
{isRequired && <p className="text-sm font-normal text-danger500 ml-1">*</p>}
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
<div className="relative rounded-md">
|
|
42
|
+
{leftIcon && (
|
|
43
|
+
<span className="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
|
44
|
+
<PiInfo
|
|
45
|
+
size={16}
|
|
46
|
+
className={`
|
|
46
47
|
${mode === "primary" && "text-black"}
|
|
47
48
|
${mode === "disable" && "text-neutral50"}
|
|
48
49
|
${mode === "danger" && "text-danger500"}
|
|
49
|
-
`}
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
`}
|
|
51
|
+
/>
|
|
52
|
+
</span>
|
|
53
|
+
)}
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
${
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
${
|
|
62
|
-
${
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
<input
|
|
56
|
+
type={type === "password" ? (showPassword ? "text" : "password") : type}
|
|
57
|
+
className={`py-2.5 px-4 w-full font-normal text-sm text-neutral300 rounded-md border
|
|
58
|
+
${
|
|
59
|
+
!value &&
|
|
60
|
+
mode === "default" &&
|
|
61
|
+
"bg-neutral20 border-neutral50 focus:outline-2 outline-primary500"
|
|
62
|
+
}
|
|
63
|
+
${value && mode === "default" && "bg-neutral20 border-black focus:outline-2 outline-primary500"}
|
|
64
|
+
${isFocused && mode === "default" && "bg-neutral20 border-primary500"}
|
|
65
|
+
${mode === "disable" && "bg-neutral30 border-neutral50"}
|
|
66
|
+
${mode === "danger" && "bg-danger50 border-danger500 focus:outline-2 outline-danger500"}
|
|
67
|
+
${leftIcon ? "pl-10" : "pl-3"}
|
|
68
|
+
${rightIcon ? "pr-10" : "pr-3"}`}
|
|
69
|
+
placeholder={placeholder}
|
|
70
|
+
disabled={mode === "disable"}
|
|
71
|
+
value={value}
|
|
72
|
+
onChange={onChangeInput}
|
|
73
|
+
onFocus={handleFocus}
|
|
74
|
+
onBlur={handleBlur}
|
|
75
|
+
/>
|
|
70
76
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
{type === "password" && (
|
|
78
|
+
<span
|
|
79
|
+
className="absolute inset-y-0 right-0 pr-4 flex items-center cursor-pointer"
|
|
80
|
+
onClick={handleTogglePasswordVisibility}
|
|
81
|
+
>
|
|
82
|
+
{showPassword ? (
|
|
83
|
+
<PiEye size={16} className={`text-black ${mode === "danger" && "text-danger500"}`} />
|
|
84
|
+
) : (
|
|
85
|
+
<PiEyeClosedLight size={16} className={`text-black ${mode === "danger" && "text-danger500"}`} />
|
|
86
|
+
)}
|
|
87
|
+
</span>
|
|
88
|
+
)}
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
{rightIcon && (
|
|
91
|
+
<span className="absolute inset-y-0 right-0 pr-4 flex items-center pointer-events-none">
|
|
92
|
+
<PiInfo
|
|
93
|
+
size={16}
|
|
94
|
+
className={`
|
|
80
95
|
${mode === "primary" && "text-black"}
|
|
81
96
|
${mode === "disable" && "text-neutral50"}
|
|
82
97
|
${mode === "danger" && "text-danger500"}
|
|
83
|
-
`}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
`}
|
|
99
|
+
/>
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</div>
|
|
101
|
-
)}
|
|
104
|
+
{footer && (
|
|
105
|
+
<div className="mt-1">
|
|
106
|
+
{mode === "danger" ? (
|
|
107
|
+
<div className="flex">
|
|
108
|
+
<div>
|
|
109
|
+
<PiInfo size={16} className="text-danger500" />
|
|
110
|
+
</div>
|
|
111
|
+
<p className="text-danger500 text-xs ml-1">{footer}</p>
|
|
112
|
+
</div>
|
|
113
|
+
) : (
|
|
114
|
+
<p className="text-black text-xs">{footer}</p>
|
|
115
|
+
)}
|
|
102
116
|
</div>
|
|
103
|
-
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
104
120
|
};
|
|
105
121
|
|
|
106
|
-
export default TextInput;
|
|
122
|
+
export default TextInput;
|