MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / Calendar

Function Calendar

packages/react/src/components/calendar.tsx:8–135  ·  view source on GitHub ↗
({
  className,
  classNames,
  showOutsideDays = true,
  captionLayout = "label",
  buttonVariant = "ghost",
  formatters,
  components,
  ...props
}: React.ComponentProps<typeof DayPicker> & {
  buttonVariant?: React.ComponentProps<typeof Button>["variant"];
})

Source from the content-addressed store, hash-verified

6import { Button, buttonVariants } from "./button";
7
8function Calendar({
9 className,
10 classNames,
11 showOutsideDays = true,
12 captionLayout = "label",
13 buttonVariant = "ghost",
14 formatters,
15 components,
16 ...props
17}: React.ComponentProps<typeof DayPicker> & {
18 buttonVariant?: React.ComponentProps<typeof Button>["variant"];
19}) {
20 const defaultClassNames = getDefaultClassNames();
21
22 return (
23 <DayPicker
24 showOutsideDays={showOutsideDays}
25 className={cn(
26 "group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
27 String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
28 String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
29 className,
30 )}
31 captionLayout={captionLayout}
32 formatters={{
33 formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
34 ...formatters,
35 }}
36 classNames={{
37 root: cn("w-fit", defaultClassNames.root),
38 months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
39 month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
40 nav: cn(
41 "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
42 defaultClassNames.nav,
43 ),
44 button_previous: cn(
45 buttonVariants({ variant: buttonVariant }),
46 "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
47 defaultClassNames.button_previous,
48 ),
49 button_next: cn(
50 buttonVariants({ variant: buttonVariant }),
51 "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
52 defaultClassNames.button_next,
53 ),
54 month_caption: cn(
55 "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
56 defaultClassNames.month_caption,
57 ),
58 dropdowns: cn(
59 "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
60 defaultClassNames.dropdowns,
61 ),
62 dropdown_root: cn(
63 "relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
64 defaultClassNames.dropdown_root,
65 ),

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected