Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wise-actors-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@genseki/react": patch
---

fix: `intent-ui` date component disabled and read-only state.
15 changes: 12 additions & 3 deletions packages/react/src/react/components/primitives/date-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import type React from 'react'
import {
DatePicker as DatePickerPrimitive,
type DatePickerProps as DatePickerPrimitiveProps,
Expand All @@ -24,6 +25,7 @@ import { composeTailwindRenderProps } from './primitive'
import { RangeCalendar } from './range-calendar'

import { BaseIcon } from '../../components/primitives/base-icon'
import { cn } from '../../utils/cn'

interface DatePickerOverlayProps
extends Omit<DialogProps, 'children' | 'className' | 'style'>,
Expand Down Expand Up @@ -69,11 +71,18 @@ const DatePickerOverlay = ({
)
}

const DatePickerIcon = () => (
const DatePickerIcon = ({
className,
...props
}: Omit<React.ComponentPropsWithRef<typeof Button>, 'size' | 'variant'>) => (
<Button
size="md"
variant="vanish"
className="-translate-x-2 rounded-full outline-offset-0 hover:bg-transparent pressed:bg-transparent **:data-[slot=icon]:text-muted-fg"
className={cn(
'-translate-x-2 rounded-full outline-offset-0 hover:bg-transparent pressed:bg-transparent **:data-[slot=icon]:text-muted-fg',
className
)}
{...props}
>
<BaseIcon icon={CalendarDotsIcon} weight="duotone" className="group-open:text-fg" aria-hidden />
</Button>
Expand Down Expand Up @@ -107,7 +116,7 @@ const DatePicker = <T extends DateValue>({
)}
<FieldGroup className="min-w-40">
<DateInput size="md" className="w-full pr-16" />
<DatePickerIcon />
<DatePickerIcon isDisabled={props.isDisabled || props.isReadOnly} />
</FieldGroup>
{description && <Description>{description}</Description>}
<FieldError>{errorMessage}</FieldError>
Expand Down
Loading