Skip to content

Commit 6892abb

Browse files
authored
[TM-3086] Enhance DateRangeInput component with improved control interaction and styling. Update DatePicker.Control to handle click events for opening the date picker, and adjust styles for disabled states to improve user experience. (#2062)
1 parent 4f92bd1 commit 6892abb

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

src/redesignComponents/Forms/Inputs/DateRangeInputs/DateRangeInput.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ export const DateRangeInput: FC<DateRangeInputProps> = ({
125125
<StyledPickerWrapper $size={size} data-invalid={errorMessage != null ? "" : undefined}>
126126
<Global styles={calendarGlobalStyles} />
127127
<DatePicker.RootProvider value={picker}>
128-
<DatePicker.Control>
129-
<DatePicker.Trigger>
130-
<CalendarIcon />
131-
</DatePicker.Trigger>
128+
<DatePicker.Control
129+
onClick={() => !disabled && picker.setOpen(true)}
130+
style={{ cursor: disabled ? "not-allowed" : "pointer" }}
131+
>
132+
<CalendarIcon />
132133
<DatePicker.Input index={0} placeholder={dateFormat} />
133134

134135
<span

src/redesignComponents/Forms/Inputs/DateRangeInputs/styled.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,31 @@ export const dateRangePickerStyles = (size: "default" | "small" = "default") =>
133133
color: ${getThemedColor("neutral", 600)};
134134
}
135135
136-
[data-part="trigger"] {
136+
[data-part="control"] > .chakra-icon {
137137
display: flex;
138138
align-items: center;
139139
justify-content: center;
140-
background: transparent;
141-
border: none;
142-
cursor: pointer;
143-
padding: 0.25rem;
144-
border-radius: 0.25rem;
140+
flex-shrink: 0;
145141
color: ${getThemedColor("neutral", 700)};
146142
transition: color 0.15s;
147143
}
148144
149-
[data-part="trigger"]:hover {
145+
[data-part="control"]:hover > .chakra-icon {
150146
color: ${getThemedColor("primary", 600)};
151147
}
148+
149+
[data-part="control"][data-disabled] {
150+
cursor: not-allowed;
151+
opacity: 0.6;
152+
}
153+
154+
[data-part="control"][data-disabled] > .chakra-icon {
155+
color: ${getThemedColor("neutral", 500)};
156+
}
157+
158+
[data-part="control"][data-disabled]:hover > .chakra-icon {
159+
color: ${getThemedColor("neutral", 500)};
160+
}
152161
`;
153162

154163
export const calendarGlobalStyles = css`

0 commit comments

Comments
 (0)