@xsolla/xui-context-menu 0.199.0 → 0.200.0
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/native/index.js +66 -5
- package/native/index.js.map +1 -1
- package/native/index.mjs +66 -5
- package/native/index.mjs.map +1 -1
- package/package.json +10 -10
package/native/index.mjs
CHANGED
|
@@ -19,6 +19,38 @@ import {
|
|
|
19
19
|
Image
|
|
20
20
|
} from "react-native";
|
|
21
21
|
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
var roleToAccessibilityRole = {
|
|
23
|
+
button: "button",
|
|
24
|
+
link: "link",
|
|
25
|
+
img: "image",
|
|
26
|
+
image: "image",
|
|
27
|
+
summary: "summary",
|
|
28
|
+
switch: "switch",
|
|
29
|
+
checkbox: "checkbox",
|
|
30
|
+
radio: "radio",
|
|
31
|
+
heading: "header",
|
|
32
|
+
text: "text",
|
|
33
|
+
search: "search",
|
|
34
|
+
alert: "alert",
|
|
35
|
+
none: "none",
|
|
36
|
+
presentation: "none",
|
|
37
|
+
progressbar: "progressbar",
|
|
38
|
+
scrollbar: "scrollbar",
|
|
39
|
+
adjustable: "adjustable",
|
|
40
|
+
tab: "tab",
|
|
41
|
+
menu: "menu",
|
|
42
|
+
menuitem: "menuitem",
|
|
43
|
+
list: "list",
|
|
44
|
+
timer: "timer"
|
|
45
|
+
};
|
|
46
|
+
var toGapValue = (gap) => {
|
|
47
|
+
if (gap === void 0) return void 0;
|
|
48
|
+
if (typeof gap === "number") return gap;
|
|
49
|
+
const pxMatch = /^(\d+(?:\.\d+)?)px$/.exec(gap);
|
|
50
|
+
if (pxMatch) return Number(pxMatch[1]);
|
|
51
|
+
const asNumber = Number(gap);
|
|
52
|
+
return Number.isFinite(asNumber) ? asNumber : void 0;
|
|
53
|
+
};
|
|
22
54
|
var Box = ({
|
|
23
55
|
children,
|
|
24
56
|
onPress,
|
|
@@ -51,8 +83,10 @@ var Box = ({
|
|
|
51
83
|
marginLeft,
|
|
52
84
|
marginRight,
|
|
53
85
|
flexDirection,
|
|
86
|
+
flexWrap,
|
|
54
87
|
alignItems,
|
|
55
88
|
justifyContent,
|
|
89
|
+
alignSelf,
|
|
56
90
|
position,
|
|
57
91
|
top,
|
|
58
92
|
bottom,
|
|
@@ -64,11 +98,14 @@ var Box = ({
|
|
|
64
98
|
maxWidth,
|
|
65
99
|
maxHeight,
|
|
66
100
|
flex,
|
|
101
|
+
flexShrink,
|
|
102
|
+
gap,
|
|
67
103
|
overflow,
|
|
68
104
|
zIndex,
|
|
69
105
|
hoverStyle,
|
|
70
106
|
pressStyle,
|
|
71
107
|
style,
|
|
108
|
+
disabled,
|
|
72
109
|
"data-testid": dataTestId,
|
|
73
110
|
testID,
|
|
74
111
|
as,
|
|
@@ -107,14 +144,18 @@ var Box = ({
|
|
|
107
144
|
marginLeft,
|
|
108
145
|
marginRight,
|
|
109
146
|
flexDirection,
|
|
147
|
+
flexWrap,
|
|
110
148
|
alignItems,
|
|
111
149
|
justifyContent,
|
|
150
|
+
alignSelf,
|
|
112
151
|
position,
|
|
113
152
|
top,
|
|
114
153
|
bottom,
|
|
115
154
|
left,
|
|
116
155
|
right,
|
|
117
156
|
flex,
|
|
157
|
+
flexShrink,
|
|
158
|
+
gap: toGapValue(gap),
|
|
118
159
|
...style
|
|
119
160
|
});
|
|
120
161
|
const finalTestID = dataTestId || testID;
|
|
@@ -123,15 +164,25 @@ var Box = ({
|
|
|
123
164
|
tabIndex,
|
|
124
165
|
onKeyDown,
|
|
125
166
|
onKeyUp,
|
|
126
|
-
"aria-label":
|
|
167
|
+
"aria-label": ariaLabel,
|
|
127
168
|
"aria-labelledby": _ariaLabelledBy,
|
|
128
169
|
"aria-current": _ariaCurrent,
|
|
129
|
-
"aria-disabled":
|
|
130
|
-
"aria-live":
|
|
170
|
+
"aria-disabled": ariaDisabled,
|
|
171
|
+
"aria-live": ariaLive,
|
|
172
|
+
"aria-busy": ariaBusy,
|
|
131
173
|
className,
|
|
132
174
|
"data-testid": _dataTestId,
|
|
175
|
+
cursor: _cursor,
|
|
176
|
+
type: _type,
|
|
133
177
|
...nativeRest
|
|
134
178
|
} = rest;
|
|
179
|
+
const accessibilityRole = typeof role === "string" && roleToAccessibilityRole[role] || (as === "button" ? "button" : void 0);
|
|
180
|
+
const isDisabled = Boolean(disabled || ariaDisabled);
|
|
181
|
+
const accessibilityState = {
|
|
182
|
+
disabled: isDisabled || void 0,
|
|
183
|
+
busy: Boolean(ariaBusy) || void 0
|
|
184
|
+
};
|
|
185
|
+
const accessibilityLiveRegion = ariaLive === "polite" || ariaLive === "assertive" ? ariaLive : void 0;
|
|
135
186
|
if (as === "img" && src) {
|
|
136
187
|
const imageStyle = {
|
|
137
188
|
width,
|
|
@@ -150,16 +201,18 @@ var Box = ({
|
|
|
150
201
|
source: { uri: src },
|
|
151
202
|
style: imageStyle,
|
|
152
203
|
testID: finalTestID,
|
|
204
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : alt,
|
|
153
205
|
resizeMode: "cover",
|
|
154
206
|
...nativeRest
|
|
155
207
|
}
|
|
156
208
|
);
|
|
157
209
|
}
|
|
158
|
-
if (onPress) {
|
|
210
|
+
if (onPress || as === "button") {
|
|
159
211
|
return /* @__PURE__ */ jsx(
|
|
160
212
|
Pressable,
|
|
161
213
|
{
|
|
162
|
-
onPress,
|
|
214
|
+
onPress: !isDisabled && onPress ? onPress : void 0,
|
|
215
|
+
disabled: isDisabled,
|
|
163
216
|
onLayout,
|
|
164
217
|
onMoveShouldSetResponder,
|
|
165
218
|
onResponderGrant,
|
|
@@ -168,6 +221,10 @@ var Box = ({
|
|
|
168
221
|
onResponderTerminate,
|
|
169
222
|
style: ({ pressed }) => getContainerStyle(pressed),
|
|
170
223
|
testID: finalTestID,
|
|
224
|
+
accessibilityRole,
|
|
225
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
|
|
226
|
+
accessibilityState,
|
|
227
|
+
accessibilityLiveRegion,
|
|
171
228
|
...nativeRest,
|
|
172
229
|
children
|
|
173
230
|
}
|
|
@@ -184,6 +241,10 @@ var Box = ({
|
|
|
184
241
|
onResponderMove,
|
|
185
242
|
onResponderRelease,
|
|
186
243
|
onResponderTerminate,
|
|
244
|
+
accessibilityRole,
|
|
245
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
|
|
246
|
+
accessibilityState,
|
|
247
|
+
accessibilityLiveRegion,
|
|
187
248
|
...nativeRest,
|
|
188
249
|
children
|
|
189
250
|
}
|