Skip to content

Commit

Permalink
fix(data-range-picker): update style when field is disabled
Browse files Browse the repository at this point in the history
Updates the styles to pick up correctly when the field is disabled and also leaves the calendar
button disabled

fix #2048
  • Loading branch information
lafray committed Jan 3, 2025
1 parent c687c6c commit 6bb77c8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
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 @@ -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 6bb77c8

Please sign in to comment.