Skip to content

Commit a248440

Browse files
authored
Merge pull request #177 from cupcakearmy/password-eye-toggle
fix: password eye toggle not working
2 parents a2d2acc + c2653be commit a248440

File tree

3 files changed

+500
-247
lines changed

3 files changed

+500
-247
lines changed

packages/frontend/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
},
1414
"type": "module",
1515
"devDependencies": {
16-
"@lokalise/node-api": "^13.0.0",
16+
"@lokalise/node-api": "^13.2.1",
1717
"@sveltejs/adapter-static": "^3.0.8",
18-
"@sveltejs/kit": "^2.16.0",
18+
"@sveltejs/kit": "^2.17.3",
1919
"@sveltejs/vite-plugin-svelte": "^5.0.3",
2020
"@zerodevx/svelte-toast": "^0.9.6",
2121
"adm-zip": "^0.5.16",
2222
"dotenv": "^16.4.7",
23-
"svelte": "^5.19.0",
23+
"svelte": "^5.20.5",
2424
"svelte-check": "^4.1.4",
2525
"svelte-intl-precompile": "^0.12.3",
2626
"tslib": "^2.8.1",
2727
"typescript": "^5.7.3",
28-
"vite": "^6.0.9"
28+
"vite": "^6.2.0"
2929
},
3030
"dependencies": {
3131
"@fontsource/fira-mono": "^5.1.1",

packages/frontend/src/lib/ui/TextInput.svelte

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@
2121
...rest
2222
}: HTMLInputAttributes & Props = $props()
2323
24-
const initialType = rest.type
24+
const initialType = $state(rest.type)
2525
const isPassword = initialType === 'password'
2626
let hidden = $state(true)
2727
2828
let valid = $derived(validate(value))
29-
30-
$effect(() => {
31-
if (isPassword) {
32-
value
33-
rest.type = hidden ? initialType : 'text'
34-
}
35-
})
29+
let type = $derived(isPassword ? (hidden ? 'password' : 'text') : rest.type)
3630
3731
function toggle() {
32+
console.debug('toggle')
3833
hidden = !hidden
3934
}
4035
@@ -50,7 +45,7 @@
5045
<span class="error-text">{valid}</span>
5146
{/if}
5247
</small>
53-
<input bind:value {...rest} class:valid={valid === true} />
48+
<input bind:value {...rest} {type} autocomplete="off" class:valid={valid === true} />
5449
<div class="icons">
5550
{#if isPassword}
5651
<Icon

0 commit comments

Comments
 (0)