mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
49 lines
1.3 KiB
Svelte
49 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import { FormItem, Label } from '.';
|
|
|
|
export let id: string;
|
|
export let label: string;
|
|
export let showLabel = true;
|
|
export let value = '';
|
|
export let placeholder = '';
|
|
|
|
let showInPlainText = false;
|
|
</script>
|
|
|
|
<FormItem>
|
|
<Label hide={!showLabel} for={id}>
|
|
{label}
|
|
</Label>
|
|
|
|
<div class="input-text-wrapper" style=" --amount-of-buttons: 1;">
|
|
{#if showInPlainText}
|
|
<div
|
|
contenteditable="true"
|
|
role="textbox"
|
|
{id}
|
|
aria-placeholder={placeholder}
|
|
class="input-text is-resizable"
|
|
bind:textContent={value} />
|
|
{:else}
|
|
<input
|
|
{id}
|
|
{placeholder}
|
|
name={id}
|
|
type="password"
|
|
class="input-text"
|
|
autocomplete="off"
|
|
bind:value />
|
|
{/if}
|
|
<button
|
|
type="button"
|
|
on:click={() => (showInPlainText = !showInPlainText)}
|
|
class="show-password-button"
|
|
aria-label="show / hide password">
|
|
<span
|
|
class:icon-eye={!showInPlainText}
|
|
class:icon-eye-off={showInPlainText}
|
|
aria-hidden="true" />
|
|
</button>
|
|
</div>
|
|
</FormItem>
|