26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
// Interim-UI helper (AD-28): a labeled native <input type="date"> for server forms.
|
|
// Deliberate exception to "compose from ~/ui" — the ~/ui TextInput.Input type prop
|
|
// excludes "date" and the ~/ui DatePicker is a controlled component that does not
|
|
// submit a form field. Styled with the same design tokens as ~/ui inputs (control
|
|
// height Medium 36 = h-9, radius small 4, neutral border/text) so it reads David-near.
|
|
|
|
export type DateFieldProps = {
|
|
label: string;
|
|
name: string;
|
|
defaultValue?: string;
|
|
};
|
|
|
|
export function DateField({ label, name, defaultValue }: DateFieldProps) {
|
|
return (
|
|
<label className="flex flex-col gap-1">
|
|
<span className="text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-tertiary">{label}</span>
|
|
<input
|
|
type="date"
|
|
name={name}
|
|
defaultValue={defaultValue}
|
|
className="h-9 rounded-[4px] border border-solid border-border-default bg-transparent px-3 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary outline-none"
|
|
/>
|
|
</label>
|
|
);
|
|
}
|