shipd 0.1.3 → 0.2.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/base-package/app/globals.css +126 -0
- package/base-package/app/layout.tsx +53 -0
- package/base-package/app/page.tsx +15 -0
- package/base-package/base.config.json +57 -0
- package/base-package/components/ui/avatar.tsx +53 -0
- package/base-package/components/ui/badge.tsx +46 -0
- package/base-package/components/ui/button.tsx +59 -0
- package/base-package/components/ui/card.tsx +92 -0
- package/base-package/components/ui/chart.tsx +353 -0
- package/base-package/components/ui/checkbox.tsx +32 -0
- package/base-package/components/ui/dialog.tsx +135 -0
- package/base-package/components/ui/dropdown-menu.tsx +257 -0
- package/base-package/components/ui/form.tsx +167 -0
- package/base-package/components/ui/input.tsx +21 -0
- package/base-package/components/ui/label.tsx +24 -0
- package/base-package/components/ui/progress.tsx +31 -0
- package/base-package/components/ui/resizable.tsx +56 -0
- package/base-package/components/ui/select.tsx +185 -0
- package/base-package/components/ui/separator.tsx +28 -0
- package/base-package/components/ui/sheet.tsx +139 -0
- package/base-package/components/ui/skeleton.tsx +13 -0
- package/base-package/components/ui/sonner.tsx +25 -0
- package/base-package/components/ui/switch.tsx +31 -0
- package/base-package/components/ui/tabs.tsx +66 -0
- package/base-package/components/ui/textarea.tsx +18 -0
- package/base-package/components/ui/toggle-group.tsx +73 -0
- package/base-package/components/ui/toggle.tsx +47 -0
- package/base-package/components/ui/tooltip.tsx +61 -0
- package/base-package/components.json +21 -0
- package/base-package/eslint.config.mjs +16 -0
- package/base-package/lib/utils.ts +6 -0
- package/base-package/middleware.ts +12 -0
- package/base-package/next.config.ts +27 -0
- package/base-package/package.json +49 -0
- package/base-package/postcss.config.mjs +5 -0
- package/base-package/public/favicon.svg +4 -0
- package/base-package/tailwind.config.ts +89 -0
- package/base-package/tsconfig.json +27 -0
- package/dist/index.js +1858 -956
- package/docs-template/README.md +74 -0
- package/features/ai-chat/README.md +316 -0
- package/features/ai-chat/app/api/chat/route.ts +16 -0
- package/features/ai-chat/app/dashboard/_components/chatbot.tsx +39 -0
- package/features/ai-chat/app/dashboard/chat/page.tsx +73 -0
- package/features/ai-chat/feature.config.json +22 -0
- package/features/analytics/README.md +364 -0
- package/features/analytics/feature.config.json +20 -0
- package/features/analytics/lib/posthog.ts +36 -0
- package/features/auth/README.md +409 -0
- package/features/auth/app/api/auth/[...all]/route.ts +4 -0
- package/features/auth/app/dashboard/layout.tsx +15 -0
- package/features/auth/app/dashboard/page.tsx +140 -0
- package/features/auth/app/sign-in/page.tsx +228 -0
- package/features/auth/app/sign-up/page.tsx +243 -0
- package/features/auth/auth-schema.ts +47 -0
- package/features/auth/components/auth/setup-instructions.tsx +123 -0
- package/features/auth/feature.config.json +33 -0
- package/features/auth/lib/auth-client.ts +8 -0
- package/features/auth/lib/auth.ts +295 -0
- package/features/auth/lib/email-stub.ts +55 -0
- package/features/auth/lib/email.ts +47 -0
- package/features/auth/middleware.patch.ts +43 -0
- package/features/database/README.md +312 -0
- package/features/database/db/drizzle.ts +48 -0
- package/features/database/db/schema.ts +21 -0
- package/features/database/drizzle.config.ts +13 -0
- package/features/database/feature.config.json +30 -0
- package/features/email/README.md +341 -0
- package/features/email/emails/components/layout.tsx +181 -0
- package/features/email/emails/password-reset.tsx +67 -0
- package/features/email/emails/payment-failed.tsx +167 -0
- package/features/email/emails/subscription-confirmation.tsx +129 -0
- package/features/email/emails/welcome.tsx +100 -0
- package/features/email/feature.config.json +22 -0
- package/features/email/lib/email.ts +118 -0
- package/features/file-upload/README.md +329 -0
- package/features/file-upload/app/api/upload-image/route.ts +64 -0
- package/features/file-upload/app/dashboard/upload/page.tsx +324 -0
- package/features/file-upload/feature.config.json +23 -0
- package/features/file-upload/lib/upload-image.ts +28 -0
- package/features/marketing-landing/README.md +333 -0
- package/features/marketing-landing/app/page.tsx +25 -0
- package/features/marketing-landing/components/homepage/cli-workflow-section.tsx +231 -0
- package/features/marketing-landing/components/homepage/features-section.tsx +152 -0
- package/features/marketing-landing/components/homepage/footer.tsx +53 -0
- package/features/marketing-landing/components/homepage/hero-section.tsx +112 -0
- package/features/marketing-landing/components/homepage/integrations.tsx +124 -0
- package/features/marketing-landing/components/homepage/navigation.tsx +116 -0
- package/features/marketing-landing/components/homepage/news-section.tsx +82 -0
- package/features/marketing-landing/components/homepage/pricing-section.tsx +98 -0
- package/features/marketing-landing/components/homepage/testimonials-section.tsx +34 -0
- package/features/marketing-landing/components/logos/BetterAuth.tsx +21 -0
- package/features/marketing-landing/components/logos/NeonPostgres.tsx +41 -0
- package/features/marketing-landing/components/logos/Nextjs.tsx +72 -0
- package/features/marketing-landing/components/logos/Polar.tsx +7 -0
- package/features/marketing-landing/components/logos/TailwindCSS.tsx +27 -0
- package/features/marketing-landing/components/logos/index.ts +6 -0
- package/features/marketing-landing/components/logos/shadcnui.tsx +8 -0
- package/features/marketing-landing/feature.config.json +23 -0
- package/features/payments/README.md +375 -0
- package/features/payments/app/api/subscription/route.ts +25 -0
- package/features/payments/app/dashboard/payment/_components/manage-subscription.tsx +22 -0
- package/features/payments/app/dashboard/payment/page.tsx +126 -0
- package/features/payments/app/success/page.tsx +123 -0
- package/features/payments/feature.config.json +31 -0
- package/features/payments/lib/polar-products.ts +49 -0
- package/features/payments/lib/subscription.ts +148 -0
- package/features/payments/payments-schema.ts +30 -0
- package/features/seo/README.md +302 -0
- package/features/seo/app/blog/[slug]/page.tsx +314 -0
- package/features/seo/app/blog/page.tsx +107 -0
- package/features/seo/app/robots.txt +13 -0
- package/features/seo/app/sitemap.ts +70 -0
- package/features/seo/feature.config.json +19 -0
- package/features/seo/lib/seo-utils.ts +163 -0
- package/package.json +3 -1
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as RechartsPrimitive from "recharts"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
9
|
+
const THEMES = { light: "", dark: ".dark" } as const
|
|
10
|
+
|
|
11
|
+
export type ChartConfig = {
|
|
12
|
+
[k in string]: {
|
|
13
|
+
label?: React.ReactNode
|
|
14
|
+
icon?: React.ComponentType
|
|
15
|
+
} & (
|
|
16
|
+
| { color?: string; theme?: never }
|
|
17
|
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type ChartContextProps = {
|
|
22
|
+
config: ChartConfig
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
|
26
|
+
|
|
27
|
+
function useChart() {
|
|
28
|
+
const context = React.useContext(ChartContext)
|
|
29
|
+
|
|
30
|
+
if (!context) {
|
|
31
|
+
throw new Error("useChart must be used within a <ChartContainer />")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return context
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ChartContainer({
|
|
38
|
+
id,
|
|
39
|
+
className,
|
|
40
|
+
children,
|
|
41
|
+
config,
|
|
42
|
+
...props
|
|
43
|
+
}: React.ComponentProps<"div"> & {
|
|
44
|
+
config: ChartConfig
|
|
45
|
+
children: React.ComponentProps<
|
|
46
|
+
typeof RechartsPrimitive.ResponsiveContainer
|
|
47
|
+
>["children"]
|
|
48
|
+
}) {
|
|
49
|
+
const uniqueId = React.useId()
|
|
50
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ChartContext.Provider value={{ config }}>
|
|
54
|
+
<div
|
|
55
|
+
data-slot="chart"
|
|
56
|
+
data-chart={chartId}
|
|
57
|
+
className={cn(
|
|
58
|
+
"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
<ChartStyle id={chartId} config={config} />
|
|
64
|
+
<RechartsPrimitive.ResponsiveContainer>
|
|
65
|
+
{children}
|
|
66
|
+
</RechartsPrimitive.ResponsiveContainer>
|
|
67
|
+
</div>
|
|
68
|
+
</ChartContext.Provider>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
73
|
+
const colorConfig = Object.entries(config).filter(
|
|
74
|
+
([, config]) => config.theme || config.color
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
if (!colorConfig.length) {
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<style
|
|
83
|
+
dangerouslySetInnerHTML={{
|
|
84
|
+
__html: Object.entries(THEMES)
|
|
85
|
+
.map(
|
|
86
|
+
([theme, prefix]) => `
|
|
87
|
+
${prefix} [data-chart=${id}] {
|
|
88
|
+
${colorConfig
|
|
89
|
+
.map(([key, itemConfig]) => {
|
|
90
|
+
const color =
|
|
91
|
+
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
|
|
92
|
+
itemConfig.color
|
|
93
|
+
return color ? ` --color-${key}: ${color};` : null
|
|
94
|
+
})
|
|
95
|
+
.join("\n")}
|
|
96
|
+
}
|
|
97
|
+
`
|
|
98
|
+
)
|
|
99
|
+
.join("\n"),
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const ChartTooltip = RechartsPrimitive.Tooltip
|
|
106
|
+
|
|
107
|
+
function ChartTooltipContent({
|
|
108
|
+
active,
|
|
109
|
+
payload,
|
|
110
|
+
className,
|
|
111
|
+
indicator = "dot",
|
|
112
|
+
hideLabel = false,
|
|
113
|
+
hideIndicator = false,
|
|
114
|
+
label,
|
|
115
|
+
labelFormatter,
|
|
116
|
+
labelClassName,
|
|
117
|
+
formatter,
|
|
118
|
+
color,
|
|
119
|
+
nameKey,
|
|
120
|
+
labelKey,
|
|
121
|
+
}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
|
122
|
+
React.ComponentProps<"div"> & {
|
|
123
|
+
hideLabel?: boolean
|
|
124
|
+
hideIndicator?: boolean
|
|
125
|
+
indicator?: "line" | "dot" | "dashed"
|
|
126
|
+
nameKey?: string
|
|
127
|
+
labelKey?: string
|
|
128
|
+
}) {
|
|
129
|
+
const { config } = useChart()
|
|
130
|
+
|
|
131
|
+
const tooltipLabel = React.useMemo(() => {
|
|
132
|
+
if (hideLabel || !payload?.length) {
|
|
133
|
+
return null
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const [item] = payload
|
|
137
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`
|
|
138
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
139
|
+
const value =
|
|
140
|
+
!labelKey && typeof label === "string"
|
|
141
|
+
? config[label as keyof typeof config]?.label || label
|
|
142
|
+
: itemConfig?.label
|
|
143
|
+
|
|
144
|
+
if (labelFormatter) {
|
|
145
|
+
return (
|
|
146
|
+
<div className={cn("font-medium", labelClassName)}>
|
|
147
|
+
{labelFormatter(value, payload)}
|
|
148
|
+
</div>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (!value) {
|
|
153
|
+
return null
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
|
157
|
+
}, [
|
|
158
|
+
label,
|
|
159
|
+
labelFormatter,
|
|
160
|
+
payload,
|
|
161
|
+
hideLabel,
|
|
162
|
+
labelClassName,
|
|
163
|
+
config,
|
|
164
|
+
labelKey,
|
|
165
|
+
])
|
|
166
|
+
|
|
167
|
+
if (!active || !payload?.length) {
|
|
168
|
+
return null
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<div
|
|
175
|
+
className={cn(
|
|
176
|
+
"border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
|
|
177
|
+
className
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
{!nestLabel ? tooltipLabel : null}
|
|
181
|
+
<div className="grid gap-1.5">
|
|
182
|
+
{payload.map((item, index) => {
|
|
183
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
|
184
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
185
|
+
const indicatorColor = color || item.payload.fill || item.color
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<div
|
|
189
|
+
key={item.dataKey}
|
|
190
|
+
className={cn(
|
|
191
|
+
"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
|
|
192
|
+
indicator === "dot" && "items-center"
|
|
193
|
+
)}
|
|
194
|
+
>
|
|
195
|
+
{formatter && item?.value !== undefined && item.name ? (
|
|
196
|
+
formatter(item.value, item.name, item, index, item.payload)
|
|
197
|
+
) : (
|
|
198
|
+
<>
|
|
199
|
+
{itemConfig?.icon ? (
|
|
200
|
+
<itemConfig.icon />
|
|
201
|
+
) : (
|
|
202
|
+
!hideIndicator && (
|
|
203
|
+
<div
|
|
204
|
+
className={cn(
|
|
205
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
206
|
+
{
|
|
207
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
208
|
+
"w-1": indicator === "line",
|
|
209
|
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
210
|
+
indicator === "dashed",
|
|
211
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
212
|
+
}
|
|
213
|
+
)}
|
|
214
|
+
style={
|
|
215
|
+
{
|
|
216
|
+
"--color-bg": indicatorColor,
|
|
217
|
+
"--color-border": indicatorColor,
|
|
218
|
+
} as React.CSSProperties
|
|
219
|
+
}
|
|
220
|
+
/>
|
|
221
|
+
)
|
|
222
|
+
)}
|
|
223
|
+
<div
|
|
224
|
+
className={cn(
|
|
225
|
+
"flex flex-1 justify-between leading-none",
|
|
226
|
+
nestLabel ? "items-end" : "items-center"
|
|
227
|
+
)}
|
|
228
|
+
>
|
|
229
|
+
<div className="grid gap-1.5">
|
|
230
|
+
{nestLabel ? tooltipLabel : null}
|
|
231
|
+
<span className="text-muted-foreground">
|
|
232
|
+
{itemConfig?.label || item.name}
|
|
233
|
+
</span>
|
|
234
|
+
</div>
|
|
235
|
+
{item.value && (
|
|
236
|
+
<span className="text-foreground font-mono font-medium tabular-nums">
|
|
237
|
+
{item.value.toLocaleString()}
|
|
238
|
+
</span>
|
|
239
|
+
)}
|
|
240
|
+
</div>
|
|
241
|
+
</>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
)
|
|
245
|
+
})}
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const ChartLegend = RechartsPrimitive.Legend
|
|
252
|
+
|
|
253
|
+
function ChartLegendContent({
|
|
254
|
+
className,
|
|
255
|
+
hideIcon = false,
|
|
256
|
+
payload,
|
|
257
|
+
verticalAlign = "bottom",
|
|
258
|
+
nameKey,
|
|
259
|
+
}: React.ComponentProps<"div"> &
|
|
260
|
+
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
261
|
+
hideIcon?: boolean
|
|
262
|
+
nameKey?: string
|
|
263
|
+
}) {
|
|
264
|
+
const { config } = useChart()
|
|
265
|
+
|
|
266
|
+
if (!payload?.length) {
|
|
267
|
+
return null
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<div
|
|
272
|
+
className={cn(
|
|
273
|
+
"flex items-center justify-center gap-4",
|
|
274
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
275
|
+
className
|
|
276
|
+
)}
|
|
277
|
+
>
|
|
278
|
+
{payload.map((item) => {
|
|
279
|
+
const key = `${nameKey || item.dataKey || "value"}`
|
|
280
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<div
|
|
284
|
+
key={item.value}
|
|
285
|
+
className={cn(
|
|
286
|
+
"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"
|
|
287
|
+
)}
|
|
288
|
+
>
|
|
289
|
+
{itemConfig?.icon && !hideIcon ? (
|
|
290
|
+
<itemConfig.icon />
|
|
291
|
+
) : (
|
|
292
|
+
<div
|
|
293
|
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
294
|
+
style={{
|
|
295
|
+
backgroundColor: item.color,
|
|
296
|
+
}}
|
|
297
|
+
/>
|
|
298
|
+
)}
|
|
299
|
+
{itemConfig?.label}
|
|
300
|
+
</div>
|
|
301
|
+
)
|
|
302
|
+
})}
|
|
303
|
+
</div>
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Helper to extract item config from a payload.
|
|
308
|
+
function getPayloadConfigFromPayload(
|
|
309
|
+
config: ChartConfig,
|
|
310
|
+
payload: unknown,
|
|
311
|
+
key: string
|
|
312
|
+
) {
|
|
313
|
+
if (typeof payload !== "object" || payload === null) {
|
|
314
|
+
return undefined
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const payloadPayload =
|
|
318
|
+
"payload" in payload &&
|
|
319
|
+
typeof payload.payload === "object" &&
|
|
320
|
+
payload.payload !== null
|
|
321
|
+
? payload.payload
|
|
322
|
+
: undefined
|
|
323
|
+
|
|
324
|
+
let configLabelKey: string = key
|
|
325
|
+
|
|
326
|
+
if (
|
|
327
|
+
key in payload &&
|
|
328
|
+
typeof payload[key as keyof typeof payload] === "string"
|
|
329
|
+
) {
|
|
330
|
+
configLabelKey = payload[key as keyof typeof payload] as string
|
|
331
|
+
} else if (
|
|
332
|
+
payloadPayload &&
|
|
333
|
+
key in payloadPayload &&
|
|
334
|
+
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
|
335
|
+
) {
|
|
336
|
+
configLabelKey = payloadPayload[
|
|
337
|
+
key as keyof typeof payloadPayload
|
|
338
|
+
] as string
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return configLabelKey in config
|
|
342
|
+
? config[configLabelKey]
|
|
343
|
+
: config[key as keyof typeof config]
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export {
|
|
347
|
+
ChartContainer,
|
|
348
|
+
ChartTooltip,
|
|
349
|
+
ChartTooltipContent,
|
|
350
|
+
ChartLegend,
|
|
351
|
+
ChartLegendContent,
|
|
352
|
+
ChartStyle,
|
|
353
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
5
|
+
import { CheckIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Checkbox({
|
|
10
|
+
className,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
13
|
+
return (
|
|
14
|
+
<CheckboxPrimitive.Root
|
|
15
|
+
data-slot="checkbox"
|
|
16
|
+
className={cn(
|
|
17
|
+
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<CheckboxPrimitive.Indicator
|
|
23
|
+
data-slot="checkbox-indicator"
|
|
24
|
+
className="flex items-center justify-center text-current transition-none"
|
|
25
|
+
>
|
|
26
|
+
<CheckIcon className="size-3.5" />
|
|
27
|
+
</CheckboxPrimitive.Indicator>
|
|
28
|
+
</CheckboxPrimitive.Root>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Checkbox }
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
import { XIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
|
|
9
|
+
function Dialog({
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
12
|
+
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function DialogTrigger({
|
|
16
|
+
...props
|
|
17
|
+
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
|
18
|
+
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function DialogPortal({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
|
24
|
+
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function DialogClose({
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
|
30
|
+
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function DialogOverlay({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
|
37
|
+
return (
|
|
38
|
+
<DialogPrimitive.Overlay
|
|
39
|
+
data-slot="dialog-overlay"
|
|
40
|
+
className={cn(
|
|
41
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function DialogContent({
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content>) {
|
|
54
|
+
return (
|
|
55
|
+
<DialogPortal data-slot="dialog-portal">
|
|
56
|
+
<DialogOverlay />
|
|
57
|
+
<DialogPrimitive.Content
|
|
58
|
+
data-slot="dialog-content"
|
|
59
|
+
className={cn(
|
|
60
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md border p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
|
|
67
|
+
<XIcon />
|
|
68
|
+
<span className="sr-only">Close</span>
|
|
69
|
+
</DialogPrimitive.Close>
|
|
70
|
+
</DialogPrimitive.Content>
|
|
71
|
+
</DialogPortal>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
76
|
+
return (
|
|
77
|
+
<div
|
|
78
|
+
data-slot="dialog-header"
|
|
79
|
+
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
data-slot="dialog-footer"
|
|
89
|
+
className={cn(
|
|
90
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
91
|
+
className
|
|
92
|
+
)}
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function DialogTitle({
|
|
99
|
+
className,
|
|
100
|
+
...props
|
|
101
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
|
102
|
+
return (
|
|
103
|
+
<DialogPrimitive.Title
|
|
104
|
+
data-slot="dialog-title"
|
|
105
|
+
className={cn("text-lg leading-none font-semibold", className)}
|
|
106
|
+
{...props}
|
|
107
|
+
/>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function DialogDescription({
|
|
112
|
+
className,
|
|
113
|
+
...props
|
|
114
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
|
115
|
+
return (
|
|
116
|
+
<DialogPrimitive.Description
|
|
117
|
+
data-slot="dialog-description"
|
|
118
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
119
|
+
{...props}
|
|
120
|
+
/>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
Dialog,
|
|
126
|
+
DialogClose,
|
|
127
|
+
DialogContent,
|
|
128
|
+
DialogDescription,
|
|
129
|
+
DialogFooter,
|
|
130
|
+
DialogHeader,
|
|
131
|
+
DialogOverlay,
|
|
132
|
+
DialogPortal,
|
|
133
|
+
DialogTitle,
|
|
134
|
+
DialogTrigger,
|
|
135
|
+
}
|