{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "calendar",
  "type": "registry:ui",
  "title": "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/calendar.tsx",
      "content": "'use client'\n\nimport * as React from 'react' // base-ui-next/ui calendar@0.2.1\nimport { Calendar as CalendarPrimitive } from '@base-ui-next/react/calendar'\nimport type { VariantProps } from 'class-variance-authority'\nimport { cn } from '@/lib/utils'\nimport { buttonVariants } from '@/components/ui/button'\n\nconst calendarClassName =\n  'group/calendar w-fit bg-background p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent in-data-[slot=date-picker-popup]:bg-transparent in-data-[slot=date-range-picker-popup]:bg-transparent'\n\nconst calendarMonthsClassName = 'relative flex flex-col gap-4 md:flex-row'\n\nconst calendarNavClassName =\n  'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1'\n\nconst calendarNavButtonClassName =\n  'size-(--cell-size) p-0 select-none aria-disabled:opacity-50'\n\nconst calendarNavIconClassName = 'size-4 rtl:rotate-180'\n\nconst calendarMonthClassName = 'flex w-full flex-col gap-4'\n\nconst calendarHeadingClassName =\n  'flex h-(--cell-size) w-full items-center justify-center px-(--cell-size) text-sm font-medium select-none'\n\nconst calendarGridClassName = 'w-full border-collapse'\n\nconst calendarWeekdaysClassName = 'flex'\n\nconst calendarWeekdayClassName =\n  'flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none'\n\nconst calendarWeekClassName = 'mt-2 flex w-full'\n\n/** The cell: the band of a range, the today ground, the dimmed outside and disabled days. */\nconst calendarCellClassName =\n  'group/day relative aspect-square h-full w-full p-0 text-center outline-hidden select-none aria-hidden:invisible data-today:not-data-selected:rounded-(--cell-radius) data-today:not-data-selected:bg-muted data-today:not-data-selected:text-foreground data-outside-month:text-muted-foreground data-outside-month:aria-selected:text-muted-foreground data-disabled:text-muted-foreground data-disabled:opacity-50 data-unavailable:text-muted-foreground data-unavailable:opacity-50 data-preview:bg-muted/60 data-preview-start:rounded-l-(--cell-radius) data-preview-end:rounded-r-(--cell-radius) data-range-start:relative data-range-start:isolate data-range-start:z-0 data-range-start:rounded-l-(--cell-radius) data-range-start:bg-muted data-range-start:after:absolute data-range-start:after:inset-y-0 data-range-start:after:right-0 data-range-start:after:w-4 data-range-start:after:bg-muted data-range-end:relative data-range-end:isolate data-range-end:z-0 data-range-end:rounded-r-(--cell-radius) data-range-end:bg-muted data-range-end:after:absolute data-range-end:after:inset-y-0 data-range-end:after:left-0 data-range-end:after:w-4 data-range-end:after:bg-muted data-in-range:rounded-none [&:first-child[data-selected]>*]:rounded-l-(--cell-radius) [&:last-child[data-selected]>*]:rounded-r-(--cell-radius)'\n\n/** The day inside the cell: `buttonVariants` ghost icon plus these. */\nconst calendarDayClassName =\n  'relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) cursor-pointer flex-col gap-1 border-0 leading-none font-normal group-focus-visible/day:z-10 group-focus-visible/day:border-ring group-focus-visible/day:ring-[3px] group-focus-visible/day:ring-ring/50 data-selected:not-data-in-range:bg-primary data-selected:not-data-in-range:text-primary-foreground data-range-start:rounded-(--cell-radius) data-range-end:rounded-(--cell-radius) data-in-range:rounded-none data-in-range:bg-muted data-in-range:text-foreground data-unavailable:line-through data-disabled:pointer-events-none dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70'\n\nconst calendarCaptionClassName =\n  'flex h-(--cell-size) w-full items-center justify-center gap-1 px-(--cell-size)'\n\nconst calendarCaptionHeadingClassName = 'text-sm font-medium select-none'\n\n/** The ViewTrigger: `buttonVariants` ghost `icon-sm` plus these. */\nconst calendarViewTriggerClassName =\n  'size-(--cell-size) [&_svg]:transition-transform not-data-[view=day]:[&_svg]:rotate-180'\n\nconst calendarPeriodRowClassName = 'mt-2 flex w-full first:mt-0'\n\n/** The month or year cell, the focus holder: the range band, the focus ring, the disabled dimming. */\nconst calendarPeriodCellClassName =\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 calendarPeriodClassName =\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\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 CalendarContentProps = {\n  /** How many months to draw: the `visibleMonths` of the Root. */\n  months?: number\n  buttonVariant?: VariantProps<typeof buttonVariants>['variant']\n  showOutsideDays?: boolean\n  /** Whether to draw the ViewTrigger and the month and year grids. */\n  views?: boolean\n}\n\n// The header and the grids of the Root, shared by Calendar, RangeCalendar and the pickers' calendars.\nfunction CalendarContent({\n  months = 1,\n  buttonVariant = 'ghost',\n  showOutsideDays = true,\n  views = false,\n}: CalendarContentProps) {\n  const navClassName = cn(buttonVariants({ variant: buttonVariant }), calendarNavButtonClassName)\n  return (\n    <div data-slot=\"calendar-months\" className={calendarMonthsClassName}>\n      <div data-slot=\"calendar-nav\" className={calendarNavClassName}>\n        <CalendarPrimitive.PrevButton data-slot=\"calendar-prev-button\" className={navClassName}>\n          <SvgIcon className={calendarNavIconClassName}>\n            <path d=\"m15 18-6-6 6-6\" />\n          </SvgIcon>\n        </CalendarPrimitive.PrevButton>\n        <CalendarPrimitive.NextButton data-slot=\"calendar-next-button\" className={navClassName}>\n          <SvgIcon className={calendarNavIconClassName}>\n            <path d=\"m9 18 6-6-6-6\" />\n          </SvgIcon>\n        </CalendarPrimitive.NextButton>\n      </div>\n      {Array.from({ length: months }, (_, offset) => (\n        <div key={offset} data-slot=\"calendar-month\" className={calendarMonthClassName}>\n          {views ? (\n            <div data-slot=\"calendar-caption\" className={calendarCaptionClassName}>\n              <CalendarPrimitive.Heading\n                offset={offset}\n                data-slot=\"calendar-heading\"\n                className={calendarCaptionHeadingClassName}\n              />\n              {offset === 0 ? <CalendarViewTrigger /> : null}\n            </div>\n          ) : (\n            <CalendarPrimitive.Heading\n              offset={offset}\n              data-slot=\"calendar-heading\"\n              className={calendarHeadingClassName}\n            />\n          )}\n          <CalendarPrimitive.Grid\n            offset={offset}\n            data-slot=\"calendar-grid\"\n            className={calendarGridClassName}\n          >\n            {(grid) => (\n              <>\n                <CalendarPrimitive.GridHeader>\n                  <CalendarPrimitive.GridRow className={calendarWeekdaysClassName}>\n                    {grid.weekdays.map((weekday) => (\n                      <CalendarPrimitive.HeaderCell\n                        key={weekday.index}\n                        weekday={weekday.index}\n                        data-slot=\"calendar-weekday\"\n                        className={calendarWeekdayClassName}\n                      />\n                    ))}\n                  </CalendarPrimitive.GridRow>\n                </CalendarPrimitive.GridHeader>\n                <CalendarPrimitive.GridBody>\n                  {grid.weeks.map((week, index) => (\n                    <CalendarPrimitive.GridRow key={index} className={calendarWeekClassName}>\n                      {week.map((day) => (\n                        <CalendarPrimitive.Cell\n                          key={day.date}\n                          date={day.date}\n                          data-slot=\"calendar-cell\"\n                          className={cn(\n                            calendarCellClassName,\n                            !showOutsideDays && day.outsideMonth && 'invisible',\n                          )}\n                        >\n                          {showOutsideDays || !day.outsideMonth ? <CalendarDayButton /> : null}\n                        </CalendarPrimitive.Cell>\n                      ))}\n                    </CalendarPrimitive.GridRow>\n                  ))}\n                </CalendarPrimitive.GridBody>\n              </>\n            )}\n          </CalendarPrimitive.Grid>\n          {views ? <CalendarMonthGrid offset={offset} /> : null}\n          {views ? <CalendarYearGrid offset={offset} /> : null}\n        </div>\n      ))}\n    </div>\n  )\n}\n\ntype CalendarProps<Multiple extends boolean | undefined = false> =\n  CalendarPrimitive.Root.Props<Multiple> &\n    Pick<CalendarContentProps, 'buttonVariant' | 'showOutsideDays'>\n\nfunction Calendar<Multiple extends boolean | undefined = false>({\n  className,\n  children,\n  buttonVariant,\n  showOutsideDays,\n  ...props\n}: CalendarProps<Multiple>) {\n  return (\n    <CalendarPrimitive.Root\n      data-slot=\"calendar\"\n      className={cn(calendarClassName, className)}\n      {...props}\n    >\n      {children ?? (\n        <CalendarContent\n          months={props.visibleMonths}\n          buttonVariant={buttonVariant}\n          showOutsideDays={showOutsideDays}\n          views={props.views !== undefined}\n        />\n      )}\n    </CalendarPrimitive.Root>\n  )\n}\n\nfunction CalendarDayButton({ className, ...props }: CalendarPrimitive.Day.Props) {\n  return (\n    <CalendarPrimitive.Day\n      data-slot=\"calendar-day\"\n      className={cn(\n        buttonVariants({ variant: 'ghost', size: 'icon' }),\n        calendarDayClassName,\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\n/** A ghost icon button with lucide's ChevronDown, turned over while a month or year grid shows. */\nfunction CalendarViewTrigger({\n  className,\n  children,\n  ...props\n}: CalendarPrimitive.ViewTrigger.Props) {\n  return (\n    <CalendarPrimitive.ViewTrigger\n      data-slot=\"calendar-view-trigger\"\n      className={cn(\n        buttonVariants({ variant: 'ghost', size: 'icon-sm' }),\n        calendarViewTriggerClassName,\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <SvgIcon>\n          <path d=\"m6 9 6 6 6-6\" />\n        </SvgIcon>\n      )}\n    </CalendarPrimitive.ViewTrigger>\n  )\n}\n\n/** Without children it draws every month of the year, styled, in rows of the Root's `columns`. */\nfunction CalendarMonthGrid({ className, children, ...props }: CalendarPrimitive.MonthGrid.Props) {\n  return (\n    <CalendarPrimitive.MonthGrid\n      data-slot=\"calendar-month-grid\"\n      className={cn(calendarGridClassName, className)}\n      {...props}\n    >\n      {children ??\n        ((grid) => (\n          <CalendarPrimitive.GridBody>\n            {grid.rows.map((row, index) => (\n              <CalendarPrimitive.GridRow key={index} className={calendarPeriodRowClassName}>\n                {row.map((entry) => (\n                  <CalendarPrimitive.Cell\n                    key={entry.month}\n                    month={entry.month}\n                    data-slot=\"calendar-month-cell\"\n                    className={calendarPeriodCellClassName}\n                  >\n                    <CalendarMonth />\n                  </CalendarPrimitive.Cell>\n                ))}\n              </CalendarPrimitive.GridRow>\n            ))}\n          </CalendarPrimitive.GridBody>\n        ))}\n    </CalendarPrimitive.MonthGrid>\n  )\n}\n\n/** Without children it draws the page of years, styled, in rows of the Root's `columns`. */\nfunction CalendarYearGrid({ className, children, ...props }: CalendarPrimitive.YearGrid.Props) {\n  return (\n    <CalendarPrimitive.YearGrid\n      data-slot=\"calendar-year-grid\"\n      className={cn(calendarGridClassName, className)}\n      {...props}\n    >\n      {children ??\n        ((grid) => (\n          <CalendarPrimitive.GridBody>\n            {grid.rows.map((row, index) => (\n              <CalendarPrimitive.GridRow key={index} className={calendarPeriodRowClassName}>\n                {row.map((entry) => (\n                  <CalendarPrimitive.Cell\n                    key={entry.year}\n                    year={entry.year}\n                    data-slot=\"calendar-year-cell\"\n                    className={calendarPeriodCellClassName}\n                  >\n                    <CalendarYear />\n                  </CalendarPrimitive.Cell>\n                ))}\n              </CalendarPrimitive.GridRow>\n            ))}\n          </CalendarPrimitive.GridBody>\n        ))}\n    </CalendarPrimitive.YearGrid>\n  )\n}\n\nfunction CalendarMonth({ className, ...props }: CalendarPrimitive.Month.Props) {\n  return (\n    <CalendarPrimitive.Month\n      data-slot=\"calendar-month-label\"\n      className={cn(buttonVariants({ variant: 'ghost' }), calendarPeriodClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction CalendarYear({ className, ...props }: CalendarPrimitive.Year.Props) {\n  return (\n    <CalendarPrimitive.Year\n      data-slot=\"calendar-year-label\"\n      className={cn(buttonVariants({ variant: 'ghost' }), calendarPeriodClassName, className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Calendar,\n  CalendarContent,\n  CalendarDayButton,\n  CalendarMonth,\n  CalendarMonthGrid,\n  CalendarViewTrigger,\n  CalendarYear,\n  CalendarYearGrid,\n}\n",
      "type": "registry:ui",
      "target": "@ui/calendar.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.2.1",
      "hash": "b25439968fb57d023bf468e222f5dd9cff0ba73d3cbb92a50840bff14abf62c2",
      "files": {
        "@ui/calendar.tsx": "9cc613299756790a3726dc7045f489d1636e6691389cfd04bae06db01a1f3cd4"
      }
    }
  }
}
