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.
59 lines
1.6 KiB
TypeScript
59 lines
1.6 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"
|
|
import { format } from "date-fns"
|
|
import { ChevronDownIcon } from "lucide-react"
|
|
|
|
export function DataPickerWithDropdowns() {
|
|
const [date, setDate] = React.useState<Date>()
|
|
const [open, setOpen] = React.useState(false)
|
|
|
|
return (
|
|
<Field className="mx-auto w-72">
|
|
<Popover open={open} onOpenChange={setOpen}>
|
|
<FieldLabel htmlFor="date-picker-with-dropdowns-desktop">
|
|
Date
|
|
</FieldLabel>
|
|
<PopoverTrigger
|
|
render={
|
|
<Button
|
|
variant="outline"
|
|
id="date-picker-with-dropdowns-desktop"
|
|
className="justify-start px-2.5 font-normal"
|
|
/>
|
|
}
|
|
>
|
|
<ChevronDownIcon className="ml-auto" />
|
|
{date ? format(date, "PPP") : <span>Pick a date</span>}
|
|
</PopoverTrigger>
|
|
<PopoverContent className="w-auto p-0" align="start">
|
|
<Calendar
|
|
mode="single"
|
|
selected={date}
|
|
onSelect={setDate}
|
|
captionLayout="dropdown"
|
|
/>
|
|
<div className="flex gap-2 border-t p-2">
|
|
<Button
|
|
variant="outline"
|
|
size="sm"
|
|
className="w-full"
|
|
onClick={() => setOpen(false)}
|
|
>
|
|
Done
|
|
</Button>
|
|
</div>
|
|
</PopoverContent>
|
|
</Popover>
|
|
</Field>
|
|
)
|
|
}
|