styled raw input: make name property optional
This commit is contained in:
@@ -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}
|
||||||
|
|||||||
Reference in New Issue
Block a user