Update password input to support popovers

This commit is contained in:
Steven Nguyen
2024-02-15 14:37:53 +00:00
committed by Torsten Dittmann
parent 9083bc0ea9
commit df9891be5b
+22 -1
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { FormItem, Helper, Label } from '.';
import { Drop } from '$lib/components';
export let id: string;
export let label: string;
@@ -19,6 +20,7 @@
let element: HTMLInputElement;
let error: string;
let showInPlainText = false;
let showPopover = false;
onMount(() => {
if (element && autofocus) {
@@ -48,7 +50,26 @@
<FormItem>
<Label {required} hide={!showLabel} for={id}>
{label}
{label}{#if $$slots.popover}
<Drop bind:show={showPopover} display="inline-block">
<!-- TODO: make unclicked icon greyed out and hover and clicked filled -->
&nbsp;<button
type="button"
on:click={() => (showPopover = !showPopover)}
class="tooltip"
aria-label="input tooltip">
<span
class="icon-info"
aria-hidden="true"
style="font-size: var(--icon-size-small)" />
</button>
<svelte:fragment slot="list">
<div class="dropped card u-max-width-250" style="--p-card-padding: .75rem">
<slot name="popover" />
</div>
</svelte:fragment>
</Drop>
{/if}
</Label>
<div class="input-text-wrapper" style={showPasswordButton ? '--amount-of-buttons: 1' : ''}>