Skip to content

Commit

Permalink
Merge pull request #177 from cupcakearmy/password-eye-toggle
Browse files Browse the repository at this point in the history
fix: password eye toggle not working
  • Loading branch information
cupcakearmy authored Feb 27, 2025
2 parents a2d2acc + c2653be commit a248440
Show file tree
Hide file tree
Showing 3 changed files with 500 additions and 247 deletions.
8 changes: 4 additions & 4 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
},
"type": "module",
"devDependencies": {
"@lokalise/node-api": "^13.0.0",
"@lokalise/node-api": "^13.2.1",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.16.0",
"@sveltejs/kit": "^2.17.3",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@zerodevx/svelte-toast": "^0.9.6",
"adm-zip": "^0.5.16",
"dotenv": "^16.4.7",
"svelte": "^5.19.0",
"svelte": "^5.20.5",
"svelte-check": "^4.1.4",
"svelte-intl-precompile": "^0.12.3",
"tslib": "^2.8.1",
"typescript": "^5.7.3",
"vite": "^6.0.9"
"vite": "^6.2.0"
},
"dependencies": {
"@fontsource/fira-mono": "^5.1.1",
Expand Down
13 changes: 4 additions & 9 deletions packages/frontend/src/lib/ui/TextInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@
...rest
}: HTMLInputAttributes & Props = $props()
const initialType = rest.type
const initialType = $state(rest.type)
const isPassword = initialType === 'password'
let hidden = $state(true)
let valid = $derived(validate(value))
$effect(() => {
if (isPassword) {
value
rest.type = hidden ? initialType : 'text'
}
})
let type = $derived(isPassword ? (hidden ? 'password' : 'text') : rest.type)
function toggle() {
console.debug('toggle')
hidden = !hidden
}
Expand All @@ -50,7 +45,7 @@
<span class="error-text">{valid}</span>
{/if}
</small>
<input bind:value {...rest} class:valid={valid === true} />
<input bind:value {...rest} {type} autocomplete="off" class:valid={valid === true} />
<div class="icons">
{#if isPassword}
<Icon
Expand Down
Loading

0 comments on commit a248440

Please sign in to comment.