Skip to content

Commit

Permalink
Add attributes prop to DatePicker button (#7727)
Browse files Browse the repository at this point in the history
Co-authored-by: Mikhail Cherviakov <mikhail.cherviakov@jetbrains.com>
  • Loading branch information
pltnm239 and Mikhail Cherviakov authored Sep 16, 2024
1 parent 8457001 commit b740cdb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PureComponent, Ref} from 'react';
import {PureComponent, Ref, ButtonHTMLAttributes} from 'react';
import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down Expand Up @@ -101,6 +101,7 @@ export type DatePickerProps = Omit<DatePopupProps, 'translations' | 'parseDateIn
disabled?: boolean | null | undefined
parseDateInput: (input: string | null | undefined) => Date | null
size?: Size
buttonAttributes?: Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label'>
}

/**
Expand Down Expand Up @@ -134,7 +135,8 @@ export default class DatePicker extends PureComponent<DatePickerProps> {
maxDate: dateType,
translations: PropTypes.object,
locale: PropTypes.object,
size: PropTypes.oneOf(Object.values(Size))
size: PropTypes.oneOf(Object.values(Size)),
buttonAttributes: PropTypes.object
};

static defaultProps: DatePickerProps = {
Expand Down Expand Up @@ -324,6 +326,7 @@ export default class DatePicker extends PureComponent<DatePickerProps> {
className={styles.anchor}
text={false}
disabled={this.props.disabled ?? false}
{...this.props.buttonAttributes}
>
{anchorContent}
</Button>
Expand Down

0 comments on commit b740cdb

Please sign in to comment.