@create-lft-app/nextjs 3.2.0 → 3.3.0
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 +549 -549
- package/package.json +48 -48
- package/template/.claude/skills/anti-patterns.md +150 -0
- package/template/.claude/skills/drizzle-schema.md +178 -0
- package/template/.claude/skills/formatting.md +56 -0
- package/template/.claude/skills/module-architecture.md +143 -0
- package/template/.claude/skills/supabase-server-actions.md +199 -0
- package/template/.claude/skills/ui-patterns.md +161 -0
- package/template/CLAUDE.md +114 -1239
- package/template/drizzle.config.ts +12 -12
- package/template/eslint.config.mjs +16 -16
- package/template/gitignore +36 -36
- package/template/next.config.ts +7 -7
- package/template/package.json +86 -86
- package/template/postcss.config.mjs +7 -7
- package/template/proxy.ts +12 -12
- package/template/public/logolft.svg +11 -11
- package/template/src/app/(auth)/dashboard/dashboard-content.tsx +124 -124
- package/template/src/app/(auth)/dashboard/page.tsx +9 -9
- package/template/src/app/(auth)/layout.tsx +7 -7
- package/template/src/app/(auth)/users/page.tsx +9 -9
- package/template/src/app/(auth)/users/users-content.tsx +26 -26
- package/template/src/app/(public)/layout.tsx +7 -7
- package/template/src/app/(public)/login/page.tsx +17 -17
- package/template/src/app/api/webhooks/route.ts +20 -20
- package/template/src/app/globals.css +249 -249
- package/template/src/app/layout.tsx +37 -37
- package/template/src/app/page.tsx +5 -5
- package/template/src/app/providers.tsx +27 -27
- package/template/src/components/layout/main-content.tsx +28 -28
- package/template/src/components/layout/sidebar-context.tsx +33 -33
- package/template/src/components/layout/sidebar.tsx +141 -141
- package/template/src/components/tables/data-table-column-header.tsx +68 -68
- package/template/src/components/tables/data-table-date-filter.tsx +203 -203
- package/template/src/components/tables/data-table-faceted-filter.tsx +185 -185
- package/template/src/components/tables/data-table-filters-dropdown.tsx +130 -130
- package/template/src/components/tables/data-table-number-filter.tsx +295 -295
- package/template/src/components/tables/data-table-pagination.tsx +99 -99
- package/template/src/components/tables/data-table-toolbar.tsx +140 -140
- package/template/src/components/tables/data-table-view-options.tsx +63 -63
- package/template/src/components/tables/data-table.tsx +148 -148
- package/template/src/components/tables/index.ts +9 -9
- package/template/src/components/ui/accordion.tsx +58 -58
- package/template/src/components/ui/alert-dialog.tsx +165 -165
- package/template/src/components/ui/alert.tsx +66 -66
- package/template/src/components/ui/animations/index.ts +44 -44
- package/template/src/components/ui/avatar.tsx +55 -55
- package/template/src/components/ui/badge.tsx +50 -50
- package/template/src/components/ui/button.tsx +118 -118
- package/template/src/components/ui/calendar.tsx +220 -220
- package/template/src/components/ui/card.tsx +113 -113
- package/template/src/components/ui/checkbox.tsx +38 -38
- package/template/src/components/ui/collapsible.tsx +33 -33
- package/template/src/components/ui/command.tsx +196 -196
- package/template/src/components/ui/dialog.tsx +156 -156
- package/template/src/components/ui/dropdown-menu.tsx +280 -280
- package/template/src/components/ui/form.tsx +171 -171
- package/template/src/components/ui/icons.tsx +167 -167
- package/template/src/components/ui/input.tsx +28 -28
- package/template/src/components/ui/label.tsx +25 -25
- package/template/src/components/ui/motion.tsx +197 -197
- package/template/src/components/ui/page-transition.tsx +166 -166
- package/template/src/components/ui/popover.tsx +59 -59
- package/template/src/components/ui/progress.tsx +32 -32
- package/template/src/components/ui/radio-group.tsx +45 -45
- package/template/src/components/ui/scroll-area.tsx +63 -63
- package/template/src/components/ui/select.tsx +208 -208
- package/template/src/components/ui/separator.tsx +28 -28
- package/template/src/components/ui/sheet.tsx +170 -170
- package/template/src/components/ui/sidebar.tsx +726 -726
- package/template/src/components/ui/skeleton.tsx +15 -15
- package/template/src/components/ui/slider.tsx +58 -58
- package/template/src/components/ui/sonner.tsx +47 -47
- package/template/src/components/ui/spinner.tsx +27 -27
- package/template/src/components/ui/submit-button.tsx +47 -47
- package/template/src/components/ui/switch.tsx +31 -31
- package/template/src/components/ui/table.tsx +120 -120
- package/template/src/components/ui/tabs.tsx +75 -75
- package/template/src/components/ui/textarea.tsx +26 -26
- package/template/src/components/ui/tooltip.tsx +70 -70
- package/template/src/config/navigation.ts +59 -59
- package/template/src/config/roles.ts +27 -27
- package/template/src/config/site.ts +12 -12
- package/template/src/db/index.ts +12 -12
- package/template/src/db/schema/index.ts +1 -1
- package/template/src/db/schema/users.ts +16 -16
- package/template/src/db/seed.ts +39 -39
- package/template/src/hooks/index.ts +3 -3
- package/template/src/hooks/use-mobile.ts +21 -21
- package/template/src/hooks/useDataTable.ts +82 -82
- package/template/src/hooks/useDebounce.ts +49 -49
- package/template/src/hooks/useMediaQuery.ts +36 -36
- package/template/src/lib/date/config.ts +36 -36
- package/template/src/lib/date/formatters.ts +127 -127
- package/template/src/lib/date/index.ts +26 -26
- package/template/src/lib/excel/exporter.ts +89 -89
- package/template/src/lib/excel/index.ts +14 -14
- package/template/src/lib/excel/parser.ts +96 -96
- package/template/src/lib/query-client.ts +35 -35
- package/template/src/lib/supabase/admin.ts +23 -23
- package/template/src/lib/supabase/client.ts +11 -11
- package/template/src/lib/supabase/proxy.ts +67 -67
- package/template/src/lib/supabase/server.ts +38 -38
- package/template/src/lib/supabase/types.ts +53 -53
- package/template/src/lib/utils.ts +6 -6
- package/template/src/lib/validations/common.ts +75 -75
- package/template/src/lib/validations/index.ts +20 -20
- package/template/src/modules/auth/actions/auth-actions.ts +59 -59
- package/template/src/modules/auth/components/login-form.tsx +68 -68
- package/template/src/modules/auth/hooks/useAuth.ts +38 -38
- package/template/src/modules/auth/hooks/useAuthMutations.ts +43 -43
- package/template/src/modules/auth/hooks/useAuthQueries.ts +43 -43
- package/template/src/modules/auth/index.ts +12 -12
- package/template/src/modules/auth/schemas/auth.schema.ts +32 -32
- package/template/src/modules/auth/stores/useAuthStore.ts +37 -37
- package/template/src/modules/users/actions/users-actions.ts +166 -166
- package/template/src/modules/users/columns.tsx +106 -106
- package/template/src/modules/users/components/users-list.tsx +48 -48
- package/template/src/modules/users/hooks/useUsers.ts +39 -39
- package/template/src/modules/users/hooks/useUsersMutations.ts +55 -55
- package/template/src/modules/users/hooks/useUsersQueries.ts +35 -35
- package/template/src/modules/users/index.ts +30 -30
- package/template/src/modules/users/schemas/users.schema.ts +51 -51
- package/template/src/modules/users/stores/useUsersStore.ts +60 -60
- package/template/src/modules/users/types/auth-user.types.ts +42 -42
- package/template/src/modules/users/utils/user-mapper.ts +32 -32
- package/template/src/stores/index.ts +1 -1
- package/template/src/stores/useUiStore.ts +55 -55
- package/template/src/types/api.ts +28 -28
- package/template/src/types/index.ts +2 -2
- package/template/src/types/table.ts +34 -34
- package/template/supabase/config.toml +94 -94
- package/template/tsconfig.json +42 -42
|
@@ -1,220 +1,220 @@
|
|
|
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 "@/components/ui/button"
|
|
17
|
-
|
|
18
|
-
function Calendar({
|
|
19
|
-
className,
|
|
20
|
-
classNames,
|
|
21
|
-
showOutsideDays = true,
|
|
22
|
-
captionLayout = "label",
|
|
23
|
-
buttonVariant = "ghost",
|
|
24
|
-
formatters,
|
|
25
|
-
components,
|
|
26
|
-
...props
|
|
27
|
-
}: React.ComponentProps<typeof DayPicker> & {
|
|
28
|
-
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
29
|
-
}) {
|
|
30
|
-
const defaultClassNames = getDefaultClassNames()
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<DayPicker
|
|
34
|
-
showOutsideDays={showOutsideDays}
|
|
35
|
-
className={cn(
|
|
36
|
-
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
37
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
38
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
39
|
-
className
|
|
40
|
-
)}
|
|
41
|
-
captionLayout={captionLayout}
|
|
42
|
-
formatters={{
|
|
43
|
-
formatMonthDropdown: (date) =>
|
|
44
|
-
date.toLocaleString("default", { month: "short" }),
|
|
45
|
-
...formatters,
|
|
46
|
-
}}
|
|
47
|
-
classNames={{
|
|
48
|
-
root: cn("w-fit", defaultClassNames.root),
|
|
49
|
-
months: cn(
|
|
50
|
-
"flex gap-4 flex-col md:flex-row relative",
|
|
51
|
-
defaultClassNames.months
|
|
52
|
-
),
|
|
53
|
-
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
54
|
-
nav: cn(
|
|
55
|
-
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
56
|
-
defaultClassNames.nav
|
|
57
|
-
),
|
|
58
|
-
button_previous: cn(
|
|
59
|
-
buttonVariants({ variant: buttonVariant }),
|
|
60
|
-
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
61
|
-
defaultClassNames.button_previous
|
|
62
|
-
),
|
|
63
|
-
button_next: cn(
|
|
64
|
-
buttonVariants({ variant: buttonVariant }),
|
|
65
|
-
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
66
|
-
defaultClassNames.button_next
|
|
67
|
-
),
|
|
68
|
-
month_caption: cn(
|
|
69
|
-
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
70
|
-
defaultClassNames.month_caption
|
|
71
|
-
),
|
|
72
|
-
dropdowns: cn(
|
|
73
|
-
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
74
|
-
defaultClassNames.dropdowns
|
|
75
|
-
),
|
|
76
|
-
dropdown_root: cn(
|
|
77
|
-
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
78
|
-
defaultClassNames.dropdown_root
|
|
79
|
-
),
|
|
80
|
-
dropdown: cn(
|
|
81
|
-
"absolute bg-popover inset-0 opacity-0",
|
|
82
|
-
defaultClassNames.dropdown
|
|
83
|
-
),
|
|
84
|
-
caption_label: cn(
|
|
85
|
-
"select-none font-medium",
|
|
86
|
-
captionLayout === "label"
|
|
87
|
-
? "text-sm"
|
|
88
|
-
: "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
89
|
-
defaultClassNames.caption_label
|
|
90
|
-
),
|
|
91
|
-
table: "w-full border-collapse",
|
|
92
|
-
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
93
|
-
weekday: cn(
|
|
94
|
-
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
95
|
-
defaultClassNames.weekday
|
|
96
|
-
),
|
|
97
|
-
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
98
|
-
week_number_header: cn(
|
|
99
|
-
"select-none w-(--cell-size)",
|
|
100
|
-
defaultClassNames.week_number_header
|
|
101
|
-
),
|
|
102
|
-
week_number: cn(
|
|
103
|
-
"text-[0.8rem] select-none text-muted-foreground",
|
|
104
|
-
defaultClassNames.week_number
|
|
105
|
-
),
|
|
106
|
-
day: cn(
|
|
107
|
-
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
108
|
-
props.showWeekNumber
|
|
109
|
-
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
110
|
-
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
111
|
-
defaultClassNames.day
|
|
112
|
-
),
|
|
113
|
-
range_start: cn(
|
|
114
|
-
"rounded-l-md bg-accent",
|
|
115
|
-
defaultClassNames.range_start
|
|
116
|
-
),
|
|
117
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
118
|
-
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
119
|
-
today: cn(
|
|
120
|
-
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
121
|
-
defaultClassNames.today
|
|
122
|
-
),
|
|
123
|
-
outside: cn(
|
|
124
|
-
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
125
|
-
defaultClassNames.outside
|
|
126
|
-
),
|
|
127
|
-
disabled: cn(
|
|
128
|
-
"text-muted-foreground opacity-50",
|
|
129
|
-
defaultClassNames.disabled
|
|
130
|
-
),
|
|
131
|
-
hidden: cn("invisible", defaultClassNames.hidden),
|
|
132
|
-
...classNames,
|
|
133
|
-
}}
|
|
134
|
-
components={{
|
|
135
|
-
Root: ({ className, rootRef, ...props }) => {
|
|
136
|
-
return (
|
|
137
|
-
<div
|
|
138
|
-
data-slot="calendar"
|
|
139
|
-
ref={rootRef}
|
|
140
|
-
className={cn(className)}
|
|
141
|
-
{...props}
|
|
142
|
-
/>
|
|
143
|
-
)
|
|
144
|
-
},
|
|
145
|
-
Chevron: ({ className, orientation, ...props }) => {
|
|
146
|
-
if (orientation === "left") {
|
|
147
|
-
return (
|
|
148
|
-
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (orientation === "right") {
|
|
153
|
-
return (
|
|
154
|
-
<ChevronRightIcon
|
|
155
|
-
className={cn("size-4", className)}
|
|
156
|
-
{...props}
|
|
157
|
-
/>
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
163
|
-
)
|
|
164
|
-
},
|
|
165
|
-
DayButton: CalendarDayButton,
|
|
166
|
-
WeekNumber: ({ children, ...props }) => {
|
|
167
|
-
return (
|
|
168
|
-
<td {...props}>
|
|
169
|
-
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
170
|
-
{children}
|
|
171
|
-
</div>
|
|
172
|
-
</td>
|
|
173
|
-
)
|
|
174
|
-
},
|
|
175
|
-
...components,
|
|
176
|
-
}}
|
|
177
|
-
{...props}
|
|
178
|
-
/>
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function CalendarDayButton({
|
|
183
|
-
className,
|
|
184
|
-
day,
|
|
185
|
-
modifiers,
|
|
186
|
-
...props
|
|
187
|
-
}: React.ComponentProps<typeof DayButton>) {
|
|
188
|
-
const defaultClassNames = getDefaultClassNames()
|
|
189
|
-
|
|
190
|
-
const ref = React.useRef<HTMLButtonElement>(null)
|
|
191
|
-
React.useEffect(() => {
|
|
192
|
-
if (modifiers.focused) ref.current?.focus()
|
|
193
|
-
}, [modifiers.focused])
|
|
194
|
-
|
|
195
|
-
return (
|
|
196
|
-
<Button
|
|
197
|
-
ref={ref}
|
|
198
|
-
variant="ghost"
|
|
199
|
-
size="icon"
|
|
200
|
-
data-day={day.date.toLocaleDateString()}
|
|
201
|
-
data-selected-single={
|
|
202
|
-
modifiers.selected &&
|
|
203
|
-
!modifiers.range_start &&
|
|
204
|
-
!modifiers.range_end &&
|
|
205
|
-
!modifiers.range_middle
|
|
206
|
-
}
|
|
207
|
-
data-range-start={modifiers.range_start}
|
|
208
|
-
data-range-end={modifiers.range_end}
|
|
209
|
-
data-range-middle={modifiers.range_middle}
|
|
210
|
-
className={cn(
|
|
211
|
-
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground 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:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
212
|
-
defaultClassNames.day,
|
|
213
|
-
className
|
|
214
|
-
)}
|
|
215
|
-
{...props}
|
|
216
|
-
/>
|
|
217
|
-
)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
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 "@/components/ui/button"
|
|
17
|
+
|
|
18
|
+
function Calendar({
|
|
19
|
+
className,
|
|
20
|
+
classNames,
|
|
21
|
+
showOutsideDays = true,
|
|
22
|
+
captionLayout = "label",
|
|
23
|
+
buttonVariant = "ghost",
|
|
24
|
+
formatters,
|
|
25
|
+
components,
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
28
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
29
|
+
}) {
|
|
30
|
+
const defaultClassNames = getDefaultClassNames()
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<DayPicker
|
|
34
|
+
showOutsideDays={showOutsideDays}
|
|
35
|
+
className={cn(
|
|
36
|
+
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
37
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
38
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
captionLayout={captionLayout}
|
|
42
|
+
formatters={{
|
|
43
|
+
formatMonthDropdown: (date) =>
|
|
44
|
+
date.toLocaleString("default", { month: "short" }),
|
|
45
|
+
...formatters,
|
|
46
|
+
}}
|
|
47
|
+
classNames={{
|
|
48
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
49
|
+
months: cn(
|
|
50
|
+
"flex gap-4 flex-col md:flex-row relative",
|
|
51
|
+
defaultClassNames.months
|
|
52
|
+
),
|
|
53
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
54
|
+
nav: cn(
|
|
55
|
+
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
56
|
+
defaultClassNames.nav
|
|
57
|
+
),
|
|
58
|
+
button_previous: cn(
|
|
59
|
+
buttonVariants({ variant: buttonVariant }),
|
|
60
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
61
|
+
defaultClassNames.button_previous
|
|
62
|
+
),
|
|
63
|
+
button_next: cn(
|
|
64
|
+
buttonVariants({ variant: buttonVariant }),
|
|
65
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
66
|
+
defaultClassNames.button_next
|
|
67
|
+
),
|
|
68
|
+
month_caption: cn(
|
|
69
|
+
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
70
|
+
defaultClassNames.month_caption
|
|
71
|
+
),
|
|
72
|
+
dropdowns: cn(
|
|
73
|
+
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
74
|
+
defaultClassNames.dropdowns
|
|
75
|
+
),
|
|
76
|
+
dropdown_root: cn(
|
|
77
|
+
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
78
|
+
defaultClassNames.dropdown_root
|
|
79
|
+
),
|
|
80
|
+
dropdown: cn(
|
|
81
|
+
"absolute bg-popover inset-0 opacity-0",
|
|
82
|
+
defaultClassNames.dropdown
|
|
83
|
+
),
|
|
84
|
+
caption_label: cn(
|
|
85
|
+
"select-none font-medium",
|
|
86
|
+
captionLayout === "label"
|
|
87
|
+
? "text-sm"
|
|
88
|
+
: "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
89
|
+
defaultClassNames.caption_label
|
|
90
|
+
),
|
|
91
|
+
table: "w-full border-collapse",
|
|
92
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
93
|
+
weekday: cn(
|
|
94
|
+
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
95
|
+
defaultClassNames.weekday
|
|
96
|
+
),
|
|
97
|
+
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
98
|
+
week_number_header: cn(
|
|
99
|
+
"select-none w-(--cell-size)",
|
|
100
|
+
defaultClassNames.week_number_header
|
|
101
|
+
),
|
|
102
|
+
week_number: cn(
|
|
103
|
+
"text-[0.8rem] select-none text-muted-foreground",
|
|
104
|
+
defaultClassNames.week_number
|
|
105
|
+
),
|
|
106
|
+
day: cn(
|
|
107
|
+
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
108
|
+
props.showWeekNumber
|
|
109
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
110
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
111
|
+
defaultClassNames.day
|
|
112
|
+
),
|
|
113
|
+
range_start: cn(
|
|
114
|
+
"rounded-l-md bg-accent",
|
|
115
|
+
defaultClassNames.range_start
|
|
116
|
+
),
|
|
117
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
118
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
119
|
+
today: cn(
|
|
120
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
121
|
+
defaultClassNames.today
|
|
122
|
+
),
|
|
123
|
+
outside: cn(
|
|
124
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
125
|
+
defaultClassNames.outside
|
|
126
|
+
),
|
|
127
|
+
disabled: cn(
|
|
128
|
+
"text-muted-foreground opacity-50",
|
|
129
|
+
defaultClassNames.disabled
|
|
130
|
+
),
|
|
131
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
132
|
+
...classNames,
|
|
133
|
+
}}
|
|
134
|
+
components={{
|
|
135
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
136
|
+
return (
|
|
137
|
+
<div
|
|
138
|
+
data-slot="calendar"
|
|
139
|
+
ref={rootRef}
|
|
140
|
+
className={cn(className)}
|
|
141
|
+
{...props}
|
|
142
|
+
/>
|
|
143
|
+
)
|
|
144
|
+
},
|
|
145
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
146
|
+
if (orientation === "left") {
|
|
147
|
+
return (
|
|
148
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (orientation === "right") {
|
|
153
|
+
return (
|
|
154
|
+
<ChevronRightIcon
|
|
155
|
+
className={cn("size-4", className)}
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
163
|
+
)
|
|
164
|
+
},
|
|
165
|
+
DayButton: CalendarDayButton,
|
|
166
|
+
WeekNumber: ({ children, ...props }) => {
|
|
167
|
+
return (
|
|
168
|
+
<td {...props}>
|
|
169
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
170
|
+
{children}
|
|
171
|
+
</div>
|
|
172
|
+
</td>
|
|
173
|
+
)
|
|
174
|
+
},
|
|
175
|
+
...components,
|
|
176
|
+
}}
|
|
177
|
+
{...props}
|
|
178
|
+
/>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function CalendarDayButton({
|
|
183
|
+
className,
|
|
184
|
+
day,
|
|
185
|
+
modifiers,
|
|
186
|
+
...props
|
|
187
|
+
}: React.ComponentProps<typeof DayButton>) {
|
|
188
|
+
const defaultClassNames = getDefaultClassNames()
|
|
189
|
+
|
|
190
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
if (modifiers.focused) ref.current?.focus()
|
|
193
|
+
}, [modifiers.focused])
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<Button
|
|
197
|
+
ref={ref}
|
|
198
|
+
variant="ghost"
|
|
199
|
+
size="icon"
|
|
200
|
+
data-day={day.date.toLocaleDateString()}
|
|
201
|
+
data-selected-single={
|
|
202
|
+
modifiers.selected &&
|
|
203
|
+
!modifiers.range_start &&
|
|
204
|
+
!modifiers.range_end &&
|
|
205
|
+
!modifiers.range_middle
|
|
206
|
+
}
|
|
207
|
+
data-range-start={modifiers.range_start}
|
|
208
|
+
data-range-end={modifiers.range_end}
|
|
209
|
+
data-range-middle={modifiers.range_middle}
|
|
210
|
+
className={cn(
|
|
211
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground 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:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
212
|
+
defaultClassNames.day,
|
|
213
|
+
className
|
|
214
|
+
)}
|
|
215
|
+
{...props}
|
|
216
|
+
/>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { motion, type HTMLMotionProps } from "framer-motion"
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
interface CardProps extends HTMLMotionProps<"div"> {
|
|
8
|
-
animate?: boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function Card({ className, animate = true, ...props }: CardProps) {
|
|
12
|
-
if (!animate) {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
data-slot="card"
|
|
16
|
-
className={cn(
|
|
17
|
-
"rounded-lg border border-border bg-card text-card-foreground",
|
|
18
|
-
className
|
|
19
|
-
)}
|
|
20
|
-
{...(props as React.ComponentProps<"div">)}
|
|
21
|
-
/>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<motion.div
|
|
27
|
-
data-slot="card"
|
|
28
|
-
initial={{ opacity: 0, y: 10 }}
|
|
29
|
-
animate={{ opacity: 1, y: 0 }}
|
|
30
|
-
transition={{ duration: 0.3, ease: "easeOut" }}
|
|
31
|
-
whileHover={{ y: -2, transition: { duration: 0.2 } }}
|
|
32
|
-
className={cn(
|
|
33
|
-
"rounded-lg border border-border bg-card text-card-foreground",
|
|
34
|
-
"transition-shadow hover:shadow-md",
|
|
35
|
-
className
|
|
36
|
-
)}
|
|
37
|
-
{...props}
|
|
38
|
-
/>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
43
|
-
return (
|
|
44
|
-
<div
|
|
45
|
-
data-slot="card-header"
|
|
46
|
-
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
47
|
-
{...props}
|
|
48
|
-
/>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
53
|
-
return (
|
|
54
|
-
<div
|
|
55
|
-
data-slot="card-title"
|
|
56
|
-
className={cn("text-lg font-medium leading-none tracking-tight", className)}
|
|
57
|
-
{...props}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
data-slot="card-description"
|
|
66
|
-
className={cn("text-sm text-muted-foreground", className)}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
-
return (
|
|
74
|
-
<div
|
|
75
|
-
data-slot="card-action"
|
|
76
|
-
className={cn(
|
|
77
|
-
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
78
|
-
className
|
|
79
|
-
)}
|
|
80
|
-
{...props}
|
|
81
|
-
/>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
86
|
-
return (
|
|
87
|
-
<div
|
|
88
|
-
data-slot="card-content"
|
|
89
|
-
className={cn("p-6 pt-0", className)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
96
|
-
return (
|
|
97
|
-
<div
|
|
98
|
-
data-slot="card-footer"
|
|
99
|
-
className={cn("flex items-center p-6 pt-0", className)}
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export {
|
|
106
|
-
Card,
|
|
107
|
-
CardHeader,
|
|
108
|
-
CardFooter,
|
|
109
|
-
CardTitle,
|
|
110
|
-
CardAction,
|
|
111
|
-
CardDescription,
|
|
112
|
-
CardContent,
|
|
113
|
-
}
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { motion, type HTMLMotionProps } from "framer-motion"
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
interface CardProps extends HTMLMotionProps<"div"> {
|
|
8
|
+
animate?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function Card({ className, animate = true, ...props }: CardProps) {
|
|
12
|
+
if (!animate) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
data-slot="card"
|
|
16
|
+
className={cn(
|
|
17
|
+
"rounded-lg border border-border bg-card text-card-foreground",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...(props as React.ComponentProps<"div">)}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<motion.div
|
|
27
|
+
data-slot="card"
|
|
28
|
+
initial={{ opacity: 0, y: 10 }}
|
|
29
|
+
animate={{ opacity: 1, y: 0 }}
|
|
30
|
+
transition={{ duration: 0.3, ease: "easeOut" }}
|
|
31
|
+
whileHover={{ y: -2, transition: { duration: 0.2 } }}
|
|
32
|
+
className={cn(
|
|
33
|
+
"rounded-lg border border-border bg-card text-card-foreground",
|
|
34
|
+
"transition-shadow hover:shadow-md",
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
data-slot="card-header"
|
|
46
|
+
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
data-slot="card-title"
|
|
56
|
+
className={cn("text-lg font-medium leading-none tracking-tight", className)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
data-slot="card-description"
|
|
66
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
67
|
+
{...props}
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
73
|
+
return (
|
|
74
|
+
<div
|
|
75
|
+
data-slot="card-action"
|
|
76
|
+
className={cn(
|
|
77
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
78
|
+
className
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
data-slot="card-content"
|
|
89
|
+
className={cn("p-6 pt-0", className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
96
|
+
return (
|
|
97
|
+
<div
|
|
98
|
+
data-slot="card-footer"
|
|
99
|
+
className={cn("flex items-center p-6 pt-0", className)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
Card,
|
|
107
|
+
CardHeader,
|
|
108
|
+
CardFooter,
|
|
109
|
+
CardTitle,
|
|
110
|
+
CardAction,
|
|
111
|
+
CardDescription,
|
|
112
|
+
CardContent,
|
|
113
|
+
}
|