diff --git a/bun.lockb b/bun.lockb index 89ddb2f..1e9e72c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/ui/package.json b/packages/ui/package.json index d0dd61d..eb69616 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -12,12 +12,16 @@ "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", "@radix-ui/react-label": "^2.1.0", + "@radix-ui/react-popover": "^1.1.2", + "@radix-ui/react-select": "^2.1.2", "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-tooltip": "^1.1.3", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "date-fns": "^4.1.0", "lucide-react": "^0.446.0", "react": "^18.3.1", + "react-day-picker": "^8.9.1", "react-dom": "^18.3.1", "react-hook-form": "^7.53.0", "tailwind-merge": "^2.5.2", diff --git a/packages/ui/src/calendar.tsx b/packages/ui/src/calendar.tsx new file mode 100644 index 0000000..0e1b766 --- /dev/null +++ b/packages/ui/src/calendar.tsx @@ -0,0 +1,64 @@ +import { ChevronLeft, ChevronRight } from 'lucide-react' +import { DayPicker } from 'react-day-picker' + +import type React from 'react' +import { buttonVariants } from './button' +import { cn } from './lib/cn' + +export type CalendarProps = React.ComponentProps + +function Calendar({ + className, + classNames, + showOutsideDays = true, + ...props +}: CalendarProps) { + return ( + , + IconRight: ({ ...props }) => , + }} + {...props} + /> + ) +} +Calendar.displayName = 'Calendar' + +export { Calendar } diff --git a/packages/ui/src/date-picker.tsx b/packages/ui/src/date-picker.tsx new file mode 100644 index 0000000..630ea5b --- /dev/null +++ b/packages/ui/src/date-picker.tsx @@ -0,0 +1,37 @@ +import { format } from 'date-fns' +import { Calendar as CalendarIcon } from 'lucide-react' +import * as React from 'react' + +import { Button } from './button' +import { Calendar } from './calendar' +import { cn } from './lib/cn' +import { Popover, PopoverContent, PopoverTrigger } from './popover' + +export function DatePickerDemo() { + const [date, setDate] = React.useState() + + return ( + + + + + + + + + ) +} diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 193565b..027bc64 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -14,3 +14,7 @@ export * from './checkbox' export * from './textarea' export * from './tooltip' export * from './alert-dialog' +export * from './select' +export * from './popover' +export * from './calendar' +export * from './date-picker' diff --git a/packages/ui/src/popover.tsx b/packages/ui/src/popover.tsx new file mode 100644 index 0000000..c7cfd1d --- /dev/null +++ b/packages/ui/src/popover.tsx @@ -0,0 +1,29 @@ +import * as PopoverPrimitive from '@radix-ui/react-popover' +import * as React from 'react' + +import { cn } from './lib/cn' + +const Popover = PopoverPrimitive.Root + +const PopoverTrigger = PopoverPrimitive.Trigger + +const PopoverContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => ( + + + +)) +PopoverContent.displayName = PopoverPrimitive.Content.displayName + +export { Popover, PopoverTrigger, PopoverContent } diff --git a/packages/ui/src/select.tsx b/packages/ui/src/select.tsx new file mode 100644 index 0000000..cd9dcae --- /dev/null +++ b/packages/ui/src/select.tsx @@ -0,0 +1,158 @@ +import * as SelectPrimitive from '@radix-ui/react-select' +import { Check, ChevronDown, ChevronUp } from 'lucide-react' +import * as React from 'react' + +import { cn } from './lib/cn' + +const Select = SelectPrimitive.Root + +const SelectGroup = SelectPrimitive.Group + +const SelectValue = SelectPrimitive.Value + +const SelectTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + span]:line-clamp-1', + className, + )} + {...props} + > + {children} + + + + +)) +SelectTrigger.displayName = SelectPrimitive.Trigger.displayName + +const SelectScrollUpButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + +)) +SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName + +const SelectScrollDownButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + +)) +SelectScrollDownButton.displayName = + SelectPrimitive.ScrollDownButton.displayName + +const SelectContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, position = 'popper', ...props }, ref) => ( + + + + + {children} + + + + +)) +SelectContent.displayName = SelectPrimitive.Content.displayName + +const SelectLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SelectLabel.displayName = SelectPrimitive.Label.displayName + +const SelectItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + + + + + {children} + +)) +SelectItem.displayName = SelectPrimitive.Item.displayName + +const SelectSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SelectSeparator.displayName = SelectPrimitive.Separator.displayName + +export { + Select, + SelectGroup, + SelectValue, + SelectTrigger, + SelectContent, + SelectLabel, + SelectItem, + SelectSeparator, + SelectScrollUpButton, + SelectScrollDownButton, +}