@catalystsoftware/ui 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/tailwind.config.js +261 -3821
- package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
- package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
- package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
- package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
- package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
- package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
- package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
- package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
- package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
- package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
- package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
- package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
- package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
- package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
- package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
- package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
- package/dist/components/catalyst-ui/media/image.tsx +13 -0
- package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
- package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
- package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
- package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
- package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
- package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
- package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
- package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
- package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
- package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
- package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
- package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
- package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
- package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
- package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
- package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
- package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
- package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
- package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
- package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
- package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
- package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
- package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
- package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
- package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
- package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
- package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
- package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
- package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
- package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
- package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
- package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
- package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
- package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
- package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
- package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
- package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
- package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
- package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
- package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
- package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
- package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
- package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
- package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
- package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
- package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
- package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
- package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
- package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
- package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
- package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
- package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
- package/dist/components/catalyst-ui/utils/utils.ts +43 -0
- package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
- package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
- package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
- package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
- package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
- package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
- package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
- package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
- package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
- package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
- package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
- package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
- package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
- package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
- package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
- package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
- package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
- package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
- package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
- package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
- package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
- package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
- package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
- package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
- package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
- package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
- package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
- package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
- package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
- package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
- package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
- package/dist/data/bg-data.tsx +901 -0
- package/dist/data/buttons-data.tsx +2327 -0
- package/dist/data/charts-data.tsx +102 -0
- package/dist/data/chat-data.tsx +83 -0
- package/dist/data/code-data.tsx +1040 -0
- package/dist/data/comboboxes-data.tsx +1843 -0
- package/dist/data/command-data.tsx +1381 -0
- package/dist/data/core-data.tsx +15953 -0
- package/dist/data/crm-data.tsx +47 -0
- package/dist/data/data.tsx +159 -0
- package/dist/data/date-and-time-data.tsx +554 -0
- package/dist/data/dependencies.tsx +7 -0
- package/dist/data/ecommerce-data.tsx +1387 -0
- package/dist/data/forms-data.tsx +7890 -0
- package/dist/data/hooks-data.tsx +5487 -0
- package/dist/data/index.ts +34 -0
- package/dist/data/inputs-data.tsx +557 -0
- package/dist/data/interactive-data.tsx +5394 -0
- package/dist/data/lofi-data.tsx +18295 -0
- package/dist/data/marketing-data.tsx +2546 -0
- package/dist/data/media-data.tsx +1510 -0
- package/dist/data/motion-data.tsx +5801 -0
- package/dist/data/overlay-data.tsx +4136 -0
- package/dist/data/pdf-data.tsx +124 -0
- package/dist/data/pos-data.tsx +213 -0
- package/dist/data/postcss.config.js +6 -0
- package/dist/data/primitive-data.tsx +5170 -0
- package/dist/data/prompt-data.tsx +1226 -0
- package/dist/data/requiredLibs.ts +4 -0
- package/dist/data/sandbox-data.tsx +1 -0
- package/dist/data/sidebars-data.tsx +5421 -0
- package/dist/data/stacks-data.tsx +32 -0
- package/dist/data/table-data.tsx +706 -0
- package/dist/data/tailwind.config.js +270 -0
- package/dist/data/tailwind.config.ngin.js +3830 -0
- package/dist/data/tailwind.css +431 -0
- package/dist/data/tools-data.tsx +6910 -0
- package/dist/data/typography-data.tsx +2050 -0
- package/dist/data/utils-data.tsx +6500 -0
- package/dist/data/x-data.tsx +1171 -0
- package/dist/data.tsx +159 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -362
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, } from "lucide-react";
|
|
3
|
+
import { DayButton, DayPicker, getDefaultClassNames, } from "react-day-picker";
|
|
4
|
+
import { cn, } from "~/components/catalyst-ui";
|
|
5
|
+
import { Button, buttonVariants, } from "~/components/catalyst-ui";
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
|
|
8
|
+
// @dev app/components/catalyst-ui/data/primitive-data.tsx:1311
|
|
9
|
+
|
|
10
|
+
const calendarVariants = cva(
|
|
11
|
+
"bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default: "bg-background text-foreground border border-border rounded-lg shadow-xs",
|
|
16
|
+
elevated: "bg-surface-container-low text-primary shadow-md hover:shadow-lg rounded-lg",
|
|
17
|
+
filled: "bg-primary text-on-primary shadow-sm rounded-lg",
|
|
18
|
+
tonal: "bg-secondary-container text-on-secondary-container rounded-lg",
|
|
19
|
+
outlined: "bg-transparent border-2 border-outline text-primary rounded-lg",
|
|
20
|
+
glass: "bg-background/20 backdrop-blur-md border border-border/50 text-foreground rounded-lg",
|
|
21
|
+
destructive: "bg-destructive text-white shadow-xs rounded-lg",
|
|
22
|
+
gradient: "bg-gradient-to-r from-primary to-primary/80 text-primary-foreground shadow-md rounded-lg",
|
|
23
|
+
soft: "bg-primary/10 text-primary rounded-lg",
|
|
24
|
+
success: "bg-green-600 text-white shadow-sm rounded-lg",
|
|
25
|
+
warning: "bg-amber-600 text-white shadow-sm rounded-lg",
|
|
26
|
+
info: "bg-blue-600 text-white shadow-sm rounded-lg",
|
|
27
|
+
ghost: "bg-transparent border-transparent hover:bg-accent hover:text-accent-foreground rounded-lg",
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
sm: "p-2 [--cell-size:1.75rem] text-sm",
|
|
31
|
+
default: "p-3 [--cell-size:2rem]",
|
|
32
|
+
lg: "p-4 [--cell-size:2.25rem] text-lg",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
variant: "default",
|
|
37
|
+
size: "default",
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const calendarDayButtonVariants = cva(
|
|
43
|
+
"inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 aspect-square h-full w-full select-none p-0 text-center",
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
default: "bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground rounded-md data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground data-[selected=true]:hover:bg-primary/90",
|
|
48
|
+
destructive: "bg-transparent text-foreground hover:bg-destructive/10 hover:text-destructive rounded-md data-[selected=true]:bg-destructive data-[selected=true]:text-white data-[selected=true]:hover:bg-destructive/90",
|
|
49
|
+
elevated: "bg-transparent text-primary hover:bg-surface-container-high rounded-md data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground data-[selected=true]:hover:bg-primary/90",
|
|
50
|
+
filled: "bg-transparent text-on-primary hover:bg-primary/80 rounded-md data-[selected=true]:bg-on-primary data-[selected=true]:text-primary data-[selected=true]:hover:bg-on-primary/90",
|
|
51
|
+
tonal: "bg-transparent text-on-secondary-container hover:bg-secondary-container/80 rounded-md data-[selected=true]:bg-on-secondary-container data-[selected=true]:text-secondary-container data-[selected=true]:hover:bg-on-secondary-container/90",
|
|
52
|
+
glass: "bg-transparent text-foreground hover:bg-background/30 rounded-md data-[selected=true]:bg-primary/80 data-[selected=true]:text-primary-foreground data-[selected=true]:hover:bg-primary/70",
|
|
53
|
+
gradient: "bg-transparent text-primary-foreground hover:bg-primary/60 rounded-md data-[selected=true]:bg-primary-foreground data-[selected=true]:text-primary data-[selected=true]:hover:bg-primary-foreground/90",
|
|
54
|
+
soft: "bg-transparent text-primary hover:bg-primary/20 rounded-md data-[selected=true]:bg-primary/30 data-[selected=true]:text-primary data-[selected=true]:hover:bg-primary/40",
|
|
55
|
+
success: "bg-transparent text-white hover:bg-green-700 rounded-md data-[selected=true]:bg-green-200 data-[selected=true]:text-green-900 data-[selected=true]:hover:bg-green-300",
|
|
56
|
+
warning: "bg-transparent text-white hover:bg-amber-700 rounded-md data-[selected=true]:bg-amber-200 data-[selected=true]:text-amber-900 data-[selected=true]:hover:bg-amber-300",
|
|
57
|
+
info: "bg-transparent text-white hover:bg-blue-700 rounded-md data-[selected=true]:bg-blue-200 data-[selected=true]:text-blue-900 data-[selected=true]:hover:bg-blue-300",
|
|
58
|
+
ghost: "bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground rounded-md data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[selected=true]:hover:bg-accent/80",
|
|
59
|
+
},
|
|
60
|
+
today: {
|
|
61
|
+
true: "bg-accent text-accent-foreground font-semibold",
|
|
62
|
+
false: "",
|
|
63
|
+
},
|
|
64
|
+
outside: {
|
|
65
|
+
true: "text-muted-foreground opacity-60 aria-selected:text-muted-foreground",
|
|
66
|
+
false: "",
|
|
67
|
+
},
|
|
68
|
+
disabled: {
|
|
69
|
+
true: "text-muted-foreground opacity-30 cursor-not-allowed",
|
|
70
|
+
false: "",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
variant: "default",
|
|
75
|
+
today: false,
|
|
76
|
+
outside: false,
|
|
77
|
+
disabled: false,
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
const calendarNavButtonVariants = cva(
|
|
83
|
+
"inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 h-[--cell-size] w-[--cell-size] select-none p-0",
|
|
84
|
+
{
|
|
85
|
+
variants: {
|
|
86
|
+
variant: {
|
|
87
|
+
default: "bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground rounded-md",
|
|
88
|
+
destructive: "bg-transparent text-foreground hover:bg-destructive/10 hover:text-destructive rounded-md",
|
|
89
|
+
ghost: "bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground rounded-md",
|
|
90
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground rounded-md",
|
|
91
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-md",
|
|
92
|
+
elevated: "bg-surface-container-low text-primary hover:bg-surface-container-high rounded-md",
|
|
93
|
+
filled: "bg-primary text-on-primary hover:bg-primary/80 rounded-md",
|
|
94
|
+
tonal: "bg-secondary-container text-on-secondary-container hover:bg-secondary-container/80 rounded-md",
|
|
95
|
+
glass: "bg-background/20 text-foreground hover:bg-background/30 rounded-md",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
defaultVariants: {
|
|
99
|
+
variant: "default",
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
function Calendar({
|
|
105
|
+
className,
|
|
106
|
+
classNames,
|
|
107
|
+
showOutsideDays = true,
|
|
108
|
+
captionLayout = "label",
|
|
109
|
+
buttonVariant = "ghost",
|
|
110
|
+
calendarVariant = "default",
|
|
111
|
+
calendarSize = "default",
|
|
112
|
+
formatters,
|
|
113
|
+
components,
|
|
114
|
+
...props
|
|
115
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
116
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
117
|
+
calendarVariant?: "default" | "elevated" | "filled" | "tonal" | "outlined" | "glass" | "destructive" | "gradient" | "soft" | "success" | "warning" | "info" | "ghost"
|
|
118
|
+
calendarSize?: "sm" | "default" | "lg"
|
|
119
|
+
}) {
|
|
120
|
+
const defaultClassNames = getDefaultClassNames()
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<DayPicker
|
|
124
|
+
showOutsideDays={showOutsideDays}
|
|
125
|
+
className={cn(
|
|
126
|
+
calendarVariants({ variant: calendarVariant, size: calendarSize }),
|
|
127
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
128
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
129
|
+
className
|
|
130
|
+
)}
|
|
131
|
+
captionLayout={captionLayout}
|
|
132
|
+
formatters={{
|
|
133
|
+
formatMonthDropdown: (date) =>
|
|
134
|
+
date.toLocaleString("default", { month: "short" }),
|
|
135
|
+
...formatters,
|
|
136
|
+
}}
|
|
137
|
+
classNames={{
|
|
138
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
139
|
+
months: cn(
|
|
140
|
+
"relative flex flex-col gap-4 md:flex-row",
|
|
141
|
+
defaultClassNames.months
|
|
142
|
+
),
|
|
143
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
144
|
+
nav: cn(
|
|
145
|
+
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
146
|
+
defaultClassNames.nav
|
|
147
|
+
),
|
|
148
|
+
button_previous: cn(
|
|
149
|
+
calendarNavButtonVariants({ variant: buttonVariant }),
|
|
150
|
+
"aria-disabled:opacity-50",
|
|
151
|
+
defaultClassNames.button_previous
|
|
152
|
+
),
|
|
153
|
+
button_next: cn(
|
|
154
|
+
calendarNavButtonVariants({ variant: buttonVariant }),
|
|
155
|
+
"aria-disabled:opacity-50",
|
|
156
|
+
defaultClassNames.button_next
|
|
157
|
+
),
|
|
158
|
+
month_caption: cn(
|
|
159
|
+
"flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
|
|
160
|
+
defaultClassNames.month_caption
|
|
161
|
+
),
|
|
162
|
+
dropdowns: cn(
|
|
163
|
+
"flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
164
|
+
defaultClassNames.dropdowns
|
|
165
|
+
),
|
|
166
|
+
dropdown_root: cn(
|
|
167
|
+
"has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
|
|
168
|
+
defaultClassNames.dropdown_root
|
|
169
|
+
),
|
|
170
|
+
dropdown: cn("absolute inset-0 opacity-0", defaultClassNames.dropdown),
|
|
171
|
+
caption_label: cn(
|
|
172
|
+
"select-none font-medium",
|
|
173
|
+
captionLayout === "label"
|
|
174
|
+
? "text-sm"
|
|
175
|
+
: "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
|
|
176
|
+
defaultClassNames.caption_label
|
|
177
|
+
),
|
|
178
|
+
table: "w-full border-collapse",
|
|
179
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
180
|
+
weekday: cn(
|
|
181
|
+
"text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
|
|
182
|
+
defaultClassNames.weekday
|
|
183
|
+
),
|
|
184
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
185
|
+
week_number_header: cn(
|
|
186
|
+
"w-[--cell-size] select-none",
|
|
187
|
+
defaultClassNames.week_number_header
|
|
188
|
+
),
|
|
189
|
+
week_number: cn(
|
|
190
|
+
"text-muted-foreground select-none text-[0.8rem]",
|
|
191
|
+
defaultClassNames.week_number
|
|
192
|
+
),
|
|
193
|
+
day: cn(
|
|
194
|
+
"group/day relative",
|
|
195
|
+
defaultClassNames.day
|
|
196
|
+
),
|
|
197
|
+
range_start: cn(
|
|
198
|
+
"bg-accent rounded-l-md",
|
|
199
|
+
defaultClassNames.range_start
|
|
200
|
+
),
|
|
201
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
202
|
+
range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
|
|
203
|
+
today: cn(
|
|
204
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
205
|
+
defaultClassNames.today
|
|
206
|
+
),
|
|
207
|
+
outside: cn(
|
|
208
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
209
|
+
defaultClassNames.outside
|
|
210
|
+
),
|
|
211
|
+
disabled: cn(
|
|
212
|
+
"text-muted-foreground opacity-50",
|
|
213
|
+
defaultClassNames.disabled
|
|
214
|
+
),
|
|
215
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
216
|
+
...classNames,
|
|
217
|
+
}}
|
|
218
|
+
components={{
|
|
219
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
220
|
+
return (
|
|
221
|
+
<div
|
|
222
|
+
data-slot="calendar"
|
|
223
|
+
ref={rootRef}
|
|
224
|
+
className={cn(className)}
|
|
225
|
+
{...props}
|
|
226
|
+
/>
|
|
227
|
+
)
|
|
228
|
+
},
|
|
229
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
230
|
+
if (orientation === "left") {
|
|
231
|
+
return (
|
|
232
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (orientation === "right") {
|
|
237
|
+
return (
|
|
238
|
+
<ChevronRightIcon
|
|
239
|
+
className={cn("size-4", className)}
|
|
240
|
+
{...props}
|
|
241
|
+
/>
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
247
|
+
)
|
|
248
|
+
},
|
|
249
|
+
DayButton: ({ children, ...props }) => (
|
|
250
|
+
<CalendarDayButton
|
|
251
|
+
variant={calendarVariant}
|
|
252
|
+
today={props.today}
|
|
253
|
+
outside={props.outside}
|
|
254
|
+
disabled={props.disabled}
|
|
255
|
+
{...props}
|
|
256
|
+
>
|
|
257
|
+
{children}
|
|
258
|
+
</CalendarDayButton>
|
|
259
|
+
),
|
|
260
|
+
WeekNumber: ({ children, ...props }) => {
|
|
261
|
+
return (
|
|
262
|
+
<td {...props}>
|
|
263
|
+
<div className="flex size-[--cell-size] items-center justify-center text-center">
|
|
264
|
+
{children}
|
|
265
|
+
</div>
|
|
266
|
+
</td>
|
|
267
|
+
)
|
|
268
|
+
},
|
|
269
|
+
...components,
|
|
270
|
+
}}
|
|
271
|
+
{...props}
|
|
272
|
+
/>
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function CalendarDayButton({
|
|
277
|
+
variant = "default",
|
|
278
|
+
today = false,
|
|
279
|
+
outside = false,
|
|
280
|
+
disabled = false,
|
|
281
|
+
children,
|
|
282
|
+
...props
|
|
283
|
+
}) {
|
|
284
|
+
return (
|
|
285
|
+
<button
|
|
286
|
+
className={calendarDayButtonVariants({ variant, today, outside, disabled })}
|
|
287
|
+
{...props}
|
|
288
|
+
>
|
|
289
|
+
{children}
|
|
290
|
+
</button>
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
export { Calendar, CalendarDayButton, calendarNavButtonVariants, calendarDayButtonVariants, calendarVariants }
|