enh: input type event call
This commit is contained in:
@@ -13,9 +13,14 @@
|
||||
export let cancelLabel = $i18n.t('Cancel');
|
||||
export let confirmLabel = $i18n.t('Confirm');
|
||||
|
||||
export let input = false;
|
||||
export let inputPlaceholder = '';
|
||||
|
||||
export let show = false;
|
||||
|
||||
let modalElement = null;
|
||||
let mounted = false;
|
||||
let inputValue = '';
|
||||
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
@@ -73,6 +78,16 @@
|
||||
{:else}
|
||||
{$i18n.t('This action cannot be undone. Do you wish to continue?')}
|
||||
{/if}
|
||||
|
||||
{#if input}
|
||||
<textarea
|
||||
bind:value={inputValue}
|
||||
placeholder={inputPlaceholder ? inputPlaceholder : $i18n.t('Enter your message')}
|
||||
class="w-full mt-2 rounded-lg px-4 py-2 text-sm dark:text-gray-300 dark:bg-gray-900 outline-none resize-none"
|
||||
rows="3"
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</slot>
|
||||
|
||||
@@ -91,7 +106,7 @@
|
||||
class="bg-gray-900 hover:bg-gray-850 text-gray-100 dark:bg-gray-100 dark:hover:bg-white dark:text-gray-800 font-medium w-full py-2.5 rounded-lg transition"
|
||||
on:click={() => {
|
||||
show = false;
|
||||
dispatch('confirm');
|
||||
dispatch('confirm', inputValue);
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user