{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "calendar",
  "title": "Calendar",
  "description": "Month grid for picking a day, range or several days; Turkish, Monday first.",
  "dependencies": [
    "date-fns",
    "lucide-react",
    "react-day-picker"
  ],
  "registryDependencies": [
    "@ikas/button",
    "@ikas/utils"
  ],
  "files": [
    {
      "path": "registry/ui/calendar.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport type { Locale } from \"date-fns\"\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\"\nimport { DayPicker, getDefaultClassNames, type DayButton } from \"react-day-picker\"\nimport { tr } from \"react-day-picker/locale\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\ntype DayPickerProps = React.ComponentProps<typeof DayPicker>\n\n/** Every react-day-picker prop works; these are the ones with ikas defaults. */\ntype CalendarProps = DayPickerProps & {\n  /** Language of month and weekday names, a react-day-picker or date-fns locale. */\n  locale?: Partial<Locale>\n  /** First day of the week, 0 for Sunday. */\n  weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n  /** \"dropdown\" adds month and year selects; limit them with startMonth and endMonth. */\n  captionLayout?: \"label\" | \"dropdown\" | \"dropdown-months\" | \"dropdown-years\"\n  /** Fills the grid with the days of the previous and next month. */\n  showOutsideDays?: boolean\n}\n\n/**\n * Month grid on react-day-picker for single, range and multiple selection.\n * Turkish and Monday-first by default; pass `locale` and `weekStartsOn` to change.\n * Set `captionLayout=\"dropdown\"` for month and year selects.\n */\nfunction Calendar({\n  className,\n  classNames,\n  showOutsideDays = true,\n  captionLayout = \"label\",\n  locale = tr,\n  weekStartsOn = 1,\n  components,\n  ...props\n}: CalendarProps) {\n  const defaultClassNames = getDefaultClassNames()\n\n  return (\n    <DayPicker\n      showOutsideDays={showOutsideDays}\n      captionLayout={captionLayout}\n      locale={locale}\n      weekStartsOn={weekStartsOn}\n      className={cn(\n        \"group/calendar w-fit rounded-xl bg-card p-3 text-card-foreground shadow-card [--cell-size:--spacing(9)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=card-content]_&]:shadow-none [[data-slot=popover-content]_&]:rounded-none [[data-slot=popover-content]_&]:bg-transparent [[data-slot=popover-content]_&]:p-0 [[data-slot=popover-content]_&]:shadow-none\",\n        String.raw`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,\n        String.raw`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,\n        className\n      )}\n      classNames={{\n        root: cn(\"w-fit\", defaultClassNames.root),\n        months: cn(\"relative flex flex-col gap-4 sm:flex-row sm:gap-6\", defaultClassNames.months),\n        month: cn(\"flex w-full flex-col gap-3\", defaultClassNames.month),\n        nav: cn(\"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1\", defaultClassNames.nav),\n        button_previous: cn(\n          buttonVariants({ variant: \"ghost\", size: \"icon\" }),\n          \"z-10 size-(--cell-size) text-muted-foreground hover:text-foreground aria-disabled:opacity-40\",\n          defaultClassNames.button_previous\n        ),\n        button_next: cn(\n          buttonVariants({ variant: \"ghost\", size: \"icon\" }),\n          \"z-10 size-(--cell-size) text-muted-foreground hover:text-foreground aria-disabled:opacity-40\",\n          defaultClassNames.button_next\n        ),\n        month_caption: cn(\n          \"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)\",\n          defaultClassNames.month_caption\n        ),\n        dropdowns: cn(\"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium\", defaultClassNames.dropdowns),\n        dropdown_root: cn(\n          \"relative rounded-md bg-card shadow-raised transition-shadow hover:shadow-raised-hover has-focus-visible:ring-3 has-focus-visible:ring-ring/30\",\n          defaultClassNames.dropdown_root\n        ),\n        dropdown: cn(\"absolute inset-0 cursor-pointer bg-popover opacity-0\", defaultClassNames.dropdown),\n        caption_label: cn(\n          \"font-medium capitalize select-none\",\n          captionLayout === \"label\"\n            ? \"text-sm\"\n            : \"flex h-7 items-center gap-1 rounded-md pr-1.5 pl-2.5 text-[13px] [&>svg]:size-3.5 [&>svg]:text-muted-foreground\",\n          defaultClassNames.caption_label\n        ),\n        month_grid: cn(\"w-full border-collapse\", defaultClassNames.month_grid),\n        weekdays: cn(\"flex\", defaultClassNames.weekdays),\n        weekday: cn(\n          \"w-(--cell-size) flex-1 text-xs font-medium text-muted-foreground capitalize select-none\",\n          defaultClassNames.weekday\n        ),\n        week: cn(\"mt-1 flex w-full\", defaultClassNames.week),\n        week_number_header: cn(\"w-(--cell-size) select-none\", defaultClassNames.week_number_header),\n        week_number: cn(\"text-xs text-muted-foreground select-none\", defaultClassNames.week_number),\n        day: cn(\n          \"group/day relative aspect-square h-full w-full p-0 text-center select-none\",\n          defaultClassNames.day\n        ),\n        // The band behind a range sits on the cell, so the selected ends stay round.\n        range_start: cn(\"rounded-l-md bg-muted\", defaultClassNames.range_start),\n        range_middle: cn(\"rounded-none bg-muted\", defaultClassNames.range_middle),\n        range_end: cn(\"rounded-r-md bg-muted\", defaultClassNames.range_end),\n        today: cn(defaultClassNames.today),\n        outside: cn(\"text-muted-foreground/70\", defaultClassNames.outside),\n        disabled: cn(\"text-muted-foreground opacity-40\", defaultClassNames.disabled),\n        hidden: cn(\"invisible\", defaultClassNames.hidden),\n        ...classNames,\n      }}\n      components={{\n        Root: ({ className, rootRef, ...props }) => (\n          <div data-slot=\"calendar\" ref={rootRef} className={cn(className)} {...props} />\n        ),\n        Chevron: ({ className, orientation, ...props }) => {\n          if (orientation === \"left\") return <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />\n          if (orientation === \"right\") return <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />\n          return <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />\n        },\n        DayButton: CalendarDayButton,\n        WeekNumber: ({ children, ...props }) => (\n          <td {...props}>\n            <div className=\"flex size-(--cell-size) items-center justify-center text-center\">{children}</div>\n          </td>\n        ),\n        ...components,\n      }}\n      {...props}\n    />\n  )\n}\n\n/** One day in the grid. Exported so apps can wrap it, e.g. to add prices or dots. */\nfunction CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {\n  const defaultClassNames = getDefaultClassNames()\n  const ref = React.useRef<HTMLButtonElement>(null)\n  React.useEffect(() => {\n    if (modifiers.focused) ref.current?.focus()\n  }, [modifiers.focused])\n\n  const end = modifiers.range_start || modifiers.range_end\n  const single = modifiers.selected && !end && !modifiers.range_middle\n\n  return (\n    <button\n      ref={ref}\n      type=\"button\"\n      data-day={day.date.toLocaleDateString()}\n      data-selected-single={single || undefined}\n      data-range-start={modifiers.range_start || undefined}\n      data-range-end={modifiers.range_end || undefined}\n      data-range-middle={modifiers.range_middle || undefined}\n      data-today={modifiers.today || undefined}\n      className={cn(\n        \"relative flex aspect-square size-auto w-full min-w-(--cell-size) items-center justify-center rounded-md text-sm leading-none tabular-nums transition-[color,background-color,box-shadow] duration-150 ease-out outline-none\",\n        \"hover:bg-muted focus-visible:z-10 focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none\",\n        // Today: semibold with a dot under the number.\n        \"data-today:font-semibold data-today:after:absolute data-today:after:bottom-1 data-today:after:left-1/2 data-today:after:size-1 data-today:after:-translate-x-1/2 data-today:after:rounded-full data-today:after:bg-primary\",\n        // Range middle: carried by the cell's band, the button stays flat.\n        \"data-range-middle:rounded-none data-range-middle:bg-transparent data-range-middle:hover:bg-foreground/[0.06]\",\n        // Selected day and range ends: filled like a solid button.\n        \"data-[selected-single=true]:bg-primary data-[selected-single=true]:bg-linear-to-b data-[selected-single=true]:from-white/14 data-[selected-single=true]:to-transparent data-[selected-single=true]:font-medium data-[selected-single=true]:text-primary-foreground data-[selected-single=true]:shadow-raised data-[selected-single=true]:after:bg-primary-foreground\",\n        \"data-range-start:bg-primary data-range-start:bg-linear-to-b data-range-start:from-white/14 data-range-start:to-transparent data-range-start:font-medium data-range-start:text-primary-foreground data-range-start:shadow-raised data-range-start:after:bg-primary-foreground\",\n        \"data-range-end:bg-primary data-range-end:bg-linear-to-b data-range-end:from-white/14 data-range-end:to-transparent data-range-end:font-medium data-range-end:text-primary-foreground data-range-end:shadow-raised data-range-end:after:bg-primary-foreground\",\n        defaultClassNames.day_button,\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Calendar, CalendarDayButton, type CalendarProps }\n",
      "type": "registry:ui"
    }
  ],
  "docs": "https://builders.ikas.com/tr/docs/app-development/ui-kit/components/calendar",
  "categories": [
    "primitives",
    "forms"
  ],
  "type": "registry:ui"
}