mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-10-30 18:22:59 +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.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { Button } from "@/examples/base/ui/button"
|
|
import { Calendar } from "@/examples/base/ui/calendar"
|
|
import { Field, FieldLabel } from "@/examples/base/ui/field"
|
|
import {
|
|
Popover,
|
|
PopoverContent,
|
|
PopoverTrigger,
|
|
} from "@/examples/base/ui/popover"
|
|
|
|
export function DatePickerSimple() {
|
|
const [open, setOpen] = React.useState(false)
|
|
const [date, setDate] = React.useState<Date | undefined>(undefined)
|
|
|
|
return (
|
|
<Field className="mx-auto w-44">
|
|
<FieldLabel htmlFor="date">Date of birth</FieldLabel>
|
|
<Popover open={open} onOpenChange={setOpen}>
|
|
<PopoverTrigger
|
|
render={
|
|
<Button
|
|
variant="outline"
|
|
id="date"
|
|
className="justify-start font-normal"
|
|
/>
|
|
}
|
|
>
|
|
{date ? date.toLocaleDateString() : "Select date"}
|
|
</PopoverTrigger>
|
|
<PopoverContent className="w-auto overflow-hidden p-0" align="start">
|
|
<Calendar
|
|
mode="single"
|
|
selected={date}
|
|
defaultMonth={date}
|
|
captionLayout="dropdown"
|
|
onSelect={(date) => {
|
|
setDate(date)
|
|
setOpen(false)
|
|
}}
|
|
/>
|
|
</PopoverContent>
|
|
</Popover>
|
|
</Field>
|
|
)
|
|
}
|