@zohodesk/components
Version:
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development
68 lines (63 loc) • 1.82 kB
JavaScript
import React from 'react';
import { DropDownSearch_propTypes } from "./props/propTypes";
import { DropDownSearch_defaultProps } from "./props/defaultProps";
import TextBox from "../TextBox/TextBox";
import style from "./DropDownSearch.module.css";
/* eslint css-modules/no-unused-class: [2, { markAsUsed: ['dropdown', 'menu', 'shadow', 'target', 'header', 'headertext', 'list', 'padding', 'listHover', 'active', 'children', 'user', 'footer', separator, 'small', 'search', 'medium', 'heading', 'listGroup'] }] */
export default class DropDownSearch extends React.Component {
constructor(props) {
super(props);
this.getRef = this.getRef.bind(this);
}
componentDidMount() {
this.input && this.input.focus({
preventScroll: true
});
}
getRef(ele) {
let {
getRef
} = this.props;
this.input = ele;
getRef && getRef(ele);
}
render() {
let {
name,
id,
maxLength,
onKeyDown,
onChange,
value,
onBlur,
size,
textBoxSize,
placeHolder,
customClass,
dataId
} = this.props;
let {
searchClass = '',
customTextBox = ''
} = customClass;
return /*#__PURE__*/React.createElement("div", {
className: `${style.search} ${style[`${size}Search`]} ${searchClass}`,
"data-id": dataId,
"data-test-id": dataId
}, /*#__PURE__*/React.createElement(TextBox, {
id: id,
inputRef: this.getRef,
maxLength: maxLength,
name: name,
onBlur: onBlur,
onChange: onChange,
onKeyDown: onKeyDown,
size: textBoxSize,
value: value,
placeHolder: placeHolder,
customClass: customTextBox
}));
}
}
DropDownSearch.defaultProps = DropDownSearch_defaultProps;
DropDownSearch.propTypes = DropDownSearch_propTypes;