styled raw input: make name property optional

This commit is contained in:
Elijah Duffy
2025-07-03 11:16:30 -07:00
parent 7a7fade491
commit ff9af6dd0a

View File

@@ -5,9 +5,10 @@
type InputValidatorEvent, type InputValidatorEvent,
type ValidatorOptions type ValidatorOptions
} from '@svelte-toolkit/validate'; } from '@svelte-toolkit/validate';
import { generateIdentifier } from './util.js';
type $Props = Omit<HTMLInputAttributes, 'name' | 'value'> & { type $Props = Omit<HTMLInputAttributes, 'name' | 'value'> & {
name: string; name?: string;
value?: string; value?: string;
validate?: ValidatorOptions; validate?: ValidatorOptions;
ref?: HTMLInputElement | null; ref?: HTMLInputElement | null;
@@ -15,6 +16,7 @@
}; };
let { let {
id = generateIdentifier('styled-raw-input'),
name, name,
value = $bindable(''), value = $bindable(''),
placeholder, placeholder,
@@ -35,7 +37,7 @@
</script> </script>
<input <input
id={name} {id}
{name} {name}
{placeholder} {placeholder}
aria-label={placeholder} aria-label={placeholder}