@startupjs-ui/auto-suggest 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.mdx +18 -15
- package/index.d.ts +2 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/auto-suggest
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.1.15](https://github.com/startupjs/startupjs-ui/compare/v0.1.14...v0.1.15) (2026-02-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @startupjs-ui/auto-suggest
|
package/README.mdx
CHANGED
|
@@ -6,7 +6,12 @@ import Span from '@startupjs-ui/span'
|
|
|
6
6
|
import { Sandbox } from '@startupjs-ui/docs'
|
|
7
7
|
|
|
8
8
|
# AutoSuggest
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
AutoSuggest is a text input with a pop-up list of filterable options. As the user types, the options are filtered to match the input text.
|
|
11
|
+
|
|
12
|
+
Use the `options` prop to provide the list of options (strings, numbers, or objects with `value` and `label` keys), `value` for the currently selected value, and `onChange` to handle selection. The component also supports `placeholder` (defaults to `'Select value'`), `size` (`'s'`, `'m'`, `'l'`, defaults to `'m'`), `disabled`, `readonly`, and `isLoading` to show a loader while fetching options.
|
|
13
|
+
|
|
14
|
+
For custom styling, use `style` for the suggestion list container, `captionStyle` for the input wrapper, `inputStyle` for the input field, `iconStyle` for the clear icon, and `inputIcon` for a custom input icon. Use `testID` for testing.
|
|
10
15
|
|
|
11
16
|
```jsx
|
|
12
17
|
import { AutoSuggest } from 'startupjs-ui'
|
|
@@ -14,9 +19,10 @@ import { AutoSuggest } from 'startupjs-ui'
|
|
|
14
19
|
|
|
15
20
|
## Initialization
|
|
16
21
|
|
|
17
|
-
Before
|
|
22
|
+
Before using AutoSuggest, you need to configure [Portal](/docs/components/Portal).
|
|
18
23
|
|
|
19
24
|
## Simple example
|
|
25
|
+
|
|
20
26
|
```jsx example
|
|
21
27
|
const [value, setValue] = useState()
|
|
22
28
|
|
|
@@ -36,11 +42,14 @@ return (
|
|
|
36
42
|
```
|
|
37
43
|
|
|
38
44
|
## Props
|
|
39
|
-
|
|
40
|
-
- value
|
|
41
|
-
-
|
|
42
|
-
- placeholder
|
|
43
|
-
- onChange
|
|
45
|
+
|
|
46
|
+
- `options` -- an array of options, each being a string, number, or object with `value` and `label` keys.
|
|
47
|
+
- `value` -- the currently selected value.
|
|
48
|
+
- `placeholder` -- placeholder text displayed when no value is selected.
|
|
49
|
+
- `onChange` -- callback called when the user selects a value, receiving the selected value as its argument.
|
|
50
|
+
- `onChangeText` -- callback called when the user types in the input, receiving the current text.
|
|
51
|
+
- `onDismiss` -- callback called when the suggestion list closes.
|
|
52
|
+
- `onScrollEnd` -- callback called when the list is scrolled to the end (useful for loading more options).
|
|
44
53
|
|
|
45
54
|
```jsx example
|
|
46
55
|
const [value, setValue] = useState()
|
|
@@ -67,7 +76,8 @@ return (
|
|
|
67
76
|
```
|
|
68
77
|
|
|
69
78
|
## Customization
|
|
70
|
-
|
|
79
|
+
|
|
80
|
+
Use the `renderItem` prop to customize how each option is rendered. The function receives three arguments: the current item, its index, and the currently highlighted index.
|
|
71
81
|
|
|
72
82
|
```jsx example
|
|
73
83
|
const [value, setValue] = useState()
|
|
@@ -114,13 +124,6 @@ return (
|
|
|
114
124
|
)
|
|
115
125
|
```
|
|
116
126
|
|
|
117
|
-
## Also
|
|
118
|
-
- style: responsible for styled hidden content
|
|
119
|
-
- captionStyle: responsible for heading styles (input)
|
|
120
|
-
- onDismiss: callback, called when the list is closed
|
|
121
|
-
- onChangeText: callback, called when entering text, accepts 1 argument text
|
|
122
|
-
- onScrollEnd: callback, called at the end of the scroll
|
|
123
|
-
|
|
124
127
|
## Sandbox
|
|
125
128
|
|
|
126
129
|
<Sandbox
|
package/index.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface AutoSuggestProps {
|
|
|
26
26
|
options?: AutoSuggestOption[];
|
|
27
27
|
/** Current selected value */
|
|
28
28
|
value?: AutoSuggestValue;
|
|
29
|
+
/** Size preset @default 'm' */
|
|
30
|
+
size?: 'l' | 'm' | 's';
|
|
29
31
|
/** Placeholder text @default 'Select value' */
|
|
30
32
|
placeholder?: string | number;
|
|
31
33
|
/** Custom item renderer (item, index, highlightedIndex) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/auto-suggest",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/abstract-popover": "^0.1.
|
|
11
|
+
"@startupjs-ui/abstract-popover": "^0.1.16",
|
|
12
12
|
"@startupjs-ui/core": "^0.1.11",
|
|
13
|
-
"@startupjs-ui/flat-list": "^0.1.
|
|
14
|
-
"@startupjs-ui/loader": "^0.1.
|
|
15
|
-
"@startupjs-ui/menu": "^0.1.
|
|
16
|
-
"@startupjs-ui/text-input": "^0.1.
|
|
13
|
+
"@startupjs-ui/flat-list": "^0.1.16",
|
|
14
|
+
"@startupjs-ui/loader": "^0.1.16",
|
|
15
|
+
"@startupjs-ui/menu": "^0.1.16",
|
|
16
|
+
"@startupjs-ui/text-input": "^0.1.16"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "*",
|
|
20
20
|
"react-native": "*",
|
|
21
21
|
"startupjs": "*"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
|
|
24
24
|
}
|