Skip to content

Commit 73e627c

Browse files
authored
Merge pull request #907 from Availity/feature/nonbreaking-clearable-datepicker
feat(mui-datepicker): add inputadornment clear button with no onclear
2 parents ddb5a8c + 6d57ddd commit 73e627c

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

packages/datepicker/src/lib/Datepicker.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ export type DatepickerProps = {
1818
* @default bottom-start
1919
*/
2020
placement?: 'bottom-start' | 'bottom' | 'bottom-end';
21-
/** Determines if the clear button appears in the action bar */
21+
/** Determines if the clear button appears in the action bar and input. _No custom onClear available_ */
2222
clearable?: boolean;
23-
} & Omit<
23+
}
24+
// TODO: v3 BREAKING CHANGE add onClear and remove action bar clear button
25+
// & Pick<ExportedPickerFieldUIProps, 'onClear' | 'clearable'>
26+
& Omit<
2427
MuiDatePickerProps<false>,
2528
| 'components'
2629
| 'componentsProps'
@@ -83,6 +86,7 @@ export const Datepicker = ({
8386
{...props}
8487
dayOfWeekFormatter={(weekday: Dayjs) => weekday.format('dd')}
8588
slotProps={{
89+
// TODO: v3 BREAKING CHANGE remove action bar
8690
actionBar: {
8791
actions: clearable ? ['clear'] : [],
8892
},
@@ -92,6 +96,8 @@ export const Datepicker = ({
9296
'aria-label': FieldProps?.label?.toString() || FieldProps?.inputProps?.['aria-label'] || 'Date picker',
9397
'aria-labelledby': FieldProps?.inputProps?.['aria-labelledby'] || undefined,
9498
},
99+
// TODO: v3 add onClear to field
100+
field: { clearable },
95101
textField: FieldProps,
96102
popper: {
97103
placement,

packages/theme/src/lib/light-theme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,10 @@ export const lightTheme = {
18581858
// padding: '8px',
18591859
color: tokens.colorGrey400,
18601860
},
1861+
'.MuiInputAdornment-root .MuiIconButton-root': {
1862+
width: '2.25rem',
1863+
height: '2.25rem',
1864+
},
18611865
},
18621866
},
18631867
},

0 commit comments

Comments
 (0)