@h-ai/ui 0.1.0-alpha.18 → 0.1.0-alpha.19
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.
|
@@ -42,14 +42,23 @@
|
|
|
42
42
|
),
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
+
function getSubmittedValue(formData: FormData, key: string, fallback = ''): string | undefined {
|
|
46
|
+
const submitted = formData.get(key)
|
|
47
|
+
const value = typeof submitted === 'string' ? submitted : fallback
|
|
48
|
+
const trimmed = value.trim()
|
|
49
|
+
return trimmed || undefined
|
|
50
|
+
}
|
|
51
|
+
|
|
45
52
|
async function handleSubmit(e: SubmitEvent) {
|
|
46
53
|
e.preventDefault()
|
|
47
54
|
if (loading || disabled)
|
|
48
55
|
return
|
|
49
56
|
|
|
57
|
+
const submittedFormData = new FormData(e.currentTarget as HTMLFormElement)
|
|
58
|
+
|
|
50
59
|
const data: ForgotPasswordFormData = {
|
|
51
|
-
email: mode === 'email' ? email : undefined,
|
|
52
|
-
phone: mode === 'phone' ? phone : undefined,
|
|
60
|
+
email: mode === 'email' ? getSubmittedValue(submittedFormData, 'email', email) : undefined,
|
|
61
|
+
phone: mode === 'phone' ? getSubmittedValue(submittedFormData, 'phone', phone) : undefined,
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
await onsubmit?.(data)
|
|
@@ -101,6 +101,13 @@
|
|
|
101
101
|
: ''),
|
|
102
102
|
)
|
|
103
103
|
|
|
104
|
+
function getSubmittedValue(formData: FormData, key: string, fallback = ''): string | undefined {
|
|
105
|
+
const submitted = formData.get(key)
|
|
106
|
+
const value = typeof submitted === 'string' ? submitted : fallback
|
|
107
|
+
const trimmed = value.trim()
|
|
108
|
+
return trimmed || undefined
|
|
109
|
+
}
|
|
110
|
+
|
|
104
111
|
async function handleSubmit(e: SubmitEvent) {
|
|
105
112
|
e.preventDefault()
|
|
106
113
|
if (loading || disabled)
|
|
@@ -108,13 +115,15 @@
|
|
|
108
115
|
if (!passwordsMatch)
|
|
109
116
|
return
|
|
110
117
|
|
|
118
|
+
const submittedFormData = new FormData(e.currentTarget as HTMLFormElement)
|
|
119
|
+
|
|
111
120
|
const data: RegisterFormData = {
|
|
112
|
-
username,
|
|
113
|
-
email,
|
|
114
|
-
phone,
|
|
121
|
+
username: getSubmittedValue(submittedFormData, 'username', username),
|
|
122
|
+
email: getSubmittedValue(submittedFormData, 'email', email),
|
|
123
|
+
phone: getSubmittedValue(submittedFormData, 'phone', phone),
|
|
115
124
|
password,
|
|
116
125
|
confirmPassword: requireConfirmPassword ? confirmPassword : undefined,
|
|
117
|
-
nickname,
|
|
126
|
+
nickname: getSubmittedValue(submittedFormData, 'nickname', nickname),
|
|
118
127
|
}
|
|
119
128
|
|
|
120
129
|
await onsubmit?.(data)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-ai/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.19",
|
|
5
5
|
"description": "Hai Framework UI component library for Svelte 5 Runes.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"svelte": "./dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"marked": "^18.0.0",
|
|
45
45
|
"shiki": "^4.0.2",
|
|
46
46
|
"tailwind-merge": "^3.5.0",
|
|
47
|
-
"@h-ai/core": "0.1.0-alpha.
|
|
47
|
+
"@h-ai/core": "0.1.0-alpha.19"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@sveltejs/package": "^2.5.7",
|