Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-widgets/src/SelectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ class SelectList extends React.Component {
messages: PropTypes.shape({
emptyList: CustomPropTypes.message,
}),

labelClass: PropTypes.string,
inputClass: PropTypes.string,
}

static defaultProps = {
Expand Down Expand Up @@ -267,7 +270,7 @@ class SelectList extends React.Component {
attachListRef = ref => (this.listRef = ref)

renderListItem = itemProps => {
const { name, multiple, disabled, readOnly } = this.props
const { name, multiple, disabled, readOnly, labelClass, inputClass } = this.props
const { dataItems, accessors } = this.state
return (
<SelectListItem
Expand All @@ -278,6 +281,8 @@ class SelectList extends React.Component {
onChange={this.handleChange}
onMouseDown={this.handleMouseDown}
checked={accessors.includes(dataItems, itemProps.dataItem)}
labelClass={labelClass}
inputClass={inputClass}
/>
)
}
Expand Down
14 changes: 10 additions & 4 deletions packages/react-widgets/src/SelectListItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import ListOption from './ListOption';
import cs from 'classnames';


class SelectListItem extends React.Component {
Expand All @@ -14,6 +15,9 @@ class SelectListItem extends React.Component {

onChange: PropTypes.func.isRequired,
onMouseDown: PropTypes.func.isRequired,

labelClass: PropTypes.string,
inputClass: PropTypes.string,
};

handleChange = (e) => {
Expand All @@ -25,13 +29,15 @@ class SelectListItem extends React.Component {

render() {
let {
children
children
, disabled
, readOnly
, name
, type
, checked
, onMouseDown
, labelClass
, inputClass
, ...props } = this.props;

delete props.onChange;
Expand All @@ -45,7 +51,7 @@ class SelectListItem extends React.Component {
>
<label
onMouseDown={onMouseDown}
className="rw-select-list-label"
className={cs('rw-select-list-label', labelClass)}
>
<input
name={name}
Expand All @@ -54,10 +60,10 @@ class SelectListItem extends React.Component {
checked={checked}
disabled={disabled || !!readOnly}
role='presentation'
className="rw-select-list-input"
className={cs('rw-select-list-input', inputClass)}
onChange={this.handleChange}
/>
{children}
{children}
</label>
</ListOption>
);
Expand Down