You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Completed changes for v2.1.0, which includes the new 'async' mode; update README.md; add new story 'Async' to storybook and rebuild storybook files; bump some dev dependencies
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@
13
13
- Extensible styling API with [`styled-components`](https://github.com/styled-components/styled-components)
14
14
- Opt-in properties to make the component fully accessible
15
15
- Effortlessly scroll, filter, and key through datasets numbering in the tens of thousands via [`react-window`](https://github.com/bvaughn/react-window) + performance conscious code
16
+
- Async mode for fetching dynamic options from a remote server using the search input value (starting in `v2.1.0`)
16
17
17
18
<strong>Peer dependencies:</strong>
18
19
@@ -21,14 +22,14 @@
21
22
22
23
## Overview
23
24
24
-
Essentially, this is a focused subset of [`react-select`](https://github.com/JedWatson/react-select)'s API that is engineered for ultimate performance and minimal bundle size. It is built entirely using `React Hooks` and `FunctionComponents`. The primary design principal revolves around weighing the cost/benefits of adding a feature against the impact to performance & # of lines of code its addition would have.
25
+
Essentially, this is a focused subset of [`react-select`](https://github.com/JedWatson/react-select)'s API that is engineered for ultimate performance and minimal bundle size. It is built entirely using `React Hooks` and `FunctionComponents`. The primary design principal revolves around weighing the cost/benefits of adding a feature against the impact to performance & # of lines of code its addition would have.
25
26
26
-
I opted to exclude less "in-demand" features such as:
27
+
I opted to exclude less "in-demand" features such as:
27
28
28
29
- Preventing scroll events on the app's body if the menu is open <strong><em>TODO: add code example</em></strong>
29
30
- Closing an open menu if the app's body is scrolled <strong><em>TODO: add code example</em></strong>
30
31
31
-
These feature would have added significant overhead to the package. In addition, if we expose the right public methods and/or callback properties, this feature should be trivial to add to wrapping components - proper decoupling and abstraction of code is key to keeping such channels open for similar customizations that can be kept out of this package.
32
+
These feature would have added significant overhead to the package. In addition, if we expose the right public methods and/or callback properties, this feature should be trivial to add to wrapping components - proper decoupling and abstraction of code is key to keeping such channels open for similar customizations that can be kept out of this package.
All properties are technically optional (with a few having default values). Very similar with [`react-select`](https://github.com/JedWatson/react-select)'s API.
110
111
111
-
> <strong><em>Note that the following non-primitive properties should be properly memoized if defined:</em></strong><br>`clearIcon`, `caretIcon`, `options`, `renderOptionLabel`, `onMenuOpen`, `onOptionChange`, `onKeyDown`, `getOptionLabel`, `getOptionLabel`, `getOptionValue`, `onInputBlur`, `onInputFocus`, `getIsOptionDisabled`, `getFilterOptionString`, `themeConfig`
112
+
> <strong><em>Note that the following non-primitive properties should be properly memoized if defined:</em></strong><br>`clearIcon`, `caretIcon`, `options`, `renderOptionLabel`, `onMenuOpen`, `onOptionChange`, `onKeyDown`, `getOptionLabel`, `getOptionLabel`, `getOptionValue`, `onInputBlur`, `onInputFocus`, `onInputChange`, `onSearchChange`, `getIsOptionDisabled`, `getFilterOptionString`, `themeConfig`
112
113
113
114
| Property | Type | Default | Description
114
115
:---|:---|:---|:---
115
116
| `inputId`| string | `undefined` | The id of the autosize search input
116
117
|`selectId`| string | `undefined` | The id of the parent div
|`isMulti`| bool | `false` | Does the control allow for multiple selections (defaults to single-value mode)
120
+
|`async`| bool | `false` | Is the component in 'async' mode - when in 'async' mode, updates to the input search value will NOT cause the effect `useMenuOptions` to execute (this effect parses `options` into stateful value `menuOptions`)
119
121
|`autoFocus`| bool | `false` | Focus the control following initial mount of component
120
122
|`isLoading`| bool | `false` | Is the select in a state of loading - shows loading dots animation
121
123
|`isInvalid`| bool | `false` | Is the current value invalid - control recieves invalid styling
@@ -126,6 +128,7 @@ All properties are technically optional (with a few having default values). Very
126
128
|`menuItemSize`| number | `35` | The height of each option in the menu (px)
127
129
|`isClearable`| bool | `false` | Is the select value clearable
128
130
|`noOptionsMsg`| string | `No options` | The text displayed in the menu when there are no options available
131
+
|`loadingMsg`| string | `Loading...` | The text displayed in the menu when `isLoading` === `true`
@@ -157,6 +160,8 @@ All properties are technically optional (with a few having default values). Very
157
160
|`getOptionValue`| (data: any): ReactText | `undefined` | Resolves option data to React.ReactText to compare option values (by default will use option.value)
158
161
|`onInputBlur`| (e: FocusEvent\<HTMLInputElement\>): void | `undefined` | Handle blur events on the search input
159
162
|`onInputFocus`| (e: FocusEvent\<HTMLInputElement\>): void | `undefined` | Handle focus events on the search input
163
+
|`onInputChange`| (value: string): void | `undefined` | Handle change events on the search input
164
+
|`onSearchChange`| (value: string): void | `undefined` | Callback executed after the debounced search input value is persisted to the component's state - if no debounce is defined via the `inputDelay` property, it probably makes more sense to use `onInputChange` instead.
160
165
|`renderOptionLabel`| (data: any): ReactNode | `undefined` | Formats option labels in the menu and control as JSX.Elements or React Components (by default will use `getOptionLabel`)
161
166
|`getIsOptionDisabled`| (data: any): boolean | `undefined` | When defined will evaluate each option to determine whether it is disabled or not (if not specified, each option will be evaluated as to whether or not it contains a property of `isDisabled` with a value of `true`)
162
167
|`getFilterOptionString`| (option: any): string | `undefined` | When defined will take each option and generate a string used in the filtering process (by default, will use option.label)
0 commit comments