Keep the date range year visible and ring the whole field.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
dae5d7d533
commit
93208fb911
|
|
@ -90,9 +90,9 @@ export function DateRangeInput({
|
|||
popover.setOpen(false)
|
||||
}
|
||||
|
||||
// Ширина — по тексту даты (≈5em у 14–16px) плюс отступы поля: без хвоста справа,
|
||||
// иначе пустота перед «—» вдвое больше, чем после.
|
||||
const input = "w-[calc(5.1em+1.125rem)] flex-none px-2.5 tabular"
|
||||
// Ширина — по тексту даты плюс отступы поля. 5.2em хватает на «2026»,
|
||||
// без лишнего хвоста перед «—».
|
||||
const input = "w-[calc(5.2em+1.125rem)] flex-none px-2.5 tabular"
|
||||
// Фокус после закрытия календаря возвращается в то поле, где человек был последним.
|
||||
const remember = (e: React.FocusEvent<HTMLInputElement>) => {
|
||||
popover.returnFocus.current = e.currentTarget
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ function Input({
|
|||
id,
|
||||
"aria-describedby": ariaDescribedBy,
|
||||
"aria-invalid": ariaInvalid,
|
||||
"data-slot": dataSlot = "input",
|
||||
...props
|
||||
}: React.ComponentProps<"input">) {
|
||||
const field = useFormControl({ id, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid })
|
||||
|
|
@ -18,7 +19,7 @@ function Input({
|
|||
id={field.id}
|
||||
aria-describedby={field["aria-describedby"]}
|
||||
aria-invalid={field["aria-invalid"]}
|
||||
data-slot="input"
|
||||
data-slot={dataSlot}
|
||||
className={cn(
|
||||
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
||||
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ function Textarea({
|
|||
id,
|
||||
"aria-describedby": ariaDescribedBy,
|
||||
"aria-invalid": ariaInvalid,
|
||||
"data-slot": dataSlot = "textarea",
|
||||
...props
|
||||
}: React.ComponentProps<"textarea">) {
|
||||
const field = useFormControl({ id, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid })
|
||||
|
|
@ -16,7 +17,7 @@ function Textarea({
|
|||
id={field.id}
|
||||
aria-describedby={field["aria-describedby"]}
|
||||
aria-invalid={field["aria-invalid"]}
|
||||
data-slot="textarea"
|
||||
data-slot={dataSlot}
|
||||
className={cn(
|
||||
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
|
||||
className
|
||||
|
|
|
|||
Loading…
Reference in New Issue