
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@exmg/exmg-searchbar
Advanced tools
A customizable search bar element.
This search bar uses mwc-textfield for the input element. More information about styling and the input element itself can be found on the link below: https://github.com/material-components/material-components-web-components/tree/master/packages/textfield
Import this element to your project with npm i @exmg/exmg-searchbar
.
Then add the snippet below into your code.
<exmg-searchbar></exmg-searchbar>
ExmgSearchBar has it's own filtering methods in it which you can also override. To achieve default filtering, take the example of html code below:
<exmg-searchbar .data="${dataArray}" .filterKeys="${filterKeys}" suggestion-label-key="url"> </exmg-searchbar>
When you pass the data array into data
property along with filterKeys
, exmg-search bar automatically filters
data and shows suggestions.
filterKeys
property has to contain specific key names from the type of each item in data
.
For example; if you have [{username:"exmachina",name: "Ex Machina"},{username:"livery",name:"Livery"}]
as the data array,
you can pass ['username']
to filter out username
values of data. Or pass ['username', 'name']
to filter out values of both keys.
To determine which value of items passed into data
should be shown as the label of each suggestion, use suggestion-label-key
just like filterKeys
but the only difference is, it accepts a single key as a simple string, not an array.
By extending ExmgSearchBar
, you can override any of
three functions of your selection.
These functions are:
filter(data: any[], filterKeys: string[], query: string): ExmgSearchSuggestion[]: TemplateResult
renderSuggestions(suggestions: ExmgSearchSuggestion[])
renderSuggestionsLoading(): TemplateResult
filter
expects array of ExmgSearchSuggestion
objects. By implementing your own filtering method,
you might not need suggestion-label-key
since you can place any string value into text
property of ExmgSearchSuggestion
.
Please check ExmgSearchBar
class in order to see how these three functions are working. After that you can extend
ExmgSearchBar
class and override those functions to create your fancy filtering methods or suggestions.
If you are handling filtering logic manually on the parent, you can follow this way to
show suggestions manually.
To show suggestons, pass the suggestion data to suggestions
property of exmg-searchbar
.
It accepts array of ExmgSearchSuggestion
type of elements into suggestions.
Follow this document for available properties, events, methods and styling.
Variable | Default | Description |
---|---|---|
--exmg-searchbar-error-color | #b00020 | Error color of search bar |
--exmg-searchbar-hint-color | rgba(0, 0, 0, 0.6) | Hint text color of search bar |
--exmg-searchbar-primary-color | #0071dc | Primary theme color of search bar |
--exmg-searchbar-text-color | rgba(0, 0, 0, 0.87) | Text color of search bar |
--exmg-searchbar-suggestions-spinner-color | #0071dc | Suggestions loading indicator color |
--exmg-searchbar-suggestions-spinner-width | 3px | Suggestions loading indicator spinner width |
--exmg-searchbar-suggestions-max-visible-suggestions | 5 | Max visible suggestions before showing scrollbar |
--exmg-searchbar-suggestions-min-height | 40px | Suggestion item row height |
--exmg-searchbar-suggestions-text-color | rgba(0, 0, 0, 0.6) | Suggestion item text color |
--exmg-searchbar-suggestions-background-color | #ffffff | Suggestions list background color |
--exmg-searchbar-suggestions-z-index | 1 | z-index of suggestions list |
--exmg-searchbar-width | 100% | Width of search bar |
Name | Type | Default | Description |
---|---|---|---|
filterKeys | string[] | undefined | Set of which keys of data should be checked to filter data by default. |
data | any[] | undefined | The data in search bar to filter. |
keepFocus | boolean | false | If true, keeps focus on search bar after query-submit is fired |
keepSuggestionsOnSelect | boolean | false | Option to whether keep suggestions visible or not on suggestion selection |
submitKeys | string[] | ['ENTER'] | Determines which keys should trigger submitting search query |
notifyOnQueryChange | boolean | true | If true, dispatches query-change event with the current query on every change of search input. |
searchQuery | string | '' | Current query of search bar |
suggestionLabelKey | string | undefined | Defines which property of each data item should be placed into suggestions' labels. |
submitOnKeyPress | boolean | true | If true, dispatches query-submit event with the current query upon receiving key press event with specific keys passed to keys string array |
suggestions | ExmgSearchSuggestion[] | [] | List of suggestions to be passed into and displayed |
suggestionsLoading | boolean | false | If true and there are no suggestions passed to element, a loading indicator should be shownbar |
Fired on query change.
Payload: {value: string}
Fired on query submit.
Payload: {value: string}
Fired on suggestion selection.
This event is also fired when there is only one suggestion and user submits query.
Payload: {value: any, index: number}
Clears suggestions.
Hides the loading indicator.
Fires query-submit
event with passed query into search bar.
Sets query.
Sets suggestions
.
Shows the loading indicator if there are no suggestions available.
FAQs
An element to search the needle in a haystack.
We found that @exmg/exmg-searchbar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.