react-dropdown-select
Advanced tools
Comparing version 4.9.0 to 4.9.3
{ | ||
"name": "react-dropdown-select", | ||
"version": "4.9.0", | ||
"version": "4.9.3", | ||
"description": "Customizable dropdown select for react", | ||
@@ -74,5 +74,5 @@ "main": "dist/react-dropdown-select.js", | ||
"coveralls": "^3.0.9", | ||
"css-loader": "^3.4.1", | ||
"css-loader": "^6.7.3", | ||
"gh-pages": "^2.2.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"html-webpack-plugin": "^5.5.0", | ||
"husky": "^3.1.0", | ||
@@ -86,5 +86,5 @@ "jest": "^25.3.0", | ||
"replace": "^1.2.0", | ||
"style-loader": "^0.23.1", | ||
"webpack": "^4.41.5", | ||
"webpack-cli": "^3.3.10", | ||
"style-loader": "^3.3.1", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^5.0.1", | ||
"webpack-dev-server": "^3.10.1" | ||
@@ -91,0 +91,0 @@ }, |
@@ -40,8 +40,40 @@ # react-dropdown-select | ||
```jsx | ||
const options = [ | ||
{ | ||
value: 1, | ||
label: "Leanne Graham" | ||
}, | ||
{ | ||
value: 2, | ||
label: "Ervin Howell" | ||
} | ||
]; | ||
<Select options={options} onChange={(values) => this.setValues(values)} /> | ||
``` | ||
If your options don't have **value** and **label** fields, include **labelField** and **valueField** in the props: | ||
```jsx | ||
const options = [ | ||
{ | ||
id: 1, | ||
name: "Leanne Graham" | ||
}, | ||
{ | ||
id: 2, | ||
name: "Ervin Howell" | ||
} | ||
]; | ||
<Select options={options} labelField="name" valueField="id" onChange={(values) => this.setValues(values)} /> | ||
``` | ||
> **options** and **onChange** are the minimum required props | ||
### Help and Contributions | ||
@@ -48,0 +80,0 @@ |
declare module 'react-dropdown-select' { | ||
import React, { KeyboardEvent, CSSProperties, ChangeEvent } from 'react'; | ||
import { | ||
ChangeEvent, | ||
CSSProperties, | ||
HTMLAttributes, | ||
KeyboardEvent, | ||
MouseEvent, | ||
PropsWithRef, | ||
RefObject | ||
} from 'react'; | ||
@@ -22,8 +30,4 @@ export interface SetStateFnArgs<T> { | ||
export interface SelectMethods<T> { | ||
removeItem: ( | ||
event: React.MouseEvent<HTMLElement, MouseEvent> | null, | ||
item: T, | ||
close: boolean | ||
) => void; | ||
dropDown: (action: string, event?: React.MouseEvent<HTMLElement, MouseEvent> | null) => void; | ||
removeItem: (event: MouseEvent<HTMLElement> | null, item: T, close: boolean) => void; | ||
dropDown: (action: string, event?: MouseEvent<HTMLElement> | null) => void; | ||
addItem: (item: T) => void; | ||
@@ -142,5 +146,5 @@ setSearch: (event: ChangeEvent<HTMLInputElement>) => void; | ||
}: SelectRenderer<T> & { | ||
inputRef: React.RefObject<HTMLInputElement>; | ||
inputRef: RefObject<HTMLInputElement>; | ||
}) => JSX.Element; | ||
itemRenderer?: ({ | ||
itemRenderer?: ({ | ||
item, | ||
@@ -156,3 +160,3 @@ itemIndex, | ||
separatorRenderer?: ({ props, state, methods }: SelectRenderer<T>) => JSX.Element; | ||
additionalProps?: React.HTMLAttributes<HTMLDivElement>; | ||
additionalProps?: HTMLAttributes<HTMLDivElement>; | ||
wrapperClassName?: string; | ||
@@ -170,5 +174,5 @@ } | ||
const Select: <T extends object | string = {}>( | ||
props: React.PropsWithRef<SelectProps<T>> | ||
props: PropsWithRef<SelectProps<T>> | ||
) => JSX.Element; | ||
export default Select; | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
169770
181
165
0