diff --git a/client/src/components/SidePanel/Schedules/ScheduleDialog.tsx b/client/src/components/SidePanel/Schedules/ScheduleDialog.tsx index d701568f49..16d1356e18 100644 --- a/client/src/components/SidePanel/Schedules/ScheduleDialog.tsx +++ b/client/src/components/SidePanel/Schedules/ScheduleDialog.tsx @@ -63,9 +63,6 @@ const BASE_MINUTES = [0, 15, 30, 45]; const FORM_ID = 'schedule-form'; -/** Matches the Input primitive so every control in the form reads as one field set. */ -const FIELD_CLASS = 'h-10 w-full rounded-lg border border-border-light bg-transparent'; - const getDefaultValues = (schedule?: TSchedule): ScheduleFormValues => { if (!schedule) { return { @@ -390,11 +387,7 @@ export default function ScheduleDialog({ // trap fighting Ariakit for focus locks the page up. portal={false} matchTriggerWidth={true} - containerClassName="w-full px-0" - className={cn( - FIELD_CLASS, - 'justify-start px-3 text-sm hover:bg-surface-hover', - )} + variant="field" /> )} /> @@ -475,7 +468,7 @@ export default function ScheduleDialog({ value={String(field.value)} onChange={(value) => field.onChange(Number(value))} options={dayOptions} - className={FIELD_CLASS} + variant="field" portal={false} aria-labelledby="schedule-day-label" testId="schedule-day-select" @@ -509,7 +502,7 @@ export default function ScheduleDialog({ value={String(field.value)} onChange={(value) => field.onChange(Number(value))} options={hourOptions} - className={FIELD_CLASS} + variant="field" portal={false} ariaLabel={localize('com_ui_schedule_hour')} testId="schedule-hour-select" @@ -525,7 +518,7 @@ export default function ScheduleDialog({ value={String(field.value)} onChange={(value) => field.onChange(Number(value))} options={minuteOptions} - className={FIELD_CLASS} + variant="field" portal={false} ariaLabel={localize('com_ui_schedule_minute')} testId="schedule-minute-select" @@ -541,7 +534,7 @@ export default function ScheduleDialog({ value={field.value} onChange={field.onChange} options={meridiemOptions} - className={FIELD_CLASS} + variant="field" portal={false} ariaLabel={localize('com_ui_schedule_meridiem')} testId="schedule-meridiem-select" diff --git a/packages/client/src/components/ControlCombobox.tsx b/packages/client/src/components/ControlCombobox.tsx index 2a7e1ca9ea..05fc1a0bde 100644 --- a/packages/client/src/components/ControlCombobox.tsx +++ b/packages/client/src/components/ControlCombobox.tsx @@ -5,6 +5,7 @@ import { Search, ChevronDown } from 'lucide-react'; import { SelectRenderer } from '@ariakit/react-components/select/select-renderer'; import type { OptionWithIcon } from '~/common'; import { usePopoverZIndex } from './OriginalDialog'; +import { fieldControl } from './Field'; import './AnimatePopover.css'; import { JSX } from 'react/jsx-runtime'; import { cn } from '~/utils'; @@ -32,6 +33,8 @@ interface ControlComboboxProps { placement?: Ariakit.SelectStoreProps['placement']; popoverClassName?: string; matchTriggerWidth?: boolean; + /** `field` matches the `Input` primitive so this can sit in a form row. */ + variant?: 'default' | 'field'; gutter?: number; /** * Radix dialogs trap focus, so a portaled popover rendered outside the dialog @@ -67,6 +70,7 @@ function ControlCombobox({ placement, popoverClassName, matchTriggerWidth = true, + variant = 'default', gutter = 4, portal = true, }: ControlComboboxProps): JSX.Element { @@ -142,7 +146,13 @@ function ControlCombobox({ ); return ( -