Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-select-search
Advanced tools
React powered selectbox with filter using fuse.js (Javascript fuzzy-search).
Example design comes from the beautiful work by Rovane Durso.
A React 0.12.* supported version can be found in 0.2.* (and below) tagged releases
Live demo can be found here: http://tbleckert.github.io/react-select-search/
Install it with npm (npm install react-select-search --save
) and require it like you normally would.
React.render(
<SelectSearch
name="country"
value="SE"
placeholder="Choose country"
search={true}
multiple={false}
height={height in pixels, used if multiple select}
className="my-selectbox"
options={objectWithOptions}
fuse={fuseJsOptions}
optionSelected={callbackWhenOptionMarked}
valueChanged={callbackWhenValueChanged}
renderOption={modifyOptionHtml}
onMount={componentDidMountCallback}
onFocus={searchFocusCallback}
onBlur={searchBlurCallback} />,
document.getElementById('selectSearch')
);
These are all available options. The React component renders a hidden field with the name property and the current value to use in forms.
You will also need some CSS to make it look right. The important piece is the options.
/** The option list should not be visible by default */
.select-search-box__select {
display: none;
}
/** If it's a multiple select, you can style it with this selector */
.select-search-box--multiple .select-search-box__select {
display: block;
}
/** The list receives the modifier class "display" when the select has focus */
.select-search-box__select--display {
display: block;
}
/**
* The option list hides when the selectbox loses focus.
* To prevent the list from dissapearing before the option click event
* we use a timer that hides it after 200ms.
* To make it look like it dissapears right away
* you can use this class and set opacity to 0
*
* I found that using the mousedown event wasn't a good option.
*/
.select-search-box__select--prehide {
opacity: 0;
}
/** UL with the options */
.select-search-box__options {
}
/** The option (LI), look at the state classes below */
.select-search-box__option {
}
/** When the option has been selected */
.select-search-box__option--selected {
}
/** When the option is selected (when navigation with the arrow keys, up/down) */
.select-search-box__option--hover, .select-search-box__option:hover {
}
FAQs
Lightweight select component for React
The npm package react-select-search receives a total of 17,190 weekly downloads. As such, react-select-search popularity was classified as popular.
We found that react-select-search demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.