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 error = '';
|
||||||
export let placeholder = '';
|
export let placeholder = '';
|
||||||
export let inputType = 'text';
|
export let inputType = 'text';
|
||||||
|
export let inputMaxLength: number | null = null;
|
||||||
export let items: { label: string; value: unknown }[] = [];
|
export let items: { label: string; value: unknown }[] = [];
|
||||||
export let initialValue: unknown = null;
|
export let initialValue: unknown = null;
|
||||||
export let totpActive: boolean | null = null;
|
export let totpActive: boolean | null = null;
|
||||||
@@ -477,7 +478,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<textarea
|
<textarea
|
||||||
bind:value={inputValue}
|
bind:value={inputValue}
|
||||||
maxlength="1000"
|
maxlength={inputMaxLength ?? undefined}
|
||||||
placeholder={placeholder || 'Describe the issue'}
|
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"
|
class="h-28 w-full resize-none rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
|
||||||
></textarea>
|
></textarea>
|
||||||
@@ -489,6 +490,7 @@
|
|||||||
{:else if shouldShowInput}
|
{:else if shouldShowInput}
|
||||||
<input
|
<input
|
||||||
type={inputType}
|
type={inputType}
|
||||||
|
maxlength={inputMaxLength ?? undefined}
|
||||||
bind:value={inputValue}
|
bind:value={inputValue}
|
||||||
class="mb-3 w-full rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
|
class="mb-3 w-full rounded border border-neutral-700 bg-neutral-800 p-2 text-white outline-none"
|
||||||
{placeholder}
|
{placeholder}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
error={state.error}
|
error={state.error}
|
||||||
placeholder={state.placeholder}
|
placeholder={state.placeholder}
|
||||||
inputType={state.inputType}
|
inputType={state.inputType}
|
||||||
|
inputMaxLength={state.maxInputLength ?? null}
|
||||||
items={state.items}
|
items={state.items}
|
||||||
initialValue={state.initialValue}
|
initialValue={state.initialValue}
|
||||||
totpActive={state.totpActive}
|
totpActive={state.totpActive}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ type ModalState = {
|
|||||||
error: string;
|
error: string;
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
inputType: string;
|
inputType: string;
|
||||||
|
maxInputLength?: number;
|
||||||
items: ModalItem[];
|
items: ModalItem[];
|
||||||
initialValue: unknown;
|
initialValue: unknown;
|
||||||
totpActive: boolean | null;
|
totpActive: boolean | null;
|
||||||
@@ -42,6 +43,7 @@ const initialState: ModalState = {
|
|||||||
error: '',
|
error: '',
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
inputType: 'text',
|
inputType: 'text',
|
||||||
|
maxInputLength: undefined,
|
||||||
items: [],
|
items: [],
|
||||||
initialValue: null,
|
initialValue: null,
|
||||||
totpActive: null,
|
totpActive: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user