// // Copyright 2026 DXOS.org // import { DatePicker as DatePickerPrimitive, useDatePickerContext } from '@ark-ui/react/date-picker'; import { Portal } from '@ark-ui/react/portal'; import React, { type RefObject } from 'react'; import { useTranslation } from 'react-i18next'; import { mx } from '@dxos/ui-theme'; import { translationKey } from '#translations'; import { recipes } from '../../recipes.ts'; import { type Size } from '../../sizes.ts'; import { Button } from '../Button/Button.tsx'; import { usePopupSize } from '../ScrollArea/PopupScroll.tsx'; /** Months and years are laid out four to a row, as the current Calendar's pickers. */ const GRID_COLUMNS = 4; type CalendarView = 'day' | 'month' | 'year'; /** What the previous and next triggers step by in each view: months, years or decades. */ const NAV_LABELS: Record = { day: { previous: 'calendar.nav.previous.label', next: 'calendar.nav.next.label' }, month: { previous: 'calendar.nav.previous-year.label', next: 'calendar.nav.next-year.label' }, year: { previous: 'calendar.nav.previous-decade.label', next: 'calendar.nav.next-decade.label' }, }; /** Previous, view (month/year/decade caption) and next, over each view's table. */ const ViewControl = ({ view }: { view: CalendarView }) => { const { t } = useTranslation(translationKey); return (