@@ -41,7 +41,12 @@ export const Selector = (props: ISelector): JSX.Element => {
41
41
) ;
42
42
} ;
43
43
44
- const renderButtonSelector = ( type : string , showSelector : boolean , ariaLabel ?: string ) => {
44
+ const renderButtonSelector = (
45
+ type : string ,
46
+ showSelector : boolean ,
47
+ ariaLabel ?: string ,
48
+ role ?: string
49
+ ) => {
45
50
const buttonState = showSelector ? ButtonStateType . DISABLED : ButtonStateType . DEFAULT ;
46
51
47
52
const selectorToShow = ( ) => {
@@ -73,6 +78,7 @@ export const Selector = (props: ISelector): JSX.Element => {
73
78
< Button
74
79
aria-label = { ariaLabel }
75
80
disabled = { showSelector }
81
+ role = { role }
76
82
size = { sizeSelectorButton || props . styles ?. selectorOptions ?. sizeSelectorButton }
77
83
variant = { variantSelectorButton || props . styles ?. selectorOptions ?. variantSelectorButton }
78
84
onClick = { handleClickButtonSelector }
@@ -101,29 +107,21 @@ export const Selector = (props: ISelector): JSX.Element => {
101
107
onChangeCurrentDate ( dateHelpers . getAddMonths ( auxCurrentDate , 1 ) ) ;
102
108
} ;
103
109
104
- const handleOnClickBack : React . MouseEventHandler < HTMLDivElement > = event => {
105
- onClickLeftIcon ( ) ;
106
- props . onLeftIconClick ?.( event ) ;
107
- } ;
108
-
109
110
const handleOnClickLeftIcon : React . MouseEventHandler < HTMLButtonElement > = event => {
110
111
onClickLeftIcon ( ) ;
111
112
leftArrowIcon . onClick ?.( event ) ;
112
- } ;
113
-
114
- const handleOnClickRight : React . MouseEventHandler < HTMLDivElement > = event => {
115
- onClickRightIcon ( ) ;
116
- props . onRightIconClick ?.( event ) ;
113
+ props . onLeftIconClick ?.( event ) ;
117
114
} ;
118
115
119
116
const handleOnClickRightIcon : React . MouseEventHandler < HTMLButtonElement > = event => {
120
117
onClickRightIcon ( ) ;
121
118
rightArrowIcon . onClick ?.( event ) ;
119
+ props . onRightIconClick ?.( event ) ;
122
120
} ;
123
121
124
122
return (
125
123
< SelectorStyled isDaySelector = { isDaySelector } styles = { props . styles } >
126
- < IconAndBackTextStyled styles = { props . styles } onClick = { handleOnClickBack } >
124
+ < IconAndBackTextStyled styles = { props . styles } >
127
125
< ElementOrIcon
128
126
color = { iconArrowDisabled ( props . minDate ) ? props . styles ?. colorArrowDisabled : undefined }
129
127
customIconStyles = { props . styles ?. leftArrow }
@@ -147,20 +145,23 @@ export const Selector = (props: ISelector): JSX.Element => {
147
145
renderButtonSelector (
148
146
CalendarElementType . DAY ,
149
147
props . showDaySelector ,
150
- props . configAccesibility ?. daySelectorAriaLabel
148
+ props . configAccesibility ?. daySelectorAriaLabel ,
149
+ props . configAccesibility ?. daySelectorRole
151
150
) }
152
151
{ renderButtonSelector (
153
152
CalendarElementType . MONTH ,
154
153
props . showMonthSelector ,
155
- props . configAccesibility ?. monthSelectorAriaLabel
154
+ props . configAccesibility ?. monthSelectorAriaLabel ,
155
+ props . configAccesibility ?. monthSelectorRole
156
156
) }
157
157
{ renderButtonSelector (
158
158
CalendarElementType . YEAR ,
159
159
props . showYearSelector ,
160
- props . configAccesibility ?. yearSelectorAriaLabel
160
+ props . configAccesibility ?. yearSelectorAriaLabel ,
161
+ props . configAccesibility ?. yearSelectorRole
161
162
) }
162
163
</ OptionsStyled >
163
- < RightIconStyled showCustomSelector = { showCustomSelector } onClick = { handleOnClickRight } >
164
+ < RightIconStyled showCustomSelector = { showCustomSelector } >
164
165
< ElementOrIcon
165
166
color = { iconArrowDisabled ( props . maxDate ) ? props . styles ?. colorArrowDisabled : undefined }
166
167
customIconStyles = { props . styles ?. rightArrow }
0 commit comments