Gathering detailed insights and metrics for hive-select
Gathering detailed insights and metrics for hive-select
Gathering detailed insights and metrics for hive-select
Gathering detailed insights and metrics for hive-select
npm install hive-select
Typescript
Module System
Node Version
NPM Version
TypeScript (81.07%)
CSS (9.76%)
Vue (4.65%)
HTML (2.48%)
JavaScript (2.03%)
Total Downloads
380
Last Day
2
Last Week
3
Last Month
5
Last Year
103
2,729 Stars
515 Commits
151 Forks
25 Watching
5 Branches
28 Contributors
Latest Version
3.3.1
Package Id
hive-select@3.3.1
Unpacked Size
172.44 kB
Size
52.87 kB
File Count
8
NPM Version
8.19.2
Node Version
18.12.1
Publised On
07 Jun 2023
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
0%
3
Compared to previous week
Last month
150%
5
Compared to previous month
Last year
-62.8%
103
Compared to previous year
1
1
Install using your package manager of choice:
npm install @viselect/react
If you're (still) using CRA, you may run into issues while using the bundle provided. See this comment for how to fix it.
Last but not least you'll need to add some basic styles to make your selection-area visible:
1.selection-area { 2 background: rgba(46, 115, 252, 0.11); 3 border: 2px solid rgba(98, 155, 255, 0.81); 4 border-radius: 0.1em; 5}
Additionally, to not interfere with text-selection, selection-js won't prevent any default events anymore (as of v2.0.3
). This however can cause problems with the actual
selection ("introduced" by #99, reported in #103). If you don't care about
text-selection, add the following to the container where all your selectables are located:
1.container { 2 user-select: none; 3}
All options are exposed as props. They're a one-to-one mapping of the original options found in the vanilla version!
1import SelectionArea, {SelectionEvent} from '@viselect/react'; 2import React, {FunctionComponent, useState} from 'react'; 3 4const App: FunctionComponent = () => { 5 const [selected, setSelected] = useState<Set<number>>(() => new Set()); 6 7 const extractIds = (els: Element[]): number[] => 8 els.map(v => v.getAttribute('data-key')) 9 .filter(Boolean) 10 .map(Number); 11 12 const onStart = ({event, selection}: SelectionEvent) => { 13 if (!event?.ctrlKey && !event?.metaKey) { 14 selection.clearSelection(); 15 setSelected(() => new Set()); 16 } 17 }; 18 19 const onMove = ({store: {changed: {added, removed}}}: SelectionEvent) => { 20 setSelected(prev => { 21 const next = new Set(prev); 22 extractIds(added).forEach(id => next.add(id)); 23 extractIds(removed).forEach(id => next.delete(id)); 24 return next; 25 }); 26 }; 27 28 return ( 29 <> 30 <SelectionArea className="container" 31 onStart={onStart} 32 onMove={onMove} 33 selectables=".selectable"> 34 {new Array(42).fill(0).map((_, index) => ( 35 <div className={selected.has(index) ? 'selected selectable' : 'selectable'} 36 data-key={index} 37 key={index}/> 38 ))} 39 </SelectionArea> 40 </> 41 ); 42}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
7 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 8
Reason
6 existing vulnerabilities detected
Details
Reason
Found 4/27 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More