{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "calendar",
  "type": "registry:ui",
  "title": "Calendar",
  "description": "Calendar lets the user pick a single date or a date range.",
  "dependencies": [
    "@remixicon/react@^4.9.0",
    "class-variance-authority@^0.7.1",
    "date-fns@^4.1.0",
    "react-day-picker@^9.11.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/button.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/popup.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/calendar/Calendar.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/Calendar.tsx",
      "content": "'use client';\n\nimport { startOfMonth } from 'date-fns';\nimport * as React from 'react';\nimport { DayPicker } from 'react-day-picker';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport type { CalendarProps } from './Calendar.types';\nimport { calendarClassNames, calendarMotionVariants } from './Calendar.variants';\nimport { CalendarFooter } from './CalendarFooter';\nimport { CalendarMonthCaption } from './CalendarMonthCaption';\n\nconst getInitialMonth = (props: CalendarProps, defaultMonth?: Date): Date => {\n  if (defaultMonth) return startOfMonth(defaultMonth);\n\n  if (props.mode === 'range' && props.selected?.from instanceof Date) {\n    return startOfMonth(props.selected.from);\n  }\n\n  if (props.mode === 'single' && props.selected instanceof Date) {\n    return startOfMonth(props.selected);\n  }\n\n  return new Date();\n};\n\nconst Calendar = ({\n  className,\n  classNames,\n  showOutsideDays = false,\n  components,\n  footer,\n  yearsPerPage = 16,\n  onMonthSelect,\n  onYearSelect,\n  month: controlledMonth,\n  defaultMonth,\n  onMonthChange,\n  monthCaptionAriaLabels,\n  monthGridLabels,\n  yearGridLabels,\n  defaultMotion,\n  ...props\n}: CalendarProps) => {\n  const motion = useDefaultMotion(defaultMotion);\n  const isControlled = controlledMonth !== undefined;\n  const [internalMonth, setInternalMonth] = React.useState<Date>(\n    () => controlledMonth ?? getInitialMonth(props, defaultMonth),\n  );\n\n  const currentMonth = controlledMonth ?? internalMonth;\n\n  const handleMonthChange = React.useCallback(\n    (nextMonth: Date) => {\n      if (!isControlled) {\n        setInternalMonth(nextMonth);\n      }\n      onMonthChange?.(nextMonth);\n    },\n    [isControlled, onMonthChange],\n  );\n\n  return (\n    <DayPicker\n      month={currentMonth}\n      onMonthChange={handleMonthChange}\n      showOutsideDays={showOutsideDays}\n      hideNavigation\n      className={cn('p-ws-5 w-fit', className)}\n      classNames={Object.fromEntries(\n        Object.entries(calendarClassNames).map(([key, value]) => [\n          key,\n          cn(\n            value,\n            key === 'day_button' && calendarMotionVariants({ enabled: motion }),\n            classNames?.[key as keyof typeof classNames],\n          ),\n        ]),\n      )}\n      components={{\n        MonthCaption: ({ calendarMonth }) => (\n          <CalendarMonthCaption\n            calendarMonth={calendarMonth}\n            displayMonth={currentMonth}\n            numberOfMonths={props.numberOfMonths}\n            onMonthChange={handleMonthChange}\n            onMonthSelect={onMonthSelect}\n            onYearSelect={onYearSelect}\n            yearsPerPage={yearsPerPage}\n            ariaLabels={monthCaptionAriaLabels}\n            monthGridLabels={monthGridLabels}\n            yearGridLabels={yearGridLabels}\n            defaultMotion={motion}\n          />\n        ),\n        ...components,\n      }}\n      footer={footer && <CalendarFooter footer={footer} />}\n      data-slot=\"calendar\"\n      {...props}\n    />\n  );\n};\nCalendar.displayName = 'Calendar';\n\nexport { Calendar };\n"
    },
    {
      "path": "src/components/calendar/Calendar.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/Calendar.types.ts",
      "content": "import type * as React from 'react';\nimport type { CalendarMonth, DayPickerProps } from 'react-day-picker';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\n\n/** A date selection calendar with month and year navigation. */\nexport type CalendarProps = DayPickerProps &\n  MotionProps & {\n    /** Number of years shown per page in the year picker popover. Defaults to 16. */\n    yearsPerPage?: number;\n    /** Fired when a month is picked from the month popover. Receives the month index (0–11). */\n    onMonthSelect?: (month: number) => void;\n    /** Fired when a year is picked from the year popover. Receives the four-digit year. */\n    onYearSelect?: (year: number) => void;\n    /** Accessible labels for the month caption navigation buttons and pickers. */\n    monthCaptionAriaLabels?: {\n      /** Accessible label for navigation to the previous year. */\n      prevYear?: string;\n      /** Accessible label for navigation to the previous month. */\n      prevMonth?: string;\n      /** Accessible label for the month picker trigger. */\n      selectMonth?: string;\n      /** Accessible label for the year picker trigger. */\n      selectYear?: string;\n      /** Accessible label for navigation to the next month. */\n      nextMonth?: string;\n      /** Accessible label for navigation to the next year. */\n      nextYear?: string;\n    };\n    /** Labels for the month grid picker. */\n    monthGridLabels?: {\n      /** Title shown above the month grid. Defaults to `'Select month'`. */\n      title?: string;\n      /** Accessible label for the month listbox. Defaults to `'Month selection'`. */\n      ariaLabel?: string;\n      /** 12-element array of month abbreviations. Defaults to `['Jan', 'Feb', …, 'Dec']`. */\n      months?: string[];\n    };\n    /** Labels for the year grid picker. */\n    yearGridLabels?: {\n      /** Title shown above the year grid. Defaults to `'Select year'`. */\n      title?: string;\n      /** Accessible label for the year listbox. Defaults to `'Year selection'`. */\n      ariaLabel?: string;\n      /** Accessible label for the previous-years button. Defaults to `'Previous years'`. */\n      prevYears?: string;\n      /** Accessible label for the next-years button. Defaults to `'Next years'`. */\n      nextYears?: string;\n    };\n  };\n\n/** The month and year caption with navigation controls. */\nexport type CalendarMonthCaptionProps = MotionProps & {\n  /** The month being rendered, as provided by react-day-picker. */\n  calendarMonth: CalendarMonth;\n  /** The first displayed month. Navigation is always computed relative to it so all months move together. */\n  displayMonth: Date;\n  /** Total number of months shown side by side. Defaults to 1. */\n  numberOfMonths?: number;\n  /** Fired when the displayed month changes (e.g. via month/year picker selection). */\n  onMonthChange: (date: Date) => void;\n  /** Fired when a month is picked from the month popover. Receives the month index (0–11). */\n  onMonthSelect?: (month: number) => void;\n  /** Fired when a year is picked from the year popover. Receives the four-digit year. */\n  onYearSelect?: (year: number) => void;\n  /** Number of years shown per page in the year picker popover. Defaults to 16. */\n  yearsPerPage?: number;\n  /** Accessible labels for the navigation buttons and picker triggers. */\n  ariaLabels?: CalendarProps['monthCaptionAriaLabels'];\n  /** Labels forwarded to the month grid picker. */\n  monthGridLabels?: CalendarProps['monthGridLabels'];\n  /** Labels forwarded to the year grid picker. */\n  yearGridLabels?: CalendarProps['yearGridLabels'];\n};\n\n/** A month selection grid. */\nexport type CalendarMonthGridProps = MotionProps & {\n  /** Currently selected month index (0–11), used to highlight the active cell. */\n  selectedMonth?: number;\n  /** Fired when a month cell is clicked. Receives the month index (0–11). */\n  onMonthSelect?: (month: number) => void;\n  /** Title shown above the month grid. Defaults to `'Select month'`. */\n  title?: string;\n  /** Accessible label for the month listbox. Defaults to `'Month selection'`. */\n  ariaLabel?: string;\n  /** 12-element array of month abbreviations. Defaults to `['Jan', 'Feb', …, 'Dec']`. */\n  months?: string[];\n};\n\n/** A year selection grid. */\nexport type CalendarYearGridProps = MotionProps & {\n  /** Anchor year used to compute the visible year page. */\n  baseYear: number;\n  /** Currently selected year, used to highlight the active cell. */\n  selectedYear?: number;\n  /** Number of years shown per page. Defaults to 16. */\n  yearsPerPage?: number;\n  /** Fired when a year cell is clicked. Receives the four-digit year. */\n  onYearSelect?: (year: number) => void;\n  /** Title shown above the year grid. Defaults to `'Select year'`. */\n  title?: string;\n  /** Accessible label for the year listbox. Defaults to `'Year selection'`. */\n  ariaLabel?: string;\n  /** Accessible label for the previous-years button. Defaults to `'Previous years'`. */\n  prevYearsAriaLabel?: string;\n  /** Accessible label for the next-years button. Defaults to `'Next years'`. */\n  nextYearsAriaLabel?: string;\n};\n\n/** The action area beneath the main content. */\nexport type CalendarFooterProps = {\n  /** Footer content rendered below the calendar grid. */\n  footer: React.ReactNode;\n};\n"
    },
    {
      "path": "src/components/calendar/Calendar.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/Calendar.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { hoverTintMotion, pressMotion } from '@/lib/wideset/motion/recipes';\n\nexport const calendarClassNames = {\n  chevron: 'hidden',\n  months: 'flex flex-row gap-ws-12',\n  weekdays: 'h-ws-14',\n  weekday: 'typography-caption-md text-ws-static-subtle text-center w-ws-16 h-ws-14 p-0',\n  month_grid: 'w-full border-collapse',\n  hidden: '!invisible !bg-transparent before:!bg-transparent',\n  day: 'size-ws-16 p-0 text-center',\n  day_button: cn(\n    'flex h-full w-full cursor-pointer items-center justify-center rounded-full',\n    'text-ws-static-subtle typography-number-md',\n    'hover:bg-ws-dynamic-secondary-alpha-hover active:bg-ws-dynamic-secondary-alpha-pressed',\n    'disabled:cursor-default disabled:opacity-50 disabled:hover:bg-transparent disabled:active:bg-transparent',\n    'focus-visible:wds-focus-visible focus-visible:outline-ws-dynamic-primary-strong-default',\n  ),\n  range_start: cn(\n    'relative',\n    'before:bg-ws-dynamic-primary-alpha-strong-default before:absolute before:inset-y-0 before:right-0 before:left-1/2',\n    '[&>button]:z-ws-base [&>button]:relative',\n  ),\n  range_end: cn(\n    'relative',\n    'before:bg-ws-dynamic-primary-alpha-strong-default before:absolute before:inset-y-0 before:right-1/2 before:left-0',\n    '[&>button]:z-ws-base [&>button]:relative',\n  ),\n  range_middle: cn(\n    'range-middle bg-ws-dynamic-primary-alpha-strong-default rounded-none',\n    '[&>button]:text-ws-dynamic-primary-default',\n  ),\n  selected: cn(\n    '[&:not(.range-middle)>button]:typography-number-strong-md',\n    '[&:not(.range-middle)>button]:bg-ws-dynamic-primary-default',\n    '[&:not(.range-middle)>button]:text-ws-dynamic-on-primary-default',\n    '[&:not(.range-middle)>button]:hover:bg-ws-dynamic-primary-hover',\n    '[&:not(.range-middle)>button]:hover:text-ws-dynamic-on-primary-hover',\n    '[&:not(.range-middle)>button]:active:bg-ws-dynamic-primary-pressed',\n    '[&:not(.range-middle)>button]:active:text-ws-dynamic-on-primary-pressed',\n  ),\n  today: cn(\n    '[&>button]:typography-number-strong-md',\n    '[&>button]:border-ws-dynamic-primary-strong-default [&>button]:border',\n    '[&>button]:text-ws-dynamic-primary-default [&>button]:rounded-full',\n    '[&>button]:hover:border-ws-dynamic-primary-strong-hover [&>button]:active:border-ws-dynamic-primary-strong-pressed',\n    '[&>button]:hover:bg-ws-dynamic-primary-alpha-hover [&>button]:active:bg-ws-dynamic-primary-alpha-pressed [&>button]:hover:text-ws-dynamic-primary-hover [&>button]:active:text-ws-dynamic-primary-pressed',\n  ),\n  disabled: 'text-ws-dynamic-secondary-disabled',\n};\n\nexport const calendarFooterClassName =\n  'text-ws-static-subtle typography-caption-md mt-ws-7 px-ws-7 pb-ws-5 w-0 min-w-full text-center break-words';\n\nexport const calendarGridCellClassName = cn(\n  'typography-label-md rounded-ws-control-lg h-ws-16 flex items-center justify-center',\n  'text-ws-static-subtle',\n  'hover:bg-ws-dynamic-secondary-alpha-hover active:bg-ws-dynamic-secondary-alpha-pressed',\n  'focus-visible:wds-focus-visible focus-visible:outline-ws-dynamic-primary-strong-default',\n);\n\nexport const calendarGridCellSelectedClassName = cn(\n  'border-ws-dynamic-primary-strong-default text-ws-dynamic-primary-default border',\n  'hover:bg-ws-dynamic-primary-alpha-hover active:bg-ws-dynamic-primary-alpha-pressed hover:text-ws-dynamic-primary-hover active:text-ws-dynamic-primary-pressed',\n);\n\nexport const calendarMotionVariants = cva('', {\n  variants: {\n    enabled: { true: cn(hoverTintMotion, pressMotion), false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n"
    },
    {
      "path": "src/components/calendar/CalendarFooter.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/CalendarFooter.tsx",
      "content": "'use client';\n\nimport type { CalendarFooterProps } from './Calendar.types';\nimport { calendarFooterClassName } from './Calendar.variants';\n\nconst CalendarFooter = ({ footer }: CalendarFooterProps) => {\n  if (typeof footer === 'string') {\n    return (\n      <div data-slot=\"calendar-footer\" className={calendarFooterClassName}>\n        {footer}\n      </div>\n    );\n  }\n\n  return <>{footer}</>;\n};\n\nCalendarFooter.displayName = 'CalendarFooter';\n\nexport { CalendarFooter };\n"
    },
    {
      "path": "src/components/calendar/CalendarMonthCaption.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/CalendarMonthCaption.tsx",
      "content": "'use client';\n\nimport {\n  RiArrowLeftDoubleLine,\n  RiArrowLeftSLine,\n  RiArrowRightDoubleLine,\n  RiArrowRightSLine,\n} from '@remixicon/react';\nimport { addMonths, format, isSameMonth, startOfMonth } from 'date-fns';\nimport { useState } from 'react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { Popup } from '@/components/ui/wideset/popup/Popup';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport type { CalendarMonthCaptionProps } from './Calendar.types';\nimport { CalendarMonthGrid } from './CalendarMonthGrid';\nimport { CalendarYearGrid } from './CalendarYearGrid';\n\nconst CalendarMonthCaption = ({\n  calendarMonth,\n  displayMonth,\n  numberOfMonths = 1,\n  onMonthChange,\n  onMonthSelect,\n  onYearSelect,\n  yearsPerPage = 16,\n  ariaLabels,\n  monthGridLabels,\n  yearGridLabels,\n  defaultMotion,\n}: CalendarMonthCaptionProps) => {\n  const motion = useDefaultMotion(defaultMotion);\n  const [isMonthPickerOpen, setIsMonthPickerOpen] = useState(false);\n  const [isYearPickerOpen, setIsYearPickerOpen] = useState(false);\n\n  const isPickerVisible = isMonthPickerOpen || isYearPickerOpen;\n  const date = calendarMonth.date;\n\n  const firstMonth = startOfMonth(displayMonth);\n  const isFirstMonth = isSameMonth(date, firstMonth);\n  const isLastMonth = isSameMonth(date, addMonths(firstMonth, numberOfMonths - 1));\n\n  const handleMonthPickerOpenChange = (open: boolean) => {\n    setIsMonthPickerOpen(open);\n    if (open) setIsYearPickerOpen(false);\n  };\n\n  const handleYearPickerOpenChange = (open: boolean) => {\n    setIsYearPickerOpen(open);\n    if (open) setIsMonthPickerOpen(false);\n  };\n\n  const handleMonthSelect = (m: number) => {\n    const next = new Date(date);\n    next.setMonth(m);\n    onMonthChange(next);\n    setIsMonthPickerOpen(false);\n    onMonthSelect?.(m);\n  };\n\n  const handleYearSelect = (y: number) => {\n    const next = new Date(date);\n    next.setFullYear(y);\n    onMonthChange(next);\n    setIsYearPickerOpen(false);\n    onYearSelect?.(y);\n  };\n\n  return (\n    <div\n      data-slot=\"calendar-month-caption\"\n      className=\"h-ws-18 relative flex w-full items-center justify-center\"\n    >\n      {/*\n       * Figma pins 32px arrow buttons at the edges and\n       * centers \"Month Year\" as a single tight label. Month and year stay\n       * separate triggers here (they open different pickers), so they hug with a\n       * word-space gap (px-ws-2 + gap-ws-3) — narrow enough that even the widest\n       * month name (\"September\") clears the arrows without box overlap.\n       */}\n      {!isPickerVisible && isFirstMonth && (\n        <div className=\"left-ws-3 gap-ws-5 absolute flex items-center\">\n          <IconButton\n            icon={RiArrowLeftDoubleLine}\n            preset=\"ghost\"\n            variant=\"secondary\"\n            size=\"sm\"\n            defaultMotion={motion}\n            aria-label={ariaLabels?.prevYear ?? 'Previous year'}\n            onClick={() => onMonthChange(addMonths(firstMonth, -12))}\n          />\n          <IconButton\n            icon={RiArrowLeftSLine}\n            preset=\"ghost\"\n            variant=\"secondary\"\n            size=\"sm\"\n            defaultMotion={motion}\n            aria-label={ariaLabels?.prevMonth ?? 'Previous month'}\n            onClick={() => onMonthChange(addMonths(firstMonth, -1))}\n          />\n        </div>\n      )}\n      <div className=\"gap-ws-3 flex items-center justify-center\">\n        <Popup open={isMonthPickerOpen} onOpenChange={handleMonthPickerOpenChange}>\n          <Popup.Trigger asChild>\n            <Button\n              preset=\"ghost\"\n              variant=\"secondary\"\n              size=\"sm\"\n              defaultMotion={motion}\n              className=\"px-ws-2\"\n              aria-label={ariaLabels?.selectMonth ?? 'Select month'}\n            >\n              {format(date, 'MMMM')}\n            </Button>\n          </Popup.Trigger>\n          <Popup.Container align=\"center\" sideOffset={4} className=\"w-auto\" defaultMotion={motion}>\n            <CalendarMonthGrid\n              selectedMonth={date.getMonth()}\n              onMonthSelect={handleMonthSelect}\n              title={monthGridLabels?.title}\n              ariaLabel={monthGridLabels?.ariaLabel}\n              months={monthGridLabels?.months}\n              defaultMotion={motion}\n            />\n          </Popup.Container>\n        </Popup>\n\n        <Popup open={isYearPickerOpen} onOpenChange={handleYearPickerOpenChange}>\n          <Popup.Trigger asChild>\n            <Button\n              preset=\"ghost\"\n              variant=\"secondary\"\n              size=\"sm\"\n              defaultMotion={motion}\n              className=\"px-ws-2\"\n              aria-label={ariaLabels?.selectYear ?? 'Select year'}\n            >\n              {format(date, 'yyyy')}\n            </Button>\n          </Popup.Trigger>\n          <Popup.Container align=\"center\" sideOffset={4} className=\"w-auto\" defaultMotion={motion}>\n            <CalendarYearGrid\n              baseYear={date.getFullYear()}\n              yearsPerPage={yearsPerPage}\n              selectedYear={date.getFullYear()}\n              onYearSelect={handleYearSelect}\n              title={yearGridLabels?.title}\n              ariaLabel={yearGridLabels?.ariaLabel}\n              prevYearsAriaLabel={yearGridLabels?.prevYears}\n              nextYearsAriaLabel={yearGridLabels?.nextYears}\n              defaultMotion={motion}\n            />\n          </Popup.Container>\n        </Popup>\n      </div>\n      {!isPickerVisible && isLastMonth && (\n        <div className=\"right-ws-3 gap-ws-5 absolute flex items-center\">\n          <IconButton\n            icon={RiArrowRightSLine}\n            preset=\"ghost\"\n            variant=\"secondary\"\n            size=\"sm\"\n            defaultMotion={motion}\n            aria-label={ariaLabels?.nextMonth ?? 'Next month'}\n            onClick={() => onMonthChange(addMonths(firstMonth, 1))}\n          />\n          <IconButton\n            icon={RiArrowRightDoubleLine}\n            preset=\"ghost\"\n            variant=\"secondary\"\n            size=\"sm\"\n            defaultMotion={motion}\n            aria-label={ariaLabels?.nextYear ?? 'Next year'}\n            onClick={() => onMonthChange(addMonths(firstMonth, 12))}\n          />\n        </div>\n      )}\n    </div>\n  );\n};\n\nCalendarMonthCaption.displayName = 'CalendarMonthCaption';\n\nexport { CalendarMonthCaption };\n"
    },
    {
      "path": "src/components/calendar/CalendarMonthGrid.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/CalendarMonthGrid.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport type { CalendarMonthGridProps } from './Calendar.types';\nimport {\n  calendarGridCellClassName,\n  calendarGridCellSelectedClassName,\n  calendarMotionVariants,\n} from './Calendar.variants';\n\nconst DEFAULT_MONTHS = [\n  'Jan',\n  'Feb',\n  'Mar',\n  'Apr',\n  'May',\n  'Jun',\n  'Jul',\n  'Aug',\n  'Sep',\n  'Oct',\n  'Nov',\n  'Dec',\n];\n\nconst CalendarMonthGrid = ({\n  selectedMonth,\n  onMonthSelect,\n  title = 'Select month',\n  ariaLabel = 'Month selection',\n  months = DEFAULT_MONTHS,\n  defaultMotion,\n}: CalendarMonthGridProps) => {\n  const motion = useDefaultMotion(defaultMotion);\n  return (\n    <div data-slot=\"calendar-month-grid\" className=\"p-ws-5\" role=\"listbox\" aria-label={ariaLabel}>\n      <div className=\"text-ws-static-strong typography-body-strong-md h-ws-18 p-ws-3 flex items-center justify-center text-center\">\n        {title}\n      </div>\n      <div className=\"grid min-w-[280px] grid-cols-3\">\n        {months.map((month, index) => {\n          const isSelected = selectedMonth === index;\n\n          return (\n            <button\n              key={month}\n              role=\"option\"\n              type=\"button\"\n              aria-selected={isSelected}\n              onClick={() => onMonthSelect?.(index)}\n              className={cn(\n                calendarGridCellClassName,\n                calendarMotionVariants({ enabled: motion }),\n                isSelected && calendarGridCellSelectedClassName,\n              )}\n            >\n              {month}\n            </button>\n          );\n        })}\n      </div>\n    </div>\n  );\n};\n\nCalendarMonthGrid.displayName = 'CalendarMonthGrid';\n\nexport { CalendarMonthGrid };\n"
    },
    {
      "path": "src/components/calendar/CalendarYearGrid.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/calendar/CalendarYearGrid.tsx",
      "content": "'use client';\n\nimport { RiArrowLeftSLine, RiArrowRightSLine } from '@remixicon/react';\nimport { useState } from 'react';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport type { CalendarYearGridProps } from './Calendar.types';\nimport {\n  calendarGridCellClassName,\n  calendarGridCellSelectedClassName,\n  calendarMotionVariants,\n} from './Calendar.variants';\n\nconst getYearsPage = (displayedYear: number, yearsPerPage: number): number[] => {\n  const startYear = displayedYear - (displayedYear % yearsPerPage);\n\n  return Array.from({ length: yearsPerPage }, (_, i) => startYear + i);\n};\n\nconst CalendarYearGrid = ({\n  baseYear,\n  selectedYear,\n  yearsPerPage = 16,\n  onYearSelect,\n  title = 'Select year',\n  ariaLabel = 'Year selection',\n  prevYearsAriaLabel = 'Previous years',\n  nextYearsAriaLabel = 'Next years',\n  defaultMotion,\n}: CalendarYearGridProps) => {\n  const motion = useDefaultMotion(defaultMotion);\n  const [pageOffset, setPageOffset] = useState(0);\n  const displayedYear = baseYear + pageOffset * yearsPerPage;\n  const years = getYearsPage(displayedYear, yearsPerPage);\n\n  return (\n    <div data-slot=\"calendar-year-grid\" className=\"p-ws-5\" role=\"listbox\" aria-label={ariaLabel}>\n      <div className=\"h-ws-18 gap-ws-5 flex items-center\">\n        <IconButton\n          icon={RiArrowLeftSLine}\n          preset=\"ghost\"\n          variant=\"secondary\"\n          size=\"md\"\n          defaultMotion={motion}\n          aria-label={prevYearsAriaLabel}\n          onClick={() => setPageOffset((prev) => prev - 1)}\n          data-testid=\"prev-year-button\"\n        />\n        <div className=\"text-ws-static-strong typography-body-strong-md p-ws-3 flex grow items-center justify-center text-center\">\n          {title}\n        </div>\n        <IconButton\n          icon={RiArrowRightSLine}\n          preset=\"ghost\"\n          variant=\"secondary\"\n          size=\"md\"\n          defaultMotion={motion}\n          aria-label={nextYearsAriaLabel}\n          onClick={() => setPageOffset((prev) => prev + 1)}\n          data-testid=\"next-year-button\"\n        />\n      </div>\n      <div className=\"grid min-w-[280px] grid-cols-4\">\n        {years.map((year) => {\n          const isSelected = selectedYear === year;\n\n          return (\n            <button\n              key={year}\n              role=\"option\"\n              type=\"button\"\n              aria-selected={isSelected}\n              onClick={() => onYearSelect?.(year)}\n              className={cn(\n                calendarGridCellClassName,\n                calendarMotionVariants({ enabled: motion }),\n                isSelected && calendarGridCellSelectedClassName,\n              )}\n            >\n              {year}\n            </button>\n          );\n        })}\n      </div>\n    </div>\n  );\n};\n\nCalendarYearGrid.displayName = 'CalendarYearGrid';\n\nexport { CalendarYearGrid };\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
