Skip to content

Commit 641c55c

Browse files
committed
[SelectField] Add callback signatures to docs; improve other props.
1 parent 3c93c9c commit 641c55c

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

src/SelectField/SelectField.js

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,74 +23,82 @@ class SelectField extends Component {
2323
/**
2424
* If true, the width will automatically be set according to the
2525
* items inside the menu.
26-
* To control this width in css instead, leave this prop to `false`.
26+
* To control the width in CSS instead, leave this prop set to `false`.
2727
*/
2828
autoWidth: PropTypes.bool,
2929
/**
30-
* The `MenuItem` elements to populate the `Menu` with.
31-
* If the MenuItems have the prop `label` that value will
32-
* be used to render the representation of that
33-
* item within the field.
30+
* The `MenuItem` elements to populate the select field with.
31+
* If the menu items have a `label` prop, that value will
32+
* represent the selected menu item in the rendered select field.
3433
*/
3534
children: PropTypes.node,
3635
/**
37-
* Disables the select field if set to true.
36+
* If true, the select field will be disabled.
3837
*/
3938
disabled: PropTypes.bool,
4039
/**
41-
* The style object to use to override error styles.
40+
* Override the inline-styles of the error element.
4241
*/
4342
errorStyle: PropTypes.object,
4443
/**
4544
* The error content to display.
4645
*/
4746
errorText: PropTypes.node,
4847
/**
49-
* The style object to use to override floating label styles.
48+
* Override the inline-styles of the floating label.
5049
*/
5150
floatingLabelStyle: PropTypes.object,
5251
/**
53-
* The content to use for the floating label element.
52+
* The content of the floating label.
5453
*/
5554
floatingLabelText: PropTypes.node,
5655
/**
57-
* If true, the field receives the property width 100%.
56+
* If true, the select field will take up the full width of its container.
5857
*/
5958
fullWidth: PropTypes.bool,
6059
/**
61-
* The style object to use to override hint styles.
60+
* Override the inline-styles of the hint element.
6261
*/
6362
hintStyle: PropTypes.object,
6463
/**
6564
* The hint content to display.
6665
*/
6766
hintText: PropTypes.node,
6867
/**
69-
* Overrides the styles of the icon element.
68+
* Override the inline-styles of the icon element.
7069
*/
7170
iconStyle: PropTypes.object,
7271
/**
7372
* The id prop for the text field.
7473
*/
7574
id: PropTypes.string,
7675
/**
77-
* Overrides the styles of label when the `SelectField` is inactive.
76+
* Override the label style when the select field is inactive.
7877
*/
7978
labelStyle: PropTypes.object,
8079
/**
81-
* Callback function that is fired when the `SelectField` loses focus.
80+
* Callback function fired when the select field loses focus.
81+
*
82+
* @param {object} event `blur` event targeting the select field.
8283
*/
8384
onBlur: PropTypes.func,
8485
/**
85-
* Callback function that is fired when the value changes.
86+
* Callback function fired when a menu item is selected.
87+
*
88+
* @param {object} event TouchTap event targeting the menu item
89+
* that was selected.
90+
* @param {number} key The index of the selected menu item.
91+
* @param {any} payload The `value` prop of the selected menu item.
8692
*/
8793
onChange: PropTypes.func,
8894
/**
89-
* Callback function that is fired when the `SelectField` gains focus.
95+
* Callback function fired when the select field gains focus.
96+
*
97+
* @param {object} event `focus` event targeting the select field.
9098
*/
9199
onFocus: PropTypes.func,
92100
/**
93-
* The style object to use to override the `DropDownMenu`.
101+
* Override the inline-styles of the underlying `DropDownMenu` element.
94102
*/
95103
selectFieldRoot: PropTypes.object, // Must be changed!
96104

@@ -99,15 +107,17 @@ class SelectField extends Component {
99107
*/
100108
style: PropTypes.object,
101109
/**
102-
* Override the inline-styles of the underline element when disabled.
110+
* Override the inline-styles of the underline element when the select
111+
* field is disabled.
103112
*/
104113
underlineDisabledStyle: PropTypes.object,
105114
/**
106-
* Override the inline-styles of the underline element when focused.
115+
* Override the inline-styles of the underline element when the select field
116+
* is focused.
107117
*/
108118
underlineFocusStyle: PropTypes.object,
109119
/**
110-
* Overrides the styles of the underline element.
120+
* Override the inline-styles of the underline element.
111121
*/
112122
underlineStyle: PropTypes.object,
113123
/**

0 commit comments

Comments
 (0)