@openconsole/shadcn 0.2.4 → 0.2.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/README.md +460 -380
- package/components/ai-elements/agent.tsx +141 -0
- package/components/ai-elements/artifact.tsx +148 -0
- package/components/ai-elements/attachments.tsx +426 -0
- package/components/ai-elements/audio-player.tsx +231 -0
- package/components/ai-elements/canvas.tsx +26 -0
- package/components/ai-elements/chain-of-thought.tsx +222 -0
- package/components/ai-elements/checkpoint.tsx +71 -0
- package/components/ai-elements/code-block.tsx +562 -0
- package/components/ai-elements/commit.tsx +458 -0
- package/components/ai-elements/confirmation.tsx +174 -0
- package/components/ai-elements/connection.tsx +28 -0
- package/components/ai-elements/context.tsx +409 -0
- package/components/ai-elements/controls.tsx +18 -0
- package/components/ai-elements/conversation.tsx +168 -0
- package/components/ai-elements/edge.tsx +143 -0
- package/components/ai-elements/environment-variables.tsx +324 -0
- package/components/ai-elements/file-tree.tsx +304 -0
- package/components/ai-elements/image.tsx +24 -0
- package/components/ai-elements/index.ts +51 -0
- package/components/ai-elements/inline-citation.tsx +296 -0
- package/components/ai-elements/jsx-preview.tsx +310 -0
- package/components/ai-elements/message.tsx +360 -0
- package/components/ai-elements/mic-selector.tsx +375 -0
- package/components/ai-elements/model-selector.tsx +213 -0
- package/components/ai-elements/node.tsx +71 -0
- package/components/ai-elements/open-in-chat.tsx +370 -0
- package/components/ai-elements/package-info.tsx +239 -0
- package/components/ai-elements/panel.tsx +15 -0
- package/components/ai-elements/persona.tsx +306 -0
- package/components/ai-elements/plan.tsx +147 -0
- package/components/ai-elements/prompt-input.tsx +1463 -0
- package/components/ai-elements/queue.tsx +274 -0
- package/components/ai-elements/reasoning.tsx +228 -0
- package/components/ai-elements/sandbox.tsx +132 -0
- package/components/ai-elements/schema-display.tsx +471 -0
- package/components/ai-elements/shimmer.tsx +77 -0
- package/components/ai-elements/snippet.tsx +145 -0
- package/components/ai-elements/sources.tsx +77 -0
- package/components/ai-elements/speech-input.tsx +323 -0
- package/components/ai-elements/stack-trace.tsx +528 -0
- package/components/ai-elements/suggestion.tsx +57 -0
- package/components/ai-elements/task.tsx +87 -0
- package/components/ai-elements/terminal.tsx +273 -0
- package/components/ai-elements/test-results.tsx +496 -0
- package/components/ai-elements/tool.tsx +173 -0
- package/components/ai-elements/toolbar.tsx +16 -0
- package/components/ai-elements/transcription.tsx +125 -0
- package/components/ai-elements/voice-selector.tsx +524 -0
- package/components/ai-elements/web-preview.tsx +281 -0
- package/components/index.ts +3 -0
- package/{accordion.tsx → components/ui/accordion.tsx} +66 -66
- package/{alert-dialog.tsx → components/ui/alert-dialog.tsx} +196 -196
- package/{alert.tsx → components/ui/alert.tsx} +66 -66
- package/{aspect-ratio.tsx → components/ui/aspect-ratio.tsx} +11 -11
- package/{avatar.tsx → components/ui/avatar.tsx} +53 -53
- package/{badge.tsx → components/ui/badge.tsx} +46 -46
- package/{breadcrumb.tsx → components/ui/breadcrumb.tsx} +109 -109
- package/{button-group.tsx → components/ui/button-group.tsx} +83 -83
- package/{button.tsx → components/ui/button.tsx} +60 -60
- package/{calendar.tsx → components/ui/calendar.tsx} +219 -219
- package/{card.tsx → components/ui/card.tsx} +92 -92
- package/{carousel.tsx → components/ui/carousel.tsx} +241 -241
- package/{chart.tsx → components/ui/chart.tsx} +374 -374
- package/{checkbox.tsx → components/ui/checkbox.tsx} +32 -32
- package/{collapsible.tsx → components/ui/collapsible.tsx} +33 -33
- package/{command.tsx → components/ui/command.tsx} +184 -184
- package/{context-menu.tsx → components/ui/context-menu.tsx} +252 -252
- package/{dialog.tsx → components/ui/dialog.tsx} +143 -143
- package/{direction.tsx → components/ui/direction.tsx} +22 -22
- package/{drawer.tsx → components/ui/drawer.tsx} +135 -135
- package/{dropdown-menu.tsx → components/ui/dropdown-menu.tsx} +257 -257
- package/{empty.tsx → components/ui/empty.tsx} +104 -104
- package/{field.tsx → components/ui/field.tsx} +248 -248
- package/{form.tsx → components/ui/form.tsx} +167 -167
- package/{hover-card.tsx → components/ui/hover-card.tsx} +44 -44
- package/{icon.tsx → components/ui/icon.tsx} +55 -55
- package/components/ui/index.ts +59 -0
- package/{input-group.tsx → components/ui/input-group.tsx} +170 -170
- package/{input-otp.tsx → components/ui/input-otp.tsx} +77 -77
- package/{input.tsx → components/ui/input.tsx} +21 -21
- package/{item.tsx → components/ui/item.tsx} +193 -193
- package/{kbd.tsx → components/ui/kbd.tsx} +28 -28
- package/{label.tsx → components/ui/label.tsx} +24 -24
- package/{menubar.tsx → components/ui/menubar.tsx} +276 -276
- package/{native-select.tsx → components/ui/native-select.tsx} +62 -62
- package/{navigation-menu.tsx → components/ui/navigation-menu.tsx} +168 -168
- package/{pagination.tsx → components/ui/pagination.tsx} +127 -127
- package/{popover.tsx → components/ui/popover.tsx} +89 -89
- package/{progress.tsx → components/ui/progress.tsx} +31 -31
- package/{radio-group.tsx → components/ui/radio-group.tsx} +45 -45
- package/{resizable.tsx → components/ui/resizable.tsx} +53 -53
- package/{scroll-area.tsx → components/ui/scroll-area.tsx} +58 -58
- package/{select.tsx → components/ui/select.tsx} +187 -187
- package/{separator.tsx → components/ui/separator.tsx} +28 -28
- package/{sheet.tsx → components/ui/sheet.tsx} +139 -139
- package/{sidebar.tsx → components/ui/sidebar.tsx} +724 -724
- package/{skeleton.tsx → components/ui/skeleton.tsx} +13 -13
- package/{slider.tsx → components/ui/slider.tsx} +63 -63
- package/{sonner.tsx → components/ui/sonner.tsx} +40 -40
- package/{spinner.tsx → components/ui/spinner.tsx} +16 -16
- package/{switch.tsx → components/ui/switch.tsx} +35 -35
- package/{table.tsx → components/ui/table.tsx} +116 -116
- package/{tabs.tsx → components/ui/tabs.tsx} +66 -66
- package/{textarea.tsx → components/ui/textarea.tsx} +18 -18
- package/{toggle-group.tsx → components/ui/toggle-group.tsx} +83 -83
- package/{toggle.tsx → components/ui/toggle.tsx} +47 -47
- package/{tooltip.tsx → components/ui/tooltip.tsx} +61 -61
- package/hooks/index.ts +1 -1
- package/hooks/use-mobile.ts +19 -19
- package/index.ts +3 -59
- package/lib/index.ts +1 -1
- package/lib/utils.ts +6 -6
- package/package.json +79 -1
- package/styles.css +124 -124
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import {
|
|
5
|
-
ChevronDownIcon,
|
|
6
|
-
ChevronLeftIcon,
|
|
7
|
-
ChevronRightIcon,
|
|
8
|
-
} from "lucide-react"
|
|
9
|
-
import {
|
|
10
|
-
DayPicker,
|
|
11
|
-
getDefaultClassNames,
|
|
12
|
-
type DayButton,
|
|
13
|
-
} from "react-day-picker"
|
|
14
|
-
|
|
15
|
-
import { cn } from "
|
|
16
|
-
import { Button, buttonVariants } from "./button"
|
|
17
|
-
|
|
18
|
-
const defaultClassNames = getDefaultClassNames()
|
|
19
|
-
|
|
20
|
-
function Calendar({
|
|
21
|
-
className,
|
|
22
|
-
classNames,
|
|
23
|
-
showOutsideDays = true,
|
|
24
|
-
captionLayout = "label",
|
|
25
|
-
buttonVariant = "ghost",
|
|
26
|
-
formatters,
|
|
27
|
-
components,
|
|
28
|
-
...props
|
|
29
|
-
}: React.ComponentProps<typeof DayPicker> & {
|
|
30
|
-
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
31
|
-
}) {
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<DayPicker
|
|
35
|
-
showOutsideDays={showOutsideDays}
|
|
36
|
-
className={cn(
|
|
37
|
-
"group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
38
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
39
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
40
|
-
className
|
|
41
|
-
)}
|
|
42
|
-
captionLayout={captionLayout}
|
|
43
|
-
formatters={{
|
|
44
|
-
formatMonthDropdown: (date) =>
|
|
45
|
-
date.toLocaleString("default", { month: "short" }),
|
|
46
|
-
...formatters,
|
|
47
|
-
}}
|
|
48
|
-
classNames={{
|
|
49
|
-
root: cn("w-fit", defaultClassNames.root),
|
|
50
|
-
months: cn(
|
|
51
|
-
"relative flex flex-col gap-4 md:flex-row",
|
|
52
|
-
defaultClassNames.months
|
|
53
|
-
),
|
|
54
|
-
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
55
|
-
nav: cn(
|
|
56
|
-
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
57
|
-
defaultClassNames.nav
|
|
58
|
-
),
|
|
59
|
-
button_previous: cn(
|
|
60
|
-
buttonVariants({ variant: buttonVariant }),
|
|
61
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
62
|
-
defaultClassNames.button_previous
|
|
63
|
-
),
|
|
64
|
-
button_next: cn(
|
|
65
|
-
buttonVariants({ variant: buttonVariant }),
|
|
66
|
-
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
67
|
-
defaultClassNames.button_next
|
|
68
|
-
),
|
|
69
|
-
month_caption: cn(
|
|
70
|
-
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
71
|
-
defaultClassNames.month_caption
|
|
72
|
-
),
|
|
73
|
-
dropdowns: cn(
|
|
74
|
-
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
75
|
-
defaultClassNames.dropdowns
|
|
76
|
-
),
|
|
77
|
-
dropdown_root: cn(
|
|
78
|
-
"relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
|
|
79
|
-
defaultClassNames.dropdown_root
|
|
80
|
-
),
|
|
81
|
-
dropdown: cn(
|
|
82
|
-
"absolute inset-0 bg-popover opacity-0",
|
|
83
|
-
defaultClassNames.dropdown
|
|
84
|
-
),
|
|
85
|
-
caption_label: cn(
|
|
86
|
-
"font-medium select-none",
|
|
87
|
-
captionLayout === "label"
|
|
88
|
-
? "text-sm"
|
|
89
|
-
: "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
90
|
-
defaultClassNames.caption_label
|
|
91
|
-
),
|
|
92
|
-
month_grid: "w-full border-collapse",
|
|
93
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
94
|
-
weekday: cn(
|
|
95
|
-
"flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
96
|
-
defaultClassNames.weekday
|
|
97
|
-
),
|
|
98
|
-
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
99
|
-
week_number_header: cn(
|
|
100
|
-
"w-(--cell-size) select-none",
|
|
101
|
-
defaultClassNames.week_number_header
|
|
102
|
-
),
|
|
103
|
-
week_number: cn(
|
|
104
|
-
"text-[0.8rem] text-muted-foreground select-none",
|
|
105
|
-
defaultClassNames.week_number
|
|
106
|
-
),
|
|
107
|
-
day: cn(
|
|
108
|
-
"group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
109
|
-
props.showWeekNumber
|
|
110
|
-
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
111
|
-
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
112
|
-
defaultClassNames.day
|
|
113
|
-
),
|
|
114
|
-
range_start: cn(
|
|
115
|
-
"rounded-l-md bg-accent",
|
|
116
|
-
defaultClassNames.range_start
|
|
117
|
-
),
|
|
118
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
119
|
-
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
120
|
-
today: cn(
|
|
121
|
-
"rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",
|
|
122
|
-
defaultClassNames.today
|
|
123
|
-
),
|
|
124
|
-
outside: cn(
|
|
125
|
-
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
126
|
-
defaultClassNames.outside
|
|
127
|
-
),
|
|
128
|
-
disabled: cn(
|
|
129
|
-
"text-muted-foreground opacity-50",
|
|
130
|
-
defaultClassNames.disabled
|
|
131
|
-
),
|
|
132
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
133
|
-
...classNames,
|
|
134
|
-
}}
|
|
135
|
-
components={{
|
|
136
|
-
Root: ({ className, rootRef, ...props }) => {
|
|
137
|
-
return (
|
|
138
|
-
<div
|
|
139
|
-
data-slot="calendar"
|
|
140
|
-
ref={rootRef}
|
|
141
|
-
className={cn(className)}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
)
|
|
145
|
-
},
|
|
146
|
-
Chevron: ({ className, orientation, ...props }) => {
|
|
147
|
-
if (orientation === "left") {
|
|
148
|
-
return (
|
|
149
|
-
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
150
|
-
)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (orientation === "right") {
|
|
154
|
-
return (
|
|
155
|
-
<ChevronRightIcon
|
|
156
|
-
className={cn("size-4", className)}
|
|
157
|
-
{...props}
|
|
158
|
-
/>
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return (
|
|
163
|
-
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
164
|
-
)
|
|
165
|
-
},
|
|
166
|
-
DayButton: CalendarDayButton,
|
|
167
|
-
WeekNumber: ({ children, ...props }) => {
|
|
168
|
-
return (
|
|
169
|
-
<td {...props}>
|
|
170
|
-
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
171
|
-
{children}
|
|
172
|
-
</div>
|
|
173
|
-
</td>
|
|
174
|
-
)
|
|
175
|
-
},
|
|
176
|
-
...components,
|
|
177
|
-
}}
|
|
178
|
-
{...props}
|
|
179
|
-
/>
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function CalendarDayButton({
|
|
184
|
-
className,
|
|
185
|
-
day,
|
|
186
|
-
modifiers,
|
|
187
|
-
...props
|
|
188
|
-
}: React.ComponentProps<typeof DayButton>) {
|
|
189
|
-
const ref = React.useRef<HTMLButtonElement>(null)
|
|
190
|
-
React.useEffect(() => {
|
|
191
|
-
if (modifiers.focused) ref.current?.focus()
|
|
192
|
-
}, [modifiers.focused])
|
|
193
|
-
|
|
194
|
-
return (
|
|
195
|
-
<Button
|
|
196
|
-
ref={ref}
|
|
197
|
-
variant="ghost"
|
|
198
|
-
size="icon"
|
|
199
|
-
data-day={day.date.toLocaleDateString()}
|
|
200
|
-
data-selected-single={
|
|
201
|
-
modifiers.selected &&
|
|
202
|
-
!modifiers.range_start &&
|
|
203
|
-
!modifiers.range_end &&
|
|
204
|
-
!modifiers.range_middle
|
|
205
|
-
}
|
|
206
|
-
data-range-start={modifiers.range_start}
|
|
207
|
-
data-range-end={modifiers.range_end}
|
|
208
|
-
data-range-middle={modifiers.range_middle}
|
|
209
|
-
className={cn(
|
|
210
|
-
"flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
211
|
-
defaultClassNames.day,
|
|
212
|
-
className
|
|
213
|
-
)}
|
|
214
|
-
{...props}
|
|
215
|
-
/>
|
|
216
|
-
)
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export { Calendar, CalendarDayButton }
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
ChevronLeftIcon,
|
|
7
|
+
ChevronRightIcon,
|
|
8
|
+
} from "lucide-react"
|
|
9
|
+
import {
|
|
10
|
+
DayPicker,
|
|
11
|
+
getDefaultClassNames,
|
|
12
|
+
type DayButton,
|
|
13
|
+
} from "react-day-picker"
|
|
14
|
+
|
|
15
|
+
import { cn } from "../../lib/utils"
|
|
16
|
+
import { Button, buttonVariants } from "./button"
|
|
17
|
+
|
|
18
|
+
const defaultClassNames = getDefaultClassNames()
|
|
19
|
+
|
|
20
|
+
function Calendar({
|
|
21
|
+
className,
|
|
22
|
+
classNames,
|
|
23
|
+
showOutsideDays = true,
|
|
24
|
+
captionLayout = "label",
|
|
25
|
+
buttonVariant = "ghost",
|
|
26
|
+
formatters,
|
|
27
|
+
components,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
30
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
31
|
+
}) {
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<DayPicker
|
|
35
|
+
showOutsideDays={showOutsideDays}
|
|
36
|
+
className={cn(
|
|
37
|
+
"group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
38
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
39
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
captionLayout={captionLayout}
|
|
43
|
+
formatters={{
|
|
44
|
+
formatMonthDropdown: (date) =>
|
|
45
|
+
date.toLocaleString("default", { month: "short" }),
|
|
46
|
+
...formatters,
|
|
47
|
+
}}
|
|
48
|
+
classNames={{
|
|
49
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
50
|
+
months: cn(
|
|
51
|
+
"relative flex flex-col gap-4 md:flex-row",
|
|
52
|
+
defaultClassNames.months
|
|
53
|
+
),
|
|
54
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
55
|
+
nav: cn(
|
|
56
|
+
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
57
|
+
defaultClassNames.nav
|
|
58
|
+
),
|
|
59
|
+
button_previous: cn(
|
|
60
|
+
buttonVariants({ variant: buttonVariant }),
|
|
61
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
62
|
+
defaultClassNames.button_previous
|
|
63
|
+
),
|
|
64
|
+
button_next: cn(
|
|
65
|
+
buttonVariants({ variant: buttonVariant }),
|
|
66
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
67
|
+
defaultClassNames.button_next
|
|
68
|
+
),
|
|
69
|
+
month_caption: cn(
|
|
70
|
+
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
71
|
+
defaultClassNames.month_caption
|
|
72
|
+
),
|
|
73
|
+
dropdowns: cn(
|
|
74
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
75
|
+
defaultClassNames.dropdowns
|
|
76
|
+
),
|
|
77
|
+
dropdown_root: cn(
|
|
78
|
+
"relative rounded-md border border-input shadow-xs has-focus:border-ring has-focus:ring-[3px] has-focus:ring-ring/50",
|
|
79
|
+
defaultClassNames.dropdown_root
|
|
80
|
+
),
|
|
81
|
+
dropdown: cn(
|
|
82
|
+
"absolute inset-0 bg-popover opacity-0",
|
|
83
|
+
defaultClassNames.dropdown
|
|
84
|
+
),
|
|
85
|
+
caption_label: cn(
|
|
86
|
+
"font-medium select-none",
|
|
87
|
+
captionLayout === "label"
|
|
88
|
+
? "text-sm"
|
|
89
|
+
: "flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
90
|
+
defaultClassNames.caption_label
|
|
91
|
+
),
|
|
92
|
+
month_grid: "w-full border-collapse",
|
|
93
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
94
|
+
weekday: cn(
|
|
95
|
+
"flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
96
|
+
defaultClassNames.weekday
|
|
97
|
+
),
|
|
98
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
99
|
+
week_number_header: cn(
|
|
100
|
+
"w-(--cell-size) select-none",
|
|
101
|
+
defaultClassNames.week_number_header
|
|
102
|
+
),
|
|
103
|
+
week_number: cn(
|
|
104
|
+
"text-[0.8rem] text-muted-foreground select-none",
|
|
105
|
+
defaultClassNames.week_number
|
|
106
|
+
),
|
|
107
|
+
day: cn(
|
|
108
|
+
"group/day relative aspect-square h-full w-full p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-md",
|
|
109
|
+
props.showWeekNumber
|
|
110
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
111
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
112
|
+
defaultClassNames.day
|
|
113
|
+
),
|
|
114
|
+
range_start: cn(
|
|
115
|
+
"rounded-l-md bg-accent",
|
|
116
|
+
defaultClassNames.range_start
|
|
117
|
+
),
|
|
118
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
119
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
120
|
+
today: cn(
|
|
121
|
+
"rounded-md bg-accent text-accent-foreground data-[selected=true]:rounded-none",
|
|
122
|
+
defaultClassNames.today
|
|
123
|
+
),
|
|
124
|
+
outside: cn(
|
|
125
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
126
|
+
defaultClassNames.outside
|
|
127
|
+
),
|
|
128
|
+
disabled: cn(
|
|
129
|
+
"text-muted-foreground opacity-50",
|
|
130
|
+
defaultClassNames.disabled
|
|
131
|
+
),
|
|
132
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
133
|
+
...classNames,
|
|
134
|
+
}}
|
|
135
|
+
components={{
|
|
136
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
137
|
+
return (
|
|
138
|
+
<div
|
|
139
|
+
data-slot="calendar"
|
|
140
|
+
ref={rootRef}
|
|
141
|
+
className={cn(className)}
|
|
142
|
+
{...props}
|
|
143
|
+
/>
|
|
144
|
+
)
|
|
145
|
+
},
|
|
146
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
147
|
+
if (orientation === "left") {
|
|
148
|
+
return (
|
|
149
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (orientation === "right") {
|
|
154
|
+
return (
|
|
155
|
+
<ChevronRightIcon
|
|
156
|
+
className={cn("size-4", className)}
|
|
157
|
+
{...props}
|
|
158
|
+
/>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
164
|
+
)
|
|
165
|
+
},
|
|
166
|
+
DayButton: CalendarDayButton,
|
|
167
|
+
WeekNumber: ({ children, ...props }) => {
|
|
168
|
+
return (
|
|
169
|
+
<td {...props}>
|
|
170
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
171
|
+
{children}
|
|
172
|
+
</div>
|
|
173
|
+
</td>
|
|
174
|
+
)
|
|
175
|
+
},
|
|
176
|
+
...components,
|
|
177
|
+
}}
|
|
178
|
+
{...props}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function CalendarDayButton({
|
|
184
|
+
className,
|
|
185
|
+
day,
|
|
186
|
+
modifiers,
|
|
187
|
+
...props
|
|
188
|
+
}: React.ComponentProps<typeof DayButton>) {
|
|
189
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
190
|
+
React.useEffect(() => {
|
|
191
|
+
if (modifiers.focused) ref.current?.focus()
|
|
192
|
+
}, [modifiers.focused])
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<Button
|
|
196
|
+
ref={ref}
|
|
197
|
+
variant="ghost"
|
|
198
|
+
size="icon"
|
|
199
|
+
data-day={day.date.toLocaleDateString()}
|
|
200
|
+
data-selected-single={
|
|
201
|
+
modifiers.selected &&
|
|
202
|
+
!modifiers.range_start &&
|
|
203
|
+
!modifiers.range_end &&
|
|
204
|
+
!modifiers.range_middle
|
|
205
|
+
}
|
|
206
|
+
data-range-start={modifiers.range_start}
|
|
207
|
+
data-range-end={modifiers.range_end}
|
|
208
|
+
data-range-middle={modifiers.range_middle}
|
|
209
|
+
className={cn(
|
|
210
|
+
"flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
211
|
+
defaultClassNames.day,
|
|
212
|
+
className
|
|
213
|
+
)}
|
|
214
|
+
{...props}
|
|
215
|
+
/>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { cn } from "
|
|
4
|
-
|
|
5
|
-
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
-
return (
|
|
7
|
-
<div
|
|
8
|
-
data-slot="card"
|
|
9
|
-
className={cn(
|
|
10
|
-
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
|
11
|
-
className
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
data-slot="card-header"
|
|
22
|
-
className={cn(
|
|
23
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
24
|
-
className
|
|
25
|
-
)}
|
|
26
|
-
{...props}
|
|
27
|
-
/>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
data-slot="card-title"
|
|
35
|
-
className={cn("leading-none font-semibold", className)}
|
|
36
|
-
{...props}
|
|
37
|
-
/>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
-
return (
|
|
43
|
-
<div
|
|
44
|
-
data-slot="card-description"
|
|
45
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
-
return (
|
|
53
|
-
<div
|
|
54
|
-
data-slot="card-action"
|
|
55
|
-
className={cn(
|
|
56
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
-
className
|
|
58
|
-
)}
|
|
59
|
-
{...props}
|
|
60
|
-
/>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
-
return (
|
|
66
|
-
<div
|
|
67
|
-
data-slot="card-content"
|
|
68
|
-
className={cn("px-6", className)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
-
return (
|
|
76
|
-
<div
|
|
77
|
-
data-slot="card-footer"
|
|
78
|
-
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export {
|
|
85
|
-
Card,
|
|
86
|
-
CardHeader,
|
|
87
|
-
CardFooter,
|
|
88
|
-
CardTitle,
|
|
89
|
-
CardAction,
|
|
90
|
-
CardDescription,
|
|
91
|
-
CardContent,
|
|
92
|
-
}
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "../../lib/utils"
|
|
4
|
+
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="card"
|
|
9
|
+
className={cn(
|
|
10
|
+
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="card-header"
|
|
22
|
+
className={cn(
|
|
23
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="card-title"
|
|
35
|
+
className={cn("leading-none font-semibold", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="card-description"
|
|
45
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-slot="card-action"
|
|
55
|
+
className={cn(
|
|
56
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="card-content"
|
|
68
|
+
className={cn("px-6", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="card-footer"
|
|
78
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Card,
|
|
86
|
+
CardHeader,
|
|
87
|
+
CardFooter,
|
|
88
|
+
CardTitle,
|
|
89
|
+
CardAction,
|
|
90
|
+
CardDescription,
|
|
91
|
+
CardContent,
|
|
92
|
+
}
|