Skip to content

Commit 580df55

Browse files
sstrubbergabbeyhrttay1orjonesjoshblack
authored
feat(TimePickerSelect): updated props for v11 (#9914)
* feat(TimePickerSelect): updated props for v11 * feat(TimePickerSelect): updated public snappy * feat(TimePickerSelect): re-added hideLabel * feat(TimePickerSelect): updated public snappy * Update packages/react/src/components/TimePickerSelect/TimePickerSelect.js Co-authored-by: Abbey Hart <abbeyhrt@gmail.com> * Update packages/react/src/components/TimePickerSelect/TimePickerSelect.js Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com> * feat(TimePickerSelect): added bool back to hideLabel * Update packages/react/src/components/TimePickerSelect/TimePickerSelect.js Co-authored-by: Josh Black <josh@josh.black> * feat(TimePickerSelect): aria-label tweaks * feat(TimePickerSelect): updated public snapshot * feat(TimePickerSelect): removed whitespaces * Update packages/react/src/components/TimePickerSelect/TimePickerSelect.js Co-authored-by: Josh Black <josh@josh.black> Co-authored-by: Abbey Hart <abbeyhrt@gmail.com> Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com> Co-authored-by: Josh Black <josh@josh.black>
1 parent 711a35f commit 580df55

3 files changed

Lines changed: 29 additions & 32 deletions

File tree

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7054,10 +7054,11 @@ Map {
70547054
"TimePickerSelect" => Object {
70557055
"defaultProps": Object {
70567056
"disabled": false,
7057-
"iconDescription": "open list of options",
7058-
"inline": true,
70597057
},
70607058
"propTypes": Object {
7059+
"aria-label": Object {
7060+
"type": "string",
7061+
},
70617062
"children": Object {
70627063
"type": "node",
70637064
},
@@ -7071,17 +7072,11 @@ Map {
70717072
"type": "bool",
70727073
},
70737074
"hideLabel": [Function],
7074-
"iconDescription": Object {
7075-
"isRequired": true,
7076-
"type": "string",
7077-
},
7075+
"iconDescription": [Function],
70787076
"id": Object {
70797077
"isRequired": true,
70807078
"type": "string",
70817079
},
7082-
"inline": Object {
7083-
"type": "bool",
7084-
},
70857080
"labelText": Object {
70867081
"isRequired": true,
70877082
"type": "node",

packages/react/src/components/TimePicker/TimePicker-story.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ const props = {
5959
'Label text (labelText in <TimePickerSelect>)',
6060
'Please select'
6161
),
62-
iconDescription: text(
63-
'Trigger icon description (iconDescription in <TimePickerSelect>)',
62+
['aria-label']: text(
63+
'ARIA label (aria-label in <TimePickerSelect>)',
6464
'open list of options'
6565
),
6666
}),

packages/react/src/components/TimePickerSelect/TimePickerSelect.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const { prefix } = settings;
1616

1717
export default class TimePickerSelect extends Component {
1818
static propTypes = {
19+
/**
20+
* Provide aria-label to the <select> element
21+
*/
22+
['aria-label']: PropTypes.string,
23+
1924
/**
2025
* Provide the contents of your TimePickerSelect
2126
*/
@@ -37,7 +42,7 @@ export default class TimePickerSelect extends Component {
3742
disabled: PropTypes.bool,
3843

3944
/**
40-
* Specify whether the label should be hidden, or not
45+
* hideLabel has been deprecated in v10 and will be removed in v11.
4146
*/
4247
hideLabel: deprecate(
4348
PropTypes.bool,
@@ -46,20 +51,19 @@ export default class TimePickerSelect extends Component {
4651
),
4752

4853
/**
49-
* Provide a description for the twistie icon that can be read by screen readers
54+
* iconDescription is deprecated in v10 and will be removed in v11.
5055
*/
51-
iconDescription: PropTypes.string.isRequired,
56+
iconDescription: deprecate(
57+
PropTypes.string,
58+
'The `iconDescription` prop for `TimePickerSelect` is no longer needed and has ' +
59+
'been deprecated. It will be removed in the next major release. Use `aria-label` instead.'
60+
),
5261

5362
/**
5463
* Specify a custom `id` for the `<select>`
5564
*/
5665
id: PropTypes.string.isRequired,
5766

58-
/**
59-
* Specify whether you want the inline version of this control
60-
*/
61-
inline: PropTypes.bool,
62-
6367
/**
6468
* Provide label text to be read by screen readers when interacting with the
6569
* control
@@ -69,21 +73,19 @@ export default class TimePickerSelect extends Component {
6973

7074
static defaultProps = {
7175
disabled: false,
72-
inline: true,
73-
iconDescription: 'open list of options',
7476
};
7577

7678
render() {
7779
const {
78-
id,
79-
disabled,
80+
['aria-label']: ariaLabel = 'open list of options',
8081
children,
81-
iconDescription,
8282
className,
83+
disabled,
8384
hideLabel = true,
85+
id,
86+
iconDescription,
8487
labelText,
85-
inline, // eslint-disable-line
86-
...other
88+
...rest
8789
} = this.props;
8890

8991
const selectClasses = classNames({
@@ -107,17 +109,17 @@ export default class TimePickerSelect extends Component {
107109
<div className={selectClasses}>
108110
{label}
109111
<select
110-
{...other}
111-
id={id}
112112
className={`${prefix}--select-input`}
113-
disabled={disabled}>
113+
disabled={disabled}
114+
id={id}
115+
aria-label={ariaLabel}
116+
{...rest}>
114117
{children}
115118
</select>
116119
<ChevronDown16
117120
className={`${prefix}--select__arrow`}
118-
aria-label={iconDescription}>
119-
{iconDescription && <title>{iconDescription}</title>}
120-
</ChevronDown16>
121+
aria-label={ariaLabel ? ariaLabel : iconDescription}
122+
/>
121123
</div>
122124
);
123125
}

0 commit comments

Comments
 (0)