Skip to content

Commit

Permalink
fix: adjust date-picker disabled prop (#2049)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaporwavie authored Jan 6, 2025
2 parents 287b560 + 6bb77c8 commit 78cd16e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function DatePicker<T extends DateValue>(props: DatePickerProps<T>) {
label={buttonProps['aria-label']}
aria-describedby={buttonProps['aria-describedby']}
variant="tertiary"
disabled={buttonProps.isDisabled}
>
<IconCalendarBlank />
</IconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,13 @@ export function AsField() {
</Field>
)
}

export function Disabled() {
return (
<Field>
<Label>Date</Label>
<DatePicker value={today(getLocalTimeZone())} isDisabled />
<FieldDescription>The event starting date</FieldDescription>
</Field>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export function DateRangePicker<T extends DateValue>(
aria-describedby={buttonProps['aria-describedby']}
variant="tertiary"
data-sl-date-range-picker-icon-button
disabled={buttonProps.isDisabled}
>
<IconCalendarBlank />
</IconButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ export function Locale() {
</LocaleProvider>
)
}

export function Disabled() {
const now = today(getLocalTimeZone())

return (
<Field>
<Label>Date</Label>
<DateRangePicker
value={{ start: now, end: now.add({ days: 2 }) }}
isDisabled
/>
<FieldDescription>The event starting date</FieldDescription>
</Field>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@
}
}

&[data-disabled="true"] {
&[aria-disabled="true"] {
border: var(--sl-border-base-disabled);
color: var(--sl-fg-base-disabled);
background-color: var(--sl-bg-base-disabled);

&:focus-within {
box-shadow: none;
border: var(--sl-border-base-disabled);
}
}

&:focus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@
}
}

&[data-disabled="true"] {
&[aria-disabled="true"] {
border: var(--sl-border-base-disabled);
color: var(--sl-fg-base-disabled);
background-color: var(--sl-bg-base-disabled);

&:focus-within {
box-shadow: none;
border: var(--sl-border-base-disabled);
}
}

&:focus {
Expand Down

0 comments on commit 78cd16e

Please sign in to comment.