saas-forge 0.0.1
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/.eslintrc.js +10 -0
- package/.vscode/settings.json +3 -0
- package/README.md +31 -0
- package/apps/web/.env.example +1 -0
- package/apps/web/app/favicon.ico +0 -0
- package/apps/web/app/layout.tsx +23 -0
- package/apps/web/app/page.tsx +12 -0
- package/apps/web/components.json +20 -0
- package/apps/web/eslint.config.js +4 -0
- package/apps/web/hooks/.gitkeep +0 -0
- package/apps/web/next-env.d.ts +5 -0
- package/apps/web/next.config.mjs +6 -0
- package/apps/web/package.json +32 -0
- package/apps/web/postcss.config.mjs +1 -0
- package/apps/web/tsconfig.json +23 -0
- package/docs/CODE_OF_CONDUCT.md +128 -0
- package/docs/CONTRIBUTING.md +45 -0
- package/docs/ISSUE_TEMPLATE/bug_report.md +31 -0
- package/docs/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/docs/SECURITY.md +9 -0
- package/docs/pull_request_template.md +24 -0
- package/package.json +38 -0
- package/packages/eslint-config/README.md +3 -0
- package/packages/eslint-config/base.js +32 -0
- package/packages/eslint-config/next.js +51 -0
- package/packages/eslint-config/package.json +26 -0
- package/packages/eslint-config/react-internal.js +41 -0
- package/packages/typescript-config/README.md +3 -0
- package/packages/typescript-config/base.json +20 -0
- package/packages/typescript-config/nextjs.json +13 -0
- package/packages/typescript-config/package.json +9 -0
- package/packages/typescript-config/react-library.json +8 -0
- package/packages/ui/components.json +20 -0
- package/packages/ui/eslint.config.js +4 -0
- package/packages/ui/package.json +86 -0
- package/packages/ui/postcss.config.mjs +6 -0
- package/packages/ui/src/components/.gitkeep +0 -0
- package/packages/ui/src/components/aceternity/3d-card.tsx +155 -0
- package/packages/ui/src/components/aceternity/3d-marquee.tsx +142 -0
- package/packages/ui/src/components/aceternity/Spotlight.tsx +57 -0
- package/packages/ui/src/components/aceternity/animated-testimonials.tsx +165 -0
- package/packages/ui/src/components/aceternity/animated-tooltip.tsx +92 -0
- package/packages/ui/src/components/aceternity/aurora-background.tsx +61 -0
- package/packages/ui/src/components/aceternity/background-beams.tsx +141 -0
- package/packages/ui/src/components/aceternity/background-gradient.tsx +72 -0
- package/packages/ui/src/components/aceternity/card-hover-effect.tsx +111 -0
- package/packages/ui/src/components/aceternity/compare.tsx +244 -0
- package/packages/ui/src/components/aceternity/container-scroll-animation.tsx +95 -0
- package/packages/ui/src/components/aceternity/lamp.tsx +104 -0
- package/packages/ui/src/components/aceternity/sparkles.tsx +434 -0
- package/packages/ui/src/components/aceternity/spotlight-new.tsx +128 -0
- package/packages/ui/src/components/mdx/Alert.tsx +14 -0
- package/packages/ui/src/components/mdx/Badge.tsx +10 -0
- package/packages/ui/src/components/mdx/blockquote.tsx +11 -0
- package/packages/ui/src/components/mdx/code.tsx +16 -0
- package/packages/ui/src/components/mdx/h1.tsx +18 -0
- package/packages/ui/src/components/mdx/h2.tsx +18 -0
- package/packages/ui/src/components/mdx/h3.tsx +18 -0
- package/packages/ui/src/components/mdx/hr.tsx +7 -0
- package/packages/ui/src/components/mdx/li.tsx +7 -0
- package/packages/ui/src/components/mdx/mdxComponents.tsx +25 -0
- package/packages/ui/src/components/mdx/ol.tsx +7 -0
- package/packages/ui/src/components/mdx/pre.tsx +13 -0
- package/packages/ui/src/components/mdx/tableOfContents.tsx +23 -0
- package/packages/ui/src/components/mdx/ul.tsx +7 -0
- package/packages/ui/src/components/mdx/ulNumbered.tsx +7 -0
- package/packages/ui/src/components/shadcn/accordion.tsx +66 -0
- package/packages/ui/src/components/shadcn/alert-dialog.tsx +157 -0
- package/packages/ui/src/components/shadcn/alert.tsx +66 -0
- package/packages/ui/src/components/shadcn/aspect-ratio.tsx +11 -0
- package/packages/ui/src/components/shadcn/avatar.tsx +53 -0
- package/packages/ui/src/components/shadcn/badge.tsx +46 -0
- package/packages/ui/src/components/shadcn/breadcrumb.tsx +109 -0
- package/packages/ui/src/components/shadcn/button-group.tsx +83 -0
- package/packages/ui/src/components/shadcn/button.tsx +60 -0
- package/packages/ui/src/components/shadcn/calendar.tsx +216 -0
- package/packages/ui/src/components/shadcn/card.tsx +92 -0
- package/packages/ui/src/components/shadcn/carousel.tsx +241 -0
- package/packages/ui/src/components/shadcn/chart.tsx +357 -0
- package/packages/ui/src/components/shadcn/checkbox.tsx +32 -0
- package/packages/ui/src/components/shadcn/collapsible.tsx +33 -0
- package/packages/ui/src/components/shadcn/command.tsx +184 -0
- package/packages/ui/src/components/shadcn/context-menu.tsx +252 -0
- package/packages/ui/src/components/shadcn/dialog.tsx +143 -0
- package/packages/ui/src/components/shadcn/drawer.tsx +135 -0
- package/packages/ui/src/components/shadcn/dropdown-menu.tsx +257 -0
- package/packages/ui/src/components/shadcn/empty.tsx +104 -0
- package/packages/ui/src/components/shadcn/field.tsx +248 -0
- package/packages/ui/src/components/shadcn/form.tsx +167 -0
- package/packages/ui/src/components/shadcn/hover-card.tsx +44 -0
- package/packages/ui/src/components/shadcn/input-group.tsx +170 -0
- package/packages/ui/src/components/shadcn/input-otp.tsx +77 -0
- package/packages/ui/src/components/shadcn/input.tsx +21 -0
- package/packages/ui/src/components/shadcn/item.tsx +193 -0
- package/packages/ui/src/components/shadcn/kbd.tsx +28 -0
- package/packages/ui/src/components/shadcn/label.tsx +24 -0
- package/packages/ui/src/components/shadcn/menubar.tsx +276 -0
- package/packages/ui/src/components/shadcn/native-select.tsx +48 -0
- package/packages/ui/src/components/shadcn/navigation-menu.tsx +168 -0
- package/packages/ui/src/components/shadcn/pagination.tsx +127 -0
- package/packages/ui/src/components/shadcn/popover.tsx +48 -0
- package/packages/ui/src/components/shadcn/progress.tsx +31 -0
- package/packages/ui/src/components/shadcn/radio-group.tsx +45 -0
- package/packages/ui/src/components/shadcn/resizable.tsx +56 -0
- package/packages/ui/src/components/shadcn/scroll-area.tsx +58 -0
- package/packages/ui/src/components/shadcn/select.tsx +187 -0
- package/packages/ui/src/components/shadcn/separator.tsx +28 -0
- package/packages/ui/src/components/shadcn/sheet.tsx +139 -0
- package/packages/ui/src/components/shadcn/sidebar.tsx +726 -0
- package/packages/ui/src/components/shadcn/skeleton.tsx +13 -0
- package/packages/ui/src/components/shadcn/slider.tsx +63 -0
- package/packages/ui/src/components/shadcn/sonner.tsx +40 -0
- package/packages/ui/src/components/shadcn/spinner.tsx +16 -0
- package/packages/ui/src/components/shadcn/switch.tsx +31 -0
- package/packages/ui/src/components/shadcn/table.tsx +116 -0
- package/packages/ui/src/components/shadcn/tabs.tsx +66 -0
- package/packages/ui/src/components/shadcn/textarea.tsx +18 -0
- package/packages/ui/src/components/shadcn/toggle-group.tsx +83 -0
- package/packages/ui/src/components/shadcn/toggle.tsx +47 -0
- package/packages/ui/src/components/shadcn/tooltip.tsx +61 -0
- package/packages/ui/src/hooks/.gitkeep +0 -0
- package/packages/ui/src/hooks/use-device.tsx +29 -0
- package/packages/ui/src/hooks/use-mobile.tsx +19 -0
- package/packages/ui/src/hooks/use-outside-click.tsx +23 -0
- package/packages/ui/src/lib/utils.ts +6 -0
- package/packages/ui/src/providers/theme-provider.tsx +18 -0
- package/packages/ui/src/styles/globals.css +65 -0
- package/packages/ui/src/styles/shadcn-blue.css +69 -0
- package/packages/ui/src/styles/shadcn-green.css +68 -0
- package/packages/ui/src/styles/shadcn-neutral.css +69 -0
- package/packages/ui/src/styles/shadcn-orange.css +68 -0
- package/packages/ui/src/styles/shadcn-red.css +68 -0
- package/packages/ui/src/styles/shadcn-rose.css +68 -0
- package/packages/ui/src/styles/shadcn-violet.css +68 -0
- package/packages/ui/src/styles/shadcn-yellow.css +68 -0
- package/packages/ui/src/typography/font.tsx +19 -0
- package/packages/ui/src/typography/fontFiles/Cyberdyne.woff2 +0 -0
- package/packages/ui/src/typography/fontFiles/GeistMonoVF.woff +0 -0
- package/packages/ui/src/typography/fontFiles/GeistVF.woff +0 -0
- package/packages/ui/tsconfig.json +11 -0
- package/packages/ui/tsconfig.lint.json +8 -0
- package/pnpm-workspace.yaml +3 -0
- package/scripts/cli.js +44 -0
- package/tsconfig.json +4 -0
- package/turbo.json +21 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@workspace/ui/lib/utils"
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md 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:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
+
outline:
|
|
16
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost:
|
|
20
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
"icon-sm": "size-8",
|
|
29
|
+
"icon-lg": "size-10",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
function Button({
|
|
40
|
+
className,
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
asChild = false,
|
|
44
|
+
...props
|
|
45
|
+
}: React.ComponentProps<"button"> &
|
|
46
|
+
VariantProps<typeof buttonVariants> & {
|
|
47
|
+
asChild?: boolean
|
|
48
|
+
}) {
|
|
49
|
+
const Comp = asChild ? Slot : "button"
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Comp
|
|
53
|
+
data-slot="button"
|
|
54
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
ChevronLeftIcon,
|
|
7
|
+
ChevronRightIcon,
|
|
8
|
+
} from "lucide-react"
|
|
9
|
+
import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
|
|
10
|
+
|
|
11
|
+
import { cn } from "@workspace/ui/lib/utils"
|
|
12
|
+
import { Button, buttonVariants } from "@workspace/ui/components/shadcn/button"
|
|
13
|
+
|
|
14
|
+
function Calendar({
|
|
15
|
+
className,
|
|
16
|
+
classNames,
|
|
17
|
+
showOutsideDays = true,
|
|
18
|
+
captionLayout = "label",
|
|
19
|
+
buttonVariant = "ghost",
|
|
20
|
+
formatters,
|
|
21
|
+
components,
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
24
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"]
|
|
25
|
+
}) {
|
|
26
|
+
const defaultClassNames = getDefaultClassNames()
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<DayPicker
|
|
30
|
+
showOutsideDays={showOutsideDays}
|
|
31
|
+
className={cn(
|
|
32
|
+
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
33
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
34
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
35
|
+
className
|
|
36
|
+
)}
|
|
37
|
+
captionLayout={captionLayout}
|
|
38
|
+
formatters={{
|
|
39
|
+
formatMonthDropdown: (date) =>
|
|
40
|
+
date.toLocaleString("default", { month: "short" }),
|
|
41
|
+
...formatters,
|
|
42
|
+
}}
|
|
43
|
+
classNames={{
|
|
44
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
45
|
+
months: cn(
|
|
46
|
+
"flex gap-4 flex-col md:flex-row relative",
|
|
47
|
+
defaultClassNames.months
|
|
48
|
+
),
|
|
49
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
50
|
+
nav: cn(
|
|
51
|
+
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
52
|
+
defaultClassNames.nav
|
|
53
|
+
),
|
|
54
|
+
button_previous: cn(
|
|
55
|
+
buttonVariants({ variant: buttonVariant }),
|
|
56
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
57
|
+
defaultClassNames.button_previous
|
|
58
|
+
),
|
|
59
|
+
button_next: cn(
|
|
60
|
+
buttonVariants({ variant: buttonVariant }),
|
|
61
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
62
|
+
defaultClassNames.button_next
|
|
63
|
+
),
|
|
64
|
+
month_caption: cn(
|
|
65
|
+
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
66
|
+
defaultClassNames.month_caption
|
|
67
|
+
),
|
|
68
|
+
dropdowns: cn(
|
|
69
|
+
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
70
|
+
defaultClassNames.dropdowns
|
|
71
|
+
),
|
|
72
|
+
dropdown_root: cn(
|
|
73
|
+
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
74
|
+
defaultClassNames.dropdown_root
|
|
75
|
+
),
|
|
76
|
+
dropdown: cn(
|
|
77
|
+
"absolute bg-popover inset-0 opacity-0",
|
|
78
|
+
defaultClassNames.dropdown
|
|
79
|
+
),
|
|
80
|
+
caption_label: cn(
|
|
81
|
+
"select-none font-medium",
|
|
82
|
+
captionLayout === "label"
|
|
83
|
+
? "text-sm"
|
|
84
|
+
: "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
85
|
+
defaultClassNames.caption_label
|
|
86
|
+
),
|
|
87
|
+
table: "w-full border-collapse",
|
|
88
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
89
|
+
weekday: cn(
|
|
90
|
+
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
91
|
+
defaultClassNames.weekday
|
|
92
|
+
),
|
|
93
|
+
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
94
|
+
week_number_header: cn(
|
|
95
|
+
"select-none w-(--cell-size)",
|
|
96
|
+
defaultClassNames.week_number_header
|
|
97
|
+
),
|
|
98
|
+
week_number: cn(
|
|
99
|
+
"text-[0.8rem] select-none text-muted-foreground",
|
|
100
|
+
defaultClassNames.week_number
|
|
101
|
+
),
|
|
102
|
+
day: cn(
|
|
103
|
+
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
104
|
+
props.showWeekNumber
|
|
105
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
106
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
107
|
+
defaultClassNames.day
|
|
108
|
+
),
|
|
109
|
+
range_start: cn(
|
|
110
|
+
"rounded-l-md bg-accent",
|
|
111
|
+
defaultClassNames.range_start
|
|
112
|
+
),
|
|
113
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
114
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
115
|
+
today: cn(
|
|
116
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
117
|
+
defaultClassNames.today
|
|
118
|
+
),
|
|
119
|
+
outside: cn(
|
|
120
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
121
|
+
defaultClassNames.outside
|
|
122
|
+
),
|
|
123
|
+
disabled: cn(
|
|
124
|
+
"text-muted-foreground opacity-50",
|
|
125
|
+
defaultClassNames.disabled
|
|
126
|
+
),
|
|
127
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
128
|
+
...classNames,
|
|
129
|
+
}}
|
|
130
|
+
components={{
|
|
131
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
132
|
+
return (
|
|
133
|
+
<div
|
|
134
|
+
data-slot="calendar"
|
|
135
|
+
ref={rootRef}
|
|
136
|
+
className={cn(className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
)
|
|
140
|
+
},
|
|
141
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
142
|
+
if (orientation === "left") {
|
|
143
|
+
return (
|
|
144
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (orientation === "right") {
|
|
149
|
+
return (
|
|
150
|
+
<ChevronRightIcon
|
|
151
|
+
className={cn("size-4", className)}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
159
|
+
)
|
|
160
|
+
},
|
|
161
|
+
DayButton: CalendarDayButton,
|
|
162
|
+
WeekNumber: ({ children, ...props }) => {
|
|
163
|
+
return (
|
|
164
|
+
<td {...props}>
|
|
165
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
166
|
+
{children}
|
|
167
|
+
</div>
|
|
168
|
+
</td>
|
|
169
|
+
)
|
|
170
|
+
},
|
|
171
|
+
...components,
|
|
172
|
+
}}
|
|
173
|
+
{...props}
|
|
174
|
+
/>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function CalendarDayButton({
|
|
179
|
+
className,
|
|
180
|
+
day,
|
|
181
|
+
modifiers,
|
|
182
|
+
...props
|
|
183
|
+
}: React.ComponentProps<typeof DayButton>) {
|
|
184
|
+
const defaultClassNames = getDefaultClassNames()
|
|
185
|
+
|
|
186
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
187
|
+
React.useEffect(() => {
|
|
188
|
+
if (modifiers.focused) ref.current?.focus()
|
|
189
|
+
}, [modifiers.focused])
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<Button
|
|
193
|
+
ref={ref}
|
|
194
|
+
variant="ghost"
|
|
195
|
+
size="icon"
|
|
196
|
+
data-day={day.date.toLocaleDateString()}
|
|
197
|
+
data-selected-single={
|
|
198
|
+
modifiers.selected &&
|
|
199
|
+
!modifiers.range_start &&
|
|
200
|
+
!modifiers.range_end &&
|
|
201
|
+
!modifiers.range_middle
|
|
202
|
+
}
|
|
203
|
+
data-range-start={modifiers.range_start}
|
|
204
|
+
data-range-end={modifiers.range_end}
|
|
205
|
+
data-range-middle={modifiers.range_middle}
|
|
206
|
+
className={cn(
|
|
207
|
+
"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",
|
|
208
|
+
defaultClassNames.day,
|
|
209
|
+
className
|
|
210
|
+
)}
|
|
211
|
+
{...props}
|
|
212
|
+
/>
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@workspace/ui/lib/utils"
|
|
4
|
+
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="card"
|
|
9
|
+
className={cn(
|
|
10
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 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-muted-foreground text-sm", 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
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import useEmblaCarousel, {
|
|
5
|
+
type UseEmblaCarouselType,
|
|
6
|
+
} from "embla-carousel-react"
|
|
7
|
+
import { ArrowLeft, ArrowRight } from "lucide-react"
|
|
8
|
+
|
|
9
|
+
import { cn } from "@workspace/ui/lib/utils"
|
|
10
|
+
import { Button } from "@workspace/ui/components/shadcn/button"
|
|
11
|
+
|
|
12
|
+
type CarouselApi = UseEmblaCarouselType[1]
|
|
13
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
|
14
|
+
type CarouselOptions = UseCarouselParameters[0]
|
|
15
|
+
type CarouselPlugin = UseCarouselParameters[1]
|
|
16
|
+
|
|
17
|
+
type CarouselProps = {
|
|
18
|
+
opts?: CarouselOptions
|
|
19
|
+
plugins?: CarouselPlugin
|
|
20
|
+
orientation?: "horizontal" | "vertical"
|
|
21
|
+
setApi?: (api: CarouselApi) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type CarouselContextProps = {
|
|
25
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
|
26
|
+
api: ReturnType<typeof useEmblaCarousel>[1]
|
|
27
|
+
scrollPrev: () => void
|
|
28
|
+
scrollNext: () => void
|
|
29
|
+
canScrollPrev: boolean
|
|
30
|
+
canScrollNext: boolean
|
|
31
|
+
} & CarouselProps
|
|
32
|
+
|
|
33
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
|
34
|
+
|
|
35
|
+
function useCarousel() {
|
|
36
|
+
const context = React.useContext(CarouselContext)
|
|
37
|
+
|
|
38
|
+
if (!context) {
|
|
39
|
+
throw new Error("useCarousel must be used within a <Carousel />")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return context
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function Carousel({
|
|
46
|
+
orientation = "horizontal",
|
|
47
|
+
opts,
|
|
48
|
+
setApi,
|
|
49
|
+
plugins,
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<"div"> & CarouselProps) {
|
|
54
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
55
|
+
{
|
|
56
|
+
...opts,
|
|
57
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
58
|
+
},
|
|
59
|
+
plugins
|
|
60
|
+
)
|
|
61
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
|
62
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
|
63
|
+
|
|
64
|
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
65
|
+
if (!api) return
|
|
66
|
+
setCanScrollPrev(api.canScrollPrev())
|
|
67
|
+
setCanScrollNext(api.canScrollNext())
|
|
68
|
+
}, [])
|
|
69
|
+
|
|
70
|
+
const scrollPrev = React.useCallback(() => {
|
|
71
|
+
api?.scrollPrev()
|
|
72
|
+
}, [api])
|
|
73
|
+
|
|
74
|
+
const scrollNext = React.useCallback(() => {
|
|
75
|
+
api?.scrollNext()
|
|
76
|
+
}, [api])
|
|
77
|
+
|
|
78
|
+
const handleKeyDown = React.useCallback(
|
|
79
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
80
|
+
if (event.key === "ArrowLeft") {
|
|
81
|
+
event.preventDefault()
|
|
82
|
+
scrollPrev()
|
|
83
|
+
} else if (event.key === "ArrowRight") {
|
|
84
|
+
event.preventDefault()
|
|
85
|
+
scrollNext()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
[scrollPrev, scrollNext]
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
if (!api || !setApi) return
|
|
93
|
+
setApi(api)
|
|
94
|
+
}, [api, setApi])
|
|
95
|
+
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
if (!api) return
|
|
98
|
+
onSelect(api)
|
|
99
|
+
api.on("reInit", onSelect)
|
|
100
|
+
api.on("select", onSelect)
|
|
101
|
+
|
|
102
|
+
return () => {
|
|
103
|
+
api?.off("select", onSelect)
|
|
104
|
+
}
|
|
105
|
+
}, [api, onSelect])
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<CarouselContext.Provider
|
|
109
|
+
value={{
|
|
110
|
+
carouselRef,
|
|
111
|
+
api: api,
|
|
112
|
+
opts,
|
|
113
|
+
orientation:
|
|
114
|
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
115
|
+
scrollPrev,
|
|
116
|
+
scrollNext,
|
|
117
|
+
canScrollPrev,
|
|
118
|
+
canScrollNext,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<div
|
|
122
|
+
onKeyDownCapture={handleKeyDown}
|
|
123
|
+
className={cn("relative", className)}
|
|
124
|
+
role="region"
|
|
125
|
+
aria-roledescription="carousel"
|
|
126
|
+
data-slot="carousel"
|
|
127
|
+
{...props}
|
|
128
|
+
>
|
|
129
|
+
{children}
|
|
130
|
+
</div>
|
|
131
|
+
</CarouselContext.Provider>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
136
|
+
const { carouselRef, orientation } = useCarousel()
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div
|
|
140
|
+
ref={carouselRef}
|
|
141
|
+
className="overflow-hidden"
|
|
142
|
+
data-slot="carousel-content"
|
|
143
|
+
>
|
|
144
|
+
<div
|
|
145
|
+
className={cn(
|
|
146
|
+
"flex",
|
|
147
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
148
|
+
className
|
|
149
|
+
)}
|
|
150
|
+
{...props}
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
157
|
+
const { orientation } = useCarousel()
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<div
|
|
161
|
+
role="group"
|
|
162
|
+
aria-roledescription="slide"
|
|
163
|
+
data-slot="carousel-item"
|
|
164
|
+
className={cn(
|
|
165
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
166
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function CarouselPrevious({
|
|
175
|
+
className,
|
|
176
|
+
variant = "outline",
|
|
177
|
+
size = "icon",
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<typeof Button>) {
|
|
180
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<Button
|
|
184
|
+
data-slot="carousel-previous"
|
|
185
|
+
variant={variant}
|
|
186
|
+
size={size}
|
|
187
|
+
className={cn(
|
|
188
|
+
"absolute size-8 rounded-full",
|
|
189
|
+
orientation === "horizontal"
|
|
190
|
+
? "top-1/2 -left-12 -translate-y-1/2"
|
|
191
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
192
|
+
className
|
|
193
|
+
)}
|
|
194
|
+
disabled={!canScrollPrev}
|
|
195
|
+
onClick={scrollPrev}
|
|
196
|
+
{...props}
|
|
197
|
+
>
|
|
198
|
+
<ArrowLeft />
|
|
199
|
+
<span className="sr-only">Previous slide</span>
|
|
200
|
+
</Button>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function CarouselNext({
|
|
205
|
+
className,
|
|
206
|
+
variant = "outline",
|
|
207
|
+
size = "icon",
|
|
208
|
+
...props
|
|
209
|
+
}: React.ComponentProps<typeof Button>) {
|
|
210
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<Button
|
|
214
|
+
data-slot="carousel-next"
|
|
215
|
+
variant={variant}
|
|
216
|
+
size={size}
|
|
217
|
+
className={cn(
|
|
218
|
+
"absolute size-8 rounded-full",
|
|
219
|
+
orientation === "horizontal"
|
|
220
|
+
? "top-1/2 -right-12 -translate-y-1/2"
|
|
221
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
222
|
+
className
|
|
223
|
+
)}
|
|
224
|
+
disabled={!canScrollNext}
|
|
225
|
+
onClick={scrollNext}
|
|
226
|
+
{...props}
|
|
227
|
+
>
|
|
228
|
+
<ArrowRight />
|
|
229
|
+
<span className="sr-only">Next slide</span>
|
|
230
|
+
</Button>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export {
|
|
235
|
+
type CarouselApi,
|
|
236
|
+
Carousel,
|
|
237
|
+
CarouselContent,
|
|
238
|
+
CarouselItem,
|
|
239
|
+
CarouselPrevious,
|
|
240
|
+
CarouselNext,
|
|
241
|
+
}
|