mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
Squash merge of shadcn-ui/ui main branch into hanzo/ui, bringing in: - [email protected] through [email protected] releases - New apps/v4 directory structure - Registry system improvements and MCP server - Framework support (Vue, Svelte, React Native) - New templates (vite-app, monorepo-next, laravel) - Zod 4 compatibility (scoped override for zod@>4) - Test fixture corrections for alias resolution All 867 merge conflicts resolved preserving Hanzo customizations. 1020/1020 shadcn tests pass.
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { z } from "zod"
|
|
|
|
export const formSchema = z.object({
|
|
plan: z
|
|
.string({
|
|
required_error: "Please select a subscription plan",
|
|
})
|
|
.min(1, "Please select a subscription plan")
|
|
.refine((value) => value === "basic" || value === "pro", {
|
|
message: "Invalid plan selection. Please choose Basic or Pro",
|
|
}),
|
|
billingPeriod: z
|
|
.string({
|
|
required_error: "Please select a billing period",
|
|
})
|
|
.min(1, "Please select a billing period"),
|
|
addons: z
|
|
.array(z.string())
|
|
.min(1, "Please select at least one add-on")
|
|
.max(3, "You can select up to 3 add-ons")
|
|
.refine(
|
|
(value) => value.every((addon) => addons.some((a) => a.id === addon)),
|
|
{
|
|
message: "You selected an invalid add-on",
|
|
}
|
|
),
|
|
emailNotifications: z.boolean(),
|
|
})
|
|
|
|
export type FormState = {
|
|
values: z.infer<typeof formSchema>
|
|
errors: null | Partial<Record<keyof z.infer<typeof formSchema>, string[]>>
|
|
success: boolean
|
|
}
|
|
|
|
export const addons = [
|
|
{
|
|
id: "analytics",
|
|
title: "Analytics",
|
|
description: "Advanced analytics and reporting",
|
|
},
|
|
{
|
|
id: "backup",
|
|
title: "Backup",
|
|
description: "Automated daily backups",
|
|
},
|
|
{
|
|
id: "support",
|
|
title: "Priority Support",
|
|
description: "24/7 premium customer support",
|
|
},
|
|
] as const
|