@skalfa/skalfa-app 1.0.0 → 1.0.2
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/.env.example +43 -43
- package/.github/workflows/publish.yml +39 -0
- package/CONTRIBUTING.md +45 -0
- package/LICENSE +21 -0
- package/README.md +91 -28
- package/app/auth/edit/page.tsx +65 -65
- package/app/auth/login/page.tsx +63 -63
- package/app/auth/me/page.tsx +58 -58
- package/app/auth/register/page.tsx +69 -69
- package/app/auth/verify/page.tsx +53 -53
- package/app/dashboard/user/page.tsx +76 -76
- package/app/layout.tsx +37 -37
- package/app/manifest.ts +25 -0
- package/app/page.tsx +13 -13
- package/barrels.json +5 -5
- package/blueprints/starter.blueprint.json +102 -102
- package/bun.lock +916 -0
- package/components/base.components/chip/Chip.component.tsx +39 -39
- package/components/base.components/document/DocumentViewer.component.tsx +163 -163
- package/components/base.components/document/ExportExcel.component.tsx +340 -340
- package/components/base.components/document/ImportExcel.component.tsx +315 -315
- package/components/base.components/document/PrintTable.component.tsx +204 -204
- package/components/base.components/document/RenderPDF.component.tsx +415 -415
- package/components/base.components/input/Checkbox.component.tsx +109 -109
- package/components/base.components/input/Input.component.tsx +332 -332
- package/components/base.components/input/InputCheckbox.component.tsx +174 -174
- package/components/base.components/input/InputCurrency.component.tsx +163 -163
- package/components/base.components/input/InputDate.component.tsx +352 -352
- package/components/base.components/input/InputDatetime.component.tsx +260 -260
- package/components/base.components/input/InputDocument.component.tsx +351 -351
- package/components/base.components/input/InputImage.component.tsx +533 -533
- package/components/base.components/input/InputMap.component.tsx +317 -317
- package/components/base.components/input/InputNumber.component.tsx +192 -192
- package/components/base.components/input/InputOtp.component.tsx +169 -169
- package/components/base.components/input/InputPassword.component.tsx +236 -236
- package/components/base.components/input/InputRadio.component.tsx +175 -175
- package/components/base.components/input/InputTime.component.tsx +275 -275
- package/components/base.components/input/InputValues.component.tsx +68 -68
- package/components/base.components/input/Radio.component.tsx +102 -102
- package/components/base.components/input/Select.component.tsx +541 -541
- package/components/base.components/modal/BottomSheet.component.tsx +245 -245
- package/components/base.components/supervision/FormSupervision.component.tsx +433 -433
- package/components/base.components/supervision/TableSupervision.component.tsx +697 -697
- package/components/base.components/table/ControlBar.component.tsx +497 -497
- package/components/base.components/table/FilterComponent.tsx +518 -518
- package/components/base.components/table/Table.component.tsx +469 -469
- package/components/base.components/typography/TypographyArticle.component.tsx +26 -26
- package/components/base.components/typography/TypographyColumn.component.tsx +20 -20
- package/components/base.components/typography/TypographyContent.component.tsx +20 -20
- package/components/base.components/typography/TypographyTips.component.tsx +20 -20
- package/components/base.components/wrap/Draggable.component.tsx +303 -303
- package/components/base.components/wrap/IDBProvider.tsx +12 -12
- package/components/base.components/wrap/Image.component.tsx +9 -9
- package/components/base.components/wrap/ShortcutProvider.tsx +57 -57
- package/components/base.components/wrap/Swipe.component.tsx +93 -93
- package/components/index.ts +2 -2
- package/contexts/AppProvider.tsx +11 -11
- package/contexts/Auth.context.tsx +64 -64
- package/contexts/Toggle.context.tsx +44 -44
- package/next.config.ts +15 -1
- package/package.json +14 -13
- package/public/204.svg +19 -19
- package/public/500.svg +39 -39
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/images/logo-fill.png +0 -0
- package/public/images/logo-full-fill.png +0 -0
- package/public/images/logo-full.png +0 -0
- package/public/images/logo.png +0 -0
- package/schema/idb/app.schema.ts +8 -8
- package/src-tauri/Cargo.toml +14 -0
- package/src-tauri/build.rs +3 -0
- package/src-tauri/capabilities/default.json +11 -0
- package/src-tauri/icons/128x128.png +0 -0
- package/src-tauri/icons/128x128@2x.png +0 -0
- package/src-tauri/icons/32x32.png +0 -0
- package/src-tauri/icons/icon.icns +0 -0
- package/src-tauri/icons/icon.ico +0 -0
- package/src-tauri/src/main.rs +7 -0
- package/src-tauri/tauri.conf.json +36 -0
- package/styles/globals.css +231 -231
- package/styles/tailwind.safelist +68 -68
- package/utils/commands/barrels.ts +27 -27
- package/utils/commands/light.ts +21 -21
- package/utils/commands/logger.ts +42 -42
- package/utils/commands/stubs/table-blueprint.stub +12 -12
- package/utils/commands/use-pdf.ts +29 -29
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { InputHTMLAttributes, ReactNode, useEffect, useState } from "react";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { cn, pcn, useInputHandler, useInputRandomId, useValidation, validation, ValidationRules } from "@utils";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type CT = "label" | "tip" | "error" | "base" | "icon";
|
|
10
|
-
|
|
11
|
-
export interface InputPasswordProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
12
|
-
label ?: string;
|
|
13
|
-
tip ?: string | ReactNode;
|
|
14
|
-
leftIcon ?: any;
|
|
15
|
-
rightIcon ?: any;
|
|
16
|
-
|
|
17
|
-
value ?: string;
|
|
18
|
-
invalid ?: string;
|
|
19
|
-
validations ?: ValidationRules;
|
|
20
|
-
|
|
21
|
-
onChange ?: (value: string, confirm?: string) => any;
|
|
22
|
-
register ?: (name: string, validations?: ValidationRules) => void;
|
|
23
|
-
unregister ?: (name: string) => void;
|
|
24
|
-
|
|
25
|
-
/** Use custom class with: "label::", "tip::", "error::", "icon::". */
|
|
26
|
-
className ?: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export function InputPasswordComponent({
|
|
32
|
-
label,
|
|
33
|
-
tip,
|
|
34
|
-
leftIcon,
|
|
35
|
-
rightIcon,
|
|
36
|
-
|
|
37
|
-
value,
|
|
38
|
-
invalid,
|
|
39
|
-
validations,
|
|
40
|
-
|
|
41
|
-
register,
|
|
42
|
-
unregister,
|
|
43
|
-
onChange,
|
|
44
|
-
|
|
45
|
-
className = "",
|
|
46
|
-
...props
|
|
47
|
-
}: InputPasswordProps) {
|
|
48
|
-
const [password, setPassword] = useState("");
|
|
49
|
-
const [confirmPassword, setConfirmPassword] = useState("");
|
|
50
|
-
const [strength, setStrength] = useState<"weak" | "strong" | "excellent" | "">("");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// =========================>
|
|
54
|
-
// ## Initial
|
|
55
|
-
// =========================>
|
|
56
|
-
const inputHandler = useInputHandler(props.name, value, validations, register, unregister, false)
|
|
57
|
-
const randomId = useInputRandomId()
|
|
58
|
-
const randomConfirmId = useInputRandomId()
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// =========================>
|
|
62
|
-
// ## Invalid handler
|
|
63
|
-
// =========================>
|
|
64
|
-
const [invalidMessage] = useValidation(inputHandler.value, validations, invalid, inputHandler.idle);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// =========================>
|
|
68
|
-
// ## Password strength handler
|
|
69
|
-
// =========================>
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (!password) return setStrength("");
|
|
72
|
-
|
|
73
|
-
const hasLetter = /[A-Za-z]/.test(password);
|
|
74
|
-
const hasNumber = /\d/.test(password);
|
|
75
|
-
const hasSymbol = /[^A-Za-z0-9]/.test(password);
|
|
76
|
-
|
|
77
|
-
if (hasLetter && !hasNumber && !hasSymbol) setStrength("weak");
|
|
78
|
-
else if (hasLetter && hasNumber && !hasSymbol) setStrength("strong");
|
|
79
|
-
else if (hasLetter && hasNumber && hasSymbol) setStrength("excellent");
|
|
80
|
-
else setStrength("weak");
|
|
81
|
-
}, [password]);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// =========================>
|
|
85
|
-
// ## Check match confirm password
|
|
86
|
-
// =========================>
|
|
87
|
-
const isConfirmMismatch = confirmPassword && password !== confirmPassword;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<div className="relative flex flex-col gap-y-1">
|
|
92
|
-
{label && (
|
|
93
|
-
<label
|
|
94
|
-
htmlFor={randomId}
|
|
95
|
-
className={cn(
|
|
96
|
-
"input-label",
|
|
97
|
-
pcn<CT>(className, "label"),
|
|
98
|
-
props.disabled && "opacity-50",
|
|
99
|
-
inputHandler.focus && "text-primary",
|
|
100
|
-
!!invalidMessage && "text-danger",
|
|
101
|
-
)}
|
|
102
|
-
>
|
|
103
|
-
{label}
|
|
104
|
-
{validations && validation.hasRules(validations, "required") && <span className="text-danger ml-1">*</span>}
|
|
105
|
-
</label>
|
|
106
|
-
)}
|
|
107
|
-
|
|
108
|
-
{tip && (
|
|
109
|
-
<small
|
|
110
|
-
className={cn(
|
|
111
|
-
"input-tip",
|
|
112
|
-
pcn<CT>(className, "tip"),
|
|
113
|
-
props.disabled && "opacity-60",
|
|
114
|
-
)}
|
|
115
|
-
>{tip}</small>
|
|
116
|
-
)}
|
|
117
|
-
|
|
118
|
-
<div className="relative">
|
|
119
|
-
<input
|
|
120
|
-
{...props}
|
|
121
|
-
type="password"
|
|
122
|
-
id={randomId}
|
|
123
|
-
className={cn(
|
|
124
|
-
"input",
|
|
125
|
-
leftIcon && "pl-12",
|
|
126
|
-
rightIcon && "pr-12",
|
|
127
|
-
pcn<CT>(className, "base"),
|
|
128
|
-
!!invalidMessage && "input-error",
|
|
129
|
-
)}
|
|
130
|
-
value={password}
|
|
131
|
-
onChange={(e) => {
|
|
132
|
-
setPassword(e.target.value);
|
|
133
|
-
inputHandler.setIdle(false);
|
|
134
|
-
onChange?.(e.target.value, confirmPassword);
|
|
135
|
-
}}
|
|
136
|
-
onFocus={(e) => {
|
|
137
|
-
props.onFocus?.(e);
|
|
138
|
-
inputHandler.setFocus(true);
|
|
139
|
-
}}
|
|
140
|
-
onBlur={(e) => {
|
|
141
|
-
props.onBlur?.(e);
|
|
142
|
-
setTimeout(() => inputHandler.setFocus(false), 100);
|
|
143
|
-
}}
|
|
144
|
-
autoComplete="off"
|
|
145
|
-
/>
|
|
146
|
-
|
|
147
|
-
{leftIcon && (
|
|
148
|
-
<FontAwesomeIcon
|
|
149
|
-
className={cn("left-4 input-icon", pcn<CT>(className, "icon"))}
|
|
150
|
-
icon={leftIcon}
|
|
151
|
-
/>
|
|
152
|
-
)}
|
|
153
|
-
{rightIcon && (
|
|
154
|
-
<FontAwesomeIcon
|
|
155
|
-
className={cn("right-4 input-icon", pcn<CT>(className, "icon"))}
|
|
156
|
-
icon={rightIcon}
|
|
157
|
-
/>
|
|
158
|
-
)}
|
|
159
|
-
</div>
|
|
160
|
-
|
|
161
|
-
{invalidMessage && (
|
|
162
|
-
<small className={cn("input-error-message", "text-danger mt-1")}>
|
|
163
|
-
{invalidMessage}
|
|
164
|
-
</small>
|
|
165
|
-
)}
|
|
166
|
-
|
|
167
|
-
{strength && (
|
|
168
|
-
<div className="flex items-center gap-2 mt-1">
|
|
169
|
-
<div
|
|
170
|
-
className={cn(
|
|
171
|
-
"h-1 rounded transition-all duration-300 w-1/3",
|
|
172
|
-
strength === "weak" && "bg-danger",
|
|
173
|
-
strength === "strong" && "bg-warning",
|
|
174
|
-
strength === "excellent" && "bg-success",
|
|
175
|
-
)}
|
|
176
|
-
/>
|
|
177
|
-
<div
|
|
178
|
-
className={cn(
|
|
179
|
-
"h-1 rounded transition-all duration-300 w-1/3",
|
|
180
|
-
strength === "weak" && "bg-background",
|
|
181
|
-
strength === "strong" && "bg-warning",
|
|
182
|
-
strength === "excellent" && "bg-success",
|
|
183
|
-
)}
|
|
184
|
-
/>
|
|
185
|
-
<div
|
|
186
|
-
className={cn(
|
|
187
|
-
"h-1 rounded transition-all duration-300 w-1/3",
|
|
188
|
-
strength === "weak" && "bg-background ",
|
|
189
|
-
strength === "strong" && "bg-background",
|
|
190
|
-
strength === "excellent" && "bg-success",
|
|
191
|
-
)}
|
|
192
|
-
/>
|
|
193
|
-
<span
|
|
194
|
-
className={cn(
|
|
195
|
-
"text-[10px] font-medium",
|
|
196
|
-
strength === "weak" && "text-danger",
|
|
197
|
-
strength === "strong" && "text-warning",
|
|
198
|
-
strength === "excellent" && "text-success",
|
|
199
|
-
)}
|
|
200
|
-
>{strength === "weak" ? "Weak" : strength === "strong" ? "Strong" : "Excellent"}</span>
|
|
201
|
-
</div>
|
|
202
|
-
)}
|
|
203
|
-
|
|
204
|
-
<div className="mt-4">
|
|
205
|
-
<label
|
|
206
|
-
htmlFor={randomConfirmId}
|
|
207
|
-
className={cn("input-label text-sm", pcn<CT>(className, "label"))}
|
|
208
|
-
>Password Confirm</label>
|
|
209
|
-
<div className="relative">
|
|
210
|
-
<input
|
|
211
|
-
{...props}
|
|
212
|
-
id={randomConfirmId}
|
|
213
|
-
type="password"
|
|
214
|
-
className={cn(
|
|
215
|
-
"input",
|
|
216
|
-
leftIcon && "pl-12",
|
|
217
|
-
rightIcon && "pr-12",
|
|
218
|
-
pcn<CT>(className, "base"),
|
|
219
|
-
isConfirmMismatch && "input-error",
|
|
220
|
-
)}
|
|
221
|
-
value={confirmPassword}
|
|
222
|
-
onChange={(e) => {
|
|
223
|
-
setConfirmPassword(e.target.value);
|
|
224
|
-
onChange?.(password, e.target.value);
|
|
225
|
-
}}
|
|
226
|
-
autoComplete="off"
|
|
227
|
-
/>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
|
|
231
|
-
{isConfirmMismatch && (
|
|
232
|
-
<small className={cn("input-error-message", "text-danger mt-1")}>Password confirmation not match</small>
|
|
233
|
-
)}
|
|
234
|
-
</div>
|
|
235
|
-
);
|
|
236
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { InputHTMLAttributes, ReactNode, useEffect, useState } from "react";
|
|
4
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
+
import { cn, pcn, useInputHandler, useInputRandomId, useValidation, validation, ValidationRules } from "@utils";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
type CT = "label" | "tip" | "error" | "base" | "icon";
|
|
10
|
+
|
|
11
|
+
export interface InputPasswordProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
12
|
+
label ?: string;
|
|
13
|
+
tip ?: string | ReactNode;
|
|
14
|
+
leftIcon ?: any;
|
|
15
|
+
rightIcon ?: any;
|
|
16
|
+
|
|
17
|
+
value ?: string;
|
|
18
|
+
invalid ?: string;
|
|
19
|
+
validations ?: ValidationRules;
|
|
20
|
+
|
|
21
|
+
onChange ?: (value: string, confirm?: string) => any;
|
|
22
|
+
register ?: (name: string, validations?: ValidationRules) => void;
|
|
23
|
+
unregister ?: (name: string) => void;
|
|
24
|
+
|
|
25
|
+
/** Use custom class with: "label::", "tip::", "error::", "icon::". */
|
|
26
|
+
className ?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export function InputPasswordComponent({
|
|
32
|
+
label,
|
|
33
|
+
tip,
|
|
34
|
+
leftIcon,
|
|
35
|
+
rightIcon,
|
|
36
|
+
|
|
37
|
+
value,
|
|
38
|
+
invalid,
|
|
39
|
+
validations,
|
|
40
|
+
|
|
41
|
+
register,
|
|
42
|
+
unregister,
|
|
43
|
+
onChange,
|
|
44
|
+
|
|
45
|
+
className = "",
|
|
46
|
+
...props
|
|
47
|
+
}: InputPasswordProps) {
|
|
48
|
+
const [password, setPassword] = useState("");
|
|
49
|
+
const [confirmPassword, setConfirmPassword] = useState("");
|
|
50
|
+
const [strength, setStrength] = useState<"weak" | "strong" | "excellent" | "">("");
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// =========================>
|
|
54
|
+
// ## Initial
|
|
55
|
+
// =========================>
|
|
56
|
+
const inputHandler = useInputHandler(props.name, value, validations, register, unregister, false)
|
|
57
|
+
const randomId = useInputRandomId()
|
|
58
|
+
const randomConfirmId = useInputRandomId()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// =========================>
|
|
62
|
+
// ## Invalid handler
|
|
63
|
+
// =========================>
|
|
64
|
+
const [invalidMessage] = useValidation(inputHandler.value, validations, invalid, inputHandler.idle);
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// =========================>
|
|
68
|
+
// ## Password strength handler
|
|
69
|
+
// =========================>
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!password) return setStrength("");
|
|
72
|
+
|
|
73
|
+
const hasLetter = /[A-Za-z]/.test(password);
|
|
74
|
+
const hasNumber = /\d/.test(password);
|
|
75
|
+
const hasSymbol = /[^A-Za-z0-9]/.test(password);
|
|
76
|
+
|
|
77
|
+
if (hasLetter && !hasNumber && !hasSymbol) setStrength("weak");
|
|
78
|
+
else if (hasLetter && hasNumber && !hasSymbol) setStrength("strong");
|
|
79
|
+
else if (hasLetter && hasNumber && hasSymbol) setStrength("excellent");
|
|
80
|
+
else setStrength("weak");
|
|
81
|
+
}, [password]);
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// =========================>
|
|
85
|
+
// ## Check match confirm password
|
|
86
|
+
// =========================>
|
|
87
|
+
const isConfirmMismatch = confirmPassword && password !== confirmPassword;
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className="relative flex flex-col gap-y-1">
|
|
92
|
+
{label && (
|
|
93
|
+
<label
|
|
94
|
+
htmlFor={randomId}
|
|
95
|
+
className={cn(
|
|
96
|
+
"input-label",
|
|
97
|
+
pcn<CT>(className, "label"),
|
|
98
|
+
props.disabled && "opacity-50",
|
|
99
|
+
inputHandler.focus && "text-primary",
|
|
100
|
+
!!invalidMessage && "text-danger",
|
|
101
|
+
)}
|
|
102
|
+
>
|
|
103
|
+
{label}
|
|
104
|
+
{validations && validation.hasRules(validations, "required") && <span className="text-danger ml-1">*</span>}
|
|
105
|
+
</label>
|
|
106
|
+
)}
|
|
107
|
+
|
|
108
|
+
{tip && (
|
|
109
|
+
<small
|
|
110
|
+
className={cn(
|
|
111
|
+
"input-tip",
|
|
112
|
+
pcn<CT>(className, "tip"),
|
|
113
|
+
props.disabled && "opacity-60",
|
|
114
|
+
)}
|
|
115
|
+
>{tip}</small>
|
|
116
|
+
)}
|
|
117
|
+
|
|
118
|
+
<div className="relative">
|
|
119
|
+
<input
|
|
120
|
+
{...props}
|
|
121
|
+
type="password"
|
|
122
|
+
id={randomId}
|
|
123
|
+
className={cn(
|
|
124
|
+
"input",
|
|
125
|
+
leftIcon && "pl-12",
|
|
126
|
+
rightIcon && "pr-12",
|
|
127
|
+
pcn<CT>(className, "base"),
|
|
128
|
+
!!invalidMessage && "input-error",
|
|
129
|
+
)}
|
|
130
|
+
value={password}
|
|
131
|
+
onChange={(e) => {
|
|
132
|
+
setPassword(e.target.value);
|
|
133
|
+
inputHandler.setIdle(false);
|
|
134
|
+
onChange?.(e.target.value, confirmPassword);
|
|
135
|
+
}}
|
|
136
|
+
onFocus={(e) => {
|
|
137
|
+
props.onFocus?.(e);
|
|
138
|
+
inputHandler.setFocus(true);
|
|
139
|
+
}}
|
|
140
|
+
onBlur={(e) => {
|
|
141
|
+
props.onBlur?.(e);
|
|
142
|
+
setTimeout(() => inputHandler.setFocus(false), 100);
|
|
143
|
+
}}
|
|
144
|
+
autoComplete="off"
|
|
145
|
+
/>
|
|
146
|
+
|
|
147
|
+
{leftIcon && (
|
|
148
|
+
<FontAwesomeIcon
|
|
149
|
+
className={cn("left-4 input-icon", pcn<CT>(className, "icon"))}
|
|
150
|
+
icon={leftIcon}
|
|
151
|
+
/>
|
|
152
|
+
)}
|
|
153
|
+
{rightIcon && (
|
|
154
|
+
<FontAwesomeIcon
|
|
155
|
+
className={cn("right-4 input-icon", pcn<CT>(className, "icon"))}
|
|
156
|
+
icon={rightIcon}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
{invalidMessage && (
|
|
162
|
+
<small className={cn("input-error-message", "text-danger mt-1")}>
|
|
163
|
+
{invalidMessage}
|
|
164
|
+
</small>
|
|
165
|
+
)}
|
|
166
|
+
|
|
167
|
+
{strength && (
|
|
168
|
+
<div className="flex items-center gap-2 mt-1">
|
|
169
|
+
<div
|
|
170
|
+
className={cn(
|
|
171
|
+
"h-1 rounded transition-all duration-300 w-1/3",
|
|
172
|
+
strength === "weak" && "bg-danger",
|
|
173
|
+
strength === "strong" && "bg-warning",
|
|
174
|
+
strength === "excellent" && "bg-success",
|
|
175
|
+
)}
|
|
176
|
+
/>
|
|
177
|
+
<div
|
|
178
|
+
className={cn(
|
|
179
|
+
"h-1 rounded transition-all duration-300 w-1/3",
|
|
180
|
+
strength === "weak" && "bg-background",
|
|
181
|
+
strength === "strong" && "bg-warning",
|
|
182
|
+
strength === "excellent" && "bg-success",
|
|
183
|
+
)}
|
|
184
|
+
/>
|
|
185
|
+
<div
|
|
186
|
+
className={cn(
|
|
187
|
+
"h-1 rounded transition-all duration-300 w-1/3",
|
|
188
|
+
strength === "weak" && "bg-background ",
|
|
189
|
+
strength === "strong" && "bg-background",
|
|
190
|
+
strength === "excellent" && "bg-success",
|
|
191
|
+
)}
|
|
192
|
+
/>
|
|
193
|
+
<span
|
|
194
|
+
className={cn(
|
|
195
|
+
"text-[10px] font-medium",
|
|
196
|
+
strength === "weak" && "text-danger",
|
|
197
|
+
strength === "strong" && "text-warning",
|
|
198
|
+
strength === "excellent" && "text-success",
|
|
199
|
+
)}
|
|
200
|
+
>{strength === "weak" ? "Weak" : strength === "strong" ? "Strong" : "Excellent"}</span>
|
|
201
|
+
</div>
|
|
202
|
+
)}
|
|
203
|
+
|
|
204
|
+
<div className="mt-4">
|
|
205
|
+
<label
|
|
206
|
+
htmlFor={randomConfirmId}
|
|
207
|
+
className={cn("input-label text-sm", pcn<CT>(className, "label"))}
|
|
208
|
+
>Password Confirm</label>
|
|
209
|
+
<div className="relative">
|
|
210
|
+
<input
|
|
211
|
+
{...props}
|
|
212
|
+
id={randomConfirmId}
|
|
213
|
+
type="password"
|
|
214
|
+
className={cn(
|
|
215
|
+
"input",
|
|
216
|
+
leftIcon && "pl-12",
|
|
217
|
+
rightIcon && "pr-12",
|
|
218
|
+
pcn<CT>(className, "base"),
|
|
219
|
+
isConfirmMismatch && "input-error",
|
|
220
|
+
)}
|
|
221
|
+
value={confirmPassword}
|
|
222
|
+
onChange={(e) => {
|
|
223
|
+
setConfirmPassword(e.target.value);
|
|
224
|
+
onChange?.(password, e.target.value);
|
|
225
|
+
}}
|
|
226
|
+
autoComplete="off"
|
|
227
|
+
/>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
{isConfirmMismatch && (
|
|
232
|
+
<small className={cn("input-error-message", "text-danger mt-1")}>Password confirmation not match</small>
|
|
233
|
+
)}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
}
|