vectis-ui 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/components/VColorPicker/color.js +2 -2
  2. package/dist/components/VColorPicker/color.js.map +1 -1
  3. package/dist/components/VCombobox/VCombobox.d.ts +10 -0
  4. package/dist/components/VCombobox/VCombobox.js.map +1 -1
  5. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +177 -159
  6. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/components/VDataTable/VDataTable.css +1 -1
  8. package/dist/components/VDataTable/VDataTable.js.map +1 -1
  9. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +1 -1
  10. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  11. package/dist/components/VDatePicker/VDatePicker.css +1 -1
  12. package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
  13. package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +3 -2
  14. package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  15. package/dist/components/VDialog/VDialog.css +1 -1
  16. package/dist/components/VDialog/VDialog.js.map +1 -1
  17. package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js +4 -2
  18. package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  19. package/dist/components/VDrawer/VDrawer.css +1 -1
  20. package/dist/components/VDrawer/VDrawer.js.map +1 -1
  21. package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js +4 -2
  22. package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -1
  23. package/dist/components/VMeter/VMeter.css +1 -1
  24. package/dist/components/VMeter/VMeter.d.ts +24 -8
  25. package/dist/components/VMeter/VMeter.js.map +1 -1
  26. package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js +65 -48
  27. package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/components/VMeterGroup/VMeterGroup.css +2 -0
  29. package/dist/components/VMeterGroup/VMeterGroup.d.ts +101 -0
  30. package/dist/components/VMeterGroup/VMeterGroup.js +9 -0
  31. package/dist/components/VMeterGroup/VMeterGroup.js.map +1 -0
  32. package/dist/components/VMeterGroup/VMeterGroup.vue_vue_type_script_setup_true_lang.js +117 -0
  33. package/dist/components/VMeterGroup/VMeterGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
  34. package/dist/components/VNumberInput/number.js +2 -2
  35. package/dist/components/VNumberInput/number.js.map +1 -1
  36. package/dist/components/VProgressCircular/VProgressCircular.d.ts +1 -1
  37. package/dist/components/VProgressLinear/VProgressLinear.css +1 -1
  38. package/dist/components/VProgressLinear/VProgressLinear.d.ts +12 -13
  39. package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
  40. package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js +65 -48
  41. package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js.map +1 -1
  42. package/dist/components/VSeparator/VSeparator.css +1 -1
  43. package/dist/components/VSeparator/VSeparator.d.ts +42 -2
  44. package/dist/components/VSeparator/VSeparator.js.map +1 -1
  45. package/dist/components/VSeparator/VSeparator.vue_vue_type_script_setup_true_lang.js +50 -9
  46. package/dist/components/VSeparator/VSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
  47. package/dist/components/VSideNavigation/VSideNavigation.d.ts +6 -0
  48. package/dist/components/VSideNavigation/VSideNavigation.js.map +1 -1
  49. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +11 -2
  50. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/components/VSideNavigation/VSideNavigationItem.css +1 -1
  52. package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
  53. package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/components/VSnackbar/state.js +2 -3
  55. package/dist/components/VSnackbar/state.js.map +1 -1
  56. package/dist/components/VToast/state.js +2 -3
  57. package/dist/components/VToast/state.js.map +1 -1
  58. package/dist/composables/useAriaLabel.d.ts +5 -0
  59. package/dist/composables/useAriaLabel.js +5 -1
  60. package/dist/composables/useAriaLabel.js.map +1 -1
  61. package/dist/composables/useListbox.d.ts +2 -0
  62. package/dist/composables/useListbox.js +71 -68
  63. package/dist/composables/useListbox.js.map +1 -1
  64. package/dist/i18n/en.js +3 -1
  65. package/dist/i18n/en.js.map +1 -1
  66. package/dist/i18n/fr.js +3 -1
  67. package/dist/i18n/fr.js.map +1 -1
  68. package/dist/i18n/types.d.ts +6 -0
  69. package/dist/index.d.ts +5 -3
  70. package/dist/index.js +21 -20
  71. package/dist/styles.css +1 -1
  72. package/dist/tokens/index.d.ts +10 -5
  73. package/dist/tokens/semantic.d.ts +10 -5
  74. package/dist/tokens/semantic.js +10 -5
  75. package/dist/tokens/semantic.js.map +1 -1
  76. package/dist/tokens.json +39 -14
  77. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"VDatePicker.js","names":["_sfc_main","VDatePicker_vue_vue_type_script_setup_true_lang_default","VDatePicker_default"],"sources":["../../../src/components/VDatePicker/VDatePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * Implement roving grid focus and date selection because the platform has no composable,\n * stylable date grid. VDateInput reuses this calendar logic.\n */\n\nimport { computed, inject, nextTick, onMounted, ref, useId, watch, watchEffect } from 'vue'\nimport type { Ref } from 'vue'\n\nimport VButton from '../VButton/VButton.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { arrow_drop_down as arrowDropDownIcon } from '../VIcon/icons/arrow_drop_down'\nimport { arrow_drop_up as arrowDropUpIcon } from '../VIcon/icons/arrow_drop_up'\nimport { chevron_left as chevronLeftIcon } from '../VIcon/icons/chevron_left'\nimport { chevron_right as chevronRightIcon } from '../VIcon/icons/chevron_right'\nimport VIconButton from '../VIconButton/VIconButton.vue'\nimport {\n addDays,\n addMonths,\n buildMonthGrid,\n clampISO,\n compareISO,\n daysInMonth,\n firstDayOfWeekFor,\n formatISO,\n isDateAllowed,\n isoOf,\n isSameISO,\n isValidISO,\n parseISO,\n weekdayNames,\n} from '../../utils/date'\nimport { monthName, monthNames, monthNamesCompact, monthYearName } from './names'\n\nimport { PICKER_COLUMNS, dayStep, gridDelta } from './keyboard'\n\nimport { toggleValue } from '../../utils/array'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { hostWarnsKey } from '../../utils/hostWarns'\nimport { resolveMatcher } from '../../utils/matcher'\nimport { clamp } from '../../utils/number'\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useMessages, useResolvedLocale } from '../../i18n/state'\n\n/** What a click selects: one date, a period between two, or a list of dates. */\nexport type DatePickerSelection = 'single' | 'range' | 'multiple'\n\n/**\n * A period between two dates, the value of a `range` selection. Either bound may be\n * null: between the first and the second click, a range has a start and no end yet.\n */\nexport interface DatePickerRange {\n /** The first day of the period, as an ISO `YYYY-MM-DD` string. */\n start: string | null\n /** The last day of the period, as an ISO `YYYY-MM-DD` string. */\n end: string | null\n}\n\n/** Something happening on a given day, shown as a coloured dot under its number. */\nexport interface DatePickerEvent {\n /** The day it falls on, as an ISO `YYYY-MM-DD` string. */\n date: string\n /** The colour of the dot, as any CSS colour. It is the accent colour by default. */\n color?: string\n /** A description of the event, spoken as part of the day's accessible name. */\n label?: string\n}\n\n/**\n * Which dates cannot be selected, given either as a list of ISO strings or as a\n * function answering that question for a date.\n */\nexport type DatePickerMatcher = string[] | ((iso: string) => boolean)\n\n/** The shape of the v-model, which follows whichever `selection` is in use. */\nexport type DatePickerValue = string | null | DatePickerRange | string[]\n\n/** Everything the `#day` slot is told about the day it draws. */\nexport interface DatePickerDaySlotProps {\n /** The day, as an ISO `YYYY-MM-DD` string. */\n iso: string\n /** The day of the month. */\n day: number\n /** Whether it belongs to the month on display rather than to a neighbouring one. */\n inMonth: boolean\n /** Whether it cannot be chosen: outside the bounds, or excluded by `disabledDates`. */\n disabled: boolean\n /** Whether it is selected. */\n selected: boolean\n /** Whether it is today. */\n today: boolean\n /** Whether it falls inside the selected period, both ends included. */\n inRange: boolean\n /** The events that fall on it. */\n events: DatePickerEvent[]\n}\n\ninterface DatePickerProps {\n /**\n * What the reader is picking: a single date, a period between two dates, or any\n * number of separate dates. It determines the shape of the v-model.\n */\n selection?: DatePickerSelection\n /**\n * A BCP 47 locale, which decides the month and day names and the first day of the\n * week. It TAKES PRECEDENCE over the design system's global locale (`setLocale`)\n * and falls back to it, which is why it has no literal default here: `undefined`\n * has to stay recognizable for the global locale to have its chance.\n */\n locale?: string\n /**\n * Forces the day the weeks start on (0 for Sunday through 6 for Saturday). Left\n * out, the locale decides.\n */\n firstDayOfWeek?: number\n /**\n * The earliest selectable date, as an ISO string. Neither navigation nor selection\n * goes back beyond it.\n */\n min?: string\n /**\n * The latest selectable date, as an ISO string. Neither navigation nor selection\n * goes past it.\n */\n max?: string\n /**\n * Dates that cannot be chosen, given as a list of ISO strings or as a function.\n * They stay visible, struck through, and can still be reached with the keyboard.\n */\n disabledDates?: DatePickerMatcher\n /**\n * Fills the empty corners of the grid with the greyed days of the neighbouring months. It is\n * off by default.\n */\n showAdjacentDays?: boolean\n /**\n * Lets those neighbouring days be clicked, which moves the calendar to their month.\n * A clickable day has to be visible, so this implies showing them.\n */\n selectAdjacentDays?: boolean\n /** The events to mark, as up to three coloured dots under the day they fall on. */\n events?: DatePickerEvent[]\n /**\n * Makes the whole calendar unusable: no date can be chosen, no month reached, and\n * everything greys out through the colour tokens.\n */\n disabled?: boolean\n /**\n * Shows what is selected without letting it be changed. The calendar can still be read and\n * walked through (another month, another year), which separates it from `disabled`.\n */\n readonly?: boolean\n /**\n * The accessible name of the whole picker, its header and its grid together. It falls back to\n * the dictionary, and a consumer `aria-label` wins.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<DatePickerProps>(), {\n selection: 'single',\n locale: undefined,\n firstDayOfWeek: undefined,\n min: undefined,\n max: undefined,\n disabledDates: undefined,\n showAdjacentDays: false,\n selectAdjacentDays: false,\n events: undefined,\n disabled: false,\n readonly: false,\n label: undefined,\n})\n\n/**\n * What is selected, and its shape follows `selection`: an ISO `YYYY-MM-DD` string for `single`,\n * a `{ start, end }` pair for `range`, an array of strings for `multiple`.\n */\nconst model = defineModel<DatePickerValue>({ default: null })\n\nconst emit = defineEmits<{\n /**\n * Emitted every time a date is chosen, carrying the complete value as it now\n * stands. VDateInput listens to it to close its panel on a single selection.\n */\n select: [value: DatePickerValue]\n}>()\n\ndefineSlots<{\n /**\n * Replaces the content of a day cell, to show a price or an availability under the\n * number for instance. It receives everything known about that day, including\n * whether it belongs to the displayed month.\n */\n day?(props: DatePickerDaySlotProps): unknown\n /** The strip under the grid, for actions such as Close or Save, or for preset dates. */\n footer?(): unknown\n}>()\n\nconst gridLabelId = useId()\n\n// The navigation labels have no prop of their own: the dictionary is the single place to change\n// them, globally or per language; see `src/i18n/`.\nconst m = useMessages()\n// @a11y\n// A roleless box cannot carry an accessible name (axe: aria-prohibited-attr),\n// so the root is a named group: the VCarousel viewport arrangement.\nconst ariaLabel = useAriaLabel(() => props.label ?? m.value.datePicker.label)\nconst resolvedLocale = useResolvedLocale(() => props.locale)\n\n// @devwarn\nif (isDev && !inject(hostWarnsKey, false)) {\n watchEffect(() => {\n if (props.min && props.max && compareISO(props.min, props.max) > 0)\n console.warn(\n `[VDatePicker] min \"${props.min}\" falls after max \"${props.max}\", so no date can be chosen.`,\n )\n })\n}\n\nconst resolvedFirstDay = computed(\n () => props.firstDayOfWeek ?? firstDayOfWeekFor(resolvedLocale.value),\n)\nconst weekdays = computed(() => weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'short'))\nconst weekdaysLong = computed(() =>\n weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'long'),\n)\nconst monthLabels = computed(() => monthNamesCompact(resolvedLocale.value))\n/** The full names the compact cells are spoken with: \"Jan.\" is not a word to hear. */\nconst monthNamesLong = computed(() => monthNames(resolvedLocale.value))\n\nconst singleValue = computed(() =>\n props.selection === 'single' && typeof model.value === 'string' && isValidISO(model.value)\n ? model.value\n : null,\n)\nconst rangeValue = computed<DatePickerRange>(() => {\n if (\n props.selection === 'range' &&\n model.value &&\n typeof model.value === 'object' &&\n !Array.isArray(model.value)\n ) {\n return model.value as DatePickerRange\n }\n return { start: null, end: null }\n})\nconst multipleValues = computed<string[]>(() =>\n props.selection === 'multiple' && Array.isArray(model.value) ? model.value : [],\n)\n\n// A range start or a list entry is validated here, the way the single value is validated\n// upstream: both arrive as the consumer wrote them, and the month arrows assert that the focused\n// date parses, so a malformed one (`{ start: 'foo' }`) must never become it.\nfunction initialFocus(): string {\n if (singleValue.value) return singleValue.value\n const start = rangeValue.value.start\n if (start && isValidISO(start)) return start\n const listed = multipleValues.value.find(isValidISO)\n if (listed) return listed\n readTheClock = true\n return clampISO(formatISO(new Date()), props.min, props.max)\n}\n/** Whether the month on display was read from the clock at setup: see `renderEpoch`. */\nlet readTheClock = false\nconst focusedISO = ref(initialFocus())\nconst view = ref<'days' | 'months' | 'years'>('days')\n\nconst viewYear = computed(\n () => parseISO(focusedISO.value)?.getFullYear() ?? new Date().getFullYear(),\n)\nconst viewMonth0 = computed(() => parseISO(focusedISO.value)?.getMonth() ?? 0)\nconst monthLabel = computed(() => monthName(resolvedLocale.value, viewMonth0.value))\nconst gridLabel = computed(() =>\n monthYearName(resolvedLocale.value, viewYear.value, viewMonth0.value),\n)\n\n// @ssr\n// Today's date is only read once the component is mounted, hence on the client: the\n// server has no way to know it, and rendering it during setup would make the two\n// markups differ and break hydration.\nconst today = ref<string | null>(null)\n\n// @ssr\n/*\n * With nothing selected, the month on display is read from the clock at setup, on the server\n * and again in the browser, and the two can disagree: a page prerendered in September and\n * opened in October, or a server a timezone behind its visitor on the last evening of a month.\n * Hydration patches the text but keeps the server's attributes, which would leave the month\n * button's accessible name and the day ids `focusDay` looks up on the server's month: bumping\n * the epoch re-renders the header and the grid once mounted.\n */\nconst renderEpoch = ref(0)\nonMounted(() => {\n today.value = formatISO(new Date())\n if (readTheClock) renderEpoch.value++\n})\n\nconst isDisabledDate = computed(() => resolveMatcher(props.disabledDates))\n\nconst eventsByDate = computed(() => {\n const map = new Map<string, DatePickerEvent[]>()\n for (const ev of props.events ?? []) {\n const list = map.get(ev.date) ?? []\n list.push(ev)\n map.set(ev.date, list)\n }\n return map\n})\n\nconst hoverISO = ref<string | null>(null)\nfunction orderRange(a: string, b: string): DatePickerRange {\n return compareISO(a, b) <= 0 ? { start: a, end: b } : { start: b, end: a }\n}\nconst effectiveRange = computed<DatePickerRange>(() => {\n if (props.selection !== 'range') return { start: null, end: null }\n const r = rangeValue.value\n if (r.start && r.end) return orderRange(r.start, r.end)\n // A start is set but the end is still pending: the range is previewed up to\n // whichever day the pointer or the focus is currently on.\n const preview = hoverISO.value ?? focusedISO.value\n if (r.start && preview) return orderRange(r.start, preview)\n return { start: r.start, end: r.end }\n})\n\n/**\n * Whether a day is part of the COMMITTED value, which `aria-selected` says: the end a range\n * preview is drawing is not selected yet, and announcing every day the focus walks over as\n * \"selected\" would say so.\n */\nfunction isCommitted(iso: string): boolean {\n if (props.selection !== 'range') return isSelected(iso)\n return isSameISO(iso, rangeValue.value.start) || isSameISO(iso, rangeValue.value.end)\n}\n\nfunction isSelected(iso: string): boolean {\n if (props.selection === 'single') return isSameISO(iso, singleValue.value)\n if (props.selection === 'multiple') return multipleValues.value.includes(iso)\n // In range selection, the two ends of the period count as selected; including the provisional\n // end shown during the preview.\n return isSameISO(iso, effectiveRange.value.start) || isSameISO(iso, effectiveRange.value.end)\n}\n/** Whether a day falls inside the selected period, both ends included. */\nfunction isInRange(iso: string): boolean {\n const { start, end } = effectiveRange.value\n return !!start && !!end && compareISO(iso, start) >= 0 && compareISO(iso, end) <= 0\n}\n\ntype DayCell = {\n iso: string\n day: number\n kind: 'empty' | 'static' | 'button'\n inMonth: boolean\n disabled: boolean\n selected: boolean\n /** Selected in the value itself, the preview left out: what `aria-selected` reports. */\n committed: boolean\n rangeStart: boolean\n rangeEnd: boolean\n inRange: boolean\n today: boolean\n events: DatePickerEvent[]\n /** The events drawn as dots under the number, three at most. */\n dots: DatePickerEvent[]\n /** The labels of its events, joined, for the day's accessible name. */\n eventText: string\n}\n\n/** The 42 squares of the month on display, rebuilt only when the MONTH changes. */\nconst grid = computed(() =>\n buildMonthGrid(viewYear.value, viewMonth0.value, resolvedFirstDay.value),\n)\n\nconst NO_EVENTS: DatePickerEvent[] = []\n\nconst days = computed<DayCell[]>(() =>\n grid.value.map((cell) => {\n const inMonth = cell.adjacent === null\n // Making the neighbouring days clickable implies showing them: a day nobody can\n // see cannot be clicked.\n const show = inMonth || props.showAdjacentDays || props.selectAdjacentDays\n const selectable = inMonth || props.selectAdjacentDays\n const disabled = !isDateAllowed(cell.iso, props.min, props.max, isDisabledDate.value)\n const kind: DayCell['kind'] = !show ? 'empty' : selectable ? 'button' : 'static'\n const events = eventsByDate.value.get(cell.iso) ?? NO_EVENTS\n return {\n iso: cell.iso,\n day: cell.day,\n kind,\n inMonth,\n disabled,\n selected: kind === 'button' && !disabled && isSelected(cell.iso),\n committed: kind === 'button' && !disabled && isCommitted(cell.iso),\n rangeStart: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.start),\n rangeEnd: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.end),\n inRange: props.selection === 'range' && isInRange(cell.iso),\n today: isSameISO(cell.iso, today.value),\n events,\n dots: events.length > 3 ? events.slice(0, 3) : events,\n eventText: events\n .map((ev) => ev.label)\n .filter(Boolean)\n .join(', '),\n }\n }),\n)\n\n/** What the `#day` slot receives for a square: the same object for both kinds of cell. */\nfunction daySlotProps(cell: DayCell): DatePickerDaySlotProps {\n return {\n iso: cell.iso,\n day: cell.day,\n inMonth: cell.inMonth,\n disabled: cell.disabled,\n selected: cell.selected,\n today: cell.today,\n inRange: cell.inRange,\n events: cell.events,\n }\n}\nconst weeks = computed(() => {\n const rows: DayCell[][] = []\n for (let i = 0; i < days.value.length; i += 7) rows.push(days.value.slice(i, i + 7))\n return rows\n})\n\nfunction monthHasSelectable(year: number, month0: number): boolean {\n const first = isoOf(year, month0, 1)\n const last = isoOf(year, month0, daysInMonth(year, month0))\n return (\n (!props.max || compareISO(first, props.max) <= 0) &&\n (!props.min || compareISO(last, props.min) >= 0)\n )\n}\n// Derived from the month on display, not from the focused day, so an arrow key moving the\n// focus inside the month does not recompute them.\nconst canPrevMonth = computed(() =>\n viewMonth0.value === 0\n ? monthHasSelectable(viewYear.value - 1, 11)\n : monthHasSelectable(viewYear.value, viewMonth0.value - 1),\n)\nconst canNextMonth = computed(() =>\n viewMonth0.value === 11\n ? monthHasSelectable(viewYear.value + 1, 0)\n : monthHasSelectable(viewYear.value, viewMonth0.value + 1),\n)\nconst canPrevYear = computed(\n () => !props.min || compareISO(isoOf(viewYear.value - 1, 11, 31), props.min) >= 0,\n)\nconst canNextYear = computed(\n () => !props.max || compareISO(isoOf(viewYear.value + 1, 0, 1), props.max) <= 0,\n)\n\n// @a11y\n// Moves the real DOM focus onto a day cell. The grid keeps exactly one cell in the\n// tab order, so navigating means focusing another one.\nconst dayId = (iso: string) => `${gridLabelId}-d-${iso}`\nfunction focusDay(iso: string, options?: FocusOptions) {\n nextTick(() => document.getElementById(dayId(iso))?.focus(options))\n}\n\nfunction goTo(iso: string, moveFocus = false) {\n // Every move through the calendar comes here, so one guard covers the arrows, the\n // month and year cells and the keyboard's own steps. Only `disabled` stops it:\n // `readonly` leaves the reader free to look around.\n if (props.disabled) return\n focusedISO.value = clampISO(iso, props.min, props.max)\n if (moveFocus && view.value === 'days') focusDay(focusedISO.value)\n}\nfunction stepMonth(delta: number) {\n goTo(addMonths(focusedISO.value, delta))\n}\nfunction stepYear(delta: number) {\n goTo(addMonths(focusedISO.value, delta * 12))\n}\n\n// @a11y @core\n// Changing view has to carry the focus onto the cell the new view\n// opens on. Without that move the focus would stay on a button the view has just\n// removed from the document, and the keyboard would have nowhere to go.\nfunction toggleView(target: 'months' | 'years') {\n const next = view.value === target ? 'days' : target\n view.value = next\n if (next === 'months') {\n focusedMonth.value = viewMonth0.value\n nextTick(() => monthCellEl(viewMonth0.value)?.focus())\n } else if (next === 'years') {\n focusedYear.value = viewYear.value\n nextTick(() => {\n const cell = yearCellEl(viewYear.value)\n // Called optionally because jsdom does not implement scrollIntoView (the same\n // guard as VTimeInput's list). Centring the year is a nicety; the focus call\n // below is not, so it must not be taken down with it.\n cell?.scrollIntoView?.({ block: 'center' })\n cell?.focus()\n })\n } else if (view.value === 'days') {\n focusDay(focusedISO.value)\n }\n}\n\nfunction selectDay(cell: DayCell) {\n // Navigation is deliberately not guarded by `readonly`: a calendar one may read is a calendar\n // one may leaf through.\n if (props.disabled || props.readonly) return\n if (cell.kind !== 'button' || cell.disabled) return\n focusedISO.value = cell.iso\n let next: DatePickerValue\n if (props.selection === 'single') {\n next = cell.iso\n } else if (props.selection === 'multiple') {\n next = toggleValue(multipleValues.value, cell.iso).sort(compareISO)\n } else {\n // Range selection reads three clicks: the first sets the start, the second the\n // end (reordered if it comes before the start), and the third starts a new\n // period.\n const r = rangeValue.value\n next = !r.start || r.end ? { start: cell.iso, end: null } : orderRange(r.start, cell.iso)\n }\n lastWritten = JSON.stringify(next)\n model.value = next\n // Emit what was just computed, never `model.value` read back. Under a parent `v-model`,\n // `defineModel` does not update its local copy on write; it waits for the parent to\n // re-render; so the read would hand `select` the PREVIOUS value.\n emit('select', next)\n}\n\n// @keyboard @a11y\n// The keyboard of the days view. The table turning a key into a step is pure and\n// lives in `./keyboard`; what stays here is the date that step is applied to, and\n// the focus move that follows.\nfunction onDaysKeydown(event: KeyboardEvent) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n const cell = days.value.find((c) => c.iso === focusedISO.value)\n if (cell) selectDay(cell)\n return\n }\n const d = parseISO(focusedISO.value)!\n // How far the focused day sits from the start of its week, which is exactly what\n // Home and End have to step back and forward by.\n const offset = (d.getDay() - resolvedFirstDay.value + 7) % 7\n const step = dayStep(event.key, event.shiftKey, offset, isRtl(event.currentTarget as Element))\n if (!step) return\n event.preventDefault()\n goTo(\n 'days' in step\n ? addDays(focusedISO.value, step.days)\n : addMonths(focusedISO.value, step.months),\n true,\n )\n}\n\n/**\n * Leaving the months or the years view for the days of the month chosen, keeping the day of the\n * month where the new month has one; the 31st becoming the 30th, say.\n */\nfunction chooseYearMonth(year: number, month0: number) {\n const day = Math.min(parseISO(focusedISO.value)!.getDate(), daysInMonth(year, month0))\n goTo(isoOf(year, month0, day))\n view.value = 'days'\n focusDay(focusedISO.value)\n}\n\n// @keyboard @a11y\n/**\n * The keyboard of the months and the years views, which differ only in what their cells\n * hold: Enter or Space chooses the focused cell, and the arrows walk the list of cells a row\n * or a column at a time, stopping at either end.\n */\nfunction onViewKeydown(\n event: KeyboardEvent,\n cells: readonly number[],\n focused: Ref<number>,\n cellEl: (value: number) => HTMLElement | null,\n choose: (value: number) => void,\n selectable: (value: number) => boolean = () => true,\n) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n choose(focused.value)\n return\n }\n const delta = gridDelta(event.key, isRtl(event.currentTarget as Element))\n if (delta === undefined) return\n event.preventDefault()\n // A cell the bounds rule out is a disabled button, which cannot take the focus: landing on it\n // would move the tab stop where the focus cannot follow. The walk goes on the same way round\n // to the next cell that can be chosen, and holds still when there is none.\n let next = clamp(cells.indexOf(focused.value) + delta, 0, cells.length - 1)\n while (!selectable(cells[next]!) && next + delta >= 0 && next + delta < cells.length)\n next += delta\n if (!selectable(cells[next]!)) return\n focused.value = cells[next]!\n cellEl(focused.value)?.focus()\n}\n\nconst MONTHS = Array.from({ length: 12 }, (_, i) => i)\nconst focusedMonth = ref(viewMonth0.value)\nconst monthCellEl = (i: number) =>\n document.getElementById(`${gridLabelId}-m-${i}`) as HTMLElement | null\nfunction monthSelectable(i: number) {\n return monthHasSelectable(viewYear.value, i)\n}\nfunction chooseMonth(i: number) {\n if (monthSelectable(i)) chooseYearMonth(viewYear.value, i)\n}\nconst onMonthsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, MONTHS, focusedMonth, monthCellEl, chooseMonth, monthSelectable)\n\n// @a11y\n/*\n * Both pickers are a `role=\"grid\"`, and a grid owns ROWS, not cells: a gridcell placed straight\n * under the grid fails aria-required-children and aria-required-parent at the same time. The\n * cells are therefore cut into rows of PICKER_COLUMNS, matching the `grid-template-columns` of\n * the stylesheet; the row element itself is `display: contents`, so the CSS grid never sees it.\n */\nconst chunk = <T>(list: T[]) =>\n Array.from({ length: Math.ceil(list.length / PICKER_COLUMNS) }, (_, r) =>\n list.slice(r * PICKER_COLUMNS, r * PICKER_COLUMNS + PICKER_COLUMNS),\n )\n\nconst monthRows = computed(() => chunk(monthLabels.value.map((name, i) => ({ name, i }))))\n\nconst yearRange = computed(() => {\n /*\n * `min` and `max` come straight from the consumer, and this is the only place where they are\n * turned into a Date instead of being compared as ISO text; `compareISO`, `isWithin` and\n * `clampISO` all tolerate a malformed bound. A value that is not a valid ISO date therefore\n * has to fall back to the open range here: asserting the parse would throw and take the whole\n * render down the moment the years view is opened.\n */\n const minY = parseISO(props.min)?.getFullYear() ?? viewYear.value - 100\n const maxY = parseISO(props.max)?.getFullYear() ?? viewYear.value + 100\n const list: number[] = []\n for (let y = minY; y <= maxY; y++) list.push(y)\n return list\n})\nconst yearRows = computed(() => chunk(yearRange.value))\nconst focusedYear = ref(viewYear.value)\nconst yearCellEl = (y: number) =>\n document.getElementById(`${gridLabelId}-y-${y}`) as HTMLElement | null\nconst chooseYear = (y: number) => chooseYearMonth(y, viewMonth0.value)\nconst onYearsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, yearRange.value, focusedYear, yearCellEl, chooseYear)\n\n// Only from the OUTSIDE. The picker's own writes change the leading value too: unticking the\n// earliest date of a list makes the next one lead, and following it would throw the reader into\n// another month and drop the focus on `<body>`, the day they were on having left the document.\nlet lastWritten: string | undefined\nwatch(\n () => [singleValue.value, rangeValue.value.start, multipleValues.value[0]],\n () => {\n if (lastWritten !== undefined && JSON.stringify(model.value) === lastWritten) return\n const primary = singleValue.value ?? rangeValue.value.start ?? multipleValues.value[0]\n if (primary && isValidISO(primary)) {\n const d = parseISO(primary)!\n if (d.getFullYear() !== viewYear.value || d.getMonth() !== viewMonth0.value) {\n focusedISO.value = primary\n }\n }\n },\n)\n\n// @a11y\n/**\n * Brings the focus into the grid, on the day the calendar is currently showing. This\n * is what VDateInput calls when it opens its panel.\n */\nfunction focus(options?: FocusOptions) {\n view.value = 'days'\n focusDay(focusedISO.value, options)\n}\n\n// @core\n/*\n * A panel's content stays MOUNTED while the panel is closed, so without this the months or\n * years view a reader left open is what the next opening shows; and a field that opens its\n * panel on focus never calls `focus()`, the one place that reset the view.\n */\nfunction reset() {\n view.value = 'days'\n hoverISO.value = null\n focusedISO.value = initialFocus()\n}\n\ndefineExpose({\n /** Brings the focus into the grid, onto the day the calendar is showing. */\n focus,\n /**\n * Returns to the days view, on the selected date or today, without moving the focus.\n * VDateInput calls it each time its panel opens and closes.\n */\n reset,\n})\n</script>\n\n<template>\n <div\n class=\"v-date-picker\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :data-view=\"view\"\n :data-selection=\"selection\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-readonly=\"readonly ? '' : undefined\"\n @pointerleave=\"hoverISO = null\"\n >\n <!-- The header: the month and the year, each between two chevrons that step it,\n and each opening its own picker view when clicked -->\n <div :key=\"`header-${renderEpoch}`\" class=\"v-date-picker-header\">\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevMonth\"\n @click=\"stepMonth(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'months'\"\n :aria-label=\"monthLabel\"\n @click=\"toggleView('months')\"\n >\n {{ monthLabels[viewMonth0] }}\n <VIcon\n :name=\"view === 'months' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canNextMonth\"\n @click=\"stepMonth(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousYear\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevYear\"\n @click=\"stepYear(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'years'\"\n @click=\"toggleView('years')\"\n >\n {{ viewYear }}\n <VIcon\n :name=\"view === 'years' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextYear\"\n size=\"sm\"\n :disabled=\"disabled || !canNextYear\"\n @click=\"stepYear(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n </div>\n\n <div\n v-show=\"view === 'days'\"\n :key=\"`days-${renderEpoch}`\"\n class=\"v-date-picker-grid\"\n role=\"grid\"\n :aria-label=\"gridLabel\"\n :aria-multiselectable=\"selection === 'multiple' ? 'true' : undefined\"\n @keydown=\"onDaysKeydown\"\n >\n <div class=\"v-date-picker-weekdays\" role=\"row\">\n <span\n v-for=\"(w, i) in weekdays\"\n :key=\"w\"\n class=\"v-date-picker-weekday\"\n role=\"columnheader\"\n :aria-label=\"weekdaysLong[i]\"\n >{{ w }}</span\n >\n </div>\n <div v-for=\"(week, wi) in weeks\" :key=\"wi\" class=\"v-date-picker-week\" role=\"row\">\n <div\n v-for=\"cell in week\"\n :key=\"cell.iso\"\n class=\"v-date-picker-cell\"\n role=\"gridcell\"\n :aria-selected=\"cell.kind === 'button' ? cell.committed : undefined\"\n :data-in-range=\"cell.inRange ? '' : undefined\"\n :data-range-start=\"cell.rangeStart ? '' : undefined\"\n :data-range-end=\"cell.rangeEnd ? '' : undefined\"\n >\n <button\n v-if=\"cell.kind === 'button'\"\n :id=\"dayId(cell.iso)\"\n type=\"button\"\n class=\"v-date-picker-day\"\n :tabindex=\"cell.iso === focusedISO ? 0 : -1\"\n :data-outside=\"!cell.inMonth ? '' : undefined\"\n :data-selected=\"cell.selected ? '' : undefined\"\n :data-today=\"cell.today ? '' : undefined\"\n :data-unavailable=\"cell.disabled ? '' : undefined\"\n :disabled=\"disabled\"\n :aria-disabled=\"cell.disabled || readonly ? 'true' : undefined\"\n :aria-current=\"cell.today ? 'date' : undefined\"\n @click=\"selectDay(cell)\"\n @pointerenter=\"hoverISO = cell.iso\"\n @focus=\"hoverISO = cell.iso\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n <!-- The dots are hidden from assistive technology, so what they stand for is\n spoken here, as part of the day's name. -->\n <span v-if=\"cell.eventText\" class=\"v-visually-hidden\">, {{ cell.eventText }}</span>\n <span v-if=\"cell.dots.length\" class=\"v-date-picker-dots\" aria-hidden=\"true\">\n <span\n v-for=\"(ev, ei) in cell.dots\"\n :key=\"ei\"\n class=\"v-date-picker-dot\"\n :style=\"ev.color ? { '--date-picker-dot-color': ev.color } : undefined\"\n />\n </span>\n </button>\n <!--\n A day of a neighbouring month that cannot be selected. It renders the very same slot\n as the clickable days: were it left with the bare number, custom content taking\n several lines would apply to this month's days only, and the numbers would stop\n lining up from one cell to the next.\n -->\n <span\n v-else-if=\"cell.kind === 'static'\"\n class=\"v-date-picker-day v-date-picker-day--static\"\n :data-disabled=\"cell.disabled ? '' : undefined\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n </span>\n </div>\n </div>\n </div>\n\n <div\n v-if=\"view === 'months'\"\n class=\"v-date-picker-view\"\n role=\"grid\"\n :aria-label=\"m.datePicker.monthPicker\"\n @keydown=\"onMonthsKeydown\"\n >\n <div v-for=\"(row, r) in monthRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"{ name, i } in row\"\n :id=\"`${gridLabelId}-m-${i}`\"\n :key=\"i\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"i === focusedMonth ? 0 : -1\"\n :data-selected=\"i === viewMonth0 ? '' : undefined\"\n :aria-selected=\"i === viewMonth0 ? 'true' : undefined\"\n :aria-label=\"monthNamesLong[i]\"\n :disabled=\"disabled || !monthSelectable(i)\"\n @click=\"chooseMonth(i)\"\n >\n {{ name }}\n </button>\n </div>\n </div>\n\n <div\n v-if=\"view === 'years'\"\n class=\"v-date-picker-view v-date-picker-view--years\"\n role=\"grid\"\n :aria-label=\"m.datePicker.yearPicker\"\n @keydown=\"onYearsKeydown\"\n >\n <div v-for=\"(row, r) in yearRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"y in row\"\n :id=\"`${gridLabelId}-y-${y}`\"\n :key=\"y\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"y === focusedYear ? 0 : -1\"\n :data-selected=\"y === viewYear ? '' : undefined\"\n :aria-selected=\"y === viewYear ? 'true' : undefined\"\n :disabled=\"disabled\"\n @click=\"chooseYear(y)\"\n >\n {{ y }}\n </button>\n </div>\n </div>\n\n <div v-if=\"$slots.footer\" class=\"v-date-picker-footer\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-date-picker {\n /*\n * The consumer sets the size of the day disc through its token; the cell around it; the\n * hover area and the width of the column; grows to follow, and never falls below the size\n * the cell token sets.\n */\n --date-picker-cell: max(\n var(--vectis-control-size-date-picker-cell),\n calc(var(--vectis-control-size-date-picker-day) + var(--vectis-space-1))\n );\n display: inline-flex;\n flex-direction: column;\n gap: var(--vectis-space-2);\n padding: var(--vectis-space-3);\n font-family: var(--vectis-text-family);\n color: var(--vectis-color-text);\n }\n\n /*\n * The days grid then fills that width through its 1fr columns, and never goes below the seven\n * cells its own floor guarantees.\n */\n .v-date-picker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--vectis-space-2);\n }\n\n .v-date-picker-nav {\n display: flex;\n align-items: center;\n }\n\n /* A minimum width holds this button steady, so the chevrons on either side do not\n shift as the month or year label changes length. */\n /* Qualified by an attribute the button always renders: `.v-button` sets its own\n `font-weight` at (0,1,0), and a tie between the two sheets would leave the weight to\n whichever the consumer's bundler put last. */\n .v-date-picker-view-toggle[data-size] {\n min-inline-size: var(--vectis-control-size-date-picker-nav-min);\n font-weight: var(--vectis-font-weight-semibold);\n text-transform: capitalize;\n }\n\n /*\n * The days grid can never be narrower than seven cells. Above that floor it takes whatever\n * width the calendar has; set by the header; and the 1fr columns share it out equally.\n */\n .v-date-picker-grid {\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n\n .v-date-picker-weekdays,\n .v-date-picker-week {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n }\n\n .v-date-picker-weekday {\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--vectis-control-height-sm);\n /* A column micro-header, which takes the overline type role. The casing stays\n `capitalize`, the calendar convention, rather than the full capitals the\n VTypography overline variant would apply. */\n font-size: var(--vectis-text-overline-size);\n font-weight: var(--vectis-text-overline-weight);\n letter-spacing: var(--vectis-text-overline-tracking);\n color: var(--vectis-color-text-muted);\n text-transform: capitalize;\n }\n\n .v-date-picker-cell {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--date-picker-cell);\n }\n\n /*\n * The two cap rules below only shape a pseudo-element that `[data-in-range]` has already\n * created, so they depend on `isInRange` counting both ends of the period as inside it. Make\n * it exclusive and there is no `::before` to cap: both rounded ends of every range vanish,\n * leaving a band that stops square one cell short at each side, with nothing in the console.\n */\n .v-date-picker-cell[data-in-range]::before {\n content: '';\n position: absolute;\n inset-block: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n inset-inline: 0;\n background: var(--vectis-color-accent-surface);\n z-index: 0;\n }\n .v-date-picker-cell[data-range-start]::before {\n inset-inline-start: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-start-radius: var(--vectis-radius-pill);\n border-end-start-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-end]::before {\n inset-inline-end: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-end-radius: var(--vectis-radius-pill);\n border-end-end-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-start][data-range-end]::before {\n content: none;\n }\n\n .v-date-picker-day {\n position: relative;\n z-index: 1;\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: var(--vectis-control-size-date-picker-day);\n block-size: var(--vectis-control-size-date-picker-day);\n padding: 0;\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n cursor: pointer;\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* Hover belongs to the days one can actually click: not the disabled ones, not the\n already selected ones, and not the neighbouring days rendered as plain spans. */\n .v-date-picker-day:hover:not(:disabled):not([aria-disabled='true']):not([data-selected]):not(\n .v-date-picker-day--static\n ) {\n background: var(--vectis-color-surface-muted);\n }\n\n .v-date-picker-day[data-outside] {\n color: var(--vectis-color-text-subtle);\n }\n\n /*\n * The semibold in the two rules below marks a state; today, and the selection; and is not a\n * typographic role, which is why it reads a font token directly.\n */\n .v-date-picker-day[data-today]:not([data-selected]) {\n box-shadow: inset 0 0 0 1px var(--vectis-color-accent-border);\n color: var(--vectis-color-accent-text);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n .v-date-picker-day[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n /*\n * It hangs on its own attribute rather than on `aria-disabled`, which a read-only calendar\n * also carries on every day: nothing can be chosen there, but the dates themselves are\n * perfectly available and striking them all out would say the opposite. The hover rule below\n * still reads `aria-disabled`, so neither highlights.\n */\n .v-date-picker-day[data-unavailable] {\n color: var(--vectis-color-text-subtle);\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker[data-readonly] .v-date-picker-day:not([data-unavailable]) {\n cursor: default;\n }\n\n /* A disabled calendar greys out through the colour tokens and never through opacity,\n the selection included: left in the accent colour it would go on looking live. */\n .v-date-picker-day:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n\n .v-date-picker[data-disabled] .v-date-picker-day[data-selected] {\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n .v-date-picker-day--static {\n color: var(--vectis-color-text-subtle);\n cursor: default;\n }\n\n /* A neighbouring day that falls outside the bounds, or is disabled, is struck\n through like any other unavailable date. */\n .v-date-picker-day--static[data-disabled] {\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker-day:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-date-picker-day-num {\n line-height: var(--vectis-text-control-leading);\n }\n\n .v-date-picker-dots {\n position: absolute;\n /* Half a dot, below them and between them: the spacing scale has no step that small. */\n inset-block-end: calc(var(--vectis-control-size-date-picker-dot) / 2);\n display: flex;\n gap: calc(var(--vectis-control-size-date-picker-dot) / 2);\n }\n .v-date-picker-dot {\n inline-size: var(--vectis-control-size-date-picker-dot);\n block-size: var(--vectis-control-size-date-picker-dot);\n border-radius: var(--vectis-radius-pill);\n background: var(--date-picker-dot-color, var(--vectis-color-accent));\n }\n .v-date-picker-day[data-selected] .v-date-picker-dot {\n background: var(--vectis-color-text-on-accent);\n }\n\n /* The months and years views. They fill the calendar's width exactly like the days\n grid does: stretched by the flex column, then shared out by 1fr columns. */\n .v-date-picker-view {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: var(--vectis-space-1);\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n /* The rows ARIA requires inside a grid, made invisible to the layout: with\n `display: contents` the cells remain direct grid items of `.v-date-picker-view`,\n so the columns line up as if the rows were not there. */\n .v-date-picker-view-row {\n display: contents;\n }\n\n .v-date-picker-view--years {\n max-block-size: calc(6 * var(--date-picker-cell));\n overflow-y: auto;\n }\n\n .v-date-picker-view-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n block-size: var(--vectis-control-height-lg);\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n text-transform: capitalize;\n cursor: pointer;\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n .v-date-picker-view-cell:hover:not(:disabled):not([data-selected]) {\n background: var(--vectis-color-surface-muted);\n }\n .v-date-picker-view-cell[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n .v-date-picker-view-cell:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n .v-date-picker-view-cell:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: calc(-1 * var(--vectis-focus-ring-width));\n }\n\n .v-date-picker-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--vectis-space-2);\n padding-block-start: var(--vectis-space-2);\n border-block-start: 1px solid var(--vectis-color-border);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-date-picker-day,\n .v-date-picker-view-cell {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VDatePicker.js","names":["_sfc_main","VDatePicker_vue_vue_type_script_setup_true_lang_default","VDatePicker_default"],"sources":["../../../src/components/VDatePicker/VDatePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * Implement roving grid focus and date selection because the platform has no composable,\n * stylable date grid. VDateInput reuses this calendar logic.\n */\n\nimport { computed, inject, nextTick, onMounted, ref, useId, watch, watchEffect } from 'vue'\nimport type { Ref } from 'vue'\n\nimport VButton from '../VButton/VButton.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { arrow_drop_down as arrowDropDownIcon } from '../VIcon/icons/arrow_drop_down'\nimport { arrow_drop_up as arrowDropUpIcon } from '../VIcon/icons/arrow_drop_up'\nimport { chevron_left as chevronLeftIcon } from '../VIcon/icons/chevron_left'\nimport { chevron_right as chevronRightIcon } from '../VIcon/icons/chevron_right'\nimport VIconButton from '../VIconButton/VIconButton.vue'\nimport {\n addDays,\n addMonths,\n buildMonthGrid,\n clampISO,\n compareISO,\n daysInMonth,\n firstDayOfWeekFor,\n formatISO,\n isDateAllowed,\n isoOf,\n isSameISO,\n isValidISO,\n parseISO,\n weekdayNames,\n} from '../../utils/date'\nimport { monthName, monthNames, monthNamesCompact, monthYearName } from './names'\n\nimport { PICKER_COLUMNS, dayStep, gridDelta } from './keyboard'\n\nimport { toggleValue } from '../../utils/array'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { hostWarnsKey } from '../../utils/hostWarns'\nimport { resolveMatcher } from '../../utils/matcher'\nimport { clamp } from '../../utils/number'\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useMessages, useResolvedLocale } from '../../i18n/state'\n\n/** What a click selects: one date, a period between two, or a list of dates. */\nexport type DatePickerSelection = 'single' | 'range' | 'multiple'\n\n/**\n * A period between two dates, the value of a `range` selection. Either bound may be\n * null: between the first and the second click, a range has a start and no end yet.\n */\nexport interface DatePickerRange {\n /** The first day of the period, as an ISO `YYYY-MM-DD` string. */\n start: string | null\n /** The last day of the period, as an ISO `YYYY-MM-DD` string. */\n end: string | null\n}\n\n/** Something happening on a given day, shown as a coloured dot under its number. */\nexport interface DatePickerEvent {\n /** The day it falls on, as an ISO `YYYY-MM-DD` string. */\n date: string\n /** The colour of the dot, as any CSS colour. It is the accent colour by default. */\n color?: string\n /** A description of the event, spoken as part of the day's accessible name. */\n label?: string\n}\n\n/**\n * Which dates cannot be selected, given either as a list of ISO strings or as a\n * function answering that question for a date.\n */\nexport type DatePickerMatcher = string[] | ((iso: string) => boolean)\n\n/** The shape of the v-model, which follows whichever `selection` is in use. */\nexport type DatePickerValue = string | null | DatePickerRange | string[]\n\n/** Everything the `#day` slot is told about the day it draws. */\nexport interface DatePickerDaySlotProps {\n /** The day, as an ISO `YYYY-MM-DD` string. */\n iso: string\n /** The day of the month. */\n day: number\n /** Whether it belongs to the month on display rather than to a neighbouring one. */\n inMonth: boolean\n /** Whether it cannot be chosen: outside the bounds, or excluded by `disabledDates`. */\n disabled: boolean\n /** Whether it is selected. */\n selected: boolean\n /** Whether it is today. */\n today: boolean\n /** Whether it falls inside the selected period, both ends included. */\n inRange: boolean\n /** The events that fall on it. */\n events: DatePickerEvent[]\n}\n\ninterface DatePickerProps {\n /**\n * What the reader is picking: a single date, a period between two dates, or any\n * number of separate dates. It determines the shape of the v-model.\n */\n selection?: DatePickerSelection\n /**\n * A BCP 47 locale, which decides the month and day names and the first day of the\n * week. It TAKES PRECEDENCE over the design system's global locale (`setLocale`)\n * and falls back to it, which is why it has no literal default here: `undefined`\n * has to stay recognizable for the global locale to have its chance.\n */\n locale?: string\n /**\n * Forces the day the weeks start on (0 for Sunday through 6 for Saturday). Left\n * out, the locale decides.\n */\n firstDayOfWeek?: number\n /**\n * The earliest selectable date, as an ISO string. Neither navigation nor selection\n * goes back beyond it.\n */\n min?: string\n /**\n * The latest selectable date, as an ISO string. Neither navigation nor selection\n * goes past it.\n */\n max?: string\n /**\n * Dates that cannot be chosen, given as a list of ISO strings or as a function.\n * They stay visible, struck through, and can still be reached with the keyboard.\n */\n disabledDates?: DatePickerMatcher\n /**\n * Fills the empty corners of the grid with the greyed days of the neighbouring months. It is\n * off by default.\n */\n showAdjacentDays?: boolean\n /**\n * Lets those neighbouring days be clicked, which moves the calendar to their month.\n * A clickable day has to be visible, so this implies showing them.\n */\n selectAdjacentDays?: boolean\n /** The events to mark, as up to three coloured dots under the day they fall on. */\n events?: DatePickerEvent[]\n /**\n * Makes the whole calendar unusable: no date can be chosen, no month reached, and\n * everything greys out through the colour tokens.\n */\n disabled?: boolean\n /**\n * Shows what is selected without letting it be changed. The calendar can still be read and\n * walked through (another month, another year), which separates it from `disabled`.\n */\n readonly?: boolean\n /**\n * The accessible name of the whole picker, its header and its grid together. It falls back to\n * the dictionary, and a consumer `aria-label` wins.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<DatePickerProps>(), {\n selection: 'single',\n locale: undefined,\n firstDayOfWeek: undefined,\n min: undefined,\n max: undefined,\n disabledDates: undefined,\n showAdjacentDays: false,\n selectAdjacentDays: false,\n events: undefined,\n disabled: false,\n readonly: false,\n label: undefined,\n})\n\n/**\n * What is selected, and its shape follows `selection`: an ISO `YYYY-MM-DD` string for `single`,\n * a `{ start, end }` pair for `range`, an array of strings for `multiple`.\n */\nconst model = defineModel<DatePickerValue>({ default: null })\n\nconst emit = defineEmits<{\n /**\n * Emitted every time a date is chosen, carrying the complete value as it now\n * stands. VDateInput listens to it to close its panel on a single selection.\n */\n select: [value: DatePickerValue]\n}>()\n\ndefineSlots<{\n /**\n * Replaces the content of a day cell, to show a price or an availability under the\n * number for instance. It receives everything known about that day, including\n * whether it belongs to the displayed month.\n */\n day?(props: DatePickerDaySlotProps): unknown\n /** The strip under the grid, for actions such as Close or Save, or for preset dates. */\n footer?(): unknown\n}>()\n\nconst gridLabelId = useId()\n\n// The navigation labels have no prop of their own: the dictionary is the single place to change\n// them, globally or per language; see `src/i18n/`.\nconst m = useMessages()\n// @a11y\n// A roleless box cannot carry an accessible name (axe: aria-prohibited-attr),\n// so the root is a named group: the VCarousel viewport arrangement.\nconst ariaLabel = useAriaLabel(() => props.label ?? m.value.datePicker.label)\nconst resolvedLocale = useResolvedLocale(() => props.locale)\n\n// @devwarn\nif (isDev && !inject(hostWarnsKey, false)) {\n watchEffect(() => {\n if (props.min && props.max && compareISO(props.min, props.max) > 0)\n console.warn(\n `[VDatePicker] min \"${props.min}\" falls after max \"${props.max}\", so no date can be chosen.`,\n )\n })\n}\n\nconst resolvedFirstDay = computed(\n () => props.firstDayOfWeek ?? firstDayOfWeekFor(resolvedLocale.value),\n)\nconst weekdays = computed(() => weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'short'))\nconst weekdaysLong = computed(() =>\n weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'long'),\n)\nconst monthLabels = computed(() => monthNamesCompact(resolvedLocale.value))\n/** The full names the compact cells are spoken with: \"Jan.\" is not a word to hear. */\nconst monthNamesLong = computed(() => monthNames(resolvedLocale.value))\n\nconst singleValue = computed(() =>\n props.selection === 'single' && typeof model.value === 'string' && isValidISO(model.value)\n ? model.value\n : null,\n)\nconst rangeValue = computed<DatePickerRange>(() => {\n if (\n props.selection === 'range' &&\n model.value &&\n typeof model.value === 'object' &&\n !Array.isArray(model.value)\n ) {\n return model.value as DatePickerRange\n }\n return { start: null, end: null }\n})\nconst multipleValues = computed<string[]>(() =>\n props.selection === 'multiple' && Array.isArray(model.value) ? model.value : [],\n)\n\n// A range start or a list entry is validated here, the way the single value is validated\n// upstream: both arrive as the consumer wrote them, and the month arrows assert that the focused\n// date parses, so a malformed one (`{ start: 'foo' }`) must never become it.\nfunction initialFocus(): string {\n if (singleValue.value) return singleValue.value\n const start = rangeValue.value.start\n if (start && isValidISO(start)) return start\n const listed = multipleValues.value.find(isValidISO)\n if (listed) return listed\n readTheClock = true\n return clampISO(formatISO(new Date()), props.min, props.max)\n}\n/** Whether the month on display was read from the clock at setup: see `renderEpoch`. */\nlet readTheClock = false\nconst focusedISO = ref(initialFocus())\nconst view = ref<'days' | 'months' | 'years'>('days')\n\nconst viewYear = computed(\n () => parseISO(focusedISO.value)?.getFullYear() ?? new Date().getFullYear(),\n)\nconst viewMonth0 = computed(() => parseISO(focusedISO.value)?.getMonth() ?? 0)\nconst monthLabel = computed(() => monthName(resolvedLocale.value, viewMonth0.value))\nconst gridLabel = computed(() =>\n monthYearName(resolvedLocale.value, viewYear.value, viewMonth0.value),\n)\n\n// @ssr\n// Today's date is only read once the component is mounted, hence on the client: the\n// server has no way to know it, and rendering it during setup would make the two\n// markups differ and break hydration.\nconst today = ref<string | null>(null)\n\n// @ssr\n/*\n * With nothing selected, the month on display is read from the clock at setup, on the server\n * and again in the browser, and the two can disagree: a page prerendered in September and\n * opened in October, or a server a timezone behind its visitor on the last evening of a month.\n * Hydration patches the text but keeps the server's attributes, which would leave the month\n * button's accessible name and the day ids `focusDay` looks up on the server's month: bumping\n * the epoch re-renders the header and the grid once mounted.\n */\nconst renderEpoch = ref(0)\nonMounted(() => {\n today.value = formatISO(new Date())\n if (readTheClock) renderEpoch.value++\n})\n\nconst isDisabledDate = computed(() => resolveMatcher(props.disabledDates))\n\nconst eventsByDate = computed(() => {\n const map = new Map<string, DatePickerEvent[]>()\n for (const ev of props.events ?? []) {\n const list = map.get(ev.date) ?? []\n list.push(ev)\n map.set(ev.date, list)\n }\n return map\n})\n\nconst hoverISO = ref<string | null>(null)\nfunction orderRange(a: string, b: string): DatePickerRange {\n return compareISO(a, b) <= 0 ? { start: a, end: b } : { start: b, end: a }\n}\nconst effectiveRange = computed<DatePickerRange>(() => {\n if (props.selection !== 'range') return { start: null, end: null }\n const r = rangeValue.value\n if (r.start && r.end) return orderRange(r.start, r.end)\n // A start is set but the end is still pending: the range is previewed up to\n // whichever day the pointer or the focus is currently on.\n const preview = hoverISO.value ?? focusedISO.value\n if (r.start && preview) return orderRange(r.start, preview)\n return { start: r.start, end: r.end }\n})\n\n/**\n * Whether a day is part of the COMMITTED value, which `aria-selected` says: the end a range\n * preview is drawing is not selected yet, and announcing every day the focus walks over as\n * \"selected\" would say so.\n */\nfunction isCommitted(iso: string): boolean {\n if (props.selection !== 'range') return isSelected(iso)\n return isSameISO(iso, rangeValue.value.start) || isSameISO(iso, rangeValue.value.end)\n}\n\nfunction isSelected(iso: string): boolean {\n if (props.selection === 'single') return isSameISO(iso, singleValue.value)\n if (props.selection === 'multiple') return multipleValues.value.includes(iso)\n // In range selection, the two ends of the period count as selected; including the provisional\n // end shown during the preview.\n return isSameISO(iso, effectiveRange.value.start) || isSameISO(iso, effectiveRange.value.end)\n}\n/** Whether a day falls inside the selected period, both ends included. */\nfunction isInRange(iso: string): boolean {\n const { start, end } = effectiveRange.value\n return !!start && !!end && compareISO(iso, start) >= 0 && compareISO(iso, end) <= 0\n}\n\ntype DayCell = {\n iso: string\n day: number\n kind: 'empty' | 'static' | 'button'\n inMonth: boolean\n disabled: boolean\n selected: boolean\n /** Selected in the value itself, the preview left out: what `aria-selected` reports. */\n committed: boolean\n rangeStart: boolean\n rangeEnd: boolean\n inRange: boolean\n today: boolean\n events: DatePickerEvent[]\n /** The events drawn as dots under the number, three at most. */\n dots: DatePickerEvent[]\n /** The labels of its events, joined, for the day's accessible name. */\n eventText: string\n}\n\n/** The 42 squares of the month on display, rebuilt only when the MONTH changes. */\nconst grid = computed(() =>\n buildMonthGrid(viewYear.value, viewMonth0.value, resolvedFirstDay.value),\n)\n\nconst NO_EVENTS: DatePickerEvent[] = []\n\nconst days = computed<DayCell[]>(() =>\n grid.value.map((cell) => {\n const inMonth = cell.adjacent === null\n // Making the neighbouring days clickable implies showing them: a day nobody can\n // see cannot be clicked.\n const show = inMonth || props.showAdjacentDays || props.selectAdjacentDays\n const selectable = inMonth || props.selectAdjacentDays\n const disabled = !isDateAllowed(cell.iso, props.min, props.max, isDisabledDate.value)\n const kind: DayCell['kind'] = !show ? 'empty' : selectable ? 'button' : 'static'\n const events = eventsByDate.value.get(cell.iso) ?? NO_EVENTS\n return {\n iso: cell.iso,\n day: cell.day,\n kind,\n inMonth,\n disabled,\n selected: kind === 'button' && !disabled && isSelected(cell.iso),\n committed: kind === 'button' && !disabled && isCommitted(cell.iso),\n rangeStart: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.start),\n rangeEnd: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.end),\n inRange: props.selection === 'range' && isInRange(cell.iso),\n today: isSameISO(cell.iso, today.value),\n events,\n dots: events.length > 3 ? events.slice(0, 3) : events,\n eventText: events\n .map((ev) => ev.label)\n .filter(Boolean)\n .join(', '),\n }\n }),\n)\n\n/** What the `#day` slot receives for a square: the same object for both kinds of cell. */\nfunction daySlotProps(cell: DayCell): DatePickerDaySlotProps {\n return {\n iso: cell.iso,\n day: cell.day,\n inMonth: cell.inMonth,\n disabled: cell.disabled,\n selected: cell.selected,\n today: cell.today,\n inRange: cell.inRange,\n events: cell.events,\n }\n}\nconst weeks = computed(() => {\n const rows: DayCell[][] = []\n for (let i = 0; i < days.value.length; i += 7) rows.push(days.value.slice(i, i + 7))\n return rows\n})\n\nfunction monthHasSelectable(year: number, month0: number): boolean {\n const first = isoOf(year, month0, 1)\n const last = isoOf(year, month0, daysInMonth(year, month0))\n return (\n (!props.max || compareISO(first, props.max) <= 0) &&\n (!props.min || compareISO(last, props.min) >= 0)\n )\n}\n// Derived from the month on display, not from the focused day, so an arrow key moving the\n// focus inside the month does not recompute them.\nconst canPrevMonth = computed(() =>\n viewMonth0.value === 0\n ? monthHasSelectable(viewYear.value - 1, 11)\n : monthHasSelectable(viewYear.value, viewMonth0.value - 1),\n)\nconst canNextMonth = computed(() =>\n viewMonth0.value === 11\n ? monthHasSelectable(viewYear.value + 1, 0)\n : monthHasSelectable(viewYear.value, viewMonth0.value + 1),\n)\nconst canPrevYear = computed(\n () => !props.min || compareISO(isoOf(viewYear.value - 1, 11, 31), props.min) >= 0,\n)\nconst canNextYear = computed(\n () => !props.max || compareISO(isoOf(viewYear.value + 1, 0, 1), props.max) <= 0,\n)\n\n// @a11y\n// Moves the real DOM focus onto a day cell. The grid keeps exactly one cell in the\n// tab order, so navigating means focusing another one.\nconst dayId = (iso: string) => `${gridLabelId}-d-${iso}`\nfunction focusDay(iso: string, options?: FocusOptions) {\n nextTick(() => document.getElementById(dayId(iso))?.focus(options))\n}\n\nfunction goTo(iso: string, moveFocus = false) {\n // Every move through the calendar comes here, so one guard covers the arrows, the\n // month and year cells and the keyboard's own steps. Only `disabled` stops it:\n // `readonly` leaves the reader free to look around.\n if (props.disabled) return\n focusedISO.value = clampISO(iso, props.min, props.max)\n if (moveFocus && view.value === 'days') focusDay(focusedISO.value)\n}\nfunction stepMonth(delta: number) {\n goTo(addMonths(focusedISO.value, delta))\n}\nfunction stepYear(delta: number) {\n goTo(addMonths(focusedISO.value, delta * 12))\n}\n\n// @a11y @core\n// Changing view has to carry the focus onto the cell the new view\n// opens on. Without that move the focus would stay on a button the view has just\n// removed from the document, and the keyboard would have nowhere to go.\nfunction toggleView(target: 'months' | 'years') {\n const next = view.value === target ? 'days' : target\n view.value = next\n if (next === 'months') {\n focusedMonth.value = viewMonth0.value\n nextTick(() => monthCellEl(viewMonth0.value)?.focus())\n } else if (next === 'years') {\n focusedYear.value = viewYear.value\n nextTick(() => {\n const cell = yearCellEl(viewYear.value)\n // Called optionally because jsdom does not implement scrollIntoView (the same\n // guard as VTimeInput's list). Centring the year is a nicety; the focus call\n // below is not, so it must not be taken down with it.\n cell?.scrollIntoView?.({ block: 'center' })\n cell?.focus()\n })\n } else if (view.value === 'days') {\n focusDay(focusedISO.value)\n }\n}\n\nfunction selectDay(cell: DayCell) {\n // Navigation is deliberately not guarded by `readonly`: a calendar one may read is a calendar\n // one may leaf through.\n if (props.disabled || props.readonly) return\n if (cell.kind !== 'button' || cell.disabled) return\n focusedISO.value = cell.iso\n let next: DatePickerValue\n if (props.selection === 'single') {\n next = cell.iso\n } else if (props.selection === 'multiple') {\n next = toggleValue(multipleValues.value, cell.iso).sort(compareISO)\n } else {\n // Range selection reads three clicks: the first sets the start, the second the\n // end (reordered if it comes before the start), and the third starts a new\n // period.\n const r = rangeValue.value\n next = !r.start || r.end ? { start: cell.iso, end: null } : orderRange(r.start, cell.iso)\n }\n lastWritten = JSON.stringify(next)\n model.value = next\n // Emit what was just computed, never `model.value` read back. Under a parent `v-model`,\n // `defineModel` does not update its local copy on write; it waits for the parent to\n // re-render; so the read would hand `select` the PREVIOUS value.\n emit('select', next)\n}\n\n// @keyboard @a11y\n// The keyboard of the days view. The table turning a key into a step is pure and\n// lives in `./keyboard`; what stays here is the date that step is applied to, and\n// the focus move that follows.\nfunction onDaysKeydown(event: KeyboardEvent) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n const cell = days.value.find((c) => c.iso === focusedISO.value)\n if (cell) selectDay(cell)\n return\n }\n const d = parseISO(focusedISO.value)!\n // How far the focused day sits from the start of its week, which is exactly what\n // Home and End have to step back and forward by.\n const offset = (d.getDay() - resolvedFirstDay.value + 7) % 7\n const step = dayStep(event.key, event.shiftKey, offset, isRtl(event.currentTarget as Element))\n if (!step) return\n event.preventDefault()\n goTo(\n 'days' in step\n ? addDays(focusedISO.value, step.days)\n : addMonths(focusedISO.value, step.months),\n true,\n )\n}\n\n/**\n * Leaving the months or the years view for the days of the month chosen, keeping the day of the\n * month where the new month has one; the 31st becoming the 30th, say.\n */\nfunction chooseYearMonth(year: number, month0: number) {\n const day = Math.min(parseISO(focusedISO.value)!.getDate(), daysInMonth(year, month0))\n goTo(isoOf(year, month0, day))\n view.value = 'days'\n focusDay(focusedISO.value)\n}\n\n// @keyboard @a11y\n/**\n * The keyboard of the months and the years views, which differ only in what their cells\n * hold: Enter or Space chooses the focused cell, and the arrows walk the list of cells a row\n * or a column at a time, stopping at either end.\n */\nfunction onViewKeydown(\n event: KeyboardEvent,\n cells: readonly number[],\n focused: Ref<number>,\n cellEl: (value: number) => HTMLElement | null,\n choose: (value: number) => void,\n selectable: (value: number) => boolean = () => true,\n) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n choose(focused.value)\n return\n }\n const delta = gridDelta(event.key, isRtl(event.currentTarget as Element))\n if (delta === undefined) return\n event.preventDefault()\n // A cell the bounds rule out is a disabled button, which cannot take the focus: landing on it\n // would move the tab stop where the focus cannot follow. The walk goes on the same way round\n // to the next cell that can be chosen, and holds still when there is none.\n let next = clamp(cells.indexOf(focused.value) + delta, 0, cells.length - 1)\n while (!selectable(cells[next]!) && next + delta >= 0 && next + delta < cells.length)\n next += delta\n if (!selectable(cells[next]!)) return\n focused.value = cells[next]!\n cellEl(focused.value)?.focus()\n}\n\nconst MONTHS = Array.from({ length: 12 }, (_, i) => i)\nconst focusedMonth = ref(viewMonth0.value)\nconst monthCellEl = (i: number) =>\n document.getElementById(`${gridLabelId}-m-${i}`) as HTMLElement | null\nfunction monthSelectable(i: number) {\n return monthHasSelectable(viewYear.value, i)\n}\nfunction chooseMonth(i: number) {\n if (monthSelectable(i)) chooseYearMonth(viewYear.value, i)\n}\nconst onMonthsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, MONTHS, focusedMonth, monthCellEl, chooseMonth, monthSelectable)\n\n// @a11y\n/*\n * Both pickers are a `role=\"grid\"`, and a grid owns ROWS, not cells: a gridcell placed straight\n * under the grid fails aria-required-children and aria-required-parent at the same time. The\n * cells are therefore cut into rows of PICKER_COLUMNS, matching the `grid-template-columns` of\n * the stylesheet; the row element itself is `display: contents`, so the CSS grid never sees it.\n */\nconst chunk = <T>(list: T[]) =>\n Array.from({ length: Math.ceil(list.length / PICKER_COLUMNS) }, (_, r) =>\n list.slice(r * PICKER_COLUMNS, r * PICKER_COLUMNS + PICKER_COLUMNS),\n )\n\nconst monthRows = computed(() => chunk(monthLabels.value.map((name, i) => ({ name, i }))))\n\nconst yearRange = computed(() => {\n /*\n * `min` and `max` come straight from the consumer, and this is the only place where they are\n * turned into a Date instead of being compared as ISO text; `compareISO`, `isWithin` and\n * `clampISO` all tolerate a malformed bound. A value that is not a valid ISO date therefore\n * has to fall back to the open range here: asserting the parse would throw and take the whole\n * render down the moment the years view is opened.\n */\n const minY = parseISO(props.min)?.getFullYear() ?? viewYear.value - 100\n const maxY = parseISO(props.max)?.getFullYear() ?? viewYear.value + 100\n const list: number[] = []\n for (let y = minY; y <= maxY; y++) list.push(y)\n return list\n})\nconst yearRows = computed(() => chunk(yearRange.value))\nconst focusedYear = ref(viewYear.value)\nconst yearCellEl = (y: number) =>\n document.getElementById(`${gridLabelId}-y-${y}`) as HTMLElement | null\nconst chooseYear = (y: number) => chooseYearMonth(y, viewMonth0.value)\nconst onYearsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, yearRange.value, focusedYear, yearCellEl, chooseYear)\n\n// Only from the OUTSIDE. The picker's own writes change the leading value too: unticking the\n// earliest date of a list makes the next one lead, and following it would throw the reader into\n// another month and drop the focus on `<body>`, the day they were on having left the document.\nlet lastWritten: string | undefined\nwatch(\n () => [singleValue.value, rangeValue.value.start, multipleValues.value[0]],\n () => {\n if (lastWritten !== undefined && JSON.stringify(model.value) === lastWritten) return\n const primary = singleValue.value ?? rangeValue.value.start ?? multipleValues.value[0]\n if (primary && isValidISO(primary)) {\n const d = parseISO(primary)!\n if (d.getFullYear() !== viewYear.value || d.getMonth() !== viewMonth0.value) {\n focusedISO.value = primary\n }\n }\n },\n)\n\n// @a11y\n/**\n * Brings the focus into the grid, on the day the calendar is currently showing. This\n * is what VDateInput calls when it opens its panel.\n */\nfunction focus(options?: FocusOptions) {\n view.value = 'days'\n focusDay(focusedISO.value, options)\n}\n\n// @core\n/*\n * A panel's content stays MOUNTED while the panel is closed, so without this the months or\n * years view a reader left open is what the next opening shows; and a field that opens its\n * panel on focus never calls `focus()`, the one place that reset the view.\n */\nfunction reset() {\n view.value = 'days'\n hoverISO.value = null\n focusedISO.value = initialFocus()\n}\n\ndefineExpose({\n /** Brings the focus into the grid, onto the day the calendar is showing. */\n focus,\n /**\n * Returns to the days view, on the selected date or today, without moving the focus.\n * VDateInput calls it each time its panel opens and closes.\n */\n reset,\n})\n</script>\n\n<template>\n <div\n class=\"v-date-picker\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :data-view=\"view\"\n :data-selection=\"selection\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-readonly=\"readonly ? '' : undefined\"\n @pointerleave=\"hoverISO = null\"\n >\n <!-- The header: the month and the year, each between two chevrons that step it,\n and each opening its own picker view when clicked -->\n <div :key=\"`header-${renderEpoch}`\" class=\"v-date-picker-header\">\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevMonth\"\n @click=\"stepMonth(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'months'\"\n :aria-label=\"monthLabel\"\n @click=\"toggleView('months')\"\n >\n {{ monthLabels[viewMonth0] }}\n <VIcon\n :name=\"view === 'months' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canNextMonth\"\n @click=\"stepMonth(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousYear\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevYear\"\n @click=\"stepYear(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'years'\"\n @click=\"toggleView('years')\"\n >\n {{ viewYear }}\n <VIcon\n :name=\"view === 'years' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextYear\"\n size=\"sm\"\n :disabled=\"disabled || !canNextYear\"\n @click=\"stepYear(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n </div>\n\n <div\n v-show=\"view === 'days'\"\n :key=\"`days-${renderEpoch}`\"\n class=\"v-date-picker-grid\"\n role=\"grid\"\n :aria-label=\"gridLabel\"\n :aria-multiselectable=\"selection === 'multiple' ? 'true' : undefined\"\n @keydown=\"onDaysKeydown\"\n >\n <div class=\"v-date-picker-weekdays\" role=\"row\">\n <span\n v-for=\"(w, i) in weekdays\"\n :key=\"w\"\n class=\"v-date-picker-weekday\"\n role=\"columnheader\"\n :aria-label=\"weekdaysLong[i]\"\n >{{ w }}</span\n >\n </div>\n <div v-for=\"(week, wi) in weeks\" :key=\"wi\" class=\"v-date-picker-week\" role=\"row\">\n <div\n v-for=\"cell in week\"\n :key=\"cell.iso\"\n class=\"v-date-picker-cell\"\n role=\"gridcell\"\n :aria-selected=\"cell.kind === 'button' ? cell.committed : undefined\"\n :data-in-range=\"cell.inRange ? '' : undefined\"\n :data-range-start=\"cell.rangeStart ? '' : undefined\"\n :data-range-end=\"cell.rangeEnd ? '' : undefined\"\n >\n <button\n v-if=\"cell.kind === 'button'\"\n :id=\"dayId(cell.iso)\"\n type=\"button\"\n class=\"v-date-picker-day\"\n :tabindex=\"cell.iso === focusedISO ? 0 : -1\"\n :data-outside=\"!cell.inMonth ? '' : undefined\"\n :data-selected=\"cell.selected ? '' : undefined\"\n :data-today=\"cell.today ? '' : undefined\"\n :data-unavailable=\"cell.disabled ? '' : undefined\"\n :disabled=\"disabled\"\n :aria-disabled=\"cell.disabled || readonly ? 'true' : undefined\"\n :aria-current=\"cell.today ? 'date' : undefined\"\n @click=\"selectDay(cell)\"\n @pointerenter=\"hoverISO = cell.iso\"\n @focus=\"hoverISO = cell.iso\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n <!-- The dots are hidden from assistive technology, so what they stand for is\n spoken here, as part of the day's name. -->\n <span v-if=\"cell.eventText\" class=\"v-visually-hidden\">, {{ cell.eventText }}</span>\n <span v-if=\"cell.dots.length\" class=\"v-date-picker-dots\" aria-hidden=\"true\">\n <span\n v-for=\"(ev, ei) in cell.dots\"\n :key=\"ei\"\n class=\"v-date-picker-dot\"\n :style=\"ev.color ? { '--date-picker-dot-color': ev.color } : undefined\"\n />\n </span>\n </button>\n <!--\n A day of a neighbouring month that cannot be selected. It renders the very same slot\n as the clickable days: were it left with the bare number, custom content taking\n several lines would apply to this month's days only, and the numbers would stop\n lining up from one cell to the next.\n -->\n <span\n v-else-if=\"cell.kind === 'static'\"\n class=\"v-date-picker-day\"\n data-static\n :data-disabled=\"cell.disabled ? '' : undefined\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n </span>\n </div>\n </div>\n </div>\n\n <div\n v-if=\"view === 'months'\"\n class=\"v-date-picker-view\"\n role=\"grid\"\n :aria-label=\"m.datePicker.monthPicker\"\n @keydown=\"onMonthsKeydown\"\n >\n <div v-for=\"(row, r) in monthRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"{ name, i } in row\"\n :id=\"`${gridLabelId}-m-${i}`\"\n :key=\"i\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"i === focusedMonth ? 0 : -1\"\n :data-selected=\"i === viewMonth0 ? '' : undefined\"\n :aria-selected=\"i === viewMonth0 ? 'true' : undefined\"\n :aria-label=\"monthNamesLong[i]\"\n :disabled=\"disabled || !monthSelectable(i)\"\n @click=\"chooseMonth(i)\"\n >\n {{ name }}\n </button>\n </div>\n </div>\n\n <div\n v-if=\"view === 'years'\"\n class=\"v-date-picker-view\"\n role=\"grid\"\n :aria-label=\"m.datePicker.yearPicker\"\n @keydown=\"onYearsKeydown\"\n >\n <div v-for=\"(row, r) in yearRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"y in row\"\n :id=\"`${gridLabelId}-y-${y}`\"\n :key=\"y\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"y === focusedYear ? 0 : -1\"\n :data-selected=\"y === viewYear ? '' : undefined\"\n :aria-selected=\"y === viewYear ? 'true' : undefined\"\n :disabled=\"disabled\"\n @click=\"chooseYear(y)\"\n >\n {{ y }}\n </button>\n </div>\n </div>\n\n <div v-if=\"$slots.footer\" class=\"v-date-picker-footer\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-date-picker {\n /*\n * The consumer sets the size of the day disc through its token; the cell around it; the\n * hover area and the width of the column; grows to follow, and never falls below the size\n * the cell token sets.\n */\n --date-picker-cell: max(\n var(--vectis-control-size-date-picker-cell),\n calc(var(--vectis-control-size-date-picker-day) + var(--vectis-space-1))\n );\n display: inline-flex;\n flex-direction: column;\n gap: var(--vectis-space-2);\n padding: var(--vectis-space-3);\n font-family: var(--vectis-text-family);\n color: var(--vectis-color-text);\n }\n\n /*\n * The days grid then fills that width through its 1fr columns, and never goes below the seven\n * cells its own floor guarantees.\n */\n .v-date-picker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--vectis-space-2);\n }\n\n .v-date-picker-nav {\n display: flex;\n align-items: center;\n }\n\n /* A minimum width holds this button steady, so the chevrons on either side do not\n shift as the month or year label changes length. */\n /* Qualified by an attribute the button always renders: `.v-button` sets its own\n `font-weight` at (0,1,0), and a tie between the two sheets would leave the weight to\n whichever the consumer's bundler put last. */\n .v-date-picker-view-toggle[data-size] {\n min-inline-size: var(--vectis-control-size-date-picker-nav-min);\n font-weight: var(--vectis-font-weight-semibold);\n text-transform: capitalize;\n }\n\n /*\n * The days grid can never be narrower than seven cells. Above that floor it takes whatever\n * width the calendar has; set by the header; and the 1fr columns share it out equally.\n */\n .v-date-picker-grid {\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n\n .v-date-picker-weekdays,\n .v-date-picker-week {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n }\n\n .v-date-picker-weekday {\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--vectis-control-height-sm);\n /* A column micro-header, which takes the overline type role. The casing stays\n `capitalize`, the calendar convention, rather than the full capitals the\n VTypography overline variant would apply. */\n font-size: var(--vectis-text-overline-size);\n font-weight: var(--vectis-text-overline-weight);\n letter-spacing: var(--vectis-text-overline-tracking);\n color: var(--vectis-color-text-muted);\n text-transform: capitalize;\n }\n\n .v-date-picker-cell {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--date-picker-cell);\n }\n\n /*\n * The two cap rules below only shape a pseudo-element that `[data-in-range]` has already\n * created, so they depend on `isInRange` counting both ends of the period as inside it. Make\n * it exclusive and there is no `::before` to cap: both rounded ends of every range vanish,\n * leaving a band that stops square one cell short at each side, with nothing in the console.\n */\n .v-date-picker-cell[data-in-range]::before {\n content: '';\n position: absolute;\n inset-block: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n inset-inline: 0;\n background: var(--vectis-color-accent-surface);\n z-index: 0;\n }\n .v-date-picker-cell[data-range-start]::before {\n inset-inline-start: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-start-radius: var(--vectis-radius-pill);\n border-end-start-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-end]::before {\n inset-inline-end: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-end-radius: var(--vectis-radius-pill);\n border-end-end-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-start][data-range-end]::before {\n content: none;\n }\n\n .v-date-picker-day {\n position: relative;\n z-index: 1;\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: var(--vectis-control-size-date-picker-day);\n block-size: var(--vectis-control-size-date-picker-day);\n padding: 0;\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n cursor: pointer;\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* Hover belongs to the days one can actually click: not the disabled ones, not the\n already selected ones, and not the neighbouring days rendered as plain spans. */\n .v-date-picker-day:hover:not(:disabled):not([aria-disabled='true']):not([data-selected]):not(\n [data-static]\n ) {\n background: var(--vectis-color-surface-muted);\n }\n\n .v-date-picker-day[data-outside] {\n color: var(--vectis-color-text-subtle);\n }\n\n /*\n * The semibold in the two rules below marks a state; today, and the selection; and is not a\n * typographic role, which is why it reads a font token directly.\n */\n .v-date-picker-day[data-today]:not([data-selected]) {\n box-shadow: inset 0 0 0 1px var(--vectis-color-accent-border);\n color: var(--vectis-color-accent-text);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n .v-date-picker-day[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n /*\n * It hangs on its own attribute rather than on `aria-disabled`, which a read-only calendar\n * also carries on every day: nothing can be chosen there, but the dates themselves are\n * perfectly available and striking them all out would say the opposite. The hover rule below\n * still reads `aria-disabled`, so neither highlights.\n */\n .v-date-picker-day[data-unavailable] {\n color: var(--vectis-color-text-subtle);\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker[data-readonly] .v-date-picker-day:not([data-unavailable]) {\n cursor: default;\n }\n\n /* A disabled calendar greys out through the colour tokens and never through opacity,\n the selection included: left in the accent colour it would go on looking live. */\n .v-date-picker-day:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n\n .v-date-picker[data-disabled] .v-date-picker-day[data-selected] {\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n .v-date-picker-day[data-static] {\n color: var(--vectis-color-text-subtle);\n cursor: default;\n }\n\n /* A neighbouring day that falls outside the bounds, or is disabled, is struck\n through like any other unavailable date. */\n .v-date-picker-day[data-static][data-disabled] {\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker-day:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-date-picker-day-num {\n line-height: var(--vectis-text-control-leading);\n }\n\n .v-date-picker-dots {\n position: absolute;\n /* Half a dot, below them and between them: the spacing scale has no step that small. */\n inset-block-end: calc(var(--vectis-control-size-date-picker-dot) / 2);\n display: flex;\n gap: calc(var(--vectis-control-size-date-picker-dot) / 2);\n }\n .v-date-picker-dot {\n inline-size: var(--vectis-control-size-date-picker-dot);\n block-size: var(--vectis-control-size-date-picker-dot);\n border-radius: var(--vectis-radius-pill);\n /* A longhand: an event's colour can come from untrusted data, and must not load a `url()`. */\n background-color: var(--date-picker-dot-color, var(--vectis-color-accent));\n }\n .v-date-picker-day[data-selected] .v-date-picker-dot {\n background: var(--vectis-color-text-on-accent);\n }\n\n /* The months and years views. They fill the calendar's width exactly like the days\n grid does: stretched by the flex column, then shared out by 1fr columns. */\n .v-date-picker-view {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: var(--vectis-space-1);\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n /* The rows ARIA requires inside a grid, made invisible to the layout: with\n `display: contents` the cells remain direct grid items of `.v-date-picker-view`,\n so the columns line up as if the rows were not there. */\n .v-date-picker-view-row {\n display: contents;\n }\n\n .v-date-picker[data-view='years'] .v-date-picker-view {\n max-block-size: calc(6 * var(--date-picker-cell));\n overflow-y: auto;\n }\n\n .v-date-picker-view-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n block-size: var(--vectis-control-height-lg);\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n text-transform: capitalize;\n cursor: pointer;\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n .v-date-picker-view-cell:hover:not(:disabled):not([data-selected]) {\n background: var(--vectis-color-surface-muted);\n }\n .v-date-picker-view-cell[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n .v-date-picker-view-cell:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n .v-date-picker-view-cell:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: calc(-1 * var(--vectis-focus-ring-width));\n }\n\n .v-date-picker-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--vectis-space-2);\n padding-block-start: var(--vectis-space-2);\n border-block-start: 1px solid var(--vectis-color-border);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-date-picker-day,\n .v-date-picker-view-cell {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":""}
@@ -451,7 +451,8 @@ var je = [
451
451
  }, null, 4))), 128))])) : v("", !0)
452
452
  ], 40, Re)) : t.kind === "static" ? (T(), y("span", {
453
453
  key: 1,
454
- class: "v-date-picker-day v-date-picker-day--static",
454
+ class: "v-date-picker-day",
455
+ "data-static": "",
455
456
  "data-disabled": t.disabled ? "" : void 0
456
457
  }, [O(e.$slots, "day", Se({ ref_for: !0 }, mt(t)), () => [b("span", Ue, k(t.day), 1)])], 8, He)) : v("", !0)], 8, Le))), 128))]))), 128))], 40, Pe)), [[De, H.value === "days"]]),
457
458
  H.value === "months" ? (T(), y("div", {
@@ -479,7 +480,7 @@ var je = [
479
480
  }, k(e), 9, Ge))), 128))]))), 128))], 40, We)) : v("", !0),
480
481
  H.value === "years" ? (T(), y("div", {
481
482
  key: 1,
482
- class: "v-date-picker-view v-date-picker-view--years",
483
+ class: "v-date-picker-view",
483
484
  role: "grid",
484
485
  "aria-label": A(F).datePicker.yearPicker,
485
486
  onKeydown: Bt
@@ -1 +1 @@
1
- {"version":3,"file":"VDatePicker.vue_vue_type_script_setup_true_lang.js","names":["$slots","_useModel","_openBlock","_createElementBlock","_unref","_createElementVNode","_createVNode","VIconButton","_withCtx","VIcon","chevronLeftIcon","VButton","_createTextVNode","_toDisplayString","arrowDropUpIcon","arrowDropDownIcon","chevronRightIcon","_withDirectives","_Fragment","_renderList","_renderSlot","_mergeProps","_createCommentVNode","_normalizeStyle","_vShow","VIcon_default","VButton_default","VIconButton_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","VDatePicker_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__expose","__emit","props","__props","model","useModel","emit","gridLabelId","useId","m","useMessages","ariaLabel","useAriaLabel","resolvedLocale","useResolvedLocale","isDev","inject","hostWarnsKey","watchEffect","compareISO","resolvedFirstDay","computed","firstDayOfWeekFor","weekdays","weekdayNames","weekdaysLong","monthLabels","monthNamesCompact","monthNamesLong","monthNames","singleValue","isValidISO","rangeValue","multipleValues","initialFocus","start","clampISO","formatISO","readTheClock","focusedISO","ref","view","viewYear","parseISO","viewMonth0","monthLabel","monthName","gridLabel","monthYearName","today","renderEpoch","isDisabledDate","resolveMatcher","eventsByDate","map","ev","list","hoverISO","orderRange","a","b","effectiveRange","r","preview","isCommitted","isSameISO","iso","isSelected","isInRange","end","grid","buildMonthGrid","NO_EVENTS","days","inMonth","cell","show","selectable","disabled","isDateAllowed","kind","events","daySlotProps","weeks","rows","i","monthHasSelectable","first","isoOf","year","month0","last","daysInMonth","canPrevMonth","canNextMonth","canPrevYear","canNextYear","dayId","focusDay","options","goTo","moveFocus","stepMonth","addMonths","delta","stepYear","toggleView","next","target","nextTick","monthCellEl","yearCellEl","selectDay","toggleValue","onDaysKeydown","event","c","offset","step","dayStep","isRtl","addDays","chooseYearMonth","day","onViewKeydown","choose","focused","gridDelta","clamp","cells","cellEl","MONTHS","focusedMonth","monthSelectable","chooseMonth","onMonthsKeydown","chunk","monthRows","yearRange","minY","maxY","y","yearRows","focusedYear","chooseYear","onYearsKeydown","lastWritten","primary","d","focus","reset","openBlock","createElementBlock","unref","_cache","createElementVNode","createVNode","withCtx","chevron_left","createTextVNode","toDisplayString","arrow_drop_up","arrow_drop_down","chevron_right","withDirectives","Fragment","renderList","w","wi","week","renderSlot","_ctx","mergeProps","createCommentVNode","ei","normalizeStyle","vShow","row","name"],"sources":["../../../src/components/VDatePicker/VDatePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * Implement roving grid focus and date selection because the platform has no composable,\n * stylable date grid. VDateInput reuses this calendar logic.\n */\n\nimport { computed, inject, nextTick, onMounted, ref, useId, watch, watchEffect } from 'vue'\nimport type { Ref } from 'vue'\n\nimport VButton from '../VButton/VButton.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { arrow_drop_down as arrowDropDownIcon } from '../VIcon/icons/arrow_drop_down'\nimport { arrow_drop_up as arrowDropUpIcon } from '../VIcon/icons/arrow_drop_up'\nimport { chevron_left as chevronLeftIcon } from '../VIcon/icons/chevron_left'\nimport { chevron_right as chevronRightIcon } from '../VIcon/icons/chevron_right'\nimport VIconButton from '../VIconButton/VIconButton.vue'\nimport {\n addDays,\n addMonths,\n buildMonthGrid,\n clampISO,\n compareISO,\n daysInMonth,\n firstDayOfWeekFor,\n formatISO,\n isDateAllowed,\n isoOf,\n isSameISO,\n isValidISO,\n parseISO,\n weekdayNames,\n} from '../../utils/date'\nimport { monthName, monthNames, monthNamesCompact, monthYearName } from './names'\n\nimport { PICKER_COLUMNS, dayStep, gridDelta } from './keyboard'\n\nimport { toggleValue } from '../../utils/array'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { hostWarnsKey } from '../../utils/hostWarns'\nimport { resolveMatcher } from '../../utils/matcher'\nimport { clamp } from '../../utils/number'\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useMessages, useResolvedLocale } from '../../i18n/state'\n\n/** What a click selects: one date, a period between two, or a list of dates. */\nexport type DatePickerSelection = 'single' | 'range' | 'multiple'\n\n/**\n * A period between two dates, the value of a `range` selection. Either bound may be\n * null: between the first and the second click, a range has a start and no end yet.\n */\nexport interface DatePickerRange {\n /** The first day of the period, as an ISO `YYYY-MM-DD` string. */\n start: string | null\n /** The last day of the period, as an ISO `YYYY-MM-DD` string. */\n end: string | null\n}\n\n/** Something happening on a given day, shown as a coloured dot under its number. */\nexport interface DatePickerEvent {\n /** The day it falls on, as an ISO `YYYY-MM-DD` string. */\n date: string\n /** The colour of the dot, as any CSS colour. It is the accent colour by default. */\n color?: string\n /** A description of the event, spoken as part of the day's accessible name. */\n label?: string\n}\n\n/**\n * Which dates cannot be selected, given either as a list of ISO strings or as a\n * function answering that question for a date.\n */\nexport type DatePickerMatcher = string[] | ((iso: string) => boolean)\n\n/** The shape of the v-model, which follows whichever `selection` is in use. */\nexport type DatePickerValue = string | null | DatePickerRange | string[]\n\n/** Everything the `#day` slot is told about the day it draws. */\nexport interface DatePickerDaySlotProps {\n /** The day, as an ISO `YYYY-MM-DD` string. */\n iso: string\n /** The day of the month. */\n day: number\n /** Whether it belongs to the month on display rather than to a neighbouring one. */\n inMonth: boolean\n /** Whether it cannot be chosen: outside the bounds, or excluded by `disabledDates`. */\n disabled: boolean\n /** Whether it is selected. */\n selected: boolean\n /** Whether it is today. */\n today: boolean\n /** Whether it falls inside the selected period, both ends included. */\n inRange: boolean\n /** The events that fall on it. */\n events: DatePickerEvent[]\n}\n\ninterface DatePickerProps {\n /**\n * What the reader is picking: a single date, a period between two dates, or any\n * number of separate dates. It determines the shape of the v-model.\n */\n selection?: DatePickerSelection\n /**\n * A BCP 47 locale, which decides the month and day names and the first day of the\n * week. It TAKES PRECEDENCE over the design system's global locale (`setLocale`)\n * and falls back to it, which is why it has no literal default here: `undefined`\n * has to stay recognizable for the global locale to have its chance.\n */\n locale?: string\n /**\n * Forces the day the weeks start on (0 for Sunday through 6 for Saturday). Left\n * out, the locale decides.\n */\n firstDayOfWeek?: number\n /**\n * The earliest selectable date, as an ISO string. Neither navigation nor selection\n * goes back beyond it.\n */\n min?: string\n /**\n * The latest selectable date, as an ISO string. Neither navigation nor selection\n * goes past it.\n */\n max?: string\n /**\n * Dates that cannot be chosen, given as a list of ISO strings or as a function.\n * They stay visible, struck through, and can still be reached with the keyboard.\n */\n disabledDates?: DatePickerMatcher\n /**\n * Fills the empty corners of the grid with the greyed days of the neighbouring months. It is\n * off by default.\n */\n showAdjacentDays?: boolean\n /**\n * Lets those neighbouring days be clicked, which moves the calendar to their month.\n * A clickable day has to be visible, so this implies showing them.\n */\n selectAdjacentDays?: boolean\n /** The events to mark, as up to three coloured dots under the day they fall on. */\n events?: DatePickerEvent[]\n /**\n * Makes the whole calendar unusable: no date can be chosen, no month reached, and\n * everything greys out through the colour tokens.\n */\n disabled?: boolean\n /**\n * Shows what is selected without letting it be changed. The calendar can still be read and\n * walked through (another month, another year), which separates it from `disabled`.\n */\n readonly?: boolean\n /**\n * The accessible name of the whole picker, its header and its grid together. It falls back to\n * the dictionary, and a consumer `aria-label` wins.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<DatePickerProps>(), {\n selection: 'single',\n locale: undefined,\n firstDayOfWeek: undefined,\n min: undefined,\n max: undefined,\n disabledDates: undefined,\n showAdjacentDays: false,\n selectAdjacentDays: false,\n events: undefined,\n disabled: false,\n readonly: false,\n label: undefined,\n})\n\n/**\n * What is selected, and its shape follows `selection`: an ISO `YYYY-MM-DD` string for `single`,\n * a `{ start, end }` pair for `range`, an array of strings for `multiple`.\n */\nconst model = defineModel<DatePickerValue>({ default: null })\n\nconst emit = defineEmits<{\n /**\n * Emitted every time a date is chosen, carrying the complete value as it now\n * stands. VDateInput listens to it to close its panel on a single selection.\n */\n select: [value: DatePickerValue]\n}>()\n\ndefineSlots<{\n /**\n * Replaces the content of a day cell, to show a price or an availability under the\n * number for instance. It receives everything known about that day, including\n * whether it belongs to the displayed month.\n */\n day?(props: DatePickerDaySlotProps): unknown\n /** The strip under the grid, for actions such as Close or Save, or for preset dates. */\n footer?(): unknown\n}>()\n\nconst gridLabelId = useId()\n\n// The navigation labels have no prop of their own: the dictionary is the single place to change\n// them, globally or per language; see `src/i18n/`.\nconst m = useMessages()\n// @a11y\n// A roleless box cannot carry an accessible name (axe: aria-prohibited-attr),\n// so the root is a named group: the VCarousel viewport arrangement.\nconst ariaLabel = useAriaLabel(() => props.label ?? m.value.datePicker.label)\nconst resolvedLocale = useResolvedLocale(() => props.locale)\n\n// @devwarn\nif (isDev && !inject(hostWarnsKey, false)) {\n watchEffect(() => {\n if (props.min && props.max && compareISO(props.min, props.max) > 0)\n console.warn(\n `[VDatePicker] min \"${props.min}\" falls after max \"${props.max}\", so no date can be chosen.`,\n )\n })\n}\n\nconst resolvedFirstDay = computed(\n () => props.firstDayOfWeek ?? firstDayOfWeekFor(resolvedLocale.value),\n)\nconst weekdays = computed(() => weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'short'))\nconst weekdaysLong = computed(() =>\n weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'long'),\n)\nconst monthLabels = computed(() => monthNamesCompact(resolvedLocale.value))\n/** The full names the compact cells are spoken with: \"Jan.\" is not a word to hear. */\nconst monthNamesLong = computed(() => monthNames(resolvedLocale.value))\n\nconst singleValue = computed(() =>\n props.selection === 'single' && typeof model.value === 'string' && isValidISO(model.value)\n ? model.value\n : null,\n)\nconst rangeValue = computed<DatePickerRange>(() => {\n if (\n props.selection === 'range' &&\n model.value &&\n typeof model.value === 'object' &&\n !Array.isArray(model.value)\n ) {\n return model.value as DatePickerRange\n }\n return { start: null, end: null }\n})\nconst multipleValues = computed<string[]>(() =>\n props.selection === 'multiple' && Array.isArray(model.value) ? model.value : [],\n)\n\n// A range start or a list entry is validated here, the way the single value is validated\n// upstream: both arrive as the consumer wrote them, and the month arrows assert that the focused\n// date parses, so a malformed one (`{ start: 'foo' }`) must never become it.\nfunction initialFocus(): string {\n if (singleValue.value) return singleValue.value\n const start = rangeValue.value.start\n if (start && isValidISO(start)) return start\n const listed = multipleValues.value.find(isValidISO)\n if (listed) return listed\n readTheClock = true\n return clampISO(formatISO(new Date()), props.min, props.max)\n}\n/** Whether the month on display was read from the clock at setup: see `renderEpoch`. */\nlet readTheClock = false\nconst focusedISO = ref(initialFocus())\nconst view = ref<'days' | 'months' | 'years'>('days')\n\nconst viewYear = computed(\n () => parseISO(focusedISO.value)?.getFullYear() ?? new Date().getFullYear(),\n)\nconst viewMonth0 = computed(() => parseISO(focusedISO.value)?.getMonth() ?? 0)\nconst monthLabel = computed(() => monthName(resolvedLocale.value, viewMonth0.value))\nconst gridLabel = computed(() =>\n monthYearName(resolvedLocale.value, viewYear.value, viewMonth0.value),\n)\n\n// @ssr\n// Today's date is only read once the component is mounted, hence on the client: the\n// server has no way to know it, and rendering it during setup would make the two\n// markups differ and break hydration.\nconst today = ref<string | null>(null)\n\n// @ssr\n/*\n * With nothing selected, the month on display is read from the clock at setup, on the server\n * and again in the browser, and the two can disagree: a page prerendered in September and\n * opened in October, or a server a timezone behind its visitor on the last evening of a month.\n * Hydration patches the text but keeps the server's attributes, which would leave the month\n * button's accessible name and the day ids `focusDay` looks up on the server's month: bumping\n * the epoch re-renders the header and the grid once mounted.\n */\nconst renderEpoch = ref(0)\nonMounted(() => {\n today.value = formatISO(new Date())\n if (readTheClock) renderEpoch.value++\n})\n\nconst isDisabledDate = computed(() => resolveMatcher(props.disabledDates))\n\nconst eventsByDate = computed(() => {\n const map = new Map<string, DatePickerEvent[]>()\n for (const ev of props.events ?? []) {\n const list = map.get(ev.date) ?? []\n list.push(ev)\n map.set(ev.date, list)\n }\n return map\n})\n\nconst hoverISO = ref<string | null>(null)\nfunction orderRange(a: string, b: string): DatePickerRange {\n return compareISO(a, b) <= 0 ? { start: a, end: b } : { start: b, end: a }\n}\nconst effectiveRange = computed<DatePickerRange>(() => {\n if (props.selection !== 'range') return { start: null, end: null }\n const r = rangeValue.value\n if (r.start && r.end) return orderRange(r.start, r.end)\n // A start is set but the end is still pending: the range is previewed up to\n // whichever day the pointer or the focus is currently on.\n const preview = hoverISO.value ?? focusedISO.value\n if (r.start && preview) return orderRange(r.start, preview)\n return { start: r.start, end: r.end }\n})\n\n/**\n * Whether a day is part of the COMMITTED value, which `aria-selected` says: the end a range\n * preview is drawing is not selected yet, and announcing every day the focus walks over as\n * \"selected\" would say so.\n */\nfunction isCommitted(iso: string): boolean {\n if (props.selection !== 'range') return isSelected(iso)\n return isSameISO(iso, rangeValue.value.start) || isSameISO(iso, rangeValue.value.end)\n}\n\nfunction isSelected(iso: string): boolean {\n if (props.selection === 'single') return isSameISO(iso, singleValue.value)\n if (props.selection === 'multiple') return multipleValues.value.includes(iso)\n // In range selection, the two ends of the period count as selected; including the provisional\n // end shown during the preview.\n return isSameISO(iso, effectiveRange.value.start) || isSameISO(iso, effectiveRange.value.end)\n}\n/** Whether a day falls inside the selected period, both ends included. */\nfunction isInRange(iso: string): boolean {\n const { start, end } = effectiveRange.value\n return !!start && !!end && compareISO(iso, start) >= 0 && compareISO(iso, end) <= 0\n}\n\ntype DayCell = {\n iso: string\n day: number\n kind: 'empty' | 'static' | 'button'\n inMonth: boolean\n disabled: boolean\n selected: boolean\n /** Selected in the value itself, the preview left out: what `aria-selected` reports. */\n committed: boolean\n rangeStart: boolean\n rangeEnd: boolean\n inRange: boolean\n today: boolean\n events: DatePickerEvent[]\n /** The events drawn as dots under the number, three at most. */\n dots: DatePickerEvent[]\n /** The labels of its events, joined, for the day's accessible name. */\n eventText: string\n}\n\n/** The 42 squares of the month on display, rebuilt only when the MONTH changes. */\nconst grid = computed(() =>\n buildMonthGrid(viewYear.value, viewMonth0.value, resolvedFirstDay.value),\n)\n\nconst NO_EVENTS: DatePickerEvent[] = []\n\nconst days = computed<DayCell[]>(() =>\n grid.value.map((cell) => {\n const inMonth = cell.adjacent === null\n // Making the neighbouring days clickable implies showing them: a day nobody can\n // see cannot be clicked.\n const show = inMonth || props.showAdjacentDays || props.selectAdjacentDays\n const selectable = inMonth || props.selectAdjacentDays\n const disabled = !isDateAllowed(cell.iso, props.min, props.max, isDisabledDate.value)\n const kind: DayCell['kind'] = !show ? 'empty' : selectable ? 'button' : 'static'\n const events = eventsByDate.value.get(cell.iso) ?? NO_EVENTS\n return {\n iso: cell.iso,\n day: cell.day,\n kind,\n inMonth,\n disabled,\n selected: kind === 'button' && !disabled && isSelected(cell.iso),\n committed: kind === 'button' && !disabled && isCommitted(cell.iso),\n rangeStart: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.start),\n rangeEnd: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.end),\n inRange: props.selection === 'range' && isInRange(cell.iso),\n today: isSameISO(cell.iso, today.value),\n events,\n dots: events.length > 3 ? events.slice(0, 3) : events,\n eventText: events\n .map((ev) => ev.label)\n .filter(Boolean)\n .join(', '),\n }\n }),\n)\n\n/** What the `#day` slot receives for a square: the same object for both kinds of cell. */\nfunction daySlotProps(cell: DayCell): DatePickerDaySlotProps {\n return {\n iso: cell.iso,\n day: cell.day,\n inMonth: cell.inMonth,\n disabled: cell.disabled,\n selected: cell.selected,\n today: cell.today,\n inRange: cell.inRange,\n events: cell.events,\n }\n}\nconst weeks = computed(() => {\n const rows: DayCell[][] = []\n for (let i = 0; i < days.value.length; i += 7) rows.push(days.value.slice(i, i + 7))\n return rows\n})\n\nfunction monthHasSelectable(year: number, month0: number): boolean {\n const first = isoOf(year, month0, 1)\n const last = isoOf(year, month0, daysInMonth(year, month0))\n return (\n (!props.max || compareISO(first, props.max) <= 0) &&\n (!props.min || compareISO(last, props.min) >= 0)\n )\n}\n// Derived from the month on display, not from the focused day, so an arrow key moving the\n// focus inside the month does not recompute them.\nconst canPrevMonth = computed(() =>\n viewMonth0.value === 0\n ? monthHasSelectable(viewYear.value - 1, 11)\n : monthHasSelectable(viewYear.value, viewMonth0.value - 1),\n)\nconst canNextMonth = computed(() =>\n viewMonth0.value === 11\n ? monthHasSelectable(viewYear.value + 1, 0)\n : monthHasSelectable(viewYear.value, viewMonth0.value + 1),\n)\nconst canPrevYear = computed(\n () => !props.min || compareISO(isoOf(viewYear.value - 1, 11, 31), props.min) >= 0,\n)\nconst canNextYear = computed(\n () => !props.max || compareISO(isoOf(viewYear.value + 1, 0, 1), props.max) <= 0,\n)\n\n// @a11y\n// Moves the real DOM focus onto a day cell. The grid keeps exactly one cell in the\n// tab order, so navigating means focusing another one.\nconst dayId = (iso: string) => `${gridLabelId}-d-${iso}`\nfunction focusDay(iso: string, options?: FocusOptions) {\n nextTick(() => document.getElementById(dayId(iso))?.focus(options))\n}\n\nfunction goTo(iso: string, moveFocus = false) {\n // Every move through the calendar comes here, so one guard covers the arrows, the\n // month and year cells and the keyboard's own steps. Only `disabled` stops it:\n // `readonly` leaves the reader free to look around.\n if (props.disabled) return\n focusedISO.value = clampISO(iso, props.min, props.max)\n if (moveFocus && view.value === 'days') focusDay(focusedISO.value)\n}\nfunction stepMonth(delta: number) {\n goTo(addMonths(focusedISO.value, delta))\n}\nfunction stepYear(delta: number) {\n goTo(addMonths(focusedISO.value, delta * 12))\n}\n\n// @a11y @core\n// Changing view has to carry the focus onto the cell the new view\n// opens on. Without that move the focus would stay on a button the view has just\n// removed from the document, and the keyboard would have nowhere to go.\nfunction toggleView(target: 'months' | 'years') {\n const next = view.value === target ? 'days' : target\n view.value = next\n if (next === 'months') {\n focusedMonth.value = viewMonth0.value\n nextTick(() => monthCellEl(viewMonth0.value)?.focus())\n } else if (next === 'years') {\n focusedYear.value = viewYear.value\n nextTick(() => {\n const cell = yearCellEl(viewYear.value)\n // Called optionally because jsdom does not implement scrollIntoView (the same\n // guard as VTimeInput's list). Centring the year is a nicety; the focus call\n // below is not, so it must not be taken down with it.\n cell?.scrollIntoView?.({ block: 'center' })\n cell?.focus()\n })\n } else if (view.value === 'days') {\n focusDay(focusedISO.value)\n }\n}\n\nfunction selectDay(cell: DayCell) {\n // Navigation is deliberately not guarded by `readonly`: a calendar one may read is a calendar\n // one may leaf through.\n if (props.disabled || props.readonly) return\n if (cell.kind !== 'button' || cell.disabled) return\n focusedISO.value = cell.iso\n let next: DatePickerValue\n if (props.selection === 'single') {\n next = cell.iso\n } else if (props.selection === 'multiple') {\n next = toggleValue(multipleValues.value, cell.iso).sort(compareISO)\n } else {\n // Range selection reads three clicks: the first sets the start, the second the\n // end (reordered if it comes before the start), and the third starts a new\n // period.\n const r = rangeValue.value\n next = !r.start || r.end ? { start: cell.iso, end: null } : orderRange(r.start, cell.iso)\n }\n lastWritten = JSON.stringify(next)\n model.value = next\n // Emit what was just computed, never `model.value` read back. Under a parent `v-model`,\n // `defineModel` does not update its local copy on write; it waits for the parent to\n // re-render; so the read would hand `select` the PREVIOUS value.\n emit('select', next)\n}\n\n// @keyboard @a11y\n// The keyboard of the days view. The table turning a key into a step is pure and\n// lives in `./keyboard`; what stays here is the date that step is applied to, and\n// the focus move that follows.\nfunction onDaysKeydown(event: KeyboardEvent) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n const cell = days.value.find((c) => c.iso === focusedISO.value)\n if (cell) selectDay(cell)\n return\n }\n const d = parseISO(focusedISO.value)!\n // How far the focused day sits from the start of its week, which is exactly what\n // Home and End have to step back and forward by.\n const offset = (d.getDay() - resolvedFirstDay.value + 7) % 7\n const step = dayStep(event.key, event.shiftKey, offset, isRtl(event.currentTarget as Element))\n if (!step) return\n event.preventDefault()\n goTo(\n 'days' in step\n ? addDays(focusedISO.value, step.days)\n : addMonths(focusedISO.value, step.months),\n true,\n )\n}\n\n/**\n * Leaving the months or the years view for the days of the month chosen, keeping the day of the\n * month where the new month has one; the 31st becoming the 30th, say.\n */\nfunction chooseYearMonth(year: number, month0: number) {\n const day = Math.min(parseISO(focusedISO.value)!.getDate(), daysInMonth(year, month0))\n goTo(isoOf(year, month0, day))\n view.value = 'days'\n focusDay(focusedISO.value)\n}\n\n// @keyboard @a11y\n/**\n * The keyboard of the months and the years views, which differ only in what their cells\n * hold: Enter or Space chooses the focused cell, and the arrows walk the list of cells a row\n * or a column at a time, stopping at either end.\n */\nfunction onViewKeydown(\n event: KeyboardEvent,\n cells: readonly number[],\n focused: Ref<number>,\n cellEl: (value: number) => HTMLElement | null,\n choose: (value: number) => void,\n selectable: (value: number) => boolean = () => true,\n) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n choose(focused.value)\n return\n }\n const delta = gridDelta(event.key, isRtl(event.currentTarget as Element))\n if (delta === undefined) return\n event.preventDefault()\n // A cell the bounds rule out is a disabled button, which cannot take the focus: landing on it\n // would move the tab stop where the focus cannot follow. The walk goes on the same way round\n // to the next cell that can be chosen, and holds still when there is none.\n let next = clamp(cells.indexOf(focused.value) + delta, 0, cells.length - 1)\n while (!selectable(cells[next]!) && next + delta >= 0 && next + delta < cells.length)\n next += delta\n if (!selectable(cells[next]!)) return\n focused.value = cells[next]!\n cellEl(focused.value)?.focus()\n}\n\nconst MONTHS = Array.from({ length: 12 }, (_, i) => i)\nconst focusedMonth = ref(viewMonth0.value)\nconst monthCellEl = (i: number) =>\n document.getElementById(`${gridLabelId}-m-${i}`) as HTMLElement | null\nfunction monthSelectable(i: number) {\n return monthHasSelectable(viewYear.value, i)\n}\nfunction chooseMonth(i: number) {\n if (monthSelectable(i)) chooseYearMonth(viewYear.value, i)\n}\nconst onMonthsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, MONTHS, focusedMonth, monthCellEl, chooseMonth, monthSelectable)\n\n// @a11y\n/*\n * Both pickers are a `role=\"grid\"`, and a grid owns ROWS, not cells: a gridcell placed straight\n * under the grid fails aria-required-children and aria-required-parent at the same time. The\n * cells are therefore cut into rows of PICKER_COLUMNS, matching the `grid-template-columns` of\n * the stylesheet; the row element itself is `display: contents`, so the CSS grid never sees it.\n */\nconst chunk = <T>(list: T[]) =>\n Array.from({ length: Math.ceil(list.length / PICKER_COLUMNS) }, (_, r) =>\n list.slice(r * PICKER_COLUMNS, r * PICKER_COLUMNS + PICKER_COLUMNS),\n )\n\nconst monthRows = computed(() => chunk(monthLabels.value.map((name, i) => ({ name, i }))))\n\nconst yearRange = computed(() => {\n /*\n * `min` and `max` come straight from the consumer, and this is the only place where they are\n * turned into a Date instead of being compared as ISO text; `compareISO`, `isWithin` and\n * `clampISO` all tolerate a malformed bound. A value that is not a valid ISO date therefore\n * has to fall back to the open range here: asserting the parse would throw and take the whole\n * render down the moment the years view is opened.\n */\n const minY = parseISO(props.min)?.getFullYear() ?? viewYear.value - 100\n const maxY = parseISO(props.max)?.getFullYear() ?? viewYear.value + 100\n const list: number[] = []\n for (let y = minY; y <= maxY; y++) list.push(y)\n return list\n})\nconst yearRows = computed(() => chunk(yearRange.value))\nconst focusedYear = ref(viewYear.value)\nconst yearCellEl = (y: number) =>\n document.getElementById(`${gridLabelId}-y-${y}`) as HTMLElement | null\nconst chooseYear = (y: number) => chooseYearMonth(y, viewMonth0.value)\nconst onYearsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, yearRange.value, focusedYear, yearCellEl, chooseYear)\n\n// Only from the OUTSIDE. The picker's own writes change the leading value too: unticking the\n// earliest date of a list makes the next one lead, and following it would throw the reader into\n// another month and drop the focus on `<body>`, the day they were on having left the document.\nlet lastWritten: string | undefined\nwatch(\n () => [singleValue.value, rangeValue.value.start, multipleValues.value[0]],\n () => {\n if (lastWritten !== undefined && JSON.stringify(model.value) === lastWritten) return\n const primary = singleValue.value ?? rangeValue.value.start ?? multipleValues.value[0]\n if (primary && isValidISO(primary)) {\n const d = parseISO(primary)!\n if (d.getFullYear() !== viewYear.value || d.getMonth() !== viewMonth0.value) {\n focusedISO.value = primary\n }\n }\n },\n)\n\n// @a11y\n/**\n * Brings the focus into the grid, on the day the calendar is currently showing. This\n * is what VDateInput calls when it opens its panel.\n */\nfunction focus(options?: FocusOptions) {\n view.value = 'days'\n focusDay(focusedISO.value, options)\n}\n\n// @core\n/*\n * A panel's content stays MOUNTED while the panel is closed, so without this the months or\n * years view a reader left open is what the next opening shows; and a field that opens its\n * panel on focus never calls `focus()`, the one place that reset the view.\n */\nfunction reset() {\n view.value = 'days'\n hoverISO.value = null\n focusedISO.value = initialFocus()\n}\n\ndefineExpose({\n /** Brings the focus into the grid, onto the day the calendar is showing. */\n focus,\n /**\n * Returns to the days view, on the selected date or today, without moving the focus.\n * VDateInput calls it each time its panel opens and closes.\n */\n reset,\n})\n</script>\n\n<template>\n <div\n class=\"v-date-picker\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :data-view=\"view\"\n :data-selection=\"selection\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-readonly=\"readonly ? '' : undefined\"\n @pointerleave=\"hoverISO = null\"\n >\n <!-- The header: the month and the year, each between two chevrons that step it,\n and each opening its own picker view when clicked -->\n <div :key=\"`header-${renderEpoch}`\" class=\"v-date-picker-header\">\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevMonth\"\n @click=\"stepMonth(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'months'\"\n :aria-label=\"monthLabel\"\n @click=\"toggleView('months')\"\n >\n {{ monthLabels[viewMonth0] }}\n <VIcon\n :name=\"view === 'months' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canNextMonth\"\n @click=\"stepMonth(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousYear\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevYear\"\n @click=\"stepYear(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'years'\"\n @click=\"toggleView('years')\"\n >\n {{ viewYear }}\n <VIcon\n :name=\"view === 'years' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextYear\"\n size=\"sm\"\n :disabled=\"disabled || !canNextYear\"\n @click=\"stepYear(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n </div>\n\n <div\n v-show=\"view === 'days'\"\n :key=\"`days-${renderEpoch}`\"\n class=\"v-date-picker-grid\"\n role=\"grid\"\n :aria-label=\"gridLabel\"\n :aria-multiselectable=\"selection === 'multiple' ? 'true' : undefined\"\n @keydown=\"onDaysKeydown\"\n >\n <div class=\"v-date-picker-weekdays\" role=\"row\">\n <span\n v-for=\"(w, i) in weekdays\"\n :key=\"w\"\n class=\"v-date-picker-weekday\"\n role=\"columnheader\"\n :aria-label=\"weekdaysLong[i]\"\n >{{ w }}</span\n >\n </div>\n <div v-for=\"(week, wi) in weeks\" :key=\"wi\" class=\"v-date-picker-week\" role=\"row\">\n <div\n v-for=\"cell in week\"\n :key=\"cell.iso\"\n class=\"v-date-picker-cell\"\n role=\"gridcell\"\n :aria-selected=\"cell.kind === 'button' ? cell.committed : undefined\"\n :data-in-range=\"cell.inRange ? '' : undefined\"\n :data-range-start=\"cell.rangeStart ? '' : undefined\"\n :data-range-end=\"cell.rangeEnd ? '' : undefined\"\n >\n <button\n v-if=\"cell.kind === 'button'\"\n :id=\"dayId(cell.iso)\"\n type=\"button\"\n class=\"v-date-picker-day\"\n :tabindex=\"cell.iso === focusedISO ? 0 : -1\"\n :data-outside=\"!cell.inMonth ? '' : undefined\"\n :data-selected=\"cell.selected ? '' : undefined\"\n :data-today=\"cell.today ? '' : undefined\"\n :data-unavailable=\"cell.disabled ? '' : undefined\"\n :disabled=\"disabled\"\n :aria-disabled=\"cell.disabled || readonly ? 'true' : undefined\"\n :aria-current=\"cell.today ? 'date' : undefined\"\n @click=\"selectDay(cell)\"\n @pointerenter=\"hoverISO = cell.iso\"\n @focus=\"hoverISO = cell.iso\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n <!-- The dots are hidden from assistive technology, so what they stand for is\n spoken here, as part of the day's name. -->\n <span v-if=\"cell.eventText\" class=\"v-visually-hidden\">, {{ cell.eventText }}</span>\n <span v-if=\"cell.dots.length\" class=\"v-date-picker-dots\" aria-hidden=\"true\">\n <span\n v-for=\"(ev, ei) in cell.dots\"\n :key=\"ei\"\n class=\"v-date-picker-dot\"\n :style=\"ev.color ? { '--date-picker-dot-color': ev.color } : undefined\"\n />\n </span>\n </button>\n <!--\n A day of a neighbouring month that cannot be selected. It renders the very same slot\n as the clickable days: were it left with the bare number, custom content taking\n several lines would apply to this month's days only, and the numbers would stop\n lining up from one cell to the next.\n -->\n <span\n v-else-if=\"cell.kind === 'static'\"\n class=\"v-date-picker-day v-date-picker-day--static\"\n :data-disabled=\"cell.disabled ? '' : undefined\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n </span>\n </div>\n </div>\n </div>\n\n <div\n v-if=\"view === 'months'\"\n class=\"v-date-picker-view\"\n role=\"grid\"\n :aria-label=\"m.datePicker.monthPicker\"\n @keydown=\"onMonthsKeydown\"\n >\n <div v-for=\"(row, r) in monthRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"{ name, i } in row\"\n :id=\"`${gridLabelId}-m-${i}`\"\n :key=\"i\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"i === focusedMonth ? 0 : -1\"\n :data-selected=\"i === viewMonth0 ? '' : undefined\"\n :aria-selected=\"i === viewMonth0 ? 'true' : undefined\"\n :aria-label=\"monthNamesLong[i]\"\n :disabled=\"disabled || !monthSelectable(i)\"\n @click=\"chooseMonth(i)\"\n >\n {{ name }}\n </button>\n </div>\n </div>\n\n <div\n v-if=\"view === 'years'\"\n class=\"v-date-picker-view v-date-picker-view--years\"\n role=\"grid\"\n :aria-label=\"m.datePicker.yearPicker\"\n @keydown=\"onYearsKeydown\"\n >\n <div v-for=\"(row, r) in yearRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"y in row\"\n :id=\"`${gridLabelId}-y-${y}`\"\n :key=\"y\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"y === focusedYear ? 0 : -1\"\n :data-selected=\"y === viewYear ? '' : undefined\"\n :aria-selected=\"y === viewYear ? 'true' : undefined\"\n :disabled=\"disabled\"\n @click=\"chooseYear(y)\"\n >\n {{ y }}\n </button>\n </div>\n </div>\n\n <div v-if=\"$slots.footer\" class=\"v-date-picker-footer\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-date-picker {\n /*\n * The consumer sets the size of the day disc through its token; the cell around it; the\n * hover area and the width of the column; grows to follow, and never falls below the size\n * the cell token sets.\n */\n --date-picker-cell: max(\n var(--vectis-control-size-date-picker-cell),\n calc(var(--vectis-control-size-date-picker-day) + var(--vectis-space-1))\n );\n display: inline-flex;\n flex-direction: column;\n gap: var(--vectis-space-2);\n padding: var(--vectis-space-3);\n font-family: var(--vectis-text-family);\n color: var(--vectis-color-text);\n }\n\n /*\n * The days grid then fills that width through its 1fr columns, and never goes below the seven\n * cells its own floor guarantees.\n */\n .v-date-picker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--vectis-space-2);\n }\n\n .v-date-picker-nav {\n display: flex;\n align-items: center;\n }\n\n /* A minimum width holds this button steady, so the chevrons on either side do not\n shift as the month or year label changes length. */\n /* Qualified by an attribute the button always renders: `.v-button` sets its own\n `font-weight` at (0,1,0), and a tie between the two sheets would leave the weight to\n whichever the consumer's bundler put last. */\n .v-date-picker-view-toggle[data-size] {\n min-inline-size: var(--vectis-control-size-date-picker-nav-min);\n font-weight: var(--vectis-font-weight-semibold);\n text-transform: capitalize;\n }\n\n /*\n * The days grid can never be narrower than seven cells. Above that floor it takes whatever\n * width the calendar has; set by the header; and the 1fr columns share it out equally.\n */\n .v-date-picker-grid {\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n\n .v-date-picker-weekdays,\n .v-date-picker-week {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n }\n\n .v-date-picker-weekday {\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--vectis-control-height-sm);\n /* A column micro-header, which takes the overline type role. The casing stays\n `capitalize`, the calendar convention, rather than the full capitals the\n VTypography overline variant would apply. */\n font-size: var(--vectis-text-overline-size);\n font-weight: var(--vectis-text-overline-weight);\n letter-spacing: var(--vectis-text-overline-tracking);\n color: var(--vectis-color-text-muted);\n text-transform: capitalize;\n }\n\n .v-date-picker-cell {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--date-picker-cell);\n }\n\n /*\n * The two cap rules below only shape a pseudo-element that `[data-in-range]` has already\n * created, so they depend on `isInRange` counting both ends of the period as inside it. Make\n * it exclusive and there is no `::before` to cap: both rounded ends of every range vanish,\n * leaving a band that stops square one cell short at each side, with nothing in the console.\n */\n .v-date-picker-cell[data-in-range]::before {\n content: '';\n position: absolute;\n inset-block: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n inset-inline: 0;\n background: var(--vectis-color-accent-surface);\n z-index: 0;\n }\n .v-date-picker-cell[data-range-start]::before {\n inset-inline-start: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-start-radius: var(--vectis-radius-pill);\n border-end-start-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-end]::before {\n inset-inline-end: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-end-radius: var(--vectis-radius-pill);\n border-end-end-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-start][data-range-end]::before {\n content: none;\n }\n\n .v-date-picker-day {\n position: relative;\n z-index: 1;\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: var(--vectis-control-size-date-picker-day);\n block-size: var(--vectis-control-size-date-picker-day);\n padding: 0;\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n cursor: pointer;\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* Hover belongs to the days one can actually click: not the disabled ones, not the\n already selected ones, and not the neighbouring days rendered as plain spans. */\n .v-date-picker-day:hover:not(:disabled):not([aria-disabled='true']):not([data-selected]):not(\n .v-date-picker-day--static\n ) {\n background: var(--vectis-color-surface-muted);\n }\n\n .v-date-picker-day[data-outside] {\n color: var(--vectis-color-text-subtle);\n }\n\n /*\n * The semibold in the two rules below marks a state; today, and the selection; and is not a\n * typographic role, which is why it reads a font token directly.\n */\n .v-date-picker-day[data-today]:not([data-selected]) {\n box-shadow: inset 0 0 0 1px var(--vectis-color-accent-border);\n color: var(--vectis-color-accent-text);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n .v-date-picker-day[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n /*\n * It hangs on its own attribute rather than on `aria-disabled`, which a read-only calendar\n * also carries on every day: nothing can be chosen there, but the dates themselves are\n * perfectly available and striking them all out would say the opposite. The hover rule below\n * still reads `aria-disabled`, so neither highlights.\n */\n .v-date-picker-day[data-unavailable] {\n color: var(--vectis-color-text-subtle);\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker[data-readonly] .v-date-picker-day:not([data-unavailable]) {\n cursor: default;\n }\n\n /* A disabled calendar greys out through the colour tokens and never through opacity,\n the selection included: left in the accent colour it would go on looking live. */\n .v-date-picker-day:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n\n .v-date-picker[data-disabled] .v-date-picker-day[data-selected] {\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n .v-date-picker-day--static {\n color: var(--vectis-color-text-subtle);\n cursor: default;\n }\n\n /* A neighbouring day that falls outside the bounds, or is disabled, is struck\n through like any other unavailable date. */\n .v-date-picker-day--static[data-disabled] {\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker-day:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-date-picker-day-num {\n line-height: var(--vectis-text-control-leading);\n }\n\n .v-date-picker-dots {\n position: absolute;\n /* Half a dot, below them and between them: the spacing scale has no step that small. */\n inset-block-end: calc(var(--vectis-control-size-date-picker-dot) / 2);\n display: flex;\n gap: calc(var(--vectis-control-size-date-picker-dot) / 2);\n }\n .v-date-picker-dot {\n inline-size: var(--vectis-control-size-date-picker-dot);\n block-size: var(--vectis-control-size-date-picker-dot);\n border-radius: var(--vectis-radius-pill);\n background: var(--date-picker-dot-color, var(--vectis-color-accent));\n }\n .v-date-picker-day[data-selected] .v-date-picker-dot {\n background: var(--vectis-color-text-on-accent);\n }\n\n /* The months and years views. They fill the calendar's width exactly like the days\n grid does: stretched by the flex column, then shared out by 1fr columns. */\n .v-date-picker-view {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: var(--vectis-space-1);\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n /* The rows ARIA requires inside a grid, made invisible to the layout: with\n `display: contents` the cells remain direct grid items of `.v-date-picker-view`,\n so the columns line up as if the rows were not there. */\n .v-date-picker-view-row {\n display: contents;\n }\n\n .v-date-picker-view--years {\n max-block-size: calc(6 * var(--date-picker-cell));\n overflow-y: auto;\n }\n\n .v-date-picker-view-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n block-size: var(--vectis-control-height-lg);\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n text-transform: capitalize;\n cursor: pointer;\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n .v-date-picker-view-cell:hover:not(:disabled):not([data-selected]) {\n background: var(--vectis-color-surface-muted);\n }\n .v-date-picker-view-cell[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n .v-date-picker-view-cell:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n .v-date-picker-view-cell:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: calc(-1 * var(--vectis-focus-ring-width));\n }\n\n .v-date-picker-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--vectis-space-2);\n padding-block-start: var(--vectis-space-2);\n border-block-start: 1px solid var(--vectis-color-border);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-date-picker-day,\n .v-date-picker-view-cell {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiKA,IAAMmD,IAAQC,GAmBRC,IAAQpD,GAA4BmD,GAAA,YAAkB,GAEtDG,KAAOL,IAmBPM,IAAcC,GAAM,GAIpBC,IAAIC,EAAY,GAIhBC,KAAYC,QAAmBV,EAAM,SAASO,EAAE,MAAM,WAAW,KAAK,GACtEI,IAAiBC,QAAwBZ,EAAM,MAAM;EAG3D,AAAIa,KAAS,CAACC,GAAOC,IAAc,EAAK,KACtCC,SAAkB;GAChB,AAAIhB,EAAM,OAAOA,EAAM,OAAOiB,EAAWjB,EAAM,KAAKA,EAAM,GAAG,IAAI,KAC/D,QAAQ,KACN,sBAAsBA,EAAM,IAAI,qBAAqBA,EAAM,IAAI,6BACjE;EACJ,CAAC;EAGH,IAAMkB,IAAmBC,QACjBnB,EAAM,kBAAkBoB,GAAkBT,EAAe,KAAK,CACtE,GACMU,KAAWF,QAAeG,GAAaX,EAAe,OAAOO,EAAiB,OAAO,OAAO,CAAC,GAC7FK,KAAeJ,QACnBG,GAAaX,EAAe,OAAOO,EAAiB,OAAO,MAAM,CACnE,GACMM,KAAcL,QAAeM,GAAkBd,EAAe,KAAK,CAAC,GAEpEe,KAAiBP,QAAeQ,GAAWhB,EAAe,KAAK,CAAC,GAEhEiB,IAAcT,QAClBnB,EAAM,cAAc,YAAY,OAAOE,EAAM,SAAU,YAAY2B,EAAW3B,EAAM,KAAK,IAC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QAAQ,KAAQ,KAAA;IACrC,iBAAemG,MAAMnG,EAAA,QAAQ,SAAY,KAAA;IACzC,UAAUvC,EAAA;IACV,UAAK,MAAE6I,GAAWH,CAAC;GAEjB,GAAAjL,EAAAiL,CAAC,GAAA,GAAAlJ,EAAA;GAKC5C,EAAAA,OAAO,UAAlBE,EAAA,GAAAC,EAEM,OAFN0C,IAEM,CADJzB,EAAsBwM,EAAA,QAAA,QAAA,CAAA,CAAA,KAAAE,EAAA,IAAA,EAAA"}
1
+ {"version":3,"file":"VDatePicker.vue_vue_type_script_setup_true_lang.js","names":["$slots","_useModel","_openBlock","_createElementBlock","_unref","_createElementVNode","_createVNode","VIconButton","_withCtx","VIcon","chevronLeftIcon","VButton","_createTextVNode","_toDisplayString","arrowDropUpIcon","arrowDropDownIcon","chevronRightIcon","_withDirectives","_Fragment","_renderList","_renderSlot","_mergeProps","_createCommentVNode","_normalizeStyle","_vShow","VIcon_default","VButton_default","VIconButton_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","VDatePicker_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__expose","__emit","props","__props","model","useModel","emit","gridLabelId","useId","m","useMessages","ariaLabel","useAriaLabel","resolvedLocale","useResolvedLocale","isDev","inject","hostWarnsKey","watchEffect","compareISO","resolvedFirstDay","computed","firstDayOfWeekFor","weekdays","weekdayNames","weekdaysLong","monthLabels","monthNamesCompact","monthNamesLong","monthNames","singleValue","isValidISO","rangeValue","multipleValues","initialFocus","start","clampISO","formatISO","readTheClock","focusedISO","ref","view","viewYear","parseISO","viewMonth0","monthLabel","monthName","gridLabel","monthYearName","today","renderEpoch","isDisabledDate","resolveMatcher","eventsByDate","map","ev","list","hoverISO","orderRange","a","b","effectiveRange","r","preview","isCommitted","isSameISO","iso","isSelected","isInRange","end","grid","buildMonthGrid","NO_EVENTS","days","inMonth","cell","show","selectable","disabled","isDateAllowed","kind","events","daySlotProps","weeks","rows","i","monthHasSelectable","first","isoOf","year","month0","last","daysInMonth","canPrevMonth","canNextMonth","canPrevYear","canNextYear","dayId","focusDay","options","goTo","moveFocus","stepMonth","addMonths","delta","stepYear","toggleView","next","target","nextTick","monthCellEl","yearCellEl","selectDay","toggleValue","onDaysKeydown","event","c","offset","step","dayStep","isRtl","addDays","chooseYearMonth","day","onViewKeydown","choose","focused","gridDelta","clamp","cells","cellEl","MONTHS","focusedMonth","monthSelectable","chooseMonth","onMonthsKeydown","chunk","monthRows","yearRange","minY","maxY","y","yearRows","focusedYear","chooseYear","onYearsKeydown","lastWritten","primary","d","focus","reset","openBlock","createElementBlock","unref","_cache","createElementVNode","createVNode","withCtx","chevron_left","createTextVNode","toDisplayString","arrow_drop_up","arrow_drop_down","chevron_right","withDirectives","Fragment","renderList","w","wi","week","renderSlot","_ctx","mergeProps","createCommentVNode","ei","normalizeStyle","vShow","row","name"],"sources":["../../../src/components/VDatePicker/VDatePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * Implement roving grid focus and date selection because the platform has no composable,\n * stylable date grid. VDateInput reuses this calendar logic.\n */\n\nimport { computed, inject, nextTick, onMounted, ref, useId, watch, watchEffect } from 'vue'\nimport type { Ref } from 'vue'\n\nimport VButton from '../VButton/VButton.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { arrow_drop_down as arrowDropDownIcon } from '../VIcon/icons/arrow_drop_down'\nimport { arrow_drop_up as arrowDropUpIcon } from '../VIcon/icons/arrow_drop_up'\nimport { chevron_left as chevronLeftIcon } from '../VIcon/icons/chevron_left'\nimport { chevron_right as chevronRightIcon } from '../VIcon/icons/chevron_right'\nimport VIconButton from '../VIconButton/VIconButton.vue'\nimport {\n addDays,\n addMonths,\n buildMonthGrid,\n clampISO,\n compareISO,\n daysInMonth,\n firstDayOfWeekFor,\n formatISO,\n isDateAllowed,\n isoOf,\n isSameISO,\n isValidISO,\n parseISO,\n weekdayNames,\n} from '../../utils/date'\nimport { monthName, monthNames, monthNamesCompact, monthYearName } from './names'\n\nimport { PICKER_COLUMNS, dayStep, gridDelta } from './keyboard'\n\nimport { toggleValue } from '../../utils/array'\nimport { isRtl } from '../../utils/direction'\nimport { isDev } from '../../utils/env'\nimport { hostWarnsKey } from '../../utils/hostWarns'\nimport { resolveMatcher } from '../../utils/matcher'\nimport { clamp } from '../../utils/number'\nimport { useAriaLabel } from '../../composables/useAriaLabel'\nimport { useMessages, useResolvedLocale } from '../../i18n/state'\n\n/** What a click selects: one date, a period between two, or a list of dates. */\nexport type DatePickerSelection = 'single' | 'range' | 'multiple'\n\n/**\n * A period between two dates, the value of a `range` selection. Either bound may be\n * null: between the first and the second click, a range has a start and no end yet.\n */\nexport interface DatePickerRange {\n /** The first day of the period, as an ISO `YYYY-MM-DD` string. */\n start: string | null\n /** The last day of the period, as an ISO `YYYY-MM-DD` string. */\n end: string | null\n}\n\n/** Something happening on a given day, shown as a coloured dot under its number. */\nexport interface DatePickerEvent {\n /** The day it falls on, as an ISO `YYYY-MM-DD` string. */\n date: string\n /** The colour of the dot, as any CSS colour. It is the accent colour by default. */\n color?: string\n /** A description of the event, spoken as part of the day's accessible name. */\n label?: string\n}\n\n/**\n * Which dates cannot be selected, given either as a list of ISO strings or as a\n * function answering that question for a date.\n */\nexport type DatePickerMatcher = string[] | ((iso: string) => boolean)\n\n/** The shape of the v-model, which follows whichever `selection` is in use. */\nexport type DatePickerValue = string | null | DatePickerRange | string[]\n\n/** Everything the `#day` slot is told about the day it draws. */\nexport interface DatePickerDaySlotProps {\n /** The day, as an ISO `YYYY-MM-DD` string. */\n iso: string\n /** The day of the month. */\n day: number\n /** Whether it belongs to the month on display rather than to a neighbouring one. */\n inMonth: boolean\n /** Whether it cannot be chosen: outside the bounds, or excluded by `disabledDates`. */\n disabled: boolean\n /** Whether it is selected. */\n selected: boolean\n /** Whether it is today. */\n today: boolean\n /** Whether it falls inside the selected period, both ends included. */\n inRange: boolean\n /** The events that fall on it. */\n events: DatePickerEvent[]\n}\n\ninterface DatePickerProps {\n /**\n * What the reader is picking: a single date, a period between two dates, or any\n * number of separate dates. It determines the shape of the v-model.\n */\n selection?: DatePickerSelection\n /**\n * A BCP 47 locale, which decides the month and day names and the first day of the\n * week. It TAKES PRECEDENCE over the design system's global locale (`setLocale`)\n * and falls back to it, which is why it has no literal default here: `undefined`\n * has to stay recognizable for the global locale to have its chance.\n */\n locale?: string\n /**\n * Forces the day the weeks start on (0 for Sunday through 6 for Saturday). Left\n * out, the locale decides.\n */\n firstDayOfWeek?: number\n /**\n * The earliest selectable date, as an ISO string. Neither navigation nor selection\n * goes back beyond it.\n */\n min?: string\n /**\n * The latest selectable date, as an ISO string. Neither navigation nor selection\n * goes past it.\n */\n max?: string\n /**\n * Dates that cannot be chosen, given as a list of ISO strings or as a function.\n * They stay visible, struck through, and can still be reached with the keyboard.\n */\n disabledDates?: DatePickerMatcher\n /**\n * Fills the empty corners of the grid with the greyed days of the neighbouring months. It is\n * off by default.\n */\n showAdjacentDays?: boolean\n /**\n * Lets those neighbouring days be clicked, which moves the calendar to their month.\n * A clickable day has to be visible, so this implies showing them.\n */\n selectAdjacentDays?: boolean\n /** The events to mark, as up to three coloured dots under the day they fall on. */\n events?: DatePickerEvent[]\n /**\n * Makes the whole calendar unusable: no date can be chosen, no month reached, and\n * everything greys out through the colour tokens.\n */\n disabled?: boolean\n /**\n * Shows what is selected without letting it be changed. The calendar can still be read and\n * walked through (another month, another year), which separates it from `disabled`.\n */\n readonly?: boolean\n /**\n * The accessible name of the whole picker, its header and its grid together. It falls back to\n * the dictionary, and a consumer `aria-label` wins.\n */\n label?: string\n}\n\nconst props = withDefaults(defineProps<DatePickerProps>(), {\n selection: 'single',\n locale: undefined,\n firstDayOfWeek: undefined,\n min: undefined,\n max: undefined,\n disabledDates: undefined,\n showAdjacentDays: false,\n selectAdjacentDays: false,\n events: undefined,\n disabled: false,\n readonly: false,\n label: undefined,\n})\n\n/**\n * What is selected, and its shape follows `selection`: an ISO `YYYY-MM-DD` string for `single`,\n * a `{ start, end }` pair for `range`, an array of strings for `multiple`.\n */\nconst model = defineModel<DatePickerValue>({ default: null })\n\nconst emit = defineEmits<{\n /**\n * Emitted every time a date is chosen, carrying the complete value as it now\n * stands. VDateInput listens to it to close its panel on a single selection.\n */\n select: [value: DatePickerValue]\n}>()\n\ndefineSlots<{\n /**\n * Replaces the content of a day cell, to show a price or an availability under the\n * number for instance. It receives everything known about that day, including\n * whether it belongs to the displayed month.\n */\n day?(props: DatePickerDaySlotProps): unknown\n /** The strip under the grid, for actions such as Close or Save, or for preset dates. */\n footer?(): unknown\n}>()\n\nconst gridLabelId = useId()\n\n// The navigation labels have no prop of their own: the dictionary is the single place to change\n// them, globally or per language; see `src/i18n/`.\nconst m = useMessages()\n// @a11y\n// A roleless box cannot carry an accessible name (axe: aria-prohibited-attr),\n// so the root is a named group: the VCarousel viewport arrangement.\nconst ariaLabel = useAriaLabel(() => props.label ?? m.value.datePicker.label)\nconst resolvedLocale = useResolvedLocale(() => props.locale)\n\n// @devwarn\nif (isDev && !inject(hostWarnsKey, false)) {\n watchEffect(() => {\n if (props.min && props.max && compareISO(props.min, props.max) > 0)\n console.warn(\n `[VDatePicker] min \"${props.min}\" falls after max \"${props.max}\", so no date can be chosen.`,\n )\n })\n}\n\nconst resolvedFirstDay = computed(\n () => props.firstDayOfWeek ?? firstDayOfWeekFor(resolvedLocale.value),\n)\nconst weekdays = computed(() => weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'short'))\nconst weekdaysLong = computed(() =>\n weekdayNames(resolvedLocale.value, resolvedFirstDay.value, 'long'),\n)\nconst monthLabels = computed(() => monthNamesCompact(resolvedLocale.value))\n/** The full names the compact cells are spoken with: \"Jan.\" is not a word to hear. */\nconst monthNamesLong = computed(() => monthNames(resolvedLocale.value))\n\nconst singleValue = computed(() =>\n props.selection === 'single' && typeof model.value === 'string' && isValidISO(model.value)\n ? model.value\n : null,\n)\nconst rangeValue = computed<DatePickerRange>(() => {\n if (\n props.selection === 'range' &&\n model.value &&\n typeof model.value === 'object' &&\n !Array.isArray(model.value)\n ) {\n return model.value as DatePickerRange\n }\n return { start: null, end: null }\n})\nconst multipleValues = computed<string[]>(() =>\n props.selection === 'multiple' && Array.isArray(model.value) ? model.value : [],\n)\n\n// A range start or a list entry is validated here, the way the single value is validated\n// upstream: both arrive as the consumer wrote them, and the month arrows assert that the focused\n// date parses, so a malformed one (`{ start: 'foo' }`) must never become it.\nfunction initialFocus(): string {\n if (singleValue.value) return singleValue.value\n const start = rangeValue.value.start\n if (start && isValidISO(start)) return start\n const listed = multipleValues.value.find(isValidISO)\n if (listed) return listed\n readTheClock = true\n return clampISO(formatISO(new Date()), props.min, props.max)\n}\n/** Whether the month on display was read from the clock at setup: see `renderEpoch`. */\nlet readTheClock = false\nconst focusedISO = ref(initialFocus())\nconst view = ref<'days' | 'months' | 'years'>('days')\n\nconst viewYear = computed(\n () => parseISO(focusedISO.value)?.getFullYear() ?? new Date().getFullYear(),\n)\nconst viewMonth0 = computed(() => parseISO(focusedISO.value)?.getMonth() ?? 0)\nconst monthLabel = computed(() => monthName(resolvedLocale.value, viewMonth0.value))\nconst gridLabel = computed(() =>\n monthYearName(resolvedLocale.value, viewYear.value, viewMonth0.value),\n)\n\n// @ssr\n// Today's date is only read once the component is mounted, hence on the client: the\n// server has no way to know it, and rendering it during setup would make the two\n// markups differ and break hydration.\nconst today = ref<string | null>(null)\n\n// @ssr\n/*\n * With nothing selected, the month on display is read from the clock at setup, on the server\n * and again in the browser, and the two can disagree: a page prerendered in September and\n * opened in October, or a server a timezone behind its visitor on the last evening of a month.\n * Hydration patches the text but keeps the server's attributes, which would leave the month\n * button's accessible name and the day ids `focusDay` looks up on the server's month: bumping\n * the epoch re-renders the header and the grid once mounted.\n */\nconst renderEpoch = ref(0)\nonMounted(() => {\n today.value = formatISO(new Date())\n if (readTheClock) renderEpoch.value++\n})\n\nconst isDisabledDate = computed(() => resolveMatcher(props.disabledDates))\n\nconst eventsByDate = computed(() => {\n const map = new Map<string, DatePickerEvent[]>()\n for (const ev of props.events ?? []) {\n const list = map.get(ev.date) ?? []\n list.push(ev)\n map.set(ev.date, list)\n }\n return map\n})\n\nconst hoverISO = ref<string | null>(null)\nfunction orderRange(a: string, b: string): DatePickerRange {\n return compareISO(a, b) <= 0 ? { start: a, end: b } : { start: b, end: a }\n}\nconst effectiveRange = computed<DatePickerRange>(() => {\n if (props.selection !== 'range') return { start: null, end: null }\n const r = rangeValue.value\n if (r.start && r.end) return orderRange(r.start, r.end)\n // A start is set but the end is still pending: the range is previewed up to\n // whichever day the pointer or the focus is currently on.\n const preview = hoverISO.value ?? focusedISO.value\n if (r.start && preview) return orderRange(r.start, preview)\n return { start: r.start, end: r.end }\n})\n\n/**\n * Whether a day is part of the COMMITTED value, which `aria-selected` says: the end a range\n * preview is drawing is not selected yet, and announcing every day the focus walks over as\n * \"selected\" would say so.\n */\nfunction isCommitted(iso: string): boolean {\n if (props.selection !== 'range') return isSelected(iso)\n return isSameISO(iso, rangeValue.value.start) || isSameISO(iso, rangeValue.value.end)\n}\n\nfunction isSelected(iso: string): boolean {\n if (props.selection === 'single') return isSameISO(iso, singleValue.value)\n if (props.selection === 'multiple') return multipleValues.value.includes(iso)\n // In range selection, the two ends of the period count as selected; including the provisional\n // end shown during the preview.\n return isSameISO(iso, effectiveRange.value.start) || isSameISO(iso, effectiveRange.value.end)\n}\n/** Whether a day falls inside the selected period, both ends included. */\nfunction isInRange(iso: string): boolean {\n const { start, end } = effectiveRange.value\n return !!start && !!end && compareISO(iso, start) >= 0 && compareISO(iso, end) <= 0\n}\n\ntype DayCell = {\n iso: string\n day: number\n kind: 'empty' | 'static' | 'button'\n inMonth: boolean\n disabled: boolean\n selected: boolean\n /** Selected in the value itself, the preview left out: what `aria-selected` reports. */\n committed: boolean\n rangeStart: boolean\n rangeEnd: boolean\n inRange: boolean\n today: boolean\n events: DatePickerEvent[]\n /** The events drawn as dots under the number, three at most. */\n dots: DatePickerEvent[]\n /** The labels of its events, joined, for the day's accessible name. */\n eventText: string\n}\n\n/** The 42 squares of the month on display, rebuilt only when the MONTH changes. */\nconst grid = computed(() =>\n buildMonthGrid(viewYear.value, viewMonth0.value, resolvedFirstDay.value),\n)\n\nconst NO_EVENTS: DatePickerEvent[] = []\n\nconst days = computed<DayCell[]>(() =>\n grid.value.map((cell) => {\n const inMonth = cell.adjacent === null\n // Making the neighbouring days clickable implies showing them: a day nobody can\n // see cannot be clicked.\n const show = inMonth || props.showAdjacentDays || props.selectAdjacentDays\n const selectable = inMonth || props.selectAdjacentDays\n const disabled = !isDateAllowed(cell.iso, props.min, props.max, isDisabledDate.value)\n const kind: DayCell['kind'] = !show ? 'empty' : selectable ? 'button' : 'static'\n const events = eventsByDate.value.get(cell.iso) ?? NO_EVENTS\n return {\n iso: cell.iso,\n day: cell.day,\n kind,\n inMonth,\n disabled,\n selected: kind === 'button' && !disabled && isSelected(cell.iso),\n committed: kind === 'button' && !disabled && isCommitted(cell.iso),\n rangeStart: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.start),\n rangeEnd: props.selection === 'range' && isSameISO(cell.iso, effectiveRange.value.end),\n inRange: props.selection === 'range' && isInRange(cell.iso),\n today: isSameISO(cell.iso, today.value),\n events,\n dots: events.length > 3 ? events.slice(0, 3) : events,\n eventText: events\n .map((ev) => ev.label)\n .filter(Boolean)\n .join(', '),\n }\n }),\n)\n\n/** What the `#day` slot receives for a square: the same object for both kinds of cell. */\nfunction daySlotProps(cell: DayCell): DatePickerDaySlotProps {\n return {\n iso: cell.iso,\n day: cell.day,\n inMonth: cell.inMonth,\n disabled: cell.disabled,\n selected: cell.selected,\n today: cell.today,\n inRange: cell.inRange,\n events: cell.events,\n }\n}\nconst weeks = computed(() => {\n const rows: DayCell[][] = []\n for (let i = 0; i < days.value.length; i += 7) rows.push(days.value.slice(i, i + 7))\n return rows\n})\n\nfunction monthHasSelectable(year: number, month0: number): boolean {\n const first = isoOf(year, month0, 1)\n const last = isoOf(year, month0, daysInMonth(year, month0))\n return (\n (!props.max || compareISO(first, props.max) <= 0) &&\n (!props.min || compareISO(last, props.min) >= 0)\n )\n}\n// Derived from the month on display, not from the focused day, so an arrow key moving the\n// focus inside the month does not recompute them.\nconst canPrevMonth = computed(() =>\n viewMonth0.value === 0\n ? monthHasSelectable(viewYear.value - 1, 11)\n : monthHasSelectable(viewYear.value, viewMonth0.value - 1),\n)\nconst canNextMonth = computed(() =>\n viewMonth0.value === 11\n ? monthHasSelectable(viewYear.value + 1, 0)\n : monthHasSelectable(viewYear.value, viewMonth0.value + 1),\n)\nconst canPrevYear = computed(\n () => !props.min || compareISO(isoOf(viewYear.value - 1, 11, 31), props.min) >= 0,\n)\nconst canNextYear = computed(\n () => !props.max || compareISO(isoOf(viewYear.value + 1, 0, 1), props.max) <= 0,\n)\n\n// @a11y\n// Moves the real DOM focus onto a day cell. The grid keeps exactly one cell in the\n// tab order, so navigating means focusing another one.\nconst dayId = (iso: string) => `${gridLabelId}-d-${iso}`\nfunction focusDay(iso: string, options?: FocusOptions) {\n nextTick(() => document.getElementById(dayId(iso))?.focus(options))\n}\n\nfunction goTo(iso: string, moveFocus = false) {\n // Every move through the calendar comes here, so one guard covers the arrows, the\n // month and year cells and the keyboard's own steps. Only `disabled` stops it:\n // `readonly` leaves the reader free to look around.\n if (props.disabled) return\n focusedISO.value = clampISO(iso, props.min, props.max)\n if (moveFocus && view.value === 'days') focusDay(focusedISO.value)\n}\nfunction stepMonth(delta: number) {\n goTo(addMonths(focusedISO.value, delta))\n}\nfunction stepYear(delta: number) {\n goTo(addMonths(focusedISO.value, delta * 12))\n}\n\n// @a11y @core\n// Changing view has to carry the focus onto the cell the new view\n// opens on. Without that move the focus would stay on a button the view has just\n// removed from the document, and the keyboard would have nowhere to go.\nfunction toggleView(target: 'months' | 'years') {\n const next = view.value === target ? 'days' : target\n view.value = next\n if (next === 'months') {\n focusedMonth.value = viewMonth0.value\n nextTick(() => monthCellEl(viewMonth0.value)?.focus())\n } else if (next === 'years') {\n focusedYear.value = viewYear.value\n nextTick(() => {\n const cell = yearCellEl(viewYear.value)\n // Called optionally because jsdom does not implement scrollIntoView (the same\n // guard as VTimeInput's list). Centring the year is a nicety; the focus call\n // below is not, so it must not be taken down with it.\n cell?.scrollIntoView?.({ block: 'center' })\n cell?.focus()\n })\n } else if (view.value === 'days') {\n focusDay(focusedISO.value)\n }\n}\n\nfunction selectDay(cell: DayCell) {\n // Navigation is deliberately not guarded by `readonly`: a calendar one may read is a calendar\n // one may leaf through.\n if (props.disabled || props.readonly) return\n if (cell.kind !== 'button' || cell.disabled) return\n focusedISO.value = cell.iso\n let next: DatePickerValue\n if (props.selection === 'single') {\n next = cell.iso\n } else if (props.selection === 'multiple') {\n next = toggleValue(multipleValues.value, cell.iso).sort(compareISO)\n } else {\n // Range selection reads three clicks: the first sets the start, the second the\n // end (reordered if it comes before the start), and the third starts a new\n // period.\n const r = rangeValue.value\n next = !r.start || r.end ? { start: cell.iso, end: null } : orderRange(r.start, cell.iso)\n }\n lastWritten = JSON.stringify(next)\n model.value = next\n // Emit what was just computed, never `model.value` read back. Under a parent `v-model`,\n // `defineModel` does not update its local copy on write; it waits for the parent to\n // re-render; so the read would hand `select` the PREVIOUS value.\n emit('select', next)\n}\n\n// @keyboard @a11y\n// The keyboard of the days view. The table turning a key into a step is pure and\n// lives in `./keyboard`; what stays here is the date that step is applied to, and\n// the focus move that follows.\nfunction onDaysKeydown(event: KeyboardEvent) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n const cell = days.value.find((c) => c.iso === focusedISO.value)\n if (cell) selectDay(cell)\n return\n }\n const d = parseISO(focusedISO.value)!\n // How far the focused day sits from the start of its week, which is exactly what\n // Home and End have to step back and forward by.\n const offset = (d.getDay() - resolvedFirstDay.value + 7) % 7\n const step = dayStep(event.key, event.shiftKey, offset, isRtl(event.currentTarget as Element))\n if (!step) return\n event.preventDefault()\n goTo(\n 'days' in step\n ? addDays(focusedISO.value, step.days)\n : addMonths(focusedISO.value, step.months),\n true,\n )\n}\n\n/**\n * Leaving the months or the years view for the days of the month chosen, keeping the day of the\n * month where the new month has one; the 31st becoming the 30th, say.\n */\nfunction chooseYearMonth(year: number, month0: number) {\n const day = Math.min(parseISO(focusedISO.value)!.getDate(), daysInMonth(year, month0))\n goTo(isoOf(year, month0, day))\n view.value = 'days'\n focusDay(focusedISO.value)\n}\n\n// @keyboard @a11y\n/**\n * The keyboard of the months and the years views, which differ only in what their cells\n * hold: Enter or Space chooses the focused cell, and the arrows walk the list of cells a row\n * or a column at a time, stopping at either end.\n */\nfunction onViewKeydown(\n event: KeyboardEvent,\n cells: readonly number[],\n focused: Ref<number>,\n cellEl: (value: number) => HTMLElement | null,\n choose: (value: number) => void,\n selectable: (value: number) => boolean = () => true,\n) {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n choose(focused.value)\n return\n }\n const delta = gridDelta(event.key, isRtl(event.currentTarget as Element))\n if (delta === undefined) return\n event.preventDefault()\n // A cell the bounds rule out is a disabled button, which cannot take the focus: landing on it\n // would move the tab stop where the focus cannot follow. The walk goes on the same way round\n // to the next cell that can be chosen, and holds still when there is none.\n let next = clamp(cells.indexOf(focused.value) + delta, 0, cells.length - 1)\n while (!selectable(cells[next]!) && next + delta >= 0 && next + delta < cells.length)\n next += delta\n if (!selectable(cells[next]!)) return\n focused.value = cells[next]!\n cellEl(focused.value)?.focus()\n}\n\nconst MONTHS = Array.from({ length: 12 }, (_, i) => i)\nconst focusedMonth = ref(viewMonth0.value)\nconst monthCellEl = (i: number) =>\n document.getElementById(`${gridLabelId}-m-${i}`) as HTMLElement | null\nfunction monthSelectable(i: number) {\n return monthHasSelectable(viewYear.value, i)\n}\nfunction chooseMonth(i: number) {\n if (monthSelectable(i)) chooseYearMonth(viewYear.value, i)\n}\nconst onMonthsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, MONTHS, focusedMonth, monthCellEl, chooseMonth, monthSelectable)\n\n// @a11y\n/*\n * Both pickers are a `role=\"grid\"`, and a grid owns ROWS, not cells: a gridcell placed straight\n * under the grid fails aria-required-children and aria-required-parent at the same time. The\n * cells are therefore cut into rows of PICKER_COLUMNS, matching the `grid-template-columns` of\n * the stylesheet; the row element itself is `display: contents`, so the CSS grid never sees it.\n */\nconst chunk = <T>(list: T[]) =>\n Array.from({ length: Math.ceil(list.length / PICKER_COLUMNS) }, (_, r) =>\n list.slice(r * PICKER_COLUMNS, r * PICKER_COLUMNS + PICKER_COLUMNS),\n )\n\nconst monthRows = computed(() => chunk(monthLabels.value.map((name, i) => ({ name, i }))))\n\nconst yearRange = computed(() => {\n /*\n * `min` and `max` come straight from the consumer, and this is the only place where they are\n * turned into a Date instead of being compared as ISO text; `compareISO`, `isWithin` and\n * `clampISO` all tolerate a malformed bound. A value that is not a valid ISO date therefore\n * has to fall back to the open range here: asserting the parse would throw and take the whole\n * render down the moment the years view is opened.\n */\n const minY = parseISO(props.min)?.getFullYear() ?? viewYear.value - 100\n const maxY = parseISO(props.max)?.getFullYear() ?? viewYear.value + 100\n const list: number[] = []\n for (let y = minY; y <= maxY; y++) list.push(y)\n return list\n})\nconst yearRows = computed(() => chunk(yearRange.value))\nconst focusedYear = ref(viewYear.value)\nconst yearCellEl = (y: number) =>\n document.getElementById(`${gridLabelId}-y-${y}`) as HTMLElement | null\nconst chooseYear = (y: number) => chooseYearMonth(y, viewMonth0.value)\nconst onYearsKeydown = (event: KeyboardEvent) =>\n onViewKeydown(event, yearRange.value, focusedYear, yearCellEl, chooseYear)\n\n// Only from the OUTSIDE. The picker's own writes change the leading value too: unticking the\n// earliest date of a list makes the next one lead, and following it would throw the reader into\n// another month and drop the focus on `<body>`, the day they were on having left the document.\nlet lastWritten: string | undefined\nwatch(\n () => [singleValue.value, rangeValue.value.start, multipleValues.value[0]],\n () => {\n if (lastWritten !== undefined && JSON.stringify(model.value) === lastWritten) return\n const primary = singleValue.value ?? rangeValue.value.start ?? multipleValues.value[0]\n if (primary && isValidISO(primary)) {\n const d = parseISO(primary)!\n if (d.getFullYear() !== viewYear.value || d.getMonth() !== viewMonth0.value) {\n focusedISO.value = primary\n }\n }\n },\n)\n\n// @a11y\n/**\n * Brings the focus into the grid, on the day the calendar is currently showing. This\n * is what VDateInput calls when it opens its panel.\n */\nfunction focus(options?: FocusOptions) {\n view.value = 'days'\n focusDay(focusedISO.value, options)\n}\n\n// @core\n/*\n * A panel's content stays MOUNTED while the panel is closed, so without this the months or\n * years view a reader left open is what the next opening shows; and a field that opens its\n * panel on focus never calls `focus()`, the one place that reset the view.\n */\nfunction reset() {\n view.value = 'days'\n hoverISO.value = null\n focusedISO.value = initialFocus()\n}\n\ndefineExpose({\n /** Brings the focus into the grid, onto the day the calendar is showing. */\n focus,\n /**\n * Returns to the days view, on the selected date or today, without moving the focus.\n * VDateInput calls it each time its panel opens and closes.\n */\n reset,\n})\n</script>\n\n<template>\n <div\n class=\"v-date-picker\"\n role=\"group\"\n :aria-label=\"ariaLabel\"\n :data-view=\"view\"\n :data-selection=\"selection\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-readonly=\"readonly ? '' : undefined\"\n @pointerleave=\"hoverISO = null\"\n >\n <!-- The header: the month and the year, each between two chevrons that step it,\n and each opening its own picker view when clicked -->\n <div :key=\"`header-${renderEpoch}`\" class=\"v-date-picker-header\">\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevMonth\"\n @click=\"stepMonth(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'months'\"\n :aria-label=\"monthLabel\"\n @click=\"toggleView('months')\"\n >\n {{ monthLabels[viewMonth0] }}\n <VIcon\n :name=\"view === 'months' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextMonth\"\n size=\"sm\"\n :disabled=\"disabled || !canNextMonth\"\n @click=\"stepMonth(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n\n <div class=\"v-date-picker-nav\">\n <VIconButton\n :label=\"m.datePicker.previousYear\"\n size=\"sm\"\n :disabled=\"disabled || !canPrevYear\"\n @click=\"stepYear(-1)\"\n >\n <VIcon :name=\"chevronLeftIcon\" mirrored />\n </VIconButton>\n <VButton\n variant=\"ghost\"\n tone=\"neutral\"\n size=\"sm\"\n class=\"v-date-picker-view-toggle\"\n :disabled=\"disabled\"\n :aria-expanded=\"view === 'years'\"\n @click=\"toggleView('years')\"\n >\n {{ viewYear }}\n <VIcon\n :name=\"view === 'years' ? arrowDropUpIcon : arrowDropDownIcon\"\n aria-hidden=\"true\"\n />\n </VButton>\n <VIconButton\n :label=\"m.datePicker.nextYear\"\n size=\"sm\"\n :disabled=\"disabled || !canNextYear\"\n @click=\"stepYear(1)\"\n >\n <VIcon :name=\"chevronRightIcon\" mirrored />\n </VIconButton>\n </div>\n </div>\n\n <div\n v-show=\"view === 'days'\"\n :key=\"`days-${renderEpoch}`\"\n class=\"v-date-picker-grid\"\n role=\"grid\"\n :aria-label=\"gridLabel\"\n :aria-multiselectable=\"selection === 'multiple' ? 'true' : undefined\"\n @keydown=\"onDaysKeydown\"\n >\n <div class=\"v-date-picker-weekdays\" role=\"row\">\n <span\n v-for=\"(w, i) in weekdays\"\n :key=\"w\"\n class=\"v-date-picker-weekday\"\n role=\"columnheader\"\n :aria-label=\"weekdaysLong[i]\"\n >{{ w }}</span\n >\n </div>\n <div v-for=\"(week, wi) in weeks\" :key=\"wi\" class=\"v-date-picker-week\" role=\"row\">\n <div\n v-for=\"cell in week\"\n :key=\"cell.iso\"\n class=\"v-date-picker-cell\"\n role=\"gridcell\"\n :aria-selected=\"cell.kind === 'button' ? cell.committed : undefined\"\n :data-in-range=\"cell.inRange ? '' : undefined\"\n :data-range-start=\"cell.rangeStart ? '' : undefined\"\n :data-range-end=\"cell.rangeEnd ? '' : undefined\"\n >\n <button\n v-if=\"cell.kind === 'button'\"\n :id=\"dayId(cell.iso)\"\n type=\"button\"\n class=\"v-date-picker-day\"\n :tabindex=\"cell.iso === focusedISO ? 0 : -1\"\n :data-outside=\"!cell.inMonth ? '' : undefined\"\n :data-selected=\"cell.selected ? '' : undefined\"\n :data-today=\"cell.today ? '' : undefined\"\n :data-unavailable=\"cell.disabled ? '' : undefined\"\n :disabled=\"disabled\"\n :aria-disabled=\"cell.disabled || readonly ? 'true' : undefined\"\n :aria-current=\"cell.today ? 'date' : undefined\"\n @click=\"selectDay(cell)\"\n @pointerenter=\"hoverISO = cell.iso\"\n @focus=\"hoverISO = cell.iso\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n <!-- The dots are hidden from assistive technology, so what they stand for is\n spoken here, as part of the day's name. -->\n <span v-if=\"cell.eventText\" class=\"v-visually-hidden\">, {{ cell.eventText }}</span>\n <span v-if=\"cell.dots.length\" class=\"v-date-picker-dots\" aria-hidden=\"true\">\n <span\n v-for=\"(ev, ei) in cell.dots\"\n :key=\"ei\"\n class=\"v-date-picker-dot\"\n :style=\"ev.color ? { '--date-picker-dot-color': ev.color } : undefined\"\n />\n </span>\n </button>\n <!--\n A day of a neighbouring month that cannot be selected. It renders the very same slot\n as the clickable days: were it left with the bare number, custom content taking\n several lines would apply to this month's days only, and the numbers would stop\n lining up from one cell to the next.\n -->\n <span\n v-else-if=\"cell.kind === 'static'\"\n class=\"v-date-picker-day\"\n data-static\n :data-disabled=\"cell.disabled ? '' : undefined\"\n >\n <slot name=\"day\" v-bind=\"daySlotProps(cell)\">\n <span class=\"v-date-picker-day-num\">{{ cell.day }}</span>\n </slot>\n </span>\n </div>\n </div>\n </div>\n\n <div\n v-if=\"view === 'months'\"\n class=\"v-date-picker-view\"\n role=\"grid\"\n :aria-label=\"m.datePicker.monthPicker\"\n @keydown=\"onMonthsKeydown\"\n >\n <div v-for=\"(row, r) in monthRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"{ name, i } in row\"\n :id=\"`${gridLabelId}-m-${i}`\"\n :key=\"i\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"i === focusedMonth ? 0 : -1\"\n :data-selected=\"i === viewMonth0 ? '' : undefined\"\n :aria-selected=\"i === viewMonth0 ? 'true' : undefined\"\n :aria-label=\"monthNamesLong[i]\"\n :disabled=\"disabled || !monthSelectable(i)\"\n @click=\"chooseMonth(i)\"\n >\n {{ name }}\n </button>\n </div>\n </div>\n\n <div\n v-if=\"view === 'years'\"\n class=\"v-date-picker-view\"\n role=\"grid\"\n :aria-label=\"m.datePicker.yearPicker\"\n @keydown=\"onYearsKeydown\"\n >\n <div v-for=\"(row, r) in yearRows\" :key=\"r\" class=\"v-date-picker-view-row\" role=\"row\">\n <button\n v-for=\"y in row\"\n :id=\"`${gridLabelId}-y-${y}`\"\n :key=\"y\"\n type=\"button\"\n class=\"v-date-picker-view-cell\"\n role=\"gridcell\"\n :tabindex=\"y === focusedYear ? 0 : -1\"\n :data-selected=\"y === viewYear ? '' : undefined\"\n :aria-selected=\"y === viewYear ? 'true' : undefined\"\n :disabled=\"disabled\"\n @click=\"chooseYear(y)\"\n >\n {{ y }}\n </button>\n </div>\n </div>\n\n <div v-if=\"$slots.footer\" class=\"v-date-picker-footer\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-date-picker {\n /*\n * The consumer sets the size of the day disc through its token; the cell around it; the\n * hover area and the width of the column; grows to follow, and never falls below the size\n * the cell token sets.\n */\n --date-picker-cell: max(\n var(--vectis-control-size-date-picker-cell),\n calc(var(--vectis-control-size-date-picker-day) + var(--vectis-space-1))\n );\n display: inline-flex;\n flex-direction: column;\n gap: var(--vectis-space-2);\n padding: var(--vectis-space-3);\n font-family: var(--vectis-text-family);\n color: var(--vectis-color-text);\n }\n\n /*\n * The days grid then fills that width through its 1fr columns, and never goes below the seven\n * cells its own floor guarantees.\n */\n .v-date-picker-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--vectis-space-2);\n }\n\n .v-date-picker-nav {\n display: flex;\n align-items: center;\n }\n\n /* A minimum width holds this button steady, so the chevrons on either side do not\n shift as the month or year label changes length. */\n /* Qualified by an attribute the button always renders: `.v-button` sets its own\n `font-weight` at (0,1,0), and a tie between the two sheets would leave the weight to\n whichever the consumer's bundler put last. */\n .v-date-picker-view-toggle[data-size] {\n min-inline-size: var(--vectis-control-size-date-picker-nav-min);\n font-weight: var(--vectis-font-weight-semibold);\n text-transform: capitalize;\n }\n\n /*\n * The days grid can never be narrower than seven cells. Above that floor it takes whatever\n * width the calendar has; set by the header; and the 1fr columns share it out equally.\n */\n .v-date-picker-grid {\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n\n .v-date-picker-weekdays,\n .v-date-picker-week {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n }\n\n .v-date-picker-weekday {\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--vectis-control-height-sm);\n /* A column micro-header, which takes the overline type role. The casing stays\n `capitalize`, the calendar convention, rather than the full capitals the\n VTypography overline variant would apply. */\n font-size: var(--vectis-text-overline-size);\n font-weight: var(--vectis-text-overline-weight);\n letter-spacing: var(--vectis-text-overline-tracking);\n color: var(--vectis-color-text-muted);\n text-transform: capitalize;\n }\n\n .v-date-picker-cell {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: var(--date-picker-cell);\n }\n\n /*\n * The two cap rules below only shape a pseudo-element that `[data-in-range]` has already\n * created, so they depend on `isInRange` counting both ends of the period as inside it. Make\n * it exclusive and there is no `::before` to cap: both rounded ends of every range vanish,\n * leaving a band that stops square one cell short at each side, with nothing in the console.\n */\n .v-date-picker-cell[data-in-range]::before {\n content: '';\n position: absolute;\n inset-block: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n inset-inline: 0;\n background: var(--vectis-color-accent-surface);\n z-index: 0;\n }\n .v-date-picker-cell[data-range-start]::before {\n inset-inline-start: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-start-radius: var(--vectis-radius-pill);\n border-end-start-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-end]::before {\n inset-inline-end: calc((100% - var(--vectis-control-size-date-picker-day)) / 2);\n border-start-end-radius: var(--vectis-radius-pill);\n border-end-end-radius: var(--vectis-radius-pill);\n }\n .v-date-picker-cell[data-range-start][data-range-end]::before {\n content: none;\n }\n\n .v-date-picker-day {\n position: relative;\n z-index: 1;\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: var(--vectis-control-size-date-picker-day);\n block-size: var(--vectis-control-size-date-picker-day);\n padding: 0;\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n cursor: pointer;\n transition:\n background-color var(--vectis-duration-fast) var(--vectis-ease-default),\n color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n /* Hover belongs to the days one can actually click: not the disabled ones, not the\n already selected ones, and not the neighbouring days rendered as plain spans. */\n .v-date-picker-day:hover:not(:disabled):not([aria-disabled='true']):not([data-selected]):not(\n [data-static]\n ) {\n background: var(--vectis-color-surface-muted);\n }\n\n .v-date-picker-day[data-outside] {\n color: var(--vectis-color-text-subtle);\n }\n\n /*\n * The semibold in the two rules below marks a state; today, and the selection; and is not a\n * typographic role, which is why it reads a font token directly.\n */\n .v-date-picker-day[data-today]:not([data-selected]) {\n box-shadow: inset 0 0 0 1px var(--vectis-color-accent-border);\n color: var(--vectis-color-accent-text);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n .v-date-picker-day[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n\n /*\n * It hangs on its own attribute rather than on `aria-disabled`, which a read-only calendar\n * also carries on every day: nothing can be chosen there, but the dates themselves are\n * perfectly available and striking them all out would say the opposite. The hover rule below\n * still reads `aria-disabled`, so neither highlights.\n */\n .v-date-picker-day[data-unavailable] {\n color: var(--vectis-color-text-subtle);\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker[data-readonly] .v-date-picker-day:not([data-unavailable]) {\n cursor: default;\n }\n\n /* A disabled calendar greys out through the colour tokens and never through opacity,\n the selection included: left in the accent colour it would go on looking live. */\n .v-date-picker-day:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n\n .v-date-picker[data-disabled] .v-date-picker-day[data-selected] {\n background: var(--vectis-color-surface-muted);\n color: var(--vectis-color-text-subtle);\n }\n\n .v-date-picker-day[data-static] {\n color: var(--vectis-color-text-subtle);\n cursor: default;\n }\n\n /* A neighbouring day that falls outside the bounds, or is disabled, is struck\n through like any other unavailable date. */\n .v-date-picker-day[data-static][data-disabled] {\n text-decoration: line-through;\n cursor: not-allowed;\n }\n\n .v-date-picker-day:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: var(--vectis-focus-ring-offset);\n }\n\n .v-date-picker-day-num {\n line-height: var(--vectis-text-control-leading);\n }\n\n .v-date-picker-dots {\n position: absolute;\n /* Half a dot, below them and between them: the spacing scale has no step that small. */\n inset-block-end: calc(var(--vectis-control-size-date-picker-dot) / 2);\n display: flex;\n gap: calc(var(--vectis-control-size-date-picker-dot) / 2);\n }\n .v-date-picker-dot {\n inline-size: var(--vectis-control-size-date-picker-dot);\n block-size: var(--vectis-control-size-date-picker-dot);\n border-radius: var(--vectis-radius-pill);\n /* A longhand: an event's colour can come from untrusted data, and must not load a `url()`. */\n background-color: var(--date-picker-dot-color, var(--vectis-color-accent));\n }\n .v-date-picker-day[data-selected] .v-date-picker-dot {\n background: var(--vectis-color-text-on-accent);\n }\n\n /* The months and years views. They fill the calendar's width exactly like the days\n grid does: stretched by the flex column, then shared out by 1fr columns. */\n .v-date-picker-view {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: var(--vectis-space-1);\n min-inline-size: calc(7 * var(--date-picker-cell));\n }\n /* The rows ARIA requires inside a grid, made invisible to the layout: with\n `display: contents` the cells remain direct grid items of `.v-date-picker-view`,\n so the columns line up as if the rows were not there. */\n .v-date-picker-view-row {\n display: contents;\n }\n\n .v-date-picker[data-view='years'] .v-date-picker-view {\n max-block-size: calc(6 * var(--date-picker-cell));\n overflow-y: auto;\n }\n\n .v-date-picker-view-cell {\n display: flex;\n align-items: center;\n justify-content: center;\n block-size: var(--vectis-control-height-lg);\n border: none;\n border-radius: var(--vectis-radius-pill);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--vectis-text-body-md-size);\n text-transform: capitalize;\n cursor: pointer;\n transition: background-color var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n .v-date-picker-view-cell:hover:not(:disabled):not([data-selected]) {\n background: var(--vectis-color-surface-muted);\n }\n .v-date-picker-view-cell[data-selected] {\n background: var(--vectis-color-accent);\n color: var(--vectis-color-text-on-accent);\n font-weight: var(--vectis-font-weight-semibold);\n }\n .v-date-picker-view-cell:disabled {\n color: var(--vectis-color-text-subtle);\n cursor: not-allowed;\n }\n .v-date-picker-view-cell:focus-visible {\n outline: var(--vectis-focus-ring-width) solid var(--vectis-focus-ring-color);\n outline-offset: calc(-1 * var(--vectis-focus-ring-width));\n }\n\n .v-date-picker-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--vectis-space-2);\n padding-block-start: var(--vectis-space-2);\n border-block-start: 1px solid var(--vectis-color-border);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-date-picker-day,\n .v-date-picker-view-cell {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiKA,IAAMmD,IAAQC,GAmBRC,IAAQpD,GAA4BmD,GAAA,YAAkB,GAEtDG,KAAOL,IAmBPM,IAAcC,GAAM,GAIpBC,IAAIC,EAAY,GAIhBC,KAAYC,QAAmBV,EAAM,SAASO,EAAE,MAAM,WAAW,KAAK,GACtEI,IAAiBC,QAAwBZ,EAAM,MAAM;EAG3D,AAAIa,KAAS,CAACC,GAAOC,IAAc,EAAK,KACtCC,SAAkB;GAChB,AAAIhB,EAAM,OAAOA,EAAM,OAAOiB,EAAWjB,EAAM,KAAKA,EAAM,GAAG,IAAI,KAC/D,QAAQ,KACN,sBAAsBA,EAAM,IAAI,qBAAqBA,EAAM,IAAI,6BACjE;EACJ,CAAC;EAGH,IAAMkB,IAAmBC,QACjBnB,EAAM,kBAAkBoB,GAAkBT,EAAe,KAAK,CACtE,GACMU,KAAWF,QAAeG,GAAaX,EAAe,OAAOO,EAAiB,OAAO,OAAO,CAAC,GAC7FK,KAAeJ,QACnBG,GAAaX,EAAe,OAAOO,EAAiB,OAAO,MAAM,CACnE,GACMM,KAAcL,QAAeM,GAAkBd,EAAe,KAAK,CAAC,GAEpEe,KAAiBP,QAAeQ,GAAWhB,EAAe,KAAK,CAAC,GAEhEiB,IAAcT,QAClBnB,EAAM,cAAc,YAAY,OAAOE,EAAM,SAAU,YAAY2B,EAAW3B,EAAM,KAAK,IACrFA,EAAM,QACN,IACN,GACM4B,IAAaX,QAEfnB,EAAM,cAAc,WACpBE,EAAM,SACN,OAAOA,EAAM,SAAU,YACvB,CAAC,MAAM,QAAQA,EAAM,KAA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