11'use client'
22
3+ import type React from 'react'
34import {
45 DatePicker as DatePickerPrimitive ,
56 type DatePickerProps as DatePickerPrimitiveProps ,
@@ -24,6 +25,7 @@ import { composeTailwindRenderProps } from './primitive'
2425import { RangeCalendar } from './range-calendar'
2526
2627import { BaseIcon } from '../../components/primitives/base-icon'
28+ import { cn } from '../../utils/cn'
2729
2830interface DatePickerOverlayProps
2931 extends Omit < DialogProps , 'children' | 'className' | 'style' > ,
@@ -69,11 +71,18 @@ const DatePickerOverlay = ({
6971 )
7072}
7173
72- const DatePickerIcon = ( ) => (
74+ const DatePickerIcon = ( {
75+ className,
76+ ...props
77+ } : Omit < React . ComponentPropsWithRef < typeof Button > , 'size' | 'variant' > ) => (
7378 < Button
7479 size = "md"
7580 variant = "vanish"
76- className = "-translate-x-2 rounded-full outline-offset-0 hover:bg-transparent pressed:bg-transparent **:data-[slot=icon]:text-muted-fg"
81+ className = { cn (
82+ '-translate-x-2 rounded-full outline-offset-0 hover:bg-transparent pressed:bg-transparent **:data-[slot=icon]:text-muted-fg' ,
83+ className
84+ ) }
85+ { ...props }
7786 >
7887 < BaseIcon icon = { CalendarDotsIcon } weight = "duotone" className = "group-open:text-fg" aria-hidden />
7988 </ Button >
@@ -107,7 +116,7 @@ const DatePicker = <T extends DateValue>({
107116 ) }
108117 < FieldGroup className = "min-w-40" >
109118 < DateInput size = "md" className = "w-full pr-16" />
110- < DatePickerIcon />
119+ < DatePickerIcon isDisabled = { props . isDisabled || props . isReadOnly } />
111120 </ FieldGroup >
112121 { description && < Description > { description } </ Description > }
113122 < FieldError > { errorMessage } </ FieldError >
0 commit comments