@startupjs-ui/multi-select 0.1.12 → 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 +16 -0
- package/README.mdx +37 -10
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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/multi-select
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @startupjs-ui/multi-select
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.1.12](https://github.com/startupjs/startupjs-ui/compare/v0.1.11...v0.1.12) (2026-01-21)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @startupjs-ui/multi-select
|
package/README.mdx
CHANGED
|
@@ -7,7 +7,7 @@ import MultiSelect, { _PropsJsonSchema as MultiSelectPropsJsonSchema } from './i
|
|
|
7
7
|
|
|
8
8
|
# MultiSelect
|
|
9
9
|
|
|
10
|
-
MultiSelect lets
|
|
10
|
+
MultiSelect lets users pick multiple options from a dropdown list. Selected options are displayed as tags in the input area.
|
|
11
11
|
|
|
12
12
|
```jsx
|
|
13
13
|
import { MultiSelect } from 'startupjs-ui'
|
|
@@ -15,7 +15,7 @@ import { MultiSelect } from 'startupjs-ui'
|
|
|
15
15
|
|
|
16
16
|
## Initialization
|
|
17
17
|
|
|
18
|
-
Before
|
|
18
|
+
Before using MultiSelect, you need to configure [Portal](/docs/components/Portal).
|
|
19
19
|
|
|
20
20
|
## Simple example
|
|
21
21
|
|
|
@@ -39,7 +39,7 @@ return (
|
|
|
39
39
|
|
|
40
40
|
## Options
|
|
41
41
|
|
|
42
|
-
You can pass array of
|
|
42
|
+
You can pass an array of `{ label, value }` objects or an array of primitives to the `options` prop.
|
|
43
43
|
|
|
44
44
|
```jsx example
|
|
45
45
|
const OBJECT_OPTIONS_EXAMPLE = [
|
|
@@ -73,6 +73,8 @@ return (
|
|
|
73
73
|
|
|
74
74
|
## Disabled
|
|
75
75
|
|
|
76
|
+
Set `disabled` to `true` to prevent all user interaction with the component.
|
|
77
|
+
|
|
76
78
|
```jsx example
|
|
77
79
|
const OPTIONS = [
|
|
78
80
|
{ label: 'New York', value: 'ny' },
|
|
@@ -93,6 +95,8 @@ return (
|
|
|
93
95
|
|
|
94
96
|
## Readonly
|
|
95
97
|
|
|
98
|
+
Set `readonly` to `true` to display selected values as plain text without allowing changes.
|
|
99
|
+
|
|
96
100
|
```jsx example
|
|
97
101
|
const OPTIONS = [
|
|
98
102
|
{ label: 'New York', value: 'ny' },
|
|
@@ -113,7 +117,7 @@ return (
|
|
|
113
117
|
|
|
114
118
|
## Tag
|
|
115
119
|
|
|
116
|
-
You can
|
|
120
|
+
You can provide a custom tag component using the `TagComponent` prop. It receives `{ record, index, isLast }` where `record` is the matching option object.
|
|
117
121
|
|
|
118
122
|
```jsx example
|
|
119
123
|
const OPTIONS = [
|
|
@@ -134,9 +138,9 @@ return (
|
|
|
134
138
|
)
|
|
135
139
|
```
|
|
136
140
|
|
|
137
|
-
## Input
|
|
141
|
+
## Input component
|
|
138
142
|
|
|
139
|
-
You can
|
|
143
|
+
You can provide a custom input component using the `InputComponent` prop. It receives `{ children, onOpen, onHide, value, placeholder, disabled, readonly, focused }`.
|
|
140
144
|
|
|
141
145
|
```jsx example
|
|
142
146
|
const OPTIONS = [
|
|
@@ -174,7 +178,7 @@ return (
|
|
|
174
178
|
|
|
175
179
|
## Tag limit
|
|
176
180
|
|
|
177
|
-
You can limit the number of displayed tags by passing `tagLimit
|
|
181
|
+
You can limit the number of displayed tags by passing `tagLimit`. Extra tags are collapsed and shown as a "+N" indicator.
|
|
178
182
|
|
|
179
183
|
```jsx example
|
|
180
184
|
const OPTIONS = [
|
|
@@ -197,7 +201,7 @@ return (
|
|
|
197
201
|
|
|
198
202
|
## Limit the number of selected tags
|
|
199
203
|
|
|
200
|
-
You can limit the number of
|
|
204
|
+
You can limit the number of selections by passing `maxTagCount`. Once the limit is reached, additional options cannot be selected.
|
|
201
205
|
|
|
202
206
|
```jsx example
|
|
203
207
|
const OPTIONS = [
|
|
@@ -218,6 +222,29 @@ return (
|
|
|
218
222
|
)
|
|
219
223
|
```
|
|
220
224
|
|
|
225
|
+
## Props
|
|
226
|
+
|
|
227
|
+
- **value** -- an array of selected values (default `[]`)
|
|
228
|
+
- **options** -- an array of `{ label, value }` objects or primitives (default `[]`)
|
|
229
|
+
- **onChange** -- called with the updated array of values when the selection changes
|
|
230
|
+
- **onSelect** -- called with the value when an option is selected
|
|
231
|
+
- **onRemove** -- called with the value when an option is removed
|
|
232
|
+
- **onFocus** -- called when the dropdown opens
|
|
233
|
+
- **onBlur** -- called when the dropdown closes
|
|
234
|
+
- **placeholder** -- text shown when no options are selected (default `'Select'`)
|
|
235
|
+
- **disabled** -- disables all interactions (default `false`)
|
|
236
|
+
- **readonly** -- renders selected values as read-only text (default `false`)
|
|
237
|
+
- **tagLimit** -- maximum number of visible tags; extra tags show a "+N" indicator
|
|
238
|
+
- **tagLimitVariant** -- behavior when tags are limited: `'hidden'` or `'disabled'` (default `'hidden'`)
|
|
239
|
+
- **maxTagCount** -- maximum number of options that can be selected
|
|
240
|
+
- **TagComponent** -- a custom component for rendering tags
|
|
241
|
+
- **InputComponent** -- a custom component for rendering the input area
|
|
242
|
+
- **renderListItem** -- a custom renderer for dropdown items; receives `{ item, index, selected }`
|
|
243
|
+
- **hasWidthCaption** -- match the dropdown width to the input width on web (default `false`)
|
|
244
|
+
- **style** -- custom styles for the popover anchor wrapper
|
|
245
|
+
- **inputStyle** -- custom styles for the input wrapper
|
|
246
|
+
- **ref** -- a ref providing imperative `focus()` and `blur()` methods
|
|
247
|
+
|
|
221
248
|
## Sandbox
|
|
222
249
|
|
|
223
250
|
<Sandbox
|
|
@@ -227,8 +254,8 @@ return (
|
|
|
227
254
|
value: ['New York'],
|
|
228
255
|
options: ['New York', 'Los Angeles', 'Tokyo'],
|
|
229
256
|
onChange: value => console.info('New value is ' + JSON.stringify(value)),
|
|
230
|
-
onSelect: value => console.info('Value
|
|
231
|
-
onRemove: value => console.info('Value
|
|
257
|
+
onSelect: value => console.info('Value "' + value + '" is selected'),
|
|
258
|
+
onRemove: value => console.info('Value "' + value + '" is removed'),
|
|
232
259
|
}}
|
|
233
260
|
block
|
|
234
261
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/multi-select",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@startupjs-ui/core": "^0.1.11",
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/drawer": "^0.1.
|
|
14
|
-
"@startupjs-ui/icon": "^0.1.
|
|
15
|
-
"@startupjs-ui/popover": "^0.1.
|
|
16
|
-
"@startupjs-ui/scroll-view": "^0.1.
|
|
17
|
-
"@startupjs-ui/span": "^0.1.
|
|
18
|
-
"@startupjs-ui/tag": "^0.1.
|
|
12
|
+
"@startupjs-ui/div": "^0.1.16",
|
|
13
|
+
"@startupjs-ui/drawer": "^0.1.16",
|
|
14
|
+
"@startupjs-ui/icon": "^0.1.16",
|
|
15
|
+
"@startupjs-ui/popover": "^0.1.16",
|
|
16
|
+
"@startupjs-ui/scroll-view": "^0.1.16",
|
|
17
|
+
"@startupjs-ui/span": "^0.1.16",
|
|
18
|
+
"@startupjs-ui/tag": "^0.1.16"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "*",
|
|
22
22
|
"react-native": "*",
|
|
23
23
|
"startupjs": "*"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
|
|
26
26
|
}
|