Tweak search component to accept data-/aria- props
This commit is contained in:
parent
ce64147aa8
commit
ff115b0873
1 changed files with 3 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const PropTypes = require('prop-types');
|
const PropTypes = require('prop-types');
|
||||||
|
const { pick } = require('./utils');
|
||||||
|
|
||||||
class Search extends React.PureComponent {
|
class Search extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -91,6 +92,7 @@ class Search extends React.PureComponent {
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
onKeyDown={this.handleKeyDown}
|
onKeyDown={this.handleKeyDown}
|
||||||
value={this.state.immediateValue}
|
value={this.state.immediateValue}
|
||||||
|
{...pick(this.props, p => p.startsWith('data-') || p.startsWith('aria-'))}
|
||||||
/>
|
/>
|
||||||
{this.state.immediateValue !== ''
|
{this.state.immediateValue !== ''
|
||||||
? <div
|
? <div
|
||||||
|
@ -106,6 +108,7 @@ class Search extends React.PureComponent {
|
||||||
onSearch: PropTypes.func,
|
onSearch: PropTypes.func,
|
||||||
timeout: PropTypes.number,
|
timeout: PropTypes.number,
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
|
placeholder: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue