diff --git a/lib/globals/animations.module.scss b/lib/globals/animations.module.scss index 303383e6..27889a73 100644 --- a/lib/globals/animations.module.scss +++ b/lib/globals/animations.module.scss @@ -13,6 +13,21 @@ } } +@mixin zoomIn() { + -o-animation-name: animateZoom; + -moz-animation-name: animateZoom; + -webkit-animation-name: animateZoom; + animation-name: animateZoom; + @keyframes animateZoom { + 0% { + transform: scale(0.1); + } + 100% { + transform: scale(1); + } + } +} + @mixin sectionEntry($duration) { visibility: hidden; opacity: 0; diff --git a/lib/multiselect/index.js b/lib/multiselect/index.js index fa8b4a82..07c7bf4f 100644 --- a/lib/multiselect/index.js +++ b/lib/multiselect/index.js @@ -3,6 +3,8 @@ import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import cx from 'classnames'; import { themr } from 'react-css-themr'; +import { FaChevronDown } from 'react-icons/fa'; +import { MdClose } from 'react-icons/md'; import defaultTheme from './theme.module.scss'; const { findDOMNode: findNode } = ReactDOM; @@ -17,7 +19,6 @@ class MultiSelect extends Component { */ selected: [], open: false, - input: '', }; this.listRef = null; @@ -31,12 +32,6 @@ class MultiSelect extends Component { return { threshold, focusedItem }; }; - handleInput = ({ target }) => { - this.setState({ - input: target.value, - }); - }; - // Handle the click event when user selects / clicks on an option from the dropdown. handleSelect = (selectedOption) => { const { onSelect } = this.props; @@ -65,12 +60,7 @@ class MultiSelect extends Component { handleKeyPress = (e) => { e.preventDefault(); const { options } = this.props; - const { input, selected, focus } = this.state; - const isValid = options - .filter(opt => opt - .label - .toLowerCase() - .indexOf(input.toLowerCase()) !== -1); + const { focus } = this.state; switch (e.key) { case 'ArrowDown': this.setState( @@ -118,22 +108,7 @@ class MultiSelect extends Component { ); break; case 'Enter': - if (focus) { - this.handleSelect(options[focus]); - break; - } - if (isValid.length) { - if ( - !selected.filter(item => item.label === isValid[0].label).length - ) { - this.setState({ - selected: [...selected, isValid[0]], - }); - } - } - this.setState({ - input: '', - }); + this.handleSelect(options[focus]); break; default: break; @@ -204,18 +179,8 @@ class MultiSelect extends Component { // Helper function to render options inside the dropdown. renderOptions = (options) => { const { theme } = this.props; - const { selected, input, focus } = this.state; - let filteredOptions; - if (input.length) { - filteredOptions = options - .filter(opt => opt - .label - .toLowerCase() - .indexOf(input.toLowerCase()) !== -1); - } else { - filteredOptions = options; - } - return filteredOptions.map((option, index) => { + const { selected, focus } = this.state; + return options.map((option, index) => { /* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/no-static-element-interactions */ const itemtheme = cx( @@ -259,7 +224,7 @@ class MultiSelect extends Component { >