{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "month-calendar",
  "type": "registry:ui",
  "title": "Month Calendar",
  "dependencies": [
    "@base-ui-next/react",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json",
    "https://hamur.dev/r/react/button.json"
  ],
  "files": [
    {
      "path": "react/month-calendar.tsx",
      "content": "'use client'\n\nimport * as React from 'react' // base-ui-next/ui month-calendar@0.1.1\nimport { MonthCalendar as MonthCalendarPrimitive } from '@base-ui-next/react/month-calendar'\nimport type { VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { buttonVariants } from '@/components/ui/button'\n\nconst monthCalendarClassName =\n  'group/month-calendar w-fit bg-background p-3 in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent in-data-[slot=month-picker-popup]:bg-transparent in-data-[slot=month-range-picker-popup]:bg-transparent'\n\nconst monthCalendarPagesClassName = 'relative flex flex-col gap-4 md:flex-row'\n\nconst monthCalendarNavClassName =\n  'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1'\n\nconst monthCalendarNavButtonClassName = 'size-8 p-0 select-none aria-disabled:opacity-50'\n\nconst monthCalendarNavIconClassName = 'size-4 rtl:rotate-180'\n\nconst monthCalendarPageClassName = 'flex w-full flex-col gap-4'\n\nconst monthCalendarCaptionClassName =\n  'flex h-8 w-full items-center justify-center gap-1 px-8'\n\nconst monthCalendarHeadingClassName = 'text-sm font-medium select-none'\n\n/** The ViewTrigger: `buttonVariants` ghost `icon-sm` plus these. */\nconst monthCalendarViewTriggerClassName =\n  '[&_svg]:transition-transform data-[view=year]:[&_svg]:rotate-180'\n\nconst monthCalendarGridClassName = 'w-full border-collapse'\n\nconst monthCalendarRowClassName = 'mt-2 flex w-full first:mt-0'\n\n/** The cell, the focus holder: the range band, the focus ring, the disabled dimming. */\nconst monthCalendarCellClassName =\n  'relative flex h-9 min-w-14 flex-1 items-center justify-center rounded-md p-0 text-center text-sm outline-hidden select-none focus-visible:z-10 focus-visible:ring-[3px] focus-visible:ring-ring/50 data-disabled:opacity-50 data-preview:bg-muted/60 data-preview:not-data-preview-start:rounded-l-none data-preview:not-data-preview-end:rounded-r-none data-in-range:rounded-none data-in-range:bg-muted data-range-start:bg-muted data-range-start:not-data-range-end:rounded-r-none data-range-end:bg-muted data-range-end:not-data-range-start:rounded-l-none'\n\n/** The Month or Year inside the cell: `buttonVariants` ghost plus these. */\nconst monthCalendarPeriodClassName =\n  'relative size-full cursor-pointer rounded-md px-2 font-normal data-selected:not-data-in-range:bg-primary data-selected:not-data-in-range:text-primary-foreground data-selected:not-data-in-range:hover:bg-primary data-selected:not-data-in-range:hover:text-primary-foreground data-in-range:rounded-none data-unavailable:line-through data-disabled:cursor-default data-current:after:absolute data-current:after:bottom-1 data-current:after:left-1/2 data-current:after:h-0.5 data-current:after:w-4 data-current:after:-translate-x-1/2 data-current:after:rounded-full data-current:after:bg-current data-has-selection:before:absolute data-has-selection:before:bottom-1 data-has-selection:before:left-1/2 data-has-selection:before:size-1 data-has-selection:before:-translate-x-1/2 data-has-selection:before:rounded-full data-has-selection:before:bg-current data-current:data-has-selection:before:bottom-2'\n\ntype ButtonVariants = VariantProps<typeof buttonVariants>\n\n// lucide's icons, inline and hidden from assistive technology (10 · As built, BN-309).\nfunction SvgIcon({ children, ...props }: React.ComponentProps<'svg'>) {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden=\"true\"\n      {...props}\n    >\n      {children}\n    </svg>\n  )\n}\n\ntype MonthCalendarContentProps = {\n  /** How many years to draw: the `visibleYears` of the Root. */\n  years?: number\n  buttonVariant?: ButtonVariants['variant']\n}\n\n// No shadcn item: one name per Base UI part (docs/design/log/month-year-picker.md). The header and\n// the grids of the Root, shared by MonthRangeCalendar and the month pickers' calendars.\nfunction MonthCalendarContent({ years = 1, buttonVariant = 'ghost' }: MonthCalendarContentProps) {\n  return (\n    <div data-slot=\"month-calendar-pages\" className={monthCalendarPagesClassName}>\n      <div data-slot=\"month-calendar-nav\" className={monthCalendarNavClassName}>\n        <MonthCalendarPrevButton variant={buttonVariant} />\n        <MonthCalendarNextButton variant={buttonVariant} />\n      </div>\n      {Array.from({ length: years }, (_, offset) => (\n        <div key={offset} data-slot=\"month-calendar-page\" className={monthCalendarPageClassName}>\n          <div data-slot=\"month-calendar-caption\" className={monthCalendarCaptionClassName}>\n            <MonthCalendarHeading offset={offset} />\n            {offset === 0 ? <MonthCalendarViewTrigger /> : null}\n          </div>\n          <MonthCalendarMonthGrid offset={offset} />\n          <MonthCalendarYearGrid offset={offset} />\n        </div>\n      ))}\n    </div>\n  )\n}\n\ntype MonthCalendarProps<Multiple extends boolean | undefined = false> =\n  MonthCalendarPrimitive.Root.Props<Multiple> & Pick<MonthCalendarContentProps, 'buttonVariant'>\n\nfunction MonthCalendar<Multiple extends boolean | undefined = false>({\n  className,\n  children,\n  buttonVariant,\n  ...props\n}: MonthCalendarProps<Multiple>) {\n  return (\n    <MonthCalendarPrimitive.Root\n      data-slot=\"month-calendar\"\n      className={cn(monthCalendarClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <MonthCalendarContent years={props.visibleYears} buttonVariant={buttonVariant} />\n      )}\n    </MonthCalendarPrimitive.Root>\n  )\n}\n\n/** A ghost button with lucide's ChevronLeft; Base UI names it. */\nfunction MonthCalendarPrevButton({\n  className,\n  children,\n  variant = 'ghost',\n  ...props\n}: MonthCalendarPrimitive.PrevButton.Props & Pick<ButtonVariants, 'variant'>) {\n  return (\n    <MonthCalendarPrimitive.PrevButton\n      data-slot=\"month-calendar-prev-button\"\n      className={cn(buttonVariants({ variant }), monthCalendarNavButtonClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon className={monthCalendarNavIconClassName}>\n          <path d=\"m15 18-6-6 6-6\" />\n        </SvgIcon>\n      )}\n    </MonthCalendarPrimitive.PrevButton>\n  )\n}\n\n/** A ghost button with lucide's ChevronRight; Base UI names it. */\nfunction MonthCalendarNextButton({\n  className,\n  children,\n  variant = 'ghost',\n  ...props\n}: MonthCalendarPrimitive.NextButton.Props & Pick<ButtonVariants, 'variant'>) {\n  return (\n    <MonthCalendarPrimitive.NextButton\n      data-slot=\"month-calendar-next-button\"\n      className={cn(buttonVariants({ variant }), monthCalendarNavButtonClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon className={monthCalendarNavIconClassName}>\n          <path d=\"m9 18 6-6-6-6\" />\n        </SvgIcon>\n      )}\n    </MonthCalendarPrimitive.NextButton>\n  )\n}\n\nfunction MonthCalendarHeading({ className, ...props }: MonthCalendarPrimitive.Heading.Props) {\n  return (\n    <MonthCalendarPrimitive.Heading\n      data-slot=\"month-calendar-heading\"\n      className={cn(monthCalendarHeadingClassName, className)}\n      {...props}\n    />\n  )\n}\n\n/** A ghost icon button with lucide's ChevronDown, turned over while the year grid shows. */\nfunction MonthCalendarViewTrigger({\n  className,\n  children,\n  ...props\n}: MonthCalendarPrimitive.ViewTrigger.Props) {\n  return (\n    <MonthCalendarPrimitive.ViewTrigger\n      data-slot=\"month-calendar-view-trigger\"\n      className={cn(\n        buttonVariants({ variant: 'ghost', size: 'icon-sm' }),\n        monthCalendarViewTriggerClassName,\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon>\n          <path d=\"m6 9 6 6 6-6\" />\n        </SvgIcon>\n      )}\n    </MonthCalendarPrimitive.ViewTrigger>\n  )\n}\n\n/** Without children it draws the twelve months, styled, in rows of the Root's `columns`. */\nfunction MonthCalendarMonthGrid({\n  className,\n  children,\n  ...props\n}: MonthCalendarPrimitive.MonthGrid.Props) {\n  return (\n    <MonthCalendarPrimitive.MonthGrid\n      data-slot=\"month-calendar-month-grid\"\n      className={cn(monthCalendarGridClassName, className)}\n      {...props}\n    >\n      {children ??\n        ((grid) => (\n          <MonthCalendarGridBody>\n            {grid.rows.map((row, index) => (\n              <MonthCalendarGridRow key={index}>\n                {row.map((entry) => (\n                  <MonthCalendarCell key={entry.month} month={entry.month}>\n                    <MonthCalendarMonth />\n                  </MonthCalendarCell>\n                ))}\n              </MonthCalendarGridRow>\n            ))}\n          </MonthCalendarGridBody>\n        ))}\n    </MonthCalendarPrimitive.MonthGrid>\n  )\n}\n\n/** Without children it draws the page of years, styled, in rows of the Root's `columns`. */\nfunction MonthCalendarYearGrid({\n  className,\n  children,\n  ...props\n}: MonthCalendarPrimitive.YearGrid.Props) {\n  return (\n    <MonthCalendarPrimitive.YearGrid\n      data-slot=\"month-calendar-year-grid\"\n      className={cn(monthCalendarGridClassName, className)}\n      {...props}\n    >\n      {children ??\n        ((grid) => (\n          <MonthCalendarGridBody>\n            {grid.rows.map((row, index) => (\n              <MonthCalendarGridRow key={index}>\n                {row.map((entry) => (\n                  <MonthCalendarCell key={entry.year} year={entry.year}>\n                    <MonthCalendarYear />\n                  </MonthCalendarCell>\n                ))}\n              </MonthCalendarGridRow>\n            ))}\n          </MonthCalendarGridBody>\n        ))}\n    </MonthCalendarPrimitive.YearGrid>\n  )\n}\n\nfunction MonthCalendarGridBody(props: MonthCalendarPrimitive.GridBody.Props) {\n  return <MonthCalendarPrimitive.GridBody data-slot=\"month-calendar-grid-body\" {...props} />\n}\n\nfunction MonthCalendarGridRow({ className, ...props }: MonthCalendarPrimitive.GridRow.Props) {\n  return (\n    <MonthCalendarPrimitive.GridRow\n      data-slot=\"month-calendar-grid-row\"\n      className={cn(monthCalendarRowClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction MonthCalendarCell({ className, ...props }: MonthCalendarPrimitive.Cell.Props) {\n  return (\n    <MonthCalendarPrimitive.Cell\n      data-slot=\"month-calendar-cell\"\n      className={cn(monthCalendarCellClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction MonthCalendarMonth({ className, ...props }: MonthCalendarPrimitive.Month.Props) {\n  return (\n    <MonthCalendarPrimitive.Month\n      data-slot=\"month-calendar-month\"\n      className={cn(buttonVariants({ variant: 'ghost' }), monthCalendarPeriodClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction MonthCalendarYear({ className, ...props }: MonthCalendarPrimitive.Year.Props) {\n  return (\n    <MonthCalendarPrimitive.Year\n      data-slot=\"month-calendar-year\"\n      className={cn(buttonVariants({ variant: 'ghost' }), monthCalendarPeriodClassName, className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  MonthCalendar,\n  MonthCalendarCell,\n  MonthCalendarContent,\n  MonthCalendarGridBody,\n  MonthCalendarGridRow,\n  MonthCalendarHeading,\n  MonthCalendarMonth,\n  MonthCalendarMonthGrid,\n  MonthCalendarNextButton,\n  MonthCalendarPrevButton,\n  MonthCalendarViewTrigger,\n  MonthCalendarYear,\n  MonthCalendarYearGrid,\n}\n",
      "type": "registry:ui",
      "target": "@ui/month-calendar.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.1",
      "hash": "0b0f55e332c646c02a89dfa803e74f4fd7b1808f0f21a4ea2fbe9c7209bf9c5d",
      "files": {
        "@ui/month-calendar.tsx": "6aee1bbf0c736d9a397622e6c93cf0f8403ed1f55d3b059a6146857d1546943b"
      }
    }
  }
}
