styled raw & text input: include all props & add disabled

This commit is contained in:
Elijah Duffy
2025-07-07 17:35:39 -07:00
parent 45ca099570
commit 48e456c3a7
3 changed files with 16 additions and 25 deletions

View File

@@ -8,7 +8,7 @@
import { generateIdentifier } from './util';
import { onMount } from 'svelte';
type $Props = Omit<HTMLInputAttributes, 'name' | 'value' | 'class'> & {
type $Props = Omit<HTMLInputAttributes, 'name' | 'value'> & {
name?: string;
value?: string;
validate?: ValidatorOptions;
@@ -16,7 +16,6 @@
use?: (node: HTMLInputElement) => void;
ref?: HTMLInputElement | null;
onvalidate?: (e: InputValidatorEvent) => void;
class?: ClassValue | null | undefined;
};
let {
@@ -25,6 +24,7 @@
value = $bindable(''),
placeholder,
validate: validateOpts,
disabled = false,
focus: focusOnMount = false,
use,
ref = $bindable<HTMLInputElement | null>(null),
@@ -68,8 +68,11 @@
'dark:text-sui-background dark:placeholder:text-sui-background/60 dark:sm:bg-slate-800',
'ring-sui-primary ring-offset-1 placeholder-shown:text-ellipsis focus:ring-2',
!valid && 'border-red-500!',
disabled &&
'border-sui-accent/20 text-sui-text/60 dark:text-sui-background/60 cursor-not-allowed',
classValue
]}
{disabled}
use:validate={validateOpts}
use:conditionalUse
onvalidate={(e) => {