@xsolla/xui-status-dropdown 0.198.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 +5 -5
package/native/index.mjs
CHANGED
|
@@ -8,6 +8,38 @@ import {
|
|
|
8
8
|
Image
|
|
9
9
|
} from "react-native";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var roleToAccessibilityRole = {
|
|
12
|
+
button: "button",
|
|
13
|
+
link: "link",
|
|
14
|
+
img: "image",
|
|
15
|
+
image: "image",
|
|
16
|
+
summary: "summary",
|
|
17
|
+
switch: "switch",
|
|
18
|
+
checkbox: "checkbox",
|
|
19
|
+
radio: "radio",
|
|
20
|
+
heading: "header",
|
|
21
|
+
text: "text",
|
|
22
|
+
search: "search",
|
|
23
|
+
alert: "alert",
|
|
24
|
+
none: "none",
|
|
25
|
+
presentation: "none",
|
|
26
|
+
progressbar: "progressbar",
|
|
27
|
+
scrollbar: "scrollbar",
|
|
28
|
+
adjustable: "adjustable",
|
|
29
|
+
tab: "tab",
|
|
30
|
+
menu: "menu",
|
|
31
|
+
menuitem: "menuitem",
|
|
32
|
+
list: "list",
|
|
33
|
+
timer: "timer"
|
|
34
|
+
};
|
|
35
|
+
var toGapValue = (gap) => {
|
|
36
|
+
if (gap === void 0) return void 0;
|
|
37
|
+
if (typeof gap === "number") return gap;
|
|
38
|
+
const pxMatch = /^(\d+(?:\.\d+)?)px$/.exec(gap);
|
|
39
|
+
if (pxMatch) return Number(pxMatch[1]);
|
|
40
|
+
const asNumber = Number(gap);
|
|
41
|
+
return Number.isFinite(asNumber) ? asNumber : void 0;
|
|
42
|
+
};
|
|
11
43
|
var Box = ({
|
|
12
44
|
children,
|
|
13
45
|
onPress,
|
|
@@ -40,8 +72,10 @@ var Box = ({
|
|
|
40
72
|
marginLeft,
|
|
41
73
|
marginRight,
|
|
42
74
|
flexDirection,
|
|
75
|
+
flexWrap,
|
|
43
76
|
alignItems,
|
|
44
77
|
justifyContent,
|
|
78
|
+
alignSelf,
|
|
45
79
|
position,
|
|
46
80
|
top,
|
|
47
81
|
bottom,
|
|
@@ -53,11 +87,14 @@ var Box = ({
|
|
|
53
87
|
maxWidth,
|
|
54
88
|
maxHeight,
|
|
55
89
|
flex,
|
|
90
|
+
flexShrink,
|
|
91
|
+
gap,
|
|
56
92
|
overflow,
|
|
57
93
|
zIndex,
|
|
58
94
|
hoverStyle,
|
|
59
95
|
pressStyle,
|
|
60
96
|
style,
|
|
97
|
+
disabled,
|
|
61
98
|
"data-testid": dataTestId,
|
|
62
99
|
testID,
|
|
63
100
|
as,
|
|
@@ -96,14 +133,18 @@ var Box = ({
|
|
|
96
133
|
marginLeft,
|
|
97
134
|
marginRight,
|
|
98
135
|
flexDirection,
|
|
136
|
+
flexWrap,
|
|
99
137
|
alignItems,
|
|
100
138
|
justifyContent,
|
|
139
|
+
alignSelf,
|
|
101
140
|
position,
|
|
102
141
|
top,
|
|
103
142
|
bottom,
|
|
104
143
|
left,
|
|
105
144
|
right,
|
|
106
145
|
flex,
|
|
146
|
+
flexShrink,
|
|
147
|
+
gap: toGapValue(gap),
|
|
107
148
|
...style
|
|
108
149
|
});
|
|
109
150
|
const finalTestID = dataTestId || testID;
|
|
@@ -112,15 +153,25 @@ var Box = ({
|
|
|
112
153
|
tabIndex,
|
|
113
154
|
onKeyDown,
|
|
114
155
|
onKeyUp,
|
|
115
|
-
"aria-label":
|
|
156
|
+
"aria-label": ariaLabel,
|
|
116
157
|
"aria-labelledby": _ariaLabelledBy,
|
|
117
158
|
"aria-current": _ariaCurrent,
|
|
118
|
-
"aria-disabled":
|
|
119
|
-
"aria-live":
|
|
159
|
+
"aria-disabled": ariaDisabled,
|
|
160
|
+
"aria-live": ariaLive,
|
|
161
|
+
"aria-busy": ariaBusy,
|
|
120
162
|
className,
|
|
121
163
|
"data-testid": _dataTestId,
|
|
164
|
+
cursor: _cursor,
|
|
165
|
+
type: _type,
|
|
122
166
|
...nativeRest
|
|
123
167
|
} = rest;
|
|
168
|
+
const accessibilityRole = typeof role === "string" && roleToAccessibilityRole[role] || (as === "button" ? "button" : void 0);
|
|
169
|
+
const isDisabled = Boolean(disabled || ariaDisabled);
|
|
170
|
+
const accessibilityState = {
|
|
171
|
+
disabled: isDisabled || void 0,
|
|
172
|
+
busy: Boolean(ariaBusy) || void 0
|
|
173
|
+
};
|
|
174
|
+
const accessibilityLiveRegion = ariaLive === "polite" || ariaLive === "assertive" ? ariaLive : void 0;
|
|
124
175
|
if (as === "img" && src) {
|
|
125
176
|
const imageStyle = {
|
|
126
177
|
width,
|
|
@@ -139,16 +190,18 @@ var Box = ({
|
|
|
139
190
|
source: { uri: src },
|
|
140
191
|
style: imageStyle,
|
|
141
192
|
testID: finalTestID,
|
|
193
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : alt,
|
|
142
194
|
resizeMode: "cover",
|
|
143
195
|
...nativeRest
|
|
144
196
|
}
|
|
145
197
|
);
|
|
146
198
|
}
|
|
147
|
-
if (onPress) {
|
|
199
|
+
if (onPress || as === "button") {
|
|
148
200
|
return /* @__PURE__ */ jsx(
|
|
149
201
|
Pressable,
|
|
150
202
|
{
|
|
151
|
-
onPress,
|
|
203
|
+
onPress: !isDisabled && onPress ? onPress : void 0,
|
|
204
|
+
disabled: isDisabled,
|
|
152
205
|
onLayout,
|
|
153
206
|
onMoveShouldSetResponder,
|
|
154
207
|
onResponderGrant,
|
|
@@ -157,6 +210,10 @@ var Box = ({
|
|
|
157
210
|
onResponderTerminate,
|
|
158
211
|
style: ({ pressed }) => getContainerStyle(pressed),
|
|
159
212
|
testID: finalTestID,
|
|
213
|
+
accessibilityRole,
|
|
214
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
|
|
215
|
+
accessibilityState,
|
|
216
|
+
accessibilityLiveRegion,
|
|
160
217
|
...nativeRest,
|
|
161
218
|
children
|
|
162
219
|
}
|
|
@@ -173,6 +230,10 @@ var Box = ({
|
|
|
173
230
|
onResponderMove,
|
|
174
231
|
onResponderRelease,
|
|
175
232
|
onResponderTerminate,
|
|
233
|
+
accessibilityRole,
|
|
234
|
+
accessibilityLabel: typeof ariaLabel === "string" ? ariaLabel : void 0,
|
|
235
|
+
accessibilityState,
|
|
236
|
+
accessibilityLiveRegion,
|
|
176
237
|
...nativeRest,
|
|
177
238
|
children
|
|
178
239
|
}
|