@startupjs-ui/menu 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/MenuItem/index.tsx +18 -1
- package/package.json +7 -7
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/menu
|
|
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/MenuItem/index.tsx
CHANGED
|
@@ -34,6 +34,12 @@ export interface MenuItemProps extends Omit<ItemProps, 'style' | 'onPress' | 'ic
|
|
|
34
34
|
to?: string
|
|
35
35
|
/** Handler called on item press */
|
|
36
36
|
onPress?: ItemProps['onPress']
|
|
37
|
+
/** Web accessibility role forwarded to the interactive root */
|
|
38
|
+
role?: ItemProps['role']
|
|
39
|
+
/** Whether the option is selected (for listbox/combobox patterns on web) */
|
|
40
|
+
'aria-selected'?: boolean
|
|
41
|
+
/** Accessible name when item text is not plain text */
|
|
42
|
+
'aria-label'?: string
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
function MenuItem ({
|
|
@@ -42,6 +48,9 @@ function MenuItem ({
|
|
|
42
48
|
active = false,
|
|
43
49
|
bold,
|
|
44
50
|
icon,
|
|
51
|
+
role,
|
|
52
|
+
'aria-selected': ariaSelected,
|
|
53
|
+
'aria-label': ariaLabel,
|
|
45
54
|
...props
|
|
46
55
|
}: MenuItemProps): ReactNode {
|
|
47
56
|
const context = useContext(MenuContext)
|
|
@@ -61,9 +70,17 @@ function MenuItem ({
|
|
|
61
70
|
color = active ? (activeColor ?? getColor('text-primary')) : (color ?? getColor('text-main'))
|
|
62
71
|
const borderStyle: StyleProp<ViewStyle> = { backgroundColor: activeColor ?? getColor('border-primary') }
|
|
63
72
|
|
|
73
|
+
const optionLabel = ariaLabel ??
|
|
74
|
+
(typeof children === 'string' || typeof children === 'number' ? String(children) : undefined)
|
|
75
|
+
|
|
64
76
|
return pug`
|
|
65
77
|
Div
|
|
66
|
-
Item(
|
|
78
|
+
Item(
|
|
79
|
+
...props
|
|
80
|
+
role=role
|
|
81
|
+
aria-label=optionLabel
|
|
82
|
+
aria-selected=ariaSelected
|
|
83
|
+
)
|
|
67
84
|
if icon && iconPosition === 'left'
|
|
68
85
|
Item.Left
|
|
69
86
|
Icon(icon=icon style={ color })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/core": "^0.
|
|
12
|
-
"@startupjs-ui/div": "^0.
|
|
13
|
-
"@startupjs-ui/icon": "^0.
|
|
14
|
-
"@startupjs-ui/item": "^0.
|
|
15
|
-
"@startupjs-ui/span": "^0.
|
|
11
|
+
"@startupjs-ui/core": "^0.3.0",
|
|
12
|
+
"@startupjs-ui/div": "^0.3.1",
|
|
13
|
+
"@startupjs-ui/icon": "^0.3.0",
|
|
14
|
+
"@startupjs-ui/item": "^0.3.1",
|
|
15
|
+
"@startupjs-ui/span": "^0.3.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*",
|
|
19
19
|
"react-native": "*",
|
|
20
20
|
"startupjs": "*"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "60311773bdc83f354c797a272774304502d28c58"
|
|
23
23
|
}
|