mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: add inputMaxLength property to Modal component for better input control
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
export let error = '';
|
||||
export let placeholder = '';
|
||||
export let inputType = 'text';
|
||||
export let inputMaxLength: number | null = null;
|
||||
export let items: { label: string; value: unknown }[] = [];
|
||||
export let initialValue: unknown = null;
|
||||
export let totpActive: boolean | null = null;
|
||||
@@ -477,7 +478,7 @@
|
||||
{/if}
|
||||
<textarea
|
||||
bind:value={inputValue}
|
||||
maxlength="1000"
|
||||
maxlength={inputMaxLength ?? undefined}
|
||||
placeholder={placeholder || 'Describe the issue'}
|
||||
class="h-28 w-full resize-none rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
|
||||
></textarea>
|
||||
@@ -489,6 +490,7 @@
|
||||
{:else if shouldShowInput}
|
||||
<input
|
||||
type={inputType}
|
||||
maxlength={inputMaxLength ?? undefined}
|
||||
bind:value={inputValue}
|
||||
class="mb-3 w-full rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
|
||||
{placeholder}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
error={state.error}
|
||||
placeholder={state.placeholder}
|
||||
inputType={state.inputType}
|
||||
inputMaxLength={state.maxInputLength ?? null}
|
||||
items={state.items}
|
||||
initialValue={state.initialValue}
|
||||
totpActive={state.totpActive}
|
||||
|
||||
@@ -20,6 +20,7 @@ type ModalState = {
|
||||
error: string;
|
||||
placeholder: string;
|
||||
inputType: string;
|
||||
maxInputLength?: number;
|
||||
items: ModalItem[];
|
||||
initialValue: unknown;
|
||||
totpActive: boolean | null;
|
||||
@@ -42,6 +43,7 @@ const initialState: ModalState = {
|
||||
error: '',
|
||||
placeholder: '',
|
||||
inputType: 'text',
|
||||
maxInputLength: undefined,
|
||||
items: [],
|
||||
initialValue: null,
|
||||
totpActive: null,
|
||||
|
||||
Reference in New Issue
Block a user