@startupjs-ui/auto-suggest 0.2.0 → 0.3.1
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 +19 -0
- package/index.d.ts +8 -0
- package/index.tsx +31 -3
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.3.1](https://github.com/startupjs/startupjs-ui/compare/v0.3.0...v0.3.1) (2026-06-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/auto-suggest
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.3.0](https://github.com/startupjs/startupjs-ui/compare/v0.2.3...v0.3.0) (2026-05-27)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* [BREAKING] [0.3] improve accessibility props for E2E tests. Support testID everywhere ([#31](https://github.com/startupjs/startupjs-ui/issues/31)) ([882588c](https://github.com/startupjs/startupjs-ui/commit/882588ca37d5e1fd14b5717b5697cf9ed47042e4))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.2.0](https://github.com/startupjs/startupjs-ui/compare/v0.1.23...v0.2.0) (2026-05-04)
|
|
7
26
|
|
|
8
27
|
|
package/index.d.ts
CHANGED
|
@@ -38,6 +38,14 @@ export interface AutoSuggestProps {
|
|
|
38
38
|
disabled?: boolean;
|
|
39
39
|
/** Render as non-interactive */
|
|
40
40
|
readonly?: boolean;
|
|
41
|
+
/** Accessible name for the combobox input */
|
|
42
|
+
'aria-label'?: string;
|
|
43
|
+
/** Element id that labels the combobox input */
|
|
44
|
+
'aria-labelledby'?: string;
|
|
45
|
+
/** Element id that describes the combobox input */
|
|
46
|
+
'aria-describedby'?: string;
|
|
47
|
+
/** Whether the combobox input value is invalid */
|
|
48
|
+
'aria-invalid'?: boolean;
|
|
41
49
|
/** Change handler for selected value */
|
|
42
50
|
onChange?: (value?: any) => void | Promise<void>;
|
|
43
51
|
/** Called after the list is closed */
|
package/index.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { pug, observer } from 'startupjs'
|
|
11
11
|
import { themed } from '@startupjs-ui/core'
|
|
12
12
|
import AbstractPopover from '@startupjs-ui/abstract-popover'
|
|
13
|
+
import Div from '@startupjs-ui/div'
|
|
13
14
|
import FlatList from '@startupjs-ui/flat-list'
|
|
14
15
|
import Loader from '@startupjs-ui/loader'
|
|
15
16
|
import Menu from '@startupjs-ui/menu'
|
|
@@ -66,6 +67,14 @@ export interface AutoSuggestProps {
|
|
|
66
67
|
disabled?: boolean
|
|
67
68
|
/** Render as non-interactive */
|
|
68
69
|
readonly?: boolean
|
|
70
|
+
/** Accessible name for the combobox input */
|
|
71
|
+
'aria-label'?: string
|
|
72
|
+
/** Element id that labels the combobox input */
|
|
73
|
+
'aria-labelledby'?: string
|
|
74
|
+
/** Element id that describes the combobox input */
|
|
75
|
+
'aria-describedby'?: string
|
|
76
|
+
/** Whether the combobox input value is invalid */
|
|
77
|
+
'aria-invalid'?: boolean
|
|
69
78
|
/** Change handler for selected value */
|
|
70
79
|
onChange?: (value?: any) => void | Promise<void>
|
|
71
80
|
/** Called after the list is closed */
|
|
@@ -111,6 +120,10 @@ function AutoSuggest ({
|
|
|
111
120
|
isLoading = false,
|
|
112
121
|
disabled,
|
|
113
122
|
readonly,
|
|
123
|
+
'aria-label': ariaLabel,
|
|
124
|
+
'aria-labelledby': ariaLabelledBy,
|
|
125
|
+
'aria-describedby': ariaDescribedBy,
|
|
126
|
+
'aria-invalid': ariaInvalid,
|
|
114
127
|
onChange,
|
|
115
128
|
onDismiss,
|
|
116
129
|
onChangeText,
|
|
@@ -175,13 +188,19 @@ function AutoSuggest ({
|
|
|
175
188
|
`
|
|
176
189
|
}
|
|
177
190
|
|
|
191
|
+
const optionLabel = getOptionLabel(item)
|
|
192
|
+
const isSelected = stringifyValue(item) === stringifyValue(value)
|
|
193
|
+
|
|
178
194
|
return pug`
|
|
179
195
|
Menu.Item.item(
|
|
180
196
|
key=index
|
|
181
197
|
styleName={ selectMenu: selectIndexValue === index }
|
|
182
198
|
onPress=() => { _onPress(item) }
|
|
183
|
-
active=
|
|
184
|
-
|
|
199
|
+
active=isSelected
|
|
200
|
+
role='option'
|
|
201
|
+
aria-selected=isSelected
|
|
202
|
+
aria-label=optionLabel != null ? String(optionLabel) : undefined
|
|
203
|
+
)= optionLabel
|
|
185
204
|
`
|
|
186
205
|
}
|
|
187
206
|
|
|
@@ -212,6 +231,8 @@ function AutoSuggest ({
|
|
|
212
231
|
}
|
|
213
232
|
|
|
214
233
|
const matchAnchorWidth = !(style as ViewStyle)?.width && !(style as ViewStyle)?.maxWidth
|
|
234
|
+
const inputAccessibleName = ariaLabel ??
|
|
235
|
+
(ariaLabelledBy ? undefined : placeholder != null ? String(placeholder) : undefined)
|
|
215
236
|
|
|
216
237
|
return pug`
|
|
217
238
|
TextInput(
|
|
@@ -226,6 +247,13 @@ function AutoSuggest ({
|
|
|
226
247
|
placeholder=placeholder
|
|
227
248
|
disabled=disabled
|
|
228
249
|
readonly=readonly
|
|
250
|
+
role='combobox'
|
|
251
|
+
aria-label=inputAccessibleName
|
|
252
|
+
aria-labelledby=ariaLabelledBy
|
|
253
|
+
aria-describedby=ariaDescribedBy
|
|
254
|
+
aria-invalid=ariaInvalid
|
|
255
|
+
aria-expanded=isShow
|
|
256
|
+
aria-haspopup='listbox'
|
|
229
257
|
onChangeText=_onChangeText
|
|
230
258
|
onFocus=() => setIsShow(true)
|
|
231
259
|
onKeyPress=onKeyPress
|
|
@@ -247,7 +275,7 @@ function AutoSuggest ({
|
|
|
247
275
|
View.loaderCase
|
|
248
276
|
Loader(size='s')
|
|
249
277
|
else
|
|
250
|
-
|
|
278
|
+
Div.contentCase(role='listbox')
|
|
251
279
|
FlatList.content(
|
|
252
280
|
style=style
|
|
253
281
|
data=_options
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/auto-suggest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/abstract-popover": "^0.
|
|
12
|
-
"@startupjs-ui/core": "^0.
|
|
13
|
-
"@startupjs-ui/
|
|
14
|
-
"@startupjs-ui/
|
|
15
|
-
"@startupjs-ui/
|
|
16
|
-
"@startupjs-ui/
|
|
11
|
+
"@startupjs-ui/abstract-popover": "^0.3.0",
|
|
12
|
+
"@startupjs-ui/core": "^0.3.0",
|
|
13
|
+
"@startupjs-ui/div": "^0.3.1",
|
|
14
|
+
"@startupjs-ui/flat-list": "^0.3.0",
|
|
15
|
+
"@startupjs-ui/loader": "^0.3.0",
|
|
16
|
+
"@startupjs-ui/menu": "^0.3.1",
|
|
17
|
+
"@startupjs-ui/text-input": "^0.3.1"
|
|
17
18
|
},
|
|
18
19
|
"peerDependencies": {
|
|
19
20
|
"react": "*",
|
|
20
21
|
"react-native": "*",
|
|
21
22
|
"startupjs": "*"
|
|
22
23
|
},
|
|
23
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "60311773bdc83f354c797a272774304502d28c58"
|
|
24
25
|
}
|