Skip to content

Commit f6f854e

Browse files
authored
Merge pull request #36 from rrd108/jules_wip_10506712769273927019
Pull request for issue #35
2 parents 3a938f6 + 82ece3b commit f6f854e

5 files changed

Lines changed: 174 additions & 195 deletions

File tree

playground/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default defineNuxtConfig({
2-
modules: ['../src/module', '@formkit/nuxt'],
2+
modules: ['../src/module'],
33
devtools: { enabled: true },
44
css: ['~/assets/colors.css'],
55
compatibilityDate: '2025-07-08',

playground/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"generate": "nuxi generate"
99
},
1010
"dependencies": {
11-
"nuxt": "^3.17.6",
12-
"@formkit/nuxt": "1.7.0-e225f13"
11+
"nuxt": "^3.17.6"
1312
}
1413
}
Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<script setup lang="ts">
22
import { ref, reactive } from 'vue'
3-
// Ensure FormKit types are available if you're using them explicitly,
4-
// though often not needed for basic setup with Nuxt FormKit module.
53
64
interface ForgotPasswordFormData {
75
email: string
@@ -15,7 +13,7 @@ const message = ref('')
1513
const loading = ref(false)
1614
const isError = ref(false)
1715
18-
const handleForgotPassword = async (data: ForgotPasswordFormData) => {
16+
const handleForgotPassword = async () => {
1917
loading.value = true
2018
message.value = ''
2119
isError.value = false
@@ -27,7 +25,7 @@ const handleForgotPassword = async (data: ForgotPasswordFormData) => {
2725
'Content-Type': 'application/json',
2826
'Accept': 'application/json',
2927
},
30-
body: JSON.stringify({ email: data.email }), // Use email from form data
28+
body: JSON.stringify({ email: formData.email }),
3129
})
3230
3331
const responseData = await response.json()
@@ -59,33 +57,32 @@ const handleForgotPassword = async (data: ForgotPasswordFormData) => {
5957
<template>
6058
<div>
6159
<h2>Forgot Password</h2>
62-
<FormKit
63-
v-slot="{ disabled }"
64-
type="form"
65-
:actions="false"
66-
@submit="handleForgotPassword"
67-
>
68-
<FormKit
69-
v-model="formData.email"
70-
type="email"
71-
name="email"
72-
label="Email"
73-
placeholder="your@email.com"
74-
validation="required|email"
75-
/>
76-
<FormKit
60+
<form @submit.prevent="handleForgotPassword">
61+
<div class="form-group">
62+
<label for="email">Email</label>
63+
<input
64+
id="email"
65+
v-model="formData.email"
66+
type="email"
67+
name="email"
68+
placeholder="your@email.com"
69+
required
70+
>
71+
</div>
72+
<button
7773
type="submit"
78-
:label="loading ? 'Sending...' : 'Send Password Reset Link'"
79-
:disabled="Boolean(disabled) || loading"
80-
/>
74+
:disabled="loading"
75+
>
76+
{{ loading ? 'Sending...' : 'Send Password Reset Link' }}
77+
</button>
8178
<p
8279
v-if="message"
8380
:class="{ error: isError, success: !isError }"
8481
class="form-message"
8582
>
8683
{{ message }}
8784
</p>
88-
</FormKit>
85+
</form>
8986
</div>
9087
</template>
9188

@@ -101,41 +98,35 @@ const handleForgotPassword = async (data: ForgotPasswordFormData) => {
10198
font-size: 0.9rem;
10299
}
103100
/* Basic styling for FormKit elements if not using a global theme */
104-
:deep(.formkit-outer) {
105-
margin-bottom: 1em;
101+
.form-group {
102+
margin-bottom: 1em;
106103
}
107-
:deep(.formkit-label) {
104+
105+
label {
108106
display: block;
109-
margin-bottom: 0.25em;
107+
margin-bottom: 0.25em;
110108
font-weight: bold;
111109
}
112-
:deep(.formkit-input input[type="email"]),
113-
:deep(.formkit-input input[type="password"]) {
110+
111+
input[type="email"] {
114112
width: 100%;
115-
padding: 0.75em;
113+
padding: 0.75em;
116114
box-sizing: border-box;
117115
border: 1px solid var(--color-border-dark);
118116
border-radius: 4px;
119117
}
120-
:deep(.formkit-input input[type="submit"]) {
121-
padding: 0.75em 1.5em;
118+
119+
button[type="submit"] {
120+
padding: 0.75em 1.5em;
122121
cursor: pointer;
123122
background-color: var(--color-gray-800);
124123
color: white;
125124
border: none;
126125
border-radius: 4px;
127126
}
128-
:deep(.formkit-input input[type="submit"]:disabled) {
127+
128+
button[type="submit"]:disabled {
129129
background-color: var(--color-gray-500);
130130
cursor: not-allowed;
131131
}
132-
:deep(.formkit-messages) {
133-
list-style: none;
134-
padding: 0;
135-
margin-top: 0.25em;
136-
}
137-
:deep(.formkit-message) {
138-
color: red;
139-
font-size: 0.8rem;
140-
}
141132
</style>

0 commit comments

Comments
 (0)